[Pkg-samba-maint] Bug#652942: Do we really need to reload samba in DHCP enter hook?

Steve Langasek vorlon at debian.org
Wed Jun 27 16:36:14 UTC 2012


On Wed, Jun 27, 2012 at 09:25:46AM -0700, Steve Langasek wrote:
> Sigh.  So no, I definitely don't agree with this change; but I didn't get a
> chance to review this patch and didn't see up to that point in the
> discussion that anyone was proposing *dropping* the dhcp hook.  I thought we
> were only talking about dropping the reload handling, not the entire hook!

> I'm going to revert this change and reopen the bugs.  Whether or not nmbd is
> reloading its config, dhcp wins registration is still valuable for client
> software, and this change is a regression.

Also, the 'reload' is done there specifically so that smbd gets the new
config, because smbd *also* will talk to the configured wins for name
resolution - so this was quite deliberate and has nothing to do with nmbd,
which we know does nothing on reload.

So I'm restoring the full patch, including the reload in the dhcp hook.  The
systemd maintainers should fix their invoke-rc.d implementation to not have
broken timeouts.

> -- 
> Steve Langasek                   Give me a lever long enough and a Free OS
> Debian Developer                   to set it on, and I can move the world.
> Ubuntu Developer                                    http://www.debian.org/
> slangasek at ubuntu.com                                     vorlon at debian.org
> 
> > Index: samba-common.maintscript
> > ===================================================================
> > --- samba-common.maintscript	(revision 0)
> > +++ samba-common.maintscript	(working copy)
> > @@ -0,0 +1,3 @@
> > +rm_conffile /etc/dhcp3/dhclient-enter-hooks.d/samba 2:3.6.5-8~ samba-common
> > +rm_conffile /etc/dhcp/dhclient-enter-hooks.d/samba 2:3.6.5-8~ samba-common
> > +rm_conffile /etc/samba/dhcp.conf 2:3.6.5-8~ samba-common
> > Index: samba-common.dhcp
> > ===================================================================
> > --- samba-common.dhcp	(revision 4124)
> > +++ samba-common.dhcp	(working copy)
> > @@ -1,75 +0,0 @@
> > -#!/bin/sh
> > -
> > -SAMBA_DHCP_CONF=/etc/samba/dhcp.conf
> > -
> > -netbios_setup() {
> > -	# No need to continue if we're called with an unsupported option
> > -
> > -	case $reason in
> > -	BOUND|RENEW|REBIND|REBOOT|EXPIRE|FAIL|RELEASE|STOP)
> > -		;;
> > -	*)
> > -		return
> > -		;;
> > -	esac
> > -
> > -	umask 022
> > -
> > -	local other_servers=""
> > -	local serverlist=""
> > -
> > -	# the destination file won't exist yet on the first run after 
> > -	# installing samba
> > -	if [ -e $SAMBA_DHCP_CONF ] && [ -s $SAMBA_DHCP_CONF ]
> > -	then
> > -		# don't continue if no settings have changed
> > -		if [ "$new_netbios_name_servers" = "$old_netbios_name_servers" ] \
> > -		   && [ "$new_netbios_scope" = "$old_netbios_scope" ] \
> > -		   && [ -n "$new_netbios_name_servers" ]
> > -		then
> > -			return
> > -		fi
> > -
> > -		# reparse our own file
> > -		other_servers=`sed -n -e"s/[[:space:]]$interface:[^[:space:]]*//g; \
> > -			s/^[[:space:]]*wins server[[:space:]]*=[[:space:]]*//pi" \
> > -			$SAMBA_DHCP_CONF`
> > -
> > -		serverlist="$other_servers"
> > -	fi
> > -
> > -	for server in $new_netbios_name_servers
> > -	do
> > -		serverlist="$serverlist $interface:$server"
> > -	done
> > -
> > -	echo -n > ${SAMBA_DHCP_CONF}.new
> > -
> > -	# If we're updating on failure/expire, AND there are no WINS
> > -	# servers for other interfaces, leave the file empty.
> > -	if [ -z "$other_servers" ]
> > -	then
> > -		if [ "$reason" = FAIL ] || [ "$reason" = EXPIRE ]
> > -		then
> > -			mv ${SAMBA_DHCP_CONF}.new $SAMBA_DHCP_CONF
> > -			return
> > -		fi
> > -	fi
> > -
> > -	if [ -n "$serverlist" ]
> > -	then
> > -		echo "   wins server =$serverlist" >> ${SAMBA_DHCP_CONF}.new
> > -	fi
> > -	if [ -n "$new_netbios_scope" ]
> > -	then
> > -		echo "   netbios scope = $new_netbios_scope" >> ${SAMBA_DHCP_CONF}.new
> > -	fi
> > -	mv ${SAMBA_DHCP_CONF}.new $SAMBA_DHCP_CONF
> > -
> > -	# reload the samba server
> > -	# We don't necessarily have the samba package installed. #414841
> > -	[ -x /etc/init.d/samba ] && /usr/sbin/invoke-rc.d samba reload
> > -
> > -}
> > -
> > -netbios_setup
> > Index: rules
> > ===================================================================
> > --- rules	(revision 4124)
> > +++ rules	(working copy)
> > @@ -98,11 +98,6 @@
> >  	mkdir -p $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
> >  	install -m 0644 source3/pkgconfig/wbclient.pc $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
> >  
> > -	# Install samba-common's conffiles - they'll get moved later to their
> > -	# correct place by dh_install
> > -	mkdir -p $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d
> > -	install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba
> > -
> >  override_dh_installpam:
> >  	dh_installpam --name=samba
> >  
> > Index: samba-common.links
> > ===================================================================
> > --- samba-common.links	(revision 4124)
> > +++ samba-common.links	(working copy)
> > @@ -1 +0,0 @@
> > -etc/dhcp3/dhclient-enter-hooks.d/samba etc/dhcp/dhclient-enter-hooks.d/samba
> > Index: samba-common.dirs
> > ===================================================================
> > --- samba-common.dirs	(revision 4124)
> > +++ samba-common.dirs	(working copy)
> > @@ -1,5 +1,4 @@
> >  etc/samba
> > -etc/dhcp3/dhclient-enter-hooks.d
> >  var/cache/samba
> >  var/lib/samba
> >  var/log/samba
> > Index: control
> > ===================================================================
> > --- control	(revision 4124)
> > +++ control	(working copy)
> > @@ -57,6 +57,7 @@
> >  Package: samba-common
> >  Architecture: all
> >  Multi-Arch: foreign
> > +Pre-Depends: ${misc:Pre-Depends}
> >  Depends: ucf, ${misc:Depends}
> >  Replaces: samba (<< 3.0.20b-1), samba4-common (<< 4.0.0~alpha7-1)
> >  Conflicts: samba4-common (<< 4.0.0~alpha7-1)
> > Index: samba-common.postinst
> > ===================================================================
> > --- samba-common.postinst	(revision 4124)
> > +++ samba-common.postinst	(working copy)
> > @@ -11,11 +11,14 @@
> >  NEWFILE=$TEMPDIR/smb.conf
> >  CONFIG=/etc/samba/smb.conf
> >  
> > +OLDVERSION="$2"
> > +
> >  # ------------------------- Debconf questions start ---------------------
> >  
> >  configure_smb_conf() {
> >  	local CONFIG
> >  	CONFIG="$1"
> > +	OLDVERSION="$2"
> >  
> >  	# Is the user configuring with debconf, or he/she prefers
> >  	# swat/manual config?
> > @@ -50,19 +53,9 @@
> >  		        s/^\([[:space:]]*\)encrypt passwords[[:space:]]*=.*/\1encrypt passwords = ${ENCRYPT_PASSWORDS}/i" \
> >  		"$CONFIG"
> >  
> > -	# Install DHCP support
> > -	db_get samba-common/dhcp
> > -	if [ "$RET" = true ] && \
> > -	   ! grep -q dhcp.conf "$CONFIG"
> > +	# Remove DHCP support prio to version 2:3.6.5-8
> > +	if dpkg --compare-versions "$OLDVERSION" lt '2:3.6.5-8~'
> >  	then
> > -		sed -i -e "s/^\([[:space:]]*\)\[global\]/\1\[global\]/i
> > -			/^[[:space:]]*\[global\]/,/^[[:space:]]*\[/ {
> > -				/wins server[[:space:]]*=/a \\
> > -\\
> > -# If we receive WINS server info from DHCP, override the options above. \\
> > -   include = /etc/samba/dhcp.conf
> > -}" "$CONFIG"
> > -	elif [ "$RET" != true ]; then
> >  		sed -i -e '
> >  		/^#[[:space:]]*If we receive WINS server info from DHCP, override the options above/d
> >  		/^#*[[:space:]]*include[[:space:]]*=[[:space:]]*\/etc\/samba\/dhcp.conf/,/[^[:space:]]/ {
> > @@ -75,7 +68,7 @@
> >  
> >  
> >  if [ -e "$CONFIG" ]; then
> > -	configure_smb_conf "$CONFIG"
> > +	configure_smb_conf "$CONFIG" "$OLDVERSION"
> >  fi
> >  
> >  mkdir -p "$TEMPDIR"
> > Index: samba-common.install
> > ===================================================================
> > --- samba-common.install	(revision 4124)
> > +++ samba-common.install	(working copy)
> > @@ -1,6 +1,5 @@
> >  etc/samba/
> >  debian/gdbcommands etc/samba
> > -etc/dhcp3/
> >  usr/share/samba/lowcase.dat
> >  debian/panic-action usr/share/samba
> >  debian/smb.conf* usr/share/samba
> > Index: samba-common.templates
> > ===================================================================
> > --- samba-common.templates	(revision 4124)
> > +++ samba-common.templates	(working copy)
> > @@ -2,19 +2,6 @@
> >  Type: title
> >  _Description: Samba server and utilities
> >  
> > -Template: samba-common/dhcp
> > -Type: boolean
> > -Default: false
> > -_Description: Modify smb.conf to use WINS settings from DHCP?
> > - If your computer gets IP address information from a DHCP server on the
> > - network, the DHCP server may also provide information about WINS servers
> > - ("NetBIOS name servers") present on the network.  This requires a
> > - change to your smb.conf file so that DHCP-provided WINS settings will
> > - automatically be read from /etc/samba/dhcp.conf.
> > - .
> > - The dhcp3-client package must be installed to take advantage of this
> > - feature.
> > -
> >  Template: samba-common/do_debconf
> >  Type: boolean
> >  Default: true
> > Index: samba-common.config
> > ===================================================================
> > --- samba-common.config	(revision 4124)
> > +++ samba-common.config	(working copy)
> > @@ -77,32 +77,3 @@
> >  db_input medium samba-common/encrypt_passwords || true
> >  db_go
> >  
> > -DHCPPRIORITY=medium
> > -#if [ "$DEBCONF_RECONFIGURE" = 1 ] && [ -f /sbin/dhclient3 ]
> > -if [ -f /sbin/dhclient3 ]
> > -then
> > -	DHCPPRIORITY=high
> > -# TODO: see if we can detect that dhcp3-client is *going* to be installed,
> > -# even if it isn't yet.
> > -#elif dpkg-query -W --showformat='${Status}\n' dhcp3-client | grep ???
> > -# unknown ok not-installed ? 
> > -#	DHCPPRIORITY=high
> > -fi
> > -
> > -FOUND=false
> > -if [ -f $FILE ]; then
> > -	if grep -q 'include[[:space:]]*=[[:space:]]*/etc/samba/dhcp.conf' $FILE
> > -	then
> > -		FOUND=true
> > -	fi
> > -	db_set samba-common/dhcp $FOUND
> > -fi
> > -
> > -# we only prompt in one of three cases: the file doesn't exist yet, it
> > -# has the context we need to add our include line, or the include line
> > -# is already present.
> > -if [ ! -f $FILE ] || grep -q -i 'wins server' $FILE || [ "$FOUND" = "true" ];
> > -then
> > -	db_input $DHCPPRIORITY samba-common/dhcp || true
> > -	db_go
> > -fi
> > Index: changelog
> > ===================================================================
> > --- changelog	(revision 4124)
> > +++ changelog	(working copy)
> > @@ -1,3 +1,9 @@
> > +samba (2:3.6.5-8) UNRELEASED; urgency=low
> > +
> > +  * Remove DHCP hook. Closes: #652942, #629406, #649100
> > +
> > + -- Ivo De Decker <ivo.dedecker at ugent.be>  Tue, 19 Jun 2012 21:19:29 +0200
> > +
> >  samba (2:3.6.5-7) unstable; urgency=low
> >  
> >    * Allow installing smbclient package together with newer versions of
> 
> 
> 
> 

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org





More information about the Pkg-samba-maint mailing list