diff options
author | Simo Sorce <idra@samba.org> | 2011-05-11 16:38:46 -0400 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-05-13 14:40:26 +0200 |
commit | d31181214cee1ce459b58f0ca60b40a38f396dac (patch) | |
tree | 228d384947426338f9978d58cd344373f571f4b5 | |
parent | 99df3f6cbbdfa1693d805c2696e34f353dfa28ac (diff) | |
download | samba-d31181214cee1ce459b58f0ca60b40a38f396dac.tar.gz samba-d31181214cee1ce459b58f0ca60b40a38f396dac.tar.xz samba-d31181214cee1ce459b58f0ca60b40a38f396dac.zip |
rpc_server: Always use rpc_pipe_open_interface()
This way we can configure which rpc service we actually want to connect to.
By default it uses an "embedded" interface and calls rpc_pipe_open_internal()
Signed-off-by: Günther Deschner <gd@samba.org>
Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Fri May 13 14:40:26 CEST 2011 on sn-devel-104
-rw-r--r-- | source3/printing/nt_printing_migrate.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/rpc_ncacn_np.c | 53 | ||||
-rw-r--r-- | source3/rpc_server/rpc_ncacn_np.h | 6 | ||||
-rw-r--r-- | source3/smbd/lanman.c | 16 |
4 files changed, 40 insertions, 37 deletions
diff --git a/source3/printing/nt_printing_migrate.c b/source3/printing/nt_printing_migrate.c index 5fd0aae7fc1..38791989771 100644 --- a/source3/printing/nt_printing_migrate.c +++ b/source3/printing/nt_printing_migrate.c @@ -651,7 +651,7 @@ bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx) return false; } - status = rpc_pipe_open_internal(tmp_ctx, + status = rpc_pipe_open_interface(tmp_ctx, &ndr_table_spoolss.syntax_id, session_info, NULL, diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index 2e99da72ed7..9328322f200 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -519,7 +519,8 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx, * @brief Create a new RPC client context which uses a local transport. * * This creates a local transport. It is a shortcut to directly call the server - * functions and avoid marschalling. + * functions and avoid marshalling. + * NOTE: this function should be used only by rpc_pipe_open_interface() * * @param[in] mem_ctx The memory context to use. * @@ -536,19 +537,8 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx, * * @return NT_STATUS_OK on success, a corresponding NT status if an * error occured. - * - * @code - * struct rpc_pipe_client *winreg_pipe; - * NTSTATUS status; - * - * status = rpc_pipe_open_internal(tmp_ctx, - * &ndr_table_winreg.syntax_id, - * p->session_info, - * client_id, - * &winreg_pipe); - * @endcode */ -NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *abstract_syntax, const struct auth_serversupplied_info *serversupplied_info, struct client_address *client_id, @@ -833,17 +823,36 @@ done: } /** - * @brief Create a new RPC client context which uses a local dispatch function. + * @brief Create a new RPC client context which uses a local dispatch function + * or a remote transport, depending on rpc_server configuration for the + * specific service. + * + * @param[in] mem_ctx The memory context to use. + * + * @param[in] abstract_syntax Normally the syntax_id of the autogenerated + * ndr_table_<name>. + * + * @param[in] serversupplied_info The server supplied authentication function. * - * @param mem_ctx The memory context on which thje pipe will ultimately - * be allocated - * @param name The pipe name to connect to. - * @param session_info Credentials to use for the connection. - * @param pipe [in|out] Checks if a pipe is connected, and connects it - * if not + * @param[in] client_id The client address information. + * + * @param[in] msg_ctx The messaging context to use. * - * @return NT_STATUS_OK on success, a corresponding NT status if - * an error occured. + * @param[out] presult A pointer to store the connected rpc client pipe. + * + * @return NT_STATUS_OK on success, a corresponding NT status if an + * error occured. + * + * @code + * struct rpc_pipe_client *winreg_pipe; + * NTSTATUS status; + * + * status = rpc_pipe_open_interface(tmp_ctx, + * &ndr_table_winreg.syntax_id, + * p->session_info, + * client_id, + * &winreg_pipe); + * @endcode */ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx, diff --git a/source3/rpc_server/rpc_ncacn_np.h b/source3/rpc_server/rpc_ncacn_np.h index edebceaa43f..3d9a170cdc9 100644 --- a/source3/rpc_server/rpc_ncacn_np.h +++ b/source3/rpc_server/rpc_ncacn_np.h @@ -49,12 +49,6 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx, const struct auth_serversupplied_info *session_info, struct messaging_context *msg_ctx, struct dcerpc_binding_handle **binding_handle); -NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, - const struct ndr_syntax_id *abstract_syntax, - const struct auth_serversupplied_info *serversupplied_info, - struct client_address *client_id, - struct messaging_context *msg_ctx, - struct rpc_pipe_client **presult); NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax, const struct auth_serversupplied_info *session_info, diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index b5171867a3d..56cfb66c581 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -2254,7 +2254,7 @@ static bool api_RNetShareAdd(struct smbd_server_connection *sconn, return false; } - status = rpc_pipe_open_internal(mem_ctx, &ndr_table_srvsvc.syntax_id, + status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id, conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, @@ -2365,7 +2365,7 @@ static bool api_RNetGroupEnum(struct smbd_server_connection *sconn, return False; } - status = rpc_pipe_open_internal( + status = rpc_pipe_open_interface( talloc_tos(), &ndr_table_samr.syntax_id, conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &samr_pipe); @@ -2571,7 +2571,7 @@ static bool api_NetUserGetGroups(struct smbd_server_connection *sconn, p = *rdata; endp = *rdata + *rdata_len; - status = rpc_pipe_open_internal( + status = rpc_pipe_open_interface( talloc_tos(), &ndr_table_samr.syntax_id, conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &samr_pipe); @@ -2763,7 +2763,7 @@ static bool api_RNetUserEnum(struct smbd_server_connection *sconn, p = *rdata; endp = *rdata + *rdata_len; - status = rpc_pipe_open_internal( + status = rpc_pipe_open_interface( talloc_tos(), &ndr_table_samr.syntax_id, conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &samr_pipe); @@ -3029,7 +3029,7 @@ static bool api_SetUserPassword(struct smbd_server_connection *sconn, ZERO_STRUCT(domain_handle); ZERO_STRUCT(user_handle); - status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id, + status = rpc_pipe_open_interface(mem_ctx, &ndr_table_samr.syntax_id, conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, @@ -3280,7 +3280,7 @@ static bool api_SamOEMChangePassword(struct smbd_server_connection *sconn, memcpy(password.data, data, 516); memcpy(hash.hash, data+516, 16); - status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id, + status = rpc_pipe_open_interface(mem_ctx, &ndr_table_samr.syntax_id, conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, @@ -3864,7 +3864,7 @@ static bool api_RNetServerGetInfo(struct smbd_server_connection *sconn, p = *rdata; p2 = p + struct_len; - status = rpc_pipe_open_internal(mem_ctx, &ndr_table_srvsvc.syntax_id, + status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id, conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, @@ -4291,7 +4291,7 @@ static bool api_RNetUserGetInfo(struct smbd_server_connection *sconn, ZERO_STRUCT(domain_handle); ZERO_STRUCT(user_handle); - status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id, + status = rpc_pipe_open_interface(mem_ctx, &ndr_table_samr.syntax_id, conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, |