From 48ea48d5031f7118cf39b0233799d02e8bae6946 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 Feb 2011 13:13:01 +1100 Subject: s4-rpc: added public APIs for dce_call authentication Pair-Programmed-With: Andrew Bartlett --- source4/rpc_server/dcerpc_server.c | 19 +++++++++++++++++++ source4/rpc_server/dcerpc_server.h | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index fd26740ddc..fa5f3e9830 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -1718,3 +1718,22 @@ NTSTATUS dcesrv_add_ep(struct dcesrv_context *dce_ctx, return NT_STATUS_NOT_SUPPORTED; } } + + +/** + * retrieve credentials from a dce_call + */ +_PUBLIC_ struct cli_credentials *dcesrv_call_credentials(struct dcesrv_call_state *dce_call) +{ + return dce_call->conn->auth_state.session_info->credentials; +} + +/** + * returns true if this is an authenticated call + */ +_PUBLIC_ bool dcesrv_call_authenticated(struct dcesrv_call_state *dce_call) +{ + enum security_user_level level; + level = security_session_user_level(dce_call->conn->auth_state.session_info, NULL); + return level >= SECURITY_USER; +} diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 08a57495cc..6e513acac1 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -383,5 +383,15 @@ NTSTATUS dcesrv_add_ep(struct dcesrv_context *dce_ctx, struct tevent_context *event_ctx, const struct model_ops *model_ops); +/** + * retrieve credentials from a dce_call + */ +_PUBLIC_ struct cli_credentials *dcesrv_call_credentials(struct dcesrv_call_state *dce_call); + +/** + * returns true if this is an authenticated call + */ +_PUBLIC_ bool dcesrv_call_authenticated(struct dcesrv_call_state *dce_call); + #endif /* SAMBA_DCERPC_SERVER_H */ -- cgit