diff options
author | Simo Sorce <idra@samba.org> | 2010-07-19 13:39:01 -0400 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-07-20 15:52:34 +1000 |
commit | a91727fc7974aeb314bfb6378f078e6727b20344 (patch) | |
tree | 17b734cbe8fdc6439ffe74da3d75b214d4c46131 /source3 | |
parent | e958b39042b67acaf2dc90a1f3d9bea51d7cebd8 (diff) | |
download | samba-a91727fc7974aeb314bfb6378f078e6727b20344.tar.gz samba-a91727fc7974aeb314bfb6378f078e6727b20344.tar.bz2 samba-a91727fc7974aeb314bfb6378f078e6727b20344.zip |
s3-auth: Add auth_ntlmssp wrapper for client side
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/ntlmssp_wrap.h | 16 | ||||
-rw-r--r-- | source3/libsmb/ntlmssp_wrap.c | 59 |
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; +} |