[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Sat Sep 4 03:07:57 MDT 2010


The branch, master has been updated
       via  54d2dce librpc/rpc: add dcerpc_binding_handle_set_timeout()
       via  1df9fe8 s3:rpc_server: implement rpcint_bh_set_timeout() as dummy
       via  d5355dd s3:winbindd: implement wbint_bh_set_timeout() as dummy
       via  a510b9d s3:rpc_client: implement rpccli_bh_set_timeout()
       via  0879571 s4:lib/messaging: implement irpc_bh_set_timeout
       via  99a26ed s4:librpc/rpc: implement dcerpc_bh_set_timeout()
       via  2791898 librpc/rpc: add set_timeout() to dcerpc_binding_handle_ops
       via  2907310 s3:rpc_server: make it possible to use rpcint_binding_handle() directly
      from  389d357 torture-lsa: cope with STATUS_SOME_UNMAPPED errors

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 54d2dce7b15579cc4daaad07a9e0344ef4fc17f7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 3 19:57:02 2010 +0200

    librpc/rpc: add dcerpc_binding_handle_set_timeout()
    
    metze

commit 1df9fe81f52deebc23f762c80c974ca772553b21
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 3 20:05:39 2010 +0200

    s3:rpc_server: implement rpcint_bh_set_timeout() as dummy
    
    metze

commit d5355dda819e0dc6c75678f4756becef94715ffa
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 3 20:05:08 2010 +0200

    s3:winbindd: implement wbint_bh_set_timeout() as dummy
    
    metze

commit a510b9de39bfc970084ab77d94f67d6bec5c4923
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 3 19:59:15 2010 +0200

    s3:rpc_client: implement rpccli_bh_set_timeout()
    
    metze

commit 0879571897c0c0485890119768a4dad860ee88b0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 3 19:52:59 2010 +0200

    s4:lib/messaging: implement irpc_bh_set_timeout
    
    metze

commit 99a26edcb37cfce19a1221f518e6c57e55120682
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 3 19:52:20 2010 +0200

    s4:librpc/rpc: implement dcerpc_bh_set_timeout()
    
    metze

commit 27918981de05edf0d07bdb4adc75701b29c957d3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 3 19:51:58 2010 +0200

    librpc/rpc: add set_timeout() to dcerpc_binding_handle_ops
    
    metze

commit 2907310803a3168582fa0d7ffb5c357e89723434
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 3 19:28:00 2010 +0200

    s3:rpc_server: make it possible to use rpcint_binding_handle() directly
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 librpc/rpc/binding_handle.c                |    6 ++
 source3/include/client.h                   |    3 -
 source3/include/proto.h                    |    6 ++
 source3/librpc/rpc/dcerpc.h                |    5 ++
 source3/rpc_client/cli_pipe.c              |   10 +++
 source3/rpc_server/rpc_ncacn_np_internal.c |  102 +++++++++++++++++++++++-----
 source3/winbindd/winbindd_dual_ndr.c       |    8 ++
 source4/lib/messaging/messaging.c          |   20 +++++-
 source4/librpc/rpc/dcerpc.c                |   18 +++++
 source4/librpc/rpc/dcerpc.h                |    5 ++
 10 files changed, 161 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/rpc/binding_handle.c b/librpc/rpc/binding_handle.c
index 75b2ded..93c0fd4 100644
--- a/librpc/rpc/binding_handle.c
+++ b/librpc/rpc/binding_handle.c
@@ -91,6 +91,12 @@ bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h)
 	return h->ops->is_connected(h);
 }
 
+uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
+					   uint32_t timeout)
+{
+	return h->ops->set_timeout(h, timeout);
+}
+
 struct dcerpc_binding_handle_raw_call_state {
 	const struct dcerpc_binding_handle_ops *ops;
 	uint8_t *out_data;
diff --git a/source3/include/client.h b/source3/include/client.h
index 326931c..03d4c85 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -125,9 +125,6 @@ struct rpc_pipe_client {
 
 	/* The following is only non-null on a netlogon client pipe. */
 	struct netlogon_creds_CredentialState *dc;
-
-	/* Used by internal rpc_pipe_client */
-	struct pipes_struct *pipes_struct;
 };
 
 /* Transport encryption state. */
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 180e1c0..2f82e70 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4169,6 +4169,12 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
 					      struct client_address *client_id,
 					      struct auth_serversupplied_info *server_info,
 					      struct messaging_context *msg_ctx);
+NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
+			       const struct ndr_interface_table *ndr_table,
+			       struct client_address *client_id,
+			       struct auth_serversupplied_info *server_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,
 				struct auth_serversupplied_info *serversupplied_info,
diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
index d064f3d..af20889 100644
--- a/source3/librpc/rpc/dcerpc.h
+++ b/source3/librpc/rpc/dcerpc.h
@@ -186,6 +186,8 @@ struct dcerpc_binding_handle_ops {
 	const char *name;
 
 	bool (*is_connected)(struct dcerpc_binding_handle *h);
+	uint32_t (*set_timeout)(struct dcerpc_binding_handle *h,
+				uint32_t timeout);
 
 	struct tevent_req *(*raw_call_send)(TALLOC_CTX *mem_ctx,
 					    struct tevent_context *ev,
@@ -257,6 +259,9 @@ _DEPRECATED_ void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle
 
 bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h);
 
+uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
+					   uint32_t timeout);
+
 struct tevent_req *dcerpc_binding_handle_raw_call_send(TALLOC_CTX *mem_ctx,
 						struct tevent_context *ev,
 						struct dcerpc_binding_handle *h,
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 9660df3..1975d73 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -1996,6 +1996,15 @@ static bool rpccli_bh_is_connected(struct dcerpc_binding_handle *h)
 	return rpccli_is_connected(hs->rpc_cli);
 }
 
+static uint32_t rpccli_bh_set_timeout(struct dcerpc_binding_handle *h,
+				      uint32_t timeout)
+{
+	struct rpccli_bh_state *hs = dcerpc_binding_handle_data(h,
+				     struct rpccli_bh_state);
+
+	return rpccli_set_timeout(hs->rpc_cli, timeout);
+}
+
 struct rpccli_bh_raw_call_state {
 	DATA_BLOB in_data;
 	DATA_BLOB out_data;
@@ -2174,6 +2183,7 @@ static void rpccli_bh_do_ndr_print(struct dcerpc_binding_handle *h,
 static const struct dcerpc_binding_handle_ops rpccli_bh_ops = {
 	.name			= "rpccli",
 	.is_connected		= rpccli_bh_is_connected,
+	.set_timeout		= rpccli_bh_set_timeout,
 	.raw_call_send		= rpccli_bh_raw_call_send,
 	.raw_call_recv		= rpccli_bh_raw_call_recv,
 	.disconnect_send	= rpccli_bh_disconnect_send,
diff --git a/source3/rpc_server/rpc_ncacn_np_internal.c b/source3/rpc_server/rpc_ncacn_np_internal.c
index d4cb342..3a3f8ca 100644
--- a/source3/rpc_server/rpc_ncacn_np_internal.c
+++ b/source3/rpc_server/rpc_ncacn_np_internal.c
@@ -252,6 +252,13 @@ static bool rpcint_bh_is_connected(struct dcerpc_binding_handle *h)
 	return true;
 }
 
+static uint32_t rpcint_bh_set_timeout(struct dcerpc_binding_handle *h,
+				      uint32_t timeout)
+{
+	/* TODO: implement timeouts */
+	return UINT32_MAX;
+}
+
 struct rpcint_bh_raw_call_state {
 	DATA_BLOB in_data;
 	DATA_BLOB out_data;
@@ -408,6 +415,7 @@ static void rpcint_bh_do_ndr_print(struct dcerpc_binding_handle *h,
 static const struct dcerpc_binding_handle_ops rpcint_bh_ops = {
 	.name			= "rpcint",
 	.is_connected		= rpcint_bh_is_connected,
+	.set_timeout		= rpcint_bh_set_timeout,
 	.raw_call_send		= rpcint_bh_raw_call_send,
 	.raw_call_recv		= rpcint_bh_raw_call_recv,
 	.disconnect_send	= rpcint_bh_disconnect_send,
@@ -417,25 +425,84 @@ static const struct dcerpc_binding_handle_ops rpcint_bh_ops = {
 	.do_ndr_print		= rpcint_bh_do_ndr_print,
 };
 
-/* initialise a wbint binding handle */
-static struct dcerpc_binding_handle *rpcint_binding_handle(struct pipes_struct *p)
+static NTSTATUS rpcint_binding_handle_ex(TALLOC_CTX *mem_ctx,
+			const struct ndr_syntax_id *abstract_syntax,
+			const struct ndr_interface_table *ndr_table,
+			struct client_address *client_id,
+			struct auth_serversupplied_info *server_info,
+			struct messaging_context *msg_ctx,
+			struct dcerpc_binding_handle **binding_handle)
 {
 	struct dcerpc_binding_handle *h;
 	struct rpcint_bh_state *hs;
 
-	h = dcerpc_binding_handle_create(p,
+	if (ndr_table) {
+		abstract_syntax = &ndr_table->syntax_id;
+	}
+
+	h = dcerpc_binding_handle_create(mem_ctx,
 					 &rpcint_bh_ops,
 					 NULL,
-					 NULL, /* TODO */
+					 ndr_table,
 					 &hs,
 					 struct rpcint_bh_state,
 					 __location__);
 	if (h == NULL) {
-		return NULL;
+		return NT_STATUS_NO_MEMORY;
+	}
+	hs->p = make_internal_rpc_pipe_p(hs,
+					 abstract_syntax,
+					 client_id,
+					 server_info,
+					 msg_ctx);
+	if (hs->p == NULL) {
+		TALLOC_FREE(h);
+		return NT_STATUS_NO_MEMORY;
 	}
-	hs->p = p;
 
-	return h;
+	*binding_handle = h;
+	return NT_STATUS_OK;
+}
+/**
+ * @brief Create a new DCERPC Binding Handle which uses a local dispatch function.
+ *
+ * @param[in]  mem_ctx  The memory context to use.
+ *
+ * @param[in]  ndr_table Normally the ndr_table_<name>.
+ *
+ * @param[in]  client_id The info about the connected client.
+ *
+ * @param[in]  serversupplied_info The server supplied authentication function.
+ *
+ * @param[in]  msg_ctx   The messaging context that can be used by the server
+ *
+ * @param[out] binding_handle  A pointer to store the connected
+ *                             dcerpc_binding_handle
+ *
+ * @return              NT_STATUS_OK on success, a corresponding NT status if an
+ *                      error occured.
+ *
+ * @code
+ *   struct dcerpc_binding_handle *winreg_binding;
+ *   NTSTATUS status;
+ *
+ *   status = rpcint_binding_handle(tmp_ctx,
+ *                                  &ndr_table_winreg,
+ *                                  p->client_id,
+ *                                  p->server_info,
+ *                                  p->msg_ctx
+ *                                  &winreg_binding);
+ * @endcode
+ */
+NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
+			       const struct ndr_interface_table *ndr_table,
+			       struct client_address *client_id,
+			       struct auth_serversupplied_info *server_info,
+			       struct messaging_context *msg_ctx,
+			       struct dcerpc_binding_handle **binding_handle)
+{
+	return rpcint_binding_handle_ex(mem_ctx, NULL, ndr_table, client_id,
+					server_info, msg_ctx, binding_handle);
 }
 
 /**
@@ -475,6 +542,7 @@ NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
 				struct rpc_pipe_client **presult)
 {
 	struct rpc_pipe_client *result;
+	NTSTATUS status;
 
 	result = TALLOC_ZERO_P(mem_ctx, struct rpc_pipe_client);
 	if (result == NULL) {
@@ -491,21 +559,19 @@ NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
 		client_id = &unknown;
 	}
 
-	result->pipes_struct = make_internal_rpc_pipe_p(
-		result, abstract_syntax, client_id, serversupplied_info,
-		msg_ctx);
-	if (result->pipes_struct == NULL) {
-		TALLOC_FREE(result);
-		return NT_STATUS_NO_MEMORY;
-	}
-
 	result->max_xmit_frag = -1;
 	result->max_recv_frag = -1;
 
-	result->binding_handle = rpcint_binding_handle(result->pipes_struct);
-	if (result->binding_handle == NULL) {
+	status = rpcint_binding_handle_ex(result,
+					  abstract_syntax,
+					  NULL,
+					  client_id,
+					  serversupplied_info,
+					  msg_ctx,
+					  &result->binding_handle);
+	if (!NT_STATUS_IS_OK(status)) {
 		TALLOC_FREE(result);
-		return NT_STATUS_NO_MEMORY;
+		return status;
 	}
 
 	*presult = result;
diff --git a/source3/winbindd/winbindd_dual_ndr.c b/source3/winbindd/winbindd_dual_ndr.c
index 495c58a..e400b61 100644
--- a/source3/winbindd/winbindd_dual_ndr.c
+++ b/source3/winbindd/winbindd_dual_ndr.c
@@ -48,6 +48,13 @@ static bool wbint_bh_is_connected(struct dcerpc_binding_handle *h)
 	return true;
 }
 
+static uint32_t wbint_bh_set_timeout(struct dcerpc_binding_handle *h,
+				     uint32_t timeout)
+{
+	/* TODO: implement timeouts */
+	return UINT32_MAX;
+}
+
 struct wbint_bh_raw_call_state {
 	struct winbindd_domain *domain;
 	uint32_t opnum;
@@ -254,6 +261,7 @@ static void wbint_bh_do_ndr_print(struct dcerpc_binding_handle *h,
 static const struct dcerpc_binding_handle_ops wbint_bh_ops = {
 	.name			= "wbint",
 	.is_connected		= wbint_bh_is_connected,
+	.set_timeout		= wbint_bh_set_timeout,
 	.raw_call_send		= wbint_bh_raw_call_send,
 	.raw_call_recv		= wbint_bh_raw_call_recv,
 	.disconnect_send	= wbint_bh_disconnect_send,
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index e50e50f..ae3f908 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -1004,6 +1004,7 @@ struct irpc_bh_state {
 	struct messaging_context *msg_ctx;
 	struct server_id server_id;
 	const struct ndr_interface_table *table;
+	uint32_t timeout;
 };
 
 static bool irpc_bh_is_connected(struct dcerpc_binding_handle *h)
@@ -1018,6 +1019,18 @@ static bool irpc_bh_is_connected(struct dcerpc_binding_handle *h)
 	return true;
 }
 
+static uint32_t irpc_bh_set_timeout(struct dcerpc_binding_handle *h,
+				    uint32_t timeout)
+{
+	struct irpc_bh_state *hs = dcerpc_binding_handle_data(h,
+				   struct irpc_bh_state);
+	uint32_t old = hs->timeout;
+
+	hs->timeout = timeout;
+
+	return old;
+}
+
 struct irpc_bh_raw_call_state {
 	struct irpc_request *irpc;
 	uint32_t opnum;
@@ -1119,7 +1132,10 @@ static struct tevent_req *irpc_bh_raw_call_send(TALLOC_CTX *mem_ctx,
 		return tevent_req_post(req, ev);
 	}
 
-	tevent_req_set_endtime(req, ev, timeval_current_ofs(IRPC_CALL_TIMEOUT, 0));
+	ok = tevent_req_set_endtime(req, ev, timeval_current_ofs(hs->timeout, 0));
+	if (!ok) {
+		return tevent_req_post(req, ev);
+	}
 
 	return req;
 }
@@ -1228,6 +1244,7 @@ static bool irpc_bh_ref_alloc(struct dcerpc_binding_handle *h)
 static const struct dcerpc_binding_handle_ops irpc_bh_ops = {
 	.name			= "wbint",
 	.is_connected		= irpc_bh_is_connected,
+	.set_timeout		= irpc_bh_set_timeout,
 	.raw_call_send		= irpc_bh_raw_call_send,
 	.raw_call_recv		= irpc_bh_raw_call_recv,
 	.disconnect_send	= irpc_bh_disconnect_send,
@@ -1258,6 +1275,7 @@ struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx,
 	hs->msg_ctx = msg_ctx;
 	hs->server_id = server_id;
 	hs->table = table;
+	hs->timeout = IRPC_CALL_TIMEOUT;
 
 	dcerpc_binding_handle_set_sync_ev(h, msg_ctx->event.ev);
 
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 1163eae..13e3a3e 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -121,6 +121,23 @@ static bool dcerpc_bh_is_connected(struct dcerpc_binding_handle *h)
 	return true;
 }
 
+static uint32_t dcerpc_bh_set_timeout(struct dcerpc_binding_handle *h,
+				      uint32_t timeout)
+{
+	struct dcerpc_bh_state *hs = dcerpc_binding_handle_data(h,
+				     struct dcerpc_bh_state);
+	uint32_t old;
+
+	if (!hs->p) {
+		return DCERPC_REQUEST_TIMEOUT;
+	}
+
+	old = hs->p->request_timeout;
+	hs->p->request_timeout = timeout;
+
+	return old;
+}
+
 struct dcerpc_bh_raw_call_state {
 	struct dcerpc_binding_handle *h;
 	DATA_BLOB in_data;
@@ -456,6 +473,7 @@ static NTSTATUS dcerpc_bh_ndr_validate_out(struct dcerpc_binding_handle *h,
 static const struct dcerpc_binding_handle_ops dcerpc_bh_ops = {
 	.name			= "dcerpc",
 	.is_connected		= dcerpc_bh_is_connected,
+	.set_timeout		= dcerpc_bh_set_timeout,
 	.raw_call_send		= dcerpc_bh_raw_call_send,
 	.raw_call_recv		= dcerpc_bh_raw_call_recv,
 	.disconnect_send	= dcerpc_bh_disconnect_send,
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 9ff2c1b..b77628d 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -407,6 +407,8 @@ struct dcerpc_binding_handle_ops {
 	const char *name;
 
 	bool (*is_connected)(struct dcerpc_binding_handle *h);
+	uint32_t (*set_timeout)(struct dcerpc_binding_handle *h,
+				uint32_t timeout);
 
 	struct tevent_req *(*raw_call_send)(TALLOC_CTX *mem_ctx,
 					    struct tevent_context *ev,
@@ -475,6 +477,9 @@ _DEPRECATED_ void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle
 
 bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h);
 
+uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
+					   uint32_t timeout);
+
 struct tevent_req *dcerpc_binding_handle_raw_call_send(TALLOC_CTX *mem_ctx,
 						struct tevent_context *ev,
 						struct dcerpc_binding_handle *h,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list