rpc_server: Always use rpc_pipe_open_interface()
authorSimo Sorce <idra@samba.org>
Wed, 11 May 2011 20:38:46 +0000 (16:38 -0400)
committerGünther Deschner <gd@samba.org>
Fri, 13 May 2011 12:40:26 +0000 (14:40 +0200)
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

source3/printing/nt_printing_migrate.c
source3/rpc_server/rpc_ncacn_np.c
source3/rpc_server/rpc_ncacn_np.h
source3/smbd/lanman.c

index 5fd0aae7fc1402f7c04df91e9e03a3d77193bf30..3879198977153e02529ae23746b88dabbf9df6d9 100644 (file)
@@ -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,
index 2e99da72ed739b76701f1609bff79b1710d46947..9328322f2001a24d01bdc12c669e7bcf1793ed72 100644 (file)
@@ -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,
index edebceaa43f1934eed51a84400b35478880601f2..3d9a170cdc9d62c23fdeccbb16aee16b9e3fd073 100644 (file)
@@ -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,
index b5171867a3d7c01fd71b5bfbeb419ae5a803e9d1..56cfb66c581526bc4499331805b0487db2eb95b4 100644 (file)
@@ -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,