diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-02-03 23:32:26 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-02-24 11:23:18 +1100 |
commit | 4478f315e6cb178b53114033e1247e265f82ab8f (patch) | |
tree | f29e886f9ddb223f530fe30609c9dda216dcfec6 /source3 | |
parent | e3cebef0cf93ddade8e698ea292d2c03cf005a7b (diff) | |
download | samba-4478f315e6cb178b53114033e1247e265f82ab8f.tar.gz samba-4478f315e6cb178b53114033e1247e265f82ab8f.tar.bz2 samba-4478f315e6cb178b53114033e1247e265f82ab8f.zip |
s3-auth: Provide helper routine to check password and return session_info
Diffstat (limited to 'source3')
-rw-r--r-- | source3/auth/auth_generic.c | 26 | ||||
-rw-r--r-- | source3/auth/proto.h | 5 |
2 files changed, 31 insertions, 0 deletions
diff --git a/source3/auth/auth_generic.c b/source3/auth/auth_generic.c index cf6866c2dd..43baab58ff 100644 --- a/source3/auth/auth_generic.c +++ b/source3/auth/auth_generic.c @@ -346,3 +346,29 @@ NTSTATUS auth_generic_prepare(TALLOC_CTX *mem_ctx, TALLOC_FREE(tmp_ctx); return NT_STATUS_OK; } + +NTSTATUS auth_check_password_session_info(struct auth4_context *auth_context, + TALLOC_CTX *mem_ctx, + struct auth_usersupplied_info *user_info, + struct auth_session_info **session_info) +{ + NTSTATUS nt_status; + void *server_info; + + nt_status = auth_context->check_ntlm_password(auth_context, + talloc_tos(), + user_info, + &server_info, NULL, NULL); + + if (NT_STATUS_IS_OK(nt_status)) { + nt_status = auth_context->generate_session_info(auth_context, + mem_ctx, + server_info, + user_info->client.account_name, + AUTH_SESSION_INFO_UNIX_TOKEN | + AUTH_SESSION_INFO_DEFAULT_GROUPS, + session_info); + TALLOC_FREE(server_info); + } + return nt_status; +} diff --git a/source3/auth/proto.h b/source3/auth/proto.h index 2d123b0264..c68b99af90 100644 --- a/source3/auth/proto.h +++ b/source3/auth/proto.h @@ -73,6 +73,11 @@ NTSTATUS make_auth4_context(TALLOC_CTX *mem_ctx, struct auth4_context **auth4_co NTSTATUS auth_generic_prepare(TALLOC_CTX *mem_ctx, const struct tsocket_address *remote_address, struct gensec_security **gensec_security_out); +NTSTATUS auth_check_password_session_info(struct auth4_context *auth_context, + TALLOC_CTX *mem_ctx, + struct auth_usersupplied_info *user_info, + struct auth_session_info **session_info); + /* The following definitions come from auth/auth_ntlmssp.c */ NTSTATUS auth3_generate_session_info(struct auth4_context *auth_context, |