[Pkg-samba-maint] Bug#594088: samba-common: wins server not added to /etc/samba/dhcp.conf

Mario 'BitKoenig' Holbe Mario.Holbe at TU-Ilmenau.DE
Fri Jan 28 20:46:57 UTC 2011

On Mon, Aug 23, 2010 at 10:31:33PM +0700, Maxim Nikulin wrote:
> /etc/samba/dhcp.conf file remains empty, although dhcp client receives
> netbios-name-servers. If I add "wins server" to dhcp.conf by hand,
> the file becomes empty on DHCP RELEASE event (ifdown eth0).
> 'ifup eth0' updates dhcp.conf modification time but it remains empty.
> The DHCP client
> ii  isc-dhcp-clien 4.1.1-P1-9     ISC DHCP client
> sets emty new_netbios_name_servers environment variable on DHCP RELEASE.
> This wipes out "wins server" record from dhcp.conf. It should be
> intended behaviour of /etc/dhcp3/dhclient-enter-hooks.d/samba
> script. On DHCP BOUND event the scripts have equal
> new_netbios_name_servers == old_netbios_name_servers variables.

I can confirm this bug for samba-common 2:3.5.6~dfsg-4 and
isc-dhcp-client 4.1.1-P1-15.

This bug shows up if the lease is RELEASEd AND is still valid upon ifup.
If the lease is not valid upon ifup, dhclient enters the BOUND state
with empty old_* variables: everyting works well in the samba hook.
If the lease is still valid upon ifup and not RELEASEd, dhclient
re-requests it and enters the somewhat special REBOOT state where it
clears the old_* variables: everyting works well in the samba hook.
Unfortunately, Debian's ifdown initiates an DHCPRELEASE. Hence, if the
lease is still valid upon ifup it gets offered to dhclient again and it
enters the BOUND state with filled old_* variables.

The attached patch fixes this issue at least for the empty dhcp.conf
case. It does not fix more complex scenarios where information of
multiple DHCP servers is merged into one dhcp.conf. Hence, the patch
should be considered intermediate - to get it into squeeze, for example.

For a clean fix I'd suggest to always create a complete dhcp.conf (in
/tmp, for example) and to apply a "move and reload if changed" pattern.

Btw.: dhcp.conf should not be located in /etc, this prevents ro-mounted
roots. /var/lib/samba would be a way better place for it.

Thanks for your work & regards
If you think technology can solve your problems you don't understand
technology and you don't understand your problems.
                                -- Bruce Schneier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samba-dhcp-hook.patch
Type: text/x-diff
Size: 481 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20110128/c3f15754/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20110128/c3f15754/attachment.pgp>

More information about the Pkg-samba-maint mailing list