[SCM] Samba Shared Repository - branch v4-1-test updated

Karolin Seeger kseeger at samba.org
Thu Dec 18 15:01:03 MST 2014


The branch, v4-1-test has been updated
       via  d6c626a libcli/smb: only force signing of smb2 session setups when binding a new session
       via  be1585f s3:smb2_server: allow reauthentication without signing
       via  7aacb3c s3:smb2_server: use the global signing key to check if signing is required
       via  b1ecde9 testprogs/test_ldb: check rootdse search with extended-dn control
       via  54c8bca s4:dsdb/rootdse: expand extended dn values with the AS_SYSTEM control
       via  950506d s3:utils/profiles fix a use after free
       via  b18866b s3:registry/regfio fix some valgrind warnings
       via  d95c2d2 s3:registry/regfio read SD from the correct location
      from  a3d2970 s3: modules: Fix *allocate* calls to follow POSIX error return convention.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-1-test


- Log -----------------------------------------------------------------
commit d6c626a87e416dcc5137694d88178bb76054dbe7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Dec 12 13:55:38 2014 +0000

    libcli/smb: only force signing of smb2 session setups when binding a new session
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10958
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Dec 12 23:11:40 CET 2014 on sn-devel-104
    
    (cherry picked from commit daff0f5d709eca621a7f319c892ecaba7b03e5c2)
    
    Autobuild-User(v4-1-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-1-test): Thu Dec 18 23:00:51 CET 2014 on sn-devel-104

commit be1585ffdc980f5d44358146ec3884e89f554a84
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Dec 12 09:22:15 2014 +0100

    s3:smb2_server: allow reauthentication without signing
    
    If signing is not required we should not require it for reauthentication.
    Windows clients would otherwise fail to reauthenticate.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10958
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 382019656ee164fd21455ed7d7b5e9e18bd0ca72)

commit 7aacb3cc5c877f26db0539791b9750389caa1fe1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jun 12 15:10:11 2014 +0200

    s3:smb2_server: use the global signing key to check if signing is required
    
    If we have a channel session key, we also always have a global session key.
    
    For multi-channel it's possible that the channel session key is not in place
    yet, in that case the global session key needs to be used.
    
    In both cases (reauth or session bind) we session setup requests need to be
    signed.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    (cherry picked from commit 7e006d11134cdc37ea0fc13110fe5bbfb9de3f14)

commit b1ecde9c9a1a7279d2f68cf970f374846ff6d45e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 21 14:11:54 2014 +0100

    testprogs/test_ldb: check rootdse search with extended-dn control
    
    Verifies BUG: https://bugzilla.samba.org/show_bug.cgi?id=10949
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Fri Dec 12 20:15:46 CET 2014 on sn-devel-104
    
    (cherry picked from commit 7e81fe282540a5b52dcb8c5396321a67733790d2)

commit 54c8bca3b08a8b17a2564b968bdfb51178fce281
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Nov 20 14:21:06 2014 +0100

    s4:dsdb/rootdse: expand extended dn values with the AS_SYSTEM control
    
    Otherwise we can't find the GUID of the 'serverName' attribute
    as ANONYMOUS.
    
    This results in
    
      root at ub1204-161:~# ldbsearch -U% -H ldap://172.31.9.161 -b '' -s base --extended-dn serverName
      search error - LDAP error 1 LDAP_OPERATIONS_ERROR -  <00002020: operations error at ../source4/dsdb/samdb/ldb_modules/rootdse.c:567> <>
    
    While it works as system:
    
      root at ub1204-161:~# ldbsearch -U% -H /var/lib/samba/private/sam.ldb -b '' -s base --extended-dn serverName
      # record 1
      dn:
      serverName: <GUID=348c35e1-04e3-4988-a32c-32478d584551>;CN=UB1204-161,CN=Serve
       rs,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=s4xdom,DC=base
    
      # returned 1 records
      # 1 entries
      # 0 referrals
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10949
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit a6ecef4532e4529a819219cd814e2979c2df0797)

commit 950506d158cf88c72d993cec2f199abc6e90d066
Author: Christian Ambach <ambi at samba.org>
Date:   Tue Nov 4 23:51:23 2014 +0100

    s3:utils/profiles fix a use after free
    
    path is a talloc-child of subkeys, so subkeys should not be freed before calling
    verbose_output
    
    Signed-off-by: Christian Ambach <ambi at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Christian Ambach <ambi at samba.org>
    Autobuild-Date(master): Wed Dec  3 00:43:19 CET 2014 on sn-devel-104
    
    (cherry picked from commit 3b90bfb1089e6a4b7e05e7ed62bb642521f57917)

commit b18866b858a5ee75340d6f26e27f834db049c231
Author: Christian Ambach <ambi at samba.org>
Date:   Tue Nov 4 23:50:07 2014 +0100

    s3:registry/regfio fix some valgrind warnings
    
    Signed-off-by: Christian Ambach <ambi at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 4b41489901b7f1a78ffd479128c3e0d309e53b53)

commit d95c2d2d4b5f9505b8b64720748bd76e095794ff
Author: Christian Ambach <ambi at samba.org>
Date:   Tue Nov 4 23:47:26 2014 +0100

    s3:registry/regfio read SD from the correct location
    
    try to find the security descriptor at the data pointer, not at the beginning of the hbin
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=9629
    
    Signed-off-by: Christian Ambach <ambi at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 217a0189c15761f6c7b24c9d7bfdbccf85de8e1d)

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

Summary of changes:
 libcli/smb/smbXcli_base.c                |  7 ++++++-
 source3/registry/regfio.c                | 10 ++++++----
 source3/smbd/smb2_server.c               |  5 -----
 source3/smbd/smb2_sesssetup.c            |  4 ++++
 source3/utils/profiles.c                 |  6 +++---
 source4/dsdb/samdb/ldb_modules/rootdse.c |  6 ++----
 testprogs/blackbox/test_ldb.sh           |  2 ++
 7 files changed, 23 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 0ceb1dd..7fadffa 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -2655,7 +2655,12 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
 		state->smb2.should_encrypt = session->smb2->should_encrypt;
 
 		if (cmd == SMB2_OP_SESSSETUP &&
-		    session->smb2->signing_key.length != 0) {
+		    session->smb2_channel.signing_key.length == 0 &&
+		    session->smb2->signing_key.length != 0)
+		{
+			/*
+			 * a session bind needs to be signed
+			 */
 			state->smb2.should_sign = true;
 		}
 
diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c
index fe80094..e49de26 100644
--- a/source3/registry/regfio.c
+++ b/source3/registry/regfio.c
@@ -768,8 +768,10 @@ static bool hbin_prs_sk_rec( const char *desc, REGF_HBIN *hbin, int depth, REGF_
 			if (!prs_copy_data_in(&hbin->ps, (const char *)blob.data, blob.length))
 				return False;
 		} else {
-			blob = data_blob_const(prs_data_p(&hbin->ps),
-					       prs_data_size(&hbin->ps));
+			blob = data_blob_const(
+				prs_data_p(&hbin->ps) + prs_offset(&hbin->ps),
+				prs_data_size(&hbin->ps) - prs_offset(&hbin->ps)
+			       );
 			status = unmarshall_sec_desc(mem_ctx,
 						     blob.data, blob.length,
 						     &sk->sec_desc);
@@ -1739,7 +1741,7 @@ static bool create_vk_record(REGF_FILE *file, REGF_VK_REC *vk,
 		/* make sure we don't try to copy from a NULL value pointer */
 
 		if ( vk->data_size != 0 ) 
-			memcpy( &vk->data_off, regval_data_p(value), sizeof(uint32) );
+			memcpy( &vk->data_off, regval_data_p(value), vk->data_size);
 		vk->data_size |= VK_DATA_IN_OFFSET;		
 	}
 
@@ -1804,7 +1806,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
 		REGF_HASH_REC *hash = &parent->subkeys.hashes[parent->subkey_index];
 
 		hash->nk_off = prs_offset( &nk->hbin->ps ) + nk->hbin->first_hbin_off - HBIN_HDR_SIZE;
-		memcpy( hash->keycheck, name, sizeof(uint32) );
+		memcpy(hash->keycheck, name, MIN(strlen(name),sizeof(uint32)));
 		hash->fullname = talloc_strdup( file->mem_ctx, name );
 		parent->subkey_index++;
 
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 58eddee..f7798fa 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -1910,11 +1910,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
 	if (x != NULL) {
 		signing_required = x->global->signing_required;
 		encryption_required = x->global->encryption_required;
-
-		if (opcode == SMB2_OP_SESSSETUP &&
-		    x->global->channels[0].signing_key.length) {
-			signing_required = true;
-		}
 	}
 
 	req->do_signing = false;
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index e911945..a82d696 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -422,6 +422,10 @@ static NTSTATUS smbd_smb2_reauth_generic_return(struct smbXsrv_session *session,
 
 	conn_clear_vuid_caches(conn->sconn, session->compat->vuid);
 
+	if (security_session_user_level(session_info, NULL) >= SECURITY_USER) {
+		smb2req->do_signing = true;
+	}
+
 	*out_session_id = session->global->session_wire_id;
 
 	return NT_STATUS_OK;
diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c
index 30c6ad0..a88469a 100644
--- a/source3/utils/profiles.c
+++ b/source3/utils/profiles.c
@@ -182,12 +182,12 @@ static bool copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
 		}
 	}
 
-	/* values is a talloc()'d child of subkeys here so just throw it all away */
-
-	TALLOC_FREE( subkeys );
 
 	verbose_output("[%s]\n", path);
 
+	/* values is a talloc()'d child of subkeys here so just throw it all away */
+	TALLOC_FREE(subkeys);
+
 	return True;
 }
 
diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c
index b13dc9e..111266f 100644
--- a/source4/dsdb/samdb/ldb_modules/rootdse.c
+++ b/source4/dsdb/samdb/ldb_modules/rootdse.c
@@ -142,10 +142,8 @@ static int expand_dn_in_message(struct ldb_module *module, struct ldb_message *m
 			return ret;
 		}
 
-
-		ret = ldb_request_add_control(req2,
-					LDB_CONTROL_EXTENDED_DN_OID,
-					edn_control->critical, edn);
+		ret = dsdb_request_add_controls(req2, DSDB_FLAG_AS_SYSTEM |
+						DSDB_SEARCH_SHOW_EXTENDED_DN);
 		if (ret != LDB_SUCCESS) {
 			talloc_free(tmp_ctx);
 			return ldb_error(ldb, ret, "Failed to add control");
diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh
index f326672..60bad44 100755
--- a/testprogs/blackbox/test_ldb.sh
+++ b/testprogs/blackbox/test_ldb.sh
@@ -37,6 +37,8 @@ export PATH="$BINDIR:$PATH"
 ldbsearch="$VALGRIND ldbsearch"
 
 check "RootDSE" $ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x dnsHostName highestCommittedUSN || failed=`expr $failed + 1`
+check "RootDSE (full)" $ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base '(objectClass=*)' || failed=`expr $failed + 1`
+check "RootDSE (extended)" $ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base '(objectClass=*)' --extended-dn || failed=`expr $failed + 1`
 
 echo "Getting defaultNamingContext"
 BASEDN=`$ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}'`


-- 
Samba Shared Repository


More information about the samba-cvs mailing list