From 6a77cbd6f94549734ad0606919371ace347c1bf4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 21 Sep 2010 15:41:23 -0700 Subject: [PATCH] s3: Remove a global variable in bugfix for bug 7665 --- source3/lib/netapi/cm.c | 17 ++++++++++------- source3/lib/netapi/netapi_private.h | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c index cb86181..97a5968 100644 --- a/source3/lib/netapi/cm.c +++ b/source3/lib/netapi/cm.c @@ -36,16 +36,15 @@ struct client_pipe_connection { struct rpc_pipe_client *pipe; }; -static struct client_ipc_connection *ipc_connections = NULL; - /******************************************************************** ********************************************************************/ -static struct client_ipc_connection *ipc_cm_find(const char *server_name) +static struct client_ipc_connection *ipc_cm_find( + struct libnetapi_private_ctx *priv_ctx, const char *server_name) { struct client_ipc_connection *p; - for (p = ipc_connections; p; p = p->next) { + for (p = priv_ctx->ipc_connections; p; p = p->next) { if (strequal(p->cli->desthost, server_name)) { return p; } @@ -61,6 +60,8 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx, const char *server_name, struct client_ipc_connection **pp) { + struct libnetapi_private_ctx *priv_ctx = + (struct libnetapi_private_ctx *)ctx->private_data; struct user_auth_info *auth_info = NULL; struct cli_state *cli_ipc = NULL; struct client_ipc_connection *p; @@ -69,7 +70,7 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx, return WERR_INVALID_PARAM; } - p = ipc_cm_find(server_name); + p = ipc_cm_find(priv_ctx, server_name); if (p) { *pp = p; return WERR_OK; @@ -123,7 +124,7 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx, } p->cli = cli_ipc; - DLIST_ADD(ipc_connections, p); + DLIST_ADD(priv_ctx->ipc_connections, p); *pp = p; @@ -135,9 +136,11 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx, WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx) { + struct libnetapi_private_ctx *priv_ctx = + (struct libnetapi_private_ctx *)ctx->private_data; struct client_ipc_connection *p; - for (p = ipc_connections; p; p = p->next) { + for (p = priv_ctx->ipc_connections; p; p = p->next) { cli_shutdown(p->cli); } diff --git a/source3/lib/netapi/netapi_private.h b/source3/lib/netapi/netapi_private.h index effe2eb..d0f7756 100644 --- a/source3/lib/netapi/netapi_private.h +++ b/source3/lib/netapi/netapi_private.h @@ -43,6 +43,7 @@ struct libnetapi_private_ctx { struct policy_handle builtin_handle; } samr; + struct client_ipc_connection *ipc_connections; }; NET_API_STATUS libnetapi_get_password(struct libnetapi_ctx *ctx, char **password); -- 1.7.0.4