[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Feb 10 08:06:02 UTC 2017


The branch, master has been updated
       via  34b0ee8 messaging_dgm: avoid GCC snprintf warnings in messaging_dgm_out_create
       via  a091a30 shadow_copy_get_shadow_copy_data: fix GCC snprintf warning
       via  1864322 python provision: fix indenting of doc string
       via  3ee5660 ntlmssp: fix compilation with -O2 -fno-inline
       via  2ad69f4 getncchanges script: use library code, not copied functions.
       via  b02d636 lib/replace tests: prevent GCC fretting over snprintf sizes
       via  1a33044 fix blackbox_supported_features: mkdir -p its directory
       via  c4299da docs/smbconf: update log level list in man page
       via  3c63f47 selftest: show multiple arguments for --help
       via  6f88ff8 waf --test-list takes a filename argument
      from  a592bdc docs: Add missing spaces in man smb.conf.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 34b0ee832850e5a01b337caf70677bdae6eea551
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Feb 9 14:03:33 2017 +1300

    messaging_dgm: avoid GCC snprintf warnings in messaging_dgm_out_create
    
    We are trying to put something that (in theory) could be 109 bytes
    long, into the sockaddr_un.sun_path field which has a fixed size of
    108 bytes. The "in theory" part is that one of the components is a
    pid, which although stored as 32 bits is in practice 16 bits, so the
    maximum size is not actually hit.
    
    This is all very annoying, because the length is checked anyway and
    all this achieves is silencing a warning.
    
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri Feb 10 09:05:31 CET 2017 on sn-devel-144

commit a091a30a5bd50bc02df3e9c01b11f70c94dbd053
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 9 13:02:52 2017 +1300

    shadow_copy_get_shadow_copy_data: fix GCC snprintf warning
    
    GCC 7 warns about snprintf truncating a dirent d_name (potentially 255 bytes) to 25 bytes,
    even though we have checked that it is 25 long in shadow_copy_match_name().
    
    Using strlcpy instead of snprintf lets us check it again, JUST TO BE SURE.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 18643226a69c3db62db1736d958298a07dd5ab51
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Dec 15 09:34:28 2016 +1300

    python provision: fix indenting of doc string
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3ee56607db8b4fedd5d04f74de548ae7324686cd
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Dec 21 13:24:46 2016 +1300

    ntlmssp: fix compilation with -O2 -fno-inline
    
    Without inlining the function, GCC doesn't know that
    gensec_ntlmssp->ntlmssp_state->role always has a valid value.
    
    With inlining, this is obviously redundant but GCC clearly knows
    enough to detect this and elide the default case.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2ad69f4bd0f724296a40347a140a031f6ab341e9
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Oct 28 15:05:28 2016 +1300

    getncchanges script: use library code, not copied functions.
    
    These functions were duplicates. To be exact, the diff -ub between what
    getncchanges had, and what drs_uitls now has is this:
    
    |@@ -1,4 +1,5 @@
    |-def do_DsBind(drs):
    |+def drs_DsBind(drs):
    |     '''make a DsBind call, returning the binding handle'''
    |     bind_info = drsuapi.DsBindInfoCtr()
    |     bind_info.length = 28
    |@@ -32,7 +33,8 @@
    |     bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7
    |     bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT
    |     (info, handle) = drs.DsBind(misc.GUID(drsuapi.DRSUAPI_DS_BIND_GUID), bind_info)
    |-    return handle
    |+
    |+    return (handle, info.info.supported_extensions)
    |
    |
    | def drs_get_rodc_partial_attribute_set(samdb):
    |@@ -43,7 +45,7 @@
    |     attids = []
    |
    |     # the exact list of attids we send is quite critical. Note that
    |-    # we do ask for the secret attributes, but set set SPECIAL_SECRET_PROCESSING
    |+    # we do ask for the secret attributes, but set SPECIAL_SECRET_PROCESSING
    |     # to zero them out
    |     schema_dn = samdb.get_schema_basedn()
    |     res = samdb.search(base=schema_dn, scope=ldb.SCOPE_SUBTREE,
    |@@ -71,3 +73,4 @@
    |     partial_attribute_set.attids         = attids
    |     partial_attribute_set.num_attids = len(attids)
    |     return partial_attribute_set
    
    while the drs_utils code has changed in moving
    drs_get_rodc_partial_attribute_set() out of the class.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b02d636e0b1c43821a83297f51599bb03b5858b3
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Tue Nov 1 13:26:11 2016 +1300

    lib/replace tests: prevent GCC fretting over snprintf sizes
    
    These tests deliberately use snprintf for truncating strings, which is
    fine for tests. This has the effect of leaving the warning in place
    but preventing it from becoming a fatal error.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1a330443c64f237d7f0096f91880b6e358a93bf7
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Feb 10 12:30:59 2017 +1300

    fix blackbox_supported_features: mkdir -p its directory
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c4299da8ac1ae465349bcce6bbba8883f5066ea5
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Jan 26 11:39:13 2017 +1300

    docs/smbconf: update log level list in man page
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3c63f4711aab65afe650e8bc752fe188b730879b
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Jan 27 15:10:29 2017 +1300

    selftest: show multiple arguments for --help
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6f88ff83bfef7e9dac806b6bfa3144a9235e921b
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 2 17:26:43 2017 +1300

    waf --test-list takes a filename argument
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 auth/ntlmssp/ntlmssp.c                             |  4 ++
 docs-xml/smbdotconf/logging/loglevel.xml           |  4 ++
 lib/replace/wscript                                |  7 +-
 python/samba/drs_utils.py                          | 77 +++++++++++-----------
 python/samba/provision/__init__.py                 |  2 +-
 selftest/selftest.pl                               |  2 +-
 selftest/wscript                                   |  1 -
 source3/include/ntioctl.h                          |  2 +-
 source3/lib/messages_dgm.c                         |  5 +-
 source3/modules/vfs_shadow_copy.c                  | 11 +++-
 source4/scripting/devel/getncchanges               | 77 +---------------------
 source4/setup/tests/blackbox_supported_features.sh |  2 +
 12 files changed, 72 insertions(+), 122 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/ntlmssp/ntlmssp.c b/auth/ntlmssp/ntlmssp.c
index 4abab88..3283c96 100644
--- a/auth/ntlmssp/ntlmssp.c
+++ b/auth/ntlmssp/ntlmssp.c
@@ -107,6 +107,10 @@ static NTSTATUS gensec_ntlmssp_update_find(struct gensec_security *gensec_securi
 				return NT_STATUS_INVALID_PARAMETER;
 			}
 			break;
+		default:
+			DEBUG(1, ("NTLMSSP state has invalid role %d\n",
+				  gensec_ntlmssp->ntlmssp_state->role));
+			return NT_STATUS_INVALID_PARAMETER;
 		}
 	} else {
 		if (!msrpc_parse(gensec_ntlmssp->ntlmssp_state,
diff --git a/docs-xml/smbdotconf/logging/loglevel.xml b/docs-xml/smbdotconf/logging/loglevel.xml
index f4e2adb..d943dd9 100644
--- a/docs-xml/smbdotconf/logging/loglevel.xml
+++ b/docs-xml/smbdotconf/logging/loglevel.xml
@@ -37,6 +37,10 @@
 	<listitem><para><parameter moreinfo="none">msdfs</parameter></para></listitem>
 	<listitem><para><parameter moreinfo="none">dmapi</parameter></para></listitem>
 	<listitem><para><parameter moreinfo="none">registry</parameter></para></listitem>
+        <listitem><para><parameter moreinfo="none">scavenger</parameter></para></listitem>
+        <listitem><para><parameter moreinfo="none">dns</parameter></para></listitem>
+        <listitem><para><parameter moreinfo="none">ldb</parameter></para></listitem>
+        <listitem><para><parameter moreinfo="none">tevent</parameter></para></listitem>
     </itemizedlist>
     
 </description>
diff --git a/lib/replace/wscript b/lib/replace/wscript
index ea0d5d0..de199b1 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -704,9 +704,10 @@ def build(bld):
                       deps='crypt dl nsl socket rt attr' + extra_libs)
 
     bld.SAMBA_SUBSYSTEM('replace-test',
-                      source='''test/testsuite.c test/strptime.c
-                      test/os2_delete.c test/getifaddrs.c''',
-                      deps='replace')
+                        source='''test/testsuite.c test/strptime.c
+                        test/os2_delete.c test/getifaddrs.c''',
+                        deps='replace',
+                        cflags="-Wno-format-length")
 
     if bld.env.standalone_replace:
         bld.SAMBA_BINARY('replace_testsuite',
diff --git a/python/samba/drs_utils.py b/python/samba/drs_utils.py
index 07fc05a..126c57e 100644
--- a/python/samba/drs_utils.py
+++ b/python/samba/drs_utils.py
@@ -144,6 +144,44 @@ def drs_DsBind(drs):
     return (handle, info.info.supported_extensions)
 
 
+def drs_get_rodc_partial_attribute_set(samdb):
+    '''get a list of attributes for RODC replication'''
+    partial_attribute_set = drsuapi.DsPartialAttributeSet()
+    partial_attribute_set.version = 1
+
+    attids = []
+
+    # the exact list of attids we send is quite critical. Note that
+    # we do ask for the secret attributes, but set SPECIAL_SECRET_PROCESSING
+    # to zero them out
+    schema_dn = samdb.get_schema_basedn()
+    res = samdb.search(base=schema_dn, scope=ldb.SCOPE_SUBTREE,
+                       expression="objectClass=attributeSchema",
+                       attrs=["lDAPDisplayName", "systemFlags",
+                              "searchFlags"])
+
+    for r in res:
+        ldap_display_name = r["lDAPDisplayName"][0]
+        if "systemFlags" in r:
+            system_flags      = r["systemFlags"][0]
+            if (int(system_flags) & (samba.dsdb.DS_FLAG_ATTR_NOT_REPLICATED |
+                                     samba.dsdb.DS_FLAG_ATTR_IS_CONSTRUCTED)):
+                continue
+        if "searchFlags" in r:
+            search_flags = r["searchFlags"][0]
+            if (int(search_flags) & samba.dsdb.SEARCH_FLAG_RODC_ATTRIBUTE):
+                continue
+        attid = samdb.get_attid_from_lDAPDisplayName(ldap_display_name)
+        attids.append(int(attid))
+
+    # the attids do need to be sorted, or windows doesn't return
+    # all the attributes we need
+    attids.sort()
+    partial_attribute_set.attids         = attids
+    partial_attribute_set.num_attids = len(attids)
+    return partial_attribute_set
+
+
 class drs_Replicate(object):
     '''DRS replication calls'''
 
@@ -158,43 +196,6 @@ class drs_Replicate(object):
             raise RuntimeError("Must not set GUID 00000000-0000-0000-0000-000000000000 as invocation_id")
         self.replication_state = self.net.replicate_init(self.samdb, lp, self.drs, invocation_id)
 
-    def drs_get_rodc_partial_attribute_set(self):
-        '''get a list of attributes for RODC replication'''
-        partial_attribute_set = drsuapi.DsPartialAttributeSet()
-        partial_attribute_set.version = 1
-
-        attids = []
-
-        # the exact list of attids we send is quite critical. Note that
-        # we do ask for the secret attributes, but set SPECIAL_SECRET_PROCESSING
-        # to zero them out
-        schema_dn = self.samdb.get_schema_basedn()
-        res = self.samdb.search(base=schema_dn, scope=ldb.SCOPE_SUBTREE,
-                                      expression="objectClass=attributeSchema",
-                                      attrs=["lDAPDisplayName", "systemFlags",
-                                             "searchFlags"])
-
-        for r in res:
-            ldap_display_name = r["lDAPDisplayName"][0]
-            if "systemFlags" in r:
-                system_flags      = r["systemFlags"][0]
-                if (int(system_flags) & (samba.dsdb.DS_FLAG_ATTR_NOT_REPLICATED |
-                                         samba.dsdb.DS_FLAG_ATTR_IS_CONSTRUCTED)):
-                    continue
-            if "searchFlags" in r:
-                search_flags = r["searchFlags"][0]
-                if (int(search_flags) & samba.dsdb.SEARCH_FLAG_RODC_ATTRIBUTE):
-                    continue
-            attid = self.samdb.get_attid_from_lDAPDisplayName(ldap_display_name)
-            attids.append(int(attid))
-
-        # the attids do need to be sorted, or windows doesn't return
-        # all the attributes we need
-        attids.sort()
-        partial_attribute_set.attids         = attids
-        partial_attribute_set.num_attids = len(attids)
-        return partial_attribute_set
-
     def replicate(self, dn, source_dsa_invocation_id, destination_dsa_guid,
                   schema=False, exop=drsuapi.DRSUAPI_EXOP_NONE, rodc=False,
                   replica_flags=None):
@@ -237,7 +238,7 @@ class drs_Replicate(object):
         req8.mapping_ctr.mappings = None
 
         if not schema and rodc:
-            req8.partial_attribute_set = self.drs_get_rodc_partial_attribute_set()
+            req8.partial_attribute_set = drs_get_rodc_partial_attribute_set(self.samdb)
 
         if self.supported_extensions & drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8:
             req_level = 8
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index faa4b0c..3187b65 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -929,7 +929,7 @@ def secretsdb_self_join(secretsdb, domain,
 def setup_secretsdb(paths, session_info, backend_credentials, lp):
     """Setup the secrets database.
 
-   :note: This function does not handle exceptions and transaction on purpose,
+    :note: This function does not handle exceptions and transaction on purpose,
        it's up to the caller to do this job.
 
     :param path: Path to the secrets database.
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 14ac58f..bfc8d7f 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -189,7 +189,7 @@ sub ShowHelp()
 Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
 Copyright (C) Stefan Metzmacher <metze\@samba.org>
 
-Usage: $Script [OPTIONS] TESTNAME-REGEX
+Usage: $Script [OPTIONS] TESTNAME-REGEX [TESTNAME-REGEX...]
 
 Generic options:
  --help                     this help page
diff --git a/selftest/wscript b/selftest/wscript
index 86deac5..f35efa8 100644
--- a/selftest/wscript
+++ b/selftest/wscript
@@ -82,7 +82,6 @@ def set_options(opt):
     gr.add_option('--perf-test', dest='PERF_TEST', default=False,
                   action="store_true", help="run performance tests only")
     gr.add_option('--test-list', dest='TEST_LIST', default='',
-                  action="store_true",
                   help=("use tests listed here, not defaults "
                         "(--test-list='FOO|' will execute FOO; "
                         "--test-list='FOO' will read it)"))
diff --git a/source3/include/ntioctl.h b/source3/include/ntioctl.h
index f9e6dd9..bd80a30 100644
--- a/source3/include/ntioctl.h
+++ b/source3/include/ntioctl.h
@@ -30,7 +30,7 @@
 
 
 /* For FSCTL_GET_SHADOW_COPY_DATA ...*/
-typedef char SHADOW_COPY_LABEL[25];
+typedef char SHADOW_COPY_LABEL[25]; /* sizeof("@GMT-2004.02.18-15.44.00") + 1 */
 
 struct shadow_copy_data {
 	/* Total number of shadow volumes currently mounted */
diff --git a/source3/lib/messages_dgm.c b/source3/lib/messages_dgm.c
index 49b3903..dff8357 100644
--- a/source3/lib/messages_dgm.c
+++ b/source3/lib/messages_dgm.c
@@ -212,6 +212,7 @@ static int messaging_dgm_out_create(TALLOC_CTX *mem_ctx,
 	struct sockaddr_un addr = { .sun_family = AF_UNIX };
 	int ret = ENOMEM;
 	int out_pathlen;
+	char addr_buf[sizeof(addr.sun_path) + (3 * sizeof(unsigned) + 2)];
 
 	out = talloc(mem_ctx, struct messaging_dgm_out);
 	if (out == NULL) {
@@ -224,7 +225,7 @@ static int messaging_dgm_out_create(TALLOC_CTX *mem_ctx,
 		.cookie = 1
 	};
 
-	out_pathlen = snprintf(addr.sun_path, sizeof(addr.sun_path),
+	out_pathlen = snprintf(addr_buf, sizeof(addr_buf),
 			       "%s/%u", ctx->socket_dir.buf, (unsigned)pid);
 	if (out_pathlen < 0) {
 		goto errno_fail;
@@ -234,6 +235,8 @@ static int messaging_dgm_out_create(TALLOC_CTX *mem_ctx,
 		goto fail;
 	}
 
+	memcpy(addr.sun_path, addr_buf, out_pathlen + 1);
+
 	out->queue = tevent_queue_create(out, addr.sun_path);
 	if (out->queue == NULL) {
 		ret = ENOMEM;
diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c
index 9b43e85..dae70f5 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -252,6 +252,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
 	while (True) {
 		SHADOW_COPY_LABEL *tlabels;
 		struct dirent *d;
+		int ret;
 
 		d = SMB_VFS_NEXT_READDIR(handle, p, NULL);
 		if (d == NULL) {
@@ -280,7 +281,15 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
 			return -1;
 		}
 
-		snprintf(tlabels[shadow_copy_data->num_volumes++], sizeof(*tlabels), "%s",d->d_name);
+		ret = strlcpy(tlabels[shadow_copy_data->num_volumes], d->d_name,
+			      sizeof(tlabels[shadow_copy_data->num_volumes]));
+		if (ret != sizeof(tlabels[shadow_copy_data->num_volumes]) - 1) {
+			DEBUG(0,("shadow_copy_get_shadow_copy_data: malformed label %s\n",
+				 d->d_name));
+			SMB_VFS_NEXT_CLOSEDIR(handle, p);
+			return -1;
+		}
+		shadow_copy_data->num_volumes++;
 
 		shadow_copy_data->labels = tlabels;
 	}
diff --git a/source4/scripting/devel/getncchanges b/source4/scripting/devel/getncchanges
index 37ec18b..9b6361b 100755
--- a/source4/scripting/devel/getncchanges
+++ b/source4/scripting/devel/getncchanges
@@ -14,80 +14,7 @@ from samba.dcerpc import drsuapi, misc
 from samba.samdb import SamDB
 from samba.auth import system_session
 from samba.ndr import ndr_unpack
-
-def do_DsBind(drs):
-    '''make a DsBind call, returning the binding handle'''
-    bind_info = drsuapi.DsBindInfoCtr()
-    bind_info.length = 28
-    bind_info.info = drsuapi.DsBindInfo28()
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_BASE
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7
-    bind_info.info.supported_extensions	|= drsuapi.DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT
-    (info, handle) = drs.DsBind(misc.GUID(drsuapi.DRSUAPI_DS_BIND_GUID), bind_info)
-    return handle
-
-
-def drs_get_rodc_partial_attribute_set(samdb):
-    '''get a list of attributes for RODC replication'''
-    partial_attribute_set = drsuapi.DsPartialAttributeSet()
-    partial_attribute_set.version = 1
-
-    attids = []
-
-    # the exact list of attids we send is quite critical. Note that
-    # we do ask for the secret attributes, but set set SPECIAL_SECRET_PROCESSING
-    # to zero them out
-    schema_dn = samdb.get_schema_basedn()
-    res = samdb.search(base=schema_dn, scope=ldb.SCOPE_SUBTREE,
-                       expression="objectClass=attributeSchema",
-                       attrs=["lDAPDisplayName", "systemFlags",
-                              "searchFlags"])
-
-    for r in res:
-        ldap_display_name = r["lDAPDisplayName"][0]
-        if "systemFlags" in r:
-            system_flags      = r["systemFlags"][0]
-            if (int(system_flags) & (samba.dsdb.DS_FLAG_ATTR_NOT_REPLICATED |
-                                     samba.dsdb.DS_FLAG_ATTR_IS_CONSTRUCTED)):
-                continue
-        if "searchFlags" in r:
-            search_flags = r["searchFlags"][0]
-            if (int(search_flags) & samba.dsdb.SEARCH_FLAG_RODC_ATTRIBUTE):
-                continue
-        attid = samdb.get_attid_from_lDAPDisplayName(ldap_display_name)
-        attids.append(int(attid))
-
-    # the attids do need to be sorted, or windows doesn't return
-    # all the attributes we need
-    attids.sort()
-    partial_attribute_set.attids         = attids
-    partial_attribute_set.num_attids = len(attids)
-    return partial_attribute_set
+from samba.drs_utils import drs_get_rodc_partial_attribute_set, drs_DsBind
 
 
 ########### main code ###########
@@ -148,7 +75,7 @@ if __name__ == "__main__":
     binding_str = "ncacn_ip_tcp:%s[seal,print]" % server
 
     drs = drsuapi.drsuapi(binding_str, lp, creds)
-    drs_handle = do_DsBind(drs)
+    drs_handle, supported_extensions = drs_DsBind(drs)
     print "DRS Handle: %s" % drs_handle
 
     req8 = drsuapi.DsGetNCChangesRequest8()
diff --git a/source4/setup/tests/blackbox_supported_features.sh b/source4/setup/tests/blackbox_supported_features.sh
index 640338e..e8c6a15 100755
--- a/source4/setup/tests/blackbox_supported_features.sh
+++ b/source4/setup/tests/blackbox_supported_features.sh
@@ -12,6 +12,8 @@ shift 1
 
 DBPATH=$PREFIX/supported-features
 
+mkdir -p $DBPATH
+
 . `dirname $0`/../../../testprogs/blackbox/subunit.sh
 
 ldbmodify="ldbmodify"


-- 
Samba Shared Repository



More information about the samba-cvs mailing list