Source-Changes-HG archive

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

[src/trunk]: src/dist/dhcp/client Instead of printing the raw suspect value i...



details:   https://anonhg.NetBSD.org/src/rev/d018019bb173
branches:  trunk
changeset: 768454:d018019bb173
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Aug 17 08:06:38 2011 +0000

description:
Instead of printing the raw suspect value instead of the name (!?!?), print the
name and the suspect value vis encoded.

diffstat:

 dist/dhcp/client/dhclient.c |  24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diffs (67 lines):

diff -r cd12732f1987 -r d018019bb173 dist/dhcp/client/dhclient.c
--- a/dist/dhcp/client/dhclient.c       Wed Aug 17 07:26:16 2011 +0000
+++ b/dist/dhcp/client/dhclient.c       Wed Aug 17 08:06:38 2011 +0000
@@ -32,11 +32,12 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhclient.c,v 1.21 2011/04/06 20:24:16 christos Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dhclient.c,v 1.22 2011/08/17 08:06:38 christos Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
 #include "version.h"
+#include <vis.h>
 
 TIME default_lease_time = 43200; /* 12 hours... */
 TIME max_lease_time = 86400; /* 24 hours... */
@@ -86,6 +87,14 @@
 
 void do_release(struct client_state *);
 
+static void
+suspect(const char *name, const char *value)
+{
+       char buf[1024];
+       (void)strnvis(buf, sizeof(buf), value, VIS_WHITE);
+       log_error("suspect value in %s option (%s) - discarded", name, buf);
+}
+
 #if !defined (SMALL)
 static isc_result_t
 verify_addr (omapi_object_t *l, omapi_addr_t *addr)
@@ -2492,11 +2501,8 @@
                                        client_envadd(es->client, es->prefix,
                                                      name, "%s", value);
                                } else {
-                                       log_error("suspect value in %s "
-                                                 "option - discarded",
-                                                 name);
+                                       suspect(name, value);
                                }
-
                                data_string_forget (&data, MDL);
                        }
                }
@@ -2576,9 +2582,7 @@
                        client_envadd(client, prefix, "filename",
                                      "%s", lease->filename);
                } else {
-                       log_error("suspect value in %s "
-                                 "option - discarded",
-                                 lease->filename);
+                       suspect("filename", lease->filename);
                }
        }
 
@@ -2589,9 +2593,7 @@
                        client_envadd (client, prefix, "server_name",
                                       "%s", lease->server_name);
                } else {
-                       log_error("suspect value in %s "
-                                 "option - discarded",
-                                 lease->server_name);
+                       suspect("server_mame", lease->server_name);
                }
        }
        for (i = 0; i < lease -> options -> universe_count; i++) {



Home | Main Index | Thread Index | Old Index