From dc9d7b08aa62743e7cbfb1795c324b3c1773ecd0 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 15 May 2013 10:49:54 +1000 Subject: [PATCH] - Silence benign static analysis warnings. [ISC-Bugs #33428] --- RELNOTES | 3 + client/clparse.c | 69 ++++++------ client/dhclient.c | 18 +-- common/alloc.c | 3 +- common/conflex.c | 3 +- common/execute.c | 44 +++++--- common/icmp.c | 8 +- common/inet.c | 3 +- common/parse.c | 255 +++++++++++++++++++++---------------------- common/print.c | 6 +- common/resolv.c | 8 +- common/socket.c | 3 +- common/tree.c | 3 +- configure | 79 ++++++++++++++ configure.ac | 2 + dhcpctl/omshell.c | 18 ++- dst/dst_api.c | 5 +- dst/prandom.c | 6 +- includes/config.h.in | 3 + includes/dhcpd.h | 8 +- omapip/connection.c | 4 +- relay/dhcrelay.c | 18 +-- server/confpars.c | 146 ++++++++++++------------- server/dhcpd.c | 16 +-- server/dhcpv6.c | 4 +- server/failover.c | 8 +- 26 files changed, 417 insertions(+), 326 deletions(-) diff --git a/RELNOTES b/RELNOTES index a37ab9754..251c97989 100644 --- a/RELNOTES +++ b/RELNOTES @@ -60,6 +60,9 @@ work on other platforms. Please report any problems and suggested fixes to Changes since 4.2.5 +- Silence benign static analysis warnings. + [ISC-Bugs #33428] + - Add check for 64-bit package for atf. [ISC-Bugs #32206] diff --git a/client/clparse.c b/client/clparse.c index c535d7b41..a9406a29f 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -3,7 +3,7 @@ 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 * * 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; parse_client_statement (cfile, ip, client); } 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); @@ -341,7 +341,7 @@ void parse_client_statement (cfile, ip, config) switch (peek_token (&val, (unsigned *)0, cfile)) { case INCLUDE: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != STRING) { parse_warn (cfile, "filename string expected."); @@ -355,7 +355,7 @@ void parse_client_statement (cfile, ip, config) return; case KEY: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (ip) { /* This may seem arbitrary, but there's a reason for doing it: the authentication key database is not @@ -378,7 +378,7 @@ void parse_client_statement (cfile, ip, config) case TOKEN_ALSO: /* consume ALSO */ - next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); /* consume type of ALSO list. */ 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 comma-separated list of names of required options. */ case REQUIRE: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile); if (token == AUTHENTICATION) { policy = P_REQUIRE; @@ -456,22 +456,22 @@ void parse_client_statement (cfile, ip, config) return; case IGNORE: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); policy = P_IGNORE; goto do_policy; case ACCEPT: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); policy = P_ACCEPT; goto do_policy; case PREFER: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); policy = P_PREFER; goto do_policy; case DONT: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); policy = P_DONT; goto do_policy; @@ -504,8 +504,7 @@ void parse_client_statement (cfile, ip, config) break; case OPTION: - token = next_token (&val, (unsigned *)0, cfile); - + skip_token(&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile); if (token == SPACE) { if (ip) { @@ -556,12 +555,12 @@ void parse_client_statement (cfile, ip, config) return; case MEDIA: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_string_list (cfile, &config -> media, 1); return; case HARDWARE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (ip) { parse_hardware_param (cfile, &ip -> hw_address); } else { @@ -572,7 +571,7 @@ void parse_client_statement (cfile, ip, config) return; case ANYCAST_MAC: - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); if (ip != NULL) { parse_hardware_param(cfile, &ip->anycast_mac_addr); } else { @@ -583,29 +582,29 @@ void parse_client_statement (cfile, ip, config) return; case REQUEST: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (config -> requested_options == default_requested_options) config -> requested_options = NULL; parse_option_list (cfile, &config -> requested_options); return; case TIMEOUT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_lease_time (cfile, &config -> timeout); return; case RETRY: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_lease_time (cfile, &config -> retry_interval); return; case SELECT_TIMEOUT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_lease_time (cfile, &config -> select_interval); return; case OMAPI: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != PORT) { parse_warn (cfile, @@ -631,7 +630,7 @@ void parse_client_statement (cfile, ip, config) return; case DO_FORWARD_UPDATE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (!strcasecmp (val, "on") || !strcasecmp (val, "true")) @@ -648,32 +647,32 @@ void parse_client_statement (cfile, ip, config) return; case REBOOT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_lease_time (cfile, &config -> reboot_timeout); return; case BACKOFF_CUTOFF: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_lease_time (cfile, &config -> backoff_cutoff); return; case INITIAL_INTERVAL: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_lease_time (cfile, &config -> initial_interval); return; case INITIAL_DELAY: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_lease_time (cfile, &config -> initial_delay); return; case SCRIPT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_string (cfile, &config -> script_name, (unsigned *)0); return; case VENDOR: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != OPTION) { parse_warn (cfile, "expecting 'vendor option space'"); @@ -708,14 +707,14 @@ void parse_client_statement (cfile, ip, config) return; case INTERFACE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (ip) parse_warn (cfile, "nested interface declaration."); parse_interface_declaration (cfile, config, (char *)0); return; case PSEUDO: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); name = dmalloc (strlen (val) + 1, MDL); if (!name) @@ -725,17 +724,17 @@ void parse_client_statement (cfile, ip, config) return; case LEASE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_client_lease_statement (cfile, 1); return; case ALIAS: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_client_lease_statement (cfile, 2); return; case REJECT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_reject_statement (cfile, config); return; @@ -806,7 +805,7 @@ parse_option_list(struct parse *cfile, struct option ***list) } if (!is_identifier (token)) { 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); return 0; } @@ -922,7 +921,7 @@ void parse_interface_declaration (cfile, outer_config, name) break; parse_client_statement (cfile, ip, client -> config); } 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) @@ -1049,7 +1048,7 @@ void parse_client_lease_statement (cfile, is_static) break; parse_client_lease_declaration (cfile, lease, &ip, &client); } while (1); - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); /* If the lease declaration didn't include an interface declaration that we recognized, it's of no use to us. */ diff --git a/client/dhclient.c b/client/dhclient.c index b99825610..cfcf10cd5 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -3,7 +3,7 @@ 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 * * Permission to use, copy, modify, and distribute this software for any @@ -399,7 +399,6 @@ main(int argc, char **argv) { long temp; int e; - oldpid = 0; if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) { e = fscanf(pidfd, "%ld\n", &temp); oldpid = (pid_t)temp; @@ -3470,17 +3469,17 @@ void go_daemon () else if (pid) exit (0); /* Become session leader and get pid... */ - pid = setsid (); + (void) setsid (); /* Close standard I/O descriptors. */ - close(0); - close(1); - close(2); + (void) close(0); + (void) close(1); + (void) close(2); /* Reopen them on /dev/null. */ - open("/dev/null", O_RDWR); - open("/dev/null", O_RDWR); - open("/dev/null", O_RDWR); + (void) open("/dev/null", O_RDWR); + (void) open("/dev/null", O_RDWR); + (void) open("/dev/null", O_RDWR); write_client_pid_file (); @@ -4037,6 +4036,7 @@ client_dns_update(struct client_state *client, dhcp_ddns_cb_t *ddns_cb) * MAC address. */ result = 0; + POST(result); memset(&client_identifier, 0, sizeof(client_identifier)); if (client->active_lease != NULL) { if (((oc = diff --git a/common/alloc.c b/common/alloc.c index 3cbd140ac..ddff848b0 100644 --- a/common/alloc.c +++ b/common/alloc.c @@ -3,7 +3,7 @@ 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) 1996-2003 by Internet Software Consortium * @@ -143,7 +143,6 @@ int option_chain_head_dereference (ptr, file, line) option_cache_dereference ((struct option_cache **) (&car -> car), MDL); dfree (car, MDL); - car = cdr; } dfree (option_chain_head, file, line); diff --git a/common/conflex.c b/common/conflex.c index 4987fc4c4..0da5076f4 100644 --- a/common/conflex.c +++ b/common/conflex.c @@ -3,7 +3,7 @@ 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 * * Permission to use, copy, modify, and distribute this software for any @@ -534,7 +534,6 @@ static enum dhcp_token read_string (cfile) goto again; default: cfile -> tokbuf [i] = c; - bs = 0; break; } bs = 0; diff --git a/common/execute.c b/common/execute.c index bbf027923..d4c8066d4 100644 --- a/common/execute.c +++ b/common/execute.c @@ -3,7 +3,7 @@ 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) 1998-2003 by Internet Software Consortium * @@ -181,6 +181,8 @@ int execute_statements (result, packet, lease, client_state, #if defined (DEBUG_EXPRESSIONS) log_debug ("exec: evaluate: %s", (status ? "succeeded" : "failed")); +#else + POST(status); #endif break; @@ -272,6 +274,8 @@ int execute_statements (result, packet, lease, client_state, #if defined (DEBUG_EXPRESSIONS) log_debug ("exec: return: %s", (status ? "succeeded" : "failed")); +#else + POST(status); #endif break; @@ -331,20 +335,20 @@ int execute_statements (result, packet, lease, client_state, if (!scope) { log_error("set %s: no scope", r->data.set.name); - status = 0; break; } if (!*scope) { if (!binding_scope_allocate(scope, MDL)) { log_error("set %s: can't allocate scope", r->data.set.name); - status = 0; break; } } binding = find_binding(*scope, r->data.set.name); #if defined (DEBUG_EXPRESSIONS) log_debug("exec: set %s", r->data.set.name); +#else + POST(status); #endif if (binding == NULL) { binding = dmalloc(sizeof(*binding), MDL); @@ -395,14 +399,14 @@ int execute_statements (result, packet, lease, client_state, #if defined (DEBUG_EXPRESSIONS) log_debug ("exec: set %s%s", r -> data.set.name, (binding && status ? "" : " (failed)")); +#else + POST(status); #endif break; case unset_statement: - if (!scope || !*scope) { - status = 0; + if (!scope || !*scope) break; - } binding = find_binding (*scope, r -> data.unset); if (binding) { if (binding -> value) @@ -414,6 +418,8 @@ int execute_statements (result, packet, lease, client_state, #if defined (DEBUG_EXPRESSIONS) log_debug ("exec: unset %s: %s", r -> data.unset, (status ? "found" : "not found")); +#else + POST(status); #endif break; @@ -463,6 +469,8 @@ int execute_statements (result, packet, lease, client_state, #if defined (DEBUG_EXPRESSIONS) log_debug("exec: let %s%s", e->data.let.name, (binding && status ? "" : "failed")); +#else + POST(status); #endif if (!e->data.let.statements) { } else if (e->data.let.statements->op == @@ -758,11 +766,11 @@ void write_statements (file, statements, indent) } if (r -> data.on.evtypes & ON_COMMIT) { fprintf (file, "%scommit", s); - s = "or"; + s = " or "; } if (r -> data.on.evtypes & ON_RELEASE) { fprintf (file, "%srelease", s); - s = "or"; + /* s = " or "; */ } if (r -> data.on.statements) { fprintf (file, " {"); @@ -842,7 +850,7 @@ void write_statements (file, statements, indent) case eval_statement: indent_spaces (file, indent); fprintf (file, "eval "); - col = write_expression (file, r -> data.eval, + (void) write_expression (file, r -> data.eval, indent + 5, indent + 5, 1); fprintf (file, ";"); break; @@ -916,11 +924,11 @@ void write_statements (file, statements, indent) fprintf (file, "set "); col = token_print_indent (file, indent + 4, indent + 4, "", "", 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, indent + 3, indent + 3, 0); - col = token_print_indent (file, col, indent + 4, + (void) token_print_indent (file, col, indent + 4, " ", "", ";"); break; @@ -929,7 +937,7 @@ void write_statements (file, statements, indent) fprintf (file, "unset "); col = token_print_indent (file, indent + 6, indent + 6, "", "", r -> data.set.name); - col = token_print_indent (file, col, indent + 6, + (void) token_print_indent (file, col, indent + 6, " ", "", ";"); break; @@ -940,29 +948,29 @@ void write_statements (file, statements, indent) "", "", "("); switch (r -> data.log.priority) { case log_priority_fatal: - col = token_print_indent + (void) token_print_indent (file, col, indent + 4, "", " ", "fatal,"); break; case log_priority_error: - col = token_print_indent + (void) token_print_indent (file, col, indent + 4, "", " ", "error,"); break; case log_priority_debug: - col = token_print_indent + (void) token_print_indent (file, col, indent + 4, "", " ", "debug,"); break; case log_priority_info: - col = token_print_indent + (void) token_print_indent (file, col, indent + 4, "", " ", "info,"); break; } col = write_expression (file, r -> data.log.expr, indent + 4, indent + 4, 0); - col = token_print_indent (file, col, indent + 4, + (void) token_print_indent (file, col, indent + 4, "", "", ");"); break; @@ -979,7 +987,7 @@ void write_statements (file, statements, indent) col = token_print_indent(file, col, indent + 4, "", " ", ","); 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 */ log_fatal("Impossible case at %s:%d (ENABLE_EXECUTE " "is not defined).", MDL); diff --git a/common/icmp.c b/common/icmp.c index cf9a7459d..ce72c7835 100644 --- a/common/icmp.c +++ b/common/icmp.c @@ -4,7 +4,7 @@ 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) 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) { - struct icmp *icmp; 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", - length, (int)((sizeof (*icmp)) + (sizeof ia))); + length, (int)(sizeof (struct icmp) + sizeof (ia))); return; } ia.len = 4; memcpy (ia.iabuf, buf, 4); - icmp = (struct icmp *)(buf + 1); log_error ("trace_icmp_output_input: unsent ping to %s", piaddr (ia)); } diff --git a/common/inet.c b/common/inet.c index 39845a827..ac3904772 100644 --- a/common/inet.c +++ b/common/inet.c @@ -4,7 +4,7 @@ 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) 2004,2005 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium @@ -198,7 +198,6 @@ addr_match(addr, match) if (addr->len != match->addr.len) return 0; - i = 0; for (i = 0 ; i < addr->len ; i++) { if ((addr->iabuf[i] & match->mask.iabuf[i]) != match->addr.iabuf[i]) diff --git a/common/parse.c b/common/parse.c index ac8e6613e..ad31f8ab4 100644 --- a/common/parse.c +++ b/common/parse.c @@ -3,7 +3,7 @@ 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 * * Permission to use, copy, modify, and distribute this software for any @@ -110,7 +110,7 @@ void skip_to_rbrace (cfile, brace_count) do { token = peek_token (&val, (unsigned *)0, cfile); if (token == RBRACE) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (brace_count) { if (!--brace_count) return; @@ -119,13 +119,13 @@ void skip_to_rbrace (cfile, brace_count) } else if (token == LBRACE) { brace_count++; } else if (token == SEMI && !brace_count) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); return; } else if (token == EOL) { /* EOL only happens when parsing /etc/resolv.conf, and we treat it like a semicolon because the resolv.conf file is line-oriented. */ - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); return; } token = next_token (&val, (unsigned *)0, cfile); @@ -206,7 +206,7 @@ char *parse_host_name (cfile) token = peek_token (&val, (unsigned *)0, cfile); if (!is_identifier (token) && token != NUMBER) break; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); /* Store this identifier... */ 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. */ save_parse_state(cfile); - (void) next_token(NULL, NULL, cfile); + skip_token(NULL, NULL, cfile); if (next_token(NULL, NULL, cfile) == DOT && next_token(NULL, NULL, cfile) == NUMBER) ipaddr = 1; @@ -498,7 +498,7 @@ parse_ip_addr_with_subnet(cfile, match) token = peek_token(&val, NULL, cfile); if (token == SLASH) { - next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile); if (token != NUMBER) { @@ -733,7 +733,7 @@ unsigned char *parse_numeric_aggregate (cfile, buf, dfree(bufp, MDL); return (unsigned char *)0; } - token = next_token (&val, (unsigned *)0, cfile); + skip_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 */ token = peek_token(&val, NULL, cfile); if (token == NEVER) { - token = next_token(&val, NULL, cfile); /* consume NEVER */ + skip_token(&val, NULL, cfile); /* consume NEVER */ return(MAX_TIME); } /* This indicates 'local' time format. */ if (token == EPOCH) { - token = next_token(&val, NULL, cfile); /* consume EPOCH */ + skip_token(&val, NULL, cfile); /* consume EPOCH */ token = peek_token(&val, NULL, cfile); if (token != NUMBER) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "Seconds since epoch expected."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume number */ + skip_token(&val, NULL, cfile); /* consume number */ guess = atoi(val); return((TIME)guess); @@ -972,22 +972,22 @@ parse_date_core(cfile) if (token != NUMBER) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "numeric day of week expected."); 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 */ /* Year... */ token = peek_token(&val, NULL, cfile); if (token != NUMBER) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "numeric year expected."); 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 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); if (token != SLASH) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "expected slash separating year from month."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume SLASH */ + skip_token(&val, NULL, cfile); /* consume SLASH */ /* Month... */ token = peek_token(&val, NULL, cfile); if (token != NUMBER) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "numeric month expected."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume month */ + skip_token(&val, NULL, cfile); /* consume month */ mon = atoi(val) - 1; /* Slash separating month from day... */ token = peek_token(&val, NULL, cfile); if (token != SLASH) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "expected slash separating month from day."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume SLASH */ + skip_token(&val, NULL, cfile); /* consume SLASH */ /* Day of month... */ token = peek_token(&val, NULL, cfile); if (token != NUMBER) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "numeric day of month expected."); 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); /* Hour... */ token = peek_token(&val, NULL, cfile); if (token != NUMBER) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "numeric hour expected."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume hour */ + skip_token(&val, NULL, cfile); /* consume hour */ hour = atoi(val); /* Colon separating hour from minute... */ token = peek_token(&val, NULL, cfile); if (token != COLON) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "expected colon separating hour from minute."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume colon */ + skip_token(&val, NULL, cfile); /* consume colon */ /* Minute... */ token = peek_token(&val, NULL, cfile); if (token != NUMBER) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "numeric minute expected."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume minute */ + skip_token(&val, NULL, cfile); /* consume minute */ min = atoi(val); /* Colon separating minute from second... */ token = peek_token(&val, NULL, cfile); if (token != COLON) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "expected colon separating minute from second."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume colon */ + skip_token(&val, NULL, cfile); /* consume colon */ /* Second... */ token = peek_token(&val, NULL, cfile); if (token != NUMBER) { if (token != SEMI) - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "numeric second expected."); return((TIME)0); } - token = next_token(&val, NULL, cfile); /* consume second */ + skip_token(&val, NULL, cfile); /* consume second */ sec = atoi(val); tzoff = 0; token = peek_token(&val, NULL, cfile); if (token == NUMBER) { - token = next_token(&val, NULL, cfile); /* consume tzoff */ + skip_token(&val, NULL, cfile); /* consume tzoff */ tzoff = atoi(val); } else if (token != SEMI) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "Time zone offset or semicolon expected."); return((TIME)0); @@ -1189,7 +1189,7 @@ parse_option_name (cfile, allocate, known, opt) token = peek_token (&val, (unsigned *)0, cfile); if (token == DOT) { /* 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... */ token = next_token (&val, (unsigned *)0, cfile); @@ -1308,7 +1308,7 @@ void parse_option_space_decl (cfile) char *nu_name; 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 caller. */ token = next_token (&val, (unsigned *)0, cfile); @@ -1670,7 +1670,7 @@ int parse_option_code_definition (cfile, option) /* Consume optional compression indicator. */ token = peek_token(&val, NULL, cfile); if (token == COMPRESSED) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); tokbuf[tokix++] = 'D'; type = 'c'; } else @@ -2028,7 +2028,7 @@ int parse_cshl (data, cfile) token = peek_token (&val, (unsigned *)0, cfile); if (token != COLON) break; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); } while (1); 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); switch (token) { case DB_TIME_FORMAT: - next_token(&val, NULL, cfile); - + skip_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile); if (token == DEFAULT) { db_time_format = DEFAULT_TIME_FORMAT; @@ -2131,11 +2130,11 @@ int parse_executable_statement (result, cfile, lose, case_context) return 1; case IF: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); return parse_if_statement (result, cfile, lose); case TOKEN_ADD: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != STRING) { parse_warn (cfile, "expecting class name."); @@ -2163,7 +2162,7 @@ int parse_executable_statement (result, cfile, lose, case_context) break; case BREAK: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!parse_semi (cfile)) { *lose = 1; return 0; @@ -2174,7 +2173,7 @@ int parse_executable_statement (result, cfile, lose, case_context) break; case SEND: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); known = 0; status = parse_option_name (cfile, 0, &known, &option); if (status != ISC_R_SUCCESS || option == NULL) { @@ -2188,7 +2187,7 @@ int parse_executable_statement (result, cfile, lose, case_context) case SUPERSEDE: case OPTION: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); known = 0; status = parse_option_name (cfile, 0, &known, &option); if (status != ISC_R_SUCCESS || option == NULL) { @@ -2209,7 +2208,7 @@ int parse_executable_statement (result, cfile, lose, case_context) case IGNORE: flag = 2; pad: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); cache = (struct option_cache *)0; if (!parse_allow_deny (&cache, cfile, flag)) return 0; @@ -2220,7 +2219,7 @@ int parse_executable_statement (result, cfile, lose, case_context) break; case DEFAULT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile); if (token == COLON) goto switch_default; @@ -2236,7 +2235,7 @@ int parse_executable_statement (result, cfile, lose, case_context) return status; case PREPEND: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); known = 0; status = parse_option_name (cfile, 0, &known, &option); if (status != ISC_R_SUCCESS || option == NULL) { @@ -2249,7 +2248,7 @@ int parse_executable_statement (result, cfile, lose, case_context) return status; case APPEND: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); known = 0; status = parse_option_name (cfile, 0, &known, &option); if (status != ISC_R_SUCCESS || option == NULL) { @@ -2262,15 +2261,15 @@ int parse_executable_statement (result, cfile, lose, case_context) return status; case ON: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); return parse_on_statement (result, cfile, lose); case SWITCH: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); return parse_switch_statement (result, cfile, lose); case CASE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (case_context == context_any) { parse_warn (cfile, "case statement in inappropriate scope."); @@ -2282,7 +2281,7 @@ int parse_executable_statement (result, cfile, lose, case_context) cfile, lose, case_context); switch_default: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (case_context == context_any) { parse_warn (cfile, "switch default statement in %s", "inappropriate scope."); @@ -2298,7 +2297,7 @@ int parse_executable_statement (result, cfile, lose, case_context) case DEFINE: case TOKEN_SET: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (token == DEFINE) flag = 1; else @@ -2424,8 +2423,7 @@ int parse_executable_statement (result, cfile, lose, case_context) break; case UNSET: - token = next_token (&val, (unsigned *)0, cfile); - + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != NAME && token != NUMBER_OR_NAME) { parse_warn (cfile, @@ -2450,8 +2448,7 @@ int parse_executable_statement (result, cfile, lose, case_context) break; case EVAL: - token = next_token (&val, (unsigned *)0, cfile); - + skip_token(&val, (unsigned *)0, cfile); if (!executable_statement_allocate (result, MDL)) log_fatal ("no memory for eval statement."); (*result) -> op = eval_statement; @@ -2476,7 +2473,7 @@ int parse_executable_statement (result, cfile, lose, case_context) case EXECUTE: #ifdef ENABLE_EXECUTE - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); if (!executable_statement_allocate (result, MDL)) log_fatal ("no memory for execute statement."); @@ -2546,7 +2543,7 @@ int parse_executable_statement (result, cfile, lose, case_context) break; case RETURN: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!executable_statement_allocate (result, MDL)) log_fatal ("no memory for return statement."); @@ -2572,7 +2569,7 @@ int parse_executable_statement (result, cfile, lose, case_context) break; case LOG: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!executable_statement_allocate (result, MDL)) log_fatal ("no memory for log statement."); @@ -2601,7 +2598,7 @@ int parse_executable_statement (result, cfile, lose, case_context) i = 0; } if (i) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != COMMA) { 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 parsers. */ case ZONE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); zone = (struct dns_zone *)0; if (!dns_zone_allocate (&zone, MDL)) 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. */ case KEY: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!parse_key (cfile)) { *lose = 1; return 0; @@ -2693,8 +2690,7 @@ int parse_executable_statement (result, cfile, lose, case_context) config_universe->name_hash, val, 0, MDL); if (option) { - token = next_token (&val, - (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); status = parse_option_statement (result, cfile, 1, option, supersede_option_statement); @@ -2790,7 +2786,7 @@ int parse_zone (struct dns_zone *zone, struct parse *cfile) log_fatal ("can't allocate secondary."); oc = zone -> secondary; consemup: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); do { struct expression *expr = (struct expression *)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."); oc = zone->secondary6; consemup6: - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); do { struct expression *expr = NULL; if (parse_ip6_addr_expr(&expr, cfile) == 0) { @@ -2882,10 +2878,10 @@ int parse_zone (struct dns_zone *zone, struct parse *cfile) break; case KEY: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile); if (token == STRING) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); key_name = (char *)0; } else { key_name = parse_host_name (cfile); @@ -2943,7 +2939,7 @@ int parse_key (struct parse *cfile) token = peek_token (&val, (unsigned *)0, cfile); if (token == STRING) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); key -> name = dmalloc (strlen (val) + 1, MDL); if (!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 closing brace. */ token = peek_token (&val, (unsigned *)0, cfile); - if (token == SEMI) - token = next_token (&val, (unsigned *)0, cfile); + if (token == SEMI) { + skip_token(&val, (unsigned *)0, cfile); + } /* Remember the 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); if (token == LPAREN) { parenp = 1; - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); } else parenp = 0; @@ -3341,10 +3338,10 @@ int parse_if_statement (result, cfile, lose) } token = peek_token (&val, (unsigned *)0, cfile); if (token == ELSE) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile); if (token == IF) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!parse_if_statement (&(*result) -> data.ie.fc, cfile, lose)) { if (!*lose) @@ -3361,7 +3358,7 @@ int parse_if_statement (result, cfile, lose) executable_statement_dereference (result, MDL); return 0; } else { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!(parse_executable_statements (&(*result) -> data.ie.fc, cfile, lose, context_any))) { @@ -3378,7 +3375,7 @@ int parse_if_statement (result, cfile, lose) } } } 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, cfile, lose)) { if (!*lose) @@ -3580,7 +3577,7 @@ int parse_non_binary (expr, cfile, lose, context) /* Check for unary operators... */ switch (token) { case CHECK: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != STRING) { parse_warn (cfile, "string expected."); @@ -3603,7 +3600,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case TOKEN_NOT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); #if defined(NSUPDATE_OLD) if (context == context_dns) { token = peek_token (&val, (unsigned *)0, cfile); @@ -3633,7 +3630,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case LPAREN: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!parse_expression (expr, cfile, lose, context, (struct expression **)0, expr_none)) { if (!*lose) { @@ -3657,7 +3654,7 @@ int parse_non_binary (expr, cfile, lose, context) if (context == context_dns) goto ns_exists; #endif - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_exists; @@ -3674,21 +3671,21 @@ int parse_non_binary (expr, cfile, lose, context) break; case STATIC: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_static; break; case KNOWN: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_known; break; case SUBSTRING: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_substring; @@ -3757,7 +3754,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case SUFFIX: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_suffix; @@ -3784,7 +3781,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case LCASE: - token = next_token(&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate(expr, MDL)) log_fatal ("can't allocate expression"); (*expr)->op = expr_lcase; @@ -3802,7 +3799,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case UCASE: - token = next_token(&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate(expr, MDL)) log_fatal ("can't allocate expression"); (*expr)->op = expr_ucase; @@ -3821,7 +3818,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case CONCAT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_concat; @@ -3863,7 +3860,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case BINARY_TO_ASCII: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_binary_to_ascii; @@ -3906,7 +3903,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case REVERSE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_reverse; @@ -3935,7 +3932,7 @@ int parse_non_binary (expr, cfile, lose, context) case PICK: /* pick (a, b, c) actually produces an internal representation 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))) log_fatal ("can't allocate expression"); @@ -3981,7 +3978,7 @@ int parse_non_binary (expr, cfile, lose, context) parse_warn (cfile, "Please rebuild dhcpd with --with-nsupdate."); #endif - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (token == DNS_UPDATE) opcode = expr_ns_add; else @@ -4088,7 +4085,7 @@ int parse_non_binary (expr, cfile, lose, context) parse_warn (cfile, "Please rebuild dhcpd with --with-nsupdate."); #endif - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); @@ -4256,7 +4253,7 @@ int parse_non_binary (expr, cfile, lose, context) (*expr) -> op = (token == OPTION ? expr_option : expr_config_option); - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); known = 0; /* Pass reference directly to expression structure. */ status = parse_option_name(cfile, 0, &known, @@ -4270,56 +4267,56 @@ int parse_non_binary (expr, cfile, lose, context) break; case HARDWARE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_hardware; break; case LEASED_ADDRESS: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_leased_address; break; case CLIENT_STATE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_client_state; break; case FILENAME: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_filename; break; case SERVER_NAME: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_sname; break; case LEASE_TIME: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_lease_time; break; case TOKEN_NULL: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_null; break; case HOST_DECL_NAME: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_host_decl_name; @@ -4327,8 +4324,7 @@ int parse_non_binary (expr, cfile, lose, context) #if defined(NSUPDATE_OLD) case UPDATED_DNS_RR: - token = next_token (&val, (unsigned *)0, cfile); - + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != LPAREN) goto nolparen; @@ -4364,7 +4360,7 @@ int parse_non_binary (expr, cfile, lose, context) break; #endif /* NSUPDATE_OLD */ case PACKET: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_packet; @@ -4391,14 +4387,14 @@ int parse_non_binary (expr, cfile, lose, context) break; case STRING: - token = next_token (&val, &len, cfile); + skip_token(&val, &len, cfile); if (!make_const_data (expr, (const unsigned char *)val, len, 1, 1, MDL)) log_fatal ("can't make constant string expression."); break; case EXTRACT_INT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != LPAREN) { parse_warn (cfile, "left parenthesis expected."); @@ -4468,7 +4464,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case ENCODE_INT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != LPAREN) { parse_warn (cfile, "left parenthesis expected."); @@ -4539,7 +4535,7 @@ int parse_non_binary (expr, cfile, lose, context) number, by itself. */ if (context == context_numeric || context == context_data_or_numeric) { - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_const_int; @@ -4562,7 +4558,7 @@ int parse_non_binary (expr, cfile, lose, context) known = FORMERR; goto ns_const; ns_const: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_const_int; @@ -4638,7 +4634,7 @@ int parse_non_binary (expr, cfile, lose, context) goto ns_const; case DEFINED: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != LPAREN) goto nolparen; @@ -4665,7 +4661,7 @@ int parse_non_binary (expr, cfile, lose, context) /* This parses 'gethostname()'. */ case GETHOSTNAME: - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); if (!expression_allocate(expr, MDL)) log_fatal("can't allocate expression"); (*expr)->op = expr_gethostname; @@ -4680,8 +4676,7 @@ int parse_non_binary (expr, cfile, lose, context) break; case GETHOSTBYNAME: - token = next_token(&val, NULL, cfile); - + skip_token(&val, NULL, cfile); token = next_token(NULL, NULL, cfile); if (token != LPAREN) goto nolparen; @@ -4709,7 +4704,7 @@ int parse_non_binary (expr, cfile, lose, context) if (token != NAME && token != NUMBER_OR_NAME) return 0; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); /* Save the name of the variable being referenced. */ cptr = dmalloc (strlen (val) + 1, MDL); @@ -4727,7 +4722,7 @@ int parse_non_binary (expr, cfile, lose, context) break; } - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!expression_allocate (expr, MDL)) log_fatal ("can't allocate expression"); (*expr) -> op = expr_funcall; @@ -4816,7 +4811,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop) token = peek_token (&val, (unsigned *)0, cfile); switch (token) { case BANG: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile); if (token != EQUAL) { parse_warn (cfile, "! in boolean context without ="); @@ -4837,7 +4832,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop) case TILDE: #ifdef HAVE_REGEX_H - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile); if (token == TILDE) @@ -4929,7 +4924,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop) lhs = rhs; rhs = (struct expression *)0; binop = next_op; - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); 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 * 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. */ 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... */ - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); /* Now combine the LHS and the RHS using binop. */ tmp = (struct expression *)0; @@ -5170,8 +5165,7 @@ struct option *option; token = peek_token (&val, (unsigned *)0, cfile); /* Comma means: continue with next element in array */ if (token == COMMA) { - token = next_token (&val, - (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); continue; } /* 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 * eat the semicolon token in that case. */ - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); } else if (token == EQUAL) { /* 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. */ 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) { dfree((char *)val, MDL); freeval = ISC_FALSE; + POST(freeval); } break; @@ -5864,7 +5859,7 @@ int parse_X (cfile, buf, max) } while (token == COLON); val = (char *)buf; } else if (token == STRING) { - token = next_token (&val, &len, cfile); + skip_token(&val, &len, cfile); if (len + 1 > max) { parse_warn (cfile, "string constant too long."); skip_to_semi (cfile); @@ -5952,7 +5947,7 @@ parse_domain_list(struct parse *cfile, int compress) do { /* Consume the COMMA token if peeked. */ if (token == COMMA) - next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); /* Get next (or first) value. */ token = next_token(&val, &len, cfile); diff --git a/common/print.c b/common/print.c index b113bec18..04c453a43 100644 --- a/common/print.c +++ b/common/print.c @@ -3,7 +3,7 @@ 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) 1995-2003 by Internet Software Consortium * @@ -1193,7 +1193,7 @@ int token_print_indent_concat (FILE *file, int col, int indent, } va_end (list); - len = token_print_indent (file, col, indent, + col = token_print_indent (file, col, indent, prefix, suffix, t); dfree (t, MDL); return col; @@ -1248,7 +1248,7 @@ int token_print_indent (FILE *file, int col, int indent, { int len = 0; if (prefix != NULL) - len = strlen (prefix); + len += strlen (prefix); if (buf != NULL) len += strlen (buf); diff --git a/common/resolv.c b/common/resolv.c index b29d4cf17..902817e78 100644 --- a/common/resolv.c +++ b/common/resolv.c @@ -3,7 +3,8 @@ 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 * * 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; *dp = nd; nd -> domain = dn; - dn = (char *)0; } nd -> rcdate = parse_time; token = peek_token (&val, @@ -100,7 +100,7 @@ void read_resolv_conf (parse_time) "junk after domain declaration"); skip_to_semi (cfile); } - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); } else if (token == NAMESERVER) { struct name_server *ns, **sp; struct iaddr iaddr; @@ -136,7 +136,7 @@ void read_resolv_conf (parse_time) } else skip_to_semi (cfile); /* Ignore what we don't grok. */ } 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. */ sl = (struct name_server *)0; diff --git a/common/socket.c b/common/socket.c index f95665c32..64f531462 100644 --- a/common/socket.c +++ b/common/socket.c @@ -3,7 +3,7 @@ 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 * * 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_controllen = control_buf_len; cmsg = CMSG_FIRSTHDR(&m); + INSIST(cmsg != NULL); cmsg->cmsg_level = IPPROTO_IPV6; cmsg->cmsg_type = IPV6_PKTINFO; cmsg->cmsg_len = CMSG_LEN(sizeof(*pktinfo)); diff --git a/common/tree.c b/common/tree.c index 8c2056c62..b9a88b9f5 100644 --- a/common/tree.c +++ b/common/tree.c @@ -3,7 +3,7 @@ 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) 1995-2003 by Internet Software Consortium * @@ -587,7 +587,6 @@ int evaluate_expression (result, packet, lease, client_state, strcpy (nb -> name, s -> string); else { dfree (nb, MDL); - nb = (struct binding *)0; goto blb; } } diff --git a/configure b/configure index bdeb473dc..c5f563f76 100755 --- a/configure +++ b/configure @@ -2014,6 +2014,73 @@ fi } # 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 declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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 # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including @@ -6180,6 +6247,18 @@ if test "$ac_res" != no; then : 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing if_nametoindex" >&5 $as_echo_n "checking for library containing if_nametoindex... " >&6; } diff --git a/configure.ac b/configure.ac index d14a0193c..84d15c1d7 100644 --- a/configure.ac +++ b/configure.ac @@ -535,6 +535,8 @@ AC_SEARCH_LIBS(inet_aton, [socket nsl], , # Check for a standalone regex library. AC_SEARCH_LIBS(regcomp, [regex]) +AC_CHECK_FUNCS(strlcat) + # For HP/UX we need -lipv6 for if_nametoindex, perhaps others. AC_SEARCH_LIBS(if_nametoindex, [ipv6]) diff --git a/dhcpctl/omshell.c b/dhcpctl/omshell.c index bb489d845..22506eec9 100644 --- a/dhcpctl/omshell.c +++ b/dhcpctl/omshell.c @@ -3,7 +3,7 @@ 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) 2001-2003 by Internet Software Consortium * @@ -466,8 +466,12 @@ main(int argc, char **argv) { break; } - s1[0] = '\0'; - strncat (s1, val, sizeof(s1)-1); +#ifdef HAVE_STRLCPY + 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); if (token != EQUAL) @@ -570,8 +574,12 @@ main(int argc, char **argv) { break; } - s1[0] = '\0'; - strncat (s1, val, sizeof(s1)-1); +#if HAVE_STRLCPY + 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); if (token != END_OF_FILE && token != EOL) diff --git a/dst/dst_api.c b/dst/dst_api.c index 85f2ec6a5..ddaf50fcf 100644 --- a/dst/dst_api.c +++ b/dst/dst_api.c @@ -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) 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 * purpose with or without fee is hereby granted, provided that the above @@ -100,7 +100,6 @@ dst_init() done_init = 1; s = getenv("DSTKEYPATH"); - len = 0; if (s) { struct stat statbuf; @@ -367,7 +366,7 @@ dst_read_key(const char *in_keyname, const unsigned in_id, pubkey->dk_alg) == 0) dg_key = dst_free_key(dg_key); - pubkey = dst_free_key(pubkey); + (void) dst_free_key(pubkey); return (dg_key); } diff --git a/dst/prandom.c b/dst/prandom.c index ba87094f1..fbb9a200c 100644 --- a/dst/prandom.c +++ b/dst/prandom.c @@ -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 $"; #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) 1995-1998 by Trusted Information Systems, Inc. * @@ -336,7 +336,7 @@ do_ls(dst_work *work) static int i = 0; static unsigned long d_round = 0; struct timeval tv; - int n = 0, tb_i = 0, out = 0; + int n = 0, out = 0; unsigned dir_len; char file_name[1024]; @@ -360,7 +360,6 @@ do_ls(dst_work *work) EREPORT(("do_ls i %d filled %4d in_temp %4d\n", i-1, work->filled, work->in_temp)); memcpy(tmp_buff, &buf, sizeof(buf)); - tb_i += sizeof(buf); 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) { temp = dst_s_quick_random((int) buff[n - 1]); memcpy(&buff[n], &temp, sizeof(temp)); - n += sizeof(temp); } /* covert this into a HMAC key */ new_key = dst_buffer_to_key("", KEY_HMAC_MD5, 0, 0, buff, size); diff --git a/includes/config.h.in b/includes/config.h.in index 88d252fba..a93a2d475 100644 --- a/includes/config.h.in +++ b/includes/config.h.in @@ -82,6 +82,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H diff --git a/includes/dhcpd.h b/includes/dhcpd.h index 3d513dda6..4c5cef0c9 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -3,7 +3,7 @@ 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 * * 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); enum dhcp_token peek_raw_token(const char **rval, unsigned *rlen, 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 */ void parse_trace_setup (void); diff --git a/omapip/connection.c b/omapip/connection.c index d08524d23..66aa24f65 100644 --- a/omapip/connection.c +++ b/omapip/connection.c @@ -3,7 +3,7 @@ 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) 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; memcpy (addrs -> addresses [0].address, &foo, sizeof foo); addrs -> addresses [0].port = port; - hix = 1; } status = omapi_connect_list (c, addrs, (omapi_addr_t *)0); omapi_addr_list_dereference (&addrs, MDL); @@ -355,6 +354,7 @@ static void trace_connect_input (trace_type_t *ttype, s += sizeof remote.sin_addr; memcpy (&local.sin_addr, s, sizeof local.sin_addr); s += sizeof local.sin_addr; + POST(s); connect_index = ntohl (connect_index); listener_index = ntohl (listener_index); diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c index 771aab5d2..06a36d249 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -3,7 +3,7 @@ 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 * * 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(arr); log_info(url); - } else { - quiet = 0; + } else log_perror = 0; - } /* Set default port */ if (local_family == AF_INET) { @@ -563,10 +561,10 @@ main(int argc, char **argv) { } } - close(0); - close(1); - close(2); - pid = setsid(); + (void) close(0); + (void) close(1); + (void) close(2); + (void) setsid(); IGNORE_RET (chdir("/")); } @@ -1052,9 +1050,11 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, if (end_pad != NULL) sp = end_pad; +#if 0 /* Remember where the end of the packet was after parsing it. */ op = sp; +#endif /* Sanity check. Had better not ever happen. */ 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. */ - if (!dp && !downstreams->next) + if (!dp && downstreams && !downstreams->next) dp = downstreams; if (!dp) { log_info("Can't find the down interface."); diff --git a/server/confpars.c b/server/confpars.c index 1c4923438..47422e5df 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -3,7 +3,7 @@ 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 * * 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, declaration); } 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; return status; @@ -373,7 +373,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) switch (token) { case INCLUDE: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != STRING) { parse_warn (cfile, "filename string expected."); @@ -387,7 +387,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return 1; case HOST: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type != HOST_DECL && type != CLASS_DECL) { if (global_host_once && (type == SUBNET_DECL || type == SHARED_NET_DECL)) { @@ -406,7 +406,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return 1; case GROUP: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type != HOST_DECL && type != CLASS_DECL) parse_group_declaration (cfile, group); else { @@ -417,7 +417,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return 1; case SHARED_NETWORK: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type == SHARED_NET_DECL || type == HOST_DECL || type == SUBNET_DECL || @@ -433,7 +433,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) case SUBNET: case SUBNET6: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type == HOST_DECL || type == SUBNET_DECL || type == CLASS_DECL) { parse_warn (cfile, @@ -515,7 +515,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return 1; case VENDOR_CLASS: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type == CLASS_DECL) { parse_warn (cfile, "class declarations not allowed here."); @@ -526,7 +526,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return 1; case USER_CLASS: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type == CLASS_DECL) { parse_warn (cfile, "class declarations not allowed here."); @@ -537,7 +537,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return 1; case CLASS: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type == CLASS_DECL) { parse_warn (cfile, "class declarations not allowed here."); @@ -548,7 +548,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return 1; case SUBCLASS: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type == CLASS_DECL) { parse_warn (cfile, "class declarations not allowed here."); @@ -560,7 +560,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return 1; case HARDWARE: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); memset (&hardware, 0, sizeof hardware); if (host_decl && memcmp(&hardware, &(host_decl->interface), sizeof(hardware)) != 0) { @@ -579,7 +579,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) case FIXED_ADDR: case FIXED_ADDR6: - next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); cache = NULL; if (parse_fixed_addr_param(&cache, cfile, token)) { if (host_decl) { @@ -601,7 +601,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) break; case POOL: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type == POOL_DECL) { parse_warn (cfile, "pool declared within pool."); skip_to_semi(cfile); @@ -614,7 +614,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return declaration; case RANGE: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (type != SUBNET_DECL || !group -> subnet) { parse_warn (cfile, "range declaration not allowed here."); @@ -627,7 +627,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) #ifdef DHCPv6 case RANGE6: - next_token(NULL, NULL, cfile); + skip_token(NULL, NULL, cfile); if ((type != SUBNET_DECL) || (group->subnet == NULL)) { parse_warn (cfile, "range6 declaration not allowed here."); @@ -638,7 +638,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return declaration; case PREFIX6: - next_token(NULL, NULL, cfile); + skip_token(NULL, NULL, cfile); if ((type != SUBNET_DECL) || (group->subnet == NULL)) { parse_warn (cfile, "prefix6 declaration not allowed here."); @@ -649,7 +649,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) return declaration; case FIXED_PREFIX6: - next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); if (!host_decl) { parse_warn (cfile, "fixed-prefix6 declaration not " @@ -663,7 +663,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) #endif /* DHCPv6 */ case TOKEN_NOT: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); switch (token) { case AUTHORITATIVE: @@ -676,7 +676,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) } break; case AUTHORITATIVE: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); group -> authoritative = 1; authoritative: if (type == HOST_DECL) @@ -692,11 +692,11 @@ int parse_statement (cfile, group, type, host_decl, declaration) &code, 0, MDL)) log_fatal("Server identifier not in hash (%s:%d).", MDL); - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); goto finish_option; case OPTION: - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile); if (token == SPACE) { if (type != ROOT_GROUP) { @@ -723,7 +723,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) option_dereference(&option, MDL); break; } - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); /* * 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); switch (token) { case TOKEN_NO: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != FAILOVER || (token = next_token (&val, (unsigned *)0, @@ -1484,7 +1484,7 @@ void parse_pool_statement (cfile, group, type) #if defined (FAILOVER_PROTOCOL) case FAILOVER: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != PEER) { parse_warn (cfile, "expecting 'peer'."); @@ -1513,7 +1513,7 @@ void parse_pool_statement (cfile, group, type) #endif case RANGE: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); parse_address_range (cfile, group, type, pool, &lpchain); break; @@ -1525,7 +1525,7 @@ void parse_pool_statement (cfile, group, type) permit = new_permit (MDL); if (!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); switch (token) { case UNKNOWN: @@ -1639,7 +1639,7 @@ void parse_pool_statement (cfile, group, type) goto get_permit; case RBRACE: - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); done = 1; break; @@ -1783,11 +1783,11 @@ void parse_host_declaration (cfile, group) do { token = peek_token (&val, (unsigned *)0, cfile); if (token == RBRACE) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); break; } 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"); break; } @@ -1795,7 +1795,7 @@ void parse_host_declaration (cfile, group) remember to save it. */ if (token == DYNAMIC) { dynamicp = 1; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!parse_semi (cfile)) break; continue; @@ -1804,7 +1804,7 @@ void parse_host_declaration (cfile, group) remember to save it. */ if (token == TOKEN_DELETED) { deleted = 1; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!parse_semi (cfile)) break; continue; @@ -1812,7 +1812,7 @@ void parse_host_declaration (cfile, group) if (token == GROUP) { struct group_object *go; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != STRING && !is_identifier (token)) { parse_warn (cfile, @@ -1843,7 +1843,7 @@ void parse_host_declaration (cfile, group) unsigned char *t = 0; unsigned len; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); data_string_forget (&host -> client_identifier, MDL); 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. */ token = peek_token (&val, (unsigned *)0, cfile); if (token == STRING) { - token = next_token (&val, &len, cfile); + skip_token(&val, &len, cfile); s = val; host -> client_identifier.terminated = 1; } else { @@ -1897,7 +1897,7 @@ void parse_host_declaration (cfile, group) skip_to_rbrace(cfile, 1); break; } - next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile); if (token != OPTION) { parse_warn(cfile, @@ -2072,7 +2072,7 @@ int parse_class_declaration (cp, cfile, group, type) if (type == CLASS_TYPE_SUBCLASS) { token = peek_token (&val, (unsigned *)0, cfile); if (token == STRING) { - token = next_token (&val, &data.len, cfile); + skip_token(&val, &data.len, cfile); data.buffer = (struct buffer *)0; if (!buffer_allocate (&data.buffer, data.len + 1, MDL)) { @@ -2174,7 +2174,7 @@ int parse_class_declaration (cp, cfile, group, type) if (class -> superclass) { token = peek_token (&val, (unsigned *)0, cfile); if (token == SEMI) { - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (cp) status = class_reference (cp, class, MDL); class_dereference (&class, MDL); @@ -2198,21 +2198,21 @@ int parse_class_declaration (cp, cfile, group, type) do { token = peek_token (&val, (unsigned *)0, cfile); if (token == RBRACE) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); break; } 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"); break; } else if (token == DYNAMIC) { class->flags |= CLASS_DECL_DYNAMIC; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!parse_semi (cfile)) break; continue; } else if (token == TOKEN_DELETED) { class->flags |= CLASS_DECL_DELETED; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!parse_semi (cfile)) break; continue; @@ -2223,11 +2223,11 @@ int parse_class_declaration (cp, cfile, group, type) skip_to_semi (cfile); break; } - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = peek_token (&val, (unsigned *)0, cfile); if (token != IF) goto submatch; - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (matchedonce) { parse_warn(cfile, "A class may only have " "one 'match if' clause."); @@ -2252,7 +2252,7 @@ int parse_class_declaration (cp, cfile, group, type) parse_semi (cfile); } } else if (token == SPAWN) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (pc) { parse_warn (cfile, "invalid spawn in subclass."); @@ -2293,7 +2293,7 @@ int parse_class_declaration (cp, cfile, group, type) parse_semi (cfile); } } else if (token == LEASE) { - next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); if (token != LIMIT) { parse_warn (cfile, "expecting \"limit\""); @@ -2391,7 +2391,7 @@ void parse_shared_net_declaration (cfile, group) /* Get the name of the shared network... */ token = peek_token (&val, (unsigned *)0, cfile); if (token == STRING) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (val [0] == 0) { parse_warn (cfile, "zero-length shared network name"); @@ -2421,7 +2421,7 @@ void parse_shared_net_declaration (cfile, group) do { token = peek_token (&val, (unsigned *)0, cfile); if (token == RBRACE) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); if (!share -> subnets) parse_warn (cfile, "empty shared-network decl"); @@ -2430,11 +2430,11 @@ void parse_shared_net_declaration (cfile, group) shared_network_dereference (&share, MDL); return; } 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"); break; } else if (token == INTERFACE) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile); new_shared_network_interface (cfile, share, val); if (!parse_semi (cfile)) @@ -2470,14 +2470,14 @@ common_subnet_parsing(struct parse *cfile, do { token = peek_token(&val, NULL, cfile); if (token == RBRACE) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); break; } else if (token == END_OF_FILE) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn (cfile, "unexpected end of file"); break; } else if (token == INTERFACE) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile); new_shared_network_interface(cfile, share, val); if (!parse_semi(cfile)) @@ -2738,7 +2738,7 @@ void parse_group_declaration (cfile, group) token = peek_token(&val, NULL, cfile); if (is_identifier (token) || token == STRING) { - next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); name = dmalloc(strlen(val) + 1, MDL); if (!name) @@ -2754,22 +2754,22 @@ void parse_group_declaration (cfile, group) do { token = peek_token(&val, NULL, cfile); if (token == RBRACE) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); break; } else if (token == END_OF_FILE) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_warn(cfile, "unexpected end of file"); break; } else if (token == TOKEN_DELETED) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_semi(cfile); deletedp = 1; } else if (token == DYNAMIC) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_semi(cfile); dynamicp = 1; } else if (token == STATIC) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); parse_semi(cfile); staticp = 1; } @@ -2986,7 +2986,7 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile) token = peek_token (&val, (unsigned *)0, cfile); if (token == STRING) { unsigned char *tuid; - token = next_token (&val, &buflen, cfile); + skip_token(&val, &buflen, cfile); if (buflen < sizeof lease -> uid_buf) { tuid = lease -> uid_buf; lease -> uid_max = @@ -3446,7 +3446,7 @@ parse_binding_value(struct parse *cfile, struct binding_value *value) token = peek_token(&val, NULL, cfile); if (token == STRING) { - token = next_token(&val, &buflen, cfile); + skip_token(&val, &buflen, cfile); value->type = binding_data; value->value.data.len = buflen; @@ -3482,7 +3482,7 @@ parse_binding_value(struct parse *cfile, struct binding_value *value) dfree (s, MDL); } } else if (token == PERCENT) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); token = next_token(&val, NULL, cfile); if (token != 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, (unsigned *)0, cfile)) == DYNAMIC_BOOTP) { - token = next_token (&val, (unsigned *)0, cfile); + skip_token(&val, (unsigned *)0, cfile); dynamic = 1; } @@ -3792,7 +3792,7 @@ parse_address_range6(struct parse *cfile, struct group *group) { /* * '/' 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); if (token != 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"); if (bits == 128) parse_warn(cfile, "temporary singleton?"); - token = next_token(NULL, NULL, cfile); + skip_token(NULL, NULL, cfile); type = D6O_IA_TA; } @@ -3832,7 +3832,7 @@ parse_address_range6(struct parse *cfile, struct group *group) { * temporary (RFC 4941) */ type = D6O_IA_TA; - next_token(NULL, NULL, cfile); + skip_token(NULL, NULL, cfile); bits = 64; if (!is_cidr_mask_valid(&lo, bits)) { parse_warn(cfile, "network mask too short"); @@ -4282,7 +4282,7 @@ parse_ia_na_declaration(struct parse *cfile) { */ token = peek_token(&val, NULL, cfile); if (token == SEMI) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); } else { parse_warn(cfile, "corrupt lease file; " @@ -4310,7 +4310,7 @@ parse_ia_na_declaration(struct parse *cfile) { */ token = peek_token(&val, NULL, cfile); if (token == SEMI) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); } else { parse_warn(cfile, "corrupt lease file; " @@ -4663,7 +4663,7 @@ parse_ia_ta_declaration(struct parse *cfile) { */ token = peek_token(&val, NULL, cfile); if (token == SEMI) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); } else { parse_warn(cfile, "corrupt lease file; " @@ -4691,7 +4691,7 @@ parse_ia_ta_declaration(struct parse *cfile) { */ token = peek_token(&val, NULL, cfile); if (token == SEMI) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); } else { parse_warn(cfile, "corrupt lease file; " @@ -5045,7 +5045,7 @@ parse_ia_pd_declaration(struct parse *cfile) { */ token = peek_token(&val, NULL, cfile); if (token == SEMI) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); } else { parse_warn(cfile, "corrupt lease file; " @@ -5073,7 +5073,7 @@ parse_ia_pd_declaration(struct parse *cfile) { */ token = peek_token(&val, NULL, cfile); if (token == SEMI) { - token = next_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); } else { parse_warn(cfile, "corrupt lease file; " @@ -5333,7 +5333,7 @@ parse_server_duid_conf(struct parse *cfile) { /* * Consume the SERVER_DUID token. */ - token = next_token(NULL, NULL, cfile); + skip_token(NULL, NULL, cfile); /* * Obtain the DUID type. diff --git a/server/dhcpd.c b/server/dhcpd.c index be6a6cac9..365a3d25a 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -3,7 +3,7 @@ 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 * * Permission to use, copy, modify, and distribute this software for any @@ -833,17 +833,17 @@ main(int argc, char **argv) { if (daemon) { /* Become session leader and get pid... */ - pid = setsid(); + (void) setsid(); /* Close standard I/O descriptors. */ - close(0); - close(1); - close(2); + (void) close(0); + (void) close(1); + (void) close(2); /* Reopen them on /dev/null. */ - open("/dev/null", O_RDWR); - open("/dev/null", O_RDWR); - open("/dev/null", O_RDWR); + (void) open("/dev/null", O_RDWR); + (void) open("/dev/null", O_RDWR); + (void) open("/dev/null", O_RDWR); log_perror = 0; /* No sense logging to /dev/null. */ IGNORE_RET (chdir("/")); diff --git a/server/dhcpv6.c b/server/dhcpv6.c index f94ea0bd6..210ec2dfe 100644 --- a/server/dhcpv6.c +++ b/server/dhcpv6.c @@ -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 * 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; memcpy(send_addr.iabuf, reply->fixed.data, 16); - status = ISC_R_SUCCESS; scope = &global_scope; group = reply->subnet->group; goto send_addr; @@ -3756,7 +3755,6 @@ find_client_prefix(struct reply_state *reply) { } memcpy(&send_pref, &l->cidrnet, sizeof(send_pref)); - status = ISC_R_SUCCESS; scope = &global_scope; goto send_pref; } diff --git a/server/failover.c b/server/failover.c index e0a416e24..7a9ae9e22 100644 --- a/server/failover.c +++ b/server/failover.c @@ -3,7 +3,7 @@ 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 * * 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, (int)link -> peer_port, MDL); } else if (!omapi_ds_strcmp (name, "link-state")) { - if (link -> state < 0 || - link -> state >= dhcp_flink_state_max) + if (link -> state >= dhcp_flink_state_max) return omapi_make_string_value (value, name, "invalid link state", 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"); if (status != ISC_R_SUCCESS) return status; - if (link -> state < 0 || - link -> state >= dhcp_flink_state_max) + if (link -> state >= dhcp_flink_state_max) status = omapi_connection_put_string (c, "invalid link state"); else status = (omapi_connection_put_string -- 2.39.5