zonekey.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 2001, 2003  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: zonekey.c,v 1.9 2007/06/19 23:47:16 tbox Exp $ */
00019 
00020 /*! \file */
00021 
00022 #include <config.h>
00023 
00024 #include <isc/result.h>
00025 #include <isc/types.h>
00026 #include <isc/util.h>
00027 
00028 #include <dns/keyvalues.h>
00029 #include <dns/rdata.h>
00030 #include <dns/rdatastruct.h>
00031 #include <dns/types.h>
00032 #include <dns/zonekey.h>
00033 
00034 isc_boolean_t
00035 dns_zonekey_iszonekey(dns_rdata_t *keyrdata) {
00036         isc_result_t result;
00037         dns_rdata_dnskey_t key;
00038         isc_boolean_t iszonekey = ISC_TRUE;
00039 
00040         REQUIRE(keyrdata != NULL);
00041 
00042         result = dns_rdata_tostruct(keyrdata, &key, NULL);
00043         if (result != ISC_R_SUCCESS)
00044                 return (ISC_FALSE);
00045 
00046         if ((key.flags & DNS_KEYTYPE_NOAUTH) != 0)
00047                 iszonekey = ISC_FALSE;
00048         if ((key.flags & DNS_KEYFLAG_OWNERMASK) != DNS_KEYOWNER_ZONE)
00049                 iszonekey = ISC_FALSE;
00050         if (key.protocol != DNS_KEYPROTO_DNSSEC &&
00051         key.protocol != DNS_KEYPROTO_ANY)
00052                 iszonekey = ISC_FALSE;
00053         
00054         return (iszonekey);
00055 }

Generated on Tue Apr 28 17:41:03 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha