From: Kai Blin Date: Tue, 21 Apr 2009 07:58:42 +0000 (+0200) Subject: libwbclient: Store the winbind socket dir to use in the wb_context X-Git-Tag: tdb-1.1.5~390^2~12 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;ds=sidebyside;h=bb9103d9c4cb9d68c36f278ea31be9b8a12063b9;p=samba.git libwbclient: Store the winbind socket dir to use in the wb_context --- diff --git a/nsswitch/libwbclient/wbc_async.c b/nsswitch/libwbclient/wbc_async.c index 141c9816aab..6a572f4203c 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 a2e0eed4480..607dd9de282 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 30e7e8cbc53..d185a717275 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