Quentin Gibeaux
2014-Jul-15 07:35 UTC
[Samba] samba-tool crashes if include = /patch/to/%U.conf in smb.conf
Hi, Samba4 (4.1.9) on Ubuntu 12.04 here (seen same behavior on 4.1.6 on Ubuntu 14.04). I've encountered an annoying bug with samba-tool, some exceptions aren't caught causing the tool to crash if it finds something it doesn't like in the smb.conf. I have a specific line in my conf : "include = /etc/samba/%U.smb.conf ", it's useful for applying specific samba configuration for a specific user, it works on the samba side, but when samba-tool reads the conf, it crashs : root at server:~/samba# samba-tool user list Processing section "[global]" (?) Can't find include file /etc/samba/%U.smb.conf params.c:pm_process() - Failed. Error returned from params.c:parse(). pm_process() returned No ERROR(runtime): uncaught exception - Unable to load default file File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line 175, in _run return self.run(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/samba/netcmd/user.py", line 261, in run lp = sambaopts.get_loadparm() File "/usr/lib/python2.7/dist-packages/samba/getopt.py", line 92, in get_loadparm self._lp.load_default() In fact it crashes for any include with any variable substitution (%U, %g, %a?). Any ideas ? Thanks, Quentin Gibeaux
Rowland Penny
2014-Jul-15 09:25 UTC
[Samba] samba-tool crashes if include = /patch/to/%U.conf in smb.conf
On 15/07/14 08:35, Quentin Gibeaux wrote:> Hi, > > Samba4 (4.1.9) on Ubuntu 12.04 here (seen same behavior on 4.1.6 on > Ubuntu 14.04). > > I've encountered an annoying bug with samba-tool, some exceptions > aren't caught causing the tool to crash if it finds something it > doesn't like in the smb.conf. > I have a specific line in my conf : "include = /etc/samba/%U.smb.conf > ", it's useful for applying specific samba configuration for a > specific user, it works on the samba side, but when samba-tool reads > the conf, it crashs : > > root at server:~/samba# samba-tool user list > Processing section "[global]" > (?) > Can't find include file /etc/samba/%U.smb.conf > params.c:pm_process() - Failed. Error returned from params.c:parse(). > pm_process() returned No > ERROR(runtime): uncaught exception - Unable to load default file > File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line > 175, in _run > return self.run(*args, **kwargs) > File "/usr/lib/python2.7/dist-packages/samba/netcmd/user.py", line > 261, in run > lp = sambaopts.get_loadparm() > File "/usr/lib/python2.7/dist-packages/samba/getopt.py", line 92, in > get_loadparm > self._lp.load_default() > > In fact it crashes for any include with any variable substitution (%U, > %g, %a?). > > Any ideas ? > > Thanks, > > Quentin GibeauxThe problem here is that samba-tool parses smb.conf even if it doesn't really need to and samba4 doesn't understand %U etc. If you just want a list of users and have ldb-tools installed, try this: ldbsearch -H /var/lib/samba/private/sam.ldb "(&(objectClass=user)(!(objectClass=computer)))" samaccountname | grep sAMAccountName | sed "s|sAMAccountName: ||" Rowland