nsswitch: Only connect to the priv socket if required
authorVolker Lendecke <vl@samba.org>
Mon, 23 Apr 2018 10:13:40 +0000 (12:13 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 24 Apr 2018 12:32:10 +0000 (14:32 +0200)
This should speed up calls like "wbinfo -p"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
nsswitch/wb_common.c

index da81734ae3c9efbf36d2779c0ca4ef3cd011c049..6768fde535b052210d897e8b74a46fb6e2a0ba86 100644 (file)
@@ -401,6 +401,10 @@ static int winbind_open_pipe_sock(struct winbindd_context *ctx,
                return -1;
        }
 
+       if (need_priv == 0) {
+               return ctx->winbindd_fd;
+       }
+
        /* try and get priv pipe */
 
        request.wb_flags = WBFLAG_RECURSE;
@@ -424,7 +428,7 @@ static int winbind_open_pipe_sock(struct winbindd_context *ctx,
                SAFE_FREE(response.extra_data.data);
        }
 
-       if ((need_priv != 0) && (ctx->is_privileged == 0)) {
+       if (ctx->is_privileged == 0) {
                return -1;
        }