2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-29 05:17:57 +00:00

- Silence benign static analysis warnings.

[ISC-Bugs #33428]
This commit is contained in:
Mark Andrews 2013-05-15 10:49:54 +10:00
parent 7133470475
commit dc9d7b08aa
26 changed files with 417 additions and 326 deletions

View File

@ -60,6 +60,9 @@ work on other platforms. Please report any problems and suggested fixes to
Changes since 4.2.5 Changes since 4.2.5
- Silence benign static analysis warnings.
[ISC-Bugs #33428]
- Add check for 64-bit package for atf. - Add check for 64-bit package for atf.
[ISC-Bugs #32206] [ISC-Bugs #32206]

View File

@ -3,7 +3,7 @@
Parser for dhclient config and lease files... */ Parser for dhclient config and lease files... */
/* /*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1996-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -241,7 +241,7 @@ int read_client_conf_file (const char *name, struct interface_info *ip,
break; break;
parse_client_statement (cfile, ip, client); parse_client_statement (cfile, ip, client);
} while (1); } while (1);
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
status = (cfile -> warnings_occurred status = (cfile -> warnings_occurred
? DHCP_R_BADPARSE ? DHCP_R_BADPARSE
: ISC_R_SUCCESS); : ISC_R_SUCCESS);
@ -341,7 +341,7 @@ void parse_client_statement (cfile, ip, config)
switch (peek_token (&val, (unsigned *)0, cfile)) { switch (peek_token (&val, (unsigned *)0, cfile)) {
case INCLUDE: case INCLUDE:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING) { if (token != STRING) {
parse_warn (cfile, "filename string expected."); parse_warn (cfile, "filename string expected.");
@ -355,7 +355,7 @@ void parse_client_statement (cfile, ip, config)
return; return;
case KEY: case KEY:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (ip) { if (ip) {
/* This may seem arbitrary, but there's a reason for /* This may seem arbitrary, but there's a reason for
doing it: the authentication key database is not doing it: the authentication key database is not
@ -378,7 +378,7 @@ void parse_client_statement (cfile, ip, config)
case TOKEN_ALSO: case TOKEN_ALSO:
/* consume ALSO */ /* consume ALSO */
next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
/* consume type of ALSO list. */ /* consume type of ALSO list. */
token = next_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile);
@ -446,7 +446,7 @@ void parse_client_statement (cfile, ip, config)
/* REQUIRE can either start a policy statement or a /* REQUIRE can either start a policy statement or a
comma-separated list of names of required options. */ comma-separated list of names of required options. */
case REQUIRE: case REQUIRE:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == AUTHENTICATION) { if (token == AUTHENTICATION) {
policy = P_REQUIRE; policy = P_REQUIRE;
@ -456,22 +456,22 @@ void parse_client_statement (cfile, ip, config)
return; return;
case IGNORE: case IGNORE:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
policy = P_IGNORE; policy = P_IGNORE;
goto do_policy; goto do_policy;
case ACCEPT: case ACCEPT:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
policy = P_ACCEPT; policy = P_ACCEPT;
goto do_policy; goto do_policy;
case PREFER: case PREFER:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
policy = P_PREFER; policy = P_PREFER;
goto do_policy; goto do_policy;
case DONT: case DONT:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
policy = P_DONT; policy = P_DONT;
goto do_policy; goto do_policy;
@ -504,8 +504,7 @@ void parse_client_statement (cfile, ip, config)
break; break;
case OPTION: case OPTION:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == SPACE) { if (token == SPACE) {
if (ip) { if (ip) {
@ -556,12 +555,12 @@ void parse_client_statement (cfile, ip, config)
return; return;
case MEDIA: case MEDIA:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_string_list (cfile, &config -> media, 1); parse_string_list (cfile, &config -> media, 1);
return; return;
case HARDWARE: case HARDWARE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (ip) { if (ip) {
parse_hardware_param (cfile, &ip -> hw_address); parse_hardware_param (cfile, &ip -> hw_address);
} else { } else {
@ -572,7 +571,7 @@ void parse_client_statement (cfile, ip, config)
return; return;
case ANYCAST_MAC: case ANYCAST_MAC:
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
if (ip != NULL) { if (ip != NULL) {
parse_hardware_param(cfile, &ip->anycast_mac_addr); parse_hardware_param(cfile, &ip->anycast_mac_addr);
} else { } else {
@ -583,29 +582,29 @@ void parse_client_statement (cfile, ip, config)
return; return;
case REQUEST: case REQUEST:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (config -> requested_options == default_requested_options) if (config -> requested_options == default_requested_options)
config -> requested_options = NULL; config -> requested_options = NULL;
parse_option_list (cfile, &config -> requested_options); parse_option_list (cfile, &config -> requested_options);
return; return;
case TIMEOUT: case TIMEOUT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> timeout); parse_lease_time (cfile, &config -> timeout);
return; return;
case RETRY: case RETRY:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> retry_interval); parse_lease_time (cfile, &config -> retry_interval);
return; return;
case SELECT_TIMEOUT: case SELECT_TIMEOUT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> select_interval); parse_lease_time (cfile, &config -> select_interval);
return; return;
case OMAPI: case OMAPI:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != PORT) { if (token != PORT) {
parse_warn (cfile, parse_warn (cfile,
@ -631,7 +630,7 @@ void parse_client_statement (cfile, ip, config)
return; return;
case DO_FORWARD_UPDATE: case DO_FORWARD_UPDATE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (!strcasecmp (val, "on") || if (!strcasecmp (val, "on") ||
!strcasecmp (val, "true")) !strcasecmp (val, "true"))
@ -648,32 +647,32 @@ void parse_client_statement (cfile, ip, config)
return; return;
case REBOOT: case REBOOT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> reboot_timeout); parse_lease_time (cfile, &config -> reboot_timeout);
return; return;
case BACKOFF_CUTOFF: case BACKOFF_CUTOFF:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> backoff_cutoff); parse_lease_time (cfile, &config -> backoff_cutoff);
return; return;
case INITIAL_INTERVAL: case INITIAL_INTERVAL:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> initial_interval); parse_lease_time (cfile, &config -> initial_interval);
return; return;
case INITIAL_DELAY: case INITIAL_DELAY:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> initial_delay); parse_lease_time (cfile, &config -> initial_delay);
return; return;
case SCRIPT: case SCRIPT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_string (cfile, &config -> script_name, (unsigned *)0); parse_string (cfile, &config -> script_name, (unsigned *)0);
return; return;
case VENDOR: case VENDOR:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != OPTION) { if (token != OPTION) {
parse_warn (cfile, "expecting 'vendor option space'"); parse_warn (cfile, "expecting 'vendor option space'");
@ -708,14 +707,14 @@ void parse_client_statement (cfile, ip, config)
return; return;
case INTERFACE: case INTERFACE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (ip) if (ip)
parse_warn (cfile, "nested interface declaration."); parse_warn (cfile, "nested interface declaration.");
parse_interface_declaration (cfile, config, (char *)0); parse_interface_declaration (cfile, config, (char *)0);
return; return;
case PSEUDO: case PSEUDO:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
name = dmalloc (strlen (val) + 1, MDL); name = dmalloc (strlen (val) + 1, MDL);
if (!name) if (!name)
@ -725,17 +724,17 @@ void parse_client_statement (cfile, ip, config)
return; return;
case LEASE: case LEASE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_client_lease_statement (cfile, 1); parse_client_lease_statement (cfile, 1);
return; return;
case ALIAS: case ALIAS:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_client_lease_statement (cfile, 2); parse_client_lease_statement (cfile, 2);
return; return;
case REJECT: case REJECT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_reject_statement (cfile, config); parse_reject_statement (cfile, config);
return; return;
@ -806,7 +805,7 @@ parse_option_list(struct parse *cfile, struct option ***list)
} }
if (!is_identifier (token)) { if (!is_identifier (token)) {
parse_warn (cfile, "%s: expected option name.", val); parse_warn (cfile, "%s: expected option name.", val);
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
skip_to_semi (cfile); skip_to_semi (cfile);
return 0; return 0;
} }
@ -922,7 +921,7 @@ void parse_interface_declaration (cfile, outer_config, name)
break; break;
parse_client_statement (cfile, ip, client -> config); parse_client_statement (cfile, ip, client -> config);
} while (1); } while (1);
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
} }
int interface_or_dummy (struct interface_info **pi, const char *name) int interface_or_dummy (struct interface_info **pi, const char *name)
@ -1049,7 +1048,7 @@ void parse_client_lease_statement (cfile, is_static)
break; break;
parse_client_lease_declaration (cfile, lease, &ip, &client); parse_client_lease_declaration (cfile, lease, &ip, &client);
} while (1); } while (1);
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* If the lease declaration didn't include an interface /* If the lease declaration didn't include an interface
declaration that we recognized, it's of no use to us. */ declaration that we recognized, it's of no use to us. */

View File

@ -3,7 +3,7 @@
DHCP Client. */ DHCP Client. */
/* /*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -399,7 +399,6 @@ main(int argc, char **argv) {
long temp; long temp;
int e; int e;
oldpid = 0;
if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) { if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) {
e = fscanf(pidfd, "%ld\n", &temp); e = fscanf(pidfd, "%ld\n", &temp);
oldpid = (pid_t)temp; oldpid = (pid_t)temp;
@ -3470,17 +3469,17 @@ void go_daemon ()
else if (pid) else if (pid)
exit (0); exit (0);
/* Become session leader and get pid... */ /* Become session leader and get pid... */
pid = setsid (); (void) setsid ();
/* Close standard I/O descriptors. */ /* Close standard I/O descriptors. */
close(0); (void) close(0);
close(1); (void) close(1);
close(2); (void) close(2);
/* Reopen them on /dev/null. */ /* Reopen them on /dev/null. */
open("/dev/null", O_RDWR); (void) open("/dev/null", O_RDWR);
open("/dev/null", O_RDWR); (void) open("/dev/null", O_RDWR);
open("/dev/null", O_RDWR); (void) open("/dev/null", O_RDWR);
write_client_pid_file (); write_client_pid_file ();
@ -4037,6 +4036,7 @@ client_dns_update(struct client_state *client, dhcp_ddns_cb_t *ddns_cb)
* MAC address. * MAC address.
*/ */
result = 0; result = 0;
POST(result);
memset(&client_identifier, 0, sizeof(client_identifier)); memset(&client_identifier, 0, sizeof(client_identifier));
if (client->active_lease != NULL) { if (client->active_lease != NULL) {
if (((oc = if (((oc =

View File

@ -3,7 +3,7 @@
Memory allocation... */ Memory allocation... */
/* /*
* Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1996-2003 by Internet Software Consortium
* *
@ -143,7 +143,6 @@ int option_chain_head_dereference (ptr, file, line)
option_cache_dereference ((struct option_cache **) option_cache_dereference ((struct option_cache **)
(&car -> car), MDL); (&car -> car), MDL);
dfree (car, MDL); dfree (car, MDL);
car = cdr;
} }
dfree (option_chain_head, file, line); dfree (option_chain_head, file, line);

View File

@ -3,7 +3,7 @@
Lexical scanner for dhcpd config file... */ Lexical scanner for dhcpd config file... */
/* /*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -534,7 +534,6 @@ static enum dhcp_token read_string (cfile)
goto again; goto again;
default: default:
cfile -> tokbuf [i] = c; cfile -> tokbuf [i] = c;
bs = 0;
break; break;
} }
bs = 0; bs = 0;

View File

@ -3,7 +3,7 @@
Support for executable statements. */ Support for executable statements. */
/* /*
* Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1998-2003 by Internet Software Consortium * Copyright (c) 1998-2003 by Internet Software Consortium
* *
@ -181,6 +181,8 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: evaluate: %s", log_debug ("exec: evaluate: %s",
(status ? "succeeded" : "failed")); (status ? "succeeded" : "failed"));
#else
POST(status);
#endif #endif
break; break;
@ -272,6 +274,8 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: return: %s", log_debug ("exec: return: %s",
(status ? "succeeded" : "failed")); (status ? "succeeded" : "failed"));
#else
POST(status);
#endif #endif
break; break;
@ -331,20 +335,20 @@ int execute_statements (result, packet, lease, client_state,
if (!scope) { if (!scope) {
log_error("set %s: no scope", log_error("set %s: no scope",
r->data.set.name); r->data.set.name);
status = 0;
break; break;
} }
if (!*scope) { if (!*scope) {
if (!binding_scope_allocate(scope, MDL)) { if (!binding_scope_allocate(scope, MDL)) {
log_error("set %s: can't allocate scope", log_error("set %s: can't allocate scope",
r->data.set.name); r->data.set.name);
status = 0;
break; break;
} }
} }
binding = find_binding(*scope, r->data.set.name); binding = find_binding(*scope, r->data.set.name);
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
log_debug("exec: set %s", r->data.set.name); log_debug("exec: set %s", r->data.set.name);
#else
POST(status);
#endif #endif
if (binding == NULL) { if (binding == NULL) {
binding = dmalloc(sizeof(*binding), MDL); binding = dmalloc(sizeof(*binding), MDL);
@ -395,14 +399,14 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: set %s%s", r -> data.set.name, log_debug ("exec: set %s%s", r -> data.set.name,
(binding && status ? "" : " (failed)")); (binding && status ? "" : " (failed)"));
#else
POST(status);
#endif #endif
break; break;
case unset_statement: case unset_statement:
if (!scope || !*scope) { if (!scope || !*scope)
status = 0;
break; break;
}
binding = find_binding (*scope, r -> data.unset); binding = find_binding (*scope, r -> data.unset);
if (binding) { if (binding) {
if (binding -> value) if (binding -> value)
@ -414,6 +418,8 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: unset %s: %s", r -> data.unset, log_debug ("exec: unset %s: %s", r -> data.unset,
(status ? "found" : "not found")); (status ? "found" : "not found"));
#else
POST(status);
#endif #endif
break; break;
@ -463,6 +469,8 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
log_debug("exec: let %s%s", e->data.let.name, log_debug("exec: let %s%s", e->data.let.name,
(binding && status ? "" : "failed")); (binding && status ? "" : "failed"));
#else
POST(status);
#endif #endif
if (!e->data.let.statements) { if (!e->data.let.statements) {
} else if (e->data.let.statements->op == } else if (e->data.let.statements->op ==
@ -758,11 +766,11 @@ void write_statements (file, statements, indent)
} }
if (r -> data.on.evtypes & ON_COMMIT) { if (r -> data.on.evtypes & ON_COMMIT) {
fprintf (file, "%scommit", s); fprintf (file, "%scommit", s);
s = "or"; s = " or ";
} }
if (r -> data.on.evtypes & ON_RELEASE) { if (r -> data.on.evtypes & ON_RELEASE) {
fprintf (file, "%srelease", s); fprintf (file, "%srelease", s);
s = "or"; /* s = " or "; */
} }
if (r -> data.on.statements) { if (r -> data.on.statements) {
fprintf (file, " {"); fprintf (file, " {");
@ -842,7 +850,7 @@ void write_statements (file, statements, indent)
case eval_statement: case eval_statement:
indent_spaces (file, indent); indent_spaces (file, indent);
fprintf (file, "eval "); fprintf (file, "eval ");
col = write_expression (file, r -> data.eval, (void) write_expression (file, r -> data.eval,
indent + 5, indent + 5, 1); indent + 5, indent + 5, 1);
fprintf (file, ";"); fprintf (file, ";");
break; break;
@ -916,11 +924,11 @@ void write_statements (file, statements, indent)
fprintf (file, "set "); fprintf (file, "set ");
col = token_print_indent (file, indent + 4, indent + 4, col = token_print_indent (file, indent + 4, indent + 4,
"", "", r -> data.set.name); "", "", r -> data.set.name);
col = token_print_indent (file, col, indent + 4, (void) token_print_indent (file, col, indent + 4,
" ", " ", "="); " ", " ", "=");
col = write_expression (file, r -> data.set.expr, col = write_expression (file, r -> data.set.expr,
indent + 3, indent + 3, 0); indent + 3, indent + 3, 0);
col = token_print_indent (file, col, indent + 4, (void) token_print_indent (file, col, indent + 4,
" ", "", ";"); " ", "", ";");
break; break;
@ -929,7 +937,7 @@ void write_statements (file, statements, indent)
fprintf (file, "unset "); fprintf (file, "unset ");
col = token_print_indent (file, indent + 6, indent + 6, col = token_print_indent (file, indent + 6, indent + 6,
"", "", r -> data.set.name); "", "", r -> data.set.name);
col = token_print_indent (file, col, indent + 6, (void) token_print_indent (file, col, indent + 6,
" ", "", ";"); " ", "", ";");
break; break;
@ -940,29 +948,29 @@ void write_statements (file, statements, indent)
"", "", "("); "", "", "(");
switch (r -> data.log.priority) { switch (r -> data.log.priority) {
case log_priority_fatal: case log_priority_fatal:
col = token_print_indent (void) token_print_indent
(file, col, indent + 4, "", (file, col, indent + 4, "",
" ", "fatal,"); " ", "fatal,");
break; break;
case log_priority_error: case log_priority_error:
col = token_print_indent (void) token_print_indent
(file, col, indent + 4, "", (file, col, indent + 4, "",
" ", "error,"); " ", "error,");
break; break;
case log_priority_debug: case log_priority_debug:
col = token_print_indent (void) token_print_indent
(file, col, indent + 4, "", (file, col, indent + 4, "",
" ", "debug,"); " ", "debug,");
break; break;
case log_priority_info: case log_priority_info:
col = token_print_indent (void) token_print_indent
(file, col, indent + 4, "", (file, col, indent + 4, "",
" ", "info,"); " ", "info,");
break; break;
} }
col = write_expression (file, r -> data.log.expr, col = write_expression (file, r -> data.log.expr,
indent + 4, indent + 4, 0); indent + 4, indent + 4, 0);
col = token_print_indent (file, col, indent + 4, (void) token_print_indent (file, col, indent + 4,
"", "", ");"); "", "", ");");
break; break;
@ -979,7 +987,7 @@ void write_statements (file, statements, indent)
col = token_print_indent(file, col, indent + 4, "", " ", ","); col = token_print_indent(file, col, indent + 4, "", " ", ",");
col = write_expression (file, expr->data.arg.val, col, indent + 4, 0); col = write_expression (file, expr->data.arg.val, col, indent + 4, 0);
} }
col = token_print_indent(file, col, indent + 4, "", "", ");"); (void) token_print_indent(file, col, indent + 4, "", "", ");");
#else /* !ENABLE_EXECUTE */ #else /* !ENABLE_EXECUTE */
log_fatal("Impossible case at %s:%d (ENABLE_EXECUTE " log_fatal("Impossible case at %s:%d (ENABLE_EXECUTE "
"is not defined).", MDL); "is not defined).", MDL);

View File

@ -4,7 +4,7 @@
responses. */ responses. */
/* /*
* Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2011,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1996-2003 by Internet Software Consortium
* *
@ -289,17 +289,15 @@ void trace_icmp_input_stop (trace_type_t *ttype) { }
void trace_icmp_output_input (trace_type_t *ttype, unsigned length, char *buf) void trace_icmp_output_input (trace_type_t *ttype, unsigned length, char *buf)
{ {
struct icmp *icmp;
struct iaddr ia; struct iaddr ia;
if (length != (sizeof (*icmp) + (sizeof ia))) { if (length != (sizeof (struct icmp) + sizeof (ia))) {
log_error ("trace_icmp_output_input: data size mismatch %d:%d", log_error ("trace_icmp_output_input: data size mismatch %d:%d",
length, (int)((sizeof (*icmp)) + (sizeof ia))); length, (int)(sizeof (struct icmp) + sizeof (ia)));
return; return;
} }
ia.len = 4; ia.len = 4;
memcpy (ia.iabuf, buf, 4); memcpy (ia.iabuf, buf, 4);
icmp = (struct icmp *)(buf + 1);
log_error ("trace_icmp_output_input: unsent ping to %s", piaddr (ia)); log_error ("trace_icmp_output_input: unsent ping to %s", piaddr (ia));
} }

View File

@ -4,7 +4,7 @@
way... */ way... */
/* /*
* Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2011,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2007-2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2007-2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004,2005 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004,2005 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
@ -198,7 +198,6 @@ addr_match(addr, match)
if (addr->len != match->addr.len) if (addr->len != match->addr.len)
return 0; return 0;
i = 0;
for (i = 0 ; i < addr->len ; i++) { for (i = 0 ; i < addr->len ; i++) {
if ((addr->iabuf[i] & match->mask.iabuf[i]) != if ((addr->iabuf[i] & match->mask.iabuf[i]) !=
match->addr.iabuf[i]) match->addr.iabuf[i])

View File

@ -3,7 +3,7 @@
Common parser code for dhcpd and dhclient. */ Common parser code for dhcpd and dhclient. */
/* /*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -110,7 +110,7 @@ void skip_to_rbrace (cfile, brace_count)
do { do {
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == RBRACE) { if (token == RBRACE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (brace_count) { if (brace_count) {
if (!--brace_count) if (!--brace_count)
return; return;
@ -119,13 +119,13 @@ void skip_to_rbrace (cfile, brace_count)
} else if (token == LBRACE) { } else if (token == LBRACE) {
brace_count++; brace_count++;
} else if (token == SEMI && !brace_count) { } else if (token == SEMI && !brace_count) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
return; return;
} else if (token == EOL) { } else if (token == EOL) {
/* EOL only happens when parsing /etc/resolv.conf, /* EOL only happens when parsing /etc/resolv.conf,
and we treat it like a semicolon because the and we treat it like a semicolon because the
resolv.conf file is line-oriented. */ resolv.conf file is line-oriented. */
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
return; return;
} }
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
@ -206,7 +206,7 @@ char *parse_host_name (cfile)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (!is_identifier (token) && token != NUMBER) if (!is_identifier (token) && token != NUMBER)
break; break;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* Store this identifier... */ /* Store this identifier... */
if (!(s = (char *)dmalloc (strlen (val) + 1, MDL))) if (!(s = (char *)dmalloc (strlen (val) + 1, MDL)))
@ -285,7 +285,7 @@ int parse_ip_addr_or_hostname (expr, cfile, uniform)
* we're dealing with. * we're dealing with.
*/ */
save_parse_state(cfile); save_parse_state(cfile);
(void) next_token(NULL, NULL, cfile); skip_token(NULL, NULL, cfile);
if (next_token(NULL, NULL, cfile) == DOT && if (next_token(NULL, NULL, cfile) == DOT &&
next_token(NULL, NULL, cfile) == NUMBER) next_token(NULL, NULL, cfile) == NUMBER)
ipaddr = 1; ipaddr = 1;
@ -498,7 +498,7 @@ parse_ip_addr_with_subnet(cfile, match)
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == SLASH) { if (token == SLASH) {
next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
token = next_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
@ -733,7 +733,7 @@ unsigned char *parse_numeric_aggregate (cfile, buf,
dfree(bufp, MDL); dfree(bufp, MDL);
return (unsigned char *)0; return (unsigned char *)0;
} }
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
} }
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
@ -948,23 +948,23 @@ parse_date_core(cfile)
/* "never", "epoch" or day of week */ /* "never", "epoch" or day of week */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == NEVER) { if (token == NEVER) {
token = next_token(&val, NULL, cfile); /* consume NEVER */ skip_token(&val, NULL, cfile); /* consume NEVER */
return(MAX_TIME); return(MAX_TIME);
} }
/* This indicates 'local' time format. */ /* This indicates 'local' time format. */
if (token == EPOCH) { if (token == EPOCH) {
token = next_token(&val, NULL, cfile); /* consume EPOCH */ skip_token(&val, NULL, cfile); /* consume EPOCH */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "Seconds since epoch expected."); parse_warn(cfile, "Seconds since epoch expected.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume number */ skip_token(&val, NULL, cfile); /* consume number */
guess = atoi(val); guess = atoi(val);
return((TIME)guess); return((TIME)guess);
@ -972,22 +972,22 @@ parse_date_core(cfile)
if (token != NUMBER) { if (token != NUMBER) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "numeric day of week expected."); parse_warn(cfile, "numeric day of week expected.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume day of week */ skip_token(&val, NULL, cfile); /* consume day of week */
/* we are not using this for anything */ /* we are not using this for anything */
/* Year... */ /* Year... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "numeric year expected."); parse_warn(cfile, "numeric year expected.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume year */ skip_token(&val, NULL, cfile); /* consume year */
/* Note: the following is not a Y2K bug - it's a Y1.9K bug. Until /* Note: the following is not a Y2K bug - it's a Y1.9K bug. Until
somebody invents a time machine, I think we can safely disregard somebody invents a time machine, I think we can safely disregard
@ -1001,108 +1001,108 @@ parse_date_core(cfile)
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != SLASH) { if (token != SLASH) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, parse_warn(cfile,
"expected slash separating year from month."); "expected slash separating year from month.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume SLASH */ skip_token(&val, NULL, cfile); /* consume SLASH */
/* Month... */ /* Month... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "numeric month expected."); parse_warn(cfile, "numeric month expected.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume month */ skip_token(&val, NULL, cfile); /* consume month */
mon = atoi(val) - 1; mon = atoi(val) - 1;
/* Slash separating month from day... */ /* Slash separating month from day... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != SLASH) { if (token != SLASH) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, parse_warn(cfile,
"expected slash separating month from day."); "expected slash separating month from day.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume SLASH */ skip_token(&val, NULL, cfile); /* consume SLASH */
/* Day of month... */ /* Day of month... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "numeric day of month expected."); parse_warn(cfile, "numeric day of month expected.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume day of month */ skip_token(&val, NULL, cfile); /* consume day of month */
mday = atoi(val); mday = atoi(val);
/* Hour... */ /* Hour... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "numeric hour expected."); parse_warn(cfile, "numeric hour expected.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume hour */ skip_token(&val, NULL, cfile); /* consume hour */
hour = atoi(val); hour = atoi(val);
/* Colon separating hour from minute... */ /* Colon separating hour from minute... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != COLON) { if (token != COLON) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, parse_warn(cfile,
"expected colon separating hour from minute."); "expected colon separating hour from minute.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume colon */ skip_token(&val, NULL, cfile); /* consume colon */
/* Minute... */ /* Minute... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "numeric minute expected."); parse_warn(cfile, "numeric minute expected.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume minute */ skip_token(&val, NULL, cfile); /* consume minute */
min = atoi(val); min = atoi(val);
/* Colon separating minute from second... */ /* Colon separating minute from second... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != COLON) { if (token != COLON) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, parse_warn(cfile,
"expected colon separating minute from second."); "expected colon separating minute from second.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume colon */ skip_token(&val, NULL, cfile); /* consume colon */
/* Second... */ /* Second... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
if (token != SEMI) if (token != SEMI)
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "numeric second expected."); parse_warn(cfile, "numeric second expected.");
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume second */ skip_token(&val, NULL, cfile); /* consume second */
sec = atoi(val); sec = atoi(val);
tzoff = 0; tzoff = 0;
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == NUMBER) { if (token == NUMBER) {
token = next_token(&val, NULL, cfile); /* consume tzoff */ skip_token(&val, NULL, cfile); /* consume tzoff */
tzoff = atoi(val); tzoff = atoi(val);
} else if (token != SEMI) { } else if (token != SEMI) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, parse_warn(cfile,
"Time zone offset or semicolon expected."); "Time zone offset or semicolon expected.");
return((TIME)0); return((TIME)0);
@ -1189,7 +1189,7 @@ parse_option_name (cfile, allocate, known, opt)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == DOT) { if (token == DOT) {
/* Go ahead and take the DOT token... */ /* Go ahead and take the DOT token... */
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* The next token should be an identifier... */ /* The next token should be an identifier... */
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
@ -1308,7 +1308,7 @@ void parse_option_space_decl (cfile)
char *nu_name; char *nu_name;
int tsize=1, lsize=1, hsize = 0; int tsize=1, lsize=1, hsize = 0;
next_token (&val, (unsigned *)0, cfile); /* Discard the SPACE token, skip_token(&val, (unsigned *)0, cfile); /* Discard the SPACE token,
which was checked by the which was checked by the
caller. */ caller. */
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
@ -1670,7 +1670,7 @@ int parse_option_code_definition (cfile, option)
/* Consume optional compression indicator. */ /* Consume optional compression indicator. */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == COMPRESSED) { if (token == COMPRESSED) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
tokbuf[tokix++] = 'D'; tokbuf[tokix++] = 'D';
type = 'c'; type = 'c';
} else } else
@ -2028,7 +2028,7 @@ int parse_cshl (data, cfile)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token != COLON) if (token != COLON)
break; break;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
} while (1); } while (1);
if (!buffer_allocate (&data -> buffer, tlen + ilen, MDL)) if (!buffer_allocate (&data -> buffer, tlen + ilen, MDL))
@ -2105,8 +2105,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
switch (token) { switch (token) {
case DB_TIME_FORMAT: case DB_TIME_FORMAT:
next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
token = next_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile);
if (token == DEFAULT) { if (token == DEFAULT) {
db_time_format = DEFAULT_TIME_FORMAT; db_time_format = DEFAULT_TIME_FORMAT;
@ -2131,11 +2130,11 @@ int parse_executable_statement (result, cfile, lose, case_context)
return 1; return 1;
case IF: case IF:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
return parse_if_statement (result, cfile, lose); return parse_if_statement (result, cfile, lose);
case TOKEN_ADD: case TOKEN_ADD:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING) { if (token != STRING) {
parse_warn (cfile, "expecting class name."); parse_warn (cfile, "expecting class name.");
@ -2163,7 +2162,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
break; break;
case BREAK: case BREAK:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_semi (cfile)) { if (!parse_semi (cfile)) {
*lose = 1; *lose = 1;
return 0; return 0;
@ -2174,7 +2173,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
break; break;
case SEND: case SEND:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
known = 0; known = 0;
status = parse_option_name (cfile, 0, &known, &option); status = parse_option_name (cfile, 0, &known, &option);
if (status != ISC_R_SUCCESS || option == NULL) { if (status != ISC_R_SUCCESS || option == NULL) {
@ -2188,7 +2187,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
case SUPERSEDE: case SUPERSEDE:
case OPTION: case OPTION:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
known = 0; known = 0;
status = parse_option_name (cfile, 0, &known, &option); status = parse_option_name (cfile, 0, &known, &option);
if (status != ISC_R_SUCCESS || option == NULL) { if (status != ISC_R_SUCCESS || option == NULL) {
@ -2209,7 +2208,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
case IGNORE: case IGNORE:
flag = 2; flag = 2;
pad: pad:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
cache = (struct option_cache *)0; cache = (struct option_cache *)0;
if (!parse_allow_deny (&cache, cfile, flag)) if (!parse_allow_deny (&cache, cfile, flag))
return 0; return 0;
@ -2220,7 +2219,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
break; break;
case DEFAULT: case DEFAULT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == COLON) if (token == COLON)
goto switch_default; goto switch_default;
@ -2236,7 +2235,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
return status; return status;
case PREPEND: case PREPEND:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
known = 0; known = 0;
status = parse_option_name (cfile, 0, &known, &option); status = parse_option_name (cfile, 0, &known, &option);
if (status != ISC_R_SUCCESS || option == NULL) { if (status != ISC_R_SUCCESS || option == NULL) {
@ -2249,7 +2248,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
return status; return status;
case APPEND: case APPEND:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
known = 0; known = 0;
status = parse_option_name (cfile, 0, &known, &option); status = parse_option_name (cfile, 0, &known, &option);
if (status != ISC_R_SUCCESS || option == NULL) { if (status != ISC_R_SUCCESS || option == NULL) {
@ -2262,15 +2261,15 @@ int parse_executable_statement (result, cfile, lose, case_context)
return status; return status;
case ON: case ON:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
return parse_on_statement (result, cfile, lose); return parse_on_statement (result, cfile, lose);
case SWITCH: case SWITCH:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
return parse_switch_statement (result, cfile, lose); return parse_switch_statement (result, cfile, lose);
case CASE: case CASE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (case_context == context_any) { if (case_context == context_any) {
parse_warn (cfile, parse_warn (cfile,
"case statement in inappropriate scope."); "case statement in inappropriate scope.");
@ -2282,7 +2281,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
cfile, lose, case_context); cfile, lose, case_context);
switch_default: switch_default:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (case_context == context_any) { if (case_context == context_any) {
parse_warn (cfile, "switch default statement in %s", parse_warn (cfile, "switch default statement in %s",
"inappropriate scope."); "inappropriate scope.");
@ -2298,7 +2297,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
case DEFINE: case DEFINE:
case TOKEN_SET: case TOKEN_SET:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (token == DEFINE) if (token == DEFINE)
flag = 1; flag = 1;
else else
@ -2424,8 +2423,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
break; break;
case UNSET: case UNSET:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != NAME && token != NUMBER_OR_NAME) { if (token != NAME && token != NUMBER_OR_NAME) {
parse_warn (cfile, parse_warn (cfile,
@ -2450,8 +2448,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
break; break;
case EVAL: case EVAL:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!executable_statement_allocate (result, MDL)) if (!executable_statement_allocate (result, MDL))
log_fatal ("no memory for eval statement."); log_fatal ("no memory for eval statement.");
(*result) -> op = eval_statement; (*result) -> op = eval_statement;
@ -2476,7 +2473,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
case EXECUTE: case EXECUTE:
#ifdef ENABLE_EXECUTE #ifdef ENABLE_EXECUTE
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
if (!executable_statement_allocate (result, MDL)) if (!executable_statement_allocate (result, MDL))
log_fatal ("no memory for execute statement."); log_fatal ("no memory for execute statement.");
@ -2546,7 +2543,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
break; break;
case RETURN: case RETURN:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!executable_statement_allocate (result, MDL)) if (!executable_statement_allocate (result, MDL))
log_fatal ("no memory for return statement."); log_fatal ("no memory for return statement.");
@ -2572,7 +2569,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
break; break;
case LOG: case LOG:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!executable_statement_allocate (result, MDL)) if (!executable_statement_allocate (result, MDL))
log_fatal ("no memory for log statement."); log_fatal ("no memory for log statement.");
@ -2601,7 +2598,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
i = 0; i = 0;
} }
if (i) { if (i) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != COMMA) { if (token != COMMA) {
parse_warn (cfile, "comma expected."); parse_warn (cfile, "comma expected.");
@ -2639,7 +2636,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
because it's appropriate for all DHCP agents with because it's appropriate for all DHCP agents with
parsers. */ parsers. */
case ZONE: case ZONE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
zone = (struct dns_zone *)0; zone = (struct dns_zone *)0;
if (!dns_zone_allocate (&zone, MDL)) if (!dns_zone_allocate (&zone, MDL))
log_fatal ("no memory for new zone."); log_fatal ("no memory for new zone.");
@ -2679,7 +2676,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
/* Also not really a statement, but same idea as above. */ /* Also not really a statement, but same idea as above. */
case KEY: case KEY:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_key (cfile)) { if (!parse_key (cfile)) {
*lose = 1; *lose = 1;
return 0; return 0;
@ -2693,8 +2690,7 @@ int parse_executable_statement (result, cfile, lose, case_context)
config_universe->name_hash, config_universe->name_hash,
val, 0, MDL); val, 0, MDL);
if (option) { if (option) {
token = next_token (&val, skip_token(&val, (unsigned *)0, cfile);
(unsigned *)0, cfile);
status = parse_option_statement status = parse_option_statement
(result, cfile, 1, option, (result, cfile, 1, option,
supersede_option_statement); supersede_option_statement);
@ -2790,7 +2786,7 @@ int parse_zone (struct dns_zone *zone, struct parse *cfile)
log_fatal ("can't allocate secondary."); log_fatal ("can't allocate secondary.");
oc = zone -> secondary; oc = zone -> secondary;
consemup: consemup:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
do { do {
struct expression *expr = (struct expression *)0; struct expression *expr = (struct expression *)0;
if (!parse_ip_addr_or_hostname (&expr, cfile, 0)) { if (!parse_ip_addr_or_hostname (&expr, cfile, 0)) {
@ -2848,7 +2844,7 @@ int parse_zone (struct dns_zone *zone, struct parse *cfile)
"option cache."); "option cache.");
oc = zone->secondary6; oc = zone->secondary6;
consemup6: consemup6:
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
do { do {
struct expression *expr = NULL; struct expression *expr = NULL;
if (parse_ip6_addr_expr(&expr, cfile) == 0) { if (parse_ip6_addr_expr(&expr, cfile) == 0) {
@ -2882,10 +2878,10 @@ int parse_zone (struct dns_zone *zone, struct parse *cfile)
break; break;
case KEY: case KEY:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == STRING) { if (token == STRING) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
key_name = (char *)0; key_name = (char *)0;
} else { } else {
key_name = parse_host_name (cfile); key_name = parse_host_name (cfile);
@ -2943,7 +2939,7 @@ int parse_key (struct parse *cfile)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == STRING) { if (token == STRING) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
key -> name = dmalloc (strlen (val) + 1, MDL); key -> name = dmalloc (strlen (val) + 1, MDL);
if (!key -> name) if (!key -> name)
log_fatal ("no memory for key name."); log_fatal ("no memory for key name.");
@ -3047,8 +3043,9 @@ int parse_key (struct parse *cfile)
/* Allow the BIND 8 syntax, which has a semicolon after each /* Allow the BIND 8 syntax, which has a semicolon after each
closing brace. */ closing brace. */
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == SEMI) if (token == SEMI) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
}
/* Remember the key. */ /* Remember the key. */
status = omapi_auth_key_enter (key); status = omapi_auth_key_enter (key);
@ -3286,7 +3283,7 @@ int parse_if_statement (result, cfile, lose)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == LPAREN) { if (token == LPAREN) {
parenp = 1; parenp = 1;
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
} else } else
parenp = 0; parenp = 0;
@ -3341,10 +3338,10 @@ int parse_if_statement (result, cfile, lose)
} }
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == ELSE) { if (token == ELSE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == IF) { if (token == IF) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_if_statement (&(*result) -> data.ie.fc, if (!parse_if_statement (&(*result) -> data.ie.fc,
cfile, lose)) { cfile, lose)) {
if (!*lose) if (!*lose)
@ -3361,7 +3358,7 @@ int parse_if_statement (result, cfile, lose)
executable_statement_dereference (result, MDL); executable_statement_dereference (result, MDL);
return 0; return 0;
} else { } else {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!(parse_executable_statements if (!(parse_executable_statements
(&(*result) -> data.ie.fc, (&(*result) -> data.ie.fc,
cfile, lose, context_any))) { cfile, lose, context_any))) {
@ -3378,7 +3375,7 @@ int parse_if_statement (result, cfile, lose)
} }
} }
} else if (token == ELSIF) { } else if (token == ELSIF) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_if_statement (&(*result) -> data.ie.fc, if (!parse_if_statement (&(*result) -> data.ie.fc,
cfile, lose)) { cfile, lose)) {
if (!*lose) if (!*lose)
@ -3580,7 +3577,7 @@ int parse_non_binary (expr, cfile, lose, context)
/* Check for unary operators... */ /* Check for unary operators... */
switch (token) { switch (token) {
case CHECK: case CHECK:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING) { if (token != STRING) {
parse_warn (cfile, "string expected."); parse_warn (cfile, "string expected.");
@ -3603,7 +3600,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case TOKEN_NOT: case TOKEN_NOT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
#if defined(NSUPDATE_OLD) #if defined(NSUPDATE_OLD)
if (context == context_dns) { if (context == context_dns) {
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
@ -3633,7 +3630,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case LPAREN: case LPAREN:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_expression (expr, cfile, lose, context, if (!parse_expression (expr, cfile, lose, context,
(struct expression **)0, expr_none)) { (struct expression **)0, expr_none)) {
if (!*lose) { if (!*lose) {
@ -3657,7 +3654,7 @@ int parse_non_binary (expr, cfile, lose, context)
if (context == context_dns) if (context == context_dns)
goto ns_exists; goto ns_exists;
#endif #endif
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_exists; (*expr) -> op = expr_exists;
@ -3674,21 +3671,21 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case STATIC: case STATIC:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_static; (*expr) -> op = expr_static;
break; break;
case KNOWN: case KNOWN:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_known; (*expr) -> op = expr_known;
break; break;
case SUBSTRING: case SUBSTRING:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_substring; (*expr) -> op = expr_substring;
@ -3757,7 +3754,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case SUFFIX: case SUFFIX:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_suffix; (*expr) -> op = expr_suffix;
@ -3784,7 +3781,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case LCASE: case LCASE:
token = next_token(&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate(expr, MDL)) if (!expression_allocate(expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr)->op = expr_lcase; (*expr)->op = expr_lcase;
@ -3802,7 +3799,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case UCASE: case UCASE:
token = next_token(&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate(expr, MDL)) if (!expression_allocate(expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr)->op = expr_ucase; (*expr)->op = expr_ucase;
@ -3821,7 +3818,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case CONCAT: case CONCAT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_concat; (*expr) -> op = expr_concat;
@ -3863,7 +3860,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case BINARY_TO_ASCII: case BINARY_TO_ASCII:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_binary_to_ascii; (*expr) -> op = expr_binary_to_ascii;
@ -3906,7 +3903,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case REVERSE: case REVERSE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_reverse; (*expr) -> op = expr_reverse;
@ -3935,7 +3932,7 @@ int parse_non_binary (expr, cfile, lose, context)
case PICK: case PICK:
/* pick (a, b, c) actually produces an internal representation /* pick (a, b, c) actually produces an internal representation
that looks like pick (a, pick (b, pick (c, nil))). */ that looks like pick (a, pick (b, pick (c, nil))). */
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!(expression_allocate (expr, MDL))) if (!(expression_allocate (expr, MDL)))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
@ -3981,7 +3978,7 @@ int parse_non_binary (expr, cfile, lose, context)
parse_warn (cfile, parse_warn (cfile,
"Please rebuild dhcpd with --with-nsupdate."); "Please rebuild dhcpd with --with-nsupdate.");
#endif #endif
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (token == DNS_UPDATE) if (token == DNS_UPDATE)
opcode = expr_ns_add; opcode = expr_ns_add;
else else
@ -4088,7 +4085,7 @@ int parse_non_binary (expr, cfile, lose, context)
parse_warn (cfile, parse_warn (cfile,
"Please rebuild dhcpd with --with-nsupdate."); "Please rebuild dhcpd with --with-nsupdate.");
#endif #endif
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
@ -4256,7 +4253,7 @@ int parse_non_binary (expr, cfile, lose, context)
(*expr) -> op = (token == OPTION (*expr) -> op = (token == OPTION
? expr_option ? expr_option
: expr_config_option); : expr_config_option);
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
known = 0; known = 0;
/* Pass reference directly to expression structure. */ /* Pass reference directly to expression structure. */
status = parse_option_name(cfile, 0, &known, status = parse_option_name(cfile, 0, &known,
@ -4270,56 +4267,56 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case HARDWARE: case HARDWARE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_hardware; (*expr) -> op = expr_hardware;
break; break;
case LEASED_ADDRESS: case LEASED_ADDRESS:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_leased_address; (*expr) -> op = expr_leased_address;
break; break;
case CLIENT_STATE: case CLIENT_STATE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_client_state; (*expr) -> op = expr_client_state;
break; break;
case FILENAME: case FILENAME:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_filename; (*expr) -> op = expr_filename;
break; break;
case SERVER_NAME: case SERVER_NAME:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_sname; (*expr) -> op = expr_sname;
break; break;
case LEASE_TIME: case LEASE_TIME:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_lease_time; (*expr) -> op = expr_lease_time;
break; break;
case TOKEN_NULL: case TOKEN_NULL:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_null; (*expr) -> op = expr_null;
break; break;
case HOST_DECL_NAME: case HOST_DECL_NAME:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_host_decl_name; (*expr) -> op = expr_host_decl_name;
@ -4327,8 +4324,7 @@ int parse_non_binary (expr, cfile, lose, context)
#if defined(NSUPDATE_OLD) #if defined(NSUPDATE_OLD)
case UPDATED_DNS_RR: case UPDATED_DNS_RR:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != LPAREN) if (token != LPAREN)
goto nolparen; goto nolparen;
@ -4364,7 +4360,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
#endif /* NSUPDATE_OLD */ #endif /* NSUPDATE_OLD */
case PACKET: case PACKET:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_packet; (*expr) -> op = expr_packet;
@ -4391,14 +4387,14 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case STRING: case STRING:
token = next_token (&val, &len, cfile); skip_token(&val, &len, cfile);
if (!make_const_data (expr, (const unsigned char *)val, if (!make_const_data (expr, (const unsigned char *)val,
len, 1, 1, MDL)) len, 1, 1, MDL))
log_fatal ("can't make constant string expression."); log_fatal ("can't make constant string expression.");
break; break;
case EXTRACT_INT: case EXTRACT_INT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != LPAREN) { if (token != LPAREN) {
parse_warn (cfile, "left parenthesis expected."); parse_warn (cfile, "left parenthesis expected.");
@ -4468,7 +4464,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case ENCODE_INT: case ENCODE_INT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != LPAREN) { if (token != LPAREN) {
parse_warn (cfile, "left parenthesis expected."); parse_warn (cfile, "left parenthesis expected.");
@ -4539,7 +4535,7 @@ int parse_non_binary (expr, cfile, lose, context)
number, by itself. */ number, by itself. */
if (context == context_numeric || if (context == context_numeric ||
context == context_data_or_numeric) { context == context_data_or_numeric) {
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_const_int; (*expr) -> op = expr_const_int;
@ -4562,7 +4558,7 @@ int parse_non_binary (expr, cfile, lose, context)
known = FORMERR; known = FORMERR;
goto ns_const; goto ns_const;
ns_const: ns_const:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_const_int; (*expr) -> op = expr_const_int;
@ -4638,7 +4634,7 @@ int parse_non_binary (expr, cfile, lose, context)
goto ns_const; goto ns_const;
case DEFINED: case DEFINED:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != LPAREN) if (token != LPAREN)
goto nolparen; goto nolparen;
@ -4665,7 +4661,7 @@ int parse_non_binary (expr, cfile, lose, context)
/* This parses 'gethostname()'. */ /* This parses 'gethostname()'. */
case GETHOSTNAME: case GETHOSTNAME:
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
if (!expression_allocate(expr, MDL)) if (!expression_allocate(expr, MDL))
log_fatal("can't allocate expression"); log_fatal("can't allocate expression");
(*expr)->op = expr_gethostname; (*expr)->op = expr_gethostname;
@ -4680,8 +4676,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
case GETHOSTBYNAME: case GETHOSTBYNAME:
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
token = next_token(NULL, NULL, cfile); token = next_token(NULL, NULL, cfile);
if (token != LPAREN) if (token != LPAREN)
goto nolparen; goto nolparen;
@ -4709,7 +4704,7 @@ int parse_non_binary (expr, cfile, lose, context)
if (token != NAME && token != NUMBER_OR_NAME) if (token != NAME && token != NUMBER_OR_NAME)
return 0; return 0;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* Save the name of the variable being referenced. */ /* Save the name of the variable being referenced. */
cptr = dmalloc (strlen (val) + 1, MDL); cptr = dmalloc (strlen (val) + 1, MDL);
@ -4727,7 +4722,7 @@ int parse_non_binary (expr, cfile, lose, context)
break; break;
} }
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!expression_allocate (expr, MDL)) if (!expression_allocate (expr, MDL))
log_fatal ("can't allocate expression"); log_fatal ("can't allocate expression");
(*expr) -> op = expr_funcall; (*expr) -> op = expr_funcall;
@ -4816,7 +4811,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
switch (token) { switch (token) {
case BANG: case BANG:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token != EQUAL) { if (token != EQUAL) {
parse_warn (cfile, "! in boolean context without ="); parse_warn (cfile, "! in boolean context without =");
@ -4837,7 +4832,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
case TILDE: case TILDE:
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == TILDE) if (token == TILDE)
@ -4929,7 +4924,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
lhs = rhs; lhs = rhs;
rhs = (struct expression *)0; rhs = (struct expression *)0;
binop = next_op; binop = next_op;
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
goto new_rhs; goto new_rhs;
} }
@ -4944,7 +4939,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
/* Eat the subexpression operator token, which we pass to /* Eat the subexpression operator token, which we pass to
* parse_expression...we only peek()'d earlier. * parse_expression...we only peek()'d earlier.
*/ */
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* Continue parsing of the right hand side with that token. */ /* Continue parsing of the right hand side with that token. */
tmp = rhs; tmp = rhs;
@ -5059,7 +5054,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
} }
/* Eat the operator token - we now know it was a binary operator... */ /* Eat the operator token - we now know it was a binary operator... */
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* Now combine the LHS and the RHS using binop. */ /* Now combine the LHS and the RHS using binop. */
tmp = (struct expression *)0; tmp = (struct expression *)0;
@ -5170,8 +5165,7 @@ struct option *option;
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
/* Comma means: continue with next element in array */ /* Comma means: continue with next element in array */
if (token == COMMA) { if (token == COMMA) {
token = next_token (&val, skip_token(&val, (unsigned *)0, cfile);
(unsigned *)0, cfile);
continue; continue;
} }
/* no comma: end of array. /* no comma: end of array.
@ -5217,10 +5211,10 @@ int parse_option_statement (result, cfile, lookups, option, op)
* we are parsing a zero-length option, so don't * we are parsing a zero-length option, so don't
* eat the semicolon token in that case. * eat the semicolon token in that case.
*/ */
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
} else if (token == EQUAL) { } else if (token == EQUAL) {
/* Eat the equals sign. */ /* Eat the equals sign. */
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* Parse a data expression and use its value for the data. */ /* Parse a data expression and use its value for the data. */
if (!parse_data_expression (&expr, cfile, &lose)) { if (!parse_data_expression (&expr, cfile, &lose)) {
@ -5376,6 +5370,7 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
if (freeval == ISC_TRUE) { if (freeval == ISC_TRUE) {
dfree((char *)val, MDL); dfree((char *)val, MDL);
freeval = ISC_FALSE; freeval = ISC_FALSE;
POST(freeval);
} }
break; break;
@ -5864,7 +5859,7 @@ int parse_X (cfile, buf, max)
} while (token == COLON); } while (token == COLON);
val = (char *)buf; val = (char *)buf;
} else if (token == STRING) { } else if (token == STRING) {
token = next_token (&val, &len, cfile); skip_token(&val, &len, cfile);
if (len + 1 > max) { if (len + 1 > max) {
parse_warn (cfile, "string constant too long."); parse_warn (cfile, "string constant too long.");
skip_to_semi (cfile); skip_to_semi (cfile);
@ -5952,7 +5947,7 @@ parse_domain_list(struct parse *cfile, int compress)
do { do {
/* Consume the COMMA token if peeked. */ /* Consume the COMMA token if peeked. */
if (token == COMMA) if (token == COMMA)
next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
/* Get next (or first) value. */ /* Get next (or first) value. */
token = next_token(&val, &len, cfile); token = next_token(&val, &len, cfile);

View File

@ -3,7 +3,7 @@
Turn data structures into printable text. */ Turn data structures into printable text. */
/* /*
* Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
@ -1193,7 +1193,7 @@ int token_print_indent_concat (FILE *file, int col, int indent,
} }
va_end (list); va_end (list);
len = token_print_indent (file, col, indent, col = token_print_indent (file, col, indent,
prefix, suffix, t); prefix, suffix, t);
dfree (t, MDL); dfree (t, MDL);
return col; return col;
@ -1248,7 +1248,7 @@ int token_print_indent (FILE *file, int col, int indent,
{ {
int len = 0; int len = 0;
if (prefix != NULL) if (prefix != NULL)
len = strlen (prefix); len += strlen (prefix);
if (buf != NULL) if (buf != NULL)
len += strlen (buf); len += strlen (buf);

View File

@ -3,7 +3,8 @@
Parser for /etc/resolv.conf file. */ Parser for /etc/resolv.conf file. */
/* /*
* Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1996-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -89,7 +90,6 @@ void read_resolv_conf (parse_time)
(struct domain_search_list *)0; (struct domain_search_list *)0;
*dp = nd; *dp = nd;
nd -> domain = dn; nd -> domain = dn;
dn = (char *)0;
} }
nd -> rcdate = parse_time; nd -> rcdate = parse_time;
token = peek_token (&val, token = peek_token (&val,
@ -100,7 +100,7 @@ void read_resolv_conf (parse_time)
"junk after domain declaration"); "junk after domain declaration");
skip_to_semi (cfile); skip_to_semi (cfile);
} }
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
} else if (token == NAMESERVER) { } else if (token == NAMESERVER) {
struct name_server *ns, **sp; struct name_server *ns, **sp;
struct iaddr iaddr; struct iaddr iaddr;
@ -136,7 +136,7 @@ void read_resolv_conf (parse_time)
} else } else
skip_to_semi (cfile); /* Ignore what we don't grok. */ skip_to_semi (cfile); /* Ignore what we don't grok. */
} while (1); } while (1);
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* Lose servers that are no longer in /etc/resolv.conf. */ /* Lose servers that are no longer in /etc/resolv.conf. */
sl = (struct name_server *)0; sl = (struct name_server *)0;

View File

@ -3,7 +3,7 @@
BSD socket interface code... */ BSD socket interface code... */
/* /*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -742,6 +742,7 @@ ssize_t send_packet6(struct interface_info *interface,
m.msg_control = control_buf; m.msg_control = control_buf;
m.msg_controllen = control_buf_len; m.msg_controllen = control_buf_len;
cmsg = CMSG_FIRSTHDR(&m); cmsg = CMSG_FIRSTHDR(&m);
INSIST(cmsg != NULL);
cmsg->cmsg_level = IPPROTO_IPV6; cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO; cmsg->cmsg_type = IPV6_PKTINFO;
cmsg->cmsg_len = CMSG_LEN(sizeof(*pktinfo)); cmsg->cmsg_len = CMSG_LEN(sizeof(*pktinfo));

View File

@ -3,7 +3,7 @@
Routines for manipulating parse trees... */ Routines for manipulating parse trees... */
/* /*
* Copyright (c) 2011-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2011-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
@ -587,7 +587,6 @@ int evaluate_expression (result, packet, lease, client_state,
strcpy (nb -> name, s -> string); strcpy (nb -> name, s -> string);
else { else {
dfree (nb, MDL); dfree (nb, MDL);
nb = (struct binding *)0;
goto blb; goto blb;
} }
} }

79
configure vendored
View File

@ -2014,6 +2014,73 @@ fi
} # ac_fn_c_try_link } # ac_fn_c_try_link
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ---------------------------------------------------- # ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including # Tries to find if the field MEMBER exists in type AGGR, after including
@ -6180,6 +6247,18 @@ if test "$ac_res" != no; then :
fi fi
for ac_func in strlcat
do :
ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
if test "x$ac_cv_func_strlcat" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRLCAT 1
_ACEOF
fi
done
# For HP/UX we need -lipv6 for if_nametoindex, perhaps others. # For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing if_nametoindex" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing if_nametoindex" >&5
$as_echo_n "checking for library containing if_nametoindex... " >&6; } $as_echo_n "checking for library containing if_nametoindex... " >&6; }

View File

@ -535,6 +535,8 @@ AC_SEARCH_LIBS(inet_aton, [socket nsl], ,
# Check for a standalone regex library. # Check for a standalone regex library.
AC_SEARCH_LIBS(regcomp, [regex]) AC_SEARCH_LIBS(regcomp, [regex])
AC_CHECK_FUNCS(strlcat)
# For HP/UX we need -lipv6 for if_nametoindex, perhaps others. # For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
AC_SEARCH_LIBS(if_nametoindex, [ipv6]) AC_SEARCH_LIBS(if_nametoindex, [ipv6])

View File

@ -3,7 +3,7 @@
Examine and modify omapi objects. */ Examine and modify omapi objects. */
/* /*
* Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009-2011,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2001-2003 by Internet Software Consortium * Copyright (c) 2001-2003 by Internet Software Consortium
* *
@ -466,8 +466,12 @@ main(int argc, char **argv) {
break; break;
} }
s1[0] = '\0'; #ifdef HAVE_STRLCPY
strncat (s1, val, sizeof(s1)-1); strlcpy (s1, val, sizeof(s1));
#else
s1[0] = 0;
strncat (s1, val, sizeof(s1)-strlen(s1)-1);
#endif
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != EQUAL) if (token != EQUAL)
@ -570,8 +574,12 @@ main(int argc, char **argv) {
break; break;
} }
s1[0] = '\0'; #if HAVE_STRLCPY
strncat (s1, val, sizeof(s1)-1); strlcpy (s1, val, sizeof(s1));
#else
s1[0] = 0;
strncat (s1, val, sizeof(s1)-strlen(s1)-1);
#endif
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != END_OF_FILE && token != EOL) if (token != END_OF_FILE && token != EOL)

View File

@ -5,7 +5,7 @@ static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.10 201
/* /*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
* Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (c) 2012-2013 by Internet Systems Consortium, Inc. ("ISC")
* *
* Permission to use, copy modify, and distribute this software for any * Permission to use, copy modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -100,7 +100,6 @@ dst_init()
done_init = 1; done_init = 1;
s = getenv("DSTKEYPATH"); s = getenv("DSTKEYPATH");
len = 0;
if (s) { if (s) {
struct stat statbuf; struct stat statbuf;
@ -367,7 +366,7 @@ dst_read_key(const char *in_keyname, const unsigned in_id,
pubkey->dk_alg) == 0) pubkey->dk_alg) == 0)
dg_key = dst_free_key(dg_key); dg_key = dst_free_key(dg_key);
pubkey = dst_free_key(pubkey); (void) dst_free_key(pubkey);
return (dg_key); return (dg_key);
} }

View File

@ -2,7 +2,7 @@
static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/prandom.c,v 1.10 2012/03/09 11:18:13 tomasz Exp $"; static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/prandom.c,v 1.10 2012/03/09 11:18:13 tomasz Exp $";
#endif #endif
/* /*
* Portions Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (c) 2012,2013 by Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
* *
@ -336,7 +336,7 @@ do_ls(dst_work *work)
static int i = 0; static int i = 0;
static unsigned long d_round = 0; static unsigned long d_round = 0;
struct timeval tv; struct timeval tv;
int n = 0, tb_i = 0, out = 0; int n = 0, out = 0;
unsigned dir_len; unsigned dir_len;
char file_name[1024]; char file_name[1024];
@ -360,7 +360,6 @@ do_ls(dst_work *work)
EREPORT(("do_ls i %d filled %4d in_temp %4d\n", EREPORT(("do_ls i %d filled %4d in_temp %4d\n",
i-1, work->filled, work->in_temp)); i-1, work->filled, work->in_temp));
memcpy(tmp_buff, &buf, sizeof(buf)); memcpy(tmp_buff, &buf, sizeof(buf));
tb_i += sizeof(buf);
if ((dir = opendir(dirs[i-1])) == NULL)/* open it for read */ if ((dir = opendir(dirs[i-1])) == NULL)/* open it for read */
@ -663,7 +662,6 @@ get_hmac_key(int step, int block)
if (n < size) { if (n < size) {
temp = dst_s_quick_random((int) buff[n - 1]); temp = dst_s_quick_random((int) buff[n - 1]);
memcpy(&buff[n], &temp, sizeof(temp)); memcpy(&buff[n], &temp, sizeof(temp));
n += sizeof(temp);
} }
/* covert this into a HMAC key */ /* covert this into a HMAC key */
new_key = dst_buffer_to_key("", KEY_HMAC_MD5, 0, 0, buff, size); new_key = dst_buffer_to_key("", KEY_HMAC_MD5, 0, 0, buff, size);

View File

@ -82,6 +82,9 @@
/* Define to 1 if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H #undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the <sys/socket.h> header file. */ /* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H #undef HAVE_SYS_SOCKET_H

View File

@ -3,7 +3,7 @@
Definitions for dhcpd... */ Definitions for dhcpd... */
/* /*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1996-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -1888,6 +1888,12 @@ enum dhcp_token next_raw_token(const char **rval, unsigned *rlen,
struct parse *cfile); struct parse *cfile);
enum dhcp_token peek_raw_token(const char **rval, unsigned *rlen, enum dhcp_token peek_raw_token(const char **rval, unsigned *rlen,
struct parse *cfile); struct parse *cfile);
/*
* Use skip_token when we are skipping a token we have previously
* used peek_token on as we know what the result will be in this case.
*/
#define skip_token(a,b,c) ((void) next_token((a),(b),(c)))
/* confpars.c */ /* confpars.c */
void parse_trace_setup (void); void parse_trace_setup (void);

View File

@ -3,7 +3,7 @@
Subroutines for dealing with connections. */ Subroutines for dealing with connections. */
/* /*
* Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium * Copyright (c) 1999-2003 by Internet Software Consortium
* *
@ -99,7 +99,6 @@ isc_result_t omapi_connect (omapi_object_t *c,
addrs -> addresses [0].addrlen = sizeof foo; addrs -> addresses [0].addrlen = sizeof foo;
memcpy (addrs -> addresses [0].address, &foo, sizeof foo); memcpy (addrs -> addresses [0].address, &foo, sizeof foo);
addrs -> addresses [0].port = port; addrs -> addresses [0].port = port;
hix = 1;
} }
status = omapi_connect_list (c, addrs, (omapi_addr_t *)0); status = omapi_connect_list (c, addrs, (omapi_addr_t *)0);
omapi_addr_list_dereference (&addrs, MDL); omapi_addr_list_dereference (&addrs, MDL);
@ -355,6 +354,7 @@ static void trace_connect_input (trace_type_t *ttype,
s += sizeof remote.sin_addr; s += sizeof remote.sin_addr;
memcpy (&local.sin_addr, s, sizeof local.sin_addr); memcpy (&local.sin_addr, s, sizeof local.sin_addr);
s += sizeof local.sin_addr; s += sizeof local.sin_addr;
POST(s);
connect_index = ntohl (connect_index); connect_index = ntohl (connect_index);
listener_index = ntohl (listener_index); listener_index = ntohl (listener_index);

View File

@ -3,7 +3,7 @@
DHCP/BOOTP Relay Agent. */ DHCP/BOOTP Relay Agent. */
/* /*
* Copyright(c) 2004-2012 by Internet Systems Consortium, Inc.("ISC") * Copyright(c) 2004-2013 by Internet Systems Consortium, Inc.("ISC")
* Copyright(c) 1997-2003 by Internet Software Consortium * Copyright(c) 1997-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -437,10 +437,8 @@ main(int argc, char **argv) {
log_info(copyright); log_info(copyright);
log_info(arr); log_info(arr);
log_info(url); log_info(url);
} else { } else
quiet = 0;
log_perror = 0; log_perror = 0;
}
/* Set default port */ /* Set default port */
if (local_family == AF_INET) { if (local_family == AF_INET) {
@ -563,10 +561,10 @@ main(int argc, char **argv) {
} }
} }
close(0); (void) close(0);
close(1); (void) close(1);
close(2); (void) close(2);
pid = setsid(); (void) setsid();
IGNORE_RET (chdir("/")); IGNORE_RET (chdir("/"));
} }
@ -1052,9 +1050,11 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
if (end_pad != NULL) if (end_pad != NULL)
sp = end_pad; sp = end_pad;
#if 0
/* Remember where the end of the packet was after parsing /* Remember where the end of the packet was after parsing
it. */ it. */
op = sp; op = sp;
#endif
/* Sanity check. Had better not ever happen. */ /* Sanity check. Had better not ever happen. */
if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1))
@ -1557,7 +1557,7 @@ process_down6(struct packet *packet) {
} }
} }
/* Why bother when there is no choice. */ /* Why bother when there is no choice. */
if (!dp && !downstreams->next) if (!dp && downstreams && !downstreams->next)
dp = downstreams; dp = downstreams;
if (!dp) { if (!dp) {
log_info("Can't find the down interface."); log_info("Can't find the down interface.");

View File

@ -3,7 +3,7 @@
Parser for dhcpd config file... */ Parser for dhcpd config file... */
/* /*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -253,7 +253,7 @@ isc_result_t conf_file_subparse (struct parse *cfile, struct group *group,
(struct host_decl *)0, (struct host_decl *)0,
declaration); declaration);
} while (1); } while (1);
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
status = cfile->warnings_occurred ? DHCP_R_BADPARSE : ISC_R_SUCCESS; status = cfile->warnings_occurred ? DHCP_R_BADPARSE : ISC_R_SUCCESS;
return status; return status;
@ -373,7 +373,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
switch (token) { switch (token) {
case INCLUDE: case INCLUDE:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING) { if (token != STRING) {
parse_warn (cfile, "filename string expected."); parse_warn (cfile, "filename string expected.");
@ -387,7 +387,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return 1; return 1;
case HOST: case HOST:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type != HOST_DECL && type != CLASS_DECL) { if (type != HOST_DECL && type != CLASS_DECL) {
if (global_host_once && if (global_host_once &&
(type == SUBNET_DECL || type == SHARED_NET_DECL)) { (type == SUBNET_DECL || type == SHARED_NET_DECL)) {
@ -406,7 +406,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return 1; return 1;
case GROUP: case GROUP:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type != HOST_DECL && type != CLASS_DECL) if (type != HOST_DECL && type != CLASS_DECL)
parse_group_declaration (cfile, group); parse_group_declaration (cfile, group);
else { else {
@ -417,7 +417,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return 1; return 1;
case SHARED_NETWORK: case SHARED_NETWORK:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type == SHARED_NET_DECL || if (type == SHARED_NET_DECL ||
type == HOST_DECL || type == HOST_DECL ||
type == SUBNET_DECL || type == SUBNET_DECL ||
@ -433,7 +433,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
case SUBNET: case SUBNET:
case SUBNET6: case SUBNET6:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type == HOST_DECL || type == SUBNET_DECL || if (type == HOST_DECL || type == SUBNET_DECL ||
type == CLASS_DECL) { type == CLASS_DECL) {
parse_warn (cfile, parse_warn (cfile,
@ -515,7 +515,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return 1; return 1;
case VENDOR_CLASS: case VENDOR_CLASS:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type == CLASS_DECL) { if (type == CLASS_DECL) {
parse_warn (cfile, parse_warn (cfile,
"class declarations not allowed here."); "class declarations not allowed here.");
@ -526,7 +526,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return 1; return 1;
case USER_CLASS: case USER_CLASS:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type == CLASS_DECL) { if (type == CLASS_DECL) {
parse_warn (cfile, parse_warn (cfile,
"class declarations not allowed here."); "class declarations not allowed here.");
@ -537,7 +537,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return 1; return 1;
case CLASS: case CLASS:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type == CLASS_DECL) { if (type == CLASS_DECL) {
parse_warn (cfile, parse_warn (cfile,
"class declarations not allowed here."); "class declarations not allowed here.");
@ -548,7 +548,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return 1; return 1;
case SUBCLASS: case SUBCLASS:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type == CLASS_DECL) { if (type == CLASS_DECL) {
parse_warn (cfile, parse_warn (cfile,
"class declarations not allowed here."); "class declarations not allowed here.");
@ -560,7 +560,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return 1; return 1;
case HARDWARE: case HARDWARE:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
memset (&hardware, 0, sizeof hardware); memset (&hardware, 0, sizeof hardware);
if (host_decl && memcmp(&hardware, &(host_decl->interface), if (host_decl && memcmp(&hardware, &(host_decl->interface),
sizeof(hardware)) != 0) { sizeof(hardware)) != 0) {
@ -579,7 +579,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
case FIXED_ADDR: case FIXED_ADDR:
case FIXED_ADDR6: case FIXED_ADDR6:
next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
cache = NULL; cache = NULL;
if (parse_fixed_addr_param(&cache, cfile, token)) { if (parse_fixed_addr_param(&cache, cfile, token)) {
if (host_decl) { if (host_decl) {
@ -601,7 +601,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
break; break;
case POOL: case POOL:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type == POOL_DECL) { if (type == POOL_DECL) {
parse_warn (cfile, "pool declared within pool."); parse_warn (cfile, "pool declared within pool.");
skip_to_semi(cfile); skip_to_semi(cfile);
@ -614,7 +614,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return declaration; return declaration;
case RANGE: case RANGE:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (type != SUBNET_DECL || !group -> subnet) { if (type != SUBNET_DECL || !group -> subnet) {
parse_warn (cfile, parse_warn (cfile,
"range declaration not allowed here."); "range declaration not allowed here.");
@ -627,7 +627,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
#ifdef DHCPv6 #ifdef DHCPv6
case RANGE6: case RANGE6:
next_token(NULL, NULL, cfile); skip_token(NULL, NULL, cfile);
if ((type != SUBNET_DECL) || (group->subnet == NULL)) { if ((type != SUBNET_DECL) || (group->subnet == NULL)) {
parse_warn (cfile, parse_warn (cfile,
"range6 declaration not allowed here."); "range6 declaration not allowed here.");
@ -638,7 +638,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return declaration; return declaration;
case PREFIX6: case PREFIX6:
next_token(NULL, NULL, cfile); skip_token(NULL, NULL, cfile);
if ((type != SUBNET_DECL) || (group->subnet == NULL)) { if ((type != SUBNET_DECL) || (group->subnet == NULL)) {
parse_warn (cfile, parse_warn (cfile,
"prefix6 declaration not allowed here."); "prefix6 declaration not allowed here.");
@ -649,7 +649,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return declaration; return declaration;
case FIXED_PREFIX6: case FIXED_PREFIX6:
next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
if (!host_decl) { if (!host_decl) {
parse_warn (cfile, parse_warn (cfile,
"fixed-prefix6 declaration not " "fixed-prefix6 declaration not "
@ -663,7 +663,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
#endif /* DHCPv6 */ #endif /* DHCPv6 */
case TOKEN_NOT: case TOKEN_NOT:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
switch (token) { switch (token) {
case AUTHORITATIVE: case AUTHORITATIVE:
@ -676,7 +676,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
} }
break; break;
case AUTHORITATIVE: case AUTHORITATIVE:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
group -> authoritative = 1; group -> authoritative = 1;
authoritative: authoritative:
if (type == HOST_DECL) if (type == HOST_DECL)
@ -692,11 +692,11 @@ int parse_statement (cfile, group, type, host_decl, declaration)
&code, 0, MDL)) &code, 0, MDL))
log_fatal("Server identifier not in hash (%s:%d).", log_fatal("Server identifier not in hash (%s:%d).",
MDL); MDL);
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
goto finish_option; goto finish_option;
case OPTION: case OPTION:
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == SPACE) { if (token == SPACE) {
if (type != ROOT_GROUP) { if (type != ROOT_GROUP) {
@ -723,7 +723,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
option_dereference(&option, MDL); option_dereference(&option, MDL);
break; break;
} }
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
/* /*
* If the option was known, remove it from the * If the option was known, remove it from the
@ -1465,7 +1465,7 @@ void parse_pool_statement (cfile, group, type)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
switch (token) { switch (token) {
case TOKEN_NO: case TOKEN_NO:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != FAILOVER || if (token != FAILOVER ||
(token = next_token (&val, (unsigned *)0, (token = next_token (&val, (unsigned *)0,
@ -1484,7 +1484,7 @@ void parse_pool_statement (cfile, group, type)
#if defined (FAILOVER_PROTOCOL) #if defined (FAILOVER_PROTOCOL)
case FAILOVER: case FAILOVER:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != PEER) { if (token != PEER) {
parse_warn (cfile, "expecting 'peer'."); parse_warn (cfile, "expecting 'peer'.");
@ -1513,7 +1513,7 @@ void parse_pool_statement (cfile, group, type)
#endif #endif
case RANGE: case RANGE:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_address_range (cfile, group, type, parse_address_range (cfile, group, type,
pool, &lpchain); pool, &lpchain);
break; break;
@ -1525,7 +1525,7 @@ void parse_pool_statement (cfile, group, type)
permit = new_permit (MDL); permit = new_permit (MDL);
if (!permit) if (!permit)
log_fatal ("no memory for permit"); log_fatal ("no memory for permit");
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
switch (token) { switch (token) {
case UNKNOWN: case UNKNOWN:
@ -1639,7 +1639,7 @@ void parse_pool_statement (cfile, group, type)
goto get_permit; goto get_permit;
case RBRACE: case RBRACE:
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
done = 1; done = 1;
break; break;
@ -1783,11 +1783,11 @@ void parse_host_declaration (cfile, group)
do { do {
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == RBRACE) { if (token == RBRACE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
break; break;
} }
if (token == END_OF_FILE) { if (token == END_OF_FILE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
} }
@ -1795,7 +1795,7 @@ void parse_host_declaration (cfile, group)
remember to save it. */ remember to save it. */
if (token == DYNAMIC) { if (token == DYNAMIC) {
dynamicp = 1; dynamicp = 1;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_semi (cfile)) if (!parse_semi (cfile))
break; break;
continue; continue;
@ -1804,7 +1804,7 @@ void parse_host_declaration (cfile, group)
remember to save it. */ remember to save it. */
if (token == TOKEN_DELETED) { if (token == TOKEN_DELETED) {
deleted = 1; deleted = 1;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_semi (cfile)) if (!parse_semi (cfile))
break; break;
continue; continue;
@ -1812,7 +1812,7 @@ void parse_host_declaration (cfile, group)
if (token == GROUP) { if (token == GROUP) {
struct group_object *go; struct group_object *go;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING && !is_identifier (token)) { if (token != STRING && !is_identifier (token)) {
parse_warn (cfile, parse_warn (cfile,
@ -1843,7 +1843,7 @@ void parse_host_declaration (cfile, group)
unsigned char *t = 0; unsigned char *t = 0;
unsigned len; unsigned len;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
data_string_forget (&host -> client_identifier, MDL); data_string_forget (&host -> client_identifier, MDL);
if (host->client_identifier.len != 0) { if (host->client_identifier.len != 0) {
@ -1856,7 +1856,7 @@ void parse_host_declaration (cfile, group)
/* See if it's a string or a cshl. */ /* See if it's a string or a cshl. */
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == STRING) { if (token == STRING) {
token = next_token (&val, &len, cfile); skip_token(&val, &len, cfile);
s = val; s = val;
host -> client_identifier.terminated = 1; host -> client_identifier.terminated = 1;
} else { } else {
@ -1897,7 +1897,7 @@ void parse_host_declaration (cfile, group)
skip_to_rbrace(cfile, 1); skip_to_rbrace(cfile, 1);
break; break;
} }
next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
token = next_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile);
if (token != OPTION) { if (token != OPTION) {
parse_warn(cfile, parse_warn(cfile,
@ -2072,7 +2072,7 @@ int parse_class_declaration (cp, cfile, group, type)
if (type == CLASS_TYPE_SUBCLASS) { if (type == CLASS_TYPE_SUBCLASS) {
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == STRING) { if (token == STRING) {
token = next_token (&val, &data.len, cfile); skip_token(&val, &data.len, cfile);
data.buffer = (struct buffer *)0; data.buffer = (struct buffer *)0;
if (!buffer_allocate (&data.buffer, if (!buffer_allocate (&data.buffer,
data.len + 1, MDL)) { data.len + 1, MDL)) {
@ -2174,7 +2174,7 @@ int parse_class_declaration (cp, cfile, group, type)
if (class -> superclass) { if (class -> superclass) {
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == SEMI) { if (token == SEMI) {
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (cp) if (cp)
status = class_reference (cp, class, MDL); status = class_reference (cp, class, MDL);
class_dereference (&class, MDL); class_dereference (&class, MDL);
@ -2198,21 +2198,21 @@ int parse_class_declaration (cp, cfile, group, type)
do { do {
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == RBRACE) { if (token == RBRACE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
break; break;
} else if (token == END_OF_FILE) { } else if (token == END_OF_FILE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
} else if (token == DYNAMIC) { } else if (token == DYNAMIC) {
class->flags |= CLASS_DECL_DYNAMIC; class->flags |= CLASS_DECL_DYNAMIC;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_semi (cfile)) if (!parse_semi (cfile))
break; break;
continue; continue;
} else if (token == TOKEN_DELETED) { } else if (token == TOKEN_DELETED) {
class->flags |= CLASS_DECL_DELETED; class->flags |= CLASS_DECL_DELETED;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!parse_semi (cfile)) if (!parse_semi (cfile))
break; break;
continue; continue;
@ -2223,11 +2223,11 @@ int parse_class_declaration (cp, cfile, group, type)
skip_to_semi (cfile); skip_to_semi (cfile);
break; break;
} }
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token != IF) if (token != IF)
goto submatch; goto submatch;
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (matchedonce) { if (matchedonce) {
parse_warn(cfile, "A class may only have " parse_warn(cfile, "A class may only have "
"one 'match if' clause."); "one 'match if' clause.");
@ -2252,7 +2252,7 @@ int parse_class_declaration (cp, cfile, group, type)
parse_semi (cfile); parse_semi (cfile);
} }
} else if (token == SPAWN) { } else if (token == SPAWN) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (pc) { if (pc) {
parse_warn (cfile, parse_warn (cfile,
"invalid spawn in subclass."); "invalid spawn in subclass.");
@ -2293,7 +2293,7 @@ int parse_class_declaration (cp, cfile, group, type)
parse_semi (cfile); parse_semi (cfile);
} }
} else if (token == LEASE) { } else if (token == LEASE) {
next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (token != LIMIT) { if (token != LIMIT) {
parse_warn (cfile, "expecting \"limit\""); parse_warn (cfile, "expecting \"limit\"");
@ -2391,7 +2391,7 @@ void parse_shared_net_declaration (cfile, group)
/* Get the name of the shared network... */ /* Get the name of the shared network... */
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == STRING) { if (token == STRING) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (val [0] == 0) { if (val [0] == 0) {
parse_warn (cfile, "zero-length shared network name"); parse_warn (cfile, "zero-length shared network name");
@ -2421,7 +2421,7 @@ void parse_shared_net_declaration (cfile, group)
do { do {
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == RBRACE) { if (token == RBRACE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
if (!share -> subnets) if (!share -> subnets)
parse_warn (cfile, parse_warn (cfile,
"empty shared-network decl"); "empty shared-network decl");
@ -2430,11 +2430,11 @@ void parse_shared_net_declaration (cfile, group)
shared_network_dereference (&share, MDL); shared_network_dereference (&share, MDL);
return; return;
} else if (token == END_OF_FILE) { } else if (token == END_OF_FILE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
} else if (token == INTERFACE) { } else if (token == INTERFACE) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
new_shared_network_interface (cfile, share, val); new_shared_network_interface (cfile, share, val);
if (!parse_semi (cfile)) if (!parse_semi (cfile))
@ -2470,14 +2470,14 @@ common_subnet_parsing(struct parse *cfile,
do { do {
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == RBRACE) { if (token == RBRACE) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
break; break;
} else if (token == END_OF_FILE) { } else if (token == END_OF_FILE) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
} else if (token == INTERFACE) { } else if (token == INTERFACE) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
token = next_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile);
new_shared_network_interface(cfile, share, val); new_shared_network_interface(cfile, share, val);
if (!parse_semi(cfile)) if (!parse_semi(cfile))
@ -2738,7 +2738,7 @@ void parse_group_declaration (cfile, group)
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (is_identifier (token) || token == STRING) { if (is_identifier (token) || token == STRING) {
next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
name = dmalloc(strlen(val) + 1, MDL); name = dmalloc(strlen(val) + 1, MDL);
if (!name) if (!name)
@ -2754,22 +2754,22 @@ void parse_group_declaration (cfile, group)
do { do {
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == RBRACE) { if (token == RBRACE) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
break; break;
} else if (token == END_OF_FILE) { } else if (token == END_OF_FILE) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_warn(cfile, "unexpected end of file"); parse_warn(cfile, "unexpected end of file");
break; break;
} else if (token == TOKEN_DELETED) { } else if (token == TOKEN_DELETED) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_semi(cfile); parse_semi(cfile);
deletedp = 1; deletedp = 1;
} else if (token == DYNAMIC) { } else if (token == DYNAMIC) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_semi(cfile); parse_semi(cfile);
dynamicp = 1; dynamicp = 1;
} else if (token == STATIC) { } else if (token == STATIC) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
parse_semi(cfile); parse_semi(cfile);
staticp = 1; staticp = 1;
} }
@ -2986,7 +2986,7 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
token = peek_token (&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile);
if (token == STRING) { if (token == STRING) {
unsigned char *tuid; unsigned char *tuid;
token = next_token (&val, &buflen, cfile); skip_token(&val, &buflen, cfile);
if (buflen < sizeof lease -> uid_buf) { if (buflen < sizeof lease -> uid_buf) {
tuid = lease -> uid_buf; tuid = lease -> uid_buf;
lease -> uid_max = lease -> uid_max =
@ -3446,7 +3446,7 @@ parse_binding_value(struct parse *cfile, struct binding_value *value)
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == STRING) { if (token == STRING) {
token = next_token(&val, &buflen, cfile); skip_token(&val, &buflen, cfile);
value->type = binding_data; value->type = binding_data;
value->value.data.len = buflen; value->value.data.len = buflen;
@ -3482,7 +3482,7 @@ parse_binding_value(struct parse *cfile, struct binding_value *value)
dfree (s, MDL); dfree (s, MDL);
} }
} else if (token == PERCENT) { } else if (token == PERCENT) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
token = next_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
parse_warn(cfile, "expecting decimal number."); parse_warn(cfile, "expecting decimal number.");
@ -3538,7 +3538,7 @@ void parse_address_range (cfile, group, type, inpool, lpchain)
if ((token = peek_token (&val, if ((token = peek_token (&val,
(unsigned *)0, cfile)) == DYNAMIC_BOOTP) { (unsigned *)0, cfile)) == DYNAMIC_BOOTP) {
token = next_token (&val, (unsigned *)0, cfile); skip_token(&val, (unsigned *)0, cfile);
dynamic = 1; dynamic = 1;
} }
@ -3792,7 +3792,7 @@ parse_address_range6(struct parse *cfile, struct group *group) {
/* /*
* '/' means CIDR notation, so read the bits we want. * '/' means CIDR notation, so read the bits we want.
*/ */
next_token(NULL, NULL, cfile); skip_token(NULL, NULL, cfile);
token = next_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile);
if (token != NUMBER) { if (token != NUMBER) {
parse_warn(cfile, "expecting number"); parse_warn(cfile, "expecting number");
@ -3820,7 +3820,7 @@ parse_address_range6(struct parse *cfile, struct group *group) {
parse_warn(cfile, "temporary mask too short"); parse_warn(cfile, "temporary mask too short");
if (bits == 128) if (bits == 128)
parse_warn(cfile, "temporary singleton?"); parse_warn(cfile, "temporary singleton?");
token = next_token(NULL, NULL, cfile); skip_token(NULL, NULL, cfile);
type = D6O_IA_TA; type = D6O_IA_TA;
} }
@ -3832,7 +3832,7 @@ parse_address_range6(struct parse *cfile, struct group *group) {
* temporary (RFC 4941) * temporary (RFC 4941)
*/ */
type = D6O_IA_TA; type = D6O_IA_TA;
next_token(NULL, NULL, cfile); skip_token(NULL, NULL, cfile);
bits = 64; bits = 64;
if (!is_cidr_mask_valid(&lo, bits)) { if (!is_cidr_mask_valid(&lo, bits)) {
parse_warn(cfile, "network mask too short"); parse_warn(cfile, "network mask too short");
@ -4282,7 +4282,7 @@ parse_ia_na_declaration(struct parse *cfile) {
*/ */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == SEMI) { if (token == SEMI) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
} else { } else {
parse_warn(cfile, parse_warn(cfile,
"corrupt lease file; " "corrupt lease file; "
@ -4310,7 +4310,7 @@ parse_ia_na_declaration(struct parse *cfile) {
*/ */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == SEMI) { if (token == SEMI) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
} else { } else {
parse_warn(cfile, parse_warn(cfile,
"corrupt lease file; " "corrupt lease file; "
@ -4663,7 +4663,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
*/ */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == SEMI) { if (token == SEMI) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
} else { } else {
parse_warn(cfile, parse_warn(cfile,
"corrupt lease file; " "corrupt lease file; "
@ -4691,7 +4691,7 @@ parse_ia_ta_declaration(struct parse *cfile) {
*/ */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == SEMI) { if (token == SEMI) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
} else { } else {
parse_warn(cfile, parse_warn(cfile,
"corrupt lease file; " "corrupt lease file; "
@ -5045,7 +5045,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
*/ */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == SEMI) { if (token == SEMI) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
} else { } else {
parse_warn(cfile, parse_warn(cfile,
"corrupt lease file; " "corrupt lease file; "
@ -5073,7 +5073,7 @@ parse_ia_pd_declaration(struct parse *cfile) {
*/ */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
if (token == SEMI) { if (token == SEMI) {
token = next_token(&val, NULL, cfile); skip_token(&val, NULL, cfile);
} else { } else {
parse_warn(cfile, parse_warn(cfile,
"corrupt lease file; " "corrupt lease file; "
@ -5333,7 +5333,7 @@ parse_server_duid_conf(struct parse *cfile) {
/* /*
* Consume the SERVER_DUID token. * Consume the SERVER_DUID token.
*/ */
token = next_token(NULL, NULL, cfile); skip_token(NULL, NULL, cfile);
/* /*
* Obtain the DUID type. * Obtain the DUID type.

View File

@ -3,7 +3,7 @@
DHCP Server Daemon. */ DHCP Server Daemon. */
/* /*
* Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2011,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1996-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -833,17 +833,17 @@ main(int argc, char **argv) {
if (daemon) { if (daemon) {
/* Become session leader and get pid... */ /* Become session leader and get pid... */
pid = setsid(); (void) setsid();
/* Close standard I/O descriptors. */ /* Close standard I/O descriptors. */
close(0); (void) close(0);
close(1); (void) close(1);
close(2); (void) close(2);
/* Reopen them on /dev/null. */ /* Reopen them on /dev/null. */
open("/dev/null", O_RDWR); (void) open("/dev/null", O_RDWR);
open("/dev/null", O_RDWR); (void) open("/dev/null", O_RDWR);
open("/dev/null", O_RDWR); (void) open("/dev/null", O_RDWR);
log_perror = 0; /* No sense logging to /dev/null. */ log_perror = 0; /* No sense logging to /dev/null. */
IGNORE_RET (chdir("/")); IGNORE_RET (chdir("/"));

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2006-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2006-2013 by Internet Systems Consortium, Inc. ("ISC")
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -2752,7 +2752,6 @@ find_client_address(struct reply_state *reply) {
send_addr.len = 16; send_addr.len = 16;
memcpy(send_addr.iabuf, reply->fixed.data, 16); memcpy(send_addr.iabuf, reply->fixed.data, 16);
status = ISC_R_SUCCESS;
scope = &global_scope; scope = &global_scope;
group = reply->subnet->group; group = reply->subnet->group;
goto send_addr; goto send_addr;
@ -3756,7 +3755,6 @@ find_client_prefix(struct reply_state *reply) {
} }
memcpy(&send_pref, &l->cidrnet, sizeof(send_pref)); memcpy(&send_pref, &l->cidrnet, sizeof(send_pref));
status = ISC_R_SUCCESS;
scope = &global_scope; scope = &global_scope;
goto send_pref; goto send_pref;
} }

View File

@ -3,7 +3,7 @@
Failover protocol support code... */ Failover protocol support code... */
/* /*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium * Copyright (c) 1999-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -893,8 +893,7 @@ isc_result_t dhcp_failover_link_get_value (omapi_object_t *h,
return omapi_make_int_value (value, name, return omapi_make_int_value (value, name,
(int)link -> peer_port, MDL); (int)link -> peer_port, MDL);
} else if (!omapi_ds_strcmp (name, "link-state")) { } else if (!omapi_ds_strcmp (name, "link-state")) {
if (link -> state < 0 || if (link -> state >= dhcp_flink_state_max)
link -> state >= dhcp_flink_state_max)
return omapi_make_string_value (value, name, return omapi_make_string_value (value, name,
"invalid link state", "invalid link state",
MDL); MDL);
@ -954,8 +953,7 @@ isc_result_t dhcp_failover_link_stuff_values (omapi_object_t *c,
status = omapi_connection_put_name (c, "link-state"); status = omapi_connection_put_name (c, "link-state");
if (status != ISC_R_SUCCESS) if (status != ISC_R_SUCCESS)
return status; return status;
if (link -> state < 0 || if (link -> state >= dhcp_flink_state_max)
link -> state >= dhcp_flink_state_max)
status = omapi_connection_put_string (c, "invalid link state"); status = omapi_connection_put_string (c, "invalid link state");
else else
status = (omapi_connection_put_string status = (omapi_connection_put_string