]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Bug fixes courtesy of Brian Murrell
authorTed Lemon <source@isc.org>
Thu, 9 Sep 1999 23:53:29 +0000 (23:53 +0000)
committerTed Lemon <source@isc.org>
Thu, 9 Sep 1999 23:53:29 +0000 (23:53 +0000)
17 files changed:
Makefile.conf
common/bpf.c
common/dlpi.c
common/execute.c
common/lpf.c
common/nit.c
common/socket.c
common/tree.c
common/upf.c
dhcpctl/Makefile.dist
includes/isc/types.h
omapip/Makefile.dist
omapip/buffer.c
omapip/connection.c
omapip/message.c
omapip/protocol.c
server/omapi.c

index a90dff778697063454938486bd9909164498bcf6..34193bedfd98a6211d8308129a0b8314c457cca2 100644 (file)
@@ -125,7 +125,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/share/man/cat4
 #FFMANEXT = .4
 #LIBMANDIR = /usr/share/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #VARRUN = /etc
 #VARDB = /etc
 #SCRIPT=solaris
@@ -144,7 +144,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/share/man/cat4
 #FFMANEXT = .4
 #LIBMANDIR = /usr/share/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #VARRUN = /etc
 #VARDB = /etc
 #SCRIPT=solaris
@@ -211,7 +211,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/man/man5
 #FFMANEXT = .5
 #LIBMANDIR = /usr/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 ##--ultrix--
 
 ## Linux 1.x
@@ -223,7 +223,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/man/man5
 #FFMANEXT = .5
 #LIBMANDIR = /usr/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #MANCAT = man
 #VARRUN = /var/run
 #VARDB = /var/state/dhcp
@@ -239,7 +239,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/man/man5
 #FFMANEXT = .5
 #LIBMANDIR = /usr/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #MANCAT = man
 #VARRUN = /var/run
 #VARDB = /var/state/dhcp
@@ -255,7 +255,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/man/man5
 #FFMANEXT = .5
 #LIBMANDIR = /usr/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #MANCAT = man
 #VARRUN = /var/run
 #VARDB = /var/state/dhcp
@@ -271,7 +271,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/man/man5
 #FFMANEXT = .5
 #LIBMANDIR = /usr/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #MANCAT = man
 #VARRUN = /var/run
 #VARDB = /var/dhcpd
@@ -313,7 +313,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/man/man5
 #FFMANEXT = .5
 #LIBMANDIR = /usr/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #MANCAT = man
 #VARRUN = /etc
 #COPTS=-w3 -Dlint $(BINDDEF)
@@ -332,7 +332,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/man/man5
 #FFMANEXT = .5
 #LIBMANDIR = /usr/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #VARRUN = /etc
 #MANINSTALL = /bin/true 
 #INSTALL = cp
@@ -359,7 +359,7 @@ MINORVERSION=MinorVersion
 #FFMANDIR = /usr/local/man/man5
 #FFMANEXT = .5
 #LIBMANDIR = /usr/local/man/cat3
-#LIBMANEXT .3
+#LIBMANEXT .3
 #MANCAT = man
 #INSTALL = install
 #MANINSTALL = install
index 290e12be4ba857503d13de917cb6b1fc9d57a9c4..f18fce1b59e89dcf5f0bdfa64850fea28fc24f20 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bpf.c,v 1.28 1999/09/08 01:43:38 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bpf.c,v 1.29 1999/09/09 23:53:13 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -426,7 +426,7 @@ void maybe_setup_fallback ()
                if_register_fallback (fbi);
                fbi -> refcnt = 1;
                fbi -> type = dhcp_type_interface;
-               status = omapi_register_io_object ((omapi_object_t)fbi,
+               status = omapi_register_io_object ((omapi_object_t *)fbi,
                                                   if_readsocket, 0,
                                                   fallback_discard, 0, 0);
                if (status != ISC_R_SUCCESS)
index 981cd6e0c08b087349f64a60035be5e63521eedf..a79265d4577171b6d85eab90c2935006a87f2af2 100644 (file)
@@ -70,7 +70,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dlpi.c,v 1.13 1999/09/08 01:43:39 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dlpi.c,v 1.14 1999/09/09 23:53:13 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1253,7 +1253,7 @@ void maybe_setup_fallback ()
                if_register_fallback (fbi);
                fbi -> refcnt = 1;
                fbi -> type = dhcp_type_interface;
-               status = omapi_register_io_object ((omapi_object_t)fbi,
+               status = omapi_register_io_object ((omapi_object_t *)fbi,
                                                   if_readsocket, 0,
                                                   fallback_discard, 0, 0);
                if (status != ISC_R_SUCCESS)
index 2930102b6b9b1843ea40bee79147e8f6f73e3959..8ece943195d65f05e41fa70127623aaa55d8cabf 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: execute.c,v 1.16 1999/07/31 17:56:09 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: execute.c,v 1.17 1999/09/09 23:53:14 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -45,13 +45,13 @@ int execute_statements (packet, lease, in_options, out_options, statements)
                switch (r -> op) {
                      case statements_statement:
 #if defined (DEBUG_EXPRESSIONS)
-                       log_info ("exec: statements");
+                       log_debug ("exec: statements");
 #endif
                        status = execute_statements (packet, lease,
                                                     in_options, out_options,
                                                     r -> data.statements);
 #if defined (DEBUG_EXPRESSIONS)
-                       log_info ("exec: statements returns %d", status);
+                       log_debug ("exec: statements returns %d", status);
 #endif
                        if (!status)
                                return 0;
index f20f9b2dd02b68731027912e9262456db0651bd8..924d7cd1869455d1712a6923d9f7611a6df2baa7 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: lpf.c,v 1.15 1999/09/08 01:43:39 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: lpf.c,v 1.16 1999/09/09 23:53:14 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -321,7 +321,7 @@ void maybe_setup_fallback ()
                if_register_fallback (fbi);
                fbi -> refcnt = 1;
                fbi -> type = dhcp_type_interface;
-               status = omapi_register_io_object ((omapi_object_t)fbi,
+               status = omapi_register_io_object ((omapi_object_t *)fbi,
                                                   if_readsocket, 0,
                                                   fallback_discard, 0, 0);
                if (status != ISC_R_SUCCESS)
index ef4a2ce78d25ff3c70bda0b28daa6b6289c1abeb..533cbd1216b911f625d4c0fd115563be4e269188 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: nit.c,v 1.23 1999/09/08 01:43:39 mellon Exp $ Copyright (c) 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: nit.c,v 1.24 1999/09/09 23:53:14 mellon Exp $ Copyright (c) 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -357,7 +357,7 @@ void maybe_setup_fallback ()
                if_register_fallback (fbi);
                fbi -> refcnt = 1;
                fbi -> type = dhcp_type_interface;
-               status = omapi_register_io_object ((omapi_object_t)fbi,
+               status = omapi_register_io_object ((omapi_object_t *)fbi,
                                                   if_readsocket, 0,
                                                   fallback_discard, 0, 0);
                if (status != ISC_R_SUCCESS)
index 9e30160f7e4df83ad38248ff3a1bae3b160299bc..1f312ad2a3aa0bbf296710cb230925660856d5cd 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: socket.c,v 1.38 1999/09/08 01:43:52 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: socket.c,v 1.39 1999/09/09 23:53:14 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -228,7 +228,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
 /* This just reads in a packet and silently discards it. */
 
 isc_result_t fallback_discard (object)
-       omapi_object_t object;
+       omapi_object_t *object;
 {
        char buf [1540];
        struct sockaddr_in from;
index 9006019aac05ab7ceda0583bd2d56bf70a9580c5..cf78d9d7becfbb996043a6c0b1202b821fd2209b 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: tree.c,v 1.46 1999/08/01 14:26:48 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: tree.c,v 1.47 1999/09/09 23:53:14 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -551,9 +551,6 @@ int evaluate_boolean_expression (result, packet, lease, in_options,
                /* we only want to do this on a DHCPREQUEST */
                if (!packet || packet -> packet_type != DHCPREQUEST)
                        return 0;
-               /* no update for static leases */
-               if (lease && (lease -> flags & STATIC_LEASE))
-                       return 0;
                memset (&rrtype, 0, sizeof expr1);
                s0 = evaluate_data_expression (&rrtype, packet, lease,
                                               in_options, cfg_options,
@@ -574,11 +571,18 @@ int evaluate_boolean_expression (result, packet, lease, in_options,
                if (s0 && s1 && s2 && s3) {
                        if (rrtype.len == 1 &&
                            strncmp(rrtype.data, "a", 1) == 0) {
-log_info("calling updateA(%s, %s, %d, lease)", expr1.data , expr2.data, ttl);
+#if defined (DEBUG_EXPRESSIONS)
+                               log_debug("calling updateA(%s, %s, %d, lease)",
+                                         expr1.data , expr2.data, ttl);
+#endif
                                updateA(expr1, expr2, ttl, lease);
                        } else if (rrtype.len == 3 &&
                                   strncmp(rrtype.data, "ptr", 3) == 0) {
-log_info("calling updatePTR(%s, %s, %d, lease)", expr1.data , expr2.data, ttl);
+#if defined (DEBUG_EXPRESSIONS)
+                               log_debug ("%s updatePTR(%s, %s, %d, lease)",
+                                          "calling", expr1.data,
+                                          expr2.data, ttl);
+#endif
                                updatePTR(expr1, expr2, ttl, lease);
                        }
                        *result = 1;
@@ -588,7 +592,7 @@ log_info("calling updatePTR(%s, %s, %d, lease)", expr1.data , expr2.data, ttl);
                        return 0;
                }
 #if defined (DEBUG_EXPRESSIONS)
-               log_info ("dns-update(%s, %s, %s):", 
+               log_debug ("dns-update (%s, %s, %s):", 
                          print_hex_1(rrtype.len, rrtype.data, 60),
                          print_hex_2(expr1.len, expr1.data, 60),
                          print_hex_3(expr2.len, expr2.data, 60));
index 6eb48df66db4f0e7eb9b9cbef84723987b124776..3b60702f539f46f7acc0f355f1353f140d32c0f5 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: upf.c,v 1.12 1999/09/08 01:43:39 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: upf.c,v 1.13 1999/09/09 23:53:15 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -307,7 +307,7 @@ void maybe_setup_fallback ()
                if_register_fallback (fbi);
                fbi -> refcnt = 1;
                fbi -> type = dhcp_type_interface;
-               status = omapi_register_io_object ((omapi_object_t)fbi,
+               status = omapi_register_io_object ((omapi_object_t *)fbi,
                                                   if_readsocket, 0,
                                                   fallback_discard, 0, 0);
                if (status != ISC_R_SUCCESS)
index 13ada812e7a24e6b3cf20cb5759358adbad26b5e..10940eccd27d6202c581e41e07dea7d23aef6dec 100644 (file)
@@ -30,7 +30,7 @@ CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS)
 all:   libdhcpctl.a test $(CATMANPAGES)
 
 test:  test.o libdhcpctl.a ../omapip/libomapi.a
-       $(CC) $(DEBUG) -o test test.o libdhcpctl.a ../omapip/libomapi.a
+       $(CC) $(DEBUG) -o test test.o libdhcpctl.a ../omapip/libomapi.a $(LIBS)
 
 libdhcpctl.a:  $(OBJ)
        rm -f libdhcpctl.a
index 3938c9dc856613e2a129bde5744aa44d75c1700a..2a3e7e3276f499ac8156025db3b532e145a7fa88 100644 (file)
 #include <isc/boolean.h>
 #include <isc/list.h>
 
+/* This is a bit of an ugly: if you are using NSUPDATE, you are also
+ * including (by means of -I...) the include files that are installed
+ * by BIND.  The problem is that the BIND includes also have an
+ * isc/list.h, which gets included above rather than the isc/list.h
+ * that is packaged with the DHCP server.  That include does not
+ * prepend the macros with "ISC_", the one ith the DHCP's isc/list.h
+ * does.  Sigh.
+ *
+ * Fixed in BIND 9.  Double sigh.  This is a temporary fix - we'll
+ * come up with something more correct later.
+ */
+#ifdef NSUPDATE
+#define ISC_LIST LIST
+#endif
+
 /***
  *** Core Types.
  ***/
index 86af6019c33f99b5e47dcd2a59f1697fdc5492af..e429be64f86159c497b5c0f610067e603a4b91ae 100644 (file)
@@ -32,7 +32,7 @@ CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS)
 all:   libomapi.a test $(CATMANPAGES)
 
 test:  test.o libomapi.a
-       $(CC) $(DEBUG) -o test test.o libomapi.a
+       $(CC) $(DEBUG) -o test test.o libomapi.a $(LIBS)
 
 libomapi.a:    $(OBJ)
        rm -f libomapi.a
index f0c6f287d6d3a7add727d9dc15ec0553f670f594..477a2ce1d1c6629e532884d15555ee8aa0ee05af 100644 (file)
@@ -171,9 +171,9 @@ isc_result_t omapi_connection_copyin (omapi_object_t *h,
 /* Copy some bytes from the input buffer, and advance the input buffer
    pointer beyond the bytes copied out. */
 
-u_int32_t omapi_connection_copyout (unsigned char *buf,
-                                   omapi_object_t *h,
-                                   int size)
+isc_result_t omapi_connection_copyout (unsigned char *buf,
+                                      omapi_object_t *h,
+                                      int size)
 {
        int bytes_remaining;
        int bytes_this_copy;
@@ -244,7 +244,7 @@ u_int32_t omapi_connection_copyout (unsigned char *buf,
        return ISC_R_SUCCESS;
 }
 
-u_int32_t omapi_connection_writer (omapi_object_t *h)
+isc_result_t omapi_connection_writer (omapi_object_t *h)
 {
        int bytes_this_write;
        int bytes_written;
index 0f7dd30e2295e4ad6cb5b3085a448d07d2c9e6b5..d0890bbef8a49adb64a5d5fe6115b42102d3c47a 100644 (file)
@@ -74,8 +74,10 @@ isc_result_t omapi_connect (omapi_object_t *c,
        } else
                he = (struct hostent *)0;
 
+#if defined (HAVE_SA_LEN)
        obj -> remote_addr.sin_len =
                sizeof (struct sockaddr_in);
+#endif
        obj -> remote_addr.sin_family = AF_INET;
        memset (&(obj -> remote_addr.sin_zero), 0,
                sizeof obj -> remote_addr.sin_zero);
index 94489b67ab7799ccf3167b487bd09eeee835d4ea..a9695ac24e5c79ed4e2984ddb73b03d4793099d2 100644 (file)
@@ -364,7 +364,7 @@ isc_result_t omapi_message_process (omapi_object_t *mo, omapi_object_t *po)
        omapi_message_object_t *message, *m;
        omapi_object_t *object = (omapi_object_t *)0;
        omapi_value_t *tv = (omapi_value_t *)0;
-       int create, update, exclusive;
+       u_int32_t create, update, exclusive;
        isc_result_t status, waitstatus;
        omapi_object_type_t *type;
 
@@ -623,7 +623,7 @@ isc_result_t omapi_message_process (omapi_object_t *mo, omapi_object_t *po)
                                              (omapi_object_t *)0,
                                              "result", &tv);
                if (status == ISC_R_SUCCESS) {
-                       status = omapi_get_int_value (&waitstatus,
+                       status = omapi_get_int_value ((u_int32_t *)&waitstatus,
                                                      tv -> value);
                        omapi_value_dereference (&tv,
                                                 "omapi_message_process");
index 38d77411db58da434a38f9c30fcdd63e1b166a38..a8b8dad7aad3f93a85ad472778f096b0875727bd 100644 (file)
@@ -257,8 +257,10 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
              case omapi_protocol_intro_wait:
                /* Get protocol version and header size in network
                   byte order. */
-               omapi_connection_get_uint32 (c, &p -> protocol_version);
-               omapi_connection_get_uint32 (c, &p -> header_size);
+               omapi_connection_get_uint32
+                       (c, (u_int32_t *)&p -> protocol_version);
+               omapi_connection_get_uint32
+                       (c, (u_int32_t *)&p -> header_size);
        
                /* We currently only support the current protocol version. */
                if (p -> protocol_version != OMAPI_PROTOCOL_VERSION) {
@@ -294,14 +296,20 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
                }
 
                /* Swap in the header... */
-               omapi_connection_get_uint32 (c, &p -> message -> authid);
+               omapi_connection_get_uint32
+                       (c, (u_int32_t *)&p -> message -> authid);
 
                /* XXX bind the authenticator here! */
-               omapi_connection_get_uint32 (c, &p -> message -> authlen);
-               omapi_connection_get_uint32 (c, &p -> message -> op);
-               omapi_connection_get_uint32 (c, &p -> message -> handle);
-               omapi_connection_get_uint32 (c, &p -> message -> id);
-               omapi_connection_get_uint32 (c, &p -> message -> rid);
+               omapi_connection_get_uint32
+                       (c, (u_int32_t *)&p -> message -> authlen);
+               omapi_connection_get_uint32
+                       (c, (u_int32_t *)&p -> message -> op);
+               omapi_connection_get_uint32
+                       (c, (u_int32_t *)&p -> message -> handle);
+               omapi_connection_get_uint32
+                       (c, (u_int32_t *)&p -> message -> id);
+               omapi_connection_get_uint32
+                       (c, (u_int32_t *)&p -> message -> rid);
 
                /* If there was any extra header data, skip over it. */
                if (p -> header_size > sizeof (omapi_protocol_header_t)) {
index d1f56054624bdc8e4e3db51fcd1770ca5557de1d..8b5a941c6b0047e0f76bb5664161939e7cecd9fe 100644 (file)
@@ -29,7 +29,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: omapi.c,v 1.3 1999/09/09 23:33:43 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: omapi.c,v 1.4 1999/09/09 23:53:29 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -830,8 +830,8 @@ isc_result_t dhcp_host_signal_handler (omapi_object_t *h,
        if (!strcmp (name, "updated")) {
                if (!host -> name) {
                        char hnbuf [64];
-                       sprintf (hnbuf, "nh%08lx%08x",
-                                cur_time, (u_int32_t)host);
+                       sprintf (hnbuf, "nh%08lx%08lx",
+                                cur_time, (unsigned long)host);
                        host -> name = malloc (strlen (hnbuf) + 1);
                        if (!host -> name)
                                return ISC_R_NOMEMORY;