dnsconf.c revision 307d2084502eddc7ce921e5ce439aec3531d90e0
/*
* Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
*
* This code is derived from software contributed to ISC by
* Berkeley Software Design, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* 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 AND BERKELEY SOFTWARE DESIGN, INC.
* 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: dnsconf.c,v 1.2 2009/09/01 00:22:27 jinmei Exp $ */
/*! \file */
#include <config.h>
#include <string.h>
#include <dns/fixedname.h>
#include <dns/rdatastruct.h>
/*!
* configuration data structure
*/
struct irs_dnsconf {
unsigned int magic;
};
static isc_result_t
{
const char *keystr, *keynamestr;
unsigned char keydata[4096];
unsigned char rrdata[4096];
isc_region_t r;
return (ISC_R_SUCCESS);
{
keydatabuf = NULL;
"protocol"));
"algorithm"));
"name"));
if (flags > 0xffff)
return (ISC_R_RANGE);
if (proto > 0xff)
return (ISC_R_RANGE);
if (alg > 0xff)
return (ISC_R_RANGE);
sizeof(keydata));
/* Configure key value */
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_usedregion(&rrdatabuf, &r);
r.length);
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
goto cleanup;
/* Configure key name */
strlen(keynamestr));
dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);
goto cleanup;
}
if (result != ISC_R_SUCCESS)
goto cleanup;
/* Add the key data to the list */
goto cleanup;
}
}
}
return (ISC_R_SUCCESS);
if (keydatabuf != NULL)
return (result);
}
{
return (ISC_R_NOMEMORY);
/*
* If the specified file does not exist, we'll simply with an empty
* configuration.
*/
if (!isc_file_exists(filename))
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
&cfgobj);
if (result != ISC_R_SUCCESS)
goto cleanup;
}
if (result == ISC_R_SUCCESS)
else
return (result);
}
void
}
}
return (&conf->trusted_keylist);
}