[PATCH 4/6] Add wbcContext to wbcRequestResponse

Matthew Newton mcn4 at leicester.ac.uk
Sun Feb 22 18:20:22 MST 2015


To enable libwbclient to pass winbindd context through
to the winbind client library in wb_common.

Signed-off-by: Matthew Newton <matthew-git at newtoncomputing.co.uk>
---
 nsswitch/libwbclient/wbclient.c          |   24 +++++++++++++++++++-----
 nsswitch/libwbclient/wbclient_internal.h |    4 ++--
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/nsswitch/libwbclient/wbclient.c b/nsswitch/libwbclient/wbclient.c
index c02f976..1d50f88 100644
--- a/nsswitch/libwbclient/wbclient.c
+++ b/nsswitch/libwbclient/wbclient.c
@@ -54,6 +54,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,
@@ -66,7 +67,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:
@@ -89,25 +90,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 = (struct winbindd_context *)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 = (struct winbindd_context *)ctx->winbindd_ctx;
+	}
+
+	return wbcRequestResponseInt(wbctx, cmd, request, response,
 				     winbindd_priv_request_response);
 }
 
diff --git a/nsswitch/libwbclient/wbclient_internal.h b/nsswitch/libwbclient/wbclient_internal.h
index 31f4130..c63180a 100644
--- a/nsswitch/libwbclient/wbclient_internal.h
+++ b/nsswitch/libwbclient/wbclient_internal.h
@@ -24,11 +24,11 @@
 
 /* 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);
 
-- 
1.7.10.4


-- 
Matthew Newton, Ph.D. <mcn4 at le.ac.uk>

Systems Specialist, Infrastructure Services,
I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom

For IT help contact helpdesk extn. 2253, <ithelp at le.ac.uk>


More information about the samba-technical mailing list