r2710: continue with the new style of providing a parent context whenever
authorAndrew Tridgell <tridge@samba.org>
Tue, 28 Sep 2004 05:44:59 +0000 (05:44 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:25 +0000 (12:59 -0500)
possible to a structure creation routine. This makes for much easier
global cleanup.

19 files changed:
source/auth/auth_domain.c
source/client/client.c
source/client/smbspool.c
source/libcli/cliconnect.c
source/libcli/clidfs.c
source/libcli/raw/clisocket.c
source/libcli/raw/clitree.c
source/librpc/rpc/dcerpc_smb.c
source/librpc/rpc/dcerpc_util.c
source/ntvfs/cifs/vfs_cifs.c
source/ntvfs/ipc/vfs_ipc.c
source/rpc_server/dcerpc_server.c
source/torture/gentest.c
source/torture/locktest.c
source/torture/locktest2.c
source/torture/masktest.c
source/torture/raw/context.c
source/torture/rpc/samr.c
source/torture/torture.c

index b0dd2612b0bf3b2fb21b9ce4a6709320bae4b2d3..831bb4cfe05ff1501ea42511be185f90419a162b 100644 (file)
@@ -169,7 +169,7 @@ static NTSTATUS connect_to_domain_password_server(struct smbcli_state **cli,
                return NT_STATUS_NO_LOGON_SERVERS;
        
        /* Attempt connection */
-       result = smbcli_full_connection(cli, lp_netbios_name(), remote_machine,
+       result = smbcli_full_connection(NULL, cli, lp_netbios_name(), remote_machine,
                                     &dest_ip, 0, "IPC$", "IPC", "", "", "",0, retry);
 
        if (!NT_STATUS_IS_OK(result)) {
index 68b30acc67afe9934c4047a0ce2503f5cc2f86af..9a70c2e09f43f10a2b8215f0b00c3bf4677d64a0 100644 (file)
@@ -2727,7 +2727,7 @@ static struct smbcli_state *do_connect(const char *server, const char *share)
 
  again:
        /* have to open a new connection */
-       if (!(c=smbcli_state_init()) || !smbcli_socket_connect(c, server_n)) {
+       if (!(c=smbcli_state_init(NULL)) || !smbcli_socket_connect(c, server_n)) {
                d_printf("Connection to %s failed\n", server_n);
                return NULL;
        }
@@ -2858,7 +2858,7 @@ static int do_message_op(void)
 
        server_name = dest_ip ? dest_ip : desthost;
 
-       if (!(cli=smbcli_state_init()) || !smbcli_socket_connect(cli, server_name)) {
+       if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name)) {
                d_printf("Connection to %s failed\n", server_name);
                return 1;
        }
index 25208ac93a28181f82dfb3e85ec9ae5ac60aabd1..e81453a23b45b92c8572fde02408298ed84cf06c 100644 (file)
@@ -279,7 +279,7 @@ smb_connect(const char *workgroup,          /* I - Workgroup */
 
   myname = get_myname();  
        
-  nt_status = smbcli_full_connection(&c, myname, server, NULL, 0, share, "?????", 
+  nt_status = smbcli_full_connection(NULL, &c, myname, server, NULL, 0, share, "?????", 
                                  username, workgroup, password, 0, NULL);
   
   free(myname);
index aa6aec4a1e2f5f9b7838462d754174fde8ede5d9..8e7e128a4e355c7f8d0222fc4fbb1b8dc2bc06b7 100644 (file)
@@ -27,7 +27,7 @@ BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server)
 {
        struct smbcli_socket *sock;
 
-       sock = smbcli_sock_init();
+       sock = smbcli_sock_init(cli);
        if (!sock) return False;
 
        if (!smbcli_sock_connect_byname(sock, server, 0)) {
@@ -149,17 +149,18 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename,
 /*
   easy way to get to a fully connected smbcli_state in one call
 */
-NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, 
-                            const char *myname,
-                            const char *host,
-                            struct in_addr *ip,
-                            const char *sharename,
-                            const char *devtype,
-                            const char *username,
-                            const char *domain,
-                            const char *password,
-                            uint_t flags,
-                            BOOL *retry)
+NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
+                               struct smbcli_state **ret_cli, 
+                               const char *myname,
+                               const char *host,
+                               struct in_addr *ip,
+                               const char *sharename,
+                               const char *devtype,
+                               const char *username,
+                               const char *domain,
+                               const char *password,
+                               uint_t flags,
+                               BOOL *retry)
 {
        struct smbcli_tree *tree;
        NTSTATUS status;
@@ -177,21 +178,23 @@ NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli,
                username = talloc_strdup(mem_ctx, p+1);
        }
 
-       status = smbcli_tree_full_connection(&tree, myname, host, 0, sharename, devtype,
+       status = smbcli_tree_full_connection(parent_ctx,
+                                            &tree, myname, host, 0, sharename, devtype,
                                             username, domain, password);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
 
-       (*ret_cli) = smbcli_state_init();
+       (*ret_cli) = smbcli_state_init(parent_ctx);
 
-       (*ret_cli)->tree = talloc_reference(*ret_cli, tree);
-       talloc_free(tree);
+       (*ret_cli)->tree = tree;
        (*ret_cli)->session = tree->session;
        (*ret_cli)->transport = tree->session->transport;
-
+       talloc_steal(*ret_cli, tree->session->transport->socket);
+       
 done:
        talloc_free(mem_ctx);
+
        return status;
 }
 
@@ -207,11 +210,11 @@ NTSTATUS smbcli_tdis(struct smbcli_state *cli)
 /****************************************************************************
  Initialise a client state structure.
 ****************************************************************************/
-struct smbcli_state *smbcli_state_init(void)
+struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx)
 {
        struct smbcli_state *cli;
 
-       cli = talloc_p(NULL, struct smbcli_state);
+       cli = talloc_p(mem_ctx, struct smbcli_state);
        if (cli) {
                ZERO_STRUCTP(cli);
        }
index 674666a60a71709c8b3d0b1b51602b0b5f1a6649..c007d061a95bd6be7d2c3635ea49fe4ab0477658 100644 (file)
@@ -244,7 +244,7 @@ int smbcli_dfs_open_connection(struct smbcli_client* cluster,
                return -1;
 
        c = cluster->cli[i];
-       if (NT_STATUS_IS_ERR(smbcli_full_connection(&c,
+       if (NT_STATUS_IS_ERR(smbcli_full_connection(NULL, &c,
                             NULL, host, NULL, 0,
                             share, "?????",
                             cluster->username, cluster->workgroup, 
index 37188f4e7722e9c8b5732c5c94e95d0f7b6045d9..14862a39f068c29138cd63cb7f4e758210ec48be 100644 (file)
@@ -37,11 +37,11 @@ static int sock_destructor(void *ptr)
 /*
   create a smbcli_socket context
 */
-struct smbcli_socket *smbcli_sock_init(void)
+struct smbcli_socket *smbcli_sock_init(TALLOC_CTX *mem_ctx)
 {
        struct smbcli_socket *sock;
 
-       sock = talloc_p(NULL, struct smbcli_socket);
+       sock = talloc_p(mem_ctx, struct smbcli_socket);
        if (!sock) {
                return NULL;
        }
index f19cbf8e2840c2e2d2667153aa664390daf25171..77fe0ebe2f7e597330cb0dc9443a5269bf66b05c 100644 (file)
@@ -151,7 +151,8 @@ NTSTATUS smb_tree_disconnect(struct smbcli_tree *tree)
   a convenient function to establish a smbcli_tree from scratch, using reasonable default
   parameters
 */
-NTSTATUS smbcli_tree_full_connection(struct smbcli_tree **ret_tree, 
+NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
+                                    struct smbcli_tree **ret_tree, 
                                     const char *my_name, 
                                     const char *dest_host, int port,
                                     const char *service, const char *service_type,
@@ -172,7 +173,7 @@ NTSTATUS smbcli_tree_full_connection(struct smbcli_tree **ret_tree,
 
        *ret_tree = NULL;
 
-       sock = smbcli_sock_init();
+       sock = smbcli_sock_init(parent_ctx);
        if (!sock) {
                return NT_STATUS_NO_MEMORY;
        }
index 893093c050b2ed503f211d841f40a2d19af55416..ffe7e55a8580732c0da9b04c944fea634690ce6b 100644 (file)
@@ -334,6 +334,7 @@ static NTSTATUS smb_shutdown_pipe(struct dcerpc_pipe *p)
        c.close.in.fnum = smb->fnum;
        c.close.in.write_time = 0;
        smb_raw_close(smb->tree, &c);
+
        talloc_free(smb);
 
        return NT_STATUS_OK;
@@ -433,7 +434,7 @@ NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe **p,
        }
 
        smb->fnum = io.ntcreatex.out.fnum;
-       smb->tree = talloc_reference(smb, tree);
+       smb->tree = tree;
 
        (*p)->transport.private = smb;
 
index 71fe2c63e1f594893929a119f9b7d4e468e8357d..bcadd521049b6c5636ecafce454d01a69e536557 100644 (file)
@@ -460,12 +460,12 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
        }
            
        if (!username || !username[0]) {
-               status = smbcli_full_connection(&cli, lp_netbios_name(),
+               status = smbcli_full_connection(NULL, &cli, lp_netbios_name(),
                                             binding->host, NULL, 
                                             "ipc$", "?????", 
                                             "", "", NULL, 0, &retry);
        } else {
-               status = smbcli_full_connection(&cli, lp_netbios_name(),
+               status = smbcli_full_connection(NULL, &cli, lp_netbios_name(),
                                             binding->host, NULL, 
                                             "ipc$", "?????", 
                                             username, domain,
@@ -486,7 +486,6 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
        
        /* this ensures that the reference count is decremented so
           a pipe close will really close the link */
-       talloc_free(cli->tree);
        talloc_steal(*p, cli);
 
        (*p)->flags = binding->flags;
index 3931792ee8a52ab785af8310d335d453e805a736..c0160e68529fe91998460c8b996483b288516248 100644 (file)
@@ -122,13 +122,14 @@ static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename,
 
        ntvfs_set_private(req->tcon, depth, private);
 
-       status = smbcli_tree_full_connection(&private->tree, 
-                                         "vfs_cifs",
-                                         host,
-                                         0,
-                                         remote_share, "?????",
-                                         user, domain,
-                                         pass);
+       status = smbcli_tree_full_connection(private,
+                                            &private->tree, 
+                                            "vfs_cifs",
+                                            host,
+                                            0,
+                                            remote_share, "?????",
+                                            user, domain,
+                                            pass);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index 33e1287d215c8df35f15fee4586b052a3f347cae..59da6faea5d7957ab639c0a265107c06657e06f6 100644 (file)
@@ -38,7 +38,6 @@ struct ipc_private {
        /* a list of open pipes */
        struct pipe_state {
                struct pipe_state *next, *prev;
-               TALLOC_CTX *mem_ctx;
                const char *pipe_name;
                uint16_t fnum;
                struct dcesrv_connection *dce_conn;
@@ -85,10 +84,9 @@ again:
 */
 static void pipe_shutdown(struct ipc_private *private, struct pipe_state *p)
 {
-       TALLOC_CTX *mem_ctx = private->pipe_list->mem_ctx;
-       dcesrv_endpoint_disconnect(private->pipe_list->dce_conn);
-       DLIST_REMOVE(private->pipe_list, private->pipe_list);
-       talloc_destroy(mem_ctx);
+       talloc_free(p->dce_conn);
+       DLIST_REMOVE(private->pipe_list, p);
+       talloc_destroy(p);
 }
 
 
@@ -199,33 +197,25 @@ static NTSTATUS ipc_open_generic(struct smbsrv_request *req, const char *fname,
                                 struct pipe_state **ps)
 {
        struct pipe_state *p;
-       TALLOC_CTX *mem_ctx;
        NTSTATUS status;
        struct dcesrv_ep_description ep_description;
        struct auth_session_info *session_info = NULL;
        NTVFS_GET_PRIVATE(ipc_private, private, req);
 
-       mem_ctx = talloc_init("ipc_open '%s'", fname);
-       if (!mem_ctx) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       p = talloc(mem_ctx, sizeof(struct pipe_state));
+       p = talloc_p(private, struct pipe_state);
        if (!p) {
-               talloc_destroy(mem_ctx);
                return NT_STATUS_NO_MEMORY;
        }
-       p->mem_ctx = mem_ctx;
 
-       p->pipe_name = talloc_strdup(mem_ctx, fname);
+       p->pipe_name = talloc_strdup(p, fname);
        if (!p->pipe_name) {
-               talloc_destroy(mem_ctx);
+               talloc_free(p);
                return NT_STATUS_NO_MEMORY;
        }
 
        p->fnum = find_next_fnum(private);
        if (p->fnum == 0) {
-               talloc_destroy(mem_ctx);
+               talloc_free(p);
                return NT_STATUS_TOO_MANY_OPENED_FILES;
        }
 
@@ -261,7 +251,7 @@ static NTSTATUS ipc_open_generic(struct smbsrv_request *req, const char *fname,
                                                session_info,
                                                &p->dce_conn);
        if (!NT_STATUS_IS_OK(status)) {
-               talloc_destroy(mem_ctx);
+               talloc_free(p);
                return status;
        }
 
index 9536fd68946364bde62b33b1bec6e1de607f6682..220c730790d931aadcfbb9f2b57e41aed72090c0 100644 (file)
@@ -268,6 +268,29 @@ NTSTATUS dcesrv_fetch_session_key(struct dcesrv_connection *p,
 }
 
 
+/*
+  destroy a link to an endpoint
+*/
+static int dcesrv_endpoint_destructor(void *ptr)
+{
+       struct dcesrv_connection *p = ptr;
+       if (p->iface) {
+               p->iface->unbind(p, p->iface);
+       }
+
+       /* destroy any handles */
+       while (p->handles) {
+               dcesrv_handle_destroy(p, p->handles);
+       }
+
+       if (p->auth_state.gensec_security) {
+               gensec_end(&p->auth_state.gensec_security);
+       }
+
+       return 0;
+}
+
+
 /*
   connect to a dcerpc endpoint
 */
@@ -294,6 +317,8 @@ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx,
        (*p)->auth_state.session_key = dcesrv_generic_session_key;
        (*p)->srv_conn = NULL;
 
+       talloc_set_destructor(*p, dcesrv_endpoint_destructor);
+
        return NT_STATUS_OK;
 }
 
@@ -332,27 +357,6 @@ NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx,
 }
 
 
-/*
-  disconnect a link to an endpoint
-*/
-void dcesrv_endpoint_disconnect(struct dcesrv_connection *p)
-{
-       if (p->iface) {
-               p->iface->unbind(p, p->iface);
-       }
-
-       /* destroy any handles */
-       while (p->handles) {
-               dcesrv_handle_destroy(p, p->handles);
-       }
-
-       if (p->auth_state.gensec_security) {
-               gensec_end(&p->auth_state.gensec_security);
-       }
-
-       talloc_free(p);
-}
-
 static void dcesrv_init_hdr(struct dcerpc_packet *pkt)
 {
        pkt->rpc_vers = 5;
index 71e5a8d8f9ab907e5a24784a889ca53e68086b60..22cbb79769ce10aed717626be5a3e564c4ca0d6d 100644 (file)
@@ -171,7 +171,7 @@ static BOOL connect_servers(void)
                        printf("Connecting to \\\\%s\\%s as %s - instance %d\n",
                               servers[i].server_name, servers[i].share_name, 
                               servers[i].username, j);
-                       status = smbcli_full_connection(&servers[i].cli[j],
+                       status = smbcli_full_connection(NULL, &servers[i].cli[j],
                                                     "gentest",
                                                     servers[i].server_name, NULL, 
                                                     servers[i].share_name, "?????", 
index 494688dfb5d612ff9a3df8be98180654c8fc1099..6d5558c6fde6d83149892b310599c971f5bc52a8 100644 (file)
@@ -119,7 +119,7 @@ static struct smbcli_state *connect_one(char *share, int snum)
        slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), snum);
 
        do {
-               status = smbcli_full_connection(&c, myname,
+               status = smbcli_full_connection(NULL, &c, myname,
                                             server, NULL,  
                                             share, "?????", 
                                             servers[snum].username, lp_workgroup(), 
index 63f71f2004557732bfd3111d0377c1c95f8f4d18..f474b3efa90b12eec196f9de7e0e40873360ffdb 100644 (file)
@@ -173,9 +173,10 @@ static struct smbcli_state *connect_one(char *share)
 
        slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
 
-       nt_status = smbcli_full_connection(&c, myname, server_n, NULL, 0, share, "?????", 
-                                       username, lp_workgroup(), password, 0,
-                                       NULL);
+       nt_status = smbcli_full_connection(NULL, 
+                                          &c, myname, server_n, NULL, 0, share, "?????", 
+                                          username, lp_workgroup(), password, 0,
+                                          NULL);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
index ee7e25ebbdae314e79ec0a29bc460966568be2a4..74c640d30b5f60631f2118d659caf618986b234d 100644 (file)
@@ -169,7 +169,7 @@ static struct smbcli_state *connect_one(char *share)
        *share = 0;
        share++;
 
-       status = smbcli_full_connection(&c, "masktest",
+       status = smbcli_full_connection(NULL, &c, "masktest",
                                     server, NULL, 
                                     share, "?????", 
                                     username, lp_workgroup(), 
index b5f439b5e9de06e0470af3c024b64927792fb9c4..ad8245faaff9819899c9cab87258eb71b8de089d 100644 (file)
@@ -173,7 +173,6 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        printf("logoff the new vuid\n");
        status = smb_raw_ulogoff(session);
        CHECK_STATUS(status, NT_STATUS_OK);
-       talloc_free(session);
 
        printf("the new vuid should not now be accessible\n");
        status = smb_raw_write(tree, &wr);
@@ -186,9 +185,8 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_close(cli->tree, &cl);
        CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
 
-       /* close down the new tree, which will also close the session
-          as the reference count will be 0 */
        talloc_free(tree);
+       talloc_free(session);
        
 done:
        return ret;
index 5bc5b3bf4902323444371dd1afed63d9ee58e6cc..ac09a346f6e12d193ba3abc095a3ba78bd7209ba 100644 (file)
@@ -2887,30 +2887,40 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        struct samr_Connect4 r4;
        struct samr_Connect5 r5;
        union samr_ConnectInfo info;
-       BOOL ret = True;
+       struct policy_handle h;
+       BOOL ret = True, got_handle = False;
 
        printf("testing samr_Connect\n");
 
        r.in.system_name = 0;
        r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
-       r.out.connect_handle = handle;
+       r.out.connect_handle = &h;
 
        status = dcerpc_samr_Connect(p, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Connect failed - %s\n", nt_errstr(status));
                ret = False;
+       } else {
+               got_handle = True;
+               *handle = h;
        }
 
        printf("testing samr_Connect2\n");
 
        r2.in.system_name = NULL;
        r2.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
-       r2.out.connect_handle = handle;
+       r2.out.connect_handle = &h;
 
        status = dcerpc_samr_Connect2(p, mem_ctx, &r2);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Connect2 failed - %s\n", nt_errstr(status));
                ret = False;
+       } else {
+               if (got_handle) {
+                       test_Close(p, mem_ctx, handle);
+               }
+               got_handle = True;
+               *handle = h;
        }
 
        printf("testing samr_Connect3\n");
@@ -2918,12 +2928,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        r3.in.system_name = NULL;
        r3.in.unknown = 0;
        r3.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
-       r3.out.connect_handle = handle;
+       r3.out.connect_handle = &h;
 
        status = dcerpc_samr_Connect3(p, mem_ctx, &r3);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Connect3 failed - %s\n", nt_errstr(status));
                ret = False;
+       } else {
+               if (got_handle) {
+                       test_Close(p, mem_ctx, handle);
+               }
+               got_handle = True;
+               *handle = h;
        }
 
        printf("testing samr_Connect4\n");
@@ -2931,12 +2947,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        r4.in.system_name = "";
        r4.in.unknown = 0;
        r4.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
-       r4.out.connect_handle = handle;
+       r4.out.connect_handle = &h;
 
        status = dcerpc_samr_Connect4(p, mem_ctx, &r4);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Connect4 failed - %s\n", nt_errstr(status));
                ret = False;
+       } else {
+               if (got_handle) {
+                       test_Close(p, mem_ctx, handle);
+               }
+               got_handle = True;
+               *handle = h;
        }
 
        printf("testing samr_Connect5\n");
@@ -2949,12 +2971,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        r5.in.level = 1;
        r5.in.info = &info;
        r5.out.info = &info;
-       r5.out.connect_handle = handle;
+       r5.out.connect_handle = &h;
 
        status = dcerpc_samr_Connect5(p, mem_ctx, &r5);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Connect5 failed - %s\n", nt_errstr(status));
                ret = False;
+       } else {
+               if (got_handle) {
+                       test_Close(p, mem_ctx, handle);
+               }
+               got_handle = True;
+               *handle = h;
        }
 
        return ret;
index c6af807357b4a8b69891506f5a4e203c3905fef1..15be6e528b38c7e61c6c9363ca0ba0bbc6d2f307 100644 (file)
@@ -43,7 +43,7 @@ static struct smbcli_state *open_nbt_connection(void)
        make_nmb_name(&calling, lp_netbios_name(), 0x0);
        choose_called_name(&called, host, 0x20);
 
-       cli = smbcli_state_init();
+       cli = smbcli_state_init(NULL);
        if (!cli) {
                printf("Failed initialize smbcli_struct to connect with %s\n", host);
                return NULL;
@@ -93,7 +93,8 @@ BOOL torture_open_connection_share(struct smbcli_state **c,
        if (use_kerberos)
                flags |= SMBCLI_FULL_CONNECTION_USE_KERBEROS;
 
-       status = smbcli_full_connection(c, lp_netbios_name(),
+       status = smbcli_full_connection(NULL,
+                                       c, lp_netbios_name(),
                                        hostname, NULL, 
                                        sharename, "?????", 
                                        username, username[0]?userdomain:"",
@@ -857,7 +858,8 @@ static BOOL run_tcon_devtype_test(int dummy)
        const char *userdomain = lp_parm_string(-1, "torture", "userdomain");
        const char *password = lp_parm_string(-1, "torture", "password");
        
-       status = smbcli_full_connection(&cli1, lp_netbios_name(),
+       status = smbcli_full_connection(NULL,
+                                       &cli1, lp_netbios_name(),
                                        host, NULL, 
                                        share, "?????",
                                        username, userdomain,