View | Details | Raw Unified | Return to bug 49720 | Differences between
and this patch

Collapse All | Expand All

(-)a/samba/00_waf_python2.quilt (-2 / +2 lines)
 Lines 4-11    Link Here 
4
 
4
 
5
 @conf
5
 @conf
6
 def define(self, key, val, quote=True, comment=None):
6
 def define(self, key, val, quote=True, comment=None):
7
+   if isinstance(key, unicode):
7
+   if not isinstance(key, str) and not isinstance(key, bytes):
8
+       key = str(key)
8
+       key = key.encode('utf-8')
9
    assert key and isinstance(key, str)
9
    assert key and isinstance(key, str)
10
 
10
 
11
    if val is None:
11
    if val is None:
(-)a/samba/40_samba3upgrade.quilt (-8 / +8 lines)
 Lines 29-37    Link Here 
29
             # In a lot of Samba3 databases, aliases are marked as well known groups
29
             # In a lot of Samba3 databases, aliases are marked as well known groups
30
-            (group_dom_sid, rid) = groupmap.sid.split()
30
-            (group_dom_sid, rid) = groupmap.sid.split()
31
+            try:
31
+            try:
32
+            	(group_dom_sid, rid) = groupmap.sid.split()
32
+                (group_dom_sid, rid) = groupmap.sid.split()
33
+            except:
33
+            except:
34
+                logger.warn('Failed to split sid for %s' % groupmap.nt_name)
34
+                logger.warn('Failed to split sid for %s' % (groupmap.nt_name,))
35
+                return
35
+                return
36
             if (group_dom_sid != security.dom_sid(security.SID_BUILTIN)):
36
             if (group_dom_sid != security.dom_sid(security.SID_BUILTIN)):
37
                 return
37
                 return
 Lines 71-84    Link Here 
71
-        if sid == domainsid:
71
-        if sid == domainsid:
72
-            if rid >= next_rid:
72
-            if rid >= next_rid:
73
-                next_rid = rid + 1
73
-                next_rid = rid + 1
74
+        logger.warn("GROUP '%s'", group.nt_name)
74
+        logger.warn("GROUP '%s'", (group.nt_name,))
75
+        logger.warn("GROUP SID '%s'", group.sid)
75
+        logger.warn("GROUP SID '%s'", (group.sid,))
76
+        try:
76
+        try:
77
+            sid, rid = group.sid.split()
77
+            sid, rid = group.sid.split()
78
+            if sid == domainsid:
78
+            if sid == domainsid:
79
+                if rid >= next_rid:
79
+                if rid >= next_rid:
80
+                    next_rid = rid + 1
80
+                    next_rid = rid + 1
81
+        except:
81
+        except Exception:
82
+            logger.warn("FAILED to get SID/rid")
82
+            logger.warn("FAILED to get SID/rid")
83
+            continue
83
+            continue
84
 
84
 
 Lines 104-118    Link Here 
104
             except ldb.LdbError as e:
104
             except ldb.LdbError as e:
105
-                raise ProvisioningError("Could not open ldb connection to %s, the error message is: %s" % (url, e))
105
-                raise ProvisioningError("Could not open ldb connection to %s, the error message is: %s" % (url, e))
106
+                logger.warning("Could not open ldb connection to %s, the error message is: %s\nTrying to dig.", url, e)
106
+                logger.warning("Could not open ldb connection to %s, the error message is: %s\nTrying to dig.", url, e)
107
+                from urlparse import urlparse
107
+                from urlparse import urlparse  # FIXME: python3
108
+                import subprocess
108
+                import subprocess
109
+                url_hostname = urlparse(url).hostname
109
+                url_hostname = urlparse(url).hostname
110
+                p1 = subprocess.Popen(["dig", "@localhost", url_hostname, "+short"], stdout=subprocess.PIPE)
110
+                p1 = subprocess.Popen(["dig", "@localhost", url_hostname, "+short"], stdout=subprocess.PIPE)
111
+                (stdout, stderr) = p1.communicate()
111
+                (stdout, stderr) = p1.communicate()
112
+                if stdout:
112
+                if stdout:
113
+			ldb_object = Ldb(url.replace(url_hostname, stdout.rstrip('\n')), credentials=creds)
113
+                    ldb_object = Ldb(url.replace(url_hostname, stdout.rstrip('\n')), credentials=creds)
114
+                else:
114
+                else:
115
+                	raise ProvisioningError("Could not open ldb connection to %s, the error message is: %s" % (url, e))
115
+                    raise ProvisioningError("Could not open ldb connection to %s, the error message is: %s" % (url, e))
116
             else:
116
             else:
117
                 break
117
                 break
118
     logger.info("Exporting posix attributes")
118
     logger.info("Exporting posix attributes")
(-)a/samba/44_upgrade_debug.quilt (-4 / +4 lines)
 Lines 5-12    Link Here 
5
             # Ignore uninitialized groups (gid = -1)
5
             # Ignore uninitialized groups (gid = -1)
6
             if g.gid != -1:
6
             if g.gid != -1:
7
+                try:
7
+                try:
8
+                    print('Importing group: %s' % g.nt_name)
8
+                    print('Importing group: %s' % (g.nt_name,))
9
+                except:
9
+                except Exception:
10
+                    print('Importing group: <groupname>')
10
+                    print('Importing group: <groupname>')
11
                 add_group_from_mapping_entry(result.samdb, g, logger)
11
                 add_group_from_mapping_entry(result.samdb, g, logger)
12
                 add_ad_posix_idmap_entry(result.samdb, g.sid, g.gid, "ID_TYPE_GID", logger)
12
                 add_ad_posix_idmap_entry(result.samdb, g.sid, g.gid, "ID_TYPE_GID", logger)
 Lines 16-23    Link Here 
16
                 logger.warn('User root has been kept in the directory, it should be removed in favour of the Administrator user')
16
                 logger.warn('User root has been kept in the directory, it should be removed in favour of the Administrator user')
17
 
17
 
18
+        try:
18
+        try:
19
+            print('Importing user: %s' % username)
19
+            print('Importing user: %s' % (username,))
20
+        except:
20
+        except Exception:
21
+            print('Importing user: <username>')
21
+            print('Importing user: <username>')
22
         s4_passdb.add_sam_account(userdata[username])
22
         s4_passdb.add_sam_account(userdata[username])
23
         if username in uids:
23
         if username in uids:
(-)a/samba/96_dnsupdate_exclude_interfaces.quilt (-3 / +3 lines)
 Lines 42-55   It can be used on an UCS system in the following way: Link Here 
42
+exclude_interfaces = ucr.get('samba/register/exclude/interfaces')
42
+exclude_interfaces = ucr.get('samba/register/exclude/interfaces')
43
+if exclude_interfaces:
43
+if exclude_interfaces:
44
+    if opts.verbose:
44
+    if opts.verbose:
45
+        print 'Exclude the following interfaces: %s' % exclude_interfaces
45
+        print('Exclude the following interfaces: %s' % exclude_interfaces)
46
+    for exclude_interface in exclude_interfaces.split(' '):
46
+    for exclude_interface in exclude_interfaces.split(' '):
47
+        exclude_ips = get_ip_address(exclude_interface)
47
+        exclude_ips = get_ip_address(exclude_interface)
48
+        if exclude_ips:
48
+        if exclude_ips:
49
+            IPs = [ip for ip in IPs if ip not in exclude_ips]
49
+            IPs = [ip for ip in IPs if ip not in exclude_ips]
50
+            if opts.verbose:
50
+            if opts.verbose:
51
+                print 'Exclude the following IP addresses: %s' % (exclude_ips,)
51
+                print('Exclude the following IP addresses: %s' % (exclude_ips,))
52
+      
52
+
53
 if opts.local:
53
 if opts.local:
54
     nsupdate_cmd = ['nsupdate','-l']
54
     nsupdate_cmd = ['nsupdate','-l']
55
     opts.nocreds = True
55
     opts.nocreds = True
(-)a/samba/97_Bug-44282-fix-LA-vs-DA-in-samba-tool-ntacl-syvolcheck.quilt (-7 / +7 lines)
 Lines 7-20    Link Here 
7
-    if fsacl_sddl != acl:
7
-    if fsacl_sddl != acl:
8
-        raise ProvisioningError('%s ACL on GPO directory %s %s does not match expected value %s from GPO object' % (acl_type(direct_db_access), path, fsacl_sddl, acl))
8
-        raise ProvisioningError('%s ACL on GPO directory %s %s does not match expected value %s from GPO object' % (acl_type(direct_db_access), path, fsacl_sddl, acl))
9
+
9
+
10
+    ## Sanitize "domainsid" to be a security.dom_sid
10
+    # Sanitize "domainsid" to be a security.dom_sid
11
+    if isinstance(domainsid, str):
11
+    if isinstance(domainsid, str):
12
+        domainsid = security.dom_sid(domainsid)
12
+        domainsid = security.dom_sid(domainsid)
13
+
13
+
14
+    ## If LA in filesystem then treat it as DA for comparison (reversing what samba.ntacls.setntacl did)
14
+    # If LA in filesystem then treat it as DA for comparison (reversing what samba.ntacls.setntacl did)
15
+    if fsacl.owner_sid == security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINISTRATOR)):
15
+    if fsacl.owner_sid == security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINISTRATOR)):
16
+        fsacl.owner_sid = security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINS))
16
+        fsacl.owner_sid = security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINS))
17
+    fsacl_sddl_mapped = fsacl.as_sddl(domainsid) 
17
+    fsacl_sddl_mapped = fsacl.as_sddl(domainsid)
18
+
18
+
19
+
19
+
20
+    if fsacl_sddl_mapped != acl:
20
+    if fsacl_sddl_mapped != acl:
 Lines 29-38    Link Here 
29
-            if fsacl_sddl != acl:
29
-            if fsacl_sddl != acl:
30
-                raise ProvisioningError('%s ACL on GPO file %s %s does not match expected value %s from GPO object' % (acl_type(direct_db_access), os.path.join(root, name), fsacl_sddl, acl))
30
-                raise ProvisioningError('%s ACL on GPO file %s %s does not match expected value %s from GPO object' % (acl_type(direct_db_access), os.path.join(root, name), fsacl_sddl, acl))
31
+
31
+
32
+            ## If LA in filesystem then treat it as DA for comparison (reversing what samba.ntacls.setntacl did)
32
+            # If LA in filesystem then treat it as DA for comparison (reversing what samba.ntacls.setntacl did)
33
+            if fsacl.owner_sid == security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINISTRATOR)):
33
+            if fsacl.owner_sid == security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINISTRATOR)):
34
+                fsacl.owner_sid = security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINS))
34
+                fsacl.owner_sid = security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINS))
35
+            fsacl_sddl_mapped = fsacl.as_sddl(domainsid) 
35
+            fsacl_sddl_mapped = fsacl.as_sddl(domainsid)
36
+
36
+
37
+            if fsacl_sddl_mapped != acl:
37
+            if fsacl_sddl_mapped != acl:
38
+                raise ProvisioningError('%s NTACL of GPO file %s %s does not match value %s expected from GPO object' % (acl_type(direct_db_access), os.path.join(root, name), fsacl_sddl_mapped, acl))
38
+                raise ProvisioningError('%s NTACL of GPO file %s %s does not match value %s expected from GPO object' % (acl_type(direct_db_access), os.path.join(root, name), fsacl_sddl_mapped, acl))
 Lines 46-55    Link Here 
46
-            if fsacl_sddl != acl:
46
-            if fsacl_sddl != acl:
47
-                raise ProvisioningError('%s ACL on GPO directory %s %s does not match expected value %s from GPO object' % (acl_type(direct_db_access), os.path.join(root, name), fsacl_sddl, acl))
47
-                raise ProvisioningError('%s ACL on GPO directory %s %s does not match expected value %s from GPO object' % (acl_type(direct_db_access), os.path.join(root, name), fsacl_sddl, acl))
48
+
48
+
49
+            ## If LA in filesystem then treat it as DA for comparison (reversing what samba.ntacls.setntacl did)
49
+            # If LA in filesystem then treat it as DA for comparison (reversing what samba.ntacls.setntacl did)
50
+            if fsacl.owner_sid == security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINISTRATOR)):
50
+            if fsacl.owner_sid == security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINISTRATOR)):
51
+                fsacl.owner_sid = security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINS))
51
+                fsacl.owner_sid = security.dom_sid("%s-%d" % (domainsid, security.DOMAIN_RID_ADMINS))
52
+            fsacl_sddl_mapped = fsacl.as_sddl(domainsid) 
52
+            fsacl_sddl_mapped = fsacl.as_sddl(domainsid)
53
+
53
+
54
+            if fsacl_sddl_mapped != acl:
54
+            if fsacl_sddl_mapped != acl:
55
+                raise ProvisioningError('%s NTACL of GPO directory %s %s does not match value %s expected from GPO object' % (acl_type(direct_db_access), os.path.join(root, name), fsacl_sddl_mapped, acl))
55
+                raise ProvisioningError('%s NTACL of GPO directory %s %s does not match value %s expected from GPO object' % (acl_type(direct_db_access), os.path.join(root, name), fsacl_sddl_mapped, acl))
(-)a/samba/97_Bug-46643-add-sysvolcheck-option-mask-msad-differences.quilt (-8 / +8 lines)
 Lines 7-13    Link Here 
7
-    def run(self, credopts=None, sambaopts=None, versionopts=None):
7
-    def run(self, credopts=None, sambaopts=None, versionopts=None):
8
+    takes_options = [
8
+    takes_options = [
9
+        Option("--mask-msad-differences", help="Ignore standard differences to MS AD ACLs", action="store_true"),
9
+        Option("--mask-msad-differences", help="Ignore standard differences to MS AD ACLs", action="store_true"),
10
+        ]
10
+    ]
11
+    def run(self, mask_msad_differences=False, credopts=None, sambaopts=None, versionopts=None):
11
+    def run(self, mask_msad_differences=False, credopts=None, sambaopts=None, versionopts=None):
12
         lp = sambaopts.get_loadparm()
12
         lp = sambaopts.get_loadparm()
13
         creds = credopts.get_credentials(lp)
13
         creds = credopts.get_credentials(lp)
 Lines 31-46    Link Here 
31
+    try:
31
+    try:
32
+        fsacl = getntacl(lp, path, direct_db_access=direct_db_access, service=SYSVOL_SERVICE)
32
+        fsacl = getntacl(lp, path, direct_db_access=direct_db_access, service=SYSVOL_SERVICE)
33
+        fsacl_sddl = fsacl.as_sddl(domainsid)
33
+        fsacl_sddl = fsacl.as_sddl(domainsid)
34
+    except TypeError as error:
34
+    except TypeError:
35
+        return
35
+        return
36
+    except NTSTATUSError as error:
36
+    except NTSTATUSError as error:
37
+        if check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
37
+        if check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
38
+            print "ERROR: File not found", path
38
+            print("ERROR: File not found", path)
39
+            return
39
+            return
40
+        else:
40
+        else:
41
+            raise
41
+            raise
42
+
42
+
43
+    ## Sanitize "domainsid" to be a security.dom_sid
43
+    # Sanitize "domainsid" to be a security.dom_sid
44
+    if isinstance(domainsid, str):
44
+    if isinstance(domainsid, str):
45
+        domainsid = security.dom_sid(domainsid)
45
+        domainsid = security.dom_sid(domainsid)
46
+
46
+
 Lines 117-132    Link Here 
117
+    try:
117
+    try:
118
+        ## also filter out ACE for CO, not present for GPT.INI of new GPOs created via GPMC
118
+        ## also filter out ACE for CO, not present for GPT.INI of new GPOs created via GPMC
119
+        sd_masked.dacl_del(CO)
119
+        sd_masked.dacl_del(CO)
120
+    except:
120
+    except Exception:
121
+        pass
121
+        pass
122
+    acl_expected_for_file = sd_masked.as_sddl(domainsid)
122
+    acl_expected_for_file = sd_masked.as_sddl(domainsid)
123
+
123
+
124
+    sd_masked.type &= ~ security.SEC_DESC_DACL_AUTO_INHERIT_REQ
124
+    sd_masked.type &= ~ security.SEC_DESC_DACL_AUTO_INHERIT_REQ
125
+    acl_expected_for_file_without_AR = sd_masked.as_sddl(domainsid)
125
+    acl_expected_for_file_without_AR = sd_masked.as_sddl(domainsid)
126
+
126
+
127
+    #print "ACL GPO:    %s" % acl_expected_for_gpo
127
+    #print("ACL GPO:    %s" % acl_expected_for_gpo)
128
+    #print "ACL DIR:    %s" % acl_expected_for_subdir
128
+    #print("ACL DIR:    %s" % acl_expected_for_subdir)
129
+    #print "ACL FILE:   %s" % acl_expected_for_file
129
+    #print("ACL FILE:   %s" % acl_expected_for_file)
130
+
130
+
131
+    for root, dirs, files in os.walk(path, topdown=False):
131
+    for root, dirs, files in os.walk(path, topdown=False):
132
+        for name in files:
132
+        for name in files:
(-)a/samba/97_Bug-47583-make-samba-tool-ntacl-sysvolcheck-show-the-file-path-in-error-message.quilt (-3 / +3 lines)
 Lines 43-58   index fa4cc59..c249df4 100644 Link Here 
43
-
43
-
44
+    try:
44
+    try:
45
+        fsacl = getntacl(lp, path, direct_db_access=direct_db_access, service=SYSVOL_SERVICE)
45
+        fsacl = getntacl(lp, path, direct_db_access=direct_db_access, service=SYSVOL_SERVICE)
46
+        fsacl_sddl = fsacl.as_sddl(domainsid) 
46
+        fsacl_sddl = fsacl.as_sddl(domainsid)
47
+    except TypeError as error:
47
+    except TypeError as error:
48
+        return
48
+        return
49
+    except NTSTATUSError as error:
49
+    except NTSTATUSError as error:
50
+        if check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
50
+        if check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
51
+            print "ERROR: File not found", path
51
+            print("ERROR: File not found", path)
52
+            return
52
+            return
53
+        else:
53
+        else:
54
+            raise
54
+            raise
55
     ## Sanitize "domainsid" to be a security.dom_sid
55
     # Sanitize "domainsid" to be a security.dom_sid
56
     if isinstance(domainsid, str):
56
     if isinstance(domainsid, str):
57
         domainsid = security.dom_sid(domainsid)
57
         domainsid = security.dom_sid(domainsid)
58
-- 
58
-- 
(-)a/samba/97_bug29665.quilt (-12 / +12 lines)
 Lines 106-112    Link Here 
106
+            raise CommandError("Either the username or '--filter' must be specified!")
106
+            raise CommandError("Either the username or '--filter' must be specified!")
107
+
107
+
108
+        if filter is None:
108
+        if filter is None:
109
+            filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username))
109
+            filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username),)  # FIXME: ldap filter escaping
110
+
110
+
111
+        lp = sambaopts.get_loadparm()
111
+        lp = sambaopts.get_loadparm()
112
+        creds = credopts.get_credentials(lp)
112
+        creds = credopts.get_credentials(lp)
 Lines 119-125    Link Here 
119
+                    expression=filter,
119
+                    expression=filter,
120
+                    attrs=["userPrincipalName"])
120
+                    attrs=["userPrincipalName"])
121
+
121
+
122
+        if (len(res) == 0):
122
+        if len(res) == 0:
123
+            raise CommandError("Failed to find user '%s': %s" % (username or filter, msg))
123
+            raise CommandError("Failed to find user '%s': %s" % (username or filter, msg))
124
+
124
+
125
+        if "userPrincipalName" in res[0]:
125
+        if "userPrincipalName" in res[0]:
 Lines 150-156    Link Here 
150
+        "sambaopts": options.SambaOptions,
150
+        "sambaopts": options.SambaOptions,
151
+        "credopts": options.CredentialsOptions,
151
+        "credopts": options.CredentialsOptions,
152
+        "versionopts": options.VersionOptions,
152
+        "versionopts": options.VersionOptions,
153
+        }
153
+    }
154
+
154
+
155
+    takes_options = [
155
+    takes_options = [
156
+        Option("-H", "--URL", help="LDB URL for database or target server", type=str,
156
+        Option("-H", "--URL", help="LDB URL for database or target server", type=str,
 Lines 165-171    Link Here 
165
+            raise CommandError("Either the username or '--filter' must be specified!")
165
+            raise CommandError("Either the username or '--filter' must be specified!")
166
+
166
+
167
+        if filter is None:
167
+        if filter is None:
168
+            filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username))
168
+            filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username),)  # FIXME: ldap filter escaping
169
+
169
+
170
+        lp = sambaopts.get_loadparm()
170
+        lp = sambaopts.get_loadparm()
171
+        creds = credopts.get_credentials(lp)
171
+        creds = credopts.get_credentials(lp)
 Lines 178-184    Link Here 
178
+
178
+
179
+        try:
179
+        try:
180
+            samdb.setupn(filter, upn)
180
+            samdb.setupn(filter, upn)
181
+        except Exception, msg:
181
+        except Exception as msg:
182
+            raise CommandError("Failed to set userPrincipalName for user '%s': %s" % (
182
+            raise CommandError("Failed to set userPrincipalName for user '%s': %s" % (
183
+                username or filter, msg))
183
+                username or filter, msg))
184
+        self.outf.write("Set UserPrincipalName %s for user '%s' .\n" % (
184
+        self.outf.write("Set UserPrincipalName %s for user '%s' .\n" % (
 Lines 221-227    Link Here 
221
+            raise CommandError("Either the username or '--filter' must be specified!")
221
+            raise CommandError("Either the username or '--filter' must be specified!")
222
+
222
+
223
+        if filter is None:
223
+        if filter is None:
224
+            filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username))
224
+            filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username),)  # FIXME: ldap filter escaping
225
+
225
+
226
+        lp = sambaopts.get_loadparm()
226
+        lp = sambaopts.get_loadparm()
227
+        creds = credopts.get_credentials(lp)
227
+        creds = credopts.get_credentials(lp)
 Lines 231-237    Link Here 
231
+
231
+
232
+        try:
232
+        try:
233
+            samdb.delupn(filter)
233
+            samdb.delupn(filter)
234
+        except Exception, msg:
234
+        except Exception as msg:
235
+            raise CommandError("Failed to remove userPrincipalName for user '%s': %s" % (
235
+            raise CommandError("Failed to remove userPrincipalName for user '%s': %s" % (
236
+                username or filter, msg))
236
+                username or filter, msg))
237
+
237
+
 Lines 514-520    Link Here 
514
+
514
+
515
+            found = self._find_user(user["name"])
515
+            found = self._find_user(user["name"])
516
+
516
+
517
+            self.assertEquals("%s" % found.get("userPrincipalName"), "%s" % upn)
517
+            self.assertEquals("%s" % found.get("userPrincipalName"), "%s" % (upn,))
518
+
518
+
519
+
519
+
520
     def test_getpwent(self):
520
     def test_getpwent(self):
 Lines 545-560    Link Here 
545
+
545
+
546
+    try:
546
+    try:
547
+        m = ldb.Message()
547
+        m = ldb.Message()
548
+        m.dn = ldb.Dn(samdb, "<SID=%s>" % str(sid))
548
+        m.dn = ldb.Dn(samdb, "<SID=%s>" % (sid,))
549
+        if xid_type == "ID_TYPE_UID":
549
+        if xid_type == "ID_TYPE_UID":
550
+            m['userPrincipalName'] = ldb.MessageElement(
550
+            m['userPrincipalName'] = ldb.MessageElement(
551
+                str(user_principal_name), ldb.FLAG_MOD_REPLACE, 'userPrincipalName')
551
+                str(user_principal_name), ldb.FLAG_MOD_REPLACE, 'userPrincipalName')
552
+
552
+
553
+        samdb.modify(m)
553
+        samdb.modify(m)
554
+    except ldb.LdbError, e:
554
+    except ldb.LdbError as e:
555
+        logger.warn(
555
+        logger.warn(
556
+            'Could not add userPrincipalName attr for AD entry for sid=%s, (%s)',
556
+            'Could not add userPrincipalName attr for AD entry for sid=%s, (%s)',
557
+            str(sid), str(e))
557
+            sid, e)
558
+
558
+
559
 
559
 
560
 def add_ad_posix_idmap_entry(samdb, sid, xid, xid_type, logger):
560
 def add_ad_posix_idmap_entry(samdb, sid, xid, xid_type, logger):
 Lines 572-578    Link Here 
572
                (username in shells) and (shells[username] is not None) and \
572
                (username in shells) and (shells[username] is not None) and \
573
                (username in pgids) and (pgids[username] is not None):
573
                (username in pgids) and (pgids[username] is not None):
574
                 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)
574
                 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)
575
+                if ( no_upn is not True ) and ( userdata[username].acct_ctrl & 16 ):
575
+                if (no_upn is not True) and (userdata[username].acct_ctrl & 16):
576
+                    add_userPrincipalName(samdb=result.samdb, sid=userdata[username].user_sid, name=username, realm=realm, xid_type="ID_TYPE_UID", logger=logger)
576
+                    add_userPrincipalName(samdb=result.samdb, sid=userdata[username].user_sid, name=username, realm=realm, xid_type="ID_TYPE_UID", logger=logger)
577
 
577
 
578
     logger.info("Adding users to groups")
578
     logger.info("Adding users to groups")
(-)a/samba/97_bug33616-samba-tool-dbcheck-handle-name-conflict-objects.quilt (-18 / +18 lines)
 Lines 39-48   Date: Tue Apr 1 12:16:10 2014 +0200 Link Here 
39
+            print(msg)
39
+            print(msg)
40
+            for ch in sorted(choice.keys()):
40
+            for ch in sorted(choice.keys()):
41
+                print("[%s] %s" % (ch, choice[ch]))
41
+                print("[%s] %s" % (ch, choice[ch]))
42
+            v = raw_input("What do you want to do %s? " % sorted(choice.keys()))
42
+            v = raw_input("What do you want to do %s? " % sorted(choice.keys()))  # FIXME: Python3
43
+            v = v.upper()
43
+            v = v.upper()
44
+            if not v in map(str, choice.keys()):
44
+            if v not in map(str, choice.keys()):
45
+                print("Unknown response '%s'" % v)
45
+                print("Unknown response '%s'" % (v,))
46
+            else:
46
+            else:
47
+                return v
47
+                return v
48
+
48
+
 Lines 58-68   Date: Tue Apr 1 12:16:10 2014 +0200 Link Here 
58
+
58
+
59
+        try:
59
+        try:
60
+            result = self.samdb.search(base=dn, scope=ldb.SCOPE_BASE)
60
+            result = self.samdb.search(base=dn, scope=ldb.SCOPE_BASE)
61
+        except ldb.LdbError, (enum, estr):
61
+        except ldb.LdbError as exc:
62
+            if enum != ldb.ERR_NO_SUCH_OBJECT:
62
+            if exc.args[0] != ldb.ERR_NO_SUCH_OBJECT:
63
+                raise
63
+                raise
64
+            result = ()
64
+            result = ()
65
+        if not len(result) == 1:
65
+        if len(result) != 1:
66
+            return
66
+            return
67
+        self.report("WARNING: Found name conflict object!")
67
+        self.report("WARNING: Found name conflict object!")
68
+        for line in self.samdb.write_ldif(result[0], ldb.CHANGETYPE_NONE).split("\n"):
68
+        for line in self.samdb.write_ldif(result[0], ldb.CHANGETYPE_NONE).split("\n"):
 Lines 74-104   Date: Tue Apr 1 12:16:10 2014 +0200 Link Here 
74
+        dn_non_cnf = cn + "," + base
74
+        dn_non_cnf = cn + "," + base
75
+        try:
75
+        try:
76
+            result = self.samdb.search(base=dn_non_cnf, scope=ldb.SCOPE_BASE)
76
+            result = self.samdb.search(base=dn_non_cnf, scope=ldb.SCOPE_BASE)
77
+        except ldb.LdbError, (enum, estr):
77
+        except ldb.LdbError as exc:
78
+            if enum != ldb.ERR_NO_SUCH_OBJECT:
78
+            if exc.args[0] != ldb.ERR_NO_SUCH_OBJECT:
79
+                raise
79
+                raise
80
+            result = ()
80
+            result = ()
81
+
81
+
82
+        msg = "Delete the conflict object or rename it to %s?" % dn_non_cnf
82
+        msg = "Delete the conflict object or rename it to %s?" % (dn_non_cnf,)
83
+        choice = {
83
+        choice = {
84
+            "1" : "delete the conflict object %s" % dn,
84
+            "1" : "delete the conflict object %s" % (dn,),
85
+            "2" : "rename the conflict object %s to %s" % (dn, dn_non_cnf),
85
+            "2" : "rename the conflict object %s to %s" % (dn, dn_non_cnf),
86
+            "3" : "none",  
86
+            "3" : "none",
87
+        }
87
+        }
88
+        if len(result) == 1:
88
+        if len(result) == 1:
89
+            self.report("Found corresponding non-conflict object!")
89
+            self.report("Found corresponding non-conflict object!")
90
+            for line in self.samdb.write_ldif(result[0], ldb.CHANGETYPE_NONE).split("\n"):
90
+            for line in self.samdb.write_ldif(result[0], ldb.CHANGETYPE_NONE).split("\n"):
91
+                self.report("  %s" % line)
91
+                self.report("  %s" % (line,))
92
+            msg = "Delete the conflict object or delete the non-conflict object and rename the conflict object to %s?" % dn_non_cnf
92
+            msg = "Delete the conflict object or delete the non-conflict object and rename the conflict object to %s?" % (dn_non_cnf,)
93
+            choice["2"] = "delete the non-conflict object %s and rename the conflict object to %s" % (dn_non_cnf, dn_non_cnf)
93
+            choice["2"] = "delete the non-conflict object %s and rename the conflict object to %s" % (dn_non_cnf, dn_non_cnf)
94
+        answer = self.question(msg, choice, default="1")
94
+        answer = self.question(msg, choice, default="1")
95
+        if answer == "1":
95
+        if answer == "1":
96
+            if self.do_delete(dn, [], "Failed to delete DN %s" % dn):
96
+            if self.do_delete(dn, [], "Failed to delete DN %s" % (dn,)):
97
+                self.report("Removed DN %s" % dn)
97
+                self.report("Removed DN %s" % (dn,))
98
+        elif answer == "2":
98
+        elif answer == "2":
99
+            if len(result) == 1:
99
+            if len(result) == 1:
100
+                if self.do_delete(result[0].dn, [], "Failed to delete DN %s" % result[0].dn):
100
+                if self.do_delete(result[0].dn, [], "Failed to delete DN %s" % (result[0].dn,)):
101
+                    self.report("Removed DN %s" % result[0].dn)
101
+                    self.report("Removed DN %s" % (result[0].dn,))
102
+            to_rdn, to_base = dn_non_cnf.split(",", 1)
102
+            to_rdn, to_base = dn_non_cnf.split(",", 1)
103
+            to_rdn += ","
103
+            to_rdn += ","
104
+            if self.do_rename(dn, to_rdn, to_base, [], "Failed to rename object %s into %s" % (dn, to_rdn + to_base)):
104
+            if self.do_rename(dn, to_rdn, to_base, [], "Failed to rename object %s into %s" % (dn, to_rdn + to_base)):
 Lines 112-118   Date: Tue Apr 1 12:16:10 2014 +0200 Link Here 
112
                 error_count += 1
112
                 error_count += 1
113
 
113
 
114
+        if self.check_for_conflicts:
114
+        if self.check_for_conflicts:
115
+            if not "\\0ADEL" in str(dn).upper():
115
+            if "\\0ADEL" not in str(dn).upper():
116
+                if "\\0ACNF" in str(dn).upper():
116
+                if "\\0ACNF" in str(dn).upper():
117
+                    self.handle_conflicts(dn)
117
+                    self.handle_conflicts(dn)
118
+
118
+
(-)a/samba/99_python3-samba-1.patch (+195 lines)
Line 0    Link Here 
1
commit b6a3f4baf2c28996072ca3c4f10d9f00a8f1e380
2
Author: Mathieu Parent <math.parent@gmail.com>
3
Date:   Thu Aug 29 10:47:51 2019 +0200
4
5
    Move to Python3 (from Ubuntu)
6
7
diff --git debian/control debian/control
8
index 7aa228e..babcd50 100644
9
--- debian/control
10
+++ debian/control
11
@@ -56,6 +56,14 @@ Build-Depends: bison,
12
                python-tdb (>= 1.3.16~),
13
                python-testtools,
14
                python3,
15
+               python3-all-dev,
16
+               python3-dnspython,
17
+               python3-etcd,
18
+               python3-ldb,
19
+               python3-ldb-dev,
20
+               python3-talloc-dev,
21
+               python3-tdb,
22
+               python3-testtools,
23
                xfslibs-dev [linux-any],
24
                xsltproc,
25
                zlib1g-dev (>= 1:1.2.3)
26
@@ -456,3 +464,24 @@ Description: clustered database to store temporary data
27
   * CTDB supports a system of application specific management scripts, allowing
28
     applications that depend on network or filesystem resources to be managed in
29
     a highly available manner on a cluster.
30
+
31
+Package: python3-samba
32
+Pre-Depends: ${misc:Pre-Depends}
33
+Architecture: any
34
+Section: python
35
+Provides: ${python3:Provides}
36
+Suggests: python3-gpgme
37
+Depends: python3-crypto,
38
+         python3-ldb,
39
+         python3-tdb,
40
+         samba-libs (= ${binary:Version}),
41
+         ${misc:Depends},
42
+         ${python3:Depends},
43
+         ${shlibs:Depends}
44
+Description: Python bindings for Samba
45
+ Samba is an implementation of the SMB/CIFS protocol for Unix systems,
46
+ providing support for cross-platform file sharing with Microsoft Windows, OS X,
47
+ and other Unix systems.  Samba can also function as a domain controller
48
+ or member server in both NT4-style and Active Directory domains.
49
+ .
50
+ This package contains Python bindings for most Samba libraries.
51
diff --git debian/python-samba.install debian/python-samba.install
52
index 353fe0d..490ac41 100644
53
--- debian/python-samba.install
54
+++ debian/python-samba.install
55
@@ -1 +1 @@
56
-usr/lib/python*/*-packages/samba
57
+usr/lib/python2*/*-packages/samba
58
diff --git debian/python3-samba.install debian/python3-samba.install
59
new file mode 100644
60
index 0000000..5908173
61
--- /dev/null
62
+++ debian/python3-samba.install
63
@@ -0,0 +1 @@
64
+usr/lib/python3*/*-packages/samba
65
diff --git debian/python3-samba.lintian-overrides debian/python3-samba.lintian-overrides
66
new file mode 100644
67
index 0000000..89facf8
68
--- /dev/null
69
+++ debian/python3-samba.lintian-overrides
70
@@ -0,0 +1,2 @@
71
+# False positives, see #896012
72
+python3-samba: library-not-linked-against-libc *
73
diff --git debian/rules debian/rules
74
index 36acb1c..456787f 100755
75
--- debian/rules
76
+++ debian/rules
77
@@ -15,12 +15,12 @@ PYVERS=$(shell pyversions -vr)
78
 
79
 LDB_VERSION = $(shell pkg-config --modversion ldb)
80
 LDB_EPOCH = $(shell dpkg-query -f '$${Version}' -W libldb-dev | sed 's/:.*//')
81
-LDB_NEXT_VERSION = $(shell python -c "x = '$(LDB_VERSION)'.split('.'); x[-1] = str(int(x[-1])+1); print '.'.join(x)")
82
+LDB_NEXT_VERSION = $(shell python3 -c "x = '$(LDB_VERSION)'.split('.'); x[-1] = str(int(x[-1])+1); print('.'.join(x))")
83
 # samba ships ldb modules, which are specific to the ldb version, so we need a
84
 # strict dependency on the upstream ldb version
85
 # this also mean samba needs a rebuild when the upstream ldb version changes
86
 LDB_DEPENDS = "libldb1 (<< $(LDB_EPOCH):$(LDB_NEXT_VERSION)~), libldb1 (>> $(LDB_EPOCH):$(LDB_VERSION)~)"
87
-export PYSHORT=$(shell pyversions -d)
88
+export PYSHORT=python3
89
 export PYTHON=$(shell which $(PYSHORT))
90
 export PYTHON_CONFIG="$(PYTHON)-config"
91
 WAF = $(PYTHON) ./buildtools/bin/waf -v
92
@@ -76,6 +76,7 @@ conf_args = \
93
 		--minimum-library-version="$(shell ./debian/autodeps.py --minimum-library-version)" \
94
 		--with-cluster-support \
95
 		--with-socketpath=/var/run/ctdb/ctdbd.socket \
96
+		--extra-python=/usr/bin/python2 \
97
 		--with-logdir=/var/log/ctdb
98
 
99
 ifeq ($(DEB_HOST_ARCH_OS), linux)
100
@@ -92,10 +93,10 @@ ifeq ($(DEB_HOST_ARCH_CPU), amd64)
101
 endif
102
 
103
 %:
104
-	dh $* --with python2
105
+	dh $* --with python2,python3
106
 
107
 override_dh_auto_configure:
108
-	$(WAF) configure $(conf_args)
109
+	PYTHON="" $(WAF) configure $(conf_args)
110
 
111
 override_dh_auto_clean:
112
 	-$(WAF) clean
113
@@ -134,7 +135,7 @@ override_dh_install:
114
 	# get list of files in build log
115
 	find ${DESTDIR}
116
 	# Included in python-tevent
117
-	rm $(DESTDIR)/usr/lib/python*/*-packages/_tevent.so
118
+	rm $(DESTDIR)/usr/lib/python*/*-packages/_tevent.*
119
 	rm $(DESTDIR)/usr/lib/python*/*-packages/tevent.py
120
 	# Already documented in debian/copyright
121
 	-rm $(DESTDIR)/usr/share/samba/setup/ad-schema/licence.txt
122
@@ -160,9 +161,11 @@ override_dh_install:
123
 	install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp/dhclient-enter-hooks.d/samba
124
 	# Install other stuff not installed by "make install"
125
 	install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
126
+	# This moves the dckeytab module to the samba package in order to avoid
127
+	# a circular dependency between python3-samba, samba and samba-common-bin
128
 	mkdir -p debian/samba/usr/lib/$(PYSHORT)/dist-packages/samba
129
-	mv $(DESTDIR)/usr/lib/$(PYSHORT)/dist-packages/samba/dckeytab.so \
130
-	   debian/samba/usr/lib/$(PYSHORT)/dist-packages/samba/dckeytab.so
131
+	mv $(DESTDIR)/usr/lib/$(PYSHORT)/dist-packages/samba/dckeytab*.so \
132
+	   debian/samba/usr/lib/$(PYSHORT)/dist-packages/samba/
133
 	mkdir -p $(DESTDIR)/etc/ufw/applications.d
134
 	install -m644 debian/samba.ufw.profile $(DESTDIR)/etc/ufw/applications.d/samba
135
 	# use upstream version of smb.conf.5 if there is no built version
136
diff --git debian/samba-dev.install debian/samba-dev.install
137
index 6a8dc5f..351b7e1 100644
138
--- debian/samba-dev.install
139
+++ debian/samba-dev.install
140
@@ -93,6 +93,7 @@ usr/lib/*/libsamba-errors.so
141
 usr/lib/*/libsamba-hostconfig.so
142
 usr/lib/*/libsamba-passdb.so
143
 usr/lib/*/libsamba-policy.so
144
+usr/lib/*/libsamba-policy.cpython-*.so
145
 usr/lib/*/libsamba-util.so
146
 usr/lib/*/libsamdb.so
147
 usr/lib/*/libsmbconf.so
148
@@ -109,5 +110,6 @@ usr/lib/*/pkgconfig/netapi.pc
149
 usr/lib/*/pkgconfig/samba-credentials.pc
150
 usr/lib/*/pkgconfig/samba-hostconfig.pc
151
 usr/lib/*/pkgconfig/samba-policy.pc
152
+usr/lib/*/pkgconfig/samba-policy.cpython-*.pc
153
 usr/lib/*/pkgconfig/samba-util.pc
154
 usr/lib/*/pkgconfig/samdb.pc
155
diff --git debian/samba-libs.install debian/samba-libs.install
156
index a2742f0..27ddc2f 100644
157
--- debian/samba-libs.install
158
+++ debian/samba-libs.install
159
@@ -12,6 +12,7 @@ usr/lib/*/libsamba-errors.so.*
160
 usr/lib/*/libsamba-hostconfig.so.*
161
 usr/lib/*/libsamba-passdb.so.*
162
 usr/lib/*/libsamba-policy.so.*
163
+usr/lib/*/libsamba-policy.cpython-*.so.*
164
 usr/lib/*/libsamba-util.so.*
165
 usr/lib/*/libsamdb.so.*
166
 usr/lib/*/libsmbconf.so.0
167
@@ -105,6 +106,8 @@ usr/lib/*/samba/libsamba-debug.so.0
168
 usr/lib/*/samba/libsamba-modules.so.*
169
 usr/lib/*/samba/libsamba-net.so.*
170
 usr/lib/*/samba/libsamba-python.so.0
171
+usr/lib/*/samba/libsamba-net.cpython-*.so.*
172
+usr/lib/*/samba/libsamba-python.cpython-*.so.0
173
 usr/lib/*/samba/libsamba-security.so.*
174
 usr/lib/*/samba/libsamba-sockets.so.*
175
 usr/lib/*/samba/libsamba3-util.so.*
176
diff --git debian/samba-libs.lintian-overrides debian/samba-libs.lintian-overrides
177
index e9f8aed..15dac80 100644
178
--- debian/samba-libs.lintian-overrides
179
+++ debian/samba-libs.lintian-overrides
180
@@ -1,6 +1,6 @@
181
 # the samba-libs package contains a number of libraries
182
 # it doesn't make sense to have them in separate packages, as this would
183
 # result in circular dependencies
184
-samba-libs: package-name-doesnt-match-sonames libdcerpc-binding0 libdcerpc-samr0 libdcerpc-server0 libdcerpc0 libndr-krb5pac0 libndr-nbt0 libndr-standard0 libndr0 libnetapi0 libsamba-credentials0 libsamba-errors1 libsamba-hostconfig0 libsamba-passdb0 libsamba-policy0 libsamba-util0 libsamdb0 libsmbconf0 libsmbldap2 libtevent-util0
185
+samba-libs: package-name-doesnt-match-sonames libdcerpc-binding0 libdcerpc-samr0 libdcerpc-server0 libdcerpc0 libndr-krb5pac0 libndr-nbt0 libndr-standard0 libndr0 libnetapi0 libsamba-credentials0 libsamba-errors1 libsamba-hostconfig0 libsamba-passdb0 libsamba-policy0 libsamba-policy.cpython-* libsamba-util0 libsamdb0 libsmbconf0 libsmbldap2 libtevent-util0
186
 # Embedded Heimdal is patched
187
 samba-libs: embedded-library usr/lib/*/samba/libgssapi-samba4.so.*: heimdal
188
diff --git debian/tests/python-smoke debian/tests/python-smoke
189
index 01e6681..31a6be6 100644
190
--- debian/tests/python-smoke
191
+++ debian/tests/python-smoke
192
@@ -1,2 +1,2 @@
193
 #!/bin/sh
194
-python -c 'import samba.samba3'
195
+python -c 'import samba.samba3' && python3 -c 'import samba.samba3'
(-)a/samba/99_python3-samba-2.patch (+27 lines)
Line 0    Link Here 
1
commit 2b644b748283bde6d384f4abb67886fd0bea7869
2
Author: Mathieu Parent <math.parent@gmail.com>
3
Date:   Tue Oct 1 21:04:19 2019 +0200
4
5
    Do not run waf configure in parallel. Fix FTBFS on arm (Closes: #941467)
6
7
diff --git debian/rules debian/rules
8
index 9710c71b0dc..0a569820b2a 100755
9
--- debian/rules
10
+++ debian/rules
11
@@ -24,6 +24,7 @@ export PYSHORT=python3
12
 export PYTHON=$(shell which $(PYSHORT))
13
 export PYTHON_CONFIG="$(PYTHON)-config"
14
 WAF = $(PYTHON) ./buildtools/bin/waf -v
15
+WAF_NO_PARALLEL = $(WAF)
16
 
17
 # turn DEB_BUILD_OPTIONS='foo,bar' into DEB_BUILD_OPT_FOO and DEB_BUILD_OPT_BAR
18
 d_b_o:=$(shell echo "$$DEB_BUILD_OPTIONS"|sed 's/[^-[:alnum:]]/ /g'|tr a-z A-Z)
19
@@ -96,7 +97,7 @@ endif
20
 	dh $* --with python2,python3
21
 
22
 override_dh_auto_configure:
23
-	PYTHON="" $(WAF) configure $(conf_args)
24
+	PYTHON="" $(WAF_NO_PARALLEL) configure $(conf_args)
25
 
26
 override_dh_auto_clean:
27
 	-$(WAF) clean
(-)a/samba/99_python3-samba-3.patch (+23 lines)
Line 0    Link Here 
1
commit 50178f6cd1de0ef874a32cecec3ea3a7ee5e1da4
2
Author: Mathieu Parent <math.parent@gmail.com>
3
Date:   Thu Oct 3 06:58:36 2019 +0200
4
5
    Force one job during configure step with -j 1 (Closes: #941467)
6
    
7
    Not setting -j leads to default which is number of cpus.
8
    
9
    See https://salsa.debian.org/samba-team/samba/blob/478603e68024a9c352072c20e0f4f712dd4c5a1c/third_party/waf/waflib/Options.py#L177-212
10
11
diff --git debian/rules debian/rules
12
index 77f48ac5c33..bf9bd0d703d 100755
13
--- debian/rules
14
+++ debian/rules
15
@@ -24,7 +24,7 @@ export PYSHORT=python3
16
 export PYTHON=$(shell which $(PYSHORT))
17
 export PYTHON_CONFIG="$(PYTHON)-config"
18
 WAF = $(PYTHON) ./buildtools/bin/waf -v
19
-WAF_NO_PARALLEL = $(WAF)
20
+WAF_NO_PARALLEL = $(WAF) -j 1
21
 
22
 # turn DEB_BUILD_OPTIONS='foo,bar' into DEB_BUILD_OPT_FOO and DEB_BUILD_OPT_BAR
23
 d_b_o:=$(shell echo "$$DEB_BUILD_OPTIONS"|sed 's/[^-[:alnum:]]/ /g'|tr a-z A-Z)
(-)a/samba/99_python3-samba-4.quilt (+32 lines)
Line 0    Link Here 
1
commit 261ef9d5b62f0d49f858717e6d8b4b41f008efb5
2
Author: Stefan Metzmacher <metze@samba.org>
3
Date:   Tue Mar 19 13:16:59 2019 +0100
4
5
    dbcheck: fix the err_empty_attribute() check
6
    
7
    ldb.bytes('') == '' is never True in python3,
8
    we nee ldb.bytes('') == b'' in order to
9
    check that on attribute has an empty value,
10
    that seems to work for python2 and python3.
11
    
12
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13843
13
    
14
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
15
    Reviewed-by: Noel Power <npower@samba.org>
16
    
17
    Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
18
    Autobuild-Date(master): Thu Mar 21 18:15:20 UTC 2019 on sn-devel-144
19
20
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
21
index c4747811c76..a0500c6c578 100644
22
--- a/python/samba/dbchecker.py
23
+++ b/python/samba/dbchecker.py
24
@@ -2445,7 +2445,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
25
 
26
             # check for empty attributes
27
             for val in obj[attrname]:
28
-                if val == '':
29
+                if val == b'':
30
                     self.err_empty_attribute(dn, attrname)
31
                     error_count += 1
32
                     continue
(-)a/samba/99_python3-samba-5.quilt (-1 / +14 lines)
Line 0    Link Here 
0
- 
1
diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
2
--- a/buildtools/wafsamba/samba_python.py
3
+++ b/buildtools/wafsamba/samba_python.py
4
@@ -203,6 +203,10 @@
5
         copied = ('GLOBAL_DEPENDENCIES', 'TARGET_TYPE') + tuple(extra_env_vars)
6
         for name in copied:
7
             bld.all_envs['extrapython'][name] = bld.all_envs['default'][name]
8
+        bld.all_envs['extrapython']['INCLUDES_PYEXT'] = ['/usr/include/python2.7']
9
+        bld.all_envs['extrapython']['INCLUDES_PYEMBED'] = ['/usr/include/python2.7']
10
+        bld.all_envs['extrapython']['LIB_PYEXT'] = [x if x != 'python3.5m' else 'python2.7' for x in bld.all_envs['extrapython']['LIB_PYEXT']]
11
+        bld.all_envs['extrapython']['LIB_PYEMBED'] = [x if x != 'python3.5m' else 'python2.7' for x in bld.all_envs['extrapython']['LIB_PYEMBED']]
12
         default_env = bld.all_envs['default']
13
         bld.all_envs['default'] = bld.all_envs['extrapython']
14
         yield

Return to bug 49720