diff options
author | Andreas Schneider <asn@samba.org> | 2011-03-01 19:10:02 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-03-08 11:41:30 +0100 |
commit | 5ce12e0beb65765b7e4bcef7f8d9b1963bd53e52 (patch) | |
tree | 428b0372264b918d7af847c467b0ed5b69f1a99f | |
parent | 42e9dde6462fb6e96b7b5fa9a72b11e4c6007c9f (diff) | |
download | samba-5ce12e0beb65765b7e4bcef7f8d9b1963bd53e52.tar.gz samba-5ce12e0beb65765b7e4bcef7f8d9b1963bd53e52.tar.bz2 samba-5ce12e0beb65765b7e4bcef7f8d9b1963bd53e52.zip |
s3-rpc_server: Improved the dcerpc_ncacn_accept switch.
Signed-off-by: Günther Deschner <gd@samba.org>
-rw-r--r-- | source3/rpc_server/rpc_server.c | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index 71c714cfae..d332aeb212 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -1032,21 +1032,6 @@ static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, return; } - switch (transport) { - case NCACN_IP_TCP: - ncacn_conn->ep.port = port; - break; - case NCALRPC: - case NCACN_NP: - ncacn_conn->ep.name = talloc_strdup(ncacn_conn, name); - break; - default: - DEBUG(0, ("unknown dcerpc transport: %u!\n", - transport)); - talloc_free(ncacn_conn); - close(s); - return; - } ncacn_conn->transport = transport; ncacn_conn->syntax_id = syntax_id; ncacn_conn->ev_ctx = ev_ctx; @@ -1084,6 +1069,44 @@ static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, } } + switch (transport) { + case NCACN_IP_TCP: + ncacn_conn->ep.port = port; + + pipe_name = tsocket_address_string(ncacn_conn->client, + ncacn_conn); + if (pipe_name == NULL) { + close(s); + talloc_free(ncacn_conn); + return; + } + + break; + case NCALRPC: + case NCACN_NP: + ncacn_conn->ep.name = talloc_strdup(ncacn_conn, name); + if (ncacn_conn->ep.name == NULL) { + close(s); + talloc_free(ncacn_conn); + return; + } + + pipe_name = talloc_strdup(ncacn_conn, + name); + if (pipe_name == NULL) { + close(s); + talloc_free(ncacn_conn); + return; + } + break; + default: + DEBUG(0, ("unknown dcerpc transport: %u!\n", + transport)); + talloc_free(ncacn_conn); + close(s); + return; + } + rc = set_blocking(s, false); if (rc < 0) { DEBUG(2, ("Failed to set dcerpc socket to non-blocking\n")); @@ -1104,20 +1127,6 @@ static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, return; } - switch (ncacn_conn->transport) { - case NCACN_IP_TCP: - pipe_name = tsocket_address_string(ncacn_conn->client, - ncacn_conn); - break; - case NCALRPC: - pipe_name = talloc_strdup(ncacn_conn, - ncacn_conn->ep.name); - break; - default: - talloc_free(ncacn_conn); - return; - } - if (tsocket_address_is_inet(ncacn_conn->client, "ip")) { cli_str = ncacn_conn->client_name; } else { |