s4-smbtorture: add test_oemchangepassword to RAP-SAM.
authorGünther Deschner <gd@samba.org>
Fri, 7 May 2010 20:58:42 +0000 (22:58 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 11 May 2010 22:21:06 +0000 (00:21 +0200)
Guenther

source4/torture/rap/sam.c

index f3ad5b9699a11d1a2ef510a3f7fab02691d6022b..67cfeb8c73571e6910f6ebfaf143e797cd837a48 100644 (file)
@@ -50,11 +50,40 @@ static bool test_userpasswordset2(struct torture_context *tctx,
        return true;
 }
 
+static bool test_oemchangepassword(struct torture_context *tctx,
+                                  struct smbcli_state *cli)
+{
+       struct rap_NetOEMChangePassword r;
+
+       const char *oldpass = "secret";
+       const char *newpass = "newpwd";
+       uint8_t old_pw_hash[16];
+       uint8_t new_pw_hash[16];
+
+       r.in.UserName = "gd";
+
+       E_deshash(oldpass, old_pw_hash);
+       E_deshash(newpass, new_pw_hash);
+
+       encode_pw_buffer(r.in.crypt_password, newpass, STR_ASCII);
+       arcfour_crypt(r.in.crypt_password, old_pw_hash, 516);
+       E_old_pw_hash(new_pw_hash, old_pw_hash, r.in.password_hash);
+
+       torture_comment(tctx, "Testing rap_NetOEMChangePassword(%s)\n", r.in.UserName);
+
+       torture_assert_ntstatus_ok(tctx,
+               smbcli_rap_netoemchangepassword(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r),
+               "smbcli_rap_netoemchangepassword failed");
+
+       return true;
+}
+
 struct torture_suite *torture_rap_sam(TALLOC_CTX *mem_ctx)
 {
        struct torture_suite *suite = torture_suite_create(mem_ctx, "SAM");
 
        torture_suite_add_1smb_test(suite, "userpasswordset2", test_userpasswordset2);
+       torture_suite_add_1smb_test(suite, "oemchangepassword", test_oemchangepassword);
 
        return suite;
 }