[Samba] [PATCH] Fix classicupgrade error message (was Re: Classicupgrade not work)

2013-02-11 Thread Andrew Bartlett
On Mon, 2013-02-11 at 10:33 -0200, Jonis Maurin Ceará wrote:
 I'm trying to convert my samba3  domain to samba4 AD with samba-tool,
 but i'm getting an error and i can' t find anything about it on
 google.
 
 I've enabled the log level 4 on smb.conf and here's what i got:
 
 Home server: PANDORA
 init_sam_from_ldap: Entry found for user: DIRET-ESTAG$
 Home server: PANDORA
 init_sam_from_ldap: Entry found for user: dsegato
 Home server: PANDORA
 init_sam_from_ldap: Entry found for user: lesley
 Home server: PANDORA
 ERROR(type 'exceptions.AttributeError'): uncaught exception -
 'passdb.Samu' object has no attribute 'acct_flags'
   File 
 /usr/local/samba/lib64/python2.6/site-packages/samba/netcmd/__init__.py,
 line 175, in _run
 return self.run(*args, **kwargs)
   File 
 /usr/local/samba/lib64/python2.6/site-packages/samba/netcmd/domain.py,
 line 1318, in run
 useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs)
   File /usr/local/samba/lib64/python2.6/site-packages/samba/upgrade.py,
 line 722, in upgrade_from_samba3
 % (user.acct_flags, username,
 [
 
 
 I've copied my .tdb files to a new test server.also, i'm using
 ldap backend on s3.

I do apologise, there is an error in the classicupgrade script which
means that instead of printing an informative error, we print this
backtrace.  

I also attach another fix I've had in my local tree for a while, to fix
the error when we can't find the LDAP secrets. 

Please check this improves the error, and then if someone could review
and/or push this to master I would appreciate it.

Thanks,

Andrew Bartlett

-- 
Andrew Bartletthttp://samba.org/~abartlet/
Authentication Developer, Samba Team   http://samba.org

From bc6e7aaa73f52c449006b061c370e6c759c7620a Mon Sep 17 00:00:00 2001
From: Andrew Bartlett abart...@samba.org
Date: Tue, 12 Feb 2013 09:20:03 +1100
Subject: [PATCH] samba-tool domain classicupgrade: Fix typo in error path for
 multiple account flags

---
 source4/scripting/python/samba/upgrade.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index e013d2c..02734cc 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -722,7 +722,7 @@ ACB_NORMAL (N, 0x%08X), ACB_WSTRUST (W 0x%08X), ACB_SVRTRUST (S 0x%08X) or ACB_D
 
 Please fix this account before attempting to upgrade again
 
-% (user.acct_flags, username,
+% (user.acct_ctrl, username,
samr.ACB_NORMAL, samr.ACB_WSTRUST, samr.ACB_SVRTRUST, samr.ACB_DOMTRUST))
 
 userdata[username] = user
-- 
1.7.11.7

From 3d6aaf2b8c8fe15deb400020e4b084071ea98094 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett abart...@samba.org
Date: Tue, 15 Jan 2013 21:53:30 +1100
Subject: [PATCH 1/6] samba-tool domain classicupgrade: Print a better error
 when the ldap backend PW was not found

---
 source4/scripting/python/samba/upgrade.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index d680a7c..e013d2c 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -598,7 +598,10 @@ def upgrade_from_samba3(samba3, logger, targetdir, session_info=None,
 if samba3.lp.get(passdb backend).split(:)[0].strip() == ldapsam:
 base_dn =  samba3.lp.get(ldap suffix)
 ldapuser = samba3.lp.get(ldap admin dn)
-ldappass = (secrets_db.get_ldap_bind_pw(ldapuser)).strip('\x00')
+ldappass = secrets_db.get_ldap_bind_pw(ldapuser)
+if ldappass is None:
+raise ProvisioningError(ldapsam passdb backend detected but no LDAP Bind PW found in secrets.tdb for user %s.  Please point this tool at the secrets.tdb that was used by the previous installation.)
+ldappass = ldappass.strip('\x00')
 ldap = True
 else:
 ldapuser = None
-- 
1.7.11.7

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] [PATCH] Fix classicupgrade error message (was Re: Classicupgrade not work)

2013-02-11 Thread Jonis Maurin Ceará
Tks Andrew!!
Changes that you've made worked for that problem, but now i got a new
oneand in this one i'm really stuck! Not even a field name.

This is my log (log level 12):

element 32 - now SET
element 33 - now SET
ldapsam_get_account_policy: got valid value from cache
element 19 - now SET
element 15 - now SET
element 16 - now SET
attribute sambaBadPasswordCount does not exist
attribute sambaBadPasswordTime does not exist
attribute sambaLogonHours does not exist
Adding cache entry with key =
IDMAP/SID2XID/S-1-5-21-511255529-1355219746-1726288727-3659 and
timeout = Mon Feb 18 22:58:35 2013
 (604800 seconds ahead)
Adding cache entry with key = IDMAP/UID2SID/1341 and timeout = Mon Feb
18 22:58:35 2013
 (604800 seconds ahead)
gid 1003 - sid S-1-5-21-511255529-1355219746-1726288727-3007
gid 1003 - sid S-1-5-21-511255529-1355219746-1726288727-3007
do lookup_sid(S-1-5-21-511255529-1355219746-1726288727-3007) for group
of user lesley
lookup_sid called for SID 'S-1-5-21-511255529-1355219746-1726288727-3007'
Accepting SID S-1-5-21-511255529-1355219746-1726288727 in level 1
lookup_rids called for domain sid 'S-1-5-21-511255529-1355219746-1726288727'
smbldap_search_ext: base = [ou=Users,dc=fearp,dc=usp,dc=br], filter
= 
[((objectClass=sambaSamAccount)(|(sambaSid=S-1-5-21-511255529-1355219746-1726288727-3007)))],
scope = [2]
smbldap_open: already connected to the LDAP server
smbldap_search_ext: base = [dc=fearp,dc=usp,dc=br], filter =
[((objectClass=sambaGroupMapping)(|(sambaSid=S-1-5-21-511255529-1355219746-1726288727-3007)))],
scope = [2]
smbldap_open: already connected to the LDAP server
Sid S-1-5-21-511255529-1355219746-1726288727-3007 - FEARP\pgrd(2)
Did not store value for
IDMAP/SID2XID/S-1-5-21-511255529-1355219746-1726288727-3007, we
already got it
Did not store value for IDMAP/GID2SID/1003, we already got it
Looking up login cache for user lesley
No cache entry found
No cache entry, bad count = 0, bad time = 0
element 35 - now CHANGED
ERROR(type 'exceptions.TypeError'): uncaught exception - %X format:
a number is required, not str
  File /usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py,
line 175, in _run
return self.run(*args, **kwargs)
  File /usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain.py,
line 1318, in run
useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs)
  File /usr/local/samba/lib/python2.7/site-packages/samba/upgrade.py,
line 723, in upgrade_from_samba3
samr.ACB_NORMAL, samr.ACB_WSTRUST, samr.ACB_SVRTRUST, samr.ACB_DOMTRUST))
The connection to the LDAP server was closed


2013/2/11 Andrew Bartlett abart...@samba.org:
 On Mon, 2013-02-11 at 10:33 -0200, Jonis Maurin Ceará wrote:
 I'm trying to convert my samba3  domain to samba4 AD with samba-tool,
 but i'm getting an error and i can' t find anything about it on
 google.

 I've enabled the log level 4 on smb.conf and here's what i got:

 Home server: PANDORA
 init_sam_from_ldap: Entry found for user: DIRET-ESTAG$
 Home server: PANDORA
 init_sam_from_ldap: Entry found for user: dsegato
 Home server: PANDORA
 init_sam_from_ldap: Entry found for user: lesley
 Home server: PANDORA
 ERROR(type 'exceptions.AttributeError'): uncaught exception -
 'passdb.Samu' object has no attribute 'acct_flags'
   File 
 /usr/local/samba/lib64/python2.6/site-packages/samba/netcmd/__init__.py,
 line 175, in _run
 return self.run(*args, **kwargs)
   File 
 /usr/local/samba/lib64/python2.6/site-packages/samba/netcmd/domain.py,
 line 1318, in run
 useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs)
   File /usr/local/samba/lib64/python2.6/site-packages/samba/upgrade.py,
 line 722, in upgrade_from_samba3
 % (user.acct_flags, username,
 [


 I've copied my .tdb files to a new test server.also, i'm using
 ldap backend on s3.

 I do apologise, there is an error in the classicupgrade script which
 means that instead of printing an informative error, we print this
 backtrace.

 I also attach another fix I've had in my local tree for a while, to fix
 the error when we can't find the LDAP secrets.

 Please check this improves the error, and then if someone could review
 and/or push this to master I would appreciate it.

 Thanks,

 Andrew Bartlett

 --
 Andrew Bartletthttp://samba.org/~abartlet/
 Authentication Developer, Samba Team   http://samba.org

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] [PATCH] Fix classicupgrade error message (was Re: Classicupgrade not work)

2013-02-11 Thread Andrew Bartlett
On Tue, 2013-02-12 at 00:01 -0200, Jonis Maurin Ceará wrote:
 Tks Andrew!!
 Changes that you've made worked for that problem, but now i got a new
 oneand in this one i'm really stuck! Not even a field name.

Sorry for the noise.  I've fixed it up in this new patch, I hope. 

Revert the previous patch, and then apply this one. 

Thanks,

Andrew Bartlett

-- 
Andrew Bartletthttp://samba.org/~abartlet/
Authentication Developer, Samba Team   http://samba.org

From 22a1661a8312cbad99eb9fe016db4deefc11a9d1 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett abart...@samba.org
Date: Tue, 12 Feb 2013 09:20:03 +1100
Subject: [PATCH] samba-tool domain classicupgrade: Fix typo in error path for
 multiple account flags

---
 source4/scripting/python/samba/upgrade.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index e013d2c..8371224 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -722,7 +722,7 @@ ACB_NORMAL (N, 0x%08X), ACB_WSTRUST (W 0x%08X), ACB_SVRTRUST (S 0x%08X) or ACB_D
 
 Please fix this account before attempting to upgrade again
 
-% (user.acct_flags, username,
+% (username, user.acct_ctrl,
samr.ACB_NORMAL, samr.ACB_WSTRUST, samr.ACB_SVRTRUST, samr.ACB_DOMTRUST))
 
 userdata[username] = user
-- 
1.7.11.7

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba