Add support for OMAPI KEY configuration.

This commit is contained in:
mellon 2004-03-30 19:39:39 +00:00
parent 700791bc6c
commit 40a59b47b4
1 changed files with 34 additions and 19 deletions

View File

@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: clparse.c,v 1.5 2003/10/24 05:19:31 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: clparse.c,v 1.6 2004/03/30 19:39:39 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -88,8 +88,8 @@ isc_result_t read_client_conf ()
top_level_config.bootp_policy = P_ACCEPT;
top_level_config.script_name = path_dhclient_script;
top_level_config.requested_options = default_requested_options;
top_level_config.omapi_port = -1;
top_level_config.do_forward_update = 1;
top_level_config.omapi_port = -1;
group_allocate (&top_level_config.on_receipt, MDL);
if (!top_level_config.on_receipt)
@ -440,27 +440,42 @@ void parse_client_statement (cfile, ip, config)
case OMAPI:
token = next_token (&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile);
if (token != PORT) {
if (config != &top_level_config) {
parse_warn (cfile,
"unexpected omapi subtype: %s", val);
"omapi info must be at top level.");
skip_to_semi (cfile);
return;
}
if (token == PORT) {
token = next_token (&val, (unsigned *)0, cfile);
if (token != NUMBER) {
parse_warn (cfile, "invalid port number: `%s'", val);
parse_warn (cfile,
"invalid port number: `%s'", val);
skip_to_semi (cfile);
return;
}
tmp = atoi (val);
if (tmp < 0 || tmp > 65535)
parse_warn (cfile, "invalid omapi port %d.", tmp);
else if (config != &top_level_config)
parse_warn (cfile,
"omapi port only works at top level.");
else
"invalid omapi port %d.", tmp);
config -> omapi_port = tmp;
parse_semi (cfile);
} else if (token == KEY) {
token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING && !is_identifier (token)) {
parse_warn (cfile, "expecting key name.");
skip_to_semi (cfile);
break;
}
if (omapi_auth_key_lookup_name (&config -> omapi_key,
val) != ISC_R_SUCCESS)
parse_warn (cfile, "unknown key %s", val);
parse_semi (cfile);
} else {
parse_warn (cfile,
"unexpected omapi subtype: %s", val);
skip_to_semi (cfile);
}
return;
case DO_FORWARD_UPDATE: