netlogon: add init_netr_CryptPassword.
authorGünther Deschner <gd@samba.org>
Sat, 20 Sep 2008 15:00:30 +0000 (17:00 +0200)
committerGünther Deschner <gd@samba.org>
Sun, 21 Sep 2008 20:30:10 +0000 (22:30 +0200)
Guenther

source3/include/proto.h
source3/rpc_client/init_netlogon.c

index 2901911c70db268b8a183e4b0062e7e5ad25241a..bec5f10f3c86a6707bc0876a97bce2ca6cb6d410 100644 (file)
@@ -7427,6 +7427,9 @@ void init_netr_PasswordInfo(struct netr_PasswordInfo *r,
                            const char *workstation,
                            struct samr_Password lmpassword,
                            struct samr_Password ntpassword);
+void init_netr_CryptPassword(const char *pwd,
+                            unsigned char session_key[16],
+                            struct netr_CryptPassword *pwd_buf);
 
 /* The following definitions come from rpc_client/init_samr.c  */
 
index 61841953fc61de6d6e8ebc2071711b9629ee5296..e4c39e739ee4150788aebbca581a9595f6d056f1 100644 (file)
@@ -391,3 +391,20 @@ void init_netr_PasswordInfo(struct netr_PasswordInfo *r,
        r->lmpassword = lmpassword;
        r->ntpassword = ntpassword;
 }
+
+/*************************************************************************
+ inits a netr_CryptPassword structure
+ *************************************************************************/
+
+void init_netr_CryptPassword(const char *pwd,
+                            unsigned char session_key[16],
+                            struct netr_CryptPassword *pwd_buf)
+{
+       struct samr_CryptPassword password_buf;
+
+       encode_pw_buffer(password_buf.data, pwd, STR_UNICODE);
+
+       SamOEMhash(password_buf.data, session_key, 516);
+       memcpy(pwd_buf->data, password_buf.data, 512);
+       pwd_buf->length = IVAL(password_buf.data, 512);
+}