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

Karolin Seeger kseeger at samba.org
Wed Nov 30 14:51:03 UTC 2016


The branch, v4-4-test has been updated
       via  0703c1b nss_wins: Fix errno values for HOST_NOT_FOUND
       via  1735c35 s4:torture: Fix cleanup of the secrets object in session_key test
       via  a34231a s4:torture: Normalizes names in session_key test
       via  f5fb3c2 s4:torture: Strip trailing whitespaces in session_key.c
       via  fa67920 s4:torture: Add tortue test for AddPrinterDriverEx with COPY_FROM_DIRECTORY
       via  4450467 lib:torture: Make variables const
       via  9a227c7 s3:spoolss: Add support for COPY_FROM_DIRECTORY in AddPrinterDriverEx
      from  8db189b ctdb-recovery: Avoid NULL dereference in failure case

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


- Log -----------------------------------------------------------------
commit 0703c1b4b73a76b9d24065ecd47dae41c8f81129
Author: Andreas Schneider <asn at samba.org>
Date:   Sun Nov 13 17:40:21 2016 +0100

    nss_wins: Fix errno values for HOST_NOT_FOUND
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 08d1ac0e36339e97e4464f6a6724464b0a568347)
    
    Autobuild-User(v4-4-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-4-test): Wed Nov 30 15:50:43 CET 2016 on sn-devel-144

commit 1735c35f59580dbdae19e8354b91a445a2e5a930
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 17 16:15:54 2016 +0100

    s4:torture: Fix cleanup of the secrets object in session_key test
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12433
    
    The test is known to be failing if sealing is turned on in some
    circumstances. In this case a secret is created and then the function
    dcerpc_fetch_session_key() fails. The secret is not removed!
    
    We use torturesecret-%08x with random() to fill in the number. Sometimes
    it happens that random() returns a number we already used. So we end up
    trying to create a secret for an entry which already exists and run
    into a collision
    
    This change makes sure we always cleanup behind us and do not leave
    secret objects we created.
    
    Pair-Programmed-With: Guenther Deschner <gd at samba.org>
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Nov 17 22:30:36 CET 2016 on sn-devel-144
    
    (cherry picked from commit 9de04626c058563a6cf4c13e4f5399039e345ef5)

commit a34231a4494ebc1bfc7dd108ff5521d4c55d66e9
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 17 15:44:13 2016 +0100

    s4:torture: Normalizes names in session_key test
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12433
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 31d21de548d899f82fa7944767ad94e8aca8d96d)

commit f5fb3c2d076ebb1ebbf3713d44197003abba7061
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 17 15:35:47 2016 +0100

    s4:torture: Strip trailing whitespaces in session_key.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12433
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 80f7f568f8960c809756d5233c8f875db4ea07d6)

commit fa679200b9d76149743c4cfe859900dcfa73e895
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Nov 15 18:34:22 2016 +0100

    s4:torture: Add tortue test for AddPrinterDriverEx with COPY_FROM_DIRECTORY
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12415
    
    Pair-Programmed-With: Guenther Deschner <gd at samba.org>
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit b1ade58ffeb56a0238c820797905caa107b08265)

commit 44504675ab9cebe44993075977d77044d8ea0285
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 18 10:51:57 2016 +0100

    lib:torture: Make variables const
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12415
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 9c0f2576d8aa3dd95be1c5ddda2b10d891add0bc)

commit 9a227c732e7fbaab514827c823b57edfabdaa63c
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Nov 15 14:29:29 2016 +0100

    s3:spoolss: Add support for COPY_FROM_DIRECTORY in AddPrinterDriverEx
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12415
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 4d9f4bfc69a5899bdf91406dfb7efb70a530446c)

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

Summary of changes:
 lib/torture/torture.h                       |   8 +-
 nsswitch/wins.c                             |   3 +-
 source3/include/nt_printing.h               |   7 +-
 source3/printing/nt_printing.c              |  92 ++++++++++++---
 source3/rpc_server/spoolss/srv_spoolss_nt.c |  17 ++-
 source4/torture/rpc/session_key.c           | 100 +++++++++--------
 source4/torture/rpc/spoolss.c               | 167 +++++++++++++++++++++++++++-
 7 files changed, 319 insertions(+), 75 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index e710873..05c59e6 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -503,7 +503,7 @@ void torture_result(struct torture_context *test,
 	} while(0)
 
 #define torture_assert_guid_equal(torture_ctx,got,expected,cmt)\
-	do { struct GUID __got = (got), __expected = (expected); \
+	do {const struct GUID __got = (got), __expected = (expected); \
 	if (!GUID_equal(&__got, &__expected)) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
 			__location__": "#got" was %s, expected %s: %s", \
@@ -521,7 +521,7 @@ void torture_result(struct torture_context *test,
 	} while(0)
 
 #define torture_assert_sid_equal(torture_ctx,got,expected,cmt)\
-	do { struct dom_sid *__got = (got), *__expected = (expected); \
+	do {const struct dom_sid *__got = (got), *__expected = (expected); \
 	if (!dom_sid_equal(__got, __expected)) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
 					   __location__": "#got" was %s, expected %s: %s", \
@@ -531,7 +531,7 @@ void torture_result(struct torture_context *test,
 	} while(0)
 
 #define torture_assert_not_null(torture_ctx,got,cmt)\
-	do { void *__got = (got); \
+	do {const void *__got = (got); \
 	if (__got == NULL) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
 			__location__": "#got" was NULL, expected != NULL: %s", \
@@ -541,7 +541,7 @@ void torture_result(struct torture_context *test,
 	} while(0)
 
 #define torture_assert_not_null_goto(torture_ctx,got,ret,label,cmt)\
-	do { void *__got = (got); \
+	do {const void *__got = (got); \
 	if (__got == NULL) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
 			__location__": "#got" was NULL, expected != NULL: %s", \
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index dccb6dd..19d3c5b 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -260,8 +260,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
 
 	ip = lookup_byname_backend(name);
 	if (ip == NULL) {
-		*errnop = EINVAL;
-		*h_errnop = NETDB_INTERNAL;
+		*h_errnop = HOST_NOT_FOUND;
 		nss_status = NSS_STATUS_NOTFOUND;
 		goto out;
 	}
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h
index e253658..e0003f9 100644
--- a/source3/include/nt_printing.h
+++ b/source3/include/nt_printing.h
@@ -170,11 +170,14 @@ bool delete_driver_files(const struct auth_session_info *server_info,
 			 const struct spoolss_DriverInfo8 *r);
 
 WERROR move_driver_to_download_area(struct auth_session_info *session_info,
-				    struct spoolss_AddDriverInfoCtr *r);
+				    struct spoolss_AddDriverInfoCtr *r,
+				    const char *driver_directory);
 
 WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
 			      struct auth_session_info *session_info,
-			      struct spoolss_AddDriverInfoCtr *r);
+			      struct spoolss_AddDriverInfoCtr *r,
+			      uint32_t flags,
+			      const char **driver_directory);
 
 void map_printer_permissions(struct security_descriptor *sd);
 
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 3d6cfb1..d566063 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -864,7 +864,9 @@ static WERROR clean_up_driver_struct_level(TALLOC_CTX *mem_ctx,
 					   const char **config_file,
 					   const char **help_file,
 					   struct spoolss_StringArray *dependent_files,
-					   enum spoolss_DriverOSVersion *version)
+					   enum spoolss_DriverOSVersion *version,
+					   uint32_t flags,
+					   const char **driver_directory)
 {
 	const char *short_architecture;
 	int i;
@@ -879,6 +881,43 @@ static WERROR clean_up_driver_struct_level(TALLOC_CTX *mem_ctx,
 		return WERR_INVALID_PARAM;
 	}
 
+	if (flags & APD_COPY_FROM_DIRECTORY) {
+		char *path;
+		char *q;
+
+		/*
+		 * driver_path is set to:
+		 *
+		 * \\PRINTSRV\print$\x64\{279245b0-a8bd-4431-bf6f-baee92ac15c0}\pscript5.dll
+		 */
+		path = talloc_strdup(mem_ctx, *driver_path);
+		if (path == NULL) {
+			return WERR_NOT_ENOUGH_MEMORY;
+		}
+
+		/* Remove pscript5.dll */
+		q = strrchr_m(path, '\\');
+		if (q == NULL) {
+			return WERR_INVALID_PARAMETER;
+		}
+		*q = '\0';
+
+		/* Get \{279245b0-a8bd-4431-bf6f-baee92ac15c0} */
+		q = strrchr_m(path, '\\');
+		if (q == NULL) {
+			return WERR_INVALID_PARAMETER;
+		}
+
+		/*
+		 * Set driver_directory to:
+		 *
+		 * {279245b0-a8bd-4431-bf6f-baee92ac15c0}
+		 *
+		 * This is the directory where all the files have been uploaded
+		 */
+		*driver_directory = q + 1;
+	}
+
 	/* clean up the driver name.
 	 * we can get .\driver.dll
 	 * or worse c:\windows\system\driver.dll !
@@ -931,7 +970,9 @@ static WERROR clean_up_driver_struct_level(TALLOC_CTX *mem_ctx,
 
 WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
 			      struct auth_session_info *session_info,
-			      struct spoolss_AddDriverInfoCtr *r)
+			      struct spoolss_AddDriverInfoCtr *r,
+			      uint32_t flags,
+			      const char **driver_directory)
 {
 	switch (r->level) {
 	case 3:
@@ -942,7 +983,9 @@ WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
 						    &r->info.info3->config_file,
 						    &r->info.info3->help_file,
 						    r->info.info3->dependent_files,
-						    &r->info.info3->version);
+						    &r->info.info3->version,
+						    flags,
+						    driver_directory);
 	case 6:
 		return clean_up_driver_struct_level(mem_ctx, session_info,
 						    r->info.info6->architecture,
@@ -951,7 +994,9 @@ WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
 						    &r->info.info6->config_file,
 						    &r->info.info6->help_file,
 						    r->info.info6->dependent_files,
-						    &r->info.info6->version);
+						    &r->info.info6->version,
+						    flags,
+						    driver_directory);
 	default:
 		return WERR_NOT_SUPPORTED;
 	}
@@ -986,7 +1031,8 @@ static WERROR move_driver_file_to_download_area(TALLOC_CTX *mem_ctx,
 						const char *driver_file,
 						const char *short_architecture,
 						uint32_t driver_version,
-						uint32_t version)
+						uint32_t version,
+						const char *driver_directory)
 {
 	struct smb_filename *smb_fname_old = NULL;
 	struct smb_filename *smb_fname_new = NULL;
@@ -995,9 +1041,21 @@ static WERROR move_driver_file_to_download_area(TALLOC_CTX *mem_ctx,
 	NTSTATUS status;
 	WERROR ret;
 
-	old_name = talloc_asprintf(mem_ctx, "%s/%s",
-				   short_architecture, driver_file);
-	W_ERROR_HAVE_NO_MEMORY(old_name);
+	if (driver_directory != NULL) {
+		old_name = talloc_asprintf(mem_ctx,
+					   "%s/%s/%s",
+					   short_architecture,
+					   driver_directory,
+					   driver_file);
+	} else {
+		old_name = talloc_asprintf(mem_ctx,
+					   "%s/%s",
+					   short_architecture,
+					   driver_file);
+	}
+	if (old_name == NULL) {
+		return WERR_NOT_ENOUGH_MEMORY;
+	}
 
 	new_name = talloc_asprintf(mem_ctx, "%s/%d/%s",
 				   short_architecture, driver_version, driver_file);
@@ -1050,7 +1108,8 @@ static WERROR move_driver_file_to_download_area(TALLOC_CTX *mem_ctx,
 }
 
 WERROR move_driver_to_download_area(struct auth_session_info *session_info,
-				    struct spoolss_AddDriverInfoCtr *r)
+				    struct spoolss_AddDriverInfoCtr *r,
+				    const char *driver_directory)
 {
 	struct spoolss_AddDriverInfo3 *driver;
 	struct spoolss_AddDriverInfo3 converted_driver;
@@ -1171,7 +1230,8 @@ WERROR move_driver_to_download_area(struct auth_session_info *session_info,
 							driver->driver_path,
 							short_architecture,
 							driver->version,
-							ver);
+							ver,
+							driver_directory);
 		if (!W_ERROR_IS_OK(err)) {
 			goto err_exit;
 		}
@@ -1185,7 +1245,8 @@ WERROR move_driver_to_download_area(struct auth_session_info *session_info,
 								driver->data_file,
 								short_architecture,
 								driver->version,
-								ver);
+								ver,
+								driver_directory);
 			if (!W_ERROR_IS_OK(err)) {
 				goto err_exit;
 			}
@@ -1201,7 +1262,8 @@ WERROR move_driver_to_download_area(struct auth_session_info *session_info,
 								driver->config_file,
 								short_architecture,
 								driver->version,
-								ver);
+								ver,
+								driver_directory);
 			if (!W_ERROR_IS_OK(err)) {
 				goto err_exit;
 			}
@@ -1218,7 +1280,8 @@ WERROR move_driver_to_download_area(struct auth_session_info *session_info,
 								driver->help_file,
 								short_architecture,
 								driver->version,
-								ver);
+								ver,
+								driver_directory);
 			if (!W_ERROR_IS_OK(err)) {
 				goto err_exit;
 			}
@@ -1243,7 +1306,8 @@ WERROR move_driver_to_download_area(struct auth_session_info *session_info,
 									driver->dependent_files->string[i],
 									short_architecture,
 									driver->version,
-									ver);
+									ver,
+									driver_directory);
 				if (!W_ERROR_IS_OK(err)) {
 					goto err_exit;
 				}
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index a6cbda5..a155471 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -8438,6 +8438,7 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
 {
 	WERROR err = WERR_OK;
 	const char *driver_name = NULL;
+	const char *driver_directory = NULL;
 	uint32_t version;
 	const char *fn;
 
@@ -8461,7 +8462,8 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
 		return WERR_INVALID_PARAM;
 	}
 
-	if (r->in.flags != APD_COPY_NEW_FILES) {
+	if (!(r->in.flags & APD_COPY_ALL_FILES) &&
+	    !(r->in.flags & APD_COPY_NEW_FILES)) {
 		return WERR_ACCESS_DENIED;
 	}
 
@@ -8476,12 +8478,19 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
 	}
 
 	DEBUG(5,("Cleaning driver's information\n"));
-	err = clean_up_driver_struct(p->mem_ctx, p->session_info, r->in.info_ctr);
-	if (!W_ERROR_IS_OK(err))
+	err = clean_up_driver_struct(p->mem_ctx,
+				     p->session_info,
+				     r->in.info_ctr,
+				     r->in.flags,
+				     &driver_directory);
+	if (!W_ERROR_IS_OK(err)) {
 		goto done;
+	}
 
 	DEBUG(5,("Moving driver to final destination\n"));
-	err = move_driver_to_download_area(p->session_info, r->in.info_ctr);
+	err = move_driver_to_download_area(p->session_info,
+					   r->in.info_ctr,
+					   driver_directory);
 	if (!W_ERROR_IS_OK(err)) {
 		goto done;
 	}
diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c
index 11f6a0b..3b7ba1f 100644
--- a/source4/torture/rpc/session_key.c
+++ b/source4/torture/rpc/session_key.c
@@ -1,20 +1,20 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    test suite for lsa rpc operations
 
    Copyright (C) Andrew Tridgell 2003
    Copyright (C) Andrew Bartlett <abartlet at samba.org> 2004-2005
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -32,16 +32,15 @@ static void init_lsa_String(struct lsa_String *name, const char *s)
 	name->string = s;
 }
 
-static bool test_CreateSecret_basic(struct dcerpc_pipe *p, 
+static bool test_CreateSecret_basic(struct dcerpc_pipe *p,
 				    struct torture_context *tctx,
-				    struct policy_handle *handle)
+				    struct policy_handle *handle,
+				    struct policy_handle *sec_handle)
 {
 	NTSTATUS status;
 	struct lsa_CreateSecret r;
 	struct lsa_SetSecret r3;
 	struct lsa_QuerySecret r4;
-	struct policy_handle sec_handle;
-	struct lsa_DeleteObject d;
 	struct lsa_DATA_BUF buf1;
 	struct lsa_DATA_BUF_PTR bufp1;
 	DATA_BLOB enc_key;
@@ -53,69 +52,69 @@ static bool test_CreateSecret_basic(struct dcerpc_pipe *p,
 	char *secname;
 	struct dcerpc_binding_handle *b = p->binding_handle;
 
-	secname = talloc_asprintf(tctx, "torturesecret-%u", (unsigned int)random());
+	secname = talloc_asprintf(tctx, "torturesecret-%08x", (unsigned int)random());
 
 	torture_comment(tctx, "Testing CreateSecret of %s\n", secname);
-		
+
 	init_lsa_String(&r.in.name, secname);
-	
+
 	r.in.handle = handle;
 	r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
-	r.out.sec_handle = &sec_handle;
-	
+	r.out.sec_handle = sec_handle;
+
 	torture_assert_ntstatus_ok(tctx, dcerpc_lsa_CreateSecret_r(b, tctx, &r),
 		"CreateSecret failed");
 	torture_assert_ntstatus_ok(tctx, r.out.result, "CreateSecret failed");
-	
+
 	status = dcerpc_fetch_session_key(p, &session_key);
 	torture_assert_ntstatus_ok(tctx, status, "dcerpc_fetch_session_key failed");
-	
+
 	enc_key = sess_encrypt_string(secret1, &session_key);
-	
-	r3.in.sec_handle = &sec_handle;
+
+	r3.in.sec_handle = sec_handle;
 	r3.in.new_val = &buf1;
 	r3.in.old_val = NULL;
 	r3.in.new_val->data = enc_key.data;
 	r3.in.new_val->length = enc_key.length;
 	r3.in.new_val->size = enc_key.length;
-	
+
 	torture_comment(tctx, "Testing SetSecret\n");
-	
+
 	torture_assert_ntstatus_ok(tctx, dcerpc_lsa_SetSecret_r(b, tctx, &r3),
 		"SetSecret failed");
 	torture_assert_ntstatus_ok(tctx, r3.out.result, "SetSecret failed");
-		
-	r3.in.sec_handle = &sec_handle;
+
+	r3.in.sec_handle = sec_handle;
 	r3.in.new_val = &buf1;
 	r3.in.old_val = NULL;
 	r3.in.new_val->data = enc_key.data;
 	r3.in.new_val->length = enc_key.length;
 	r3.in.new_val->size = enc_key.length;
-	
+
 	/* break the encrypted data */
 	enc_key.data[0]++;
-	
+
 	torture_comment(tctx, "Testing SetSecret with broken key\n");
-	
+
 	torture_assert_ntstatus_ok(tctx, dcerpc_lsa_SetSecret_r(b, tctx, &r3),
 		"SetSecret failed");
 	torture_assert_ntstatus_equal(tctx, r3.out.result, NT_STATUS_UNKNOWN_REVISION,
 		"SetSecret should have failed UNKNOWN_REVISION");
-	
+
 	data_blob_free(&enc_key);
-	
+
 	ZERO_STRUCT(new_mtime);
 	ZERO_STRUCT(old_mtime);
-	
+
 	/* fetch the secret back again */
-	r4.in.sec_handle = &sec_handle;
+	r4.in.sec_handle = sec_handle;
 	r4.in.new_val = &bufp1;
 	r4.in.new_mtime = &new_mtime;
 	r4.in.old_val = NULL;
 	r4.in.old_mtime = NULL;
-	
+
 	bufp1.buf = NULL;
-	
+
 	torture_comment(tctx, "Testing QuerySecret\n");
 	torture_assert_ntstatus_ok(tctx, dcerpc_lsa_QuerySecret_r(b, tctx, &r4),
 		"QuerySecret failed");
@@ -126,14 +125,9 @@ static bool test_CreateSecret_basic(struct dcerpc_pipe *p,
 	blob1.length = r4.out.new_val->buf->size;
 
 	secret2 = sess_decrypt_string(tctx, &blob1, &session_key);
-	
+
 	torture_assert_str_equal(tctx, secret1, secret2, "Returned secret invalid");
 
-	d.in.handle = &sec_handle;
-	d.out.handle = &sec_handle;
-	torture_assert_ntstatus_ok(tctx, dcerpc_lsa_DeleteObject_r(b, tctx, &d),
-		"DeleteObject failed");
-	torture_assert_ntstatus_ok(tctx, d.out.result, "delete should have returned OKINVALID_HANDLE");
 	return true;
 }
 
@@ -149,16 +143,18 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
         struct dcerpc_pipe *p;
 	struct policy_handle *handle;
 	struct dcerpc_binding *binding;
-	const struct secret_settings *settings = 
+	const struct secret_settings *settings =
 		(const struct secret_settings *)_data;
 	NTSTATUS status;
 	struct dcerpc_binding_handle *b;
+	struct policy_handle sec_handle = {0};
+	bool ok;
 
 	lpcfg_set_cmdline(torture->lp_ctx, "ntlmssp client:keyexchange", settings->keyexchange?"True":"False");
 	lpcfg_set_cmdline(torture->lp_ctx, "ntlmssp_client:ntlm2", settings->ntlm2?"True":"False");
 	lpcfg_set_cmdline(torture->lp_ctx, "ntlmssp_client:lm_key", settings->lm_key?"True":"False");
 
-	torture_assert_ntstatus_ok(torture, torture_rpc_binding(torture, &binding), 
+	torture_assert_ntstatus_ok(torture, torture_rpc_binding(torture, &binding),
 				   "Getting bindoptions");
 
 	status = dcerpc_binding_set_flags(binding, settings->bindoptions, 0);
@@ -179,18 +175,28 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
 	}
 
 	torture_assert(torture, handle, "OpenPolicy2 failed.  This test cannot run against this server");
-	
-	if (!test_CreateSecret_basic(p, torture, handle)) {
-		talloc_free(p);
-		return false;
+
+	ok = test_CreateSecret_basic(p, torture, handle, &sec_handle);
+
+	if (is_valid_policy_hnd(&sec_handle)) {
+		struct lsa_DeleteObject d;
+
+		d.in.handle = &sec_handle;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list