Subject: bin/12687: Syntax error in /sbin/dhclient-script
To: None <gnats-bugs@gnats.netbsd.org>
From: Tim Preston <tim@localhost.flibble.org>
List: netbsd-bugs
Date: 04/17/2001 22:58:30
>Number: 12687
>Category: bin
>Synopsis: /sbin/dhclient has a simple syntax error
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Apr 17 14:59:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Tim Preston
>Release: 20010417
>Organization:
The Home for Lost Haddock
>Environment:
System: NetBSD 1.5U NetBSD 1.5U (KATRINA.4MB) #1: Sat Apr 14 22:23:41 BST 2001 tim@katrina.flibble.org:/usr/export/src/sys/arch/i386/compile/KATRINA.4MB i386
Architecture: i386
Machine: i386
>Description:
One of the strings passed to '[ -z' by /sbin/dhclient-script is
not enclosed in double quotes. As a result when it is zero length
a syntax error oxxurs giving rise to the following output from
dhclient (problem manually highlighted by a trailing ****)
and the hostname on the system invoking dhclient is not set.
root@:~# dhclient -d
Internet Software Consortium DHCP Client V3.0b2pl24
Copyright 1995-2001 Internet Software Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP
Listening on BPF/fxp0/00:a0:c9:6f:e1:f3
Sending on BPF/fxp0/00:a0:c9:6f:e1:f3
Sending on Socket/fallback
DHCPREQUEST on fxp0 to 255.255.255.255 port 67
DHCPACK from 212.135.176.163
New Host Name: katrina.flibble.org
New Network Number: 212.135.176.160
New Broadcast Address: 212.135.176.175
[: closing paren expected ****
bound to 212.135.176.162 -- renewal in 20832 seconds.
^C
>How-To-Repeat:
Install dhclient and dhclient-script from sources later than 20010414
Make sure that the machine is not setting its hostname by any other
mechanism (or the string passed to '[ -z' will be non-zero and the
problem will not be triggered). Arrange for the local DHCP server
to set the machine's details, including hostname. Run dhclient.
>Fix:
Apply the following patch.
Index: netbsd
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/dhcp/client/scripts/netbsd,v
retrieving revision 1.14
diff -u -r1.14 netbsd
--- netbsd 2001/04/11 21:53:26 1.14
+++ netbsd 2001/04/17 21:55:31
@@ -133,7 +133,7 @@
\( "x$new_host_name" = "x$old_hostname" \) ]; then
current_hostname=`hostname`
fi
- if [ \( -z $current_hostname \) -o \
+ if [ \( -z "$current_hostname" \) -o \
\( "x$new_host_name" != "x$old_hostname" \) ]; then
hostname $new_host_name
fi
>Release-Note:
>Audit-Trail:
>Unformatted: