E. Westbrook
2011-Nov-27 02:01 UTC
[Samba] Environment variables in smb.conf -- inconsistent results
Hello! I am trying to use environment variables in my samba configuration file. The %$() directive does not seem to work consistently. Do I misunderstand something? As a success example, "include = %$(SVCDIR)/conf/smb-shares.conf" works fine. Logging with debuglevel = 3 indicates successful inclusion of the secondary file. However, as a failure example, "interfaces = %$(INTERFACES)" does not work at all, and I get an error such as: interpret_string_addr_internal: getaddrinfo failed for name %$(INTERFACES)> [Name or service not known] > interpret_interface: Can't find address for %$(INTERFACES) >As another failure example, pointing to a passdb backend using "passdb backend = tdbsam:%$(SVCDIR)/conf/smbusers" fails to substitute the environment variable similarly, to wit: tdb(unnamed): tdb_open_ex: could not open file %$(SVCDIR)/conf/smbusers: No> such file or directory > Could not open tdb: No such file or directory > tdbsam_open: Failed to open/create TDB passwd [%$(SVCDIR)/conf/smbusers] > tdbsam_getsampwnam: failed to open %$(SVCDIR)/conf/smbusers!What gives? Am I doing something wrong? Shouldn't %$() do a substitution anywhere it is supplied? Thanks, EW PS - Running samba 3.5.11 here.
Jeremy Allison
2011-Nov-28 21:38 UTC
[Samba] Environment variables in smb.conf -- inconsistent results
On Sat, Nov 26, 2011 at 07:01:58PM -0700, E. Westbrook wrote:> Hello! > > I am trying to use environment variables in my samba configuration file. > The %$() directive does not seem to work consistently. Do I misunderstand > something? > > As a success example, "include = %$(SVCDIR)/conf/smb-shares.conf" works > fine. Logging with debuglevel = 3 indicates successful inclusion of the > secondary file. > > However, as a failure example, "interfaces = %$(INTERFACES)" does not work > at all, and I get an error such as: > > interpret_string_addr_internal: getaddrinfo failed for name %$(INTERFACES) > > [Name or service not known] > > interpret_interface: Can't find address for %$(INTERFACES) > > > > As another failure example, pointing to a passdb backend using "passdb > backend = tdbsam:%$(SVCDIR)/conf/smbusers" fails to substitute the > environment variable similarly, to wit: > > tdb(unnamed): tdb_open_ex: could not open file %$(SVCDIR)/conf/smbusers: No > > such file or directory > > Could not open tdb: No such file or directory > > tdbsam_open: Failed to open/create TDB passwd [%$(SVCDIR)/conf/smbusers] > > tdbsam_getsampwnam: failed to open %$(SVCDIR)/conf/smbusers! > > > What gives? Am I doing something wrong? Shouldn't %$() do a substitution > anywhere it is supplied?Yes, it should be. Anything that pulls a parameter through lp_string() should call talloc_sub_basic() which does the environment variable substitutions. Jeremy.