s3: Remove a global variable in bugfix for bug 7665
authorVolker Lendecke <vl@samba.org>
Tue, 21 Sep 2010 22:41:23 +0000 (15:41 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 27 Sep 2010 19:29:04 +0000 (21:29 +0200)
(cherry picked from commit cf364274cbae996fbe186b2c2792b212f189e26a)

source3/lib/netapi/cm.c
source3/lib/netapi/netapi_private.h

index cb86181e26151383fda458d71bd0e74c7da70c2c..97a5968ee378197e045a9ccaef49701903ebf8bf 100644 (file)
@@ -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);
        }
 
index effe2eb9a076715caf1eb24529243bb2b34873ad..d0f7756d162457731b31ed9cb3298d01b6e2563f 100644 (file)
@@ -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);