svn commit: samba r16826 - in branches/SAMBA_4_0/source/torture/rpc: .

abartlet at samba.org abartlet at samba.org
Thu Jul 6 05:09:15 GMT 2006


Author: abartlet
Date: 2006-07-06 05:09:14 +0000 (Thu, 06 Jul 2006)
New Revision: 16826

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16826

Log:
Ensure we don't segfault if the remote server fails to set a password
in RPC-SAMR test.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/torture/rpc/samr.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/samr.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/samr.c	2006-07-06 05:08:30 UTC (rev 16825)
+++ branches/SAMBA_4_0/source/torture/rpc/samr.c	2006-07-06 05:09:14 UTC (rev 16826)
@@ -942,7 +942,7 @@
 	BOOL ret = True;
 	struct samr_Password hash1, hash2, hash3, hash4, hash5, hash6;
 	struct policy_handle user_handle;
-	char *oldpass = *password;
+	char *oldpass;
 	uint8_t old_nt_hash[16], new_nt_hash[16];
 	uint8_t old_lm_hash[16], new_lm_hash[16];
 
@@ -964,6 +964,13 @@
 
 	printf("Testing ChangePasswordUser\n");
 
+	if (!*password) {
+		printf("Failing ChangePasswordUser as old password was NULL.  Previous test failed?\n");
+		return False;
+	}
+
+	oldpass = *password;
+
 	E_md4hash(oldpass, old_nt_hash);
 	E_md4hash(newpass, new_nt_hash);
 	E_deshash(oldpass, old_lm_hash);
@@ -1015,7 +1022,7 @@
 	struct samr_Password lm_verifier;
 	struct samr_CryptPassword lm_pass;
 	struct lsa_AsciiString server, account, account_bad;
-	char *oldpass = *password;
+	char *oldpass;
 	char *newpass;
 	uint8_t old_lm_hash[16], new_lm_hash[16];
 
@@ -1023,11 +1030,19 @@
 	int policy_min_pw_len = 0;
 
 	struct lsa_String domain_name;
+
 	domain_name.string = "";
 	dom_pw_info.in.domain_name = &domain_name;
 
 	printf("Testing OemChangePasswordUser2\n");
 
+	if (!*password) {
+		printf("Failing OemChangePasswordUser2 as old password was NULL.  Previous test failed?\n");
+		return False;
+	}
+
+	oldpass = *password;
+
 	status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &dom_pw_info);
 	if (NT_STATUS_IS_OK(status)) {
 		policy_min_pw_len = dom_pw_info.out.info.min_password_length;
@@ -1109,7 +1124,7 @@
 	struct lsa_String server, account;
 	struct samr_CryptPassword nt_pass, lm_pass;
 	struct samr_Password nt_verifier, lm_verifier;
-	char *oldpass = *password;
+	char *oldpass;
 	char *newpass;
 	uint8_t old_nt_hash[16], new_nt_hash[16];
 	uint8_t old_lm_hash[16], new_lm_hash[16];
@@ -1118,11 +1133,19 @@
 	int policy_min_pw_len = 0;
 
 	struct lsa_String domain_name;
+
+
 	domain_name.string = "";
 	dom_pw_info.in.domain_name = &domain_name;
 
 	printf("Testing ChangePasswordUser2\n");
 
+	if (!*password) {
+		printf("Failing ChangePasswordUser3 as old password was NULL.  Previous test failed?\n");
+		return False;
+	}
+	oldpass = *password;
+
 	status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &dom_pw_info);
 	if (NT_STATUS_IS_OK(status)) {
 		policy_min_pw_len = dom_pw_info.out.info.min_password_length;
@@ -1180,13 +1203,19 @@
 	struct lsa_String server, account, account_bad;
 	struct samr_CryptPassword nt_pass, lm_pass;
 	struct samr_Password nt_verifier, lm_verifier;
-	char *oldpass = *password;
+	char *oldpass;
 	char *newpass = samr_rand_pass(mem_ctx, policy_min_pw_len);	
 	uint8_t old_nt_hash[16], new_nt_hash[16];
 	uint8_t old_lm_hash[16], new_lm_hash[16];
 
 	printf("Testing ChangePasswordUser3\n");
 
+	if (!*password) {
+		printf("Failing ChangePasswordUser3 as old password was NULL.  Previous test failed?\n");
+		return False;
+	}
+
+	oldpass = *password;
 	server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
 	init_lsa_String(&account, account_string);
 
@@ -1776,7 +1805,7 @@
 
 	if (!test_SetUserPass(p, user_ctx, user_handle, &password)) {
 		ret = False;
-	}	
+	}
 
 	for (i = 0; password_fields[i]; i++) {
 		if (!test_SetUserPass_23(p, user_ctx, user_handle, password_fields[i], &password)) {



More information about the samba-cvs mailing list