2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 14:25:41 +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

@@ -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. */