The Samba-Bugzilla – Attachment 7913 Details for
Bug 9186
'samba-tool domain classicupgrade' fails with 'LDAP client internal error'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Small patch to make migration of POSIX attrs optional (refined)
samba-4.0.0_rc1-no-posix-attrs.patch (text/plain), 7.61 KB, created by
Torsten Kurbad
on 2012-09-20 15:32:28 UTC
(
hide
)
Description:
Small patch to make migration of POSIX attrs optional (refined)
Filename:
MIME Type:
Creator:
Torsten Kurbad
Created:
2012-09-20 15:32:28 UTC
Size:
7.61 KB
patch
obsolete
>diff -urN samba-4.0.0rc1.orig/source4/scripting/python/samba/netcmd/domain.py samba-4.0.0rc1/source4/scripting/python/samba/netcmd/domain.py >--- samba-4.0.0rc1.orig/source4/scripting/python/samba/netcmd/domain.py 2012-09-13 08:54:31.000000000 +0200 >+++ samba-4.0.0rc1/source4/scripting/python/samba/netcmd/domain.py 2012-09-20 17:14:38.294713483 +0200 >@@ -1212,6 +1212,8 @@ > help="Define if we should use the native fs capabilities or a tdb file for storing attributes likes ntacl, auto tries to make an inteligent guess based on the user rights and system capabilities", default="auto"), > Option("--use-ntvfs", help="Use NTVFS for the fileserver (default = no)", > action="store_true"), >+ Option("--no-posix-attrs", help="Do not migrate posix attributes (default = do migrate)", >+ action="store_true"), > Option("--dns-backend", type="choice", metavar="NAMESERVER-BACKEND", > choices=["SAMBA_INTERNAL", "BIND9_FLATFILE", "BIND9_DLZ", "NONE"], > help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), " \ >@@ -1225,8 +1227,9 @@ > > def run(self, smbconf=None, targetdir=None, dbdir=None, testparm=None, > quiet=False, verbose=False, use_xattrs=None, sambaopts=None, versionopts=None, >- dns_backend=None, use_ntvfs=False): >+ dns_backend=None, use_ntvfs=False, no_posix_attrs=False): > >+ #import pdb; pdb.set_trace(); > if not os.path.exists(smbconf): > raise CommandError("File %s does not exist" % smbconf) > >@@ -1309,7 +1312,8 @@ > > logger.info("Provisioning") > upgrade_from_samba3(samba3, logger, targetdir, session_info=system_session(), >- useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs) >+ useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs, >+ no_posix_attrs=no_posix_attrs) > > class cmd_domain(SuperCommand): > """Domain management""" >diff -urN samba-4.0.0rc1.orig/source4/scripting/python/samba/upgrade.py samba-4.0.0rc1/source4/scripting/python/samba/upgrade.py >--- samba-4.0.0rc1.orig/source4/scripting/python/samba/upgrade.py 2012-09-04 20:44:52.000000000 +0200 >+++ samba-4.0.0rc1/source4/scripting/python/samba/upgrade.py 2012-09-20 17:18:09.341389587 +0200 >@@ -546,7 +546,7 @@ > return None > > def upgrade_from_samba3(samba3, logger, targetdir, session_info=None, useeadb=False, dns_backend=None, >- use_ntvfs=False): >+ use_ntvfs=False, no_posix_attrs=False): > """Upgrade from samba3 database to samba4 AD database > > :param samba3: samba3 object >@@ -770,44 +770,48 @@ > raise ProvisioningError("Please remove duplicate sid entries before upgrade.") > > # Get posix attributes from ldap or the os >- homes = {} >- shells = {} >- pgids = {} >- if ldap: >- creds = Credentials() >- creds.guess(samba3.lp) >- creds.set_bind_dn(ldapuser) >- creds.set_password(ldappass) >- urls = samba3.lp.get("passdb backend").split(":",1)[1].strip('"') >- for url in urls.split(): >- try: >- ldb_object = Ldb(url, credentials=creds) >- except ldb.LdbError, e: >- logger.warning("Could not open ldb connection to %s, the error message is: %s", url, e) >- else: >- break >- logger.info("Exporting posix attributes") >- userlist = s3db.search_users(0) >- for entry in userlist: >- username = entry['account_name'] >- if username in uids.keys(): >- if ldap: >- homes[username] = get_posix_attr_from_ldap_backend(logger, ldb_object, base_dn, username, "homeDirectory") >- shells[username] = get_posix_attr_from_ldap_backend(logger, ldb_object, base_dn, username, "loginShell") >- pgids[username] = get_posix_attr_from_ldap_backend(logger, ldb_object, base_dn, username, "gidNumber") >- else: >- try: >- homes[username] = pwd.getpwnam(username).pw_dir >- except KeyError: >- pass >- try: >- shells[username] = pwd.getpwnam(username).pw_shell >- except KeyError: >- pass >+ if not no_posix_attrs: >+ ldb_object = None >+ homes = {} >+ shells = {} >+ pgids = {} >+ if ldap: >+ creds = Credentials() >+ creds.guess(samba3.lp) >+ creds.set_bind_dn(ldapuser) >+ creds.set_password(ldappass) >+ urls = samba3.lp.get("passdb backend").split(":",1)[1].strip('"') >+ for url in urls.split(): > try: >- pgids[username] = pwd.getpwnam(username).pw_gid >- except KeyError: >- pass >+ ldb_object = Ldb(url, credentials=creds) >+ except ldb.LdbError, e: >+ logger.warning("Could not open ldb connection to %s, the error message is: %s", url, e) >+ else: >+ break >+ logger.info("Exporting posix attributes") >+ userlist = s3db.search_users(0) >+ for entry in userlist: >+ username = entry['account_name'] >+ if username in uids.keys(): >+ if ldb_object is None: >+ logger.warning('Could not get posix attributes for %s' % username) >+ if ldap and ldb_object is not None: >+ homes[username] = get_posix_attr_from_ldap_backend(logger, ldb_object, base_dn, username, "homeDirectory") >+ shells[username] = get_posix_attr_from_ldap_backend(logger, ldb_object, base_dn, username, "loginShell") >+ pgids[username] = get_posix_attr_from_ldap_backend(logger, ldb_object, base_dn, username, "gidNumber") >+ else: >+ try: >+ homes[username] = pwd.getpwnam(username).pw_dir >+ except KeyError: >+ pass >+ try: >+ shells[username] = pwd.getpwnam(username).pw_shell >+ except KeyError: >+ pass >+ try: >+ pgids[username] = pwd.getpwnam(username).pw_gid >+ except KeyError: >+ pass > > logger.info("Reading WINS database") > samba3_winsdb = None >@@ -880,10 +884,11 @@ > s4_passdb.add_sam_account(userdata[username]) > if username in uids: > add_ad_posix_idmap_entry(result.samdb, userdata[username].user_sid, uids[username], "ID_TYPE_UID", logger) >- if (username in homes) and (homes[username] != None) and \ >- (username in shells) and (shells[username] != None) and \ >- (username in pgids) and (pgids[username] != None): >- add_posix_attrs(samdb=result.samdb, sid=userdata[username].user_sid, name=username, nisdomain=domainname.lower(), xid_type="ID_TYPE_UID", home=homes[username], shell=shells[username], pgid=pgids[username], logger=logger) >+ if not no_posix_attrs: >+ if (username in homes) and (homes[username] != None) and \ >+ (username in shells) and (shells[username] != None) and \ >+ (username in pgids) and (pgids[username] != None): >+ add_posix_attrs(samdb=result.samdb, sid=userdata[username].user_sid, name=username, nisdomain=domainname.lower(), xid_type="ID_TYPE_UID", home=homes[username], shell=shells[username], pgid=pgids[username], logger=logger) > > logger.info("Adding users to groups") > for g in grouplist:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 9186
:
7912
| 7913