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

dhclient problem (and fix?)



Cvs'upped today.
I got problems with the new dhclient that has been merged in.

It refused the domainname I got from our w2k-server.

I checked the latest ISC DHCP and they had added code for detecting
and fixing the problem I had.

This diff made my dhclient happy:

Index: options.c
===================================================================
RCS file: /cvs/src/usr.sbin/dhcp/common/options.c,v
retrieving revision 1.3
diff -u -r1.3 options.c
--- options.c	2001/06/24 06:05:07	1.3
+++ options.c	2001/07/04 15:40:21
@@ -42,7 +42,6 @@
 
 #define DHCP_OPTION_DATA
 #include "dhcpd.h"
-#include <ctype.h>
 
 int bad_options = 0;
 int bad_options_max = 5;
@@ -579,11 +578,13 @@
 				for (; dp < data + len; dp++) {
 					if (!isascii (*dp) ||
 					    !isprint (*dp)) {
-						snprintf (op, opleft, "\\%03o",
-							 *dp);
-						op += 4;
-						opleft -= 4;
-						
+					         /* Skip trailing NUL. */
+                                                 if (dp + 1 != data + len ||
+                                                     *dp != 0) {
+                                                         sprintf (op, "\\%03o",
+                                                                 *dp);
+                                                         op += 4;
+                                                  }
 					} else if (*dp == '"' ||
 						   *dp == '\'' ||
 						   *dp == '$' ||