* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: config.c,v 1.9 2001/06/04 21:51:23 bwelling Exp $ */
+/* $Id: config.c,v 1.10 2001/08/03 18:12:04 bwelling Exp $ */
#include <config.h>
#include <dns/fixedname.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
+#include <dns/tsig.h>
#include <dns/zone.h>
#include <named/config.h>
*portp = (in_port_t)cfg_obj_asuint32(portobj);
return (ISC_R_SUCCESS);
}
+
+isc_result_t
+ns_config_getkeyalgorithm(const char *str, dns_name_t **name)
+{
+ if (strcasecmp(str, "hmac-md5") == 0 ||
+ strcasecmp(str, "hmac-md5.sig-alg.reg.int") == 0 ||
+ strcasecmp(str, "hmac-md5.sig-alg.reg.int.") == 0)
+ {
+ if (name != NULL)
+ *name = dns_tsig_hmacmd5_name;
+ return (ISC_R_SUCCESS);
+ }
+ return (ISC_R_NOTFOUND);
+}
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: controlconf.c,v 1.20 2001/08/03 18:03:02 gson Exp $ */
+/* $Id: controlconf.c,v 1.21 2001/08/03 18:12:05 bwelling Exp $ */
#include <config.h>
#include <dst/dst.h>
+#include <named/config.h>
#include <named/control.h>
#include <named/log.h>
#include <named/server.h>
algstr = cfg_obj_asstring(algobj);
secretstr = cfg_obj_asstring(secretobj);
- if (strcasecmp(algstr, "hmac-md5") != 0) {
+ if (ns_config_getkeyalgorithm(algstr, NULL) !=
+ ISC_R_SUCCESS)
+ {
cfg_obj_log(control, ns_g_lctx,
ISC_LOG_WARNING,
"unsupported algorithm '%s' in "
algstr = cfg_obj_asstring(algobj);
secretstr = cfg_obj_asstring(secretobj);
- if (strcasecmp(algstr, "hmac-md5") != 0) {
+ if (ns_config_getkeyalgorithm(algstr, NULL) != ISC_R_SUCCESS) {
cfg_obj_log(key, ns_g_lctx,
ISC_LOG_WARNING,
"unsupported algorithm '%s' in "
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: config.h,v 1.1 2001/03/04 21:21:32 bwelling Exp $ */
+/* $Id: config.h,v 1.2 2001/08/03 18:12:08 bwelling Exp $ */
-/* $Id: config.h,v 1.1 2001/03/04 21:21:32 bwelling Exp $ */
+/* $Id: config.h,v 1.2 2001/08/03 18:12:08 bwelling Exp $ */
#ifndef NAMED_CONFIG_H
#define NAMED_CONFIG_H 1
isc_result_t
ns_config_getport(cfg_obj_t *config, in_port_t *portp);
+isc_result_t
+ns_config_getkeyalgorithm(const char *str, dns_name_t **name);
+
#endif /* NAMED_CONFIG_H */
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: tsigconf.c,v 1.19 2001/07/26 20:54:34 bwelling Exp $ */
+/* $Id: tsigconf.c,v 1.20 2001/08/03 18:12:06 bwelling Exp $ */
#include <config.h>
* Create the algorithm.
*/
algstr = cfg_obj_asstring(algobj);
- if (strcasecmp(algstr, "hmac-md5") == 0 ||
- strcasecmp(algstr, "hmac-md5.sig-alg.reg.int") ||
- strcasecmp(algstr, "hmac-md5.sig-alg.reg.int."))
- alg = dns_tsig_hmacmd5_name;
- else {
+ if (ns_config_getkeyalgorithm(algstr, &alg) != ISC_R_SUCCESS) {
cfg_obj_log(algobj, ns_g_lctx, ISC_LOG_ERROR,
"key '%s': the only supported algorithm "
"is hmac-md5", keyid);