[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Wed May 26 07:08:24 MDT 2010
The branch, master has been updated
via 718718d... s3-lanman: Migrated to rpc_connect_spoolss_pipe().
via 8aa9656... s3-rpc_server: Created a per connection spoolss pipe.
from 83b2fd3... s3-waf: Build smbclient binary
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 718718d0e7d4ffd1e706a2896cc385ae6dba24e2
Author: Simo Sorce <idra at samba.org>
Date: Wed Apr 28 10:23:48 2010 -0400
s3-lanman: Migrated to rpc_connect_spoolss_pipe().
Signed-off-by: Günther Deschner <gd at samba.org>
commit 8aa96566a96413384b7c8af0143c4ed1af100492
Author: Simo Sorce <idra at samba.org>
Date: Wed Apr 28 09:51:12 2010 -0400
s3-rpc_server: Created a per connection spoolss pipe.
This way all code can reuse the same connection to spoolss
and not have to deal with the creation of a new pipe all over the
code every time we need to ask a service off spoolss.
Signed-off-by: Günther Deschner <gd at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 2 ++
source3/include/smb.h | 3 +++
source3/rpc_server/srv_pipe_hnd.c | 33 +++++++++++++++++++++++++++++++++
source3/smbd/lanman.c | 37 +++++++++----------------------------
4 files changed, 47 insertions(+), 28 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index f7d9f39..3bff172 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4899,6 +4899,8 @@ NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id
NTSTATUS (*dispatch) (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r),
struct auth_serversupplied_info *serversupplied_info,
struct rpc_pipe_client **presult);
+NTSTATUS rpc_connect_spoolss_pipe(connection_struct *conn,
+ struct rpc_pipe_client **spoolss_pipe);
NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
const struct ndr_syntax_id *interface,
struct rpc_pipe_client **presult);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 1ceb54b..a93caa7 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -592,6 +592,9 @@ typedef struct connection_struct {
struct dfree_cached_info *dfree_info;
struct trans_state *pending_trans;
struct notify_context *notify_ctx;
+
+ struct rpc_pipe_client *spoolss_pipe;
+
} connection_struct;
struct current_user {
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 847953d..075d705 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "../librpc/gen_ndr/srv_spoolss.h"
#include "librpc/gen_ndr/ndr_named_pipe_auth.h"
#undef DBGC_CLASS
@@ -1516,3 +1517,35 @@ NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
*presult = result;
return NT_STATUS_OK;
}
+
+/**
+ * @brief Create a new RPC client context which uses a local dispatch function.
+ *
+ * @param[in] conn The connection struct that will hold the pipe
+ *
+ * @param[out] spoolss_pipe A pointer to the connected rpc client pipe.
+ *
+ * @return NT_STATUS_OK on success, a corresponding NT status if an
+ * error occured.
+ */
+NTSTATUS rpc_connect_spoolss_pipe(connection_struct *conn,
+ struct rpc_pipe_client **spoolss_pipe)
+{
+ NTSTATUS status;
+
+ /* TODO: check and handle disconnections */
+
+ if (!conn->spoolss_pipe) {
+ status = rpc_pipe_open_internal(conn,
+ &ndr_table_spoolss.syntax_id,
+ rpc_spoolss_dispatch,
+ conn->server_info,
+ &conn->spoolss_pipe);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+
+ *spoolss_pipe = conn->spoolss_pipe;
+ return NT_STATUS_OK;
+}
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 744d460..0d5cda7 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -33,7 +33,6 @@
#include "rpc_client/init_spoolss.h"
#include "../librpc/gen_ndr/cli_srvsvc.h"
#include "../librpc/gen_ndr/srv_samr.h"
-#include "../librpc/gen_ndr/srv_spoolss.h"
#include "../librpc/gen_ndr/srv_srvsvc.h"
#include "../librpc/gen_ndr/rap.h"
#include "../lib/util/binsearch.h"
@@ -816,9 +815,7 @@ static bool api_DosPrintQGetInfo(connection_struct *conn, uint16 vuid,
ZERO_STRUCT(handle);
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_DosPrintQGetInfo: could not connect to spoolss: %s\n",
nt_errstr(status)));
@@ -1007,9 +1004,7 @@ static bool api_DosPrintQEnum(connection_struct *conn, uint16 vuid,
return(True);
}
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_DosPrintQEnum: could not connect to spoolss: %s\n",
nt_errstr(status)));
@@ -3099,9 +3094,7 @@ static bool api_RDosPrintJobDel(connection_struct *conn,uint16 vuid,
ZERO_STRUCT(handle);
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_RDosPrintJobDel: could not connect to spoolss: %s\n",
nt_errstr(status)));
@@ -3221,9 +3214,7 @@ static bool api_WPrintQueueCtrl(connection_struct *conn,uint16 vuid,
ZERO_STRUCT(handle);
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_WPrintQueueCtrl: could not connect to spoolss: %s\n",
nt_errstr(status)));
@@ -3397,9 +3388,7 @@ static bool api_PrintJobInfo(connection_struct *conn, uint16 vuid,
ZERO_STRUCT(handle);
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_PrintJobInfo: could not connect to spoolss: %s\n",
nt_errstr(status)));
@@ -4385,9 +4374,7 @@ static bool api_WPrintJobGetInfo(connection_struct *conn, uint16 vuid,
ZERO_STRUCT(handle);
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_WPrintJobGetInfo: could not connect to spoolss: %s\n",
nt_errstr(status)));
@@ -4521,9 +4508,7 @@ static bool api_WPrintJobEnumerate(connection_struct *conn, uint16 vuid,
ZERO_STRUCT(handle);
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_WPrintJobEnumerate: could not connect to spoolss: %s\n",
nt_errstr(status)));
@@ -4715,9 +4700,7 @@ static bool api_WPrintDestGetInfo(connection_struct *conn, uint16 vuid,
ZERO_STRUCT(handle);
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_WPrintDestGetInfo: could not connect to spoolss: %s\n",
nt_errstr(status)));
@@ -4842,9 +4825,7 @@ static bool api_WPrintDestEnum(connection_struct *conn, uint16 vuid,
queuecnt = 0;
- status = rpc_pipe_open_internal(mem_ctx, &ndr_table_spoolss.syntax_id,
- rpc_spoolss_dispatch, conn->server_info,
- &cli);
+ status = rpc_connect_spoolss_pipe(conn, &cli);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("api_WPrintDestEnum: could not connect to spoolss: %s\n",
nt_errstr(status)));
--
Samba Shared Repository
More information about the samba-cvs
mailing list