]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
rpcd: Do blocking connects to local pipes
authorVolker Lendecke <vl@samba.org>
Wed, 1 Mar 2023 13:42:00 +0000 (14:42 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 6 Mar 2023 21:32:35 +0000 (21:32 +0000)
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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_client/local_np.c

index 20b68d62d13b66dd149ab757a26386b01c7ac6f4..92d68fa95c646cc2678c619031da676e5af40c04 100644 (file)
@@ -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) {