From fa33c5627628bbd9eef633235b1eb144915da1d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Sat, 20 Sep 2008 17:00:30 +0200 Subject: [PATCH] netlogon: add init_netr_CryptPassword. Guenther (cherry picked from commit 90d0328bd7b7cb841aafd65ad0af36182ba692ee) --- source/include/proto.h | 3 +++ source/rpc_client/init_netlogon.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/source/include/proto.h b/source/include/proto.h index 2e46bcab82f..fb64a23c3da 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -7421,6 +7421,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 */ diff --git a/source/rpc_client/init_netlogon.c b/source/rpc_client/init_netlogon.c index 61841953fc6..e4c39e739ee 100644 --- a/source/rpc_client/init_netlogon.c +++ b/source/rpc_client/init_netlogon.c @@ -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); +} -- 2.11.4.GIT