1 /* $NetBSD: zonekey.c,v 1.4 2014/12/10 04:37:58 christos Exp $ */
4 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 2001, 2003 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: zonekey.c,v 1.9 2007/06/19 23:47:16 tbox Exp */
26 #include <isc/result.h>
27 #include <isc/types.h>
30 #include <dns/keyvalues.h>
31 #include <dns/rdata.h>
32 #include <dns/rdatastruct.h>
33 #include <dns/types.h>
34 #include <dns/zonekey.h>
37 dns_zonekey_iszonekey(dns_rdata_t
*keyrdata
) {
39 dns_rdata_dnskey_t key
;
40 isc_boolean_t iszonekey
= ISC_TRUE
;
42 REQUIRE(keyrdata
!= NULL
);
44 result
= dns_rdata_tostruct(keyrdata
, &key
, NULL
);
45 if (result
!= ISC_R_SUCCESS
)
48 if ((key
.flags
& DNS_KEYTYPE_NOAUTH
) != 0)
49 iszonekey
= ISC_FALSE
;
50 if ((key
.flags
& DNS_KEYFLAG_OWNERMASK
) != DNS_KEYOWNER_ZONE
)
51 iszonekey
= ISC_FALSE
;
52 if (key
.protocol
!= DNS_KEYPROTO_DNSSEC
&&
53 key
.protocol
!= DNS_KEYPROTO_ANY
)
54 iszonekey
= ISC_FALSE
;