Samba 3 management objects

Gerald (Jerry) Carter jerry at
Tue Jul 26 14:50:52 GMT 2005

Hash: SHA1

Amit Regmi wrote:
| Gerald (Jerry) Carter wrote:
| Yes . I have done object oriented programming but
| not library interface design.  You must have asked
| becoz I messed up same Server class in both the
| files I commited. I know OOP well enough. That
| was just a piece of carelessness.

The reason I ask is that there is a conceptual
model of this project that you have been struggling
with.  Which objects to create and what methods
each should have.  The objects will be the interface
upon which people write their applications.

| I don't know If you wrote this mail before going thro
| the commit coz in  yet another mail you say You'll
| see those afterwards. I don't much know about this
| library thing. All I have done is work out classes.
| Use objects and get work done.

I wrote this after the mail to the technical list.
Some of your methods don't really make sense.
For example, Server.SetServerAsPDC() is probably
not appropriate.  It would be better to simple have
a have a Server.SetServerRole("PDC") method which
simply set

	domain logons = yes
	domain master = yes
	encrypt passwords = yes
	security = user

And a Server.Workgroup("FOO") and Server.Name("RAIN")
method for setting the netbios name and workgroup.

Then you start putting the pieces together

	s = Server()

	f1 = FileService("netlogon", ....)
	f2 = FileService("profile", ....)
	f3 = FileService("homes", ....)

	s.AddShare( f1 )
	s.AddShare( f2 )
	s.AddShare( f3 )

This is just an example.  Build your own objects.


| It'd be better to start this way. Is not it ?
| ServerClass:
|    FileService objects
|    PrintService objects
|      methods:
|        setSecurityLevel()
|        TestConfiguration()
|        setServerType()

Yes!  Beautiful :-)

| FileServiceClass:
|      methods:
|        setPermissions()
| PrintServiceClass:
|      methods:
|        setPermissions()

If you are going to share a method, try creating
a base class (e.g. class BaseService) and deriving
FileService and PrintService from it.

| SharesClass:
|      methods:
|        getHiddenShares()
|        getPrinterShares()
|        getAllShares()
|        getConnectedShares()
|        getMountedShares()

I'm not sure this is really necessary.  If you follow
my previous example and start hanging File/Print Service
objects off of the Server class, then the Server.ListShares()
method makes more sense.  Rather than a separate object.

| UsersClass:
|      methods:
|        CreateUser()
|        RemoveUser()
|        ModifyUserAccount()

This starts to slip into what I commented about the FileService
originally.  You would create a new user by create a new
UserAccount class

	u = UserAccount("amit")
	u.SetPassword( "test" )

Make sense?

Same thing for group mappings.

	gmap = GroupMap( "ntadmin", "Domain Admins", 512 )

And you probably need to deal with privileges somehow.
See the 'net rpc rights' documentation.  In this case, you
would want to wrap the net command or you could look
at the python spoolss bindings (./configure --with-python)
and write a similar lsa binding.  You can find out more
about C library bindings in the python docs.

| SharesMountClass:
|          methods:
|        mountShare()
|        unmountShare()
|        forceUnmount()
|        mountReadOnly()
|        mountReadWrite()

Ignore the smbmount stuff altogether.  It is not relevant
for our server management code.

| NetworkSearchClass:
|          methods:
|        nmblookupSearch()
|        smbclientSearch()
|        getBrowseList()
|        queryMasterBrowser()

Again, these are more client tools.  Let's focus on the server
for now.

| Now am I on the track ?

*Much* better.  Make sure to check in your changes once
you make some more progress.

cheers, jerry
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -


More information about the samba-technical mailing list