diff options
77 files changed, 247 insertions, 822 deletions
@@ -55,12 +55,12 @@ suggested fixes to <dhcp-users@isc.org>. - Fixed file descriptor leak on listen failure. Thanks to Tom Clark. - Changes since 4.0.0a2 - - Bug in server configuration parser caused server to get stuck on startup for certain bad pool declarations. Thanks to Guillaume Knispel for the bug report and fix. +- Code cleaned to remove warnings reported by "gcc -Wall". + Changes since 4.0.0a1 - Bug in octal parsing fixed. Thanks to Bernd Fuhrmann for the report diff --git a/client/clparse.c b/client/clparse.c index 2991a19f..ab4839e7 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -32,16 +32,9 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: clparse.c,v 1.71 2007/05/19 19:16:23 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <errno.h> -static TIME parsed_time; - struct client_config top_level_config; u_int32_t default_requested_options [] = { @@ -57,8 +50,10 @@ u_int32_t default_requested_options [] = { static void parse_client_default_duid(struct parse *cfile); static void parse_client6_lease_statement(struct parse *cfile); +#ifdef DHCPv6 static struct dhc6_ia *parse_client6_ia_statement(struct parse *cfile); static struct dhc6_addr *parse_client6_iaaddr_statement(struct parse *cfile); +#endif /* DHCPv6 */ /* client-conf-file :== client-declarations END_OF_FILE client-declarations :== <nil> @@ -68,7 +63,6 @@ static struct dhc6_addr *parse_client6_iaaddr_statement(struct parse *cfile); isc_result_t read_client_conf () { struct client_config *config; - struct client_state *state; struct interface_info *ip; isc_result_t status; @@ -258,11 +252,9 @@ void parse_client_statement (cfile, ip, config) int token; const char *val; struct option *option = NULL; - struct executable_statement *stmt, **p; - enum statement_op op; + struct executable_statement *stmt; int lose; char *name; - struct data_string key_id; enum policy policy; int known; int tmp, i; @@ -988,11 +980,9 @@ void parse_client_lease_declaration (cfile, lease, ipp, clientp) { int token; const char *val; - char *t, *n; struct interface_info *ip; struct option_cache *oc; struct client_state *client = (struct client_state *)0; - struct data_string key_id; switch (next_token (&val, (unsigned *)0, cfile)) { case KEY: @@ -1142,6 +1132,10 @@ parse_client_default_duid(struct parse *cfile) static void parse_client6_lease_statement(struct parse *cfile) { +#if !defined(DHCPv6) + parse_warn(cfile, "No DHCPv6 support."); + skip_to_semi(cfile); +#else /* defined(DHCPv6) */ struct option_cache *oc = NULL; struct dhc6_lease *lease; struct dhc6_ia **ia; @@ -1152,10 +1146,6 @@ parse_client6_lease_statement(struct parse *cfile) unsigned len; int token, has_ia, no_semi, has_name; -#if !defined(DHCPv6) - parse_warn(cfile, "No DHCPv6 support."); - skip_to_semi(cfile); -#else /* defined(DHCPv6) */ token = next_token(NULL, NULL, cfile); if (token != LBRACE) { parse_warn(cfile, "Expecting open curly brace."); @@ -1354,6 +1344,7 @@ parse_client6_lease_statement(struct parse *cfile) /* Parse an ia_na object from the client lease. */ +#ifdef DHCPv6 static struct dhc6_ia * parse_client6_ia_statement(struct parse *cfile) { @@ -1362,7 +1353,6 @@ parse_client6_ia_statement(struct parse *cfile) struct dhc6_ia *ia; struct dhc6_addr **addr; const char *val; - unsigned len; int token, no_semi; ia = dmalloc(sizeof(*ia), MDL); @@ -1486,8 +1476,10 @@ parse_client6_ia_statement(struct parse *cfile) return ia; } +#endif /* DHCPv6 */ /* Parse an iaaddr {} structure. */ +#ifdef DHCPv6 static struct dhc6_addr * parse_client6_iaaddr_statement(struct parse *cfile) { @@ -1592,6 +1584,7 @@ parse_client6_iaaddr_statement(struct parse *cfile) return addr; } +#endif /* DHCPv6 */ void parse_string_list (cfile, lp, multiple) struct parse *cfile; @@ -1712,12 +1705,6 @@ int parse_allow_deny (oc, cfile, flag) struct parse *cfile; int flag; { - enum dhcp_token token; - const char *val; - unsigned char rf = flag; - struct expression *data = (struct expression *)0; - int status; - parse_warn (cfile, "allow/deny/ignore not permitted here."); skip_to_semi (cfile); return 0; diff --git a/client/dhc6.c b/client/dhc6.c index 2e63b735..17a69617 100644 --- a/client/dhc6.c +++ b/client/dhc6.c @@ -22,11 +22,6 @@ * http://www.isc.org/ */ -#ifndef lint -static char ocopyright[] = -"$Id: dhc6.c,v 1.6 2007/06/06 22:57:31 each Exp $ Copyright (c) 2006-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #ifdef DHCPv6 @@ -906,10 +901,9 @@ do_init6(void *input) struct data_string ds; struct data_string ia; struct data_string addr; - struct option_cache *oc; TIME elapsed; u_int32_t t1, t2; - int idx, len, send_ret, code; + int idx, len, send_ret; client = input; @@ -998,7 +992,7 @@ do_init6(void *input) if ((client->active_lease != NULL) && ((old_ia = find_ia(client->active_lease->bindings, - ia.data)) != NULL)) { + (char *)ia.data)) != NULL)) { /* For each address in the old IA, request a binding. */ memset(&addr, 0, sizeof(addr)); for (old_addr = old_ia->addrs ; old_addr != NULL ; @@ -1071,11 +1065,7 @@ void do_confirm6(void *input) { struct client_state *client; - struct dhc6_ia *ia; - struct dhc6_addr *addr; struct data_string ds; - struct data_string ia_data; - struct data_string addr_data; int send_ret; TIME elapsed; @@ -1175,8 +1165,6 @@ do_confirm6(void *input) void start_release6(struct client_state *client) { - struct data_string packet; - /* Cancel any pending transmissions */ cancel_timeout(do_confirm6, client); cancel_timeout(do_select6, client); @@ -1214,11 +1202,7 @@ do_release6(void *input) { struct sockaddr_in6 unicast, *dest_addr = &DHCPv6DestAddr; struct client_state *client; - struct dhc6_ia *ia; - struct dhc6_addr *addr; struct data_string ds; - struct data_string ia_data; - struct data_string addr_data; struct option_cache *oc; struct dhc6_lease *lease; int send_ret; @@ -1336,7 +1320,7 @@ status_log(int code, char *scope, const char *additional, int len) if (len > 0) log_info("%s status code %s: %s", scope, msg, - print_hex_1(len, additional, 50)); + print_hex_1(len, (unsigned char *)additional, 50)); else log_info("%s status code %s.", scope, msg); } @@ -1406,7 +1390,7 @@ dhc6_check_status(isc_result_t rval, struct option_state *options, status = dhc6_get_status_code(options, code, &msg); if (status == ISC_R_SUCCESS) { - status_log(*code, scope, msg.data, msg.len); + status_log(*code, scope, (char *)msg.data, msg.len); data_string_forget(&msg, MDL); if (*code != STATUS_Success) @@ -1554,7 +1538,6 @@ dhc6_withdraw_lease(struct client_state *client) { struct dhc6_ia *ia; struct dhc6_addr *addr; - TIME future; if ((client == NULL) || (client->active_lease == NULL)) return; @@ -1671,7 +1654,7 @@ dhc6_check_reply(struct client_state *client, struct dhc6_lease *new) isc_boolean_t (*action)(struct client_state *, isc_result_t, unsigned); struct dhc6_ia *ia; struct dhc6_addr *addr; - isc_result_t rval = ISC_R_SUCCESS, status; + isc_result_t rval = ISC_R_SUCCESS; unsigned code; int nscore, sscore; @@ -1776,7 +1759,7 @@ dhc6_check_reply(struct client_state *client, struct dhc6_lease *new) void init_handler(struct packet *packet, struct client_state *client) { - struct dhc6_lease *lease, **idx; + struct dhc6_lease *lease; /* In INIT state, we send solicits, we only expect to get * advertises (we don't support rapid commit yet). @@ -1946,7 +1929,6 @@ void start_selecting6(struct client_state *client) { struct dhc6_lease *lease; - struct data_string packet; if (client->advertised_leases == NULL) { log_error("Can not enter DHCPv6 SELECTING state with no " @@ -1990,13 +1972,10 @@ do_select6(void *input) { struct client_state *client; struct dhc6_lease *lease; - struct dhc6_ia *ia; - struct dhc6_addr *addr; - struct option_cache *oc; struct data_string ds; - TIME elapsed, t1, t2; + TIME elapsed; int abort = ISC_FALSE; - int code, send_ret; + int send_ret; client = input; @@ -2261,7 +2240,7 @@ dhc6_add_ia(struct client_state *client, struct data_string *packet, void reply_handler(struct packet *packet, struct client_state *client) { - struct dhc6_lease *lease, *old; + struct dhc6_lease *lease; isc_result_t check_status; if (packet->dhcpv6_msg_type != DHCPV6_REPLY) @@ -2621,7 +2600,7 @@ dhc6_merge_lease(struct dhc6_lease *src, struct dhc6_lease *dst) return; for (sia = src->bindings ; sia != NULL ; sia = sia->next) { - dia = find_ia(dst->bindings, sia->iaid); + dia = find_ia(dst->bindings, (char *)sia->iaid); if (dia == NULL) { tia = dhc6_dup_ia(sia, MDL); @@ -2720,7 +2699,7 @@ start_bound(struct client_state *client) oldia = NULL; for (ia = lease->bindings ; ia != NULL ; ia = ia->next) { if (old != NULL) - oldia = find_ia(old->bindings, ia->iaid); + oldia = find_ia(old->bindings, (char *)ia->iaid); else oldia = NULL; @@ -2843,7 +2822,7 @@ do_refresh6(void *input) struct data_string ds; struct client_state *client; struct dhc6_lease *lease; - TIME elapsed, next; + TIME elapsed; int send_ret; client = (struct client_state *)input; @@ -3137,7 +3116,6 @@ static void make_client6_options(struct client_state *client, struct option_state **op, struct dhc6_lease *lease, u_int8_t message) { - int code; struct option_cache *oc; if ((op == NULL) || (client == NULL)) diff --git a/client/dhclient.c b/client/dhclient.c index 603ce3f5..790738c0 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -30,11 +30,6 @@ * fault and not Elliot's. */ -#ifndef lint -static char ocopyright[] = -"$Id: dhclient.c,v 1.154 2007/06/15 15:02:05 shane Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <syslog.h> #include <signal.h> @@ -99,7 +94,6 @@ main(int argc, char **argv) { omapi_object_t *listener; isc_result_t result; int persist = 0; - int omapi_port; int no_dhclient_conf = 0; int no_dhclient_db = 0; int no_dhclient_pid = 0; @@ -451,8 +445,6 @@ main(int argc, char **argv) { /* Start a configuration state machine for each interface. */ #ifdef DHCPv6 if (local_family == AF_INET6) { - struct option_cache *oc; - /* Establish a default DUID. This may be moved to the * DHCPv4 area later. */ @@ -721,7 +713,6 @@ void state_selecting (cpp) picked = lp; picked -> next = (struct client_lease *)0; } else { - freeit: destroy_client_lease (lp); } } @@ -780,7 +771,6 @@ void dhcpack (packet) struct client_lease *lease; struct option_cache *oc; struct data_string ds; - int i; /* If we're not receptive to an offer right now, or if the offer has an unrecognizable transaction id, then just drop it. */ @@ -932,8 +922,6 @@ void dhcpack (packet) void bind_lease (client) struct client_state *client; { - struct interface_info *ip = client -> interface; - /* Remember the medium. */ client -> new -> medium = client -> medium; @@ -996,7 +984,6 @@ void state_bound (cpp) void *cpp; { struct client_state *client = cpp; - int i; struct option_cache *oc; struct data_string ds; @@ -1223,8 +1210,6 @@ void dhcpoffer (packet) int i; int stop_selecting; const char *name = packet -> packet_type ? "DHCPOFFER" : "BOOTREPLY"; - struct iaddrlist *ap; - struct option_cache *oc; char obuf [1024]; #ifdef DEBUG_PACKET @@ -2069,7 +2054,6 @@ void make_discover (client, lease) struct client_lease *lease; { unsigned char discover = DHCPDISCOVER; - int i; struct option_state *options = (struct option_state *)0; memset (&client -> packet, 0, sizeof (client -> packet)); @@ -2133,9 +2117,6 @@ void make_request (client, lease) struct client_lease *lease; { unsigned char request = DHCPREQUEST; - int i, j; - unsigned char *tmp, *digest; - unsigned char *old_digest_loc; struct option_cache *oc; memset (&client -> packet, 0, sizeof (client -> packet)); @@ -2223,7 +2204,6 @@ void make_decline (client, lease) struct client_lease *lease; { unsigned char decline = DHCPDECLINE; - int i; struct option_cache *oc; struct option_state *options = (struct option_state *)0; @@ -2279,7 +2259,6 @@ void make_release (client, lease) struct client_lease *lease; { unsigned char request = DHCPRELEASE; - int i; struct option_cache *oc; struct option_state *options = (struct option_state *)0; @@ -2336,8 +2315,6 @@ void make_release (client, lease) void destroy_client_lease (lease) struct client_lease *lease; { - int i; - if (lease -> server_name) dfree (lease -> server_name, MDL); if (lease -> filename) @@ -2415,8 +2392,6 @@ void write_lease_option (struct option_cache *oc, { const char *name, *dot; struct data_string ds; - int status; - struct client_state *client; char *preamble = stuff; memset (&ds, 0, sizeof ds); @@ -2595,11 +2570,7 @@ int write_client_lease (client, lease, rewrite, makesure) int rewrite; int makesure; { - int i; - struct tm *t; - struct option_cache *oc; struct data_string ds; - pair *hash; int errors = 0; char *s; const char *tval; @@ -2803,8 +2774,6 @@ void script_write_params (client, prefix, lease) int i; struct data_string data; struct option_cache *oc; - pair *hash; - char *s, *t; struct envadd_state es; es.client = client; @@ -2881,11 +2850,9 @@ void script_write_params (client, prefix, lease) int script_go (client) struct client_state *client; { - int rval; char *scriptName; char *argv [2]; char **envp; - char *epp [3]; char reason [] = "REASON=NBI"; static char client_path [] = CLIENT_PATH; int i; @@ -2966,7 +2933,7 @@ void client_envadd (struct client_state *client, { char spbuf [1024]; char *s; - unsigned len, i; + unsigned len; struct string_list *val; va_list list; @@ -3423,8 +3390,7 @@ void client_dns_update_timeout (void *cp) isc_result_t client_dns_update (struct client_state *client, int addp, int ttl, struct iaddr *address) { - struct data_string ddns_fqdn, ddns_fwd_name, - ddns_dhcid, client_identifier; + struct data_string ddns_fwd_name, ddns_dhcid, client_identifier; struct option_cache *oc; int ignorep; int result; diff --git a/common/alloc.c b/common/alloc.c index b89bd73b..9e18c6f6 100644 --- a/common/alloc.c +++ b/common/alloc.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: alloc.c,v 1.60 2007/05/19 19:16:23 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -48,7 +43,6 @@ int option_chain_head_allocate (ptr, file, line) const char *file; int line; { - int size; struct option_chain_head *h; if (!ptr) { @@ -109,7 +103,6 @@ int option_chain_head_dereference (ptr, file, line) const char *file; int line; { - int i; struct option_chain_head *option_chain_head; pair car, cdr; @@ -161,7 +154,6 @@ int group_allocate (ptr, file, line) const char *file; int line; { - int size; struct group *g; if (!ptr) { @@ -222,7 +214,6 @@ int group_dereference (ptr, file, line) const char *file; int line; { - int i; struct group *group; if (!ptr || !*ptr) { @@ -744,8 +735,6 @@ int buffer_dereference (ptr, file, line) const char *file; int line; { - struct buffer *bp; - if (!ptr) { log_error ("%s(%d): null pointer", file, line); #if defined (POINTER_DEBUG) @@ -833,8 +822,6 @@ int dns_host_entry_dereference (ptr, file, line) const char *file; int line; { - struct dns_host_entry *bp; - if (!ptr || !*ptr) { log_error ("%s(%d): null pointer", file, line); #if defined (POINTER_DEBUG) @@ -1037,7 +1024,6 @@ int packet_allocate (ptr, file, line) const char *file; int line; { - int size; struct packet *p; if (!ptr) { @@ -1157,7 +1143,6 @@ int dns_zone_allocate (ptr, file, line) const char *file; int line; { - int size; struct dns_zone *d; if (!ptr) { diff --git a/common/bpf.c b/common/bpf.c index 39a54152..d6f92a75 100644 --- a/common/bpf.c +++ b/common/bpf.c @@ -32,11 +32,6 @@ * managed to get me to integrate them. */ -#ifndef lint -static char copyright[] = -"$Id: bpf.c,v 1.57 2007/05/19 23:39:51 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE) \ || defined (USE_LPF_RECEIVE) diff --git a/common/comapi.c b/common/comapi.c index 4efae78f..b9dc9830 100644 --- a/common/comapi.c +++ b/common/comapi.c @@ -39,11 +39,6 @@ useful, you have Brian and BCtel to thank. Any limitations in the code are a result of mistakes on my part. -- Ted Lemon */ -#ifndef lint -static char copyright[] = -"$Id: comapi.c,v 1.12 2006/02/24 23:16:28 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -143,7 +138,6 @@ isc_result_t dhcp_group_set_value (omapi_object_t *h, { struct group_object *group; isc_result_t status; - int foo; if (h -> type != dhcp_type_group) return ISC_R_INVALIDARG; @@ -217,7 +211,6 @@ isc_result_t dhcp_group_get_value (omapi_object_t *h, omapi_object_t *id, { struct group_object *group; isc_result_t status; - struct data_string ip_addrs; if (h -> type != dhcp_type_group) return ISC_R_INVALIDARG; @@ -240,7 +233,6 @@ isc_result_t dhcp_group_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_group_destroy (omapi_object_t *h, const char *file, int line) { struct group_object *group, *t; - isc_result_t status; if (h -> type != dhcp_type_group) return ISC_R_INVALIDARG; @@ -271,7 +263,7 @@ isc_result_t dhcp_group_destroy (omapi_object_t *h, const char *file, int line) isc_result_t dhcp_group_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - struct group_object *group, *t; + struct group_object *group; isc_result_t status; int updatep = 0; @@ -453,7 +445,6 @@ isc_result_t dhcp_control_set_value (omapi_object_t *h, { dhcp_control_object_t *control; isc_result_t status; - int foo; unsigned long newstate; if (h -> type != dhcp_type_control) @@ -488,7 +479,6 @@ isc_result_t dhcp_control_get_value (omapi_object_t *h, omapi_object_t *id, { dhcp_control_object_t *control; isc_result_t status; - struct data_string ip_addrs; if (h -> type != dhcp_type_control) return ISC_R_INVALIDARG; @@ -511,9 +501,6 @@ isc_result_t dhcp_control_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_control_destroy (omapi_object_t *h, const char *file, int line) { - dhcp_control_object_t *control, *t; - isc_result_t status; - if (h -> type != dhcp_type_control) return ISC_R_INVALIDARG; @@ -524,9 +511,8 @@ isc_result_t dhcp_control_destroy (omapi_object_t *h, isc_result_t dhcp_control_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - dhcp_control_object_t *control, *t; + dhcp_control_object_t *control; isc_result_t status; - int updatep = 0; if (h -> type != dhcp_type_control) return ISC_R_INVALIDARG; @@ -580,7 +566,6 @@ isc_result_t dhcp_control_lookup (omapi_object_t **lp, { omapi_value_t *tv = (omapi_value_t *)0; isc_result_t status; - dhcp_control_object_t *control; /* First see if we were sent a handle. */ if (ref) { @@ -629,7 +614,6 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *h, { struct subnet *subnet; isc_result_t status; - int foo; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; @@ -675,7 +659,6 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line) { struct subnet *subnet; - isc_result_t status; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; @@ -752,10 +735,6 @@ isc_result_t dhcp_subnet_lookup (omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref) { - omapi_value_t *tv = (omapi_value_t *)0; - isc_result_t status; - struct subnet *subnet; - /* Can't look up subnets yet. */ /* If we get to here without finding a subnet, no valid key was @@ -784,7 +763,6 @@ isc_result_t dhcp_shared_network_set_value (omapi_object_t *h, { struct shared_network *shared_network; isc_result_t status; - int foo; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; @@ -832,7 +810,6 @@ isc_result_t dhcp_shared_network_destroy (omapi_object_t *h, const char *file, int line) { struct shared_network *shared_network; - isc_result_t status; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; @@ -922,10 +899,6 @@ isc_result_t dhcp_shared_network_lookup (omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref) { - omapi_value_t *tv = (omapi_value_t *)0; - isc_result_t status; - struct shared_network *shared_network; - /* Can't look up shared_networks yet. */ /* If we get to here without finding a shared_network, no valid key was diff --git a/common/conflex.c b/common/conflex.c index 9756ec25..49747ab8 100644 --- a/common/conflex.c +++ b/common/conflex.c @@ -32,22 +32,16 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: conflex.c,v 1.112 2007/07/03 09:51:58 shane Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <ctype.h> static int get_char PROTO ((struct parse *)); -static enum dhcp_token get_token PROTO ((struct parse *)); static void skip_to_eol PROTO ((struct parse *)); static enum dhcp_token read_whitespace(int c, struct parse *cfile); static enum dhcp_token read_string PROTO ((struct parse *)); static enum dhcp_token read_number PROTO ((int, struct parse *)); static enum dhcp_token read_num_or_name PROTO ((int, struct parse *)); -static enum dhcp_token intern PROTO ((unsigned char *, enum dhcp_token)); +static enum dhcp_token intern PROTO ((char *, enum dhcp_token)); isc_result_t new_parse (cfile, file, inbuf, buflen, name, eolp) struct parse **cfile; @@ -214,7 +208,7 @@ static int get_char (cfile) * when parsing IPv6 addresses). * * Generally we use the next_token() function to read tokens. This - * in turn calls get_token, which does *not* return tokens for + * in turn calls get_next_token, which does *not* return tokens for * whitespace. Rather, it skips these. * * When we need to see whitespace, we us next_raw_token(), which also @@ -678,17 +672,15 @@ static enum dhcp_token read_num_or_name (c, cfile) cfile -> tokbuf [i] = 0; cfile -> tlen = i; cfile -> tval = cfile -> tokbuf; - return intern (cfile -> tval, rv); + return intern(cfile->tval, rv); } -static enum dhcp_token intern (atom, dfv) - unsigned char *atom; - enum dhcp_token dfv; -{ - if (!isascii (atom [0])) +static enum dhcp_token +intern(char *atom, enum dhcp_token dfv) { + if (!isascii(atom[0])) return dfv; - switch (tolower (atom [0])) { + switch (tolower((unsigned char)atom[0])) { case '-': if (atom [1] == 0) return MINUS; @@ -861,7 +853,8 @@ static enum dhcp_token intern (atom, dfv) } break; case 'e': - if (isascii (atom [1]) && tolower (atom [1]) == 'x') { + if (isascii (atom [1]) && + tolower((unsigned char)atom[1]) == 'x') { if (!strcasecmp (atom + 2, "tract-int")) return EXTRACT_INT; if (!strcasecmp (atom + 2, "ists")) @@ -1206,10 +1199,12 @@ static enum dhcp_token intern (atom, dfv) case 's': if (!strcasecmp(atom + 1, "cript")) return SCRIPT; - if (isascii(atom[1]) && tolower(atom[1]) == 'e') { + if (isascii(atom[1]) && + tolower((unsigned char)atom[1]) == 'e') { if (!strcasecmp(atom + 2, "arch")) return SEARCH; - if (isascii(atom[2]) && tolower(atom[2]) == 'c') { + if (isascii(atom[2]) && + tolower((unsigned char)atom[2]) == 'c') { if (!strncasecmp(atom + 3, "ond", 3)) { if (!strcasecmp(atom + 6, "ary")) return SECONDARY; @@ -1256,14 +1251,16 @@ static enum dhcp_token intern (atom, dfv) return TOKEN_SET; break; } - if (isascii(atom[1]) && tolower(atom[1]) == 'h') { + if (isascii(atom[1]) && + tolower((unsigned char)atom[1]) == 'h') { if (!strcasecmp(atom + 2, "ared-network")) return SHARED_NETWORK; if (!strcasecmp(atom + 2, "utdown")) return SHUTDOWN; break; } - if (isascii(atom[1]) && tolower(atom[1]) == 'i') { + if (isascii(atom[1]) && + tolower((unsigned char)atom[1]) == 'i') { if (!strcasecmp(atom + 2, "addr")) return SIADDR; if (!strcasecmp(atom + 2, "gned")) @@ -1272,8 +1269,10 @@ static enum dhcp_token intern (atom, dfv) return SIZE; break; } - if (isascii(atom[1]) && tolower(atom[1]) == 'p') { - if (isascii(atom[2]) && tolower(atom[2]) == 'a') { + if (isascii(atom[1]) && + tolower((unsigned char)atom[1]) == 'p') { + if (isascii(atom[2]) && + tolower((unsigned char)atom[2]) == 'a') { if (!strcasecmp(atom + 3, "ce")) return SPACE; if (!strcasecmp(atom + 3, "wn")) @@ -1284,8 +1283,10 @@ static enum dhcp_token intern (atom, dfv) return SPLIT; break; } - if (isascii(atom[1]) && tolower(atom[1]) == 't') { - if (isascii(atom[2]) && tolower(atom[2]) == 'a') { + if (isascii(atom[1]) && + tolower((unsigned char)atom[1]) == 't') { + if (isascii(atom[2]) && + tolower((unsigned char)atom[2]) == 'a') { if(!strncasecmp(atom + 3, "rt", 2)) { if (!strcasecmp(atom + 5, "s")) return STARTS; @@ -1294,7 +1295,7 @@ static enum dhcp_token intern (atom, dfv) break; } if (isascii(atom[3]) && - tolower(atom[3]) == 't') { + tolower((unsigned char)atom[3]) == 't') { if (!strcasecmp(atom + 4, "e")) return STATE; if (!strcasecmp(atom + 4, "ic")) @@ -1317,7 +1318,8 @@ static enum dhcp_token intern (atom, dfv) return SUBSTRING; break; } - if (isascii(atom[1]) && tolower(atom[1]) == 'u') { + if (isascii(atom[1]) && + tolower((unsigned char)atom[1]) == 'u') { if (!strcasecmp(atom + 2, "ffix")) return SUFFIX; if (!strcasecmp(atom + 2, "persede")) diff --git a/common/ctrace.c b/common/ctrace.c index 24476d10..fb39a79d 100644 --- a/common/ctrace.c +++ b/common/ctrace.c @@ -30,11 +30,6 @@ * learn more about Nominum, Inc., see ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: ctrace.c,v 1.8 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (TRACING) diff --git a/common/discover.c b/common/discover.c index feea4fa8..362280bb 100644 --- a/common/discover.c +++ b/common/discover.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: discover.c,v 1.60 2007/06/08 14:58:20 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #define BSD_COMP /* needed on Solaris for SIOCGLIFNUM */ @@ -891,10 +886,13 @@ discover_interfaces(int state) { struct iface_info info; int err; - struct interface_info *tmp, *ip; + struct interface_info *tmp; struct interface_info *last, *next; - char abuf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; +#ifdef DHCPv6 + char abuf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; +#endif /* DHCPv6 */ + struct subnet *subnet; int ir; @@ -903,8 +901,6 @@ discover_interfaces(int state) { static int setup_fallback = 0; - int sock; - if (!begin_iface_scan(&ifaces)) { log_fatal("Can't get list of interfaces."); } @@ -1358,7 +1354,8 @@ got_one_v6(omapi_object_t *h) { } ip = (struct interface_info *)h; - result = receive_packet6(ip, buf, sizeof(buf), &from, &to); + result = receive_packet6(ip, (unsigned char *)buf, sizeof(buf), + &from, &to); if (result < 0) { log_error("receive_packet6() failed on %s: %m", ip->name); return ISC_R_UNEXPECTED; @@ -1393,7 +1390,6 @@ isc_result_t dhcp_interface_set_value (omapi_object_t *h, { struct interface_info *interface; isc_result_t status; - int foo; if (h -> type != dhcp_type_interface) return ISC_R_INVALIDARG; @@ -1436,7 +1432,6 @@ isc_result_t dhcp_interface_destroy (omapi_object_t *h, const char *file, int line) { struct interface_info *interface; - isc_result_t status; if (h -> type != dhcp_type_interface) return ISC_R_INVALIDARG; @@ -1466,8 +1461,6 @@ isc_result_t dhcp_interface_signal_handler (omapi_object_t *h, const char *name, va_list ap) { struct interface_info *ip, *interface; - struct client_config *config; - struct client_state *client; isc_result_t status; if (h -> type != dhcp_type_interface) diff --git a/common/dispatch.c b/common/dispatch.c index 60a05251..cc50f9f1 100644 --- a/common/dispatch.c +++ b/common/dispatch.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: dispatch.c,v 1.66 2006/02/24 23:16:28 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" struct timeout *timeouts; diff --git a/common/dlpi.c b/common/dlpi.c index bf5418b6..c38255d1 100644 --- a/common/dlpi.c +++ b/common/dlpi.c @@ -85,11 +85,6 @@ * http://docs.hp.com/en/B2355-90139/index.html */ -#ifndef lint -static char copyright[] = -"$Id: dlpi.c,v 1.33 2007/05/19 18:47:14 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE) diff --git a/common/dns.c b/common/dns.c index 8f89b004..adf3f55e 100644 --- a/common/dns.c +++ b/common/dns.c @@ -31,11 +31,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: dns.c,v 1.42 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include "arpa/nameser.h" #include "dst/md5.h" @@ -127,7 +122,6 @@ dns_zone_hash_t *dns_zone_hash; isc_result_t find_tsig_key (ns_tsig_key **key, const char *zname, struct dns_zone *zone) { - isc_result_t status; ns_tsig_key *tkey; if (!zone) @@ -201,7 +195,6 @@ isc_result_t enter_dns_zone (struct dns_zone *zone) isc_result_t dns_zone_lookup (struct dns_zone **zone, const char *name) { - struct dns_zone *tz = (struct dns_zone *)0; int len; char *tname = (char *)0; isc_result_t status; @@ -234,7 +227,6 @@ int dns_zone_dereference (ptr, file, line) const char *file; int line; { - int i; struct dns_zone *dns_zone; if (!ptr || !*ptr) { @@ -397,9 +389,7 @@ void repudiate_zone (struct dns_zone **zone) void cache_found_zone (ns_class class, char *zname, struct in_addr *addrs, int naddrs) { - isc_result_t status = ISC_R_NOTFOUND; struct dns_zone *zone = (struct dns_zone *)0; - struct data_string nsaddrs; int ix = strlen (zname); if (zname [ix - 1] == '.') @@ -684,7 +674,8 @@ ddns_update_fwd(struct data_string *ddns_fwd_name, struct iaddr ddns_addr, /* * Conflict detection override: delete DHCID RRs. */ - updrec = minires_mkupdrec(S_UPDATE, ddns_fwd_name->data, + updrec = minires_mkupdrec(S_UPDATE, + (const char *)ddns_fwd_name->data, C_IN, T_DHCID, 0); if (!updrec) { diff --git a/common/ethernet.c b/common/ethernet.c index c3542ef5..12d6d57f 100644 --- a/common/ethernet.c +++ b/common/ethernet.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: ethernet.c,v 1.8 2005/03/17 20:14:58 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (PACKET_ASSEMBLY) || defined (PACKET_DECODING) diff --git a/common/execute.c b/common/execute.c index 92df944d..ac63b084 100644 --- a/common/execute.c +++ b/common/execute.c @@ -32,13 +32,10 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: execute.c,v 1.51 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> +#include <sys/types.h> +#include <sys/wait.h> int execute_statements (result, packet, lease, client_state, in_options, out_options, scope, statements) @@ -54,8 +51,6 @@ int execute_statements (result, packet, lease, client_state, struct executable_statement *r, *e, *next; int rc; int status; - unsigned long num; - struct binding_scope *outer; struct binding *binding; struct data_string ds; struct binding_scope *ns; @@ -363,7 +358,6 @@ int execute_statements (result, packet, lease, client_state, binding -> next = (*scope) -> bindings; (*scope) -> bindings = binding; } else { - badalloc: dfree (binding, MDL); binding = (struct binding *)0; } @@ -606,8 +600,6 @@ int executable_statement_dereference (ptr, file, line) const char *file; int line; { - struct executable_statement *bp; - if (!ptr || !*ptr) { log_error ("%s(%d): null pointer", file, line); #if defined (POINTER_DEBUG) @@ -739,8 +731,6 @@ void write_statements (file, statements, indent) { struct executable_statement *r, *x; struct expression *expr; - int result; - int status; const char *s, *t, *dot; int col; @@ -1014,10 +1004,8 @@ int find_matching_case (struct executable_statement **ep, { int status, sub; struct executable_statement *s; - unsigned long foo; if (is_data_expression (expr)) { - struct executable_statement *e; struct data_string cd, ds; memset (&ds, 0, sizeof ds); memset (&cd, 0, sizeof cd); @@ -1091,7 +1079,6 @@ int executable_statement_foreach (struct executable_statement *stmt, { struct executable_statement *foo; int ok = 0; - int result; for (foo = stmt; foo; foo = foo -> next) { if ((*callback) (foo, vp, condp) != 0) diff --git a/common/fddi.c b/common/fddi.c index bb466fce..9d4446c8 100644 --- a/common/fddi.c +++ b/common/fddi.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: fddi.c,v 1.4 2005/03/17 20:14:58 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (DEC_FDDI) diff --git a/common/icmp.c b/common/icmp.c index 79074542..fa34c40e 100644 --- a/common/icmp.c +++ b/common/icmp.c @@ -33,11 +33,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: icmp.c,v 1.34 2007/05/23 10:35:10 shane Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include "netinet/ip.h" #include "netinet/ip_icmp.h" @@ -61,11 +56,7 @@ void icmp_startup (routep, handler) { struct protoent *proto; int protocol = 1; - struct sockaddr_in from; - int fd; int state; - struct icmp_state *new; - omapi_object_t *h; isc_result_t result; /* Only initialize icmp once. */ @@ -284,7 +275,6 @@ isc_result_t icmp_echoreply (h) void trace_icmp_input_input (trace_type_t *ttype, unsigned length, char *buf) { struct iaddr *ia; - unsigned len; u_int8_t *icbuf; ia = (struct iaddr *)buf; ia->len = ntohl(ia->len); diff --git a/common/inet.c b/common/inet.c index 4f8f1182..7bee0888 100644 --- a/common/inet.c +++ b/common/inet.c @@ -33,11 +33,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: inet.c,v 1.14 2007/06/19 17:06:03 shane Exp $ Copyright (c) 2004,2005,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" /* Return just the network number of an internet address... */ @@ -124,7 +119,7 @@ struct iaddr broadcast_addr (subnet, mask) struct iaddr subnet; struct iaddr mask; { - int i, j, k; + int i; struct iaddr rv; if (subnet.len > sizeof(subnet.iabuf)) diff --git a/common/lpf.c b/common/lpf.c index 9255d16c..45ff5034 100644 --- a/common/lpf.c +++ b/common/lpf.c @@ -26,11 +26,6 @@ * http://www.isc.org/ */ -#ifndef lint -static char copyright[] = -"$Id: lpf.c,v 1.35 2007/05/19 18:47:14 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) #include <sys/ioctl.h> @@ -71,8 +66,6 @@ int if_register_lpf (info) struct interface_info *info; { int sock; - char filename[50]; - int b; struct sockaddr sa; /* Make an LPF socket. */ @@ -338,7 +331,6 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) struct sockaddr_in *from; struct hardware *hfrom; { - int nread; int length = 0; int offset = 0; unsigned char ibuf [1536]; @@ -460,7 +452,7 @@ get_hw_addr(const char *name, struct hardware *hw) { break; default: log_fatal("Unsupported device type %ld for \"%s\"", - sa->sa_family, name); + (long int)sa->sa_family, name); } close(sock); diff --git a/common/memory.c b/common/memory.c index 22a6c0cc..cd1de555 100644 --- a/common/memory.c +++ b/common/memory.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: memory.c,v 1.69 2006/06/01 20:23:17 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" struct group *root_group; @@ -84,8 +79,7 @@ isc_result_t delete_group (struct group_object *group, int writep) isc_result_t supersede_group (struct group_object *group, int writep) { - struct group_object *t, *u; - isc_result_t status; + struct group_object *t; /* Register the group in the group name hash table, so we can look it up later. */ @@ -142,7 +136,6 @@ isc_result_t supersede_group (struct group_object *group, int writep) int clone_group (struct group **gp, struct group *group, const char *file, int line) { - isc_result_t status; struct group *g = (struct group *)0; /* Normally gp should contain the null pointer, but for convenience diff --git a/common/nit.c b/common/nit.c index 26549412..ca36ee3a 100644 --- a/common/nit.c +++ b/common/nit.c @@ -33,11 +33,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: nit.c,v 1.36 2007/04/27 23:54:05 each Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE) #include <sys/ioctl.h> diff --git a/common/options.c b/common/options.c index c75c8b19..aa18fa65 100644 --- a/common/options.c +++ b/common/options.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: options.c,v 1.110 2007/05/23 19:25:40 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #define DHCP_OPTION_DATA #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -44,9 +39,6 @@ static char copyright[] = struct option *vendor_cfg_option; -static void do_option_set PROTO ((pair *, - struct option_cache *, - enum statement_op)); static int pretty_text(char **, char *, const unsigned char **, const unsigned char *, int); static int pretty_domain(char **, char *, const unsigned char **, @@ -57,7 +49,6 @@ static int pretty_domain(char **, char *, const unsigned char **, int parse_options (packet) struct packet *packet; { - int i; struct option_cache *op = (struct option_cache *)0; /* Allocate a new option state. */ @@ -137,8 +128,6 @@ int parse_option_buffer (options, buffer, length, universe) unsigned length; struct universe *universe; { - unsigned char *t; - const unsigned char *end = buffer + length; unsigned len, offset; unsigned code; struct option_cache *op = NULL, *nop = NULL; @@ -356,7 +345,6 @@ int fqdn_universe_decode (struct option_state *options, const unsigned char *buffer, unsigned length, struct universe *u) { - char *name; struct buffer *bp = (struct buffer *)0; /* FQDN options have to be at least four bytes long. */ @@ -543,9 +531,7 @@ int cons_options (inpacket, outpacket, lease, client_state, int priority_len; unsigned char buffer [4096]; /* Really big buffer... */ unsigned main_buffer_size, mb_max; - unsigned mainbufix, bufix, agentix; - int fileix; - int snameix; + unsigned mainbufix, agentix; unsigned option_size; unsigned length; int i; @@ -553,7 +539,6 @@ int cons_options (inpacket, outpacket, lease, client_state, struct data_string ds; pair pp, *hash; int need_endopt = 0; - int have_sso = 0; int ocount = 0; int ofbuf1=0, ofbuf2=0; @@ -851,19 +836,23 @@ vsio_options(struct option_cache *oc, if (universe->tag_size == 1) { vs->buf[vs->bufpos++] = oc->option->code; } else if (universe->tag_size == 2) { - putUShort(vs->buf+vs->bufpos, oc->option->code); + putUShort((unsigned char *)vs->buf+vs->bufpos, + oc->option->code); vs->bufpos += 2; } else if (universe->tag_size == 4) { - putULong(vs->buf+vs->bufpos, oc->option->code); + putULong((unsigned char *)vs->buf+vs->bufpos, + oc->option->code); vs->bufpos += 4; } if (universe->length_size == 1) { vs->buf[vs->bufpos++] = ds.len; } else if (universe->length_size == 2) { - putUShort(vs->buf+vs->bufpos, ds.len); + putUShort((unsigned char *)vs->buf+vs->bufpos, + ds.len); vs->bufpos += 2; } else if (universe->length_size == 4) { - putULong(vs->buf+vs->bufpos, ds.len); + putULong((unsigned char *)vs->buf+vs->bufpos, + ds.len); vs->bufpos += 4; } memcpy(vs->buf + vs->bufpos, ds.data, ds.len); @@ -897,14 +886,13 @@ store_options6(char *buf, int buflen, struct option *o; struct data_string ds; int bufpos; - int len; int oro_size; u_int16_t code; int in_required_opts; - struct universe *u; int vsio_option_code; int vsio_wanted; struct vsio_state vs; + unsigned char *tmp; bufpos = 0; vsio_wanted = 0; @@ -942,12 +930,13 @@ store_options6(char *buf, int buflen, NULL, opt_state, NULL, &global_scope, oc, MDL)) { if ((ds.len + 4) <= (buflen - bufpos)) { + tmp = (unsigned char *)buf + bufpos; /* option tag */ - putUShort(buf+bufpos, required_opts[i]); + putUShort(tmp, required_opts[i]); /* option length */ - putUShort(buf+bufpos+2, ds.len); + putUShort(tmp+2, ds.len); /* option data */ - memcpy(buf+bufpos+4, ds.data, ds.len); + memcpy(tmp+4, ds.data, ds.len); /* update position */ bufpos += (4 + ds.len); } else { @@ -1006,12 +995,13 @@ store_options6(char *buf, int buflen, if (evaluate_option_cache(&ds, packet, NULL, NULL, opt_state, NULL, &global_scope, oc, MDL)) { if ((ds.len + 4) <= (buflen - bufpos)) { + tmp = (unsigned char *)buf + bufpos; /* option tag */ - putUShort(buf+bufpos, code); + putUShort(tmp, code); /* option length */ - putUShort(buf+bufpos+2, ds.len); + putUShort(tmp+2, ds.len); /* option data */ - memcpy(buf+bufpos+4, ds.data, ds.len); + memcpy(tmp+4, ds.data, ds.len); /* update position */ bufpos += (4 + ds.len); } else { @@ -1048,11 +1038,13 @@ store_options6(char *buf, int buflen, * add the "header". */ if (vs.bufpos > bufpos+8) { - putUShort(buf+bufpos, + tmp = (unsigned char *)buf + + bufpos; + putUShort(tmp, vsio_option_code); - putUShort(buf+bufpos+2, + putUShort(tmp+2, vs.bufpos-bufpos-4); - putULong(buf+bufpos+4, o->code); + putULong(tmp+4, o->code); bufpos = vs.bufpos; } @@ -1175,7 +1167,6 @@ int store_options (ocount, buffer, buflen, packet, lease, client_state, if ((option != NULL) && (((oc == NULL) && (option->format[0] == 'E')) || ((oc != NULL) && (option->format[0] == 'e')))) { - int uix; static char *s, *t; struct option_cache *tmp; struct data_string name; @@ -1314,7 +1305,6 @@ int store_options (ocount, buffer, buflen, packet, lease, client_state, toptstart = tix; while (length) { unsigned incr = length; - int consumed = 0; int *pix; unsigned char *base; @@ -1430,7 +1420,6 @@ format_has_text(format) const char *format; { const char *p; - int retval = 0; p = format; while (*p != '\0') { @@ -1987,7 +1976,7 @@ void set_option (universe, options, option, op) case eval_statement: case break_statement: default: - log_error ("bogus statement type in do_option_set."); + log_error ("bogus statement type in set_option."); break; case default_option_statement: @@ -2240,7 +2229,7 @@ collect_oro(struct option_cache *oc, void *void_oro) { struct data_string *oro = (struct data_string *)void_oro; - putUShort((char *)(oro->data + oro->len), oc->option->code); + putUShort((unsigned char *)(oro->data + oro->len), oc->option->code); oro->len += 2; } @@ -2295,8 +2284,9 @@ build_server_oro(struct data_string *server_oro, o = universes[i]->enc_opt; while (o != NULL) { if (o->universe == &dhcpv6_universe) { - putUShort((char *)server_oro->data + - server_oro->len, + unsigned char *tmp; + tmp = (unsigned char *)server_oro->data; + putUShort(tmp + server_oro->len, o->code); server_oro->len += 2; break; @@ -2395,7 +2385,6 @@ void delete_hashed_option (universe, options, code) int hashix; pair bptr, prev = (pair)0; pair *hash = options -> universes [universe -> index]; - struct option_cache *oc; /* There may not be any options in this space. */ if (!hash) @@ -2642,12 +2631,11 @@ int option_space_encapsulate (result, packet, lease, client_state, struct binding_scope **scope; struct data_string *name; { - struct data_string sub; - struct universe *u = NULL, *subu = NULL; + struct universe *u = NULL; int status = 0; - int i; - universe_hash_lookup(&u, universe_hash, name->data, name->len, MDL); + universe_hash_lookup(&u, universe_hash, + (char *)name->data, name->len, MDL); if (u == NULL) { log_error("option_space_encapsulate: option space %.*s does " "not exist, but is configured.", @@ -2776,7 +2764,6 @@ int nwip_option_space_encapsulate (result, packet, lease, client_state, { pair ocp; int status; - int i; static struct option_cache *no_nwip; struct data_string ds; struct option_chain_head *head; @@ -2790,7 +2777,6 @@ int nwip_option_space_encapsulate (result, packet, lease, client_state, status = 0; for (ocp = head -> first; ocp; ocp = ocp -> cdr) { - struct option_cache *oc = (struct option_cache *)(ocp -> car); if (store_option (result, universe, packet, lease, client_state, in_options, cfg_options, scope, @@ -3222,7 +3208,7 @@ fqdn6_universe_decode(struct option_state *options, goto error; /* Convert the domain name to textual representation for config. */ - len = MRns_name_ntop(buffer + 1, bp->data + 3, length - 1); + len = MRns_name_ntop(buffer + 1, (char *)bp->data + 3, length - 1); if (len == -1) { log_error("Unable to convert dhcp6.fqdn domain name to " "printable form."); @@ -3235,7 +3221,7 @@ fqdn6_universe_decode(struct option_state *options, bp->data + 3, len, FQDN_FQDN, 1)) goto error; - first_dot = strchr(bp->data + 3, '.'); + first_dot = (unsigned char *)strchr((char *)bp->data + 3, '.'); if (first_dot != NULL) { hlen = first_dot - bp->data + 3; @@ -3302,8 +3288,6 @@ void suboption_foreach (struct packet *packet, struct lease *lease, { struct universe *universe = find_option_universe (oc -> option, vsname); - int i; - if (universe -> foreach) (*universe -> foreach) (packet, lease, client_state, in_options, cfg_options, @@ -3352,7 +3336,6 @@ void save_linked_option (universe, options, oc) struct option_cache *oc; { pair *tail; - pair np = (pair )0; struct option_chain_head *head; struct option_cache **ocloc; @@ -3527,7 +3510,6 @@ void do_packet (interface, packet, len, from_port, from, hfrom) struct iaddr from; struct hardware *hfrom; { - int i; struct option_cache *op; struct packet *decoded_packet; #if defined (DEBUG_MEMORY_LEAKAGE) diff --git a/common/packet.c b/common/packet.c index e17933cd..3b2c1be9 100644 --- a/common/packet.c +++ b/common/packet.c @@ -31,11 +31,6 @@ * still be disabled. */ -#ifndef lint -static char copyright[] = -"$Id: packet.c,v 1.48 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004,2005,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (PACKET_ASSEMBLY) || defined (PACKET_DECODING) diff --git a/common/parse.c b/common/parse.c index f418bb35..4d180c11 100644 --- a/common/parse.c +++ b/common/parse.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: parse.c,v 1.129 2007/06/27 18:25:15 each Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <syslog.h> @@ -335,9 +330,6 @@ int parse_ip_addr (cfile, addr) struct parse *cfile; struct iaddr *addr; { - const char *val; - enum dhcp_token token; - addr -> len = 4; if (parse_numeric_aggregate (cfile, addr -> iabuf, &addr -> len, DOT, 10, 8)) @@ -732,7 +724,7 @@ void convert_num (cfile, buf, str, base, size) int base; unsigned size; { - const unsigned char *ptr = str; + const unsigned char *ptr = (const unsigned char *)str; int negative = 0; u_int32_t val = 0; int tval; @@ -860,7 +852,6 @@ void convert_num (cfile, buf, str, base, size) TIME parse_date (cfile) struct parse *cfile; { - struct tm tm; int guess; int tzoff, wday, year, mon, mday, hour, min, sec; const char *val; @@ -1428,7 +1419,6 @@ int parse_option_code_definition (cfile, option) char tokbuf [128]; unsigned tokix = 0; char type; - int code; int is_signed; char *s; int has_encapsulation = 0; @@ -1953,7 +1943,6 @@ int parse_executable_statement (result, cfile, lose, case_context) enum dhcp_token token; const char *val; unsigned len; - struct executable_statement base; struct class *cta; struct option *option=NULL; struct option_cache *cache; @@ -2293,7 +2282,6 @@ int parse_executable_statement (result, cfile, lose, case_context) if (token != NAME && token != NUMBER_OR_NAME) { parse_warn (cfile, "%s can't be a variable name", val); - badunset: skip_to_semi (cfile); *lose = 1; return 0; @@ -3345,15 +3333,13 @@ int parse_non_binary (expr, cfile, lose, context) enum dhcp_token token; const char *val; struct collection *col; - struct option *option; struct expression *nexp, **ep; int known; enum expr_op opcode; const char *s; char *cptr; - int i; unsigned long u; - isc_result_t status, code; + isc_result_t status; unsigned len; token = peek_token (&val, (unsigned *)0, cfile); @@ -3883,7 +3869,6 @@ int parse_non_binary (expr, cfile, lose, context) parse_warn (cfile, "expecting dns expression."); - badnstrans: expression_dereference (expr, MDL); *lose = 1; return 0; @@ -4917,7 +4902,6 @@ int parse_option_statement (result, cfile, lookups, option, op) enum dhcp_token token; struct expression *expr = (struct expression *)0; int lose; - int ftt = 1; token = peek_token (&val, (unsigned *)0, cfile); if (token == SEMI) { @@ -4981,9 +4965,8 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups) struct expression *t = (struct expression *)0; unsigned char buf [4]; unsigned len; - unsigned char *ob; struct iaddr addr; - int num, compress; + int compress; const char *f, *g; struct enumeration_value *e; @@ -5253,11 +5236,6 @@ int parse_option_decl (oc, cfile) /* Parse the option data... */ do { - /* Set a flag if this is an array of a simple type (i.e., - not an array of pairs of IP addresses, or something - like that. */ - int uniform = option -> format [1] == 'A'; - for (fmt = option -> format; *fmt; fmt++) { if (*fmt == 'A') break; @@ -5499,7 +5477,6 @@ int parse_X (cfile, buf, max) int token; const char *val; unsigned len; - u_int8_t *s; token = peek_token (&val, (unsigned *)0, cfile); if (token == NUMBER_OR_NAME || token == NUMBER) { @@ -5566,8 +5543,7 @@ int parse_warn (struct parse *cfile, const char *fmt, ...) if (lix < (sizeof lexbuf) - 1) lexbuf [lix++] = ' '; if (cfile -> token_line [i] == '\t') { - for (lix; - lix < (sizeof lexbuf) - 1 && (lix & 7); lix++) + for (; lix < (sizeof lexbuf) - 1 && (lix & 7); lix++) lexbuf [lix] = ' '; } } diff --git a/common/print.c b/common/print.c index 51ce2d30..c7bad104 100644 --- a/common/print.c +++ b/common/print.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: print.c,v 1.67 2007/06/07 15:52:29 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" int db_time_format = DEFAULT_TIME_FORMAT; @@ -44,7 +39,7 @@ int db_time_format = DEFAULT_TIME_FORMAT; char *quotify_string (const char *s, const char *file, int line) { unsigned len = 0; - const unsigned char *sp; + const char *sp; char *buf, *nsp; for (sp = s; sp && *sp; sp++) { @@ -461,7 +456,6 @@ static unsigned print_subexpression (expr, buf, len) { unsigned rv, left; const char *s; - struct expression *next_arg; switch (expr -> op) { case expr_none: @@ -1091,7 +1085,6 @@ int token_print_indent_concat (FILE *file, int col, int indent, const char *suffix, ...) { va_list list; - char *buf; unsigned len; char *s, *t, *u; @@ -1140,7 +1133,7 @@ int token_indent_data_string (FILE *file, int col, int indent, /* If we have a purely ASCII string, output it as text. */ if (i == data -> len) { - char *buf = dmalloc (data -> len + 3, MDL); + buf = dmalloc (data -> len + 3, MDL); if (buf) { buf [0] = '"'; memcpy (buf + 1, data -> data, data -> len); diff --git a/common/raw.c b/common/raw.c index 734c7000..55929abd 100644 --- a/common/raw.c +++ b/common/raw.c @@ -45,11 +45,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: raw.c,v 1.18 2005/03/17 20:15:00 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (USE_RAW_SEND) diff --git a/common/resolv.c b/common/resolv.c index 5f34f78b..38396772 100644 --- a/common/resolv.c +++ b/common/resolv.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: resolv.c,v 1.18 2006/02/24 23:16:28 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" struct name_server *name_servers; @@ -50,10 +45,8 @@ void read_resolv_conf (parse_time) struct parse *cfile; const char *val; int token; - int declaration = 0; struct name_server *sp, *sl, *ns; struct domain_search_list *dp, *dl, *nd; - struct iaddr *iaddr; if ((file = open (path_resolv_conf, O_RDONLY)) < 0) { log_error ("Can't open %s: %m", path_resolv_conf); @@ -179,7 +172,6 @@ void read_resolv_conf (parse_time) struct name_server *first_name_server () { - FILE *rc; static TIME rcdate; struct stat st; @@ -190,8 +182,6 @@ struct name_server *first_name_server () return (struct name_server *)0; } if (st.st_mtime > rcdate) { - char rcbuf [512]; - char *s, *t, *u; rcdate = cur_time + 1; read_resolv_conf (rcdate); diff --git a/common/socket.c b/common/socket.c index 01a17b8c..ccd8ae08 100644 --- a/common/socket.c +++ b/common/socket.c @@ -40,12 +40,6 @@ * I have implemented it under Linux; other systems should be doable also. */ -#ifndef lint -static char copyright[] = -"$Id: socket.c,v 1.66 2007/05/19 23:16:13 dhankins Exp $ " -"Copyright (c) 2004-2007 Internet Systems Consortium.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <errno.h> #include <sys/ioctl.h> @@ -60,7 +54,14 @@ static char copyright[] = # endif #endif +/* + * If we can't bind() to a specific interface, then we can only have + * a single socket. This variable insures that we don't try to listen + * on two sockets. + */ +#if !defined(SO_BINDTODEVICE) && !defined(USE_FALLBACK) static int once = 0; +#endif /* !defined(SO_BINDTODEVICE) && !defined(USE_FALLBACK) */ /* Reinitializes the specified interface after an address change. This is not required for packet-filter APIs. */ diff --git a/common/tables.c b/common/tables.c index 1228812d..6d8a5df9 100644 --- a/common/tables.c +++ b/common/tables.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: tables.c,v 1.64 2007/05/29 18:11:55 each Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" /* XXXDPN: Moved here from hash.c, when it moved to libomapi. Not sure diff --git a/common/tr.c b/common/tr.c index da5eb416..2abf399f 100644 --- a/common/tr.c +++ b/common/tr.c @@ -26,11 +26,6 @@ * http://www.isc.org/ */ -#ifndef lint -static char copyright[] = -"$Id: tr.c,v 1.11 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (HAVE_TR_SUPPORT) && \ diff --git a/common/upf.c b/common/upf.c index fdb4e04e..9c66a758 100644 --- a/common/upf.c +++ b/common/upf.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: upf.c,v 1.24 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #if defined (USE_UPF_SEND) || defined (USE_UPF_RECEIVE) #include <sys/ioctl.h> diff --git a/dhcpctl/callback.c b/dhcpctl/callback.c index 9d94bf3c..35c947e3 100644 --- a/dhcpctl/callback.c +++ b/dhcpctl/callback.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: callback.c,v 1.8 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> #include "dhcpctl.h" @@ -60,7 +55,6 @@ dhcpctl_status dhcpctl_set_callback (dhcpctl_handle h, void *data, { dhcpctl_callback_object_t *callback; omapi_object_t *inner; - isc_result_t status; callback = dmalloc (sizeof *callback, MDL); if (!callback) @@ -163,8 +157,6 @@ isc_result_t dhcpctl_callback_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *p) { - int i; - if (p -> type != dhcpctl_callback_type) return ISC_R_INVALIDARG; diff --git a/dhcpctl/cltest.c b/dhcpctl/cltest.c index 561f6a0f..d7ecfe72 100644 --- a/dhcpctl/cltest.c +++ b/dhcpctl/cltest.c @@ -28,11 +28,6 @@ * by Brian Murrell. */ -#ifndef lint -static char ocopyright[] = -"$Id: cltest.c,v 1.13 2005/03/17 20:15:03 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include <time.h> #include <sys/time.h> #include <stdio.h> @@ -60,9 +55,8 @@ int main (argc, argv) isc_result_t status, waitstatus; dhcpctl_handle authenticator; dhcpctl_handle connection; - dhcpctl_handle host_handle, group_handle, interface_handle; - dhcpctl_data_string cid; - dhcpctl_data_string result, groupname, identifier; + dhcpctl_handle interface_handle; + dhcpctl_data_string result; int i; int mode = undefined; const char *interface = 0; diff --git a/dhcpctl/dhcpctl.c b/dhcpctl/dhcpctl.c index 8e1d750f..891f965b 100644 --- a/dhcpctl/dhcpctl.c +++ b/dhcpctl/dhcpctl.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: dhcpctl.c,v 1.27 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> #include "dhcpctl.h" @@ -102,7 +97,6 @@ dhcpctl_status dhcpctl_connect (dhcpctl_handle *connection, dhcpctl_handle authinfo) { isc_result_t status; - dhcpctl_status waitstatus; status = omapi_generic_new (connection, MDL); if (status != ISC_R_SUCCESS) { @@ -172,7 +166,6 @@ dhcpctl_status dhcpctl_get_value (dhcpctl_data_string *result, { isc_result_t status; omapi_value_t *tv = (omapi_value_t *)0; - omapi_data_string_t *value = (omapi_data_string_t *)0; unsigned len; int ip; @@ -264,7 +257,6 @@ dhcpctl_status dhcpctl_set_value (dhcpctl_handle h, dhcpctl_data_string value, isc_result_t status; omapi_typed_data_t *tv = (omapi_typed_data_t *)0; omapi_data_string_t *name = (omapi_data_string_t *)0; - int len; status = omapi_data_string_new (&name, strlen (value_name), MDL); if (status != ISC_R_SUCCESS) @@ -298,7 +290,6 @@ dhcpctl_status dhcpctl_set_string_value (dhcpctl_handle h, const char *value, isc_result_t status; omapi_typed_data_t *tv = (omapi_typed_data_t *)0; omapi_data_string_t *name = (omapi_data_string_t *)0; - int len; status = omapi_data_string_new (&name, strlen (value_name), MDL); if (status != ISC_R_SUCCESS) @@ -387,7 +378,6 @@ dhcpctl_status dhcpctl_set_boolean_value (dhcpctl_handle h, int value, isc_result_t status; omapi_typed_data_t *tv = (omapi_typed_data_t *)0; omapi_data_string_t *name = (omapi_data_string_t *)0; - int len; status = omapi_data_string_new (&name, strlen (value_name), MDL); if (status != ISC_R_SUCCESS) @@ -417,7 +407,6 @@ dhcpctl_status dhcpctl_set_int_value (dhcpctl_handle h, int value, isc_result_t status; omapi_typed_data_t *tv = (omapi_typed_data_t *)0; omapi_data_string_t *name = (omapi_data_string_t *)0; - int len; status = omapi_data_string_new (&name, strlen (value_name), MDL); if (status != ISC_R_SUCCESS) diff --git a/dhcpctl/omshell.c b/dhcpctl/omshell.c index 63286eb5..eac61365 100644 --- a/dhcpctl/omshell.c +++ b/dhcpctl/omshell.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: omshell.c,v 1.16 2007/06/08 14:58:20 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include <time.h> #include <sys/time.h> #include <stdio.h> @@ -89,11 +84,9 @@ main(int argc, char **argv) { dhcpctl_handle connection; dhcpctl_handle authenticator; dhcpctl_handle oh; - dhcpctl_data_string cid, ip_addr; - dhcpctl_data_string result, groupname, identifier; struct data_string secret; const char *name = 0, *algorithm = "hmac-md5"; - int i, j; + int i; int port = 7911; const char *server = "127.0.0.1"; struct parse *cfile; @@ -483,7 +476,6 @@ main(int argc, char **argv) { val = buf; do { int intval = atoi (val); - dotiszero: if (intval > 255) { parse_warn (cfile, "dotted octet > 255: %s", diff --git a/dhcpctl/remote.c b/dhcpctl/remote.c index 945770fc..29af9c72 100644 --- a/dhcpctl/remote.c +++ b/dhcpctl/remote.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: remote.c,v 1.16 2007/05/19 19:16:24 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> #include "dhcpctl.h" @@ -355,8 +350,6 @@ isc_result_t dhcpctl_remote_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *p) { - int i; - if (p -> type != dhcpctl_remote_type) return ISC_R_INVALIDARG; diff --git a/dst/dst_api.c b/dst/dst_api.c index 0be00928..be629165 100644 --- a/dst/dst_api.c +++ b/dst/dst_api.c @@ -1,5 +1,5 @@ #ifndef LINT -static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.2 2007/05/29 18:11:55 each Exp $"; +static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.3 2007/07/13 06:43:42 shane Exp $"; #endif /* @@ -563,10 +563,10 @@ dst_s_read_public_key(const char *in_name, const unsigned in_id, int in_alg) enckey[--len] = '\0'; /* remove leading spaces */ - for (notspace = (char *) enckey; isspace(*notspace); len--) + for (notspace = (unsigned char *)enckey; isspace(*notspace); len--) notspace++; - dlen = b64_pton(notspace, deckey, sizeof(deckey)); + dlen = b64_pton((char *)notspace, deckey, sizeof(deckey)); if (dlen < 0) { EREPORT(("dst_read_public_key: bad return from b64_pton = %d", dlen)); diff --git a/dst/prandom.c b/dst/prandom.c index b45c5332..2311ccc3 100644 --- a/dst/prandom.c +++ b/dst/prandom.c @@ -1,5 +1,5 @@ #ifndef LINT -static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/prandom.c,v 1.3 2007/05/19 19:16:25 dhankins Exp $"; +static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/prandom.c,v 1.4 2007/07/13 06:43:42 shane Exp $"; #endif /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. @@ -428,7 +428,7 @@ unix_cmd(dst_work *work) cnt += do_time(work); } while ((n = fread(buffer, sizeof(char), sizeof(buffer), pipe)) > 0) - NULL; /* drain the pipe */ + ; /* drain the pipe */ pclose(pipe); return (cnt); /* read how many bytes where read in */ } diff --git a/includes/dhcpd.h b/includes/dhcpd.h index 31976cc4..df347d9d 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -1688,6 +1688,8 @@ int parse_non_binary PROTO ((struct expression **, struct parse *, int *, int parse_expression PROTO ((struct expression **, struct parse *, int *, enum expression_context, struct expression **, enum expr_op)); +int parse_option_data(struct expression **expr, struct parse *cfile, + int lookups, struct option *option); int parse_option_statement PROTO ((struct executable_statement **, struct parse *, int, struct option *, enum statement_op)); diff --git a/minires/ns_date.c b/minires/ns_date.c index 88e6b4c9..c24b2b74 100644 --- a/minires/ns_date.c +++ b/minires/ns_date.c @@ -22,7 +22,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_date.c,v 1.4 2007/05/29 18:11:56 each Exp $"; +static const char rcsid[] = "$Id: ns_date.c,v 1.5 2007/07/13 06:43:42 shane Exp $"; #endif /* Import. */ @@ -48,7 +48,7 @@ static const char rcsid[] = "$Id: ns_date.c,v 1.4 2007/05/29 18:11:56 each Exp $ /* Forward. */ -static int datepart(const unsigned char *, int, int, int, int *); +static int datepart(const char *, int, int, int, int *); /* Public. */ @@ -118,12 +118,12 @@ ns_datetosecs(const char *cp, int *errp) { * Don't reset the flag if there is no error. */ static int -datepart(const unsigned char *buf, int size, int min, int max, int *errp) { +datepart(const char *buf, int size, int min, int max, int *errp) { int result = 0; int i; for (i = 0; i < size; i++) { - if (!isdigit(buf[i])) + if (!isdigit((unsigned char)buf[i])) *errp = 1; result = (result * 10) + buf[i] - '0'; } diff --git a/minires/res_init.c b/minires/res_init.c index 00b303bd..bfcd60e9 100644 --- a/minires/res_init.c +++ b/minires/res_init.c @@ -76,7 +76,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; -static const char rcsid[] = "$Id: res_init.c,v 1.7 2007/05/29 18:11:56 each Exp $"; +static const char rcsid[] = "$Id: res_init.c,v 1.8 2007/07/13 06:43:42 shane Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -154,7 +154,7 @@ res_ninit(res_state statp) { int minires_vinit(res_state statp, int preinit) { register FILE *fp; - register unsigned char *cp; + char *cp; register char **pp; register int n; char buf[BUFSIZ]; diff --git a/minires/res_mkupdate.c b/minires/res_mkupdate.c index d47f8f8a..f8d84004 100644 --- a/minires/res_mkupdate.c +++ b/minires/res_mkupdate.c @@ -27,7 +27,7 @@ */ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: res_mkupdate.c,v 1.10 2007/05/19 19:16:25 dhankins Exp $"; +static const char rcsid[] = "$Id: res_mkupdate.c,v 1.11 2007/07/13 06:43:42 shane Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -109,7 +109,7 @@ res_nmkupdate(res_state statp, u_int16_t rtype, rclass; u_int32_t n1, rttl; u_char *dnptrs[20], **dpp, **lastdnptr; - unsigned siglen, certlen; + unsigned certlen; int keylen; unsigned buflen = *blp; u_char *buf = (unsigned char *)bp; @@ -483,6 +483,7 @@ res_nmkupdate(res_state statp, { int sig_type, success, dateerror; u_int32_t exptime, timesigned; + unsigned siglen; /* type */ if ((n = getword_str(buf2, sizeof buf2, diff --git a/minires/res_query.c b/minires/res_query.c index adc435ae..23ad1ed1 100644 --- a/minires/res_query.c +++ b/minires/res_query.c @@ -76,7 +76,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_query.c,v 1.6 2007/05/29 18:11:56 each Exp $"; +static const char rcsid[] = "$Id: res_query.c,v 1.7 2007/07/13 06:43:42 shane Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -396,7 +396,7 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) { setbuf(fp, NULL); buf[sizeof(buf) - 1] = '\0'; while (fgets(buf, sizeof(buf), fp)) { - for (cp1 = buf; *cp1 && !isspace(*cp1); ++cp1) + for (cp1 = (unsigned char *)buf; *cp1 && !isspace(*cp1); ++cp1) ; if (!*cp1) break; @@ -409,7 +409,7 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) { for (cp2 = cp1 + 1; *cp2 && !isspace(*cp2); ++cp2) ; *cp2 = '\0'; - strncpy(dst, cp1, siz - 1); + strncpy(dst, (char *)cp1, siz - 1); dst[siz - 1] = '\0'; fclose(fp); return (dst); diff --git a/minires/res_update.c b/minires/res_update.c index b16da1d5..d084e71b 100644 --- a/minires/res_update.c +++ b/minires/res_update.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: res_update.c,v 1.13 2005/03/17 20:15:20 dhankins Exp $"; +static const char rcsid[] = "$Id: res_update.c,v 1.14 2007/07/13 06:43:42 shane Exp $"; #endif /* not lint */ /* @@ -88,7 +88,7 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in) { double answer[PACKETSZ / sizeof (double)]; double packet[2*PACKETSZ / sizeof (double)]; struct zonegrp *zptr, tgrp; - int nzones = 0, nscount = 0; + int nscount = 0; unsigned n; unsigned rval; struct sockaddr_in nsaddrs[MAXNS]; diff --git a/omapip/alloc.c b/omapip/alloc.c index a5d76f6e..4572633c 100644 --- a/omapip/alloc.c +++ b/omapip/alloc.c @@ -33,11 +33,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: alloc.c,v 1.28 2007/05/19 19:16:25 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium, Inc. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -65,10 +60,10 @@ void * dmalloc(unsigned size, const char *file, int line) { unsigned char *foo; unsigned len; - int i; void **bar; #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + int i; struct dmalloc_preamble *dp; #endif diff --git a/omapip/array.c b/omapip/array.c index 6c23f9df..54aa056d 100644 --- a/omapip/array.c +++ b/omapip/array.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: array.c,v 1.6 2007/05/19 19:16:25 dhankins Exp $ Copyright 2004-2007 Internet Systems Consortium."; -#endif - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -48,7 +43,6 @@ isc_result_t omapi_array_allocate (omapi_array_t **array, omapi_array_deref_t deref, const char *file, int line) { - isc_result_t status; omapi_array_t *aptr; if (!array || *array) @@ -65,7 +59,6 @@ isc_result_t omapi_array_allocate (omapi_array_t **array, isc_result_t omapi_array_free (omapi_array_t **array, const char *file, int line) { - isc_result_t status; omapi_array_t *aptr; int i; diff --git a/omapip/auth.c b/omapip/auth.c index 50df9e34..b3e0b9ac 100644 --- a/omapip/auth.c +++ b/omapip/auth.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: auth.c,v 1.8 2007/05/19 19:16:25 dhankins Exp $ Copyright 2004,2007 Internet Systems Consortium."; -#endif - #include "dhcpd.h" #include <omapip/omapip_p.h> diff --git a/omapip/buffer.c b/omapip/buffer.c index de3964b5..4e851280 100644 --- a/omapip/buffer.c +++ b/omapip/buffer.c @@ -441,7 +441,6 @@ isc_result_t omapi_connection_writer (omapi_object_t *h) int bytes_written; unsigned first_byte; omapi_buffer_t *buffer; - unsigned char *bufp; omapi_connection_object_t *c; isc_result_t status; @@ -578,7 +577,6 @@ isc_result_t omapi_connection_put_uint32 (omapi_object_t *c, u_int32_t value) { u_int32_t inbuf; - isc_result_t status; inbuf = htonl (value); @@ -605,7 +603,6 @@ isc_result_t omapi_connection_put_uint16 (omapi_object_t *c, u_int32_t value) { u_int16_t inbuf; - isc_result_t status; inbuf = htons (value); diff --git a/omapip/connection.c b/omapip/connection.c index 5f753036..3f0965d2 100644 --- a/omapip/connection.c +++ b/omapip/connection.c @@ -114,10 +114,6 @@ isc_result_t omapi_connect_list (omapi_object_t *c, omapi_connection_object_t *obj; int flag; struct sockaddr_in local_sin; -#if defined (TRACING) - trace_addr_t *addrs; - u_int16_t naddrs; -#endif obj = (omapi_connection_object_t *)0; status = omapi_connection_allocate (&obj, MDL); @@ -1005,8 +1001,6 @@ isc_result_t omapi_connection_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *m) { - int i; - if (m -> type != omapi_type_connection) return ISC_R_INVALIDARG; diff --git a/omapip/convert.c b/omapip/convert.c index 313858e4..c7af59bd 100644 --- a/omapip/convert.c +++ b/omapip/convert.c @@ -33,11 +33,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: convert.c,v 1.4 2007/05/19 19:16:26 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -167,7 +162,7 @@ int binary_to_ascii (outbuf, inbuf, base, width) u_int32_t number; static char h2a [] = "0123456789abcdef"; int power = converted_length (inbuf, base, width); - int i, j; + int i; if (base > 16) return 0; diff --git a/omapip/dispatch.c b/omapip/dispatch.c index 6c188b24..9d1a62e0 100644 --- a/omapip/dispatch.c +++ b/omapip/dispatch.c @@ -35,6 +35,7 @@ #include "dhcpd.h" #include <omapip/omapip_p.h> +#include <sys/time.h> static omapi_io_object_t omapi_io_states; time_t cur_time; diff --git a/omapip/errwarn.c b/omapip/errwarn.c index 5cb29706..9ea90b1f 100644 --- a/omapip/errwarn.c +++ b/omapip/errwarn.c @@ -31,11 +31,6 @@ * with Vixie Laboratories. */ -#ifndef lint -static char copyright[] = -"$Id: errwarn.c,v 1.12 2007/05/19 19:16:26 dhankins Exp $ Copyright (c) 2004,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> diff --git a/omapip/generic.c b/omapip/generic.c index 4b8ce003..24003d58 100644 --- a/omapip/generic.c +++ b/omapip/generic.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: generic.c,v 1.14 2007/05/19 19:16:26 dhankins Exp $ Copyright 2004-2007 Internet Systems Consortium."; -#endif - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -294,7 +289,6 @@ isc_result_t omapi_generic_stuff_values (omapi_object_t *c, isc_result_t omapi_generic_clear_flags (omapi_object_t *o) { int i; - isc_result_t status; omapi_generic_object_t *g; if (o -> type != omapi_type_generic) diff --git a/omapip/handle.c b/omapip/handle.c index 4d21f9e9..56ada1da 100644 --- a/omapip/handle.c +++ b/omapip/handle.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: handle.c,v 1.10 2007/05/19 19:16:26 dhankins Exp $ Copyright 2004-2007 Internet Systems Consortium."; -#endif - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -78,7 +73,6 @@ static isc_result_t omapi_handle_table_enclose (omapi_handle_table_t **); isc_result_t omapi_object_handle (omapi_handle_t *h, omapi_object_t *o) { - int tabix; isc_result_t status; if (o -> handle) { @@ -287,7 +281,6 @@ static isc_result_t omapi_handle_lookup_in (omapi_object_t **o, isc_result_t omapi_handle_td_lookup (omapi_object_t **obj, omapi_typed_data_t *handle) { - isc_result_t status; omapi_handle_t h; if (handle -> type == omapi_datatype_int) diff --git a/omapip/hash.c b/omapip/hash.c index 912e6653..6c790079 100644 --- a/omapip/hash.c +++ b/omapip/hash.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: hash.c,v 1.16 2007/05/29 18:11:56 each Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -106,12 +101,13 @@ void free_hash_table (tp, file, line) const char *file; int line; { - int i; - struct hash_bucket *hbc, *hbn = (struct hash_bucket *)0; struct hash_table *ptr = *tp; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + int i; + struct hash_bucket *hbc, *hbn = (struct hash_bucket *)0; + for (i = 0; i < ptr -> hash_count; i++) { for (hbc = ptr -> buckets [i]; hbc; hbc = hbn) { hbn = hbc -> next; @@ -200,8 +196,9 @@ void free_hash_bucket (ptr, file, line) const char *file; int line; { - struct hash_bucket *hp; #if defined (DEBUG_MALLOC_POOL) + struct hash_bucket *hp; + for (hp = free_hash_buckets; hp; hp = hp -> next) { if (hp == ptr) { log_error ("hash bucket freed twice!"); @@ -352,7 +349,7 @@ hash_report(struct hash_table *table) struct hash_bucket *bp; if (table->hash_count == 0) - return (char *) "Invalid hash table."; + return (unsigned char *) "Invalid hash table."; for (i = 0 ; i < table->hash_count ; i++) { curlen = 0; @@ -381,9 +378,10 @@ hash_report(struct hash_table *table) pct > 2147483647 || minlen > 2147483647 || maxlen > 2147483647) - return (char *) "Report out of range for display."; + return (unsigned char *) "Report out of range for display."; - sprintf(retbuf, "Contents/Size (%%): %u/%u (%u%%). Min/max: %u/%u", + sprintf((char *)retbuf, + "Contents/Size (%%): %u/%u (%u%%). Min/max: %u/%u", contents, table->hash_count, pct, minlen, maxlen); return retbuf; diff --git a/omapip/inet_addr.c b/omapip/inet_addr.c index 046515ad..752b359e 100644 --- a/omapip/inet_addr.c +++ b/omapip/inet_addr.c @@ -41,11 +41,6 @@ static char rcsid[] = "$NetBSD: inet_addr.c,v 1.6 1996/02/02 15:22:23 mrg Exp $" #endif #endif /* LIBC_SCCS and not lint */ -#ifndef lint -static char copyright[] = -"$Id: inet_addr.c,v 1.2 2007/05/19 18:47:15 dhankins Exp $ Copyright (c) 1983, 1990, 1993 The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include "omapip/omapip_p.h" diff --git a/omapip/listener.c b/omapip/listener.c index cf4ebddc..12ef2e9c 100644 --- a/omapip/listener.c +++ b/omapip/listener.c @@ -71,12 +71,9 @@ isc_result_t omapi_listen_addr (omapi_object_t *h, omapi_addr_t *addr, int max) { - struct hostent *he; - int hix; isc_result_t status; omapi_listener_object_t *obj; int i; - struct in_addr ia; /* Currently only support IPv4 addresses. */ if (addr->addrtype != AF_INET) @@ -218,8 +215,6 @@ isc_result_t omapi_accept (omapi_object_t *h) socklen_t len; omapi_connection_object_t *obj; omapi_listener_object_t *listener; - omapi_addr_t remote_addr; - int i; struct sockaddr_in addr; int socket; @@ -241,7 +236,6 @@ isc_result_t omapi_accept (omapi_object_t *h) /* If we're recording a trace, remember the connection. */ if (trace_record ()) { trace_iov_t iov [3]; - u_int32_t lsock; iov [0].buf = (char *)&addr.sin_port; iov [0].len = sizeof addr.sin_port; iov [1].buf = (char *)&addr.sin_addr; @@ -473,8 +467,6 @@ isc_result_t omapi_listener_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *l) { - int i; - if (l -> type != omapi_type_listener) return ISC_R_INVALIDARG; diff --git a/omapip/message.c b/omapip/message.c index 911280b5..5b16bca7 100644 --- a/omapip/message.c +++ b/omapip/message.c @@ -211,8 +211,6 @@ isc_result_t omapi_message_get_value (omapi_object_t *h, isc_result_t omapi_message_destroy (omapi_object_t *h, const char *file, int line) { - int i; - omapi_message_object_t *m; if (h -> type != omapi_type_message) return ISC_R_INVALIDARG; @@ -263,8 +261,6 @@ isc_result_t omapi_message_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *m) { - int i; - if (m -> type != omapi_type_message) return ISC_R_INVALIDARG; diff --git a/omapip/mrtrace.c b/omapip/mrtrace.c index 6a90fa31..ff80e4cd 100644 --- a/omapip/mrtrace.c +++ b/omapip/mrtrace.c @@ -88,7 +88,6 @@ void trace_mr_statp_setup (res_state statp) unsigned buflen = 0; char *buf = (char *)0; isc_result_t status; - u_int32_t id; int i; if (trace_playback ()) { @@ -415,7 +414,6 @@ unsigned int trace_mr_res_randomid (unsigned int oldid) isc_result_t status; if (trace_playback ()) { - int nscount; status = trace_get_packet (&trace_mr_randomid, &buflen, &buf); if (status != ISC_R_SUCCESS) { log_error ("trace_mr_statp: no statp packet found."); diff --git a/omapip/protocol.c b/omapip/protocol.c index 9e174ee7..38966cdd 100644 --- a/omapip/protocol.c +++ b/omapip/protocol.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: protocol.c,v 1.33 2007/05/19 19:16:26 dhankins Exp $ Copyright 2004-2007 Internet Systems Consortium."; -#endif - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -167,7 +162,6 @@ isc_result_t omapi_protocol_send_message (omapi_object_t *po, omapi_remote_auth_t *ra; omapi_value_t *signature; isc_result_t status; - u_int32_t foo; unsigned auth_len; if (po -> type != omapi_type_protocol || @@ -946,8 +940,6 @@ isc_result_t omapi_protocol_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *p) { - int i; - if (p -> type != omapi_type_protocol) return ISC_R_INVALIDARG; @@ -1134,8 +1126,6 @@ isc_result_t omapi_protocol_listener_stuff (omapi_object_t *c, omapi_object_t *id, omapi_object_t *p) { - int i; - if (p -> type != omapi_type_protocol_listener) return ISC_R_INVALIDARG; diff --git a/omapip/support.c b/omapip/support.c index 734eff03..e08304d6 100644 --- a/omapip/support.c +++ b/omapip/support.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: support.c,v 1.30 2007/05/19 19:16:26 dhankins Exp $ Copyright 2004-2007 Internet Systems Consortium."; -#endif - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -55,7 +50,6 @@ omapi_object_type_t *omapi_type_auth_key; omapi_object_type_t *omapi_object_types; int omapi_object_type_count; -static int ot_max; #if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) void omapi_type_relinquish () @@ -300,7 +294,6 @@ isc_result_t omapi_signal (omapi_object_t *handle, const char *name, ...) isc_result_t omapi_signal_in (omapi_object_t *handle, const char *name, ...) { va_list ap; - omapi_object_t *outer; isc_result_t status; if (!handle) @@ -370,7 +363,6 @@ isc_result_t omapi_set_value_str (omapi_object_t *h, const char *name, omapi_typed_data_t *value) { - omapi_object_t *outer; omapi_data_string_t *nds; isc_result_t status; @@ -391,8 +383,6 @@ isc_result_t omapi_set_boolean_value (omapi_object_t *h, omapi_object_t *id, isc_result_t status; omapi_typed_data_t *tv = (omapi_typed_data_t *)0; omapi_data_string_t *n = (omapi_data_string_t *)0; - int len; - int ip; status = omapi_data_string_new (&n, strlen (name), MDL); if (status != ISC_R_SUCCESS) @@ -417,8 +407,6 @@ isc_result_t omapi_set_int_value (omapi_object_t *h, omapi_object_t *id, isc_result_t status; omapi_typed_data_t *tv = (omapi_typed_data_t *)0; omapi_data_string_t *n = (omapi_data_string_t *)0; - int len; - int ip; status = omapi_data_string_new (&n, strlen (name), MDL); if (status != ISC_R_SUCCESS) @@ -443,8 +431,6 @@ isc_result_t omapi_set_object_value (omapi_object_t *h, omapi_object_t *id, isc_result_t status; omapi_typed_data_t *tv = (omapi_typed_data_t *)0; omapi_data_string_t *n = (omapi_data_string_t *)0; - int len; - int ip; status = omapi_data_string_new (&n, strlen (name), MDL); if (status != ISC_R_SUCCESS) @@ -469,8 +455,6 @@ isc_result_t omapi_set_string_value (omapi_object_t *h, omapi_object_t *id, isc_result_t status; omapi_typed_data_t *tv = (omapi_typed_data_t *)0; omapi_data_string_t *n = (omapi_data_string_t *)0; - int len; - int ip; status = omapi_data_string_new (&n, strlen (name), MDL); if (status != ISC_R_SUCCESS) diff --git a/omapip/trace.c b/omapip/trace.c index 836faf9a..97e1bcf3 100644 --- a/omapip/trace.c +++ b/omapip/trace.c @@ -32,11 +32,6 @@ * learn more about Nominum, Inc., see ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: trace.c,v 1.15 2007/05/19 19:16:26 dhankins Exp $ Copyright 2004-2007 Internet Systems Consortium."; -#endif - #include "dhcpd.h" #include <omapip/omapip_p.h> #include <errno.h> @@ -321,7 +316,7 @@ trace_type_t *trace_type_register (const char *name, void (*stop_tracing) (trace_type_t *), const char *file, int line) { - trace_type_t *ttmp, *tptr; + trace_type_t *ttmp; unsigned slen = strlen (name); isc_result_t status; @@ -520,7 +515,6 @@ isc_result_t trace_get_next_packet (trace_type_t **ttp, trace_type_t *ttype; unsigned paylen; int status; - int len; fpos_t curpos; status = fgetpos (traceinfile, &curpos); @@ -646,7 +640,6 @@ time_t trace_snoop_time (trace_type_t **ptp) unsigned bufmax = 0; unsigned buflen = 0; char *buf = (char *)0; - isc_result_t status; time_t result; trace_type_t *ttp; diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c index 96e0a97d..941fe8ef 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: dhcrelay.c,v 1.63 2007/06/07 15:29:31 each Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <syslog.h> @@ -745,7 +740,7 @@ int add_relay_agent_options (ip, packet, length, giaddr) unsigned length; struct in_addr giaddr; { - int is_dhcp = 0, agent_options_present = 0; + int is_dhcp = 0; unsigned optlen; u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; diff --git a/server/bootp.c b/server/bootp.c index 876f3f10..3a48cb4d 100644 --- a/server/bootp.c +++ b/server/bootp.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: bootp.c,v 1.79 2007/05/19 19:16:26 dhankins Exp $ Copyright (c) 2004,2005,2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <errno.h> diff --git a/server/class.c b/server/class.c index 367a8be0..c7d38150 100644 --- a/server/class.c +++ b/server/class.c @@ -32,12 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: class.c,v 1.33 2006/06/01 20:23:17 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; - -#endif /* not lint */ - #include "dhcpd.h" struct collection default_collection = { diff --git a/server/confpars.c b/server/confpars.c index fde78107..3a66ef5a 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -32,14 +32,8 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: confpars.c,v 1.172 2007/07/11 14:54:11 shane Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" -static TIME parsed_time; static unsigned char global_host_once = 1; #if defined (TRACING) @@ -340,15 +334,12 @@ int parse_statement (cfile, group, type, host_decl, declaration) enum dhcp_token token; const char *val; struct shared_network *share; - char *t, *n; - struct expression *expr; - struct data_string data; + char *n; struct hardware hardware; struct executable_statement *et, *ep; struct option *option = NULL; struct option_cache *cache; int lose; - struct data_string key_id; int known; isc_result_t status; unsigned code; @@ -997,7 +988,6 @@ void parse_failover_peer (cfile, group, type) "load balance settings."); if (token != NUMBER) { parse_warn (cfile, "expecting number"); - badsplit: skip_to_rbrace (cfile, 1); dhcp_failover_state_dereference (&peer, MDL); return; @@ -1569,8 +1559,6 @@ void parse_pool_statement (cfile, group, type) /* See if there's already a pool into which we can merge this one. */ for (pp = pool -> shared_network -> pools; pp; pp = pp -> next) { - struct lease *l; - if (pp -> group -> statements != pool -> group -> statements) continue; #if defined (FAILOVER_PROTOCOL) @@ -1936,7 +1924,6 @@ int parse_class_declaration (cp, cfile, group, type) char *name; const char *tname; struct executable_statement *stmt = (struct executable_statement *)0; - struct expression *expr; int new = 1; isc_result_t status = ISC_R_FAILURE; int matchedonce = 0; @@ -2456,7 +2443,7 @@ void parse_subnet_declaration (cfile, share) { const char *val; enum dhcp_token token; - struct subnet *subnet, *t, *u; + struct subnet *subnet; struct iaddr iaddr; unsigned char addr [4]; unsigned len = sizeof addr; @@ -2519,6 +2506,10 @@ void parse_subnet_declaration (cfile, share) void parse_subnet6_declaration(struct parse *cfile, struct shared_network *share) { +#if !defined(DHCPv6) + parse_warn(cfile, "No DHCPv6 support."); + skip_to_semi(cfile); +#else /* defined(DHCPv6) */ struct subnet *subnet; isc_result_t status; enum dhcp_token token; @@ -2528,12 +2519,7 @@ parse_subnet6_declaration(struct parse *cfile, struct shared_network *share) { const static int mask[] = { 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE }; struct iaddr iaddr; - struct ipv6_pool *pool; -#if !defined(DHCPv6) - parse_warn(cfile, "No DHCPv6 support."); - skip_to_semi(cfile); -#else /* defined(DHCPv6) */ subnet = NULL; status = subnet_allocate(&subnet, MDL); if (status != ISC_R_SUCCESS) { @@ -2787,8 +2773,6 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile) char tbuf [32]; struct lease *lease; struct executable_statement *on; - struct expression *exp; - struct data_string ds; int lose; TIME t; char *s; @@ -3221,7 +3205,6 @@ 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); binding -> value -> type = binding_data; binding -> value -> value.data.len = buflen; @@ -3378,7 +3361,6 @@ void parse_address_range (cfile, group, type, inpool, lpchain) int dynamic = 0; struct subnet *subnet; struct shared_network *share; - struct pool *p; struct pool *pool; isc_result_t status; @@ -3760,11 +3742,15 @@ int parse_allow_deny (oc, cfile, flag) void parse_ia_na_declaration(struct parse *cfile) { +#if !defined(DHCPv6) + parse_warn(cfile, "No DHCPv6 support."); + skip_to_semi(cfile); +#else /* defined(DHCPv6) */ enum dhcp_token token; struct ia_na *ia_na; const char *val; struct ia_na *old_ia_na; - int len; + unsigned int len; u_int32_t iaid; struct iaddr iaddr; binding_state_t state; @@ -3772,12 +3758,7 @@ parse_ia_na_declaration(struct parse *cfile) { struct iaaddr *iaaddr; struct ipv6_pool *pool; char addr_buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; - struct data_string uid; -#if !defined(DHCPv6) - parse_warn(cfile, "No DHCPv6 support."); - skip_to_semi(cfile); -#else /* defined(DHCPv6) */ token = next_token(&val, &len, cfile); if (token != STRING) { parse_warn(cfile, "corrupt lease file; " @@ -3941,10 +3922,10 @@ parse_ia_na_declaration(struct parse *cfile) { */ old_ia_na = NULL; if (ia_na_hash_lookup(&old_ia_na, ia_active, - (char *)ia_na->iaid_duid.data, + (unsigned char *)ia_na->iaid_duid.data, ia_na->iaid_duid.len, MDL)) { ia_na_hash_delete(ia_active, - (char *)ia_na->iaid_duid.data, + (unsigned char *)ia_na->iaid_duid.data, ia_na->iaid_duid.len, MDL); ia_na_remove_all_iaaddr(old_ia_na, MDL); ia_na_dereference(&old_ia_na, MDL); @@ -3954,7 +3935,8 @@ parse_ia_na_declaration(struct parse *cfile) { * If we have addresses, add this, otherwise don't bother. */ if (ia_na->num_iaaddr > 0) { - ia_na_hash_add(ia_active, (char *)ia_na->iaid_duid.data, + ia_na_hash_add(ia_active, + (unsigned char *)ia_na->iaid_duid.data, ia_na->iaid_duid.len, ia_na, MDL); } ia_na_dereference(&ia_na, MDL); @@ -3974,7 +3956,7 @@ void parse_server_duid(struct parse *cfile) { enum dhcp_token token; const char *val; - int len; + unsigned int len; struct data_string duid; token = next_token(&val, &len, cfile); @@ -3989,7 +3971,7 @@ parse_server_duid(struct parse *cfile) { if (!buffer_allocate(&duid.buffer, duid.len, MDL)) { log_fatal("Out of memory storing DUID"); } - duid.data = (char *)duid.buffer->data; + duid.data = (unsigned char *)duid.buffer->data; memcpy(duid.buffer->data, val, len); set_server_duid(&duid); @@ -4019,7 +4001,7 @@ void parse_server_duid_conf(struct parse *cfile) { enum dhcp_token token; const char *val; - int len; + unsigned int len; u_int32_t enterprise_number; int ll_type; struct data_string ll_addr; @@ -4068,7 +4050,7 @@ parse_server_duid_conf(struct parse *cfile) { if (!buffer_allocate(&duid.buffer, duid.len, MDL)) { log_fatal("Out of memory storing DUID"); } - duid.data = (char *)duid.buffer->data; + duid.data = (unsigned char *)duid.buffer->data; putUShort(duid.buffer->data, DUID_EN); putULong(duid.buffer->data + 2, enterprise_number); memcpy(duid.buffer->data + 6, val, len); @@ -4120,7 +4102,7 @@ parse_server_duid_conf(struct parse *cfile) { if (!buffer_allocate(&duid.buffer, duid.len, MDL)) { log_fatal("Out of memory storing DUID"); } - duid.data = (char *)duid.buffer->data; + duid.data = (unsigned char *)duid.buffer->data; putUShort(duid.buffer->data, DUID_LL); putULong(duid.buffer->data + 2, ll_type); memcpy(duid.buffer->data + 4, @@ -4184,7 +4166,7 @@ parse_server_duid_conf(struct parse *cfile) { if (!buffer_allocate(&duid.buffer, duid.len, MDL)) { log_fatal("Out of memory storing DUID"); } - duid.data = (char *)duid.buffer->data; + duid.data = (unsigned char *)duid.buffer->data; putUShort(duid.buffer->data, DUID_LLT); putULong(duid.buffer->data + 2, ll_type); putULong(duid.buffer->data + 4, llt_time); @@ -4224,7 +4206,7 @@ parse_server_duid_conf(struct parse *cfile) { if (!buffer_allocate(&duid.buffer, duid.len, MDL)) { log_fatal("Out of memory storing DUID"); } - duid.data = (char *)duid.buffer->data; + duid.data = (unsigned char *)duid.buffer->data; putUShort(duid.buffer->data, duid_type_num); memcpy(duid.buffer->data + 2, val, len); diff --git a/server/db.c b/server/db.c index ceb24dce..24e2269c 100644 --- a/server/db.c +++ b/server/db.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: db.c,v 1.81 2007/06/06 23:07:17 each Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <ctype.h> #include <errno.h> @@ -54,7 +49,6 @@ int write_lease (lease) struct lease *lease; { int errors = 0; - int i; struct binding *b; char *s; const char *tval; @@ -148,7 +142,6 @@ int write_lease (lease) ++errors; } if (lease -> uid_len) { - int i; s = quotify_buf (lease -> uid, lease -> uid_len, MDL); if (s) { errno = 0; @@ -222,7 +215,7 @@ int write_lease (lease) } } if (lease -> client_hostname && - db_printable (lease -> client_hostname)) { + db_printable((unsigned char *)lease->client_hostname)) { s = quotify_string (lease -> client_hostname, MDL); if (s) { errno = 0; @@ -281,7 +274,7 @@ int write_host (host) if (!new_lease_file ()) return 0; - if (!db_printable (host -> name)) + if (!db_printable((unsigned char *)host->name)) return 0; if (counting) @@ -419,7 +412,6 @@ int write_group (group) struct group_object *group; { int errors = 0; - int i; /* If the lease file is corrupt, don't try to write any more leases until we've written a good lease file. */ @@ -427,7 +419,7 @@ int write_group (group) if (!new_lease_file ()) return 0; - if (!db_printable (group -> name)) + if (!db_printable((unsigned char *)group->name)) return 0; if (counting) @@ -619,7 +611,6 @@ error_exit: #if defined (FAILOVER_PROTOCOL) int write_failover_state (dhcp_failover_state_t *state) { - struct tm *t; int errors = 0; const char *tval; @@ -831,8 +822,6 @@ void write_billing_classes () { struct collection *lp; struct class *cp; - struct hash_bucket *bp; - int i; for (lp = collections; lp; lp = lp -> next) { for (cp = lp -> classes; cp; cp = cp -> nic) { @@ -849,7 +838,6 @@ int write_billing_class (class) struct class *class; { int errors = 0; - int i; if (lease_file_is_corrupt) if (!new_lease_file ()) diff --git a/server/ddns.c b/server/ddns.c index 24604b0f..d4a8fa04 100644 --- a/server/ddns.c +++ b/server/ddns.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: ddns.c,v 1.28 2007/05/17 18:27:11 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include "dst/md5.h" #include "minires/minires.h" @@ -230,7 +225,6 @@ ddns_updates(struct packet *packet, struct lease *lease, struct lease *old, struct data_string ddns_dhcid; struct binding_scope **scope; struct iaddr addr; - unsigned len; struct data_string d1; struct option_cache *oc; int s1, s2; @@ -795,7 +789,6 @@ ddns_removals(struct lease *lease, struct iaaddr *lease6) struct data_string ddns_rev_name; struct data_string ddns_dhcid; isc_result_t rcode; - struct binding *binding; struct binding_scope **scope; struct iaddr addr; int result = 0; diff --git a/server/dhcp.c b/server/dhcp.c index 9b1fac78..a27000b9 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: dhcp.c,v 1.220 2007/05/21 22:09:07 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <errno.h> #include <limits.h> @@ -267,7 +262,7 @@ void dhcpdiscover (packet, ms_nulltp) if (lease && lease -> client_hostname) { if ((strlen (lease -> client_hostname) <= 64) && - db_printable (lease -> client_hostname)) + db_printable((unsigned char *)lease->client_hostname)) s = lease -> client_hostname; else s = "Hostname Unsuitable for Printing"; @@ -393,7 +388,6 @@ void dhcprequest (packet, ms_nulltp, ip_lease) int ours = 0; struct option_cache *oc; struct data_string data; - int status; char msgbuf [1024]; /* XXX */ const char *s; char smbuf [19]; @@ -432,7 +426,7 @@ void dhcprequest (packet, ms_nulltp, ip_lease) if (lease && lease -> client_hostname) { if ((strlen (lease -> client_hostname) <= 64) && - db_printable (lease -> client_hostname)) + db_printable((unsigned char *)lease->client_hostname)) s = lease -> client_hostname; else s = "Hostname Unsuitable for Printing"; @@ -735,7 +729,7 @@ void dhcprelease (packet, ms_nulltp) if (lease && lease -> client_hostname) { if ((strlen (lease -> client_hostname) <= 64) && - db_printable (lease -> client_hostname)) + db_printable((unsigned char *)lease->client_hostname)) s = lease -> client_hostname; else s = "Hostname Unsuitable for Printing"; @@ -831,7 +825,7 @@ void dhcpdecline (packet, ms_nulltp) if (lease && lease -> client_hostname) { if ((strlen (lease -> client_hostname) <= 64) && - db_printable (lease -> client_hostname)) + db_printable((unsigned char *)lease->client_hostname)) s = lease -> client_hostname; else s = "Hostname Unsuitable for Printing"; @@ -929,14 +923,13 @@ void dhcpinform (packet, ms_nulltp) char msgbuf [1024]; struct data_string d1, prl; struct option_cache *oc; - struct expression *expr; struct option_state *options = (struct option_state *)0; struct dhcp_packet raw; struct packet outgoing; unsigned char dhcpack = DHCPACK; struct subnet *subnet = (struct subnet *)0; struct iaddr cip, gip; - unsigned i, j; + unsigned i; int nulltp; struct sockaddr_in to; struct in_addr from; @@ -1280,9 +1273,7 @@ void nak_lease (packet, cip) struct packet outgoing; struct hardware hto; unsigned i; - struct data_string data; struct option_state *options = (struct option_state *)0; - struct expression *expr; struct option_cache *oc = (struct option_cache *)0; option_state_allocate (&options, MDL); @@ -1456,17 +1447,13 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) TIME max_lease_time; TIME default_lease_time; struct option_cache *oc; - struct expression *expr; - int status; isc_result_t result; - int did_ping = 0; TIME ping_timeout; TIME lease_cltt; struct in_addr from; unsigned i, j; - int s1, s2; - int val; + int s1; int ignorep; /* If we're already acking this lease, don't do it again. */ @@ -2776,12 +2763,9 @@ void dhcp_reply (lease) struct in_addr from; struct hardware hto; int result; - int i; struct lease_state *state = lease -> state; int nulltp, bootpp, unicastp = 1; - struct option_tag *ot, *not; struct data_string d1; - struct option_cache *oc; const char *s; if (!state) @@ -2858,7 +2842,7 @@ void dhcp_reply (lease) if (lease -> client_hostname) { if ((strlen (lease -> client_hostname) <= 64) && - db_printable (lease -> client_hostname)) + db_printable((unsigned char *)lease->client_hostname)) s = lease -> client_hostname; else s = "Hostname Unsuitable for Printing"; @@ -3001,7 +2985,6 @@ int find_lease (struct lease **lp, struct data_string d1; int have_client_identifier = 0; struct data_string client_identifier; - int status; struct hardware h; /* Quick check to see if the peer has leases. */ @@ -3964,7 +3947,7 @@ get_server_source_address(struct in_addr *from, if (option_cache_allocate(&oc, MDL)) { a = &packet->interface->addresses[0]; if (make_const_data(&oc->expression, - (char *)a, sizeof(*a), + (unsigned char *)a, sizeof(*a), 0, 0, MDL)) { option_code_hash_lookup(&oc->option, dhcp_universe.code_hash, diff --git a/server/dhcpd.c b/server/dhcpd.c index c4040c28..336aff90 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -32,12 +32,7 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char ocopyright[] = -"$Id: dhcpd.c,v 1.129 2007/07/03 10:34:18 shane Exp $ Copyright 2004-2007 Internet Systems Consortium."; -#endif - - static char copyright[] = +static char copyright[] = "Copyright 2004-2007 Internet Systems Consortium."; static char arr [] = "All rights reserved."; static char message [] = "Internet Systems Consortium DHCP Server"; @@ -48,6 +43,8 @@ static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/"; #include <syslog.h> #include <errno.h> #include <limits.h> +#include <sys/types.h> +#include <signal.h> static void usage(void); @@ -201,7 +198,7 @@ main(int argc, char **argv) { int fd; int i, status; struct servent *ent; - unsigned char *s; + char *s; int cftest = 0; int lftest = 0; #ifndef DEBUG @@ -217,9 +214,6 @@ main(int argc, char **argv) { struct interface_info *ip; struct parse *parse; int lose; - omapi_object_t *auth; - struct tsig_key *key; - omapi_typed_data_t *td; int no_dhcpd_conf = 0; int no_dhcpd_db = 0; int no_dhcpd_pid = 0; @@ -265,7 +259,7 @@ main(int argc, char **argv) { if (++i == argc) usage (); for (s = argv [i]; *s; s++) - if (!isdigit (*s)) + if (!isdigit ((unsigned char)*s)) log_fatal ("%s: not a valid UDP port", argv [i]); status = atoi (argv [i]); @@ -1072,7 +1066,6 @@ int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia) necessary. */ if (!ia) { const char *fnn = "fallback-net"; - char *s; status = shared_network_allocate (&ip -> shared_network, MDL); if (status != ISC_R_SUCCESS) log_fatal ("No memory for shared subnet: %s", diff --git a/server/dhcpv6.c b/server/dhcpv6.c index f6ce12f0..4ae4014a 100644 --- a/server/dhcpv6.c +++ b/server/dhcpv6.c @@ -641,7 +641,7 @@ set_status_code(u_int16_t status_code, const char *status_message, memcpy(d.buffer->data + sizeof(status_code), status_message, d.len - sizeof(status_code)); if (!save_option_buffer(&dhcpv6_universe, opt_state, - d.buffer, (char *)d.data, d.len, + d.buffer, (unsigned char *)d.data, d.len, D6O_STATUS_CODE, 0)) { log_error("set_status_code: error saving status code."); ret_val = 0; @@ -664,7 +664,7 @@ start_reply(struct packet *packet, struct dhcpv6_packet *reply) { struct option_cache *oc; struct data_string server_oro; - char *server_id_data; + const unsigned char *server_id_data; int server_id_len; reply->msg_type = DHCPV6_REPLY; @@ -701,15 +701,15 @@ start_reply(struct packet *packet, oc = lookup_option(&dhcpv6_universe, *opt_state, D6O_SERVERID); if (oc == NULL) { if (server_id == NULL) { - server_id_data = (char *)server_duid.data; + server_id_data = server_duid.data; server_id_len = server_duid.len; } else { - server_id_data = (char *)server_id->data; + server_id_data = server_id->data; server_id_len = server_id->len; } if (!save_option_buffer(&dhcpv6_universe, *opt_state, - NULL, server_id_data, server_id_len, - D6O_SERVERID, 0)) { + NULL, (unsigned char *)server_id_data, + server_id_len, D6O_SERVERID, 0)) { log_error("start_reply: " "error saving server identifier."); return 0; @@ -739,7 +739,8 @@ start_reply(struct packet *packet, D6O_RECONF_ACCEPT); if (oc != NULL) { if (!save_option_buffer(&dhcpv6_universe, *opt_state, - NULL, "", 0, D6O_RECONF_ACCEPT, 0)) { + NULL, (unsigned char *)"", 0, + D6O_RECONF_ACCEPT, 0)) { log_error("start_reply: " "error saving RECONF_ACCEPT option."); option_state_dereference(opt_state, MDL); @@ -752,7 +753,8 @@ start_reply(struct packet *packet, */ build_server_oro(&server_oro, *opt_state, MDL); if (!save_option_buffer(&dhcpv6_universe, *opt_state, - server_oro.buffer, (char *)server_oro.data, + server_oro.buffer, + (unsigned char *)server_oro.data, server_oro.len, D6O_ORO, 0)) { log_error("start_reply: error saving server ORO."); data_string_forget(&server_oro, MDL); @@ -778,7 +780,6 @@ try_client_v6_address(struct iaaddr **addr, const struct data_string *requested_addr) { struct in6_addr tmp_addr; isc_result_t result; - struct iaddrmatch match; if (requested_addr->len < sizeof(tmp_addr)) { return ISC_R_INVALIDARG; @@ -832,7 +833,7 @@ pick_v6_address(struct iaaddr **addr, struct ipv6_pool *p; int i; int start_pool; - int attempts; + unsigned int attempts; /* * First, find the link address where the packet from the client @@ -966,7 +967,6 @@ lease_to_client(struct data_string *reply_ret, struct host_decl *packet_host; int matched_packet_host; struct option_cache *ia; - int rapid_commit; char reply_data[65536]; struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data; int reply_ofs = (int)((char *)reply->options - (char *)reply); @@ -1053,7 +1053,8 @@ lease_to_client(struct data_string *reply_ret, packet->options, D6O_RAPID_COMMIT); if (oc != NULL) { if (!save_option_buffer(&dhcpv6_universe, - opt_state, NULL, "", 0, + opt_state, NULL, + (unsigned char *)"", 0, D6O_RAPID_COMMIT, 0)) { log_error("start_reply: error saving " "RAPID_COMMIT option."); @@ -1118,7 +1119,7 @@ lease_to_client(struct data_string *reply_ret, */ iaid = getULong(cli_enc_opt_data.data); ia_na = NULL; - if (ia_na_allocate(&ia_na, iaid, client_id->data, + if (ia_na_allocate(&ia_na, iaid, (char *)client_id->data, client_id->len, MDL) != ISC_R_SUCCESS) { log_fatal("lease_to_client: no memory for ia_na."); } @@ -1271,7 +1272,8 @@ lease_to_client(struct data_string *reply_ret, */ existing_ia_na = NULL; if (ia_na_hash_lookup(&existing_ia_na, ia_active, - (char *)ia_na->iaid_duid.data, + (unsigned char *) + ia_na->iaid_duid.data, ia_na->iaid_duid.len, MDL) == 0) { existing_ia_na = NULL; } @@ -1505,8 +1507,6 @@ lease_to_client(struct data_string *reply_ret, } if (fixed_addr.len == 16) { - struct iaaddr *store_iaaddr; - /* * Store the address. * @@ -1544,7 +1544,7 @@ lease_to_client(struct data_string *reply_ret, * it up later. */ if (host != NULL) { - change_host_uid(host, client_id->data, + change_host_uid(host, (char *)client_id->data, client_id->len); } /* @@ -1558,10 +1558,11 @@ lease_to_client(struct data_string *reply_ret, struct data_string *d = &ia_na->iaid_duid; old_ia_na = NULL; if (ia_na_hash_lookup(&old_ia_na, ia_active, - (char *)d->data, + (unsigned char *)d->data, d->len, MDL)) { ia_na_hash_delete(ia_active, - (char *)d->data, + (unsigned char *) + d->data, d->len, MDL); ia_na_dereference(&old_ia_na, MDL); } @@ -1581,7 +1582,8 @@ lease_to_client(struct data_string *reply_ret, "memory adding IAADDR"); } ia_na_hash_add(ia_active, - (char *)ia_na->iaid_duid.data, + (unsigned char *) + ia_na->iaid_duid.data, ia_na->iaid_duid.len, ia_na, MDL); write_ia_na(ia_na); @@ -1717,14 +1719,14 @@ lease_to_client(struct data_string *reply_ret, * into our reply packet. Defined in RFC 3315, section 22.4. */ /* option number */ - putShort(reply_data+reply_ofs, D6O_IA_NA); + putShort((unsigned char *)reply_data+reply_ofs, D6O_IA_NA); /* option length */ - putUShort(reply_data+reply_ofs+2, len + 12); + putUShort((unsigned char *)reply_data+reply_ofs+2, len + 12); /* IA_NA, copied from the client */ memcpy(reply_data+reply_ofs+4, cli_enc_opt_data.data, 4); /* T1 and T2, set previously */ - putULong(reply_data+reply_ofs+8, t1); - putULong(reply_data+reply_ofs+12, t2); + putULong((unsigned char *)reply_data+reply_ofs+8, t1); + putULong((unsigned char *)reply_data+reply_ofs+12, t2); /* * Get ready for next IA_NA. @@ -1801,7 +1803,6 @@ exit: static void dhcpv6_solicit(struct data_string *reply_ret, struct packet *packet) { struct data_string client_id; - struct option_cache *oc; /* * Validate our input. @@ -2151,14 +2152,14 @@ ia_na_nomatch_decline(const struct data_string *client_id, * section 22.4. */ /* option number */ - putUShort(reply_data+(*reply_ofs), D6O_IA_NA); + putUShort((unsigned char *)reply_data+(*reply_ofs), D6O_IA_NA); /* option length */ - putUShort(reply_data+(*reply_ofs)+2, len + 12); + putUShort((unsigned char *)reply_data+(*reply_ofs)+2, len + 12); /* IA_NA, copied from the client */ memcpy(reply_data+(*reply_ofs)+4, ia_na_id, 4); /* t1 and t2, odd that we need them, but here it is */ - putULong(reply_data+(*reply_ofs)+8, 0); - putULong(reply_data+(*reply_ofs)+12, 0); + putULong((unsigned char *)reply_data+(*reply_ofs)+8, 0); + putULong((unsigned char *)reply_data+(*reply_ofs)+12, 0); /* * Get ready for next IA_NA. @@ -2186,8 +2187,6 @@ iterate_over_ia_na(struct data_string *reply_ret, struct option_state *cli_enc_opt_state; struct host_decl *host; struct option_state *host_opt_state; - char tmp_addr[INET6_ADDRSTRLEN]; - int len; struct data_string iaaddr; struct data_string fixed_addr; int iaaddr_is_found; @@ -2255,8 +2254,8 @@ iterate_over_ia_na(struct data_string *reply_ret, */ oc = lookup_option(&dhcpv6_universe, opt_state, D6O_SERVERID); if (oc == NULL) { - if (!save_option_buffer(&dhcpv6_universe, opt_state, - NULL, (char *)server_duid.data, + if (!save_option_buffer(&dhcpv6_universe, opt_state, NULL, + (unsigned char *)server_duid.data, server_duid.len, D6O_SERVERID, 0)) { log_error("iterate_over_ia_na: " "error saving server identifier."); @@ -2369,7 +2368,8 @@ iterate_over_ia_na(struct data_string *reply_ret, /* * Find existing IA_NA. */ - if (ia_na_make_key(&key, iaid, client_id->data, + if (ia_na_make_key(&key, iaid, + (char *)client_id->data, client_id->len, MDL) != ISC_R_SUCCESS) { log_fatal("iterate_over_ia_na: no memory for " @@ -2378,7 +2378,8 @@ iterate_over_ia_na(struct data_string *reply_ret, existing_ia_na = NULL; if (ia_na_hash_lookup(&existing_ia_na, ia_active, - (char *)key.data, key.len, MDL)) { + (unsigned char *)key.data, + key.len, MDL)) { /* * Make sure this address is in the IA_NA. */ @@ -2557,14 +2558,14 @@ ia_na_nomatch_release(const struct data_string *client_id, * section 22.4. */ /* option number */ - putUShort(reply_data+(*reply_ofs), D6O_IA_NA); + putUShort((unsigned char *)reply_data+(*reply_ofs), D6O_IA_NA); /* option length */ - putUShort(reply_data+(*reply_ofs)+2, len + 12); + putUShort((unsigned char *)reply_data+(*reply_ofs)+2, len + 12); /* IA_NA, copied from the client */ memcpy(reply_data+(*reply_ofs)+4, ia_na_id, 4); /* t1 and t2, odd that we need them, but here it is */ - putULong(reply_data+(*reply_ofs)+8, 0); - putULong(reply_data+(*reply_ofs)+12, 0); + putULong((unsigned char *)reply_data+(*reply_ofs)+8, 0); + putULong((unsigned char *)reply_data+(*reply_ofs)+12, 0); /* * Get ready for next IA_NA. @@ -2699,7 +2700,7 @@ dhcpv6_relay_forw(struct data_string *reply_ret, struct packet *packet) { goto exit; } - if (!packet6_len_okay(enc_opt_data.data, enc_opt_data.len)) { + if (!packet6_len_okay((char *)enc_opt_data.data, enc_opt_data.len)) { log_error("dhcpv6_forw_relay: encapsulated packet too short."); goto exit; } @@ -2921,8 +2922,6 @@ log_packet_in(const struct packet *packet) { u_int32_t tid; char tmp_addr[INET6_ADDRSTRLEN]; const void *addr; - struct option_cache *oc; - struct data_string tmp_ds; memset(&s, 0, sizeof(s)); diff --git a/server/failover.c b/server/failover.c index a494970d..2d305cae 100644 --- a/server/failover.c +++ b/server/failover.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: failover.c,v 1.73 2007/06/01 22:26:01 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -63,7 +58,6 @@ void dhcp_failover_startup () { dhcp_failover_state_t *state; isc_result_t status; - dhcp_failover_listener_t *l; for (state = failover_states; state; state = state -> next) { dhcp_failover_state_transition (state, "startup"); @@ -180,7 +174,6 @@ isc_result_t dhcp_failover_link_initiate (omapi_object_t *h) { isc_result_t status; dhcp_failover_link_t *obj; - omapi_value_t *value = (omapi_value_t *)0; dhcp_failover_state_t *state; omapi_object_t *o; int i; @@ -282,8 +275,6 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h, isc_result_t status; dhcp_failover_link_t *link; omapi_object_t *c; - u_int16_t nlen; - u_int32_t vlen; dhcp_failover_state_t *s, *state = (dhcp_failover_state_t *)0; if (h -> type != dhcp_type_failover_link) { @@ -597,7 +588,6 @@ static isc_result_t do_a_failover_option (c, link) unsigned op_size; unsigned op_count; int i; - isc_result_t status; if (link -> imsg_count + 2 > link -> imsg_len) { log_error ("FAILOVER: message overflow at option code."); @@ -1127,8 +1117,6 @@ isc_result_t dhcp_failover_listener_stuff (omapi_object_t *c, omapi_object_t *id, omapi_object_t *p) { - int i; - if (p -> type != dhcp_type_failover_listener) return ISC_R_INVALIDARG; @@ -1188,11 +1176,8 @@ isc_result_t dhcp_failover_state_signal (omapi_object_t *o, const char *name, va_list ap) { isc_result_t status; - omapi_connection_object_t *c; - omapi_protocol_object_t *obj; dhcp_failover_state_t *state; dhcp_failover_link_t *link; - char *peer_name; if (!o || o -> type != dhcp_type_failover_state) return ISC_R_INVALIDARG; @@ -1843,7 +1828,6 @@ isc_result_t dhcp_failover_peer_state_changed (dhcp_failover_state_t *state, enum failover_state previous_state = state -> partner.state; enum failover_state new_state; int startupp; - isc_result_t status; new_state = msg -> server_state; startupp = (msg -> server_flags & FTF_SERVER_STARTUP) ? 1 : 0; @@ -2286,7 +2270,6 @@ static int dhcp_failover_pool_dobalance(dhcp_failover_state_t *state) struct lease *next = (struct lease *)0; struct shared_network *s; struct pool *p; - int polarity; binding_state_t peer_lease_state; binding_state_t my_lease_state; struct lease **lq; @@ -2514,7 +2497,6 @@ dhcp_failover_pool_check(struct pool *pool) int dhcp_failover_state_pool_check (dhcp_failover_state_t *state) { - struct lease *lp; struct shared_network *s; struct pool *p; @@ -2843,7 +2825,6 @@ isc_result_t dhcp_failover_state_set_value (omapi_object_t *h, void dhcp_failover_keepalive (void *vs) { - dhcp_failover_state_t *state = vs; } void dhcp_failover_reconnect (void *vs) @@ -2877,7 +2858,6 @@ void dhcp_failover_reconnect (void *vs) void dhcp_failover_startup_timeout (void *vs) { dhcp_failover_state_t *state = vs; - isc_result_t status; #if defined (DEBUG_FAILOVER_TIMING) log_info ("dhcp_failover_startup_timeout"); @@ -2889,7 +2869,6 @@ void dhcp_failover_startup_timeout (void *vs) void dhcp_failover_link_startup_timeout (void *vl) { dhcp_failover_link_t *link = vl; - isc_result_t status; omapi_object_t *p; for (p = (omapi_object_t *)link; p -> inner; p = p -> inner) @@ -3368,7 +3347,6 @@ isc_result_t dhcp_failover_state_remove (omapi_object_t *sp, int dhcp_failover_state_match (dhcp_failover_state_t *state, u_int8_t *addr, unsigned addrlen) { - struct option_cache *oc; struct data_string ds; int i; @@ -3948,7 +3926,6 @@ isc_result_t dhcp_failover_put_message (dhcp_failover_link_t *link, omapi_object_t *connection, int msg_type, u_int32_t xid, ...) { - unsigned count = 0; unsigned size = 0; int bad_option = 0; int opix = 0; @@ -4061,7 +4038,6 @@ void dhcp_failover_timeout (void *vstate) { dhcp_failover_state_t *state = vstate; dhcp_failover_link_t *link; - isc_result_t status; #if defined (DEBUG_FAILOVER_TIMING) log_info ("dhcp_failover_timeout"); @@ -4181,7 +4157,6 @@ isc_result_t dhcp_failover_send_connect (omapi_object_t *l) dhcp_failover_link_t *link; dhcp_failover_state_t *state; isc_result_t status; - char hba [32]; #if defined (DEBUG_FAILOVER_MESSAGES) char obuf [64]; unsigned obufix = 0; @@ -5188,7 +5163,7 @@ isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *state, { struct shared_network *s; struct pool *p; - struct lease *l, *n; + struct lease *l; int i; #define FREE_LEASES 0 #define ACTIVE_LEASES 1 diff --git a/server/mdb.c b/server/mdb.c index 8bc73113..f18dc8d6 100644 --- a/server/mdb.c +++ b/server/mdb.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: mdb.c,v 1.92 2007/06/08 18:56:30 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include "omapip/hash.h" @@ -183,8 +178,6 @@ hash_print_hosts(struct hash_table *h) { void change_host_uid(struct host_decl *host, const char *uid, int len) { - struct host_decl *old_entry; - /* XXX: should consolidate this type of code throughout */ if (host_uid_hash == NULL) { if (!host_new_hash(&host_uid_hash, HOST_HASH_SIZE, MDL)) { @@ -467,7 +460,6 @@ isc_result_t delete_host (hd, commit) struct host_decl *hp = (struct host_decl *)0; struct host_decl *np = (struct host_decl *)0; struct host_decl *foo; - struct executable_statement *esp; int hw_head = 0, uid_head = 1; /* Don't need to do it twice. */ @@ -607,7 +599,6 @@ int find_hosts_by_haddr (struct host_decl **hp, int htype, const unsigned char *haddr, unsigned hlen, const char *file, int line) { - struct host_decl *foo; struct hardware h; h.hlen = hlen + 1; @@ -674,7 +665,6 @@ int find_host_for_network (struct subnet **sp, struct host_decl **host, struct iaddr *addr, struct shared_network *share) { int i; - struct subnet *subnet; struct iaddr ip_address; struct host_decl *hp; struct data_string fixed_addr; @@ -724,13 +714,15 @@ void new_address_range (cfile, low, high, subnet, pool, lpchain) struct pool *pool; struct lease **lpchain; { - struct lease *address_range, *lp, *plp; + struct lease *address_range; struct iaddr net; unsigned min, max, i; char lowbuf [16], highbuf [16], netbuf [16]; struct shared_network *share = subnet -> shared_network; - isc_result_t status; struct lease *lt = (struct lease *)0; +#if !defined(COMPACT_LEASES) + isc_result_t status; +#endif /* All subnets should have attached shared network structures. */ if (!share) { @@ -1018,7 +1010,6 @@ void enter_lease (lease) struct lease *lease; { struct lease *comp = (struct lease *)0; - isc_result_t status; if (find_lease_by_ip_addr (&comp, lease -> ip_addr, MDL)) { if (!comp -> pool) { @@ -1065,7 +1056,6 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate) int pimmediate; { struct lease *lp, **lq, *prev; - TIME lp_next_state; #if defined (FAILOVER_PROTOCOL) int do_pool_check = 0; @@ -1757,7 +1747,6 @@ void pool_timer (vpool) void *vpool; { struct pool *pool; - struct lease *lt = (struct lease *)0; struct lease *next = (struct lease *)0; struct lease *lease = (struct lease *)0; #define FREE_LEASES 0 @@ -2486,7 +2475,6 @@ void expire_all_pools () { struct shared_network *s; struct pool *p; - struct hash_bucket *hb; int i; struct lease *l; struct lease **lptr[RESERVED_LEASES+1]; diff --git a/server/mdb6.c b/server/mdb6.c index 7359a1b4..3bef215a 100644 --- a/server/mdb6.c +++ b/server/mdb6.c @@ -335,7 +335,7 @@ ia_na_remove_iaaddr(struct ia_na *ia_na, struct iaaddr *iaaddr, */ void ia_na_remove_all_iaaddr(struct ia_na *ia_na, const char *file, int line) { - int i, j; + int i; for (i=0; i<ia_na->num_iaaddr; i++) { iaaddr_dereference(&(ia_na->iaaddr[i]), file, line); @@ -952,7 +952,7 @@ cleanup_old_expired(struct ipv6_pool *pool) { iaaddr_dereference(&tmp, MDL); if (ia_na->num_iaaddr <= 0) { ia_na_hash_delete(ia_active, - (char *)ia_na->iaid_duid.data, + (unsigned char*)ia_na->iaid_duid.data, ia_na->iaid_duid.len, MDL); } ia_na_dereference(&ia_na, MDL); @@ -1206,6 +1206,7 @@ decline_leases(struct ia_na *ia_na) { return change_leases(ia_na, decline_lease6); } +#ifdef DHCPv6 /* * Helper function to output leases. */ @@ -1223,7 +1224,6 @@ write_ia_na_leases(const void *name, unsigned len, void *value) { return ISC_R_SUCCESS; } -#ifdef DHCPv6 /* * Write all DHCPv6 information. */ diff --git a/server/omapi.c b/server/omapi.c index fc124e35..77ade035 100644 --- a/server/omapi.c +++ b/server/omapi.c @@ -39,11 +39,6 @@ useful, you have Brian and BCtel to thank. Any limitations in the code are a result of mistakes on my part. -- Ted Lemon */ -#ifndef lint -static char copyright[] = -"$Id: omapi.c,v 1.61 2007/05/19 19:16:27 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> @@ -212,7 +207,6 @@ isc_result_t dhcp_lease_set_value (omapi_object_t *h, { struct lease *lease; isc_result_t status; - int foo; if (h -> type != dhcp_type_lease) return ISC_R_INVALIDARG; @@ -399,8 +393,6 @@ isc_result_t dhcp_lease_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_lease_destroy (omapi_object_t *h, const char *file, int line) { struct lease *lease; - isc_result_t status; - u_int8_t flagbuf; if (h -> type != dhcp_type_lease) return ISC_R_INVALIDARG; @@ -477,7 +469,6 @@ isc_result_t dhcp_lease_signal_handler (omapi_object_t *h, { struct lease *lease; isc_result_t status; - int updatep = 0; if (h -> type != dhcp_type_lease) return ISC_R_INVALIDARG; @@ -911,9 +902,8 @@ isc_result_t dhcp_host_set_value (omapi_object_t *h, omapi_data_string_t *name, omapi_typed_data_t *value) { - struct host_decl *host, *hp; + struct host_decl *host; isc_result_t status; - int foo; if (h -> type != dhcp_type_host) return ISC_R_INVALIDARG; @@ -1172,7 +1162,6 @@ isc_result_t dhcp_host_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *file, int line) { struct host_decl *host; - isc_result_t status; if (h -> type != dhcp_type_host) return ISC_R_INVALIDARG; @@ -1593,7 +1582,6 @@ isc_result_t dhcp_pool_set_value (omapi_object_t *h, { struct pool *pool; isc_result_t status; - int foo; if (h -> type != dhcp_type_pool) return ISC_R_INVALIDARG; @@ -1639,8 +1627,10 @@ isc_result_t dhcp_pool_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line) { struct pool *pool; - isc_result_t status; +#if defined (DEBUG_MEMORY_LEAKAGE) || \ + defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) struct permit *pc, *pn; +#endif if (h -> type != dhcp_type_pool) return ISC_R_INVALIDARG; @@ -1737,10 +1727,6 @@ isc_result_t dhcp_pool_stuff_values (omapi_object_t *c, isc_result_t dhcp_pool_lookup (omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref) { - omapi_value_t *tv = (omapi_value_t *)0; - isc_result_t status; - struct pool *pool; - /* Can't look up pools yet. */ /* If we get to here without finding a pool, no valid key was @@ -1914,11 +1900,6 @@ isc_result_t dhcp_class_set_value (omapi_object_t *h, omapi_data_string_t *name, omapi_typed_data_t *value) { - struct class *class; - struct class *superclass = 0; - isc_result_t status; - int foo; - if (h -> type != dhcp_type_class) return ISC_R_INVALIDARG; @@ -1953,8 +1934,6 @@ isc_result_t dhcp_class_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line) { struct class *class; - isc_result_t status; - int i; if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass) return ISC_R_INVALIDARG; @@ -1971,6 +1950,7 @@ isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line) class -> name = (char *)0; } if (class -> billed_leases) { + int i; for (i = 0; i < class -> lease_limit; i++) { if (class -> billed_leases [i]) { lease_dereference (&class -> billed_leases [i], @@ -2231,11 +2211,6 @@ isc_result_t dhcp_subclass_set_value (omapi_object_t *h, omapi_data_string_t *name, omapi_typed_data_t *value) { - struct class *subclass = 0; - struct class *superclass = 0; - isc_result_t status; - int foo; - if (h -> type != dhcp_type_subclass) return ISC_R_INVALIDARG; diff --git a/server/salloc.c b/server/salloc.c index efaa7f0e..bc7bda39 100644 --- a/server/salloc.c +++ b/server/salloc.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: salloc.c,v 1.6 2006/02/24 23:16:32 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <omapip/omapip_p.h> diff --git a/server/stables.c b/server/stables.c index 8e10b855..4e67f8e1 100644 --- a/server/stables.c +++ b/server/stables.c @@ -32,11 +32,6 @@ * ``http://www.nominum.com''. */ -#ifndef lint -static char copyright[] = -"$Id: stables.c,v 1.39 2007/05/19 22:03:51 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; -#endif /* not lint */ - #include "dhcpd.h" #include <syslog.h> |