keytable.c revision fd4dcaddae08b0fb28b0ec4faf26a9d8b1f923ca
/*
* Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: keytable.c,v 1.38 2009/07/13 23:47:42 tbox Exp $ */
/*! \file */
#include <config.h>
#include <dns/keytable.h>
#include <dns/fixedname.h>
static void
}
/*
* Create a keytable.
*/
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS)
goto cleanup_keytable;
if (result != ISC_R_SUCCESS)
goto cleanup_rbt;
if (result != ISC_R_SUCCESS)
goto cleanup_lock;
keytable->active_nodes = 0;
return (ISC_R_SUCCESS);
return (result);
}
void
/*
* Attach *targetp to source.
*/
source->references++;
}
void
/*
* Detach *keytablep from its keytable.
*/
keytable->references--;
if (destroy) {
}
}
static isc_result_t
{
if (result != ISC_R_SUCCESS)
return (result);
if (result == ISC_R_EXISTS) {
/* Key already in table? */
dns_keynode_t *k;
break;
}
break;
}
if (k == NULL)
else
}
if (result == ISC_R_SUCCESS) {
}
}
if (result == ISC_R_SUCCESS) {
}
/* Key was already there? That's the same as a success */
if (result == ISC_R_EXISTS)
return (result);
}
{
}
}
if (result == ISC_R_SUCCESS) {
else
} else if (result == DNS_R_PARTIALMATCH)
return (result);
}
if (result == DNS_R_PARTIALMATCH)
if (result != ISC_R_SUCCESS)
goto finish;
goto finish;
}
goto finish;
}
break;
}
/*
* This is equivalent to:
* dns_keynode_attach(knode->next, &tmp);
* dns_keynode_detach(kprev);
* dns_keynode_attach(tmp, &kprev);
* dns_keynode_detach(&tmp);
*/
} else
return (result);
}
{
if (result == ISC_R_SUCCESS) {
keytable->active_nodes++;
} else
} else if (result == DNS_R_PARTIALMATCH)
return (result);
}
{
/*
* Return the next key after 'keynode', regardless of
* properties.
*/
return (ISC_R_NOTFOUND);
keytable->active_nodes++;
return (ISC_R_SUCCESS);
}
{
void *data;
/*
* Search for a key named 'name', matching 'algorithm' and 'tag' in
* 'keytable'.
*/
/*
* Note we don't want the DNS_R_PARTIALMATCH from dns_rbt_findname()
* as that indicates that 'name' was not found.
*
* DNS_R_PARTIALMATCH indicates that the name was found but we
* didn't get a match on algorithm and key id arguments.
*/
if (result == ISC_R_SUCCESS) {
break;
}
break;
}
keytable->active_nodes++;
} else
} else if (result == DNS_R_PARTIALMATCH)
return (result);
}
{
/*
* Search for the next key with the same properties as 'keynode' in
* 'keytable'.
*/
break;
}
break;
}
keytable->active_nodes++;
} else
return (result);
}
{
void *data;
/*
* Search for the deepest match in 'keytable'.
*/
return (result);
}
void
{
/*
* Give back a keynode found via dns_keytable_findkeynode().
*/
keytable->active_nodes--;
}
{
void *data;
/*
* Is 'name' at or beneath a trusted key?
*/
*wantdnssecp = ISC_TRUE;
} else if (result == ISC_R_NOTFOUND) {
*wantdnssecp = ISC_FALSE;
}
return (result);
}
/*
* Get the DST key associated with keynode.
*/
}
/*
* Is this a managed key?
*/
}
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_SUCCESS);
}
void
}
void
unsigned int refs;
if (refs == 0) {
}
}