]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Fix a number of warnings (and a few real bugs) found by enabling
authorShane Kerr <shane@isc.org>
Wed, 22 Aug 2007 13:41:37 +0000 (13:41 +0000)
committerShane Kerr <shane@isc.org>
Wed, 22 Aug 2007 13:41:37 +0000 (13:41 +0000)
gcc warnings.

See RT ticket #17013 for more.

21 files changed:
client/dhc6.c
client/dhclient.c
common/alloc.c
common/discover.c
common/dns.c
common/options.c
common/socket.c
common/tables.c
common/tree.c
configure
configure.ac
dhcpctl/remote.c
dst/dst_api.c
includes/dhcp6.h
includes/dhcpd.h
includes/minires/minires.h
minires/ns_verify.c
omapip/array.c
omapip/connection.c
omapip/mrtrace.c
server/dhcpv6.c

index 17a696170e57eac4b70003afb5d0c03ce760b195..1b768a9e6a5bdf7a9b5a77f230c0b1d1083e86ea 100644 (file)
@@ -33,11 +33,12 @@ struct option *iaaddr_option = NULL;
 struct option *elapsed_option = NULL;
 
 static struct dhc6_lease *dhc6_dup_lease(struct dhc6_lease *lease,
-                                        char *file, int line);
-static struct dhc6_ia *dhc6_dup_ia(struct dhc6_ia *ia, char *file, int line);
+                                        const char *file, int line);
+static struct dhc6_ia *dhc6_dup_ia(struct dhc6_ia *ia, 
+                                  const char *file, int line);
 static struct dhc6_addr *dhc6_dup_addr(struct dhc6_addr *addr,
-                                      char *file, int line);
-static void dhc6_ia_destroy(struct dhc6_ia *ia, char *file, int line);
+                                      const char *file, int line);
+static void dhc6_ia_destroy(struct dhc6_ia *ia, const char *file, int line);
 static isc_result_t dhc6_parse_ia_na(struct dhc6_ia **pia,
                                     struct packet *packet,
                                     struct option_state *options);
@@ -68,7 +69,8 @@ void do_expire(void *input);
 static void make_client6_options(struct client_state *client,
                                 struct option_state **op,
                                 struct dhc6_lease *lease, u_int8_t message);
-static void script_write_params6(struct client_state *client, char *prefix,
+static void script_write_params6(struct client_state *client, 
+                                const char *prefix,
                                 struct option_state *options);
 
 /* The "best" default DUID, since we cannot predict any information
@@ -85,7 +87,7 @@ static void script_write_params6(struct client_state *client, char *prefix,
  * address this "one daemon model."
  */
 void
-form_duid(struct data_string *duid, char *file, int line)
+form_duid(struct data_string *duid, const char *file, int line)
 {
        struct interface_info *ip;
        int len;
@@ -350,7 +352,7 @@ valid_reply(struct packet *packet, struct client_state *client)
 /* Create a complete copy of a DHCPv6 lease structure.
  */
 static struct dhc6_lease *
-dhc6_dup_lease(struct dhc6_lease *lease, char *file, int line)
+dhc6_dup_lease(struct dhc6_lease *lease, const char *file, int line)
 {
        struct dhc6_lease *copy;
        struct dhc6_ia **insert_ia, *ia;
@@ -387,7 +389,7 @@ dhc6_dup_lease(struct dhc6_lease *lease, char *file, int line)
 /* Duplicate an IA structure.
  */
 static struct dhc6_ia *
-dhc6_dup_ia(struct dhc6_ia *ia, char *file, int line)
+dhc6_dup_ia(struct dhc6_ia *ia, const char *file, int line)
 {
        struct dhc6_ia *copy;
        struct dhc6_addr **insert_addr, *addr;
@@ -422,7 +424,7 @@ dhc6_dup_ia(struct dhc6_ia *ia, char *file, int line)
 /* Duplicate an IAADDR structure.
  */
 static struct dhc6_addr *
-dhc6_dup_addr(struct dhc6_addr *addr, char *file, int line)
+dhc6_dup_addr(struct dhc6_addr *addr, const char *file, int line)
 {
        struct dhc6_addr *copy;
 
@@ -719,7 +721,7 @@ dhc6_parse_addrs(struct dhc6_addr **paddr, struct packet *packet,
 
 /* Clean up a lease object and deallocate all its parts. */
 void
-dhc6_lease_destroy(struct dhc6_lease *lease, char *file, int line)
+dhc6_lease_destroy(struct dhc6_lease *lease, const char *file, int line)
 {
        struct dhc6_ia *ia, *nia;
 
@@ -744,7 +746,7 @@ dhc6_lease_destroy(struct dhc6_lease *lease, char *file, int line)
 
 /* Traverse the addresses list, and destroy their contents. */
 static void
-dhc6_ia_destroy(struct dhc6_ia *ia, char *file, int line)
+dhc6_ia_destroy(struct dhc6_ia *ia, const char *file, int line)
 {
        struct dhc6_addr *addr, *naddr;
 
@@ -992,7 +994,7 @@ do_init6(void *input)
 
        if ((client->active_lease != NULL) &&
            ((old_ia = find_ia(client->active_lease->bindings,
-                              (char *)ia.data)) != NULL)) {
+                              (char *)ia.buffer->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 ;
@@ -1204,7 +1206,6 @@ do_release6(void *input)
        struct client_state *client;
        struct data_string ds;
        struct option_cache *oc;
-        struct dhc6_lease *lease;
        int send_ret;
 
        client = input;
@@ -1221,10 +1222,11 @@ do_release6(void *input)
         * Check whether the server has sent a unicast option; if so, we can
         * use the address it specified.
         */
-       oc = lookup_option(&dhcpv6_universe, lease->options, D6O_UNICAST);
+       oc = lookup_option(&dhcpv6_universe, 
+                          client->active_lease->options, D6O_UNICAST);
        if (oc && evaluate_option_cache(&ds, NULL, NULL, NULL,
-                                        lease->options, NULL, &global_scope,
-                                       oc, MDL)) {
+                                        client->active_lease->options, 
+                                       NULL, &global_scope, oc, MDL)) {
                if (ds.len < 16) {
                        log_error("Invalid unicast option length %d.", ds.len);
                } else {
@@ -1285,9 +1287,9 @@ do_release6(void *input)
  * to info level.
  */
 static void
-status_log(int code, char *scope, const char *additional, int len)
+status_log(int code, const char *scope, const char *additional, int len)
 {
-       char *msg = NULL;
+       const char *msg = NULL;
 
        switch(code) {
              case STATUS_Success:
@@ -1320,7 +1322,8 @@ 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, (unsigned char *)additional, 50));
+                        print_hex_1(len, 
+                                    (const unsigned char *)additional, 50));
        else
                log_info("%s status code %s.", scope, msg);
 }
@@ -1373,7 +1376,7 @@ dhc6_get_status_code(struct option_state *options, unsigned *code,
  */
 static isc_result_t
 dhc6_check_status(isc_result_t rval, struct option_state *options,
-                 char *scope, unsigned *code)
+                 const char *scope, unsigned *code)
 {
        struct data_string msg;
        isc_result_t status;
@@ -2353,7 +2356,7 @@ reply_handler(struct packet *packet, struct client_state *client)
  * over-written by the later versions.
  */
 static void
-dhc6_marshall_values(char *prefix, struct client_state *client,
+dhc6_marshall_values(const char *prefix, struct client_state *client,
                     struct dhc6_lease *lease, struct dhc6_ia *ia,
                     struct dhc6_addr *addr)
 {
@@ -2656,7 +2659,7 @@ start_bound(struct client_state *client)
        struct dhc6_ia *ia, *oldia;
        struct dhc6_addr *addr, *oldaddr;
        struct dhc6_lease *lease, *old;
-       char *reason;
+       const char *reason;
        TIME dns_update_offset = 1;
 
        lease = client->active_lease;
@@ -3089,7 +3092,6 @@ do_expire(void *input)
 void
 unconfigure6(struct client_state *client, const char *reason)
 {
-       struct dhc6_lease *lease;
        struct dhc6_ia *ia;
        struct dhc6_addr *addr;
 
@@ -3099,7 +3101,8 @@ unconfigure6(struct client_state *client, const char *reason)
        for (ia = client->active_lease->bindings ; ia != NULL ; ia = ia->next) {
                for (addr = ia->addrs ; addr != NULL ; addr = addr->next) {
                        script_init(client, reason, NULL);
-                       dhc6_marshall_values("old_", client, lease, ia, addr);
+                       dhc6_marshall_values("old_", client, 
+                                            client->active_lease, ia, addr);
                        script_go(client);
                 
                        if (client->config->do_forward_update)
@@ -3200,7 +3203,7 @@ make_client6_options(struct client_state *client, struct option_state **op,
  * generic lines.
  */
 static void
-script_write_params6(struct client_state *client, char *prefix,
+script_write_params6(struct client_state *client, const char *prefix,
                     struct option_state *options)
 {
        struct envadd_state es;
index 790738c0e7add4de4fb32946942eb2ac9080f46d..3f6679e297116523a17f14b8cfed779e42966a79 100644 (file)
@@ -2416,14 +2416,14 @@ void write_lease_option (struct option_cache *oc,
 /* Write an option cache to the lease store. */
 static void
 write_options(struct client_state *client, struct option_state *options,
-             char *preamble)
+             const char *preamble)
 {
        int i;
 
        for (i = 0; i < options->universe_count; i++) {
                option_space_foreach(NULL, NULL, client, NULL, options,
-                                    &global_scope, universes[i], preamble,
-                                    write_lease_option);
+                                    &global_scope, universes[i], 
+                                    (char *)preamble, write_lease_option);
        }
 }
 
index 9e18c6f63db347d7229814cb50818367412605f6..d825de59e508f24df71db39f709690740785248a 100644 (file)
@@ -411,7 +411,7 @@ void free_pair (foo, file, line)
 {
        foo -> cdr = free_pairs;
        free_pairs = foo;
-       dmalloc_reuse (free_pairs, (char *)0, 0, 0);
+       dmalloc_reuse (free_pairs, __FILE__, __LINE__, 0);
 }
 
 #if defined (DEBUG_MEMORY_LEAKAGE) || \
@@ -485,7 +485,7 @@ void free_expression (expr, file, line)
 {
        expr -> data.not = free_expressions;
        free_expressions = expr;
-       dmalloc_reuse (free_expressions, (char *)0, 0, 0);
+       dmalloc_reuse (free_expressions, __FILE__, __LINE__, 0);
 }
 
 #if defined (DEBUG_MEMORY_LEAKAGE) || \
@@ -1134,7 +1134,7 @@ int packet_dereference (ptr, file, line)
        }
        packet -> raw = (struct dhcp_packet *)free_packets;
        free_packets = packet;
-       dmalloc_reuse (free_packets, (char *)0, 0, 0);
+       dmalloc_reuse (free_packets, __FILE__, __LINE__, 0);
        return 1;
 }
 
index c2488dc7b19635039d5cba8477ca26335041c29d..350dc476867059ee4a64a4bffd6b683f4b152e4a 100644 (file)
@@ -1216,16 +1216,18 @@ discover_interfaces(int state) {
                        continue;
                if (tmp -> rfdesc == -1)
                        continue;
-               if (local_family == AF_INET) {
+#ifdef DHCPv6 
+               if (local_family == AF_INET6) {
                        status = omapi_register_io_object((omapi_object_t *)tmp,
                                                          if_readsocket, 
-                                                         0, got_one, 0, 0);
-#ifdef DHCPv6
+                                                         0, got_one_v6, 0, 0);
                } else {
+#else
+               {
+#endif /* DHCPv6 */
                        status = omapi_register_io_object((omapi_object_t *)tmp,
                                                          if_readsocket, 
-                                                         0, got_one_v6, 0, 0);
-#endif /* DHCPv6 */
+                                                         0, got_one, 0, 0);
                }
                if (status != ISC_R_SUCCESS)
                        log_fatal ("Can't register I/O handle for %s: %s",
index adf3f55e4779c4d809b0f1eae55adf65ba231b95..878caf5beddd8c04b15471e0d6cc1b841ea70450 100644 (file)
@@ -206,7 +206,7 @@ isc_result_t dns_zone_lookup (struct dns_zone **zone, const char *name)
        if (name [len - 1] != '.') {
                tname = dmalloc ((unsigned)len + 2, MDL);
                if (!tname)
-                       return ISC_R_NOMEMORY;;
+                       return ISC_R_NOMEMORY;
                strcpy (tname, name);
                tname [len] = '.';
                tname [len + 1] = 0;
index aa18fa65aae0c0c9d0c06655b492bdcca9023c9f..ef9a32be47060ba028c88e2239e7aa4d4758a5d5 100644 (file)
@@ -2229,7 +2229,7 @@ collect_oro(struct option_cache *oc,
            void *void_oro) {
        struct data_string *oro = (struct data_string *)void_oro;
 
-       putUShort((unsigned char *)(oro->data + oro->len), oc->option->code);
+       putUShort(oro->buffer->data + oro->len, oc->option->code);
        oro->len += 2;
 }
 
@@ -2285,7 +2285,7 @@ build_server_oro(struct data_string *server_oro,
                        while (o != NULL) {
                                if (o->universe == &dhcpv6_universe) {
                                        unsigned char *tmp;
-                                       tmp = (unsigned char *)server_oro->data;
+                                       tmp = server_oro->buffer->data;
                                        putUShort(tmp + server_oro->len,
                                                  o->code);
                                        server_oro->len += 2;
@@ -2635,7 +2635,7 @@ int option_space_encapsulate (result, packet, lease, client_state,
        int status = 0;
 
        universe_hash_lookup(&u, universe_hash, 
-                            (char *)name->data, name->len, MDL);
+                            (const char *)name->data, name->len, MDL);
        if (u == NULL) {
                log_error("option_space_encapsulate: option space %.*s does "
                          "not exist, but is configured.",
@@ -3659,7 +3659,7 @@ do_packet6(struct interface_info *interface, const char *packet,
        msg_type = packet[0];
        if ((msg_type == DHCPV6_RELAY_FORW) || 
            (msg_type == DHCPV6_RELAY_REPL)) {
-               relay = (struct dhcpv6_relay_packet *)packet;
+               relay = (const struct dhcpv6_relay_packet *)packet;
                decoded_packet->dhcpv6_msg_type = relay->msg_type;
 
                /* relay-specific data */
@@ -3678,7 +3678,7 @@ do_packet6(struct interface_info *interface, const char *packet,
                        return;
                }
        } else {
-               msg = (struct dhcpv6_packet *)packet;
+               msg = (const struct dhcpv6_packet *)packet;
                decoded_packet->dhcpv6_msg_type = msg->msg_type;
 
                /* message-specific data */
index ccd8ae082d1819c49905e4d9db13bb74e9490be7..13904a35e8d9b0758525121bfb127a57cd0bc52c 100644 (file)
@@ -120,17 +120,8 @@ if_register_socket(struct interface_info *info, int family, int do_multicast) {
         * address family. 
         */ 
        memset(&name, 0, sizeof(name));
-       if (family == AF_INET) {
-               struct sockaddr_in *addr = (struct sockaddr_in *)&name; 
-               addr->sin_family = AF_INET;
-               addr->sin_port = local_port;
-               memcpy(&addr->sin_addr,
-                      &local_address,
-                      sizeof(addr->sin_addr));
-               name_len = sizeof(*addr);
-               domain = PF_INET;
 #ifdef DHCPv6
-       } else { 
+       if (family == AF_INET6) {
                struct sockaddr_in6 *addr = (struct sockaddr_in6 *)&name; 
                addr->sin6_family = AF_INET6;
                addr->sin6_port = local_port;
@@ -139,7 +130,18 @@ if_register_socket(struct interface_info *info, int family, int do_multicast) {
                       sizeof(addr->sin6_addr));
                name_len = sizeof(*addr);
                domain = PF_INET6;
+       } else { 
+#else 
+       {
 #endif /* DHCPv6 */
+               struct sockaddr_in *addr = (struct sockaddr_in *)&name; 
+               addr->sin_family = AF_INET;
+               addr->sin_port = local_port;
+               memcpy(&addr->sin_addr,
+                      &local_address,
+                      sizeof(addr->sin_addr));
+               name_len = sizeof(*addr);
+               domain = PF_INET;
        }
 
        /* Make a socket... */
index 6d8a5df9b35845de2aa45997dd68e500b9465972..5b9456201efb13f466b57dd86650431deef2e4d8 100644 (file)
@@ -474,7 +474,7 @@ struct enumeration_value dhcpv6_message_values[] = {
 };
 
 /* Some code refers to a different table. */
-char *dhcpv6_type_names[] = {
+const char *dhcpv6_type_names[] = {
        NULL,
        "Solicit",
        "Advertise",
index 68844bef8c980a8caad78c9ef6170322d67826f6..aa5903affcdcd2d7900e77fe33dea047c2361a48 100644 (file)
@@ -1002,7 +1002,7 @@ int evaluate_boolean_expression (result, packet, lease, client_state,
        struct binding *binding;
        struct binding_value *bv, *obv;
 #ifdef HAVE_REGEX_H
-       int reg_st, regflags = REG_EXTENDED | REG_NOSUB;
+       int regflags = REG_EXTENDED | REG_NOSUB;
        regex_t re;
 #endif
 
@@ -1139,7 +1139,15 @@ int evaluate_boolean_expression (result, packet, lease, client_state,
                        data_string_forget(&right, MDL);
 
                regfree(&re);
-               return reg_st;
+
+               /*
+                * If we have bleft and bright then we have a good
+                * syntax, otherwise not.
+                *
+                * XXX: we don't warn on invalid regular expression 
+                *      syntax, should we?
+                */
+               return bleft && bright;
 #else
                /* It shouldn't be possible to configure a regex operator
                 * when there's no support.
index 78e7acf571b5f470808dd7a1ad0da6aef31c4b28..f47602a442cc01befbd07fadb1665b8b199b64aa 100755 (executable)
--- a/configure
+++ b/configure
@@ -2232,6 +2232,12 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
 
 
 
+# We want to turn on warnings if we are using gcc and the user did
+# not specify CFLAGS. The autoconf check for the C compiler sets the
+# CFLAGS if gcc is used, so we will save it before we run that check.
+SAVE_CFLAGS="$CFLAGS"
+
+# Now find our C compiler.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3321,6 +3327,15 @@ else
 fi
 
 
+
+# If we have gcc, and AC_PROG_CC changed the flags, then we know the
+# user did not specify any flags. Add warnings in this case.
+if test "$GCC" = "yes"; then
+       if test "$CFLAGS" != "$SAVE_CFLAGS"; then
+               CFLAGS="$CFLAGS -Wall -Werror -fno-strict-aliasing"
+       fi
+fi
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
@@ -6281,8 +6296,10 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
 #include <sys/types.h>
-        #include <sys/socket.h>
+#include <sys/socket.h>
+
 
 int
 main ()
@@ -6322,8 +6339,10 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
 #include <sys/types.h>
-        #include <sys/socket.h>
+#include <sys/socket.h>
+
 
 int
 main ()
@@ -6384,8 +6403,10 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
 #include <sys/types.h>
-                #include <sys/socket.h>
+#include <sys/socket.h>
+
 
 int
 main ()
@@ -6425,8 +6446,10 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
 #include <sys/types.h>
-                #include <sys/socket.h>
+#include <sys/socket.h>
+
 
 int
 main ()
@@ -6480,6 +6503,7 @@ echo "$as_me: error: Missing msg_control member in
    { (exit 1); exit 1; }; }
 fi
 
+
 fi
 
 
index 0b0fd91f2a580893ea04180c75c8dacd770df1df..706e80f14b4d24cbb460cb40a38e5076fa444f8e 100644 (file)
@@ -4,7 +4,22 @@ AC_INIT([DHCP], [4.0.0a2], [dhcp-users@isc.org])
 # like AUTHORS, COPYING, and such
 AM_INIT_AUTOMAKE([foreign])
 
+# We want to turn on warnings if we are using gcc and the user did 
+# not specify CFLAGS. The autoconf check for the C compiler sets the
+# CFLAGS if gcc is used, so we will save it before we run that check.
+SAVE_CFLAGS="$CFLAGS"
+
+# Now find our C compiler.
 AC_PROG_CC
+
+# If we have gcc, and AC_PROG_CC changed the flags, then we know the
+# user did not specify any flags. Add warnings in this case.
+if test "$GCC" = "yes"; then
+       if test "$CFLAGS" != "$SAVE_CFLAGS"; then
+               CFLAGS="$CFLAGS -Wall -Werror -fno-strict-aliasing"
+       fi
+fi
+
 AC_PROG_RANLIB
 AC_CONFIG_HEADERS([includes/config.h])
 
@@ -183,10 +198,15 @@ AC_CHECK_MEMBER(struct msghdr.msg_control,,
         AC_CHECK_MEMBER(struct msghdr.msg_control,,
                [AC_MSG_ERROR([Missing msg_control member in 
                               msg_control structure.])],
-               [#include <sys/types.h>
-                #include <sys/socket.h>])],
-       [#include <sys/types.h>
-        #include <sys/socket.h>])
+               [
+#include <sys/types.h>
+#include <sys/socket.h>
+               ])
+       ],
+       [
+#include <sys/types.h>
+#include <sys/socket.h>
+       ])
 
 AC_OUTPUT([
   Makefile
index 29af9c724e621537b3d1ab1e0bd99629365598ed..2ada64a1aa4563a208041fce5793380dc0a6346d 100644 (file)
@@ -118,8 +118,8 @@ dhcpctl_status dhcpctl_new_object (dhcpctl_handle *h,
        isc_result_t status;
 
        m = (dhcpctl_remote_object_t *)0;
-       status = omapi_object_allocate ((omapi_object_t **)&m,
-                                       dhcpctl_remote_type, 0, MDL);
+       status = omapi_object_allocate((omapi_object_t **)&m,
+                                      dhcpctl_remote_type, 0, MDL);
        if (status != ISC_R_SUCCESS)
                return status;
 
index be629165314a3e20eba9f46146b35a63e06187ea..65015537c43363924de8faaefa1054ab1aa4cc34 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef LINT
-static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.3 2007/07/13 06:43:42 shane Exp $";
+static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.4 2007/08/22 13:41:37 shane Exp $";
 #endif
 
 /*
@@ -832,7 +832,8 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, unsigned in_id,
        int cnt, alg, len, major, minor, file_major, file_minor;
        int id;
        char filename[PATH_MAX];
-       u_char in_buff[RAW_KEY_SIZE], *p;
+       u_char in_buff[RAW_KEY_SIZE];
+       char *p;
        FILE *fp;
 
        if (name == NULL || pk_key == NULL) {
@@ -865,14 +866,14 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, unsigned in_id,
        if (memcmp(in_buff, "Private-key-format: v", 20) != 0)
                goto fail;
        len = cnt;
-       p = in_buff;
+       p = (char *)in_buff;
 
        if (!dst_s_verify_str((const char **) &p, "Private-key-format: v")) {
                EREPORT(("dst_s_read_private_key_file(): Not a Key file/Decrypt failed %s\n", name));
                goto fail;
        }
        /* read in file format */
-       sscanf((char *)p, "%d.%d", &file_major, &file_minor);
+       sscanf(p, "%d.%d", &file_major, &file_minor);
        sscanf(KEY_FILE_FORMAT, "%d.%d", &major, &minor);
        if (file_major < 1) {
                EREPORT(("dst_s_read_private_key_file(): Unknown keyfile %d.%d version for %s\n",
@@ -888,7 +889,7 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, unsigned in_id,
        if (!dst_s_verify_str((const char **) &p, "Algorithm: "))
                goto fail;
 
-       if (sscanf((char *)p, "%d", &alg) != 1)
+       if (sscanf(p, "%d", &alg) != 1)
                goto fail;
        while (*p++ != '\n') ;  /* skip to end of line */
 
@@ -901,7 +902,7 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, unsigned in_id,
                goto fail;
 
        id = pk_key->dk_func->from_file_fmt(pk_key, (char *)p,
-                                           (unsigned)(&in_buff[len] - p));
+                                           (unsigned)(&in_buff[len] - (u_char *)p));
        if (id < 0)
                goto fail;
 
index be39c5b592fbb6cb5030c033c46646b62098d632..146302a34f45767e6bf0b9072d9523c6ac0eae13 100644 (file)
@@ -94,7 +94,7 @@
 #define DHCPV6_RELAY_FORW         12
 #define DHCPV6_RELAY_REPL         13
 
-extern char *dhcpv6_type_names[];
+extern const char *dhcpv6_type_names[];
 extern const int dhcpv6_type_name_max;
 
 /* DUID type definitions (RFC3315 section 9).
index df347d9d300d519d7eab53c90412aec6ea365a9e..c04188162b64833cd58e77049ed28fe7c86a38bc 100644 (file)
@@ -1543,15 +1543,10 @@ int add_option(struct option_state *options,
                       void *data,
                       unsigned int data_len);
 
-int add_option(struct option_state *options,
-              unsigned int option_num,
-              void *data,
-              unsigned int data_len);
-
 /* dhcpd.c */
 extern TIME cur_time;
 
-int ddns_update_style;
+extern int ddns_update_style;
 
 extern const char *path_dhcpd_conf;
 extern const char *path_dhcpd_db;
@@ -1566,7 +1561,7 @@ void cleanup PROTO ((void));
 void lease_pinged PROTO ((struct iaddr, u_int8_t *, int));
 void lease_ping_timeout PROTO ((void *));
 int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia);
-enum dhcp_shutdown_state shutdown_state;
+extern enum dhcp_shutdown_state shutdown_state;
 isc_result_t dhcp_io_shutdown (omapi_object_t *, void *);
 isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
                                     control_object_state_t newstate);
@@ -1844,10 +1839,6 @@ void get_server_source_address(struct in_addr *from,
                               struct option_state *options,
                               struct packet *packet);
 
-void get_server_source_address(struct in_addr *from,
-                              struct option_state *options,
-                                      struct packet *packet);
-
 /* dhcpv6.c */
 isc_boolean_t server_duid_isset(void);
 void copy_server_duid(struct data_string *ds, const char *file, int line);
@@ -1861,7 +1852,7 @@ void dhcpv6(struct packet *);
 void bootp PROTO ((struct packet *));
 
 /* memory.c */
-int (*group_write_hook) (struct group_object *);
+extern int (*group_write_hook) (struct group_object *);
 extern struct group *root_group;
 extern group_hash_t *group_name_hash;
 isc_result_t delete_group (struct group_object *, int);
@@ -1919,9 +1910,6 @@ struct option *new_option PROTO ((const char *, const char *, int));
 int option_reference(struct option **dest, struct option *src,
                     const char * file, int line);
 int option_dereference(struct option **dest, const char *file, int line);
-int group_allocate (struct group **, const char *, int);
-int group_reference (struct group **, struct group *, const char *, int);
-int group_dereference (struct group **, const char *, int);
 struct universe *new_universe PROTO ((const char *, int));
 void free_universe PROTO ((struct universe *, const char *, int));
 void free_domain_search_list PROTO ((struct domain_search_list *,
@@ -2224,7 +2212,7 @@ extern u_int16_t remote_port;
 extern int (*dhcp_interface_setup_hook) (struct interface_info *,
                                         struct iaddr *);
 extern int (*dhcp_interface_discovery_hook) (struct interface_info *);
-isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *);
+extern isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *);
 
 extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
                                            struct dhcp_packet *, unsigned,
@@ -2236,9 +2224,9 @@ extern void (*dhcpv6_packet_handler)(struct interface_info *,
 extern struct timeout *timeouts;
 extern omapi_object_type_t *dhcp_type_interface;
 #if defined (TRACING)
-trace_type_t *interface_trace;
-trace_type_t *inpacket_trace;
-trace_type_t *outpacket_trace;
+extern trace_type_t *interface_trace;
+extern trace_type_t *inpacket_trace;
+extern trace_type_t *outpacket_trace;
 #endif
 extern struct interface_info **interface_vector;
 extern int interface_count;
@@ -2291,11 +2279,11 @@ extern struct universe vsio_universe;
 extern int dhcp_option_default_priority_list [];
 extern int dhcp_option_default_priority_list_count;
 extern const char *hardware_types [256];
-int universe_count, universe_max;
-struct universe **universes;
+extern int universe_count, universe_max;
+extern struct universe **universes;
 extern universe_hash_t *universe_hash;
 void initialize_common_option_spaces PROTO ((void));
-struct universe *config_universe;
+extern struct universe *config_universe;
 
 /* stables.c */
 #if defined (FAILOVER_PROTOCOL)
@@ -2419,15 +2407,12 @@ void dhcpv4_client_assignments(void);
 void dhcpv6_client_assignments(void);
 
 /* dhc6.c */
-void form_duid(struct data_string *duid, char *file, int line);
-void dhc6_lease_destroy(struct dhc6_lease *lease, char *file, int line);
+void form_duid(struct data_string *duid, const char *file, int line);
+void dhc6_lease_destroy(struct dhc6_lease *lease, const char *file, int line);
 void start_init6(struct client_state *client);
 void start_confirm6(struct client_state *client);
 void start_release6(struct client_state *client);
 void start_selecting6(struct client_state *client);
-isc_result_t write_client6_lease(struct client_state *client,
-                                struct dhc6_lease *lease,
-                                int rewrite, int sync);
 void unconfigure6(struct client_state *client, const char *reason);
 
 /* db.c */
@@ -2587,8 +2572,8 @@ isc_result_t ddns_remove_fwd(struct data_string *,
 
 /* resolv.c */
 extern char path_resolv_conf [];
-struct name_server *name_servers;
-struct domain_search_list *domains;
+extern struct name_server *name_servers;
+extern struct domain_search_list *domains;
 
 void read_resolv_conf PROTO ((TIME));
 struct name_server *first_name_server PROTO ((void));
@@ -2604,7 +2589,7 @@ struct class unknown_class;
 struct class known_class;
 struct collection default_collection;
 struct collection *collections;
-struct executable_statement *default_classification_rules;
+extern struct executable_statement *default_classification_rules;
 
 void classification_setup PROTO ((void));
 void classify_client PROTO ((struct packet *));
@@ -2644,7 +2629,6 @@ int executable_statement_foreach (struct executable_statement *,
                                           void *, int), void *, int);
 
 /* comapi.c */
-extern omapi_object_type_t *dhcp_type_interface;
 extern omapi_object_type_t *dhcp_type_group;
 extern omapi_object_type_t *dhcp_type_shared_network;
 extern omapi_object_type_t *dhcp_type_subnet;
@@ -2765,24 +2749,6 @@ isc_result_t dhcp_lease_create (omapi_object_t **,
                                omapi_object_t *);
 isc_result_t dhcp_lease_remove (omapi_object_t *,
                                omapi_object_t *);
-isc_result_t dhcp_group_set_value  (omapi_object_t *, omapi_object_t *,
-                                   omapi_data_string_t *,
-                                   omapi_typed_data_t *);
-isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *,
-                                  omapi_data_string_t *,
-                                  omapi_value_t **); 
-isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int);
-isc_result_t dhcp_group_signal_handler (omapi_object_t *,
-                                       const char *, va_list);
-isc_result_t dhcp_group_stuff_values (omapi_object_t *,
-                                     omapi_object_t *,
-                                     omapi_object_t *);
-isc_result_t dhcp_group_lookup (omapi_object_t **,
-                               omapi_object_t *, omapi_object_t *);
-isc_result_t dhcp_group_create (omapi_object_t **,
-                               omapi_object_t *);
-isc_result_t dhcp_group_remove (omapi_object_t *,
-                               omapi_object_t *);
 isc_result_t dhcp_host_set_value  (omapi_object_t *, omapi_object_t *,
                                   omapi_data_string_t *,
                                   omapi_typed_data_t *);
@@ -2855,39 +2821,6 @@ isc_result_t dhcp_subclass_create (omapi_object_t **,
                                   omapi_object_t *);
 isc_result_t dhcp_subclass_remove (omapi_object_t *,
                                   omapi_object_t *);
-isc_result_t dhcp_shared_network_set_value  (omapi_object_t *,
-                                            omapi_object_t *,
-                                            omapi_data_string_t *,
-                                            omapi_typed_data_t *);
-isc_result_t dhcp_shared_network_get_value (omapi_object_t *, omapi_object_t *,
-                                           omapi_data_string_t *,
-                                           omapi_value_t **); 
-isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int);
-isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *,
-                                                const char *, va_list);
-isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *,
-                                              omapi_object_t *,
-                                              omapi_object_t *);
-isc_result_t dhcp_shared_network_lookup (omapi_object_t **,
-                                        omapi_object_t *, omapi_object_t *);
-isc_result_t dhcp_shared_network_create (omapi_object_t **,
-                                        omapi_object_t *);
-isc_result_t dhcp_subnet_set_value  (omapi_object_t *, omapi_object_t *,
-                                    omapi_data_string_t *,
-                                    omapi_typed_data_t *);
-isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *,
-                                   omapi_data_string_t *,
-                                   omapi_value_t **); 
-isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int);
-isc_result_t dhcp_subnet_signal_handler (omapi_object_t *,
-                                        const char *, va_list);
-isc_result_t dhcp_subnet_stuff_values (omapi_object_t *,
-                                      omapi_object_t *,
-                                      omapi_object_t *);
-isc_result_t dhcp_subnet_lookup (omapi_object_t **,
-                                omapi_object_t *, omapi_object_t *);
-isc_result_t dhcp_subnet_create (omapi_object_t **,
-                                omapi_object_t *);
 isc_result_t dhcp_interface_set_value (omapi_object_t *,
                                       omapi_object_t *,
                                       omapi_data_string_t *,
index 000196d45e2cf1d2a35f68efa735eaa7b809e8b4..1e64e93ac2fed5695be78193106cae51a7c38802 100644 (file)
@@ -20,6 +20,8 @@
  *   <info@isc.org>
  *   http://www.isc.org/
  */
+#ifndef MINIRES_H
+#define MINIRES_H
 
 #include "cdefs.h"
 #include "osdep.h"
@@ -128,8 +130,6 @@ void  res_buildservicelist (void);
 void res_destroyservicelist (void);
 void res_buildprotolist(void);
 void res_destroyprotolist(void);
-int res_servicenumber(const char *);
-int res_protocolnumber(const char *);
 const char *res_protocolname(int);
 const char *res_servicename(u_int16_t, const char *);
 u_int32_t ns_datetosecs (const char *cp, int *errp);
@@ -194,11 +194,8 @@ isc_result_t ns_sign_tcp_init (void *, const unsigned char *,
                               unsigned, ns_tcp_tsig_state *);
 isc_result_t ns_sign_tcp (unsigned char *,
                          unsigned *, unsigned, int, ns_tcp_tsig_state *, int);
-int ns_name_pton (const char *, unsigned char *, size_t);
 int ns_name_pack (const unsigned char *, unsigned char *,
                  unsigned, const unsigned char **, const unsigned char **);
-int ns_name_compress (const char *, unsigned char *,
-                     size_t, const unsigned char **, const unsigned char **);
 int ns_name_skip (const unsigned char **, const unsigned char *);
 int ns_subdomain (const char *, const char *);
 unsigned char *ns_find_tsig (unsigned char *, unsigned char *);
@@ -232,3 +229,5 @@ isc_result_t ns_rcode_to_isc (int);
 #if defined (TRACING)
 void trace_mr_statp_setup (res_state);
 #endif
+
+#endif /* MINIRES_H */
index 7cf8a5f0d2b3404b5d34e7aaf435f7a502d777c9..c1586eb602adac4d35361141cc313575b2a70619 100644 (file)
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: ns_verify.c,v 1.7 2005/03/17 20:15:18 dhankins Exp $";
+static const char rcsid[] = "$Id: ns_verify.c,v 1.8 2007/08/22 13:41:37 shane Exp $";
 #endif
 
-#define time(x)                trace_mr_time (x)
-
 /* Import. */
 
 #include <sys/types.h>
@@ -44,6 +42,8 @@ static const char rcsid[] = "$Id: ns_verify.c,v 1.7 2005/03/17 20:15:18 dhankins
 #include <unistd.h>
 #include <time.h>
 
+#define time(x)                trace_mr_time (x)
+
 #include "minires/minires.h"
 #include "arpa/nameser.h"
 #include <isc-dhcp/dst.h>
index 54aa056dce1f2e79af99e22d0e9ada7099d1ca1f..657e99a286ede1852e1a7569621c439e30e6a9ad 100644 (file)
@@ -160,4 +160,3 @@ isc_result_t omapi_array_lookup (char **ptr, omapi_array_t *array, int index,
        return ISC_R_NOTFOUND;
 }
 
-OMAPI_ARRAY_TYPE_DECL(omapi_object, omapi_object_t);
index 3f0965d2fdb324a1782e23659556cf7488b64459..618eaa758b67b9b685adcf4d29fa54182aa8adb4 100644 (file)
@@ -173,8 +173,9 @@ isc_result_t omapi_connect_list (omapi_object_t *c,
                        
                        if (bind (obj -> socket, (struct sockaddr *)&local_sin,
                                  sizeof local_sin) < 0) {
-                               omapi_object_dereference ((omapi_object_t **)
-                                                         &obj, MDL);
+                               omapi_connection_object_t **objp = &obj;
+                               omapi_object_t **o = (omapi_object_t **)objp;
+                               omapi_object_dereference(o, MDL);
                                if (errno == EADDRINUSE)
                                        return ISC_R_ADDRINUSE;
                                if (errno == EADDRNOTAVAIL)
index ff80e4cd84ff914dd910df6e0b601a0dea356e6b..838e304c5635f88399250a881994dfb1ab1071e0 100644 (file)
@@ -64,8 +64,6 @@ time_t trace_mr_time (time_t *);
 int trace_mr_select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
 unsigned int trace_mr_res_randomid (unsigned int);
 
-extern time_t cur_time;
-
 #if defined (TRACING)
 void trace_mr_init ()
 {
index 4ae4014a34f39945fe59bec5641ecc41cf6043b3..292e3092c00e2250ae167af3a753e53eb18d1262 100644 (file)
@@ -1007,6 +1007,12 @@ lease_to_client(struct data_string *reply_ret,
        ia_na = NULL;
        lease = NULL;
 
+       /*
+        * Silence compiler warnings.
+        */
+       valid_lifetime = 0;
+       preferred_lifetime = 0;
+
        /* 
         * Set up reply.
         */
@@ -2175,7 +2181,7 @@ iterate_over_ia_na(struct data_string *reply_ret,
                   struct packet *packet,
                   const struct data_string *client_id,
                   const struct data_string *server_id,
-                  char *packet_type,
+                  const char *packet_type,
                   void (*ia_na_match)(),
                   void (*ia_na_nomatch)()) {
        struct option_state *opt_state;