Bug 11436 - samba-tool uncaught exception error
Summary: samba-tool uncaught exception error
Status: CLOSED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Python (show other bugs)
Version: 4.1.17
Hardware: All Linux
: P5 major (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-06 06:52 UTC by Cain
Modified: 2015-08-19 19:13 UTC (History)
3 users (show)

See Also:


Attachments
patch for master (1.19 KB, patch)
2015-08-14 04:44 UTC, Andrew Bartlett
no flags Details
my verson of upgrade.py (36.37 KB, text/plain)
2015-08-14 08:18 UTC, Cain
no flags Details
4.3 patch cherry-picked from master (1.43 KB, patch)
2015-08-14 20:12 UTC, Andrew Bartlett
metze: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cain 2015-08-06 06:52:43 UTC
When trying to do a classic upgrade from samba3 nt4 style domain to samba 4 AD we are getting the following error from samba-tool command:

.......
Next rid = 15625
Exporting posix attributes
ERROR(<type 'exceptions.TypeError'>): uncaught exception - __init__() 
takes exactly 2 arguments (5 given)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py",
line 175, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/domain.py",
line 1321, in run
    useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs)
  File "/usr/lib/python2.7/dist-packages/samba/upgrade.py", line 811, 
in upgrade_from_samba3
    homes[username] = get_posix_attr_from_ldap_backend(logger,
ldb_object, base_dn, username, "homeDirectory")
  File "/usr/lib/python2.7/dist-packages/samba/upgrade.py", line 542, 
in get_posix_attr_from_ldap_backend
    raise ProvisioningError("Failed to retrieve attribute %s for user 
%s, the error is: %s", attr, user, e)

Andrew indicated that this is a simply typo bug that needs to be fixed and after that, the script would indicate the actual error being hit.

Tested with:  Samba 3.5.x with an openldap backend. various versions of Debian and Samba4 (4.1.17 - 4.2.3) but samba-tool crashes with the above each time.

Thanks

Cain
Comment 1 Andrew Bartlett 2015-08-14 04:44:22 UTC
Created attachment 11331 [details]
patch for master
Comment 2 Cain 2015-08-14 08:18:02 UTC
Created attachment 11332 [details]
my verson of upgrade.py
Comment 3 Cain 2015-08-14 08:19:32 UTC
(In reply to Andrew Bartlett from comment #1)

Hi Andrew, no dice.

Not sure what upgrade.py you are working with but mine looks a little different.

First off the def get_posix_attr_from_ldap_backend method is on line 530 and not 407 as indicated in the patch file.  Also the def is completely different see attached version.

However after looking at the patch file I manually edited the line being changed and now the error just includes the braces - see below:

.......
Next rid = 15625
Exporting posix attributes
ERROR(<type 'exceptions.TypeError'>): uncaught exception - __init__() 
takes exactly 2 arguments (5 given)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py",
line 175, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/domain.py",
line 1321, in run
    useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs)
  File "/usr/lib/python2.7/dist-packages/samba/upgrade.py", line 811, 
in upgrade_from_samba3
    homes[username] = get_posix_attr_from_ldap_backend(logger,
ldb_object, base_dn, username, "homeDirectory")
  File "/usr/lib/python2.7/dist-packages/samba/upgrade.py", line 542, 
in get_posix_attr_from_ldap_backend
    raise ProvisioningError("Failed to retrieve attribute %s for user 
%s, the error is: %s", (attr, user, e))

Andrew indicated that this is a simply typo bug that needs to be fixed and after that, the script would indicate the actual error being hit.

Tested with:  Samba 3.5.x with an openldap backend. various versions of Debian and Samba4 (4.1.17 - 4.2.3) but samba-tool crashes with the above each time.

Thanks

Cain
Comment 4 Andrew Bartlett 2015-08-14 20:12:07 UTC
Created attachment 11335 [details]
4.3 patch cherry-picked from master

The attached patch is the cherry-pick from master to 4.3rc2
Comment 5 Andrew Bartlett 2015-08-14 20:15:16 UTC
The patch may apply back to older versions of Samba, but I'm mostly interested in getting this cosmetic fix sorted out for 4.3 and above, perhaps 4.2 if it happens to apply and isn't much trouble for the release team.

Please try again with Samba 4.3rc or apply it to 4.2.

The original patch I submitted still contained a syntax error, the new patch should be correct.
Comment 6 Stefan Metzmacher 2015-08-17 14:27:35 UTC
Pushed to autobuild-v4-3-test
Comment 7 Stefan Metzmacher 2015-08-18 11:30:43 UTC
Pushed to v4-3-test
Comment 8 Cain 2015-08-19 19:13:08 UTC
Thanks team - sorted.  After applying the patch I found three malformed dn's in our LDAP DB.

Current status is upgraded to Samba4 **WOOT**