summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2018-11-08 13:08:19 +0100
committerJeremy Allison <jra@samba.org>2019-01-12 03:13:36 +0100
commitc621a87322c60811483c735a23922f85064a684a (patch)
treec50bb80131ea26e5aed9544f0aaed239f5d21b6d /source4
parent6b49e325f11847ba3a3efa7ba79c7a4992b81714 (diff)
downloadsamba-c621a87322c60811483c735a23922f85064a684a.tar.gz
s4:rpc_server/remote: make use of dcesrv_call_credentials()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/rpc_server/remote/dcesrv_remote.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c
index b32fe9bb8d9..86d165bd6e2 100644
--- a/source4/rpc_server/remote/dcesrv_remote.c
+++ b/source4/rpc_server/remote/dcesrv_remote.c
@@ -47,7 +47,7 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
const char *binding = lpcfg_parm_string(dce_call->conn->dce_ctx->lp_ctx, NULL, "dcerpc_remote", "binding");
const char *user, *pass, *domain;
struct cli_credentials *credentials;
- bool must_free_credentials = true;
+ bool must_free_credentials = false;
bool machine_account;
struct dcerpc_binding *b;
struct composite_context *pipe_conn_req;
@@ -78,12 +78,15 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
return NT_STATUS_NET_WRITE_FAULT;
}
+ credentials = dcesrv_call_credentials(dce_call);
+
if (user && pass) {
DEBUG(5, ("dcerpc_remote: RPC Proxy: Using specified account\n"));
credentials = cli_credentials_init(priv);
if (!credentials) {
return NT_STATUS_NO_MEMORY;
}
+ must_free_credentials = true;
cli_credentials_set_conf(credentials, dce_call->conn->dce_ctx->lp_ctx);
cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
if (domain) {
@@ -93,6 +96,10 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
} else if (machine_account) {
DEBUG(5, ("dcerpc_remote: RPC Proxy: Using machine account\n"));
credentials = cli_credentials_init(priv);
+ if (!credentials) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ must_free_credentials = true;
cli_credentials_set_conf(credentials, dce_call->conn->dce_ctx->lp_ctx);
if (domain) {
cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
@@ -101,10 +108,8 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- } else if (dce_call->conn->auth_state.session_info->credentials) {
+ } else if (credentials != NULL) {
DEBUG(5, ("dcerpc_remote: RPC Proxy: Using delegated credentials\n"));
- credentials = dce_call->conn->auth_state.session_info->credentials;
- must_free_credentials = false;
} else {
DEBUG(1,("dcerpc_remote: RPC Proxy: You must supply binding, user and password or have delegated credentials\n"));
return NT_STATUS_INVALID_PARAMETER;