Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/dhcp/client If an omapi key is configured, use it.



details:   https://anonhg.NetBSD.org/src/rev/1e891b858db1
branches:  trunk
changeset: 565143:1e891b858db1
user:      mellon <mellon%NetBSD.org@localhost>
date:      Tue Mar 30 19:40:58 2004 +0000

description:
If an omapi key is configured, use it.

diffstat:

 dist/dhcp/client/dhclient.c |  26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diffs (50 lines):

diff -r b974a491028d -r 1e891b858db1 dist/dhcp/client/dhclient.c
--- a/dist/dhcp/client/dhclient.c       Tue Mar 30 19:39:39 2004 +0000
+++ b/dist/dhcp/client/dhclient.c       Tue Mar 30 19:40:58 2004 +0000
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhclient.c,v 1.9 2003/10/24 05:27:55 mellon Exp $ Copyright (c) 1995-2002 Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhclient.c,v 1.10 2004/03/30 19:40:58 mellon Exp $ Copyright (c) 1995-2002 Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -89,6 +89,20 @@
 
 void do_release(struct client_state *);
 
+static isc_result_t
+verify_addr (omapi_object_t *l, omapi_addr_t *addr)
+{
+       return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+verify_auth (omapi_object_t *p, omapi_auth_key_t *a)
+{
+       if (a != top_level_config.omapi_key)
+               return ISC_R_INVALIDKEY;
+       return ISC_R_SUCCESS;
+}
+
 int main (argc, argv, envp)
        int argc;
        char **argv, **envp;
@@ -442,10 +456,12 @@
                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);
+               result = (omapi_protocol_listen
+                         (listener,
+                          (unsigned)top_level_config.omapi_port, 1));
+               if (result == ISC_R_SUCCESS && top_level_config.omapi_key)
+                       result = (omapi_protocol_configure_security
+                                 (listener, verify_addr, verify_auth));
                if (result != ISC_R_SUCCESS)
                        log_fatal ("Can't start OMAPI protocol: %s",
                                   isc_result_totext (result));



Home | Main Index | Thread Index | Old Index