Module Name:    src
Committed By:   christos
Date:           Wed Aug 17 08:06:38 UTC 2011

Modified Files:
        src/dist/dhcp/client: dhclient.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/dist/dhcp/client/dhclient.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/dhcp/client/dhclient.c
diff -u src/dist/dhcp/client/dhclient.c:1.21 src/dist/dhcp/client/dhclient.c:1.22
--- src/dist/dhcp/client/dhclient.c:1.21	Wed Apr  6 16:24:16 2011
+++ src/dist/dhcp/client/dhclient.c	Wed Aug 17 04:06:38 2011
@@ -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++) {

Reply via email to