summaryrefslogtreecommitdiff
path: root/examples/scripts/shares
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-07-12 16:34:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:59:56 -0500
commitb99ae5137471fad034dc7e98bc60cd2dc893b631 (patch)
treef1307088838e9490b1ed7a4e04f4eb8d9e330839 /examples/scripts/shares
parentcfda53db8b22c7afbfae848506258f13ead041bf (diff)
downloadsamba-b99ae5137471fad034dc7e98bc60cd2dc893b631.tar.gz
samba-b99ae5137471fad034dc7e98bc60cd2dc893b631.tar.bz2
samba-b99ae5137471fad034dc7e98bc60cd2dc893b631.zip
r8384: merging clutter fixes from release branch
(This used to be commit cbe74c09109dcfe93aa4af085920999ccbff34df)
Diffstat (limited to 'examples/scripts/shares')
-rwxr-xr-xexamples/scripts/shares/perl/modify_samba_config.pl154
-rw-r--r--examples/scripts/shares/python/SambaConfig.py315
-rw-r--r--examples/scripts/shares/python/SambaParm.py84
-rwxr-xr-xexamples/scripts/shares/python/generate_parm_table.py224
-rwxr-xr-xexamples/scripts/shares/python/modify_samba_config.py78
-rw-r--r--examples/scripts/shares/python/smbparm.py374
6 files changed, 1229 insertions, 0 deletions
diff --git a/examples/scripts/shares/perl/modify_samba_config.pl b/examples/scripts/shares/perl/modify_samba_config.pl
new file mode 100755
index 0000000000..ad958625d6
--- /dev/null
+++ b/examples/scripts/shares/perl/modify_samba_config.pl
@@ -0,0 +1,154 @@
+#!/usr/bin/perl
+
+##
+## Simple example of how to implement a '[add|delete] share command' for
+## use with the Windows NT Server Manager. See smb.conf(5) for details
+## on the '[add|delete] share command'
+##
+## Author : Gerald (Jerry) Carter <jerry@samba.org>
+##
+
+use POSIX qw(tmpnam);
+
+##
+## local variables
+##
+my $delete_mode = undef;
+my $add_mode = undef;
+my $tmp_file_name = undef;
+
+
+## check for correct parameters
+if ($#ARGV == 1) {
+ $delete_mode = 1;
+}
+elsif ($#ARGV == 3) {
+ $add_mode = 1;
+}
+else {
+ print "Usage: $0 configfile share [path] [comment]\n";
+ exit -1;
+}
+
+## first param is always the config file
+open (CONFIGFILE, "$ARGV[0]") || die "Unable to open $ARGV[0] for reading!\n";
+
+## FIXME!! Right now we throw away all comments in the file.
+while (<CONFIGFILE>) {
+
+ chomp($_);
+
+ ## eat leading whitespace
+ $_ =~ s/^\s*//;
+
+ ## eat trailing whitespace
+ $_ =~ s/\s*$//;
+
+
+ ## throw away comments
+ next if (($_ =~ /^#/) || ($_ =~ /^;/));
+
+ ## set the current section name for storing the hash
+ if ($_ =~ /^\[.*\]$/) {
+
+ $_ = substr($_, 1, length($_)-2);
+
+ if ( length($_) ) {
+ $section = $_;
+ }
+ else {
+ print "Bad Section Name - no closing ]\n";
+ exit -1;
+ }
+
+ next;
+ }
+
+ ## check for a param = value
+ if ($_ =~ /=/) {
+ ($param, $value) = split (/=/, $_,2);
+ $param =~ s/./\l$&/g;
+ $param =~ s/\s+//g;
+ $value =~ s/^\s+//;
+
+ $config{$section}{$param} = $value;
+
+ next;
+ }
+
+ ## should have a hash of hashes indexed by section name
+}
+close (CONFIGFILE);
+
+##
+## We have the smb.conf in our hash of hashes now.
+## Add or delete
+##
+if ($add_mode) {
+ $config{$ARGV[1]}{'path'} = $ARGV[2];
+ $config{$ARGV[1]}{'comment'} = $ARGV[3];
+}
+elsif ($delete_mode) {
+ delete $config{$ARGV[1]};
+}
+
+##
+## Print the resulting configuration
+##
+#do {
+# $tmp_file_name = tmpnam();
+# print "Using temporary file - $tmp_file_name\n";
+#} while (!sysopen(TMP, $tmp_file_name, O_RDWR|O_CREAT|O_EXCL));
+$tmp_file_name = tmpnam();
+open (TMP, ">$tmp_file_name") || die "Unable to open temporary file for writing!\n";
+
+PrintConfigFile(TMP);
+
+## now overwrite the original config file
+close (TMP);
+system ("cp -pf $ARGV[0] $ARGV[0].bak");
+system ("cp -pf $tmp_file_name $ARGV[0]");
+unlink $tmp_file_name;
+
+
+exit 0;
+
+
+
+
+
+#######################################################################################
+## PrintConfigFile()
+##
+sub PrintConfigFile {
+ my ($output) = @_;
+
+ ## print the file back out, beginning with the global section
+ print $output "#\n# Generated by $0\n#\n";
+
+ PrintSection ($output, 'global', $config{'global'});
+
+ foreach $section (keys %config) {
+
+ if ("$section" ne "global") {
+ print $output "## Section - [$section]\n";
+ PrintSection ($output, $section, $config{$section});
+ }
+ }
+
+ print $output "#\n# end of generated smb.conf\n#\n";
+}
+
+#######################################################################################
+## PrintSection()
+##
+sub PrintSection {
+ my ($outfile, $name, $section) = @_;
+
+ print $outfile "[$name]\n";
+ foreach $param (keys %$section) {
+ print $outfile "\t$param".' 'x(25-length($param)). " = $$section{$param}\n";
+ }
+ print $outfile "\n";
+
+}
diff --git a/examples/scripts/shares/python/SambaConfig.py b/examples/scripts/shares/python/SambaConfig.py
new file mode 100644
index 0000000000..c70c23118a
--- /dev/null
+++ b/examples/scripts/shares/python/SambaConfig.py
@@ -0,0 +1,315 @@
+import sys, string, SambaParm
+from smbparm import parm_table
+
+######################################################################
+##
+## smb.conf parser class
+##
+## Copyright (C) Gerald Carter 2004.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+######################################################################
+
+
+#####################################################################
+## multi line Samba comment
+class SambaComment:
+
+ def __init__( self, comment ):
+ self.comment = comment
+
+ def Dump( self, stream, whitespace=None ):
+ if not self.comment:
+ return
+ for line in self.comment:
+ if whitespace:
+ stream.write( whitespace )
+ stream.write( line )
+ stream.write( "\n" )
+
+
+#####################################################################
+## string smb.conf parms
+class SambaParameter :
+
+ ## indexs into the parm table tuples
+ DisplayName = 0
+ ObjectType = 1
+ DefaultValue = 2
+ Scope = 3
+
+ ## Stores a key into the parm_table and creates an
+ ## SambaParmXXX object to store the value
+ def __init__( self, name, value, comment=None ):
+ self.key = string.upper(string.strip(name))
+ self.comment = None
+ assert parm_table.has_key( self.key ), "Bad parameter name! [%s]" % name
+ self.parm = parm_table[self.key][self.ObjectType]( value )
+ if comment :
+ self.comment = SambaComment( comment )
+
+ #if not self.parm.valid:
+ # self.parm.SetValue( parm_table[self.key][self.DefaultValue] )
+
+ ## simple test for global or service parameter scope
+ def isGlobalParm( self ) :
+ return parm_table[self.key][Scope]
+
+ ## dump <the parameter to stdout
+ def Dump( self, stream ):
+ if self.comment:
+ self.comment.Dump( stream, "\t" )
+ stream.write( "\t%s = %s\n" % ( parm_table[self.key][self.DisplayName], self.parm.StringValue() ))
+
+
+#####################################################################
+## Class for parsing and modifying Smb.conf
+class SambaConf:
+
+ def __init__( self ):
+ self.services = {}
+ self.valid = True
+ self.services["GLOBAL"] = {}
+ self.services_order = []
+
+
+ ## always return a non-empty line of input or None
+ ## if we hit EOF
+ def ReadLine( self, stream ):
+ result = None
+ input_str = None
+
+ while True:
+ input_str = stream.readline()
+
+ ## Are we done with the file ?
+
+ if len(input_str) == 0:
+ return result
+
+ ## we need one line of valid input at least
+ ## continue around the loop again if the result
+ ## string is empty
+
+ input_str = string.strip( input_str )
+ if len(input_str) == 0:
+ if not result:
+ continue
+ else:
+ return result
+
+ ## we have > 1` character so setup the result
+ if not result:
+ result = ""
+
+ ## Check for comments -- terminated by \n -- no continuation
+
+ if input_str[0] == '#' or input_str[0] == ';' :
+ result = input_str
+ break
+
+ ## check for line continuation
+
+ if input_str[-1] == "\\" :
+ result += input_str[0:-1]
+ contine
+
+ ## otherwise we have a complete line
+ result += input_str
+ break
+
+ return result
+
+ ## convert the parameter name to a form suitable as a dictionary key
+ def NormalizeParamName( self, param ):
+ return string.upper( string.join(string.split(param), "") )
+
+ ## Open the file and parse it into a services dictionary
+ ## if possible
+ def ReadConfig( self, filename ):
+ self.filename = filename
+
+ try:
+ fconfig = open( filename, "r" )
+ except IOError:
+ self.valid = False
+ return
+
+ section_name = None
+
+ ## the most recent seen comment is stored as an array
+ current_comment = []
+
+ while True:
+
+ str = self.ReadLine( fconfig )
+ if not str:
+ break
+
+ ## Check for comments
+ if str[0] == '#' or str[0] == ';' :
+ current_comment.append( str )
+ continue
+
+ ## look for a next section name
+ if str[0]=='[' and str[-1]==']' :
+ section_name = str[1:-1]
+ self.AddService( section_name, current_comment )
+ current_comment = []
+ continue
+
+ str_list = string.split( str, "=" )
+
+ if len(str_list) != 2 :
+ continue
+
+ if not section_name :
+ print "parameter given without section name!"
+ break
+
+ param = self.NormalizeParamName( str_list[0] )
+ value = string.strip(str_list[1])
+
+ self.SetServiceOption( section_name, param, value, current_comment )
+ self.dirty = False
+
+ ## reset the comment strinf if we have one
+ current_comment = []
+
+ fconfig.close()
+
+ ## Add a parameter to the global section
+ def SetGlobalOption( self, param, value, comment=None ) :
+ self.SetServiceOption( "GLOBAL", param, value, comment )
+
+ ## Add a parameter to a specific service
+ def SetServiceOption( self, servicename, param, value, comment=None ) :
+ service = string.upper(servicename)
+ parm = self.NormalizeParamName(param)
+ self.services[service]['_order_'].append( parm )
+ self.services[service][parm] = SambaParameter( parm, value, comment )
+ self.dirty = True
+
+ ## remove a service from the config file
+ def DelService( self, servicename ) :
+ service = string.upper(servicename)
+ self.services[service] = None
+ self.dirty = True
+
+ ## remove a service from the config file
+ def AddService( self, servicename, comment=None ) :
+ service = string.upper(servicename)
+
+ self.services[service] = {}
+ self.services[service]['_order_'] = []
+
+ if ( comment ):
+ self.services[service]['_comment_'] = SambaComment( comment )
+
+ self.services_order.append( service )
+
+ self.dirty = True
+
+ def isService( self, servicename ):
+ service = string.upper(servicename)
+ return self.services.has_key( service )
+
+ ## dump a single service to stream
+ def DumpService( self, stream, servicename ):
+
+ ## comments first
+ if self.services[servicename].has_key( '_comment_' ):
+ self.services[servicename]['_comment_'].Dump( stream )
+
+ ## section header
+ stream.write( "[%s]\n" % (servicename) )
+
+ ## parameter = value
+ for parm in self.services[servicename]['_order_']:
+ self.services[servicename][parm].Dump(stream)
+
+ ## dump the config to stream
+ def Dump( self, stream ):
+ self.DumpService( stream, "GLOBAL" )
+ stream.write("\n")
+
+ for section in self.services_order:
+ ## already handled the global section
+ if section == "GLOBAL":
+ continue
+
+ ## check for deleted sections ##
+ if not self.services[section]:
+ continue
+
+ self.DumpService( stream, section )
+ stream.write( "\n" )
+
+ ## write out any changes to disk
+ def Flush( self ):
+ if not self.dirty:
+ return
+
+ try:
+ fconfig = open( self.filename, "w" )
+ except IOError:
+ sys.stderr.write( "ERROR!\n" )
+ return 1
+
+ self.Dump( fconfig )
+ fconfig.close()
+ return 0
+
+ def Services( self ):
+ service_list = []
+ for section in self.services.keys():
+ service_list.append( section )
+
+ return service_list
+
+ def NumServices( self ):
+ return len(self.Services())
+
+ def Write( self, filename ):
+ self.filename = filename
+ self.valid = True
+
+ if not self.dirty:
+ return
+
+ self.Flush()
+
+
+
+######################################################################
+## Unit tests
+######################################################################
+
+if __name__ == "__main__" :
+
+ x = SambaConf( )
+ x.ReadConfig( sys.argv[1] )
+ if not x.valid :
+ print "Bad file!"
+ sys.exit(1)
+
+ x.Dump( sys.stdout )
+
+
+
+## end of SambaConfig.py ######################################################
+###############################################################################
+
diff --git a/examples/scripts/shares/python/SambaParm.py b/examples/scripts/shares/python/SambaParm.py
new file mode 100644
index 0000000000..292ad42cd2
--- /dev/null
+++ b/examples/scripts/shares/python/SambaParm.py
@@ -0,0 +1,84 @@
+######################################################################
+##
+## smb.conf parameter classes
+##
+## Copyright (C) Gerald Carter 2004.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+######################################################################
+
+import string
+
+#####################################################################
+## Base class for Samba smb.conf parameters
+class SambaParm :
+ def __init__( self ) :
+ pass
+
+ def StringValue( self ) :
+ return self.value
+
+#####################################################################
+## Boolean smb,conf parm
+class SambaParmBool( SambaParm ):
+ def __init__( self, value ) :
+ x = string.upper(value)
+ self.valid = True
+
+ if x=="YES" or x=="TRUE" or x=="1":
+ self.value = True
+ elif x=="NO" or x=="FALSE" or x=="0":
+ self.value = False
+ else:
+ self.valid = False
+ return self
+
+ def SetValue( self, value ) :
+ x = string.upper(value)
+ self.valid = True
+
+ if x=="YES" or x=="TRUE" or x=="1":
+ self.value = True
+ elif x=="NO" or x=="FALSE" or x=="0":
+ self.value = False
+ else:
+ self.valid = False
+ return
+
+ def StringValue( self ) :
+ if self.value :
+ return "yes"
+ else:
+ return "no"
+
+#####################################################################
+## Boolean smb,conf parm (inverts)
+class SambaParmBoolRev( SambaParmBool ) :
+ def __init__( self, value ):
+ SambaParmBool.__init__( self, value )
+ if self.valid :
+ self.value = not self.value
+
+
+#####################################################################
+## string smb.conf parms
+class SambaParmString( SambaParm ):
+ def __init__( self, value ):
+ self.value = value
+ self.valid = True
+
+
+
diff --git a/examples/scripts/shares/python/generate_parm_table.py b/examples/scripts/shares/python/generate_parm_table.py
new file mode 100755
index 0000000000..1dbc071e9b
--- /dev/null
+++ b/examples/scripts/shares/python/generate_parm_table.py
@@ -0,0 +1,224 @@
+#!/usr/bin/env python
+######################################################################
+##
+## Generate parameter dictionary from param/loadparm.c
+##
+## Copyright (C) Gerald Carter 2004.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+######################################################################
+
+import re, string, sys, commands
+
+HEADER = """######################################################################
+##
+## autogenerated file of smb.conf parameters
+## generate_parm_table <..../param/loadparm.c>
+##
+## Copyright (C) Gerald Carter 2004.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+######################################################################
+
+from SambaParm import SambaParmString, SambaParmBool, SambaParmBoolRev
+
+## boolean defines for parm_table
+P_LOCAL = 0
+P_GLOBAL = 1
+
+"""
+
+FOOTER = """##### end of smbparm.y ##########################################
+#################################################################"""
+
+TESTPARM = "/usr/bin/testparm"
+
+## fields in Samba's parameter table
+displayName = 0
+type = 1
+scope = 2
+variable = 3
+flags = 6
+
+parm_table = {}
+var_table = {}
+def_values = {}
+obj_table = {
+ 'P_BOOL' : 'SambaParmBool',
+ 'P_BOOLREV' : 'SambaParmBoolRev',
+ 'P_STRING' : 'SambaParmString',
+ 'P_USTRING' : 'SambaParmString',
+ 'P_GSTRING' : 'SambaParmString',
+ 'P_LIST' : 'SambaParmString',
+ 'P_ENUM' : 'SambaParmString',
+ 'P_CHAR' : 'SambaParmString',
+ 'P_OCTAL' : 'SambaParmString',
+ 'P_INTEGER' : 'SambaParmString',
+}
+
+######################################################################
+## BEGIN MAIN CODE ##
+######################################################################
+
+## First thing is to build the dictionary of parmeter names ##
+## based on the output from testparm ##
+
+cmd = "/usr/bin/testparm -s -v /dev/null"
+( status, testparm_output ) = commands.getstatusoutput( cmd )
+if status:
+ sys.stderr.write( "Failed to execute testparm!\n%s\n" % testparm_output )
+
+
+## break the output into a list ##
+
+lines = string.split( testparm_output, "\n" )
+
+## loop through list -- parameters in testparm output have ##
+## whitespace at the beginning of the line ##
+
+pattern = re.compile( "^\s+" )
+for input_str in lines:
+ if not pattern.search( input_str ):
+ continue
+ input_str = string.strip( input_str )
+ parts = string.split( input_str, "=" )
+ parts[0] = string.strip( parts[0] )
+ parts[1] = string.strip( parts[1] )
+ key = string.upper( string.join(string.split(parts[0]), "") )
+ new = parts[1].replace('\\', '\\\\')
+ def_values[key] = new
+
+## open loadparm.c and get the entire list of parameters ##
+## including synonums ##
+
+if len(sys.argv) != 2:
+ print "Usage: %s <.../param/loadparm.c>" % ( sys.argv[0] )
+ sys.exit( 1 )
+
+try:
+ fconfig = open( sys.argv[1], "r" )
+except IOError:
+ print "%s does not exist!" % sys.argv[1]
+ sys.exit (1)
+
+## Loop through loadparm.c -- all parameters are either ##
+## P_LOCAL or P_GLOBAL ##
+
+synonyms = []
+pattern = re.compile( '{".*P_[GL]' )
+while True:
+ input_str= fconfig.readline()
+ if len(input_str) == 0 :
+ break
+ input_str= string.strip(input_str)
+
+ ## see if we have a patch for a parameter definition ##
+
+ parm = []
+ if pattern.search( input_str) :
+
+ ## strip the surrounding '{.*},' ##
+
+ input_str= input_str[1:-2]
+ parm = string.split(input_str, ",")
+
+ ## strip the ""'s and upper case ##
+
+ name = (string.strip(parm[displayName])[1:-1])
+ key = string.upper( string.join(string.split(name), "") )
+ var_name = string.strip( parm[variable] )
+
+
+ ## try to catch synonyms -- if the parameter was not reported ##
+ ## by testparm, then save it and come back after we will out ##
+ ## the variable list ##
+
+ if not def_values.has_key( key ):
+ synonyms.append( input_str)
+ continue
+
+
+ var_table[var_name] = key
+
+ parmType = string.strip(parm[type])
+
+ parm_table[key] = [ name , string.strip(parm[type]), string.strip(parm[scope]), def_values[key] ]
+
+## Deal with any synonyms ##
+
+for input_str in synonyms:
+ parm = string.split(input_str, ",")
+ name = (string.strip(parm[displayName])[1:-1])
+ key = string.upper( string.join(string.split(name), "") )
+ var_name = string.strip( parm[variable] )
+
+ ## if there's no pre-existing key, then testparm doesn't know about it
+ if not var_table.has_key( var_name ):
+ continue
+
+ ## just make a copy
+ parm_table[key] = parm_table[var_table[var_name]][:]
+ # parm_table[key][1] = parm[1]
+ parm_table[key][1] = string.strip(parm[1])
+
+## ##
+## print out smbparm.py ##
+## ##
+
+try:
+ smbparm = open ( "smbparm.py", "w" )
+except IOError:
+ print "Cannot write to smbparm.py"
+ sys.exit( 1 )
+
+smbparm.write( HEADER )
+smbparm.write( "parm_table = {\n" )
+
+for x in parm_table.keys():
+ key = "\"%s\"" % x
+ smbparm.write("\t%-25s: (\"%s\", %s, %s, \"%s\"),\n" % ( key, parm_table[x][0],
+ obj_table[parm_table[x][1]], parm_table[x][2], parm_table[x][3] ))
+
+smbparm.write( "}\n" )
+
+smbparm.write( FOOTER )
+smbparm.write( "\n" )
+
+sys.exit(0)
+
+
+## ##
+## cut-n-paste area ##
+## ##
+
+for x in parm_table.keys():
+ if def_values.has_key( x ):
+ parm_table[x].append( def_values[x] )
+ else:
+ parm_table[x].append( "" )
diff --git a/examples/scripts/shares/python/modify_samba_config.py b/examples/scripts/shares/python/modify_samba_config.py
new file mode 100755
index 0000000000..6a4cdcab79
--- /dev/null
+++ b/examples/scripts/shares/python/modify_samba_config.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+######################################################################
+##
+## Simple add/delete/change share command script for Samba
+##
+## Copyright (C) Gerald Carter 2004.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+######################################################################
+
+import sys, os
+from SambaConfig import SambaConf
+
+
+## ##
+## check the command line args ##
+## ##
+delete_mode = False
+if len(sys.argv) == 3:
+ delete_mode = True
+ print "Deleting share..."
+elif len(sys.argv) == 5:
+ print "Adding/Updating share..."
+else:
+ print "Usage: %s configfile share [path] [comments]" % sys.argv[0]
+ sys.exit(1)
+
+
+## ##
+## read and parse the config file ##
+## ##
+
+confFile = SambaConf()
+
+confFile.ReadConfig( sys.argv[1] )
+if not confFile.valid:
+ exit( 1 )
+
+if delete_mode:
+ if not confFile.isService( sys.argv[2] ):
+ sys.stderr.write( "Asked to delete non-existent service! [%s]\n" % sys.argv[2] )
+ sys.exit( 1 )
+
+ confFile.DelService( sys.argv[2] )
+else:
+ ## make the path if it doesn't exist. Bail out if that fails
+ if ( not os.path.isdir(sys.argv[3]) ):
+ try:
+ os.makedirs( sys.argv[3] )
+ os.chmod( sys.argv[3], 0777 )
+ except os.error:
+ sys.exit( 1 )
+
+ ## only add a new service -- if it already exists, then
+ ## just set the options
+ if not confFile.isService( sys.argv[2] ):
+ confFile.AddService( sys.argv[2], ['##', '## Added by modify_samba_config.py', '##'] )
+ confFile.SetServiceOption( sys.argv[2], "path", sys.argv[3] )
+ confFile.SetServiceOption( sys.argv[2], "comment", sys.argv[4] )
+ confFile.SetServiceOption( sys.argv[2], "read only", "no" )
+
+ret = confFile.Flush()
+
+sys.exit( ret )
+
diff --git a/examples/scripts/shares/python/smbparm.py b/examples/scripts/shares/python/smbparm.py
new file mode 100644
index 0000000000..0dfcf0062e
--- /dev/null
+++ b/examples/scripts/shares/python/smbparm.py
@@ -0,0 +1,374 @@
+######################################################################
+##
+## autogenerated file of smb.conf parameters
+## generate_parm_table <..../param/loadparm.c>
+##
+## Copyright (C) Gerald Carter 2004.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+######################################################################
+
+from SambaParm import SambaParmString, SambaParmBool, SambaParmBoolRev
+
+## boolean defines for parm_table
+P_LOCAL = 0
+P_GLOBAL = 1
+
+parm_table = {
+ "PRELOADMODULES" : ("preload modules", SambaParmString, P_GLOBAL, ""),
+ "ONLYGUEST" : ("guest only", SambaParmBool, P_LOCAL, "No"),
+ "PRIVATEDIR" : ("private dir", SambaParmString, P_GLOBAL, "/etc/samba/private"),
+ "HIDESPECIALFILES" : ("hide special files", SambaParmBool, P_LOCAL, "No"),
+ "WINBINDENUMUSERS" : ("winbind enum users", SambaParmBool, P_GLOBAL, "Yes"),
+ "TIMESTAMPLOGS" : ("debug timestamp", SambaParmBool, P_GLOBAL, "Yes"),
+ "LDAPPASSWDSYNC" : ("ldap passwd sync", SambaParmString, P_GLOBAL, "no"),
+ "READBMPX" : ("read bmpx", SambaParmBool, P_GLOBAL, "No"),
+ "PASSWORDSERVER" : ("password server", SambaParmString, P_GLOBAL, "*"),
+ "COPY" : ("copy", SambaParmString, P_LOCAL, ""),
+ "MAXXMIT" : ("max xmit", SambaParmString, P_GLOBAL, "16644"),
+ "MINPRINTSPACE" : ("min print space", SambaParmString, P_LOCAL, "0"),
+ "CASESENSITIVE" : ("case sensitive", SambaParmString, P_LOCAL, "Auto"),
+ "LDAPIDMAPSUFFIX" : ("ldap idmap suffix", SambaParmString, P_GLOBAL, ""),
+ "NAMECACHETIMEOUT" : ("name cache timeout", SambaParmString, P_GLOBAL, "660"),
+ "MAPARCHIVE" : ("map archive", SambaParmBool, P_LOCAL, "Yes"),
+ "LANMANAUTH" : ("lanman auth", SambaParmBool, P_GLOBAL, "Yes"),
+ "NETBIOSSCOPE" : ("netbios scope", SambaParmString, P_GLOBAL, ""),
+ "MAXREPORTEDPRINTJOBS" : ("max reported print jobs", SambaParmString, P_LOCAL, "0"),
+ "CREATEMODE" : ("create mask", SambaParmString, P_LOCAL, "0744"),
+ "READLIST" : ("read list", SambaParmString, P_LOCAL, ""),
+ "WINBINDNESTEDGROUPS" : ("winbind nested groups", SambaParmBool, P_GLOBAL, "No"),
+ "COMMENT" : ("comment", SambaParmString, P_LOCAL, ""),
+ "PRINTER" : ("printer name", SambaParmString, P_LOCAL, ""),
+ "LMANNOUNCE" : ("lm announce", SambaParmString, P_GLOBAL, "Auto"),
+ "SYSLOGONLY" : ("syslog only", SambaParmBool, P_GLOBAL, "No"),
+ "LMINTERVAL" : ("lm interval", SambaParmString, P_GLOBAL, "60"),
+ "MANGLINGMETHOD" : ("mangling method", SambaParmString, P_GLOBAL, "hash2"),
+ "PROFILEACLS" : ("profile acls", SambaParmBool, P_LOCAL, "No"),
+ "LDAPGROUPSUFFIX" : ("ldap group suffix", SambaParmString, P_GLOBAL, ""),
+ "MAPTOGUEST" : ("map to guest", SambaParmString, P_GLOBAL, "Never"),
+ "NULLPASSWORDS" : ("null passwords", SambaParmBool, P_GLOBAL, "No"),
+ "ONLYUSER" : ("only user", SambaParmBool, P_LOCAL, "No"),
+ "UTMP" : ("utmp", SambaParmBool, P_GLOBAL, "No"),
+ "DONTDESCEND" : ("dont descend", SambaParmString, P_LOCAL, ""),
+ "PRINTING" : ("printing", SambaParmString, P_LOCAL, "cups"),
+ "SOCKETOPTIONS" : ("socket options", SambaParmString, P_GLOBAL, "TCP_NODELAY"),
+ "CLIENTUSESPNEGO" : ("client use spnego", SambaParmBool, P_GLOBAL, "Yes"),
+ "USESPNEGO" : ("use spnego", SambaParmBool, P_GLOBAL, "Yes"),
+ "FAKEOPLOCKS" : ("fake oplocks", SambaParmBool, P_LOCAL, "No"),
+ "FORCECREATEMODE" : ("force create mode", SambaParmString, P_LOCAL, "00"),
+ "SETDIRECTORY" : ("set directory", SambaParmBoolRev, P_LOCAL, "No"),
+ "SMBPORTS" : ("smb ports", SambaParmString, P_GLOBAL, "445 139"),
+ "LOCKDIR" : ("lock directory", SambaParmString, P_GLOBAL, "/var/lib/samba"),
+ "BROWSEABLE" : ("browseable", SambaParmBool, P_LOCAL, "Yes"),
+ "WINSPROXY" : ("wins proxy", SambaParmBool, P_GLOBAL, "No"),
+ "FORCEGROUP" : ("force group", SambaParmString, P_LOCAL, ""),
+ "NTSTATUSSUPPORT" : ("nt status support", SambaParmBool, P_GLOBAL, "Yes"),
+ "EXEC" : ("preexec", SambaParmString, P_LOCAL, ""),
+ "DOMAINLOGONS" : ("domain logons", SambaParmBool, P_GLOBAL, "No"),
+ "TEMPLATESHELL" : ("template shell", SambaParmString, P_GLOBAL, "/bin/false"),
+ "USESENDFILE" : ("use sendfile", SambaParmBool, P_LOCAL, "No"),
+ "USEMMAP" : ("use mmap", SambaParmBool, P_GLOBAL, "Yes"),
+ "VALIDUSERS" : ("valid users", SambaParmString, P_LOCAL, ""),
+ "DEBUGLEVEL" : ("log level", SambaParmString, P_GLOBAL, "0"),
+ "PRINTCAPCACHETIME" : ("printcap cache time", SambaParmString, P_GLOBAL, "0"),
+ "SOCKETADDRESS" : ("socket address", SambaParmString, P_GLOBAL, "0.0.0.0"),
+ "FORCEDIRECTORYMODE" : ("force directory mode", SambaParmString, P_LOCAL, "00"),
+ "MSDFSROOT" : ("msdfs root", SambaParmBool, P_LOCAL, "No"),
+ "ROOTPREEXEC" : ("root preexec", SambaParmString, P_LOCAL, ""),
+ "WRITEOK" : ("read only", SambaParmBoolRev, P_LOCAL, "Yes"),
+ "MAXLOGSIZE" : ("max log size", SambaParmString, P_GLOBAL, "5000"),
+ "FORCESECURITYMODE" : ("force security mode", SambaParmString, P_LOCAL, "00"),
+ "VFSOBJECT" : ("vfs objects", SambaParmString, P_LOCAL, ""),
+ "CHECKPASSWORDSCRIPT" : ("check password script", SambaParmString, P_GLOBAL, ""),
+ "DELETEPRINTERCOMMAND" : ("deleteprinter command", SambaParmString, P_GLOBAL, ""),
+ "OSLEVEL" : ("os level", SambaParmString, P_GLOBAL, "20"),
+ "ENUMPORTSCOMMAND" : ("enumports command", SambaParmString, P_GLOBAL, ""),
+ "DELETEUSERFROMGROUPSCRIPT": ("delete user from group script", SambaParmString, P_GLOBAL, ""),
+ "IDMAPGID" : ("idmap gid", SambaParmString, P_GLOBAL, ""),
+ "PREEXECCLOSE" : ("preexec close", SambaParmBool, P_LOCAL, "No"),
+ "UTMPDIRECTORY" : ("utmp directory", SambaParmString, P_GLOBAL, ""),
+ "DOSFILEMODE" : ("dos filemode", SambaParmBool, P_LOCAL, "No"),
+ "LOGFILE" : ("log file", SambaParmString, P_GLOBAL, ""),
+ "WORKGROUP" : ("workgroup", SambaParmString, P_GLOBAL, "WORKGROUP"),
+ "DIRECTORYSECURITYMASK" : ("directory security mask", SambaParmString, P_LOCAL, "0777"),
+ "ENCRYPTPASSWORDS" : ("encrypt passwords", SambaParmBool, P_GLOBAL, "Yes"),
+ "PRINTABLE" : ("printable", SambaParmBool, P_LOCAL, "No"),
+ "MAXPROTOCOL" : ("max protocol", SambaParmString, P_GLOBAL, "NT1"),
+ "KERNELOPLOCKS" : ("kernel oplocks", SambaParmBool, P_GLOBAL, "Yes"),
+ "NETBIOSALIASES" : ("netbios aliases", SambaParmString, P_GLOBAL, ""),
+ "ANNOUNCEAS" : ("announce as", SambaParmString, P_GLOBAL, "NT"),
+ "DIRECTORYMASK" : ("directory mask", SambaParmString, P_LOCAL, "0755"),
+ "MAPSYSTEM" : ("map system", SambaParmBool, P_LOCAL, "No"),
+ "CHANGENOTIFYTIMEOUT" : ("change notify timeout", SambaParmString, P_GLOBAL, "60"),
+ "WINBINDTRUSTEDDOMAINSONLY": ("winbind trusted domains only", SambaParmBool, P_GLOBAL, "No"),
+ "SHUTDOWNSCRIPT" : ("shutdown script", SambaParmString, P_GLOBAL, ""),
+ "FOLLOWSYMLINKS" : ("follow symlinks", SambaParmBool, P_LOCAL, "Yes"),
+ "MAPHIDDEN" : ("map hidden", SambaParmBool, P_LOCAL, "No"),
+ "GROUP" : ("force group", SambaParmString, P_LOCAL, ""),
+ "DENYHOSTS" : ("hosts deny", SambaParmString, P_LOCAL, ""),
+ "WINBINDCACHETIME" : ("winbind cache time", SambaParmString, P_GLOBAL, "300"),
+ "DELETEVETOFILES" : ("delete veto files", SambaParmBool, P_LOCAL, "No"),
+ "DISABLESPOOLSS" : ("disable spoolss", SambaParmBool, P_GLOBAL, "No"),
+ "MAXCONNECTIONS" : ("max connections", SambaParmString, P_LOCAL, "0"),
+ "WRITERAW" : ("write raw", SambaParmBool, P_GLOBAL, "Yes"),
+ "SERVERSIGNING" : ("server signing", SambaParmString, P_GLOBAL, "No"),
+ "VOLUME" : ("volume", SambaParmString, P_LOCAL, ""),
+ "UNIXPASSWORDSYNC" : ("unix password sync", SambaParmBool, P_GLOBAL, "No"),
+ "OBEYPAMRESTRICTIONS" : ("obey pam restrictions", SambaParmBool, P_GLOBAL, "No"),
+ "PASSWDCHATTIMEOUT" : ("passwd chat timeout", SambaParmString, P_GLOBAL, "2"),
+ "USER" : ("username", SambaParmString, P_LOCAL, ""),
+ "HIDEDOTFILES" : ("hide dot files", SambaParmBool, P_LOCAL, "Yes"),
+ "ROOTPOSTEXEC" : ("root postexec", SambaParmString, P_LOCAL, ""),
+ "PROTOCOL" : ("max protocol", SambaParmString, P_GLOBAL, "NT1"),
+ "LDAPADMINDN" : ("ldap admin dn", SambaParmString, P_GLOBAL, ""),
+ "DNSPROXY" : ("dns proxy", SambaParmBool, P_GLOBAL, "Yes"),
+ "OS2DRIVERMAP" : ("os2 driver map", SambaParmString, P_GLOBAL, ""),
+ "QUEUERESUMECOMMAND" : ("queueresume command", SambaParmString, P_LOCAL, ""),
+ "SERVERSCHANNEL" : ("server schannel", SambaParmString, P_GLOBAL, "Auto"),
+ "IDMAPUID" : ("idmap uid", SambaParmString, P_GLOBAL, ""),
+ "WINBINDENABLELOCALACCOUNTS": ("winbind enable local accounts", SambaParmBool, P_GLOBAL, "No"),
+ "PRINTERNAME" : ("printer name", SambaParmString, P_LOCAL, ""),
+ "NTACLSUPPORT" : ("nt acl support", SambaParmBool, P_LOCAL, "Yes"),
+ "LOGLEVEL" : ("log level", SambaParmString, P_GLOBAL, "0"),
+ "STATCACHE" : ("stat cache", SambaParmBool, P_GLOBAL, "Yes"),
+ "LPQCACHETIME" : ("lpq cache time", SambaParmString, P_GLOBAL, "30"),
+ "LEVEL2OPLOCKS" : ("level2 oplocks", SambaParmBool, P_LOCAL, "Yes"),
+ "LARGEREADWRITE" : ("large readwrite", SambaParmBool, P_GLOBAL, "Yes"),
+ "LDAPREPLICATIONSLEEP" : ("ldap replication sleep", SambaParmString, P_GLOBAL, "1000"),
+ "SECURITYMASK" : ("security mask", SambaParmString, P_LOCAL, "0777"),
+ "LDAPUSERSUFFIX" : ("ldap user suffix", SambaParmString, P_GLOBAL, ""),
+ "NETBIOSNAME" : ("netbios name", SambaParmString, P_GLOBAL, "PANTHER"),
+ "LOCKSPINCOUNT" : ("lock spin count", SambaParmString, P_GLOBAL, "3"),
+ "OPLOCKS" : ("oplocks", SambaParmBool, P_LOCAL, "Yes"),
+ "MINWINSTTL" : ("min wins ttl", SambaParmString, P_GLOBAL, "21600"),
+ "HOMEDIRMAP" : ("homedir map", SambaParmString, P_GLOBAL, ""),
+ "REMOTEANNOUNCE" : ("remote announce", SambaParmString, P_GLOBAL, ""),
+ "PREFERREDMASTER" : ("preferred master", SambaParmString, P_GLOBAL, "Auto"),
+ "SECURITY" : ("security", SambaParmString, P_GLOBAL, "USER"),
+ "AUTHMETHODS" : ("auth methods", SambaParmString, P_GLOBAL, ""),
+ "ENABLERIDALGORITHM" : ("enable rid algorithm", SambaParmBool, P_GLOBAL, "Yes"),
+ "LPRMCOMMAND" : ("lprm command", SambaParmString, P_LOCAL, ""),
+ "KERNELCHANGENOTIFY" : ("kernel change notify", SambaParmBool, P_GLOBAL, "Yes"),
+ "LOGONSCRIPT" : ("logon script", SambaParmString, P_GLOBAL, ""),
+ "PRESERVECASE" : ("preserve case", SambaParmBool, P_LOCAL, "Yes"),
+ "UNIXCHARSET" : ("unix charset", SambaParmString, P_GLOBAL, "UTF-8"),
+ "FORCEPRINTERNAME" : ("force printername", SambaParmBool, P_LOCAL, "No"),
+ "LDAPFILTER" : ("ldap filter", SambaParmString, P_GLOBAL, "(uid"),
+ "DELETEREADONLY" : ("delete readonly", SambaParmBool, P_LOCAL, "No"),
+ "ABORTSHUTDOWNSCRIPT" : ("abort shutdown script", SambaParmString, P_GLOBAL, ""),
+ "DFREECOMMAND" : ("dfree command", SambaParmString, P_GLOBAL, ""),
+ "VETOFILES" : ("veto files", SambaParmString, P_LOCAL, ""),
+ "LOCKING" : ("locking", SambaParmBool, P_LOCAL, "Yes"),
+ "EASUPPORT" : ("ea support", SambaParmBool, P_LOCAL, "No"),
+ "MAXSMBDPROCESSES" : ("max smbd processes", SambaParmString, P_GLOBAL, "0"),
+ "HIDEFILES" : ("hide files", SambaParmString, P_LOCAL, ""),
+ "PASSWDCHATDEBUG" : ("passwd chat debug", SambaParmBool, P_GLOBAL, "No"),
+ "SMBPASSWDFILE" : ("smb passwd file", SambaParmString, P_GLOBAL, "/etc/samba/private/smbpasswd"),
+ "GETQUOTACOMMAND" : ("get quota command", SambaParmString, P_GLOBAL, ""),
+ "OPLOCKCONTENTIONLIMIT" : ("oplock contention limit", SambaParmString, P_LOCAL, "2"),
+ "DOMAINMASTER" : ("domain master", SambaParmString, P_GLOBAL, "Auto"),
+ "DELETESHARECOMMAND" : ("delete share command", SambaParmString, P_GLOBAL, ""),
+ "INVALIDUSERS" : ("invalid users", SambaParmString, P_LOCAL, ""),
+ "POSIXLOCKING" : ("posix locking", SambaParmBool, P_LOCAL, "Yes"),
+ "INCLUDE" : ("include", SambaParmString, P_LOCAL, ""),
+ "ALGORITHMICRIDBASE" : ("algorithmic rid base", SambaParmString, P_GLOBAL, "1000"),
+ "FORCEDIRECTORYSECURITYMODE": ("force directory security mode", SambaParmString, P_LOCAL, "00"),
+ "ANNOUNCEVERSION" : ("announce version", SambaParmString, P_GLOBAL, "4.9"),
+ "USERNAMEMAP" : ("username map", SambaParmString, P_GLOBAL, ""),
+ "MANGLEDNAMES" : ("mangled names", SambaParmBool, P_LOCAL, "Yes"),
+ "ROOTDIRECTORY" : ("root directory", SambaParmString, P_GLOBAL, ""),
+ "DEBUGHIRESTIMESTAMP" : ("debug hires timestamp", SambaParmBool, P_GLOBAL, "No"),
+ "LOGONDRIVE" : ("logon drive", SambaParmString, P_GLOBAL, ""),
+ "LOCALMASTER" : ("local master", SambaParmBool, P_GLOBAL, "Yes"),
+ "ROOTPREEXECCLOSE" : ("root preexec close", SambaParmBool, P_LOCAL, "No"),
+ "CONFIGFILE" : ("config file", SambaParmString, P_GLOBAL, ""),
+ "USECLIENTDRIVER" : ("use client driver", SambaParmBool, P_LOCAL, "No"),
+ "MINPROTOCOL" : ("min protocol", SambaParmString, P_GLOBAL, "CORE"),
+ "ADDUSERTOGROUPSCRIPT" : ("add user to group script", SambaParmString, P_GLOBAL, ""),
+ "MAPACLINHERIT" : ("map acl inherit", SambaParmBool, P_LOCAL, "No"),
+ "DELETEUSERSCRIPT" : ("delete user script", SambaParmString, P_GLOBAL, ""),
+ "WINBINDUID" : ("idmap uid", SambaParmString, P_GLOBAL, ""),
+ "READRAW" : ("read raw", SambaParmBool, P_GLOBAL, "Yes"),
+ "WINBINDENUMGROUPS" : ("winbind enum groups", SambaParmBool, P_GLOBAL, "Yes"),
+ "PASSWORDLEVEL" : ("password level", SambaParmString, P_GLOBAL, "0"),
+ "MAXPRINTJOBS" : ("max print jobs", SambaParmString, P_LOCAL, "1000"),
+ "PRINTCAP" : ("printcap name", SambaParmString, P_GLOBAL, ""),
+ "LOADPRINTERS" : ("load printers", SambaParmBool, P_GLOBAL, "Yes"),
+ "DEFAULT" : ("default service", SambaParmString, P_GLOBAL, ""),
+ "GUESTACCOUNT" : ("guest account", SambaParmString, P_GLOBAL, "nobody"),
+ "AUTOSERVICES" : ("preload", SambaParmString, P_GLOBAL, ""),
+ "WRITEABLE" : ("read only", SambaParmBoolRev, P_LOCAL, "Yes"),
+ "CLIENTLANMANAUTH" : ("client lanman auth", SambaParmBool, P_GLOBAL, "Yes"),
+ "MESSAGECOMMAND" : ("message command", SambaParmString, P_GLOBAL, ""),
+ "UNIXEXTENSIONS" : ("unix extensions", SambaParmBool, P_GLOBAL, "Yes"),
+ "LDAPPASSWORDSYNC" : ("ldap passwd sync", SambaParmString, P_GLOBAL, "no"),
+ "AFSUSERNAMEMAP" : ("afs username map", SambaParmString, P_GLOBAL, ""),
+ "SYSLOG" : ("syslog", SambaParmString, P_GLOBAL, "1"),
+ "SETPRIMARYGROUPSCRIPT" : ("set primary group script", SambaParmString, P_GLOBAL, ""),
+ "DEADTIME" : ("deadtime", SambaParmString, P_GLOBAL, "0"),
+ "RESTRICTANONYMOUS" : ("restrict anonymous", SambaParmString, P_GLOBAL, "0"),
+ "USERNAMELEVEL" : ("username level", SambaParmString, P_GLOBAL, "0"),
+ "DISPLAYCHARSET" : ("display charset", SambaParmString, P_GLOBAL, "LOCALE"),
+ "FORCEUSER" : ("force user", SambaParmString, P_LOCAL, ""),
+ "HOSTSDENY" : ("hosts deny", SambaParmString, P_LOCAL, ""),
+ "HIDEUNWRITEABLEFILES" : ("hide unwriteable files", SambaParmBool, P_LOCAL, "No"),
+ "DOSCHARSET" : ("dos charset", SambaParmString, P_GLOBAL, "CP850"),
+ "DOSFILETIMES" : ("dos filetimes", SambaParmBool, P_LOCAL, "No"),
+ "REALM" : ("realm", SambaParmString, P_GLOBAL, ""),
+ "LDAPSUFFIX" : ("ldap suffix", SambaParmString, P_GLOBAL, ""),
+ "LPPAUSECOMMAND" : ("lppause command", SambaParmString, P_LOCAL, ""),
+ "FAKEDIRECTORYCREATETIMES": ("fake directory create times", SambaParmBool, P_LOCAL, "No"),
+ "MAGICSCRIPT" : ("magic script", SambaParmString, P_LOCAL, ""),
+ "WRITECACHESIZE" : ("write cache size", SambaParmString, P_LOCAL, "0"),
+ "BLOCKSIZE" : ("block size", SambaParmString, P_LOCAL, "1024"),
+ "LOCKSPINTIME" : ("lock spin time", SambaParmString, P_GLOBAL, "10"),
+ "ACLCOMPATIBILITY" : ("acl compatibility", SambaParmString, P_GLOBAL, ""),
+ "MSDFSPROXY" : ("msdfs proxy", SambaParmString, P_LOCAL, ""),
+ "POSTEXEC" : ("postexec", SambaParmString, P_LOCAL, ""),
+ "HIDEUNREADABLE" : ("hide unreadable", SambaParmBool, P_LOCAL, "No"),
+ "WIDELINKS" : ("wide links", SambaParmBool, P_LOCAL, "Yes"),
+ "STRICTSYNC" : ("strict sync", SambaParmBool, P_LOCAL, "No"),
+ "PRINTCAPNAME" : ("printcap name", SambaParmString, P_GLOBAL, ""),
+ "PREFEREDMASTER" : ("preferred master", SambaParmString, P_GLOBAL, "Auto"),
+ "MAXMUX" : ("max mux", SambaParmString, P_GLOBAL, "50"),
+ "VETOOPLOCKFILES" : ("veto oplock files", SambaParmString, P_LOCAL, ""),
+ "WINBINDSEPARATOR" : ("winbind separator", SambaParmString, P_GLOBAL, "\\"),
+ "NISHOMEDIR" : ("NIS homedir", SambaParmBool, P_GLOBAL, "No"),
+ "AVAILABLE" : ("available", SambaParmBool, P_LOCAL, "Yes"),
+ "KEEPALIVE" : ("keepalive", SambaParmString, P_GLOBAL, "300"),
+ "USERNAME" : ("username", SambaParmString, P_LOCAL, ""),
+ "PRINTCOMMAND" : ("print command", SambaParmString, P_LOCAL, ""),
+ "LPRESUMECOMMAND" : ("lpresume command", SambaParmString, P_LOCAL, ""),
+ "USEKERBEROSKEYTAB" : ("use kerberos keytab", SambaParmBool, P_GLOBAL, "No"),
+ "HOSTSALLOW" : ("hosts allow", SambaParmString, P_LOCAL, ""),
+ "MAXOPENFILES" : ("max open files", SambaParmString, P_GLOBAL, "10000"),
+ "PARANOIDSERVERSECURITY" : ("paranoid server security", SambaParmBool, P_GLOBAL, "Yes"),
+ "WTMPDIRECTORY" : ("wtmp directory", SambaParmString, P_GLOBAL, ""),
+ "ADDPRINTERCOMMAND" : ("addprinter command", SambaParmString, P_GLOBAL, ""),
+ "PRINTERADMIN" : ("printer admin", SambaParmString, P_LOCAL, ""),
+ "WINSSERVER" : ("wins server", SambaParmString, P_GLOBAL, ""),
+ "LDAPTIMEOUT" : ("ldap timeout", SambaParmString, P_GLOBAL, "15"),
+ "LOCKDIRECTORY" : ("lock directory", SambaParmString, P_GLOBAL, "/var/lib/samba"),
+ "LOGONHOME" : ("logon home", SambaParmString, P_GLOBAL, "\\%N\%U"),
+ "MINPASSWDLENGTH" : ("min password length", SambaParmString, P_GLOBAL, "5"),
+ "CLIENTPLAINTEXTAUTH" : ("client plaintext auth", SambaParmBool, P_GLOBAL, "Yes"),
+ "CSCPOLICY" : ("csc policy", SambaParmString, P_LOCAL, "manual"),
+ "ADDSHARECOMMAND" : ("add share command", SambaParmString, P_GLOBAL, ""),
+ "MANGLINGCHAR" : ("mangling char", SambaParmString, P_LOCAL, "~"),
+ "DIRECTORY" : ("path", SambaParmString, P_LOCAL, ""),
+ "DEBUGTIMESTAMP" : ("debug timestamp", SambaParmBool, P_GLOBAL, "Yes"),
+ "ALLOWHOSTS" : ("hosts allow", SambaParmString, P_LOCAL, ""),
+ "FSTYPE" : ("fstype", SambaParmString, P_LOCAL, "NTFS"),
+ "BLOCKINGLOCKS" : ("blocking locks", SambaParmBool, P_LOCAL, "Yes"),
+ "LDAPSSL" : ("ldap ssl", SambaParmString, P_GLOBAL, ""),
+ "PAMPASSWORDCHANGE" : ("pam password change", SambaParmBool, P_GLOBAL, "No"),
+ "GUESTOK" : ("guest ok", SambaParmBool, P_LOCAL, "No"),
+ "DEFAULTDEVMODE" : ("default devmode", SambaParmBool, P_LOCAL, "No"),
+ "MAXDISKSIZE" : ("max disk size", SambaParmString, P_GLOBAL, "0"),
+ "ADDMACHINESCRIPT" : ("add machine script", SambaParmString, P_GLOBAL, ""),
+ "MANGLEPREFIX" : ("mangle prefix", SambaParmString, P_GLOBAL, "1"),
+ "DISABLENETBIOS" : ("disable netbios", SambaParmBool, P_GLOBAL, "No"),
+ "LOGONPATH" : ("logon path", SambaParmString, P_GLOBAL, "\\%N\%U\profile"),
+ "IDMAPBACKEND" : ("idmap backend", SambaParmString, P_GLOBAL, ""),
+ "SHORTPRESERVECASE" : ("short preserve case", SambaParmBool, P_LOCAL, "Yes"),
+ "CUPSSERVER" : ("cups server", SambaParmString, P_GLOBAL, ""),
+ "NTPIPESUPPORT" : ("nt pipe support", SambaParmBool, P_GLOBAL, "Yes"),
+ "READONLY" : ("read only", SambaParmBool, P_LOCAL, "Yes"),
+ "MACHINEPASSWORDTIMEOUT" : ("machine password timeout", SambaParmString, P_GLOBAL, "604800"),
+ "PIDDIRECTORY" : ("pid directory", SambaParmString, P_GLOBAL, "/var/run"),
+ "PUBLIC" : ("guest ok", SambaParmBool, P_LOCAL, "No"),
+ "DEBUGPID" : ("debug pid", SambaParmBool, P_GLOBAL, "No"),
+ "GUESTONLY" : ("guest only", SambaParmBool, P_LOCAL, "No"),
+ "DELETEGROUPSCRIPT" : ("delete group script", SambaParmString, P_GLOBAL, ""),
+ "CUPSOPTIONS" : ("cups options", SambaParmString, P_LOCAL, ""),
+ "PASSWDCHAT" : ("passwd chat", SambaParmString, P_GLOBAL, "*new*password* %n\n *new*password* %n\n *changed*"),
+ "STRICTLOCKING" : ("strict locking", SambaParmString, P_LOCAL, "Yes"),
+ "TEMPLATEHOMEDIR" : ("template homedir", SambaParmString, P_GLOBAL, "/home/%D/%U"),
+ "WINBINDGID" : ("idmap gid", SambaParmString, P_GLOBAL, ""),
+ "INHERITPERMISSIONS" : ("inherit permissions", SambaParmBool, P_LOCAL, "No"),
+ "TIMESERVER" : ("time server", SambaParmBool, P_GLOBAL, "No"),
+ "BROWSELIST" : ("browse list", SambaParmBool, P_GLOBAL, "Yes"),
+ "HOSTNAMELOOKUPS" : ("hostname lookups", SambaParmBool, P_GLOBAL, "No"),
+ "DOSFILETIMERESOLUTION" : ("dos filetime resolution", SambaParmBool, P_LOCAL, "No"),
+ "CREATEMASK" : ("create mask", SambaParmString, P_LOCAL, "0744"),
+ "WINSHOOK" : ("wins hook", SambaParmString, P_GLOBAL, ""),
+ "DEFAULTCASE" : ("default case", SambaParmString, P_LOCAL, "lower"),
+ "PATH" : ("path", SambaParmString, P_LOCAL, ""),
+ "SHOWADDPRINTERWIZARD" : ("show add printer wizard", SambaParmBool, P_GLOBAL, "Yes"),
+ "WINSPARTNERS" : ("wins partners", SambaParmString, P_GLOBAL, ""),
+ "ENABLEPRIVILEGES" : ("enable privileges", SambaParmBool, P_GLOBAL, "No"),
+ "VFSOBJECTS" : ("vfs objects", SambaParmString, P_LOCAL, ""),
+ "STRICTALLOCATE" : ("strict allocate", SambaParmBool, P_LOCAL, "No"),
+ "PREEXEC" : ("preexec", SambaParmString, P_LOCAL, ""),
+ "WINSSUPPORT" : ("wins support", SambaParmBool, P_GLOBAL, "No"),
+ "HOSTMSDFS" : ("host msdfs", SambaParmBool, P_GLOBAL, "No"),
+ "AFSTOKENLIFETIME" : ("afs token lifetime", SambaParmString, P_GLOBAL, "604800"),
+ "PRINTOK" : ("printable", SambaParmBool, P_LOCAL, "No"),
+ "TEMPLATEPRIMARYGROUP" : ("template primary group", SambaParmString, P_GLOBAL, "nobody"),
+ "PASSWDPROGRAM" : ("passwd program", SambaParmString, P_GLOBAL, ""),
+ "SYNCALWAYS" : ("sync always", SambaParmBool, P_LOCAL, "No"),
+ "QUEUEPAUSECOMMAND" : ("queuepause command", SambaParmString, P_LOCAL, ""),
+ "BINDINTERFACESONLY" : ("bind interfaces only", SambaParmBool, P_GLOBAL, "No"),
+ "MAXWINSTTL" : ("max wins ttl", SambaParmString, P_GLOBAL, "518400"),
+ "GETWDCACHE" : ("getwd cache", SambaParmBool, P_GLOBAL, "Yes"),
+ "MAGICOUTPUT" : ("magic output", SambaParmString, P_LOCAL, ""),
+ "ADMINUSERS" : ("admin users", SambaParmString, P_LOCAL, ""),
+ "DIRECTORYMODE" : ("directory mask", SambaParmString, P_LOCAL, "0755"),
+ "CLIENTSIGNING" : ("client signing", SambaParmString, P_GLOBAL, "auto"),
+ "PASSDBBACKEND" : ("passdb backend", SambaParmString, P_GLOBAL, "smbpasswd"),
+ "CASESIGNAMES" : ("case sensitive", SambaParmString, P_LOCAL, "Auto"),
+ "SETQUOTACOMMAND" : ("set quota command", SambaParmString, P_GLOBAL, ""),
+ "LPQCOMMAND" : ("lpq command", SambaParmString, P_LOCAL, ""),
+ "SERVERSTRING" : ("server string", SambaParmString, P_GLOBAL, "Samba 3.0.11pre2-SVN-build-4840"),
+ "DEFAULTSERVICE" : ("default service", SambaParmString, P_GLOBAL, ""),
+ "WINBINDUSEDEFAULTDOMAIN": ("winbind use default domain", SambaParmBool, P_GLOBAL, "No"),
+ "INTERFACES" : ("interfaces", SambaParmString, P_GLOBAL, ""),
+ "ROOTDIR" : ("root directory", SambaParmString, P_GLOBAL, ""),
+ "ADDUSERSCRIPT" : ("add user script", SambaParmString, P_GLOBAL, ""),
+ "CLIENTNTLMV2AUTH" : ("client NTLMv2 auth", SambaParmBool, P_GLOBAL, "No"),
+ "FORCEUNKNOWNACLUSER" : ("force unknown acl user", SambaParmBool, P_LOCAL, "No"),
+ "MANGLEDMAP" : ("mangled map", SambaParmString, P_LOCAL, ""),
+ "NTLMAUTH" : ("ntlm auth", SambaParmBool, P_GLOBAL, "Yes"),
+ "INHERITACLS" : ("inherit acls", SambaParmBool, P_LOCAL, "No"),
+ "HOSTSEQUIV" : ("hosts equiv", SambaParmString, P_GLOBAL, ""),
+ "ALLOWTRUSTEDDOMAINS" : ("allow trusted domains", SambaParmBool, P_GLOBAL, "Yes"),
+ "MINPASSWORDLENGTH" : ("min password length", SambaParmString, P_GLOBAL, "5"),
+ "USERS" : ("username", SambaParmString, P_LOCAL, ""),
+ "PRELOAD" : ("preload", SambaParmString, P_GLOBAL, ""),
+ "DEBUGUID" : ("debug uid", SambaParmBool, P_GLOBAL, "No"),
+ "CHANGESHARECOMMAND" : ("change share command", SambaParmString, P_GLOBAL, ""),
+ "BROWSABLE" : ("browseable", SambaParmBool, P_LOCAL, "Yes"),
+ "ENHANCEDBROWSING" : ("enhanced browsing", SambaParmBool, P_GLOBAL, "Yes"),
+ "PANICACTION" : ("panic action", SambaParmString, P_GLOBAL, ""),
+ "LDAPMACHINESUFFIX" : ("ldap machine suffix", SambaParmString, P_GLOBAL, ""),
+ "UPDATEENCRYPTED" : ("update encrypted", SambaParmBool, P_GLOBAL, "No"),
+ "MAXTTL" : ("max ttl", SambaParmString, P_GLOBAL, "259200"),
+ "WRITABLE" : ("read only", SambaParmBoolRev, P_LOCAL, "Yes"),
+ "SHAREMODES" : ("share modes", SambaParmBool, P_LOCAL, "Yes"),
+ "REMOTEBROWSESYNC" : ("remote browse sync", SambaParmString, P_GLOBAL, ""),
+ "STOREDOSATTRIBUTES" : ("store dos attributes", SambaParmBool, P_LOCAL, "No"),
+ "CLIENTSCHANNEL" : ("client schannel", SambaParmString, P_GLOBAL, "Auto"),
+ "WRITELIST" : ("write list", SambaParmString, P_LOCAL, ""),
+ "ADDGROUPSCRIPT" : ("add group script", SambaParmString, P_GLOBAL, ""),
+ "OPLOCKBREAKWAITTIME" : ("oplock break wait time", SambaParmString, P_GLOBAL, "0"),
+ "TIMEOFFSET" : ("time offset", SambaParmString, P_GLOBAL, "0"),
+ "LDAPDELETEDN" : ("ldap delete dn", SambaParmBool, P_GLOBAL, "No"),
+ "AFSSHARE" : ("afs share", SambaParmBool, P_LOCAL, "No"),
+ "ROOT" : ("root directory", SambaParmString, P_GLOBAL, ""),
+ "NAMERESOLVEORDER" : ("name resolve order", SambaParmString, P_GLOBAL, "lmhosts wins host bcast"),
+}
+##### end of smbparm.y ##########################################
+#################################################################