PATCH: 'source environment' param and % token subs for 'netbios name'

Nicolas Williams Nicolas.Williams at
Fri Jan 28 17:43:33 GMT 2000

Attached please find unified diffs against Samba 2.0.6. I'm hoping that
others will find it useful and that it may even find its way into Samba

This patch does two things:

 - Modifies the handling of the 'netbios name' parameter so that
   standard_sub_basic() is run on its value when the 'netbios name'
   parameter is processed.

   This has to be done this way because the netbios name is accessed via
   the global_myname variable throughout Samba and not via

 - Adds a new parameter called 'source environment' which takes a path
   or a pipe command whose last character is '|' and does just what you
   would expect: calls putenv() on each line read from the given


 - Where I work we like to have a centrally distributed standard set of
   Samba configuration files with certain parameters' values being set
   from environment variables (netbios name is set with the -n command
   line argument to nmbd). So far we've used shell scripts to start/stop
   Samba with the necessary environment set.

   This approach makes it easier to prevent newbies from configuring
   Samba servers as PDCs.

 - The patch for netbios name handling will simplify these scripts and
   make Samba configuration more consistent.

 - Using %$() token substitution for configuring the most important
   paramters related to a server's identity simplifies sever
   configuration by allowing us to have a simple /etc/smb.conf.env file
   that all sysadmins can easily understand.

   [On our Sun w/ Veritas HA servers the configuration lives in
    /opt/VRTSfw/env/ha.env and the personality-specific variables are
    prefixed with 'PRIMARY_' or 'TAKEOVER_' and the Veritas startup
    script for Samba (which we wrote) takes care of the rest.]

 - The source environment patch will simplify our scripts trememndously.

 - Also, on our HA servers it's possible to have two Samba personalities
   running at the same time (one system fails and the other takes over
   -- we setup our home dir and applications file servers to do HA
   backup for each other -- we use the interfaces paramters to do this).

   Since Samba's config file path is statically compiled in we have to
   either really on the -s command-line option or %$() token
   substitution. We prefer the latter approach.

With this patch we can have a simple /etc/smb.conf.env on our standalone
Samba fileservers and a simple /etc/ script on our HA servers
(the latter will use a single environment variable to select a
personality to configure).


This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

More information about the samba-technical mailing list