svn commit: samba r26023 - in branches/4.0-python: . source/auth/kerberos source/scripting/python/samba

jelmer at samba.org jelmer at samba.org
Sat Nov 17 23:37:05 GMT 2007


Author: jelmer
Date: 2007-11-17 23:37:05 +0000 (Sat, 17 Nov 2007)
New Revision: 26023

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26023

Log:
Fix comments, PEP8
Removed:
   branches/4.0-python/source/auth/kerberos/kerberos_util.c
Modified:
   branches/4.0-python/
   branches/4.0-python/source/auth/kerberos/config.mk
   branches/4.0-python/source/scripting/python/samba/provision.py


Changeset:

Property changes on: branches/4.0-python
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/4.0-python/source/auth/kerberos/config.mk
===================================================================
--- branches/4.0-python/source/auth/kerberos/config.mk	2007-11-17 23:10:37 UTC (rev 26022)
+++ branches/4.0-python/source/auth/kerberos/config.mk	2007-11-17 23:37:05 UTC (rev 26023)
@@ -9,7 +9,6 @@
 PRIVATE_PROTO_HEADER = proto.h
 OBJ_FILES = \
 			kerberos_heimdal.o \
-			kerberos_util.o \
 			kerberos_pac.o \
 			gssapi_parse.o
 PUBLIC_DEPENDENCIES = HEIMDAL_KRB5 NDR_KRB5PAC samba-socket LIBCLI_RESOLVE

Deleted: branches/4.0-python/source/auth/kerberos/kerberos_util.c
===================================================================
--- branches/4.0-python/source/auth/kerberos/kerberos_util.c	2007-11-17 23:10:37 UTC (rev 26022)
+++ branches/4.0-python/source/auth/kerberos/kerberos_util.c	2007-11-17 23:37:05 UTC (rev 26023)
@@ -1,28 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-
-   Kerberos utility functions for GENSEC
-   
-   Copyright (C) Andrew Bartlett <abartlet at samba.org> 2004-2005
-
-   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 3 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, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "system/kerberos.h"
-#include "auth/kerberos/kerberos.h"
-#include "auth/credentials/credentials.h"
-
-

Modified: branches/4.0-python/source/scripting/python/samba/provision.py
===================================================================
--- branches/4.0-python/source/scripting/python/samba/provision.py	2007-11-17 23:10:37 UTC (rev 26022)
+++ branches/4.0-python/source/scripting/python/samba/provision.py	2007-11-17 23:37:05 UTC (rev 26023)
@@ -127,10 +127,8 @@
         self.ldap_schema_basedn_ldif = None
         self.s4_ldapi_path = None
 
-#
-#  return True if the current install seems to be OK
-#
 def install_ok(lp, session_info, credentials):
+    """Check whether the current install seems ok."""
     if lp.get("realm") == "":
         return False
     ldb = Ldb(lp.get("sam database"), session_info=session_info, 
@@ -139,10 +137,8 @@
         return False
     return True
 
-#
-#  find a user or group from a list of possibilities
-#
 def findnss(nssfn, *names):
+    """Find a user or group from a list of possibilities."""
     for name in names:
         try:
             return nssfn(name)
@@ -150,10 +146,8 @@
             pass
     raise Exception("Unable to find user/group for %s" % arguments[1])
 
-#
-# add a foreign security principle
-#
 def add_foreign(ldb, subobj, sid, desc):
+    """Add a foreign security principle."""
     add = """
 dn: CN=%s,CN=ForeignSecurityPrincipals,%s
 objectClass: top
@@ -165,10 +159,8 @@
     for msg in ldb.parse_ldif(add):
         ldb.add(msg[1])
 
-#
-#  setup a mapping between a sam name and a unix name
-#
 def setup_name_mapping(subobj, ldb, sid, unixname):
+    """Setup a mapping between a sam name and a unix name."""
     res = ldb.search(Dn(ldb, subobj.domaindn), SCOPE_SUBTREE, 
                      "objectSid=%s" % sid, ["dn"])
     assert len(res) == 1, "Failed to find record for objectSid %s" % sid
@@ -181,16 +173,12 @@
 """ % (res[0].dn, unixname)
     ldb.modify(ldb.parse_ldif(mod).next()[1])
 
-#
-#  return first host IP
-#
 def hostip():
+    """return first host IP."""
     return gethostbyname(hostname())
 
-#
-#  return first part of hostname
-#
 def hostname():
+    """return first part of hostname."""
     return gethostname().split(".")[0]
 
 # the ldb is in bad shape, possibly due to being built from an
@@ -203,10 +191,8 @@
     ldb.connect(ldb.filename)
     ldb.transaction_start()
 
-#
-#  erase an ldb, removing all records
-#
 def ldb_erase(ldb):
+    """Erase an ldb, removing all records."""
     # delete the specials
     for attr in ["@INDEXLIST", "@ATTRIBUTES", "@SUBCLASSES", "@MODULES", 
                  "@OPTIONS", "@PARTITION", "@KLUDGEACL"]:
@@ -282,10 +268,9 @@
         os.unlink(dbname)
         return Ldb(dbname, session_info=session_info, credentials=credentials)
 
-#
-#  setup a ldb in the private dir
-#
+
 def setup_add_ldif(setup_dir, ldif, subobj, ldb):
+    """Setup a ldb in the private dir."""
     assert isinstance(ldif, str)
     assert isinstance(setup_dir, str)
     src = os.path.join(setup_dir, ldif)
@@ -323,10 +308,9 @@
     ldb.transaction_commit()
     return ldb
 
-#
-# setup a ldb in the private dir
-# 
+
 def setup_ldb_modify(setup_dir, ldif, subobj, ldb):
+    """Modify a ldb in the private dir."""
     src = os.path.join(setup_dir, ldif)
 
     data = open(src, 'r').read()
@@ -335,10 +319,8 @@
     for (changetype, msg) in ldb.parse_ldif(data):
         ldb.modify(msg)
 
-#
-# setup a file in the private dir
-# 
 def setup_file(setup_dir, template, message, fname, subobj):
+    """Setup a file in the private dir."""
     f = fname
     src = os.path.join(setup_dir, template)
 
@@ -367,6 +349,7 @@
     paths.phpldapadminconfig = os.path.join(private_dir, "phpldapadmin-config.php")
     return paths
 
+
 def setup_name_mappings(subobj, ldb):
     """setup reasonable name mappings for sam names to unix names."""
     res = ldb.search(Dn(ldb, subobj.domaindn), SCOPE_BASE, "objectSid=*", 
@@ -442,6 +425,7 @@
     setup_ldb(setup_dir, "secrets.ldif", session_info, credentials, subobj, 
               paths.secrets, False)
 
+
 def provision(lp, setup_dir, subobj, message, blank, paths, session_info, 
               credentials, ldapbackend):
     """provision samba4 - caution, this wipes all existing data!"""
@@ -495,7 +479,7 @@
         setup_add_ldif(setup_dir, "provision_rootdse_add.ldif", subobj, samdb)
 
         message("Erasing data from partitions")
-        # FIXME ldb_erase_partitions(subobj, message, samdb, ldapbackend)
+        ldb_erase_partitions(subobj, message, samdb, ldapbackend)
         samdb.transaction_commit()
     except:
         samdb.transaction_cancel()
@@ -601,8 +585,9 @@
     samdb.transaction_commit()
 
     message("Setting up phpLDAPadmin configuration")
-    setup_file(setup_dir, "phpldapadmin-config.php", message, paths.phpldapadminconfig, subobj)
-    message("Please install the phpLDAPadmin configuration located at " + paths.phpldapadminconfig + " into /etc/phpldapadmin/config.php")
+    setup_file(setup_dir, "phpldapadmin-config.php", message, 
+               paths.phpldapadminconfig, subobj)
+    message("Please install the phpLDAPadmin configuration located at %s into /etc/phpldapadmin/config.php" % paths.phpldapadminconfig)
 
 
 def provision_dns(setup_dir, subobj, message, paths, session_info, credentials):
@@ -620,7 +605,8 @@
     assert(res[0]["objectGUID"] is not None)
     subobj.domainguid = res[0]["objectGUID"]
 
-    subobj.host_guid = searchone(ldb, subobj.domaindn, "(&(objectClass=computer)(cn=%s))" % subobj.netbiosname, "objectGUID")
+    subobj.host_guid = searchone(ldb, subobj.domaindn, 
+                                 "(&(objectClass=computer)(cn=%s))" % subobj.netbiosname, "objectGUID")
     assert subobj.host_guid is not None
 
     setup_file(setup_dir, "provision.zone", message, paths.dns, subobj)
@@ -653,6 +639,7 @@
 def ldaptime(timestamp=None):
     return time.strftime("%Y%m%d%H%m%s.0Z", timestamp)
 
+
 def provision_guess(lp):
     """guess reasonably default options for provisioning."""
     subobj = ProvisionSettings(realm=lp.get("realm").upper(),
@@ -729,6 +716,7 @@
         return None
     return res[0][attribute]
 
+
 def enable_account(ldb, user_dn):
     """enable the account."""
     res = ldb.search(user_dn, SCOPE_ONELEVEL, None, ["userAccountControl"])
@@ -743,6 +731,7 @@
 """ % (user_dn, userAccountControl)
     ldb.modify(mod)
 
+
 def newuser(sam, username, unixname, password, message, session_info, 
             credentials):
     """add a new user record"""



More information about the samba-cvs mailing list