[SCM] Samba Shared Repository - branch master updated
Matthias Dieter Wallnöfer
mdw at samba.org
Sat Nov 28 11:51:21 MST 2009
The branch, master has been updated
via b973c50... s4:upgrade_from_s3 - Move it back to "setup"
via f068664... s4:setup/provision - Rework
via 3ca61d9... s4:upgrade.py - remove my copyright
via 68f7b84... s4:upgrade.py - readd accidentally removed empty lines
via ecfd1df... s4:samba3.py/upgrade.py: Revert
from 8a34cf6... s4-ldb: make it much easier to use common ldb controls
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b973c5083699ad2b22c72fafe5c4b77f1f4eeccb
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Sat Nov 28 19:23:08 2009 +0100
s4:upgrade_from_s3 - Move it back to "setup"
Suggested by Jelmer
commit f0686645a99de226f199130fee07910d0f6462be
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Sat Nov 28 17:03:57 2009 +0100
s4:setup/provision - Rework
- Revert change in "ask" - was previously correct
- Readd accidentally removed checks for non-null realm and domainname
- On interactive mode perform only one "ask" call per question
- Inform the user about the unset administrator password
commit 3ca61d9a011d5e8ff677df041f4afb4c3a8be0b4
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Sat Nov 28 18:48:47 2009 +0100
s4:upgrade.py - remove my copyright
First I wanted to add also other changes but then I didn't introduce them.
Therefore remove my copyright again.
commit 68f7b84140e59800b2a5c9c96b7a27f7a67235bb
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Sat Nov 28 16:59:18 2009 +0100
s4:upgrade.py - readd accidentally removed empty lines
Jelmer pointed out that this is against the PEP8 norm
commit ecfd1dfcbd8f301b879942322f7fe765f03599bb
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Sat Nov 28 15:28:45 2009 +0100
s4:samba3.py/upgrade.py: Revert
This reverts commit 2175c0ed0649d545ea833d50e8d33fbee9051c35.
This reverts commit 6c3e2417a0639cd7c367de93615c422cf5217456.
This reverts commit dbb8989e05ac3189a5eca11fa40d572388ea02fc.
This reverts commit 82adfa39b75aa628c88f828278c6ac09335d1a49.
This reverts commit f299efa8f05c6a5b739222bdf75690a4591d3650.
After a small discussion with Jelmer we agreed that this isn't the right way
to fix the problem. We should wait for a real patch rather to rely on temporal
hacks.
-----------------------------------------------------------------------
Summary of changes:
WHATSNEW4.txt | 2 +-
howto4.txt | 2 +-
source4/scripting/python/samba/samba3.py | 11 ++++----
source4/scripting/python/samba/tests/samba3.py | 6 ++--
source4/scripting/python/samba/upgrade.py | 7 ++++-
source4/selftest/tests.sh | 2 +-
source4/setup/provision | 29 ++++++++++++++++++----
source4/{scripting/bin => setup}/upgrade_from_s3 | 0
8 files changed, 40 insertions(+), 19 deletions(-)
rename source4/{scripting/bin => setup}/upgrade_from_s3 (100%)
Changeset truncated at 500 lines:
diff --git a/WHATSNEW4.txt b/WHATSNEW4.txt
index 9718bf4..1c9d1e4 100644
--- a/WHATSNEW4.txt
+++ b/WHATSNEW4.txt
@@ -116,7 +116,7 @@ KNOWN ISSUES
- Users upgrading existing databases to Samba4 should carefully
consult upgrading-samba4.txt. We have made a number of changes in
this release that should make it easier to upgrade in future.
- Btw: there exists also a script under the "scripting/bin" directory of the
+ Btw: there exists also a script under the "setup" directory of the
source distribution called "upgrade_from_s3" which should allow a step-up
from Samba3 to Samba4. It's not included yet in the binary distributions
since it's completely experimental!
diff --git a/howto4.txt b/howto4.txt
index 50acf23..e33d040 100644
--- a/howto4.txt
+++ b/howto4.txt
@@ -93,7 +93,7 @@ use the procedures shown in "upgrading-samba4.txt" to upgrade it and keep all
data.
When you are using Samba3 at the moment you could try the experimental script
-"upgrade_from_s3" under the "scripting/bin" directory of the source
+"upgrade_from_s3" under the "setup" directory of the source
distribution (it isn't included in binary distributions yet).
Step 5: Create a simple smb.conf
diff --git a/source4/scripting/python/samba/samba3.py b/source4/scripting/python/samba/samba3.py
index 809fd01..9873679 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, 3)
+ assert self.version in (0, 1, 2)
def usernames(self):
"""Iterate over the usernames in this Tdb database."""
@@ -592,11 +592,10 @@ class TdbSam(TdbDatabase):
for entry in hours:
for i in range(8):
user.hours.append(ord(entry) & (2 ** i) == (2 ** i))
- # FIXME (reactivate also the tests in tests/samba3.py after fixing this)
- #(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
+ (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
diff --git a/source4/scripting/python/samba/tests/samba3.py b/source4/scripting/python/samba/tests/samba3.py
index 8128c51..71e08bd 100644
--- a/source4/scripting/python/samba/tests/samba3.py
+++ b/source4/scripting/python/samba/tests/samba3.py
@@ -122,15 +122,15 @@ class TdbSamTestCase(unittest.TestCase):
user.logoff_time = 2147483647
user.acct_desc = ""
user.group_rid = 1001
- # FIXME user.logon_count = 0
- # FIXME user.bad_password_count = 0
+ user.logon_count = 0
+ user.bad_password_count = 0
user.domain = "BEDWYR"
user.munged_dial = ""
user.workstations = ""
user.user_rid = 1000
user.kickoff_time = 2147483647
user.logoff_time = 2147483647
- # FIXME user.unknown_6 = 1260L
+ user.unknown_6 = 1260L
user.logon_divs = 0
user.hours = [True for i in range(168)]
other = self.samdb["root"]
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index 3c45245..29f2f7c 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -2,7 +2,6 @@
#
# backend code for upgrading from Samba3
# Copyright Jelmer Vernooij 2005-2007
-# Copyright Matthias Dieter Wallnoefer 2009
# Released under the GNU GPL v3 or later
#
@@ -93,6 +92,7 @@ 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,6 +132,7 @@ 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.
@@ -156,6 +157,7 @@ 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.
@@ -221,6 +223,7 @@ replace: @LIST
samdb.add({"dn": "@MAP=samba3sam", "@MAP_URL": ldapurl})
+
smbconf_keep = [
"dos charset",
"unix charset",
@@ -411,7 +414,7 @@ def upgrade_provision(samba3, setup_dir, message, credentials, session_info,
hostname=netbiosname, machinepass=machinepass,
serverrole=serverrole)
- # FIXME: import_wins(Ldb(result.paths.winsdb), samba3.get_wins_db())
+ import_wins(Ldb(result.paths.winsdb), samba3.get_wins_db())
# FIXME: import_registry(registry.Registry(), samba3.get_registry())
diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh
index 7c9b19f..73209ef 100755
--- a/source4/selftest/tests.sh
+++ b/source4/selftest/tests.sh
@@ -465,7 +465,7 @@ plantest "ldap.secdesc.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python"
plantest "ldap.acl.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/acl.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN
plantest "blackbox.samba3dump" none $PYTHON $samba4srcdir/scripting/bin/samba3dump $samba4srcdir/../testdata/samba3
rm -rf $PREFIX/upgrade
-plantest "blackbox.upgrade" none $PYTHON $samba4srcdir/scripting/bin/upgrade_from_s3 $CONFIGURATION --targetdir=$PREFIX/upgrade $samba4srcdir/../testdata/samba3 ../testdata/samba3/smb.conf
+plantest "blackbox.upgrade" none $PYTHON $samba4srcdir/setup/upgrade_from_s3 $CONFIGURATION --targetdir=$PREFIX/upgrade $samba4srcdir/../testdata/samba3 ../testdata/samba3/smb.conf
rm -rf $PREFIX/provision
mkdir $PREFIX/provision
plantest "blackbox.provision.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_provision.sh "$PREFIX/provision"
diff --git a/source4/setup/provision b/source4/setup/provision
index f1aa07c..b855dc2 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -129,17 +129,25 @@ if opts.interactive:
if default is not None:
print "%s [%s]: " % (prompt,default),
else:
- print "%s: " % (prompt),
+ print "%s: " % (prompt,),
return sys.stdin.readline().rstrip("\n") or default
try:
- opts.realm = ask("Realm", socket.getfqdn().split(".", 1)[1].upper())
+ default = socket.getfqdn().split(".", 1)[1].upper()
except IndexError:
- opts.realm = ask("Realm", None)
+ default = None
+ opts.realm = ask("Realm", default)
+ if opts.realm in (None, ""):
+ print >>sys.stderr, "No realm set!"
+ sys.exit(1)
try:
- opts.domain = ask("Domain", opts.realm.split(".")[0])
+ default = opts.realm.split(".")[0]
except IndexError:
- opts.domain = ask("Domain", None)
+ default = None
+ opts.domain = ask("Domain", default)
+ if opts.domain is None:
+ print >> sys.stderr, "No domain set!"
+ sys.exit(1)
opts.server_role = ask("Server Role (dc, member, standalone)", "dc")
for i in range(3):
@@ -148,6 +156,17 @@ if opts.interactive:
print >>sys.stderr, "Invalid administrator password."
else:
break
+else:
+ if opts.realm is None or opts.domain is None:
+ if opts.realm is None:
+ print >>sys.stderr, "No realm set!"
+ if opts.domain is None:
+ print >> sys.stderr, "No domain set!"
+ parser.print_usage()
+ sys.exit(1)
+
+if not opts.adminpass:
+ message("Administrator password will be set randomly!")
lp = sambaopts.get_loadparm()
smbconf = lp.configfile
diff --git a/source4/scripting/bin/upgrade_from_s3 b/source4/setup/upgrade_from_s3
similarity index 100%
rename from source4/scripting/bin/upgrade_from_s3
rename to source4/setup/upgrade_from_s3
--
Samba Shared Repository
More information about the samba-cvs
mailing list