summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-11-30 13:04:59 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:46:55 +0100
commita701aed8850b4ad87054e6cd8410acc03e968224 (patch)
treef428b670f655b7a24e2067533ba9dd390528b52f /source4
parent26f775289035cc4bdccfcd42e66748d50d67a90a (diff)
downloadsamba-a701aed8850b4ad87054e6cd8410acc03e968224.tar.gz
samba-a701aed8850b4ad87054e6cd8410acc03e968224.tar.bz2
samba-a701aed8850b4ad87054e6cd8410acc03e968224.zip
r26217: Let encode_wkssvc_join_password_buffer() take the session key as parameter.
Guenther (This used to be commit f8a247d00ed4c7ea30c28cb61975c6845b5afb69)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/rpc/wkssvc.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index c84b8dd7f9..ff5c20e258 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -1155,32 +1155,25 @@ static bool test_NetrJoinDomain(struct torture_context *tctx,
* buffer), calling MD5Update() first with session_key and then with confounder
* (vice versa in samr) - Guenther */
-static bool encode_wkssvc_join_password_buffer(struct torture_context *tctx,
- struct dcerpc_pipe *p,
+static void encode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx,
const char *pwd,
+ DATA_BLOB *session_key,
struct wkssvc_PasswordBuffer *pwd_buf)
{
- NTSTATUS status;
uint8_t buffer[516];
struct MD5Context ctx;
- DATA_BLOB confounded_session_key = data_blob_talloc(tctx, NULL, 16);
- DATA_BLOB session_key;
+ DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
int confounder_len = 8;
uint8_t confounder[8];
encode_pw_buffer(buffer, pwd, STR_UNICODE);
- status = dcerpc_fetch_session_key(p, &session_key);
- if (!NT_STATUS_IS_OK(status)) {
- return false;
- }
-
generate_random_buffer((uint8_t *)confounder, confounder_len);
MD5Init(&ctx);
- MD5Update(&ctx, session_key.data, session_key.length);
+ MD5Update(&ctx, session_key->data, session_key->length);
MD5Update(&ctx, confounder, confounder_len);
MD5Final(confounded_session_key.data, &ctx);
@@ -1189,7 +1182,7 @@ static bool encode_wkssvc_join_password_buffer(struct torture_context *tctx,
memcpy(&pwd_buf->data[0], confounder, confounder_len);
memcpy(&pwd_buf->data[8], buffer, 516);
- return true;
+ data_blob_free(&confounded_session_key);
}
/*
@@ -1213,6 +1206,7 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
enum wkssvc_NetJoinStatus join_status;
const char *join_name = NULL;
WERROR expected_err;
+ DATA_BLOB session_key;
/* FIXME: this test assumes to join workstations / servers and does not
* handle DCs (WERR_SETUP_DOMAIN_CONTROLLER) */
@@ -1253,13 +1247,14 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
return false;
}
- if (!encode_wkssvc_join_password_buffer(tctx, p,
- domain_admin_password,
- &pwd_buf))
- {
+ status = dcerpc_fetch_session_key(p, &session_key);
+ if (!NT_STATUS_IS_OK(status)) {
return false;
}
+ encode_wkssvc_join_password_buffer(tctx, domain_admin_password,
+ &session_key, &pwd_buf);
+
r.in.server_name = dcerpc_server_name(p);
r.in.domain_name = domain_name;
r.in.account_ou = NULL;
@@ -1301,6 +1296,7 @@ static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
enum wkssvc_NetJoinStatus join_status;
const char *join_name = NULL;
WERROR expected_err;
+ DATA_BLOB session_key;
/* FIXME: this test assumes to join workstations / servers and does not
* handle DCs (WERR_SETUP_DOMAIN_CONTROLLER) */
@@ -1336,13 +1332,14 @@ static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
return false;
}
- if (!encode_wkssvc_join_password_buffer(tctx, p,
- domain_admin_password,
- &pwd_buf))
- {
+ status = dcerpc_fetch_session_key(p, &session_key);
+ if (!NT_STATUS_IS_OK(status)) {
return false;
}
+ encode_wkssvc_join_password_buffer(tctx, domain_admin_password,
+ &session_key, &pwd_buf);
+
r.in.server_name = dcerpc_server_name(p);
r.in.account = domain_admin_account;
r.in.encrypted_password = &pwd_buf;