summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-12-03 14:06:22 +0100
committerGünther Deschner <gd@samba.org>2007-12-03 14:06:52 +0100
commit41418ed682f0b407a6b8d1f04ae87e60f36a2feb (patch)
treedf0f7f219c07d9a5cc0dc480366adc72d1b50cad /source3/libsmb
parent9cc7b8e2a0728e5e1664509ef60e15da0d72bdfc (diff)
downloadsamba-41418ed682f0b407a6b8d1f04ae87e60f36a2feb.tar.gz
samba-41418ed682f0b407a6b8d1f04ae87e60f36a2feb.tar.bz2
samba-41418ed682f0b407a6b8d1f04ae87e60f36a2feb.zip
Add decode_wkssvc_join_password_buffer().
Guenther (This used to be commit ba2a544baf1e1cc3652512ed5df2bb408fa8bdfd)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/smbencrypt.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index 6060669e49..8793fdcb55 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -730,3 +730,32 @@ void encode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx,
data_blob_free(&confounded_session_key);
}
+
+void decode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx,
+ struct wkssvc_PasswordBuffer *pwd_buf,
+ DATA_BLOB *session_key,
+ char **pwd)
+{
+ uint8_t buffer[516];
+ struct MD5Context ctx;
+ uint32_t pwd_len;
+
+ DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
+
+ int confounder_len = 8;
+ uint8_t confounder[8];
+
+ memcpy(&confounder, &pwd_buf->data[0], confounder_len);
+ memcpy(&buffer, &pwd_buf->data[8], 516);
+
+ MD5Init(&ctx);
+ MD5Update(&ctx, session_key->data, session_key->length);
+ MD5Update(&ctx, confounder, confounder_len);
+ MD5Final(confounded_session_key.data, &ctx);
+
+ SamOEMhashBlob(buffer, 516, &confounded_session_key);
+
+ decode_pw_buffer(mem_ctx, buffer, pwd, &pwd_len, STR_UNICODE);
+
+ data_blob_free(&confounded_session_key);
+}