summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-06-11 13:12:30 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-12 10:48:15 +0200
commit3b63a6794a008b35cd7b5bc03bcc9e4f8d4124a4 (patch)
treed02e7e386ff25b5a3d13f7db2cebb2a7df32ebe1
parentae821929a0ec048da69084b71c53270eecdb3e6e (diff)
downloadsamba-3b63a6794a008b35cd7b5bc03bcc9e4f8d4124a4.tar.gz
samba-3b63a6794a008b35cd7b5bc03bcc9e4f8d4124a4.tar.bz2
samba-3b63a6794a008b35cd7b5bc03bcc9e4f8d4124a4.zip
S3: Add ntlmssp_set_password_hash
Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/libsmb/ntlmssp.c22
2 files changed, 24 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index b265d7a2c1..d1d7131065 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -939,6 +939,8 @@ bool get_dc_name(const char *domain,
struct ntlmssp_state;
NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
+NTSTATUS ntlmssp_set_password_hash(struct ntlmssp_state *ntlmssp_state,
+ const char *hash);
NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
index 95a5dc9ccb..fb41c3c487 100644
--- a/source3/libsmb/ntlmssp.c
+++ b/source3/libsmb/ntlmssp.c
@@ -106,6 +106,28 @@ NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *p
return NT_STATUS_OK;
}
+NTSTATUS ntlmssp_set_password_hash(struct ntlmssp_state *state,
+ const char *pwhash)
+{
+ char nt_hash[16];
+ size_t converted;
+
+ converted = strhex_to_str(
+ nt_hash, sizeof(nt_hash), pwhash, strlen(pwhash));
+ if (converted != sizeof(nt_hash)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ TALLOC_FREE(state->lm_hash);
+ TALLOC_FREE(state->nt_hash);
+
+ state->nt_hash = (uint8_t *)talloc_memdup(state, nt_hash, 16);
+ if (!state->nt_hash) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ return NT_STATUS_OK;
+}
+
/**
* Set a domain on an NTLMSSP context - ensures it is talloc()ed
*