[Pkg-samba-maint] Bug#407408: /etc/samba/dhcp.conf only created on change of wins server, but not initially

Bas Zoetekouw bas at debian.org
Fri Mar 2 15:05:04 CET 2007


severity 407408 serious
tag 407408 + patch
thanks

Hi!

I'm upgrading the severity of this bug, as it breaks functionality for
new installations.  Feel free to downgrade if you don't think this
should be fixed for etch.

Attached is a patch for the samba dhcp hook script to fix this bug.  It
checks if the file doesn't exist yet, and in that always creates the
file.  It also reload samba if the settings changed.
I've tested the patch on my machine here, and it seems to work well.

Greetings,
Bas.

-------------- next part --------------
--- samba-3.0.24/debian/samba-common.dhcp.eerst	2007-03-02 12:02:49.000000000 +0100
+++ samba-3.0.24/debian/samba-common.dhcp	2007-03-02 14:54:41.149311039 +0100
@@ -12,21 +12,29 @@
 		return
 	fi
 
-	# Nor should we continue if no settings have changed
-	if [ "$new_netbios_name_servers" = "$old_netbios_name_servers" ] \
-	   && [ "$new_netbios_scope" = "$old_netbios_scope" ]
+	umask 022
+
+	# check of the destination file doesn't exist yet (i.e. on first run after
+	# installing samb)
+	if [ ! -e $SAMBA_DHCP_CONF ];
 	then
-		return
-	fi
+		local serverlist=""
+	else
+		# don't continue if no settings have changed
+		if [ "$new_netbios_name_servers" = "$old_netbios_name_servers" ] \
+	   		&& [ "$new_netbios_scope" = "$old_netbios_scope" ]
+		then
+			return
+		fi
 
-	# reparse our own file
-	local other_servers=`sed -n -e"s/[[:space:]]$interface:[^[:space:]]*//g; \
-		s/^[[:space:]]*wins server[[:space:]]*=[[:space:]]*//pi" \
-		$SAMBA_DHCP_CONF`
+		# reparse our own file
+		local other_servers=`sed -n -e"s/[[:space:]]$interface:[^[:space:]]*//g; \
+			s/^[[:space:]]*wins server[[:space:]]*=[[:space:]]*//pi" \
+			$SAMBA_DHCP_CONF`
 
-	umask 022
+		local serverlist="$other_servers"
+	fi
 
-	local serverlist="$other_servers"
 	for server in $new_netbios_name_servers
 	do
 		serverlist="$serverlist $interface:$server"
@@ -52,6 +60,9 @@
 	then
 		echo "   netbios scope = $new_netbios_scope" >> $SAMBA_DHCP_CONF
 	fi
+
+	# now reload the samba server
+	/usr/sbin/invoke-rc.d samba reload
 }
 
 netbios_setup


More information about the Pkg-samba-maint mailing list