summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/ntlmssp_wrap.h16
-rw-r--r--source3/libsmb/ntlmssp_wrap.c59
2 files changed, 75 insertions, 0 deletions
diff --git a/source3/include/ntlmssp_wrap.h b/source3/include/ntlmssp_wrap.h
index 7905b9be65..ec97f58ed8 100644
--- a/source3/include/ntlmssp_wrap.h
+++ b/source3/include/ntlmssp_wrap.h
@@ -63,7 +63,23 @@ struct ntlmssp_state *auth_ntlmssp_get_ntlmssp_state(
const char *auth_ntlmssp_get_username(struct auth_ntlmssp_state *ans);
const char *auth_ntlmssp_get_domain(struct auth_ntlmssp_state *ans);
const char *auth_ntlmssp_get_client(struct auth_ntlmssp_state *ans);
+const uint8_t *auth_ntlmssp_get_nt_hash(struct auth_ntlmssp_state *ans);
+NTSTATUS auth_ntlmssp_set_username(struct auth_ntlmssp_state *ans,
+ const char *user);
+NTSTATUS auth_ntlmssp_set_domain(struct auth_ntlmssp_state *ans,
+ const char *domain);
+NTSTATUS auth_ntlmssp_set_password(struct auth_ntlmssp_state *ans,
+ const char *password);
+void auth_ntlmssp_and_flags(struct auth_ntlmssp_state *ans, uint32_t flags);
+void auth_ntlmssp_or_flags(struct auth_ntlmssp_state *ans, uint32_t flags);
+DATA_BLOB auth_ntlmssp_get_session_key(struct auth_ntlmssp_state *ans);
+
NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *ans,
const DATA_BLOB request, DATA_BLOB *reply);
+NTSTATUS auth_ntlmssp_client_start(TALLOC_CTX *mem_ctx,
+ const char *netbios_name,
+ const char *netbios_domain,
+ bool use_ntlmv2,
+ struct auth_ntlmssp_state **_ans);
#endif /* _NTLMSSP_WRAP_ */
diff --git a/source3/libsmb/ntlmssp_wrap.c b/source3/libsmb/ntlmssp_wrap.c
index 8b8c199ff5..b3ddf50de1 100644
--- a/source3/libsmb/ntlmssp_wrap.c
+++ b/source3/libsmb/ntlmssp_wrap.c
@@ -110,9 +110,68 @@ const char *auth_ntlmssp_get_client(struct auth_ntlmssp_state *ans)
return ans->ntlmssp_state->client.netbios_name;
}
+const uint8_t *auth_ntlmssp_get_nt_hash(struct auth_ntlmssp_state *ans)
+{
+ return ans->ntlmssp_state->nt_hash;
+}
+
+NTSTATUS auth_ntlmssp_set_username(struct auth_ntlmssp_state *ans,
+ const char *user)
+{
+ return ntlmssp_set_username(ans->ntlmssp_state, user);
+}
+
+NTSTATUS auth_ntlmssp_set_domain(struct auth_ntlmssp_state *ans,
+ const char *domain)
+{
+ return ntlmssp_set_domain(ans->ntlmssp_state, domain);
+}
+
+NTSTATUS auth_ntlmssp_set_password(struct auth_ntlmssp_state *ans,
+ const char *password)
+{
+ return ntlmssp_set_password(ans->ntlmssp_state, password);
+}
+
+void auth_ntlmssp_and_flags(struct auth_ntlmssp_state *ans, uint32_t flags)
+{
+ ans->ntlmssp_state->neg_flags &= flags;
+}
+
+void auth_ntlmssp_or_flags(struct auth_ntlmssp_state *ans, uint32_t flags)
+{
+ ans->ntlmssp_state->neg_flags |= flags;
+}
+
+DATA_BLOB auth_ntlmssp_get_session_key(struct auth_ntlmssp_state *ans)
+{
+ return ans->ntlmssp_state->session_key;
+}
+
NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *ans,
const DATA_BLOB request, DATA_BLOB *reply)
{
return ntlmssp_update(ans->ntlmssp_state, request, reply);
}
+NTSTATUS auth_ntlmssp_client_start(TALLOC_CTX *mem_ctx,
+ const char *netbios_name,
+ const char *netbios_domain,
+ bool use_ntlmv2,
+ struct auth_ntlmssp_state **_ans)
+{
+ struct auth_ntlmssp_state *ans;
+ NTSTATUS status;
+
+ ans = talloc_zero(mem_ctx, struct auth_ntlmssp_state);
+
+ status = ntlmssp_client_start(ans,
+ netbios_name, netbios_domain,
+ use_ntlmv2, &ans->ntlmssp_state);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ *_ans = ans;
+ return NT_STATUS_OK;
+}