So far what I have come up with is a number of classes that are used to
deal with the "most common parameters" that Samba configuration
file deals with. Now for a server configuration I have distributed those
parameter bulk into approx 20 classes.
a) Basic class :
It covers the Basic parameters in the Server , Fileshare and Printshare
configurations
and includes parameters like
comment, path, netbiosname , workgroup , server string, etc
b) Tuning class:
it covers the methods to fine tune the Share and Server configurations .
includes parameters like
max smbd connections , keepalive, socket options, max open files,
maxconnections , write cache size, strict allocation ,
strict sync , minprint space
c) Browse class:
browseable , OS level , preferred master , local master, browse list , enhanced
browsing
d) Protocol Class:
Protocol , smb ports, max protocol, min protocol , nt pipe support , disable
netbios, time server, nt acl support, client signing , name resolve order
,
e) FilenameHandling Class :
case sensitive, preserve case, short preserve case, mangle case , hide
dot files,
delete veto, hide files, veto files, map system , map hidden , map archive,
mangled map
f) Locking class :
blocking locks , locking , oplocks , posix locking , strict locking ,
share modes , fake oplocks
g) printing class :
printing , cups options, lpq command, lppause command .....
printcap name , load printers , delete printed command , addprinter command
,
max reported print job , printable , printer name ....
h) Logon class :
add user script , delete user script , logon script , logon drive , logon
path , logon home
domain logons , shutdown script
i) WINS class :
dns proxy , wins proxy , wins server, wins support , wins hook
j) LogFile class :
includes parameters related to the log files LDAP class :
k) Security class :
includes parameters that handle the server and share security .
server security
security , auth methods, encrypt passwords , null passwords, password
server, smbpsswd file
username level , unix passwd sync, root dir , guest account , private dir
, username map
share security
force user , force group , inherit permissions , guest only , only user
, writable
username , invalid users, valid users, admin users , read list , security
mask , directory
mask , create mask ......
l) Miscellaneous class :
remaining but frequent parameters ..
follow symlinks , wide links , postexec , root preexec , root postexec
, delete readonly ,
dos file mode , fstyps , volume , dont descend ......
Now based upon these classes there would be three MAIN classes
a) ServerClass
b) FileShareClass
c) PrintShareClass
The Objects Distribution for classes ...
ServerClass (class)
Basic
Security
Tuning
Locking
Protocol
Printing
FilenameHandling
Logon Options
Browse
WINS LDAP
winbind
Miscellaneous
FileShareClass (class)
Basic
Security
Protocol
Tuning
FilenameHandling
Browse
Locking
Miscellaneous
PrintShareClass (class)
Basic
Security
Tuning
Browsing
Miscellaneous
Printing Options
UserAccountsClass (class)
At present I am dealing with the functions for Each of the Main Classes
designed so far ..
What would a test file look like ??
Functions For the Server class
def CommitChanges(self):
def AddShare(self, ShareObject):
def RefreshServer(self):
def ListOptionsInShare(self , shareName):
def PrintServerInfo(self):
def ListShares(self):
def RemoveShare(self, delShareName ):
def SetOptionValuePairInService(self, ServiceName, Option , Value):
def Version(self):
def PrintConfigFile(self):
def TestServerConfiguration(self):
def RevokeUserRight(self):
def AddUser(self):
def RemoveUser(self):
def CreatePath(self):
def CheckIfPathExist(self):
def CommentOptionValuePair(self):
def UncommentOptionValuePair(self):
def SetServerType(self, serverType):
test.py
import sys
from ServerClass import Server
from FileShareClass import FileShare
if _name_ == "_main_":
s = Server("/home/amit/test/smb.conf")
s.Basic.Workgroup(" workgroupnamE ")
s.Basic.NetBIOSname(" my computer ")
s.Security.EncryptPasswords("yes")
s.FilenameHandling.HideDotFiles("yes","comment here")
S.Browse.Browseable("yes")
s.CommitChanges()
s1 = FileShare("mama")
s1.Basic.Path("/home/amit")
s1.Basic.Comment(" comment for the share name")
s1.Security.ReadOnly("yes")
s1.Security.Writable("yes")
s.AddShare(s1)
print "done"
Amit Regmi 2nd August 2005
posted at: 03:40 | path: /samba3/pythong | permanent link to this entry