[SCM] Samba Shared Repository - branch master updated
Matthias Dieter Wallnöfer
mdw at samba.org
Fri Nov 27 07:59:30 MST 2009
The branch, master has been updated
via 0cc45b4... s4:upgrade.py - rework to make the upgrade s3 -> s4 possible again
via bd6c133... s4:upgrade_from_s3 - Fix message outputs
via dbb8989... s4:upgrade.py - the import of WINS databases don't seem to work always
via 70b3161... s4:samba3.py - ignore comments in "smb.conf" files
via 82adfa3... s4:samba3.py - don't read those informations out from the TDB
via f299efa... s4:samba3.py - support the TDB version 3
from a5d854a... s4:provision - Fix up the provision of "standalone" and "member" mode
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0cc45b47dc787abb2c3c31e4fc824798d9f3efe9
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Fri Nov 27 15:50:26 2009 +0100
s4:upgrade.py - rework to make the upgrade s3 -> s4 possible again
Able to read basic settings "workgroup", "realm", "netbios name" and the
function mode from the s3 "smb.conf" and use them for the provision of s4.
commit bd6c133e506fdb5dee13e0a144ef99c6d452be42
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Fri Nov 27 15:49:18 2009 +0100
s4:upgrade_from_s3 - Fix message outputs
The quiet parameter was interpreted in the reverse manner.
commit dbb8989e05ac3189a5eca11fa40d572388ea02fc
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Fri Nov 27 15:02:18 2009 +0100
s4:upgrade.py - the import of WINS databases don't seem to work always
Disable it for now until the cause has been found
commit 70b31610909544c58fd87c5e0aa00e02eb5f6d4b
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Fri Nov 27 15:00:41 2009 +0100
s4:samba3.py - ignore comments in "smb.conf" files
commit 82adfa39b75aa628c88f828278c6ac09335d1a49
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Fri Nov 27 14:59:12 2009 +0100
s4:samba3.py - don't read those informations out from the TDB
At the moment those three calls are broken
commit f299efa8f05c6a5b739222bdf75690a4591d3650
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Fri Nov 27 14:58:37 2009 +0100
s4:samba3.py - support the TDB version 3
-----------------------------------------------------------------------
Summary of changes:
source4/scripting/bin/upgrade_from_s3 | 6 +-
source4/scripting/python/samba/samba3.py | 11 +-
source4/scripting/python/samba/upgrade.py | 144 ++++++++++++++--------------
3 files changed, 81 insertions(+), 80 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/scripting/bin/upgrade_from_s3 b/source4/scripting/bin/upgrade_from_s3
index 03f4415..7e1e1fd 100755
--- a/source4/scripting/bin/upgrade_from_s3
+++ b/source4/scripting/bin/upgrade_from_s3
@@ -50,14 +50,14 @@ opts, args = parser.parse_args()
def message(text):
"""Print a message if quiet is not set."""
- if opts.quiet:
+ if not opts.quiet:
print text
if len(args) < 1:
parser.print_usage()
sys.exit(1)
-message("Reading Samba3 databases and smb.conf\n")
+message("Reading Samba3 databases and smb.conf")
libdir = args[0]
if not os.path.isdir(libdir):
@@ -71,7 +71,7 @@ else:
samba3 = Samba3(libdir, smbconf)
-message("Provisioning\n")
+message("Provisioning")
setup_dir = opts.setupdir
if setup_dir is None:
diff --git a/source4/scripting/python/samba/samba3.py b/source4/scripting/python/samba/samba3.py
index 179efa2..c21b457 100644
--- a/source4/scripting/python/samba/samba3.py
+++ b/source4/scripting/python/samba/samba3.py
@@ -509,7 +509,7 @@ class TdbSam(TdbDatabase):
"""Samba 3 TDB passdb backend reader."""
def _check_version(self):
self.version = fetch_uint32(self.tdb, "INFO/version\0") or 0
- assert self.version in (0, 1, 2)
+ assert self.version in (0, 1, 2, 3)
def usernames(self):
"""Iterate over the usernames in this Tdb database."""
@@ -592,9 +592,10 @@ class TdbSam(TdbDatabase):
for entry in hours:
for i in range(8):
user.hours.append(ord(entry) & (2 ** i) == (2 ** i))
- (user.bad_password_count, data) = unpack_uint16(data)
- (user.logon_count, data) = unpack_uint16(data)
- (user.unknown_6, data) = unpack_uint32(data)
+ # FIXME
+ #(user.bad_password_count, data) = unpack_uint16(data)
+ #(user.logon_count, data) = unpack_uint16(data)
+ #(user.unknown_6, data) = unpack_uint32(data)
assert len(data) == 0
return user
@@ -683,7 +684,7 @@ class ParamFile(object):
section = None
for i, l in enumerate(open(filename, 'r').xreadlines()):
l = l.strip()
- if not l:
+ if not l or l[0] == '#' or l[0] == ';':
continue
if l[0] == "[" and l[-1] == "]":
section = self._sanitize_name(l[1:-1])
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index 8194552..44b43a1 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -2,6 +2,7 @@
#
# backend code for upgrading from Samba3
# Copyright Jelmer Vernooij 2005-2007
+# Copyright Matthias Dieter Wallnöfer 2009
# Released under the GNU GPL v3 or later
#
@@ -9,7 +10,7 @@
__docformat__ = "restructuredText"
-from provision import provision, FILL_DRS
+from provision import provision
import grp
import ldb
import time
@@ -92,7 +93,6 @@ def import_sam_account(samldb,acc,domaindn,domainsid):
"ntPwdHash:": acc.nt_password,
})
-
def import_sam_group(samldb, sid, gid, sid_name_use, nt_name, comment, domaindn):
"""Upgrade a SAM group.
@@ -132,7 +132,6 @@ def import_sam_group(samldb, sid, gid, sid_name_use, nt_name, comment, domaindn)
"samba3SidNameUse": str(sid_name_use)
})
-
def import_idmap(samdb,samba3_idmap,domaindn):
"""Import idmap data.
@@ -157,7 +156,6 @@ def import_idmap(samdb,samba3_idmap,domaindn):
"type": "group",
"unixID": str(gid)})
-
def import_wins(samba4_winsdb, samba3_winsdb):
"""Import settings from a Samba3 WINS database.
@@ -208,73 +206,6 @@ def import_wins(samba4_winsdb, samba3_winsdb):
"objectClass": "winsMaxVersion",
"maxVersion": str(version_id)})
-def upgrade_provision(samba3, setup_dir, message, credentials, session_info, smbconf, targetdir):
- oldconf = samba3.get_conf()
-
- if oldconf.get("domain logons") == "True":
- serverrole = "domain controller"
- else:
- if oldconf.get("security") == "user":
- serverrole = "standalone"
- else:
- serverrole = "member server"
-
- domainname = oldconf.get("workgroup")
- if domainname:
- domainname = str(domainname)
- realm = oldconf.get("realm")
- netbiosname = oldconf.get("netbios name")
-
- secrets_db = samba3.get_secrets_db()
-
- if domainname is None:
- domainname = secrets_db.domains()[0]
- message("No domain specified in smb.conf file, assuming '%s'" % domainname)
-
- if realm is None:
- realm = domainname.lower()
- message("No realm specified in smb.conf file, assuming '%s'\n" % realm)
-
- domainguid = secrets_db.get_domain_guid(domainname)
- domainsid = secrets_db.get_sid(domainname)
- if domainsid is None:
- message("Can't find domain secrets for '%s'; using random SID\n" % domainname)
-
- if netbiosname is not None:
- machinepass = secrets_db.get_machine_password(netbiosname)
- else:
- machinepass = None
-
- result = provision(setup_dir=setup_dir, message=message,
- samdb_fill=FILL_DRS, smbconf=smbconf, session_info=session_info,
- credentials=credentials, realm=realm,
- domain=domainname, domainsid=domainsid, domainguid=domainguid,
- machinepass=machinepass, serverrole=serverrole, targetdir=targetdir)
-
- import_wins(Ldb(result.paths.winsdb), samba3.get_wins_db())
-
- # FIXME: import_registry(registry.Registry(), samba3.get_registry())
-
- # FIXME: import_idmap(samdb,samba3.get_idmap_db(),domaindn)
-
- groupdb = samba3.get_groupmapping_db()
- for sid in groupdb.groupsids():
- (gid, sid_name_use, nt_name, comment) = groupdb.get_group(sid)
- # FIXME: import_sam_group(samdb, sid, gid, sid_name_use, nt_name, comment, domaindn)
-
- # FIXME: Aliases
-
- passdb = samba3.get_sam_db()
- for name in passdb:
- user = passdb[name]
- #FIXME: import_sam_account(result.samdb, user, domaindn, domainsid)
-
- if hasattr(passdb, 'ldap_url'):
- message("Enabling Samba3 LDAP mappings for SAM database")
-
- enable_samba3sam(result.samdb, passdb.ldap_url)
-
-
def enable_samba3sam(samdb, ldapurl):
"""Enable Samba 3 LDAP URL database.
@@ -290,7 +221,6 @@ replace: @LIST
samdb.add({"dn": "@MAP=samba3sam", "@MAP_URL": ldapurl})
-
smbconf_keep = [
"dos charset",
"unix charset",
@@ -434,3 +364,73 @@ def import_registry(samba4_registry, samba3_regdb):
key_handle.set_value(value_name, value_type, value_data)
+def upgrade_provision(samba3, setup_dir, message, credentials, session_info,
+ smbconf, targetdir):
+ oldconf = samba3.get_conf()
+
+ if oldconf.get("domain logons") == "True":
+ serverrole = "domain controller"
+ else:
+ if oldconf.get("security") == "user":
+ serverrole = "standalone"
+ else:
+ serverrole = "member server"
+
+ domainname = oldconf.get("workgroup")
+ realm = oldconf.get("realm")
+ netbiosname = oldconf.get("netbios name")
+
+ secrets_db = samba3.get_secrets_db()
+
+ if domainname is None:
+ domainname = secrets_db.domains()[0]
+ message("No domain specified in smb.conf file, assuming '%s'" % domainname)
+
+ if realm is None:
+ if oldconf.get("domain logons") == "True":
+ message("No realm specified in smb.conf file and being a DC. That upgrade path doesn't work! Please add a 'realm' directive to your old smb.conf to let us know which one you want to use (generally it's the upcased DNS domainname).")
+ return
+ else:
+ realm = domainname.upper()
+ message("No realm specified in smb.conf file, assuming '%s'" % realm)
+
+ domainguid = secrets_db.get_domain_guid(domainname)
+ domainsid = secrets_db.get_sid(domainname)
+ if domainsid is None:
+ message("Can't find domain secrets for '%s'; using random SID" % domainname)
+
+ if netbiosname is not None:
+ machinepass = secrets_db.get_machine_password(netbiosname)
+ else:
+ machinepass = None
+
+ result = provision(setup_dir=setup_dir, message=message,
+ session_info=session_info, credentials=credentials,
+ targetdir=targetdir, realm=realm, domain=domainname,
+ domainguid=domainguid, domainsid=domainsid,
+ hostname=netbiosname, machinepass=machinepass,
+ serverrole=serverrole)
+
+ # FIXME: import_wins(Ldb(result.paths.winsdb), samba3.get_wins_db())
+
+ # FIXME: import_registry(registry.Registry(), samba3.get_registry())
+
+ # FIXME: import_idmap(samdb,samba3.get_idmap_db(),domaindn)
+
+ groupdb = samba3.get_groupmapping_db()
+ for sid in groupdb.groupsids():
+ (gid, sid_name_use, nt_name, comment) = groupdb.get_group(sid)
+ # FIXME: import_sam_group(samdb, sid, gid, sid_name_use, nt_name, comment, domaindn)
+
+ # FIXME: Aliases
+
+ passdb = samba3.get_sam_db()
+ for name in passdb:
+ user = passdb[name]
+ #FIXME: import_sam_account(result.samdb, user, domaindn, domainsid)
+
+ if hasattr(passdb, 'ldap_url'):
+ message("Enabling Samba3 LDAP mappings for SAM database")
+
+ enable_samba3sam(result.samdb, passdb.ldap_url)
+
--
Samba Shared Repository
More information about the samba-cvs
mailing list