Add wbcContext to wbcRequestResponse
authorMatthew Newton <matthew-git@newtoncomputing.co.uk>
Sat, 24 Jan 2015 00:30:00 +0000 (00:30 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 9 Mar 2015 23:50:10 +0000 (00:50 +0100)
To enable libwbclient to pass winbindd context through
to the winbind client library in wb_common.

Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
nsswitch/libwbclient/wbclient.c
nsswitch/libwbclient/wbclient_internal.h

index e6b3e4e9e17c96191bab397f2a61c0264b25395e..ab1159ad9377ee166b04c6d613586caca7eff28c 100644 (file)
@@ -56,6 +56,7 @@ void winbindd_ctx_free(struct winbindd_context *ctx);
 */
 
 static wbcErr wbcRequestResponseInt(
+       struct winbindd_context *wbctx,
        int cmd,
        struct winbindd_request *request,
        struct winbindd_response *response,
@@ -68,7 +69,7 @@ static wbcErr wbcRequestResponseInt(
 
        /* for some calls the request and/or response can be NULL */
 
-       nss_status = fn(NULL, cmd, request, response);
+       nss_status = fn(wbctx, cmd, request, response);
 
        switch (nss_status) {
        case NSS_STATUS_SUCCESS:
@@ -91,25 +92,38 @@ static wbcErr wbcRequestResponseInt(
 /**
  * @brief Wrapper around Winbind's send/receive API call
  *
+ * @param ctx       Context
  * @param cmd       Winbind command operation to perform
  * @param request   Send structure
  * @param response  Receive structure
  *
  * @return #wbcErr
  */
-wbcErr wbcRequestResponse(int cmd,
+wbcErr wbcRequestResponse(struct wbcContext *ctx, int cmd,
                          struct winbindd_request *request,
                          struct winbindd_response *response)
 {
-       return wbcRequestResponseInt(cmd, request, response,
+       struct winbindd_context *wbctx = NULL;
+
+       if (ctx) {
+               wbctx = ctx->winbindd_ctx;
+       }
+
+       return wbcRequestResponseInt(wbctx, cmd, request, response,
                                     winbindd_request_response);
 }
 
-wbcErr wbcRequestResponsePriv(int cmd,
+wbcErr wbcRequestResponsePriv(struct wbcContext *ctx, int cmd,
                              struct winbindd_request *request,
                              struct winbindd_response *response)
 {
-       return wbcRequestResponseInt(cmd, request, response,
+       struct winbindd_context *wbctx = NULL;
+
+       if (ctx) {
+               wbctx = ctx->winbindd_ctx;
+       }
+
+       return wbcRequestResponseInt(wbctx, cmd, request, response,
                                     winbindd_priv_request_response);
 }
 
index e55bf27c0d75fbac3ef48accc7a9484eb87947d2..becddacdf82654b9ef42386dc9c5045ee888ed43 100644 (file)
@@ -28,11 +28,11 @@ struct wbcContext {
 
 /* Private functions */
 
-wbcErr wbcRequestResponse(int cmd,
+wbcErr wbcRequestResponse(struct wbcContext *ctx, int cmd,
                          struct winbindd_request *request,
                          struct winbindd_response *response);
 
-wbcErr wbcRequestResponsePriv(int cmd,
+wbcErr wbcRequestResponsePriv(struct wbcContext *ctx, int cmd,
                              struct winbindd_request *request,
                              struct winbindd_response *response);