[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Wed Mar 9 02:33:02 MST 2011
The branch, master has been updated
via fb3e4d2 s3-rpc_server: Remove unused _rpc_ep_register.
via 8df4f4f s3-rpc_server: Use the new endpoint register functions.
via 71f613e s3-rpc_server: Add tevent based endpoint setup functions.
via 133ed1c s3-rpc_server: Change irritating debug message.
via 0380423 s3-rpc_client: Don't ask endpoint mapper for its own port.
via b181cd8 s3-smbd: Increase debug level von context messages.
via d4867ef tevent: Fixed tevent_wakeup_send code example.
from 9728b5a librpc/ndr use hyper for uid_t/gid_t rather than udlong
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit fb3e4d2be559fe56cde5d95c3aad4552d179e72b
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 8 18:25:04 2011 +0100
s3-rpc_server: Remove unused _rpc_ep_register.
Autobuild-User: Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date: Wed Mar 9 10:32:32 CET 2011 on sn-devel-104
commit 8df4f4fd410ab3069e441c823cb518713e585186
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 8 18:00:19 2011 +0100
s3-rpc_server: Use the new endpoint register functions.
commit 71f613e9d52c6667700b70a0fe1edf14d7796958
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 8 16:02:16 2011 +0100
s3-rpc_server: Add tevent based endpoint setup functions.
commit 133ed1cc6445bb6b734451a5eaf5939d5eb100b2
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 8 16:10:07 2011 +0100
s3-rpc_server: Change irritating debug message.
commit 038042363a41b685f73cdc9ec6413c942c5dd94a
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 8 16:33:50 2011 +0100
s3-rpc_client: Don't ask endpoint mapper for its own port.
commit b181cd8465e01fb7334d49725b5deee35a61d68c
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 8 17:47:36 2011 +0100
s3-smbd: Increase debug level von context messages.
commit d4867ef8389a3767bba66d76511da496cb8c5495
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 8 17:04:44 2011 +0100
tevent: Fixed tevent_wakeup_send code example.
-----------------------------------------------------------------------
Summary of changes:
lib/tevent/tevent.h | 2 +-
source3/lib/privileges.c | 2 +-
source3/rpc_client/cli_pipe.c | 6 ++
source3/rpc_server/rpc_ep_setup.c | 154 +++++++++++++++++++++++++++++--------
source3/rpc_server/rpc_server.c | 14 ++--
source3/smbd/sec_ctx.c | 12 ++--
source3/smbd/uid.c | 2 +-
7 files changed, 145 insertions(+), 47 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index d67e2b0..665c491 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -1130,7 +1130,7 @@ void tevent_req_received(struct tevent_req *req);
*
* Example:
* @code
- * static my_callback_wakeup_done(tevent_req *req)
+ * static void my_callback_wakeup_done(tevent_req *subreq)
* {
* struct tevent_req *req = tevent_req_callback_data(subreq,
* struct tevent_req);
diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c
index 00dfefe..3826424 100644
--- a/source3/lib/privileges.c
+++ b/source3/lib/privileges.c
@@ -91,7 +91,7 @@ static bool get_privileges( const struct dom_sid *sid, uint64_t *mask )
data = dbwrap_fetch_bystring( db, talloc_tos(), keystr );
if ( !data.dptr ) {
- DEBUG(3, ("get_privileges: No privileges assigned to SID "
+ DEBUG(4, ("get_privileges: No privileges assigned to SID "
"[%s]\n", sid_string_dbg(sid)));
return False;
}
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 26a0054..ebbe849 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2515,6 +2515,12 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
goto done;
}
+ if (ndr_syntax_id_equal(abstract_syntax,
+ &ndr_table_epmapper.syntax_id)) {
+ *pport = 135;
+ return NT_STATUS_OK;
+ }
+
/* open the connection to the endpoint mapper */
status = rpc_pipe_open_tcp_port(tmp_ctx, host, 135,
&ndr_table_epmapper.syntax_id,
diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c
index 32afa1d..3731915 100644
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -123,28 +123,23 @@ static uint16_t _open_sockets(struct tevent_context *ev_ctx,
return p;
}
-static NTSTATUS _rpc_ep_register(struct tevent_context *ev_ctx,
- struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const char *name,
- uint16_t port)
+static NTSTATUS _rpc_ep_unregister(const struct ndr_interface_table *iface)
{
struct dcerpc_binding_vector *v = NULL;
NTSTATUS status;
status = dcerpc_binding_vector_create(talloc_tos(),
iface,
- port,
- name,
+ 0,
+ NULL,
&v);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- status = dcerpc_ep_register(iface,
- v,
- &iface->syntax_id.uuid,
- name);
+ status = dcerpc_ep_unregister(iface,
+ v,
+ &iface->syntax_id.uuid);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -152,23 +147,120 @@ static NTSTATUS _rpc_ep_register(struct tevent_context *ev_ctx,
return status;
}
-static NTSTATUS _rpc_ep_unregister(const struct ndr_interface_table *iface)
+static void rpc_ep_setup_register_loop(struct tevent_req *subreq);
+static NTSTATUS rpc_ep_setup_try_register(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
+ const struct ndr_interface_table *iface,
+ const char *name,
+ uint16_t port);
+
+struct rpc_ep_regsiter_state {
+ uint32_t wait_time;
+
+ struct tevent_context *ev_ctx;
+ struct messaging_context *msg_ctx;
+
+ const struct ndr_interface_table *iface;
+
+ const char *ncalrpc;
+ uint16_t port;
+};
+
+static NTSTATUS rpc_ep_setup_register(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
+ const struct ndr_interface_table *iface,
+ const char *ncalrpc,
+ uint16_t port)
+{
+ struct rpc_ep_regsiter_state *state;
+ struct tevent_req *req;
+
+ state = talloc(ev_ctx, struct rpc_ep_regsiter_state);
+ if (state == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ state->wait_time = 1;
+ state->ev_ctx = ev_ctx;
+ state->msg_ctx = msg_ctx;
+ state->iface = iface;
+ state->ncalrpc = talloc_strdup(state, ncalrpc);
+ state->port = port;
+
+ req = tevent_wakeup_send(state, ev_ctx, timeval_current_ofs(1, 0));
+ if (tevent_req_nomem(state, req)) {
+ talloc_free(state);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ tevent_req_set_callback(req, rpc_ep_setup_register_loop, state);
+
+ return NT_STATUS_OK;
+}
+
+static void rpc_ep_setup_register_loop(struct tevent_req *req)
+{
+ struct rpc_ep_regsiter_state *state =
+ tevent_req_callback_data(req, struct rpc_ep_regsiter_state);
+ NTSTATUS status;
+ bool ok;
+
+ ok = tevent_wakeup_recv(req);
+ TALLOC_FREE(req);
+ if (!ok) {
+ return;
+ }
+
+ status = rpc_ep_setup_try_register(state->ev_ctx,
+ state->msg_ctx,
+ state->iface,
+ state->ncalrpc,
+ state->port);
+ if (NT_STATUS_IS_OK(status)) {
+ talloc_free(state);
+ return;
+ }
+
+ state->wait_time = state->wait_time * 2;
+ if (state->wait_time > 16) {
+ talloc_free(state);
+ return;
+ }
+
+ req = tevent_wakeup_send(state,
+ state->ev_ctx,
+ timeval_current_ofs(state->wait_time, 0));
+ if (tevent_req_nomem(state, req)) {
+ talloc_free(state);
+ return;
+ }
+
+ tevent_req_set_callback(req, rpc_ep_setup_register_loop, state);
+ return;
+}
+
+static NTSTATUS rpc_ep_setup_try_register(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
+ const struct ndr_interface_table *iface,
+ const char *name,
+ uint16_t port)
{
struct dcerpc_binding_vector *v = NULL;
NTSTATUS status;
status = dcerpc_binding_vector_create(talloc_tos(),
iface,
- 0,
- NULL,
+ port,
+ name,
&v);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- status = dcerpc_ep_unregister(iface,
- v,
- &iface->syntax_id.uuid);
+ status = dcerpc_ep_register(iface,
+ v,
+ &iface->syntax_id.uuid,
+ name);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -227,7 +319,7 @@ static bool winreg_init_cb(void *ptr)
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_winreg,
pipe_name,
@@ -297,7 +389,7 @@ static bool srvsvc_init_cb(void *ptr)
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_srvsvc,
pipe_name,
@@ -367,7 +459,7 @@ static bool lsarpc_init_cb(void *ptr)
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_lsarpc,
pipe_name,
@@ -437,7 +529,7 @@ static bool samr_init_cb(void *ptr)
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_samr,
pipe_name,
@@ -507,7 +599,7 @@ static bool netlogon_init_cb(void *ptr)
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_netlogon,
pipe_name,
@@ -566,7 +658,7 @@ static bool spoolss_init_cb(void *ptr)
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
- status =_rpc_ep_register(ep_ctx->ev_ctx,
+ status =rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_spoolss,
"spoolss",
@@ -627,7 +719,7 @@ static bool svcctl_init_cb(void *ptr)
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_svcctl,
"svcctl",
@@ -678,7 +770,7 @@ static bool ntsvcs_init_cb(void *ptr)
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_ntsvcs,
"ntsvcs",
@@ -734,7 +826,7 @@ static bool eventlog_init_cb(void *ptr)
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
- status =_rpc_ep_register(ep_ctx->ev_ctx,
+ status =rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_eventlog,
"eventlog",
@@ -784,7 +876,7 @@ static bool initshutdown_init_cb(void *ptr)
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_initshutdown,
"initshutdown",
@@ -843,7 +935,7 @@ static bool rpcecho_init_cb(void *ptr) {
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_rpcecho,
"rpcecho",
@@ -913,7 +1005,7 @@ static bool netdfs_init_cb(void *ptr)
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_netdfs,
pipe_name,
@@ -982,7 +1074,7 @@ static bool dssetup_init_cb(void *ptr)
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_dssetup,
"dssetup",
@@ -1050,7 +1142,7 @@ static bool wkssvc_init_cb(void *ptr)
return false;
}
- status = _rpc_ep_register(ep_ctx->ev_ctx,
+ status = rpc_ep_setup_register(ep_ctx->ev_ctx,
ep_ctx->msg_ctx,
&ndr_table_wkssvc,
"wkssvc",
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
index 6f3d72d..974ecee 100644
--- a/source3/rpc_server/rpc_server.c
+++ b/source3/rpc_server/rpc_server.c
@@ -1215,7 +1215,6 @@ static void dcerpc_ncacn_packet_process(struct tevent_req *subreq)
status = dcerpc_read_ncacn_packet_recv(subreq, ncacn_conn, &pkt, &recv_buffer);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(3, ("Failed to receive ncacn packet!\n"));
goto fail;
}
@@ -1337,9 +1336,8 @@ static void dcerpc_ncacn_packet_process(struct tevent_req *subreq)
return;
fail:
- DEBUG(2, ("Fatal error(%s). "
- "Terminating client(%s) connection!\n",
- nt_errstr(status), ncacn_conn->client_name));
+ DEBUG(3, ("Terminating client(%s) connection! - '%s'\n",
+ ncacn_conn->client_name, nt_errstr(status)));
/* Terminate client connection */
talloc_free(ncacn_conn);
@@ -1350,6 +1348,7 @@ static void dcerpc_ncacn_packet_done(struct tevent_req *subreq)
{
struct dcerpc_ncacn_conn *ncacn_conn =
tevent_req_callback_data(subreq, struct dcerpc_ncacn_conn);
+ NTSTATUS status = NT_STATUS_OK;
int sys_errno;
int rc;
@@ -1357,6 +1356,7 @@ static void dcerpc_ncacn_packet_done(struct tevent_req *subreq)
TALLOC_FREE(subreq);
if (rc < 0) {
DEBUG(2, ("Writev failed!\n"));
+ status = map_nt_error_from_unix(sys_errno);
goto fail;
}
@@ -1373,7 +1373,7 @@ static void dcerpc_ncacn_packet_done(struct tevent_req *subreq)
ncacn_conn->tstream);
if (subreq == NULL) {
DEBUG(2, ("Failed to start receving packets\n"));
- sys_errno = ENOMEM;
+ status = NT_STATUS_NO_MEMORY;
goto fail;
}
@@ -1381,8 +1381,8 @@ static void dcerpc_ncacn_packet_done(struct tevent_req *subreq)
return;
fail:
- DEBUG(2, ("Fatal error(%s). Terminating client(%s) connection!\n",
- strerror(sys_errno), ncacn_conn->client_name));
+ DEBUG(3, ("Terminating client(%s) connection! - '%s'\n",
+ ncacn_conn->client_name, nt_errstr(status)));
/* Terminate client connection */
talloc_free(ncacn_conn);
diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c
index 9e409de..9eed0bd 100644
--- a/source3/smbd/sec_ctx.c
+++ b/source3/smbd/sec_ctx.c
@@ -168,11 +168,11 @@ static int get_current_groups(gid_t gid, uint32_t *p_ngroups, gid_t **p_groups)
(*p_ngroups) = ngroups;
(*p_groups) = groups;
- DEBUG( 3, ( "get_current_groups: user is in %u groups: ", ngroups));
+ DEBUG( 4, ( "get_current_groups: user is in %u groups: ", ngroups));
for (i = 0; i < ngroups; i++ ) {
- DEBUG( 3, ( "%s%d", (i ? ", " : ""), (int)groups[i] ) );
+ DEBUG( 4, ( "%s%d", (i ? ", " : ""), (int)groups[i] ) );
}
- DEBUG( 3, ( "\n" ) );
+ DEBUG( 4, ( "\n" ) );
return ngroups;
@@ -207,7 +207,7 @@ bool push_sec_ctx(void)
ctx_p->ut.uid = geteuid();
ctx_p->ut.gid = getegid();
- DEBUG(3, ("push_sec_ctx(%u, %u) : sec_ctx_stack_ndx = %d\n",
+ DEBUG(4, ("push_sec_ctx(%u, %u) : sec_ctx_stack_ndx = %d\n",
(unsigned int)ctx_p->ut.uid, (unsigned int)ctx_p->ut.gid, sec_ctx_stack_ndx ));
ctx_p->token = dup_nt_token(NULL,
@@ -307,7 +307,7 @@ void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, struct securi
/* Set the security context */
- DEBUG(3, ("setting sec ctx (%u, %u) - sec_ctx_stack_ndx = %d\n",
+ DEBUG(4, ("setting sec ctx (%u, %u) - sec_ctx_stack_ndx = %d\n",
(unsigned int)uid, (unsigned int)gid, sec_ctx_stack_ndx));
security_token_debug(DBGC_CLASS, 5, token);
@@ -415,7 +415,7 @@ bool pop_sec_ctx(void)
current_user.ut.groups = prev_ctx_p->ut.groups;
current_user.nt_user_token = prev_ctx_p->token;
- DEBUG(3, ("pop_sec_ctx (%u, %u) - sec_ctx_stack_ndx = %d\n",
+ DEBUG(4, ("pop_sec_ctx (%u, %u) - sec_ctx_stack_ndx = %d\n",
(unsigned int)geteuid(), (unsigned int)getegid(), sec_ctx_stack_ndx));
return True;
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 9a6b06d..3c4b574 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -427,7 +427,7 @@ static void push_conn_ctx(void)
ctx_p->conn = current_user.conn;
ctx_p->vuid = current_user.vuid;
- DEBUG(3, ("push_conn_ctx(%u) : conn_ctx_stack_ndx = %d\n",
+ DEBUG(4, ("push_conn_ctx(%u) : conn_ctx_stack_ndx = %d\n",
(unsigned int)ctx_p->vuid, conn_ctx_stack_ndx ));
conn_ctx_stack_ndx++;
--
Samba Shared Repository
More information about the samba-cvs
mailing list