summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2009-04-21 09:58:42 +0200
committerKai Blin <kai@samba.org>2009-05-30 09:17:37 +0200
commitbb9103d9c4cb9d68c36f278ea31be9b8a12063b9 (patch)
tree599df3bc99ab426f1fdcdbd81c7f9656456958b7
parent29ee4f6a340dc4009c344983cd15bcb79aaf1163 (diff)
downloadsamba-bb9103d9c4cb9d68c36f278ea31be9b8a12063b9.tar.gz
samba-bb9103d9c4cb9d68c36f278ea31be9b8a12063b9.tar.bz2
samba-bb9103d9c4cb9d68c36f278ea31be9b8a12063b9.zip
libwbclient: Store the winbind socket dir to use in the wb_context
-rw-r--r--nsswitch/libwbclient/wbc_async.c14
-rw-r--r--nsswitch/libwbclient/wbc_async.h2
-rw-r--r--source3/torture/torture.c2
3 files changed, 14 insertions, 4 deletions
diff --git a/nsswitch/libwbclient/wbc_async.c b/nsswitch/libwbclient/wbc_async.c
index 141c9816aa..6a572f4203 100644
--- a/nsswitch/libwbclient/wbc_async.c
+++ b/nsswitch/libwbclient/wbc_async.c
@@ -88,6 +88,7 @@ struct wb_context {
struct tevent_queue *queue;
int fd;
bool is_priv;
+ const char *dir;
};
static int make_nonstd_fd(int fd)
@@ -179,7 +180,10 @@ static int make_safe_fd(int fd)
return -1;
}
-struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx)
+/* Just put a prototype to avoid moving the whole function around */
+static const char *winbindd_socket_dir(void);
+
+struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx, const char* dir)
{
struct wb_context *result;
@@ -194,6 +198,12 @@ struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx)
}
result->fd = -1;
result->is_priv = false;
+
+ if (dir != NULL) {
+ result->dir = dir;
+ } else {
+ result->dir = winbindd_socket_dir();
+ }
return result;
}
@@ -351,7 +361,7 @@ static struct tevent_req *wb_open_pipe_send(TALLOC_CTX *mem_ctx,
wb_ctx->fd = -1;
}
- subreq = wb_connect_send(state, ev, wb_ctx, winbindd_socket_dir());
+ subreq = wb_connect_send(state, ev, wb_ctx, wb_ctx->dir);
if (subreq == NULL) {
goto fail;
}
diff --git a/nsswitch/libwbclient/wbc_async.h b/nsswitch/libwbclient/wbc_async.h
index a2e0eed448..607dd9de28 100644
--- a/nsswitch/libwbclient/wbc_async.h
+++ b/nsswitch/libwbclient/wbc_async.h
@@ -38,7 +38,7 @@ struct tevent_req *wb_trans_send(TALLOC_CTX *mem_ctx,
struct winbindd_request *wb_req);
wbcErr wb_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
struct winbindd_response **presponse);
-struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx);
+struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx, const char* dir);
/* Definitions from wb_reqtrans.c */
wbcErr map_wbc_err_from_errno(int error);
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 30e7e8cbc5..d185a71727 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -5985,7 +5985,7 @@ static bool run_local_wbclient(int dummy)
d_printf("nprocs=%d, numops=%d\n", (int)nprocs, (int)torture_numops);
for (i=0; i<nprocs; i++) {
- wb_ctx[i] = wb_context_init(ev);
+ wb_ctx[i] = wb_context_init(ev, NULL);
if (wb_ctx[i] == NULL) {
goto fail;
}