From: Ted Lemon Date: Sat, 24 Jun 2000 06:02:01 +0000 (+0000) Subject: Don't listen on an OMAPI port unless one is specified in the config file. X-Git-Tag: V3-BETA-2-PATCH-1~129 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=40a59753f0017bdca04b0b1c24d56618f5bf66bc;p=thirdparty%2Fdhcp.git Don't listen on an OMAPI port unless one is specified in the config file. --- diff --git a/client/dhclient.c b/client/dhclient.c index a6e4b09f7..be6e5e9ec 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -41,7 +41,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.105 2000/06/02 21:26:57 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.106 2000/06/24 06:02:01 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -103,6 +103,7 @@ int main (argc, argv, envp) omapi_object_t *listener; isc_result_t result; int persist = 0; + int omapi_port; #ifdef SYSLOG_4_2 openlog ("dhclient", LOG_NDELAY); @@ -370,16 +371,20 @@ int main (argc, argv, envp) return 0; /* Start up a listener for the object management API protocol. */ - listener = (omapi_object_t *)0; - result = omapi_generic_new (&listener, MDL); - if (result != ISC_R_SUCCESS) - log_fatal ("Can't allocate new generic object: %s\n", - isc_result_totext (result)); - result = omapi_protocol_listen (listener, - OMAPI_PROTOCOL_PORT + 1, 1); - if (result != ISC_R_SUCCESS) - log_fatal ("Can't start OMAPI protocol: %s", - isc_result_totext (result)); + if (top_level_config.omapi_port != -1) { + listener = (omapi_object_t *)0; + result = omapi_generic_new (&listener, MDL); + if (result != ISC_R_SUCCESS) + log_fatal ("Can't allocate new generic object: %s\n", + isc_result_totext (result)); + result = omapi_protocol_listen (listener, + (unsigned) + top_level_config.omapi_port, + 1); + if (result != ISC_R_SUCCESS) + log_fatal ("Can't start OMAPI protocol: %s", + isc_result_totext (result)); + } /* Set up the bootp packet handler... */ bootp_packet_handler = do_packet;