diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-05-09 13:37:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:51:51 -0500 |
commit | 5ae9bd7535140e65b6c4e0b73f7a9504db3d0e47 (patch) | |
tree | e044a6e410bec4af4b2a210f1041146d6a673da9 /source4/torture/rpc | |
parent | 13abda129230ba9229a27f20ae17754cd06943f4 (diff) | |
download | samba-5ae9bd7535140e65b6c4e0b73f7a9504db3d0e47.tar.gz samba-5ae9bd7535140e65b6c4e0b73f7a9504db3d0e47.tar.bz2 samba-5ae9bd7535140e65b6c4e0b73f7a9504db3d0e47.zip |
r613: Fix the RPC-SAMR torture test, for my session_key changes.
Andrew Bartlett
(This used to be commit a04b074c049db832f4c02a35d951d40875fce6d1)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/samr.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index d6dcc3de02..11d71d6098 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -342,7 +342,7 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_SetUserInfo s; union samr_UserInfo u; BOOL ret = True; - uint8 session_key[16]; + DATA_BLOB session_key; char *newpass = samr_rand_pass(mem_ctx); s.in.handle = handle; @@ -352,14 +352,14 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, encode_pw_buffer(u.info24.password.data, newpass, STR_UNICODE); u.info24.pw_len = strlen(newpass); - status = dcerpc_fetch_session_key(p, session_key); + status = dcerpc_fetch_session_key(p, &session_key); if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); return False; } - SamOEMhash(u.info24.password.data, session_key, 516); + SamOEMhashBlob(u.info24.password.data, 516, &session_key); printf("Testing SetUserInfo level 24 (set password)\n"); @@ -383,7 +383,7 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_SetUserInfo s; union samr_UserInfo u; BOOL ret = True; - uint8 session_key[16]; + DATA_BLOB session_key; char *newpass = samr_rand_pass(mem_ctx); s.in.handle = handle; @@ -396,14 +396,14 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, encode_pw_buffer(u.info23.password.data, newpass, STR_UNICODE); - status = dcerpc_fetch_session_key(p, session_key); + status = dcerpc_fetch_session_key(p, &session_key); if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); return False; } - SamOEMhash(u.info23.password.data, session_key, 516); + SamOEMhashBlob(u.info23.password.data, 516, &session_key); printf("Testing SetUserInfo level 23 (set password)\n"); @@ -427,7 +427,8 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_SetUserInfo s; union samr_UserInfo u; BOOL ret = True; - uint8 session_key[16]; + DATA_BLOB session_key; + DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16); uint8 confounder[16]; char *newpass = samr_rand_pass(mem_ctx); struct MD5Context ctx; @@ -439,7 +440,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, encode_pw_buffer(u.info26.password.data, newpass, STR_UNICODE); u.info26.pw_len = strlen(newpass); - status = dcerpc_fetch_session_key(p, session_key); + status = dcerpc_fetch_session_key(p, &session_key); if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); @@ -450,10 +451,10 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, MD5Init(&ctx); MD5Update(&ctx, confounder, 16); - MD5Update(&ctx, session_key, 16); - MD5Final(session_key, &ctx); + MD5Update(&ctx, session_key.data, session_key.length); + MD5Final(confounded_session_key.data, &ctx); - SamOEMhash(u.info26.password.data, session_key, 516); + SamOEMhashBlob(u.info26.password.data, 516, &confounded_session_key); memcpy(&u.info26.password.data[516], confounder, 16); printf("Testing SetUserInfo level 26 (set password ex)\n"); @@ -477,7 +478,8 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_SetUserInfo s; union samr_UserInfo u; BOOL ret = True; - uint8 session_key[16]; + DATA_BLOB session_key; + DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16); uint8 confounder[16]; char *newpass = samr_rand_pass(mem_ctx); struct MD5Context ctx; @@ -492,7 +494,7 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, encode_pw_buffer(u.info25.password.data, newpass, STR_UNICODE); - status = dcerpc_fetch_session_key(p, session_key); + status = dcerpc_fetch_session_key(p, &session_key); if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); @@ -503,10 +505,10 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, MD5Init(&ctx); MD5Update(&ctx, confounder, 16); - MD5Update(&ctx, session_key, 16); - MD5Final(session_key, &ctx); + MD5Update(&ctx, session_key.data, session_key.length); + MD5Final(confounded_session_key.data, &ctx); - SamOEMhash(u.info25.password.data, session_key, 516); + SamOEMhashBlob(u.info25.password.data, 516, &confounded_session_key); memcpy(&u.info25.password.data[516], confounder, 16); printf("Testing SetUserInfo level 25 (set password ex)\n"); |