dnsconf.c revision 6f7abb89ec22aef5eda40ed60fcf605a42b78d4d
/*
* Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
*
* 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: dnsconf.c,v 1.3 2009/09/02 23:48:02 tbox 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);
}