diff options
author | Andreas Schneider <asn@samba.org> | 2013-10-21 08:26:47 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2013-10-21 12:49:44 +0200 |
commit | 5ea154bf25b6269e5c8d3c30bed88defc785f4ae (patch) | |
tree | ba608d1c8cc170745b7fe7b1a771dc27a9df599a | |
parent | b58df3d2bc2599c4ad359f72810395d00bdcd518 (diff) | |
download | samba-5ea154bf25b6269e5c8d3c30bed88defc785f4ae.tar.gz samba-5ea154bf25b6269e5c8d3c30bed88defc785f4ae.tar.bz2 samba-5ea154bf25b6269e5c8d3c30bed88defc785f4ae.zip |
s3-rpc_server: Refactor lsasd_create_sockets().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Oct 21 12:49:44 CEST 2013 on sn-devel-104
-rw-r--r-- | source3/rpc_server/lsasd.c | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c index 0a7e4ff312..375f4097c5 100644 --- a/source3/rpc_server/lsasd.c +++ b/source3/rpc_server/lsasd.c @@ -604,7 +604,7 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, uint32_t i; int fd = -1; int rc; - bool ok = true; + bool ok = false; tmp_ctx = talloc_stackframe(); if (tmp_ctx == NULL) { @@ -613,7 +613,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, status = dcerpc_binding_vector_new(tmp_ctx, &v_orig); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } @@ -624,7 +623,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, listen_fd, listen_fd_size); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } @@ -634,7 +632,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, if (rc == -1) { DEBUG(0, ("Failed to listen on tcpip socket - %s\n", strerror(errno))); - ok = false; goto done; } } @@ -642,7 +639,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, /* LSARPC */ fd = create_named_pipe_socket("lsarpc"); if (fd < 0) { - ok = false; goto done; } @@ -650,7 +646,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, if (rc == -1) { DEBUG(0, ("Failed to listen on lsarpc pipe - %s\n", strerror(errno))); - ok = false; goto done; } listen_fd[*listen_fd_size] = fd; @@ -658,7 +653,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, fd = create_named_pipe_socket("lsass"); if (fd < 0) { - ok = false; goto done; } @@ -666,7 +660,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, if (rc == -1) { DEBUG(0, ("Failed to listen on lsass pipe - %s\n", strerror(errno))); - ok = false; goto done; } listen_fd[*listen_fd_size] = fd; @@ -674,7 +667,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, fd = create_dcerpc_ncalrpc_socket("lsarpc"); if (fd < 0) { - ok = false; goto done; } @@ -682,7 +674,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, if (rc == -1) { DEBUG(0, ("Failed to listen on lsarpc ncalrpc - %s\n", strerror(errno))); - ok = false; goto done; } listen_fd[*listen_fd_size] = fd; @@ -691,37 +682,32 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, v = dcerpc_binding_vector_dup(tmp_ctx, v_orig); if (v == NULL) { - ok = false; goto done; } status = dcerpc_binding_vector_replace_iface(&ndr_table_lsarpc, v); if (!NT_STATUS_IS_OK(status)) { - return false; + goto done; } status = dcerpc_binding_vector_add_np_default(&ndr_table_lsarpc, v); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "lsarpc"); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_lsarpc, v); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } /* SAMR */ fd = create_named_pipe_socket("samr"); if (fd < 0) { - ok = false; goto done; } @@ -729,7 +715,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, if (rc == -1) { DEBUG(0, ("Failed to listen on samr pipe - %s\n", strerror(errno))); - ok = false; goto done; } listen_fd[*listen_fd_size] = fd; @@ -737,7 +722,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, fd = create_dcerpc_ncalrpc_socket("samr"); if (fd < 0) { - ok = false; goto done; } @@ -745,7 +729,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, if (rc == -1) { DEBUG(0, ("Failed to listen on samr ncalrpc - %s\n", strerror(errno))); - ok = false; goto done; } listen_fd[*listen_fd_size] = fd; @@ -754,37 +737,32 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, v = dcerpc_binding_vector_dup(tmp_ctx, v_orig); if (v == NULL) { - ok = false; goto done; } status = dcerpc_binding_vector_replace_iface(&ndr_table_samr, v); if (!NT_STATUS_IS_OK(status)) { - return false; + goto done; } status = dcerpc_binding_vector_add_np_default(&ndr_table_samr, v); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "samr"); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_samr, v); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } /* NETLOGON */ fd = create_named_pipe_socket("netlogon"); if (fd < 0) { - ok = false; goto done; } @@ -792,7 +770,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, if (rc == -1) { DEBUG(0, ("Failed to listen on samr pipe - %s\n", strerror(errno))); - ok = false; goto done; } listen_fd[*listen_fd_size] = fd; @@ -800,7 +777,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, fd = create_dcerpc_ncalrpc_socket("netlogon"); if (fd < 0) { - ok = false; goto done; } @@ -808,7 +784,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, if (rc == -1) { DEBUG(0, ("Failed to listen on netlogon ncalrpc - %s\n", strerror(errno))); - ok = false; goto done; } listen_fd[*listen_fd_size] = fd; @@ -817,33 +792,30 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx, v = dcerpc_binding_vector_dup(tmp_ctx, v_orig); if (v == NULL) { - ok = false; goto done; } status = dcerpc_binding_vector_replace_iface(&ndr_table_netlogon, v); if (!NT_STATUS_IS_OK(status)) { - return false; + goto done; } status = dcerpc_binding_vector_add_np_default(&ndr_table_netlogon, v); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "netlogon"); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_netlogon, v); if (!NT_STATUS_IS_OK(status)) { - ok = false; goto done; } + ok = true; done: if (fd != -1) { close(fd); |