From: Volker Lendecke Date: Wed, 1 Mar 2023 13:42:00 +0000 (+0100) Subject: rpcd: Do blocking connects to local pipes X-Git-Tag: talloc-2.4.1~1479 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ab7b84ccbd383bb2f696ce258438d4af57fe6f0;p=thirdparty%2Fsamba.git rpcd: Do blocking connects to local pipes We don't have real async callers yet, and this is the simplest way to fix our missing light-weight deterministic async fallback mechanism. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15310 Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/rpc_client/local_np.c b/source3/rpc_client/local_np.c index 20b68d62d13..92d68fa95c6 100644 --- a/source3/rpc_client/local_np.c +++ b/source3/rpc_client/local_np.c @@ -101,7 +101,7 @@ static struct tevent_req *np_sock_connect_send( return tevent_req_post(req, ev); } - ret = set_blocking(state->sock, false); + ret = set_blocking(state->sock, true); if (ret == -1) { tevent_req_error(req, errno); return tevent_req_post(req, ev); @@ -174,6 +174,18 @@ static void np_sock_connect_connected(struct tevent_req *subreq) return; } + /* + * As a quick workaround for bug 15310 we have done the + * connect in blocking mode (see np_sock_connect_send()). The + * rest of our code expects a nonblocking socket, activate + * this after the connect succeeded. + */ + ret = set_blocking(state->sock, false); + if (ret == -1) { + tevent_req_error(req, errno); + return; + } + ret = tstream_bsd_existing_socket( state, state->sock, &state->transport); if (ret == -1) {