Commit e92653f1 authored by Ted Lemon's avatar Ted Lemon

Bug fixes courtesy of Brian Murrell

parent 110d0522
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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;
......
......@@ -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)
......
......@@ -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)
......
......@@ -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;
......
......@@ -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));
......
......@@ -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)
......
......@@ -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
......
......@@ -22,6 +22,21 @@
#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.
***/
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
......
......@@ -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");
......
......@@ -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)) {
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment