← Back to team overview

enterprise-support team mailing list archive

[Bug 1952633] [NEW] %i token does not expand on 4.13.14+dfsg-0ubuntu0.20.04.2

 

Public bug reported:

%i should expand to the IP address that a smb client is connecting to.
We use this to dynamically include share definitions on servers which
have multiple IP addresses, via a global 'include' config line of the
form:

  include = /path/to/configs/%i

This worked fine on 4.13.14+dfsg-0ubuntu0.20.04.1 but no longer works on
4.13.14+dfsg-0ubuntu0.20.04.2 . (unattended-upgrades upgraded my servers
to 4.13.14+dfsg-0ubuntu0.20.04.2 last week, and we've downgraded and
pinned 4.13.14+dfsg-0ubuntu0.20.04.1 temporarily). In my setup, the
behaviour is that on 4.13.14+dfsg-0ubuntu0.20.04.2 , there are no shares
visible from a client because they're all defined in files that should
be 'include'd.

To confirm the behaviour, I have set up a test samba instance with a
static 'include' (where I hard-code the server IP address rather than
using the %i token) and added a 'root preexec' script in the share
definition which has %i passed:

  root preexec = /data/config/preexec.sh %i

and where preexec.sh is simply "echo $@ >> /tmp/debug.log". On
4.13.14+dfsg-0ubuntu0.20.04.2 the log contains 0.0.0.0 whereas on
4.13.14+dfsg-0ubuntu0.20.04.1 it contains the correctly-expanded IP
address of the samba server.

For comparison, I've built samba-4.13.14 from https://github.com/samba-
team/samba.git tag "samba-4.13.14", db11778b. Using the same config file
as with the Ubuntu packages the dynamic include via %i works correctly -
i.e. my root preexec script logs the correctly-expanded sever IP, and a
client can access the share which is 'include'd via %i.

My test smb.conf is simply the one provided by the Ubuntu packages,
aside from the 'include' and the share definition:

== /etc/samba/smb.conf ==
[global]
   workgroup = WORKGROUP
   server string = %h server (Samba, Ubuntu)
   log file = /var/log/samba/log.%m
   max log size = 1000
   logging = file
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
   usershare allow guests = yes
   include = /data/config/%i/shares

== /data/config/$SERVER_IP/shares ==
[alt36]
        path = /data/alt36
        writeable = yes
        browseable = yes
        guest ok = yes
        root preexec = /data/config/preexec.sh %i

** Affects: samba (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Server/Client Support Team, which is subscribed to samba in Ubuntu.
Matching subscriptions: Ubuntu Server/Client Support Team
https://bugs.launchpad.net/bugs/1952633

Title:
  %i token does not expand on 4.13.14+dfsg-0ubuntu0.20.04.2

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1952633/+subscriptions



Follow ups