[Samba] 'samba-tool testparm --section' bugs?

Andrew Bartlett abartlet at samba.org
Tue Sep 24 18:20:56 UTC 2019


On Tue, 2019-09-24 at 17:47 +0100, Rowland penny via samba wrote:
> On 24/09/2019 17:36, Marco Gaiarin via samba wrote:
> > I've coded some scripts that extract some info from a smb.conf
> > section.
> > 
> > In DC works:
> > 
> >   root at vdcsv1:~# samba-tool -V
> >   4.5.16-Debian
> >   root at vdcsv1:~# samba-tool testparm --section sysvol
> >   
> >   [sysvol]
> >   	path = /var/lib/samba/sysvol
> >   	read only = No
> >   root at vdcsv1:~# samba-tool testparm --section-name=sysvol
> >   
> >   [sysvol]
> >   	path = /var/lib/samba/sysvol
> >   	read only = No
> > 
> > 
> > in DM no:
> > 
> >   root at vdmsv1:~# samba-tool -V
> >   4.8.12-Debian
> >   root at vdmsv1:~# samba-tool testparm --section users
> >   ERROR(<type 'exceptions.TypeError'>): uncaught exception -
> >     File "/usr/lib/python2.7/dist-
> > packages/samba/netcmd/__init__.py", line 177, in _run
> >       return self.run(*args, **kwargs)
> >     File "/usr/lib/python2.7/dist-
> > packages/samba/netcmd/testparm.py", line 105, in run
> >       lp[section_name].dump(verbose)
> >   root at vdmsv1:~# samba-tool testparm --section-name=users
> >   ERROR(<type 'exceptions.TypeError'>): uncaught exception -
> >     File "/usr/lib/python2.7/dist-
> > packages/samba/netcmd/__init__.py", line 177, in _run
> >       return self.run(*args, **kwargs)
> >     File "/usr/lib/python2.7/dist-
> > packages/samba/netcmd/testparm.py", line 105, in run
> >       lp[section_name].dump(verbose)
> > 
> > But note that:
> > 
> >   root at vdmsv1:~# samba-tool testparm --section-name=users --
> > parameter-name=path
> >   /home
> > 
> > works.
> > 
> > 
> > I've hit a bug?! Thanks.
> > 

G'Day Marco,

Yes, looks like a bug.  Please file a bug or even better submit a patch
via a GitLab merge request if you can determine what the trouble is. 

It would be very helpful if you could work out what difference causes
the trouble.  The code in question doesn't really know or care about
being a DC or domain member, so it will be something either a bit more

subtle or a bit more silly, like the share name not existing case-wise. 

Particularly if you can work it out, posting both smb.conf files might
help demonstrate if you don't mind.

> No, the last time we discussed 'testparm' vs 'samba-tool testparm',
> we 
> were discussing a DC ;-)
> 
> 'samba-tool testparm' is what is used on a DC
> 
> 'testparm' is what is used all other Samba servers.
> 
> So your command on the Unix Domain member should be:
> 
> testparm --section-name=users --parameter-name=path
> 
> Complicated, isn't it ? ;-)

G'Day Rowland,

Regardless of the use case, both tools should parse the file quite
successfully.  The only exceptions I'm aware of are:
 - the 'registry' configuration, which is only known about by
'testparm'. 
 - include statements that use % modifiers.  Again, these only work in
the file server and so are only known about by testparm.

Otherwise, if there is a behaviour difference it is a bug that should
be fixed. 

Thanks!

Andrew Bartlett
-- 
Andrew Bartlett                       https://samba.org/~abartlet/
Authentication Developer, Samba Team  https://samba.org
Samba Developer, Catalyst IT          
https://catalyst.net.nz/services/samba






More information about the samba mailing list