uint32_t i;
int fd = -1;
int rc;
- bool ok = true;
+ bool ok = false;
tmp_ctx = talloc_stackframe();
if (tmp_ctx == NULL) {
status = dcerpc_binding_vector_new(tmp_ctx, &v_orig);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
listen_fd,
listen_fd_size);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on tcpip socket - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
}
/* LSARPC */
fd = create_named_pipe_socket("lsarpc");
if (fd < 0) {
- ok = false;
goto done;
}
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;
fd = create_named_pipe_socket("lsass");
if (fd < 0) {
- ok = false;
goto done;
}
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;
fd = create_dcerpc_ncalrpc_socket("lsarpc");
if (fd < 0) {
- ok = false;
goto done;
}
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;
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;
}
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;
fd = create_dcerpc_ncalrpc_socket("samr");
if (fd < 0) {
- ok = false;
goto done;
}
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;
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;
}
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;
fd = create_dcerpc_ncalrpc_socket("netlogon");
if (fd < 0) {
- ok = false;
goto done;
}
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;
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);