r1654: rename cli_ -> smbcli_
authorStefan Metzmacher <metze@samba.org>
Wed, 4 Aug 2004 13:23:35 +0000 (13:23 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:57:47 +0000 (12:57 -0500)
rename CLI_ -> SMBCLI_

metze
(This used to be commit 8441750fd9427dd6fe477f27e603821b4026f038)

86 files changed:
source4/auth/auth_domain.c
source4/auth/auth_server.c
source4/client/client.c
source4/client/clitar.c
source4/client/smbmount.c
source4/client/smbspool.c
source4/include/cli_context.h
source4/include/client.h
source4/libads/ldap_printer.c
source4/libcli/cliconnect.c
source4/libcli/clideltree.c
source4/libcli/clidfs.c
source4/libcli/clifile.c
source4/libcli/clilist.c
source4/libcli/climessage.c
source4/libcli/clireadwrite.c
source4/libcli/clisecdesc.c
source4/libcli/clitrans2.c
source4/libcli/namequery_dc.c
source4/libcli/raw/clioplock.c
source4/libcli/raw/clisession.c
source4/libcli/raw/clisocket.c
source4/libcli/raw/clitransport.c
source4/libcli/raw/clitree.c
source4/libcli/raw/rawacl.c
source4/libcli/raw/rawdate.c
source4/libcli/raw/rawfile.c
source4/libcli/raw/rawfileinfo.c
source4/libcli/raw/rawfsinfo.c
source4/libcli/raw/rawioctl.c
source4/libcli/raw/rawnegotiate.c
source4/libcli/raw/rawnotify.c
source4/libcli/raw/rawreadwrite.c
source4/libcli/raw/rawrequest.c
source4/libcli/raw/rawsearch.c
source4/libcli/raw/rawsetfileinfo.c
source4/libcli/raw/rawtrans.c
source4/libcli/raw/smb_signing.c
source4/libcli/util/clierror.c
source4/libcli/util/cliutil.c
source4/libcli/util/smbencrypt.c
source4/librpc/rpc/dcerpc_smb.c
source4/librpc/rpc/dcerpc_util.c
source4/ntvfs/cifs/vfs_cifs.c
source4/torture/basic/aliases.c
source4/torture/basic/charset.c
source4/torture/basic/denytest.c
source4/torture/basic/dfstest.c
source4/torture/basic/mangle_test.c
source4/torture/basic/scanner.c
source4/torture/basic/utable.c
source4/torture/gentest.c
source4/torture/locktest.c
source4/torture/locktest2.c
source4/torture/masktest.c
source4/torture/nbench/nbench.c
source4/torture/nbench/nbio.c
source4/torture/rap/rap.c
source4/torture/raw/chkpath.c
source4/torture/raw/close.c
source4/torture/raw/context.c
source4/torture/raw/ioctl.c
source4/torture/raw/lock.c
source4/torture/raw/mkdir.c
source4/torture/raw/mux.c
source4/torture/raw/notify.c
source4/torture/raw/open.c
source4/torture/raw/oplock.c
source4/torture/raw/qfileinfo.c
source4/torture/raw/qfsinfo.c
source4/torture/raw/read.c
source4/torture/raw/rename.c
source4/torture/raw/search.c
source4/torture/raw/seek.c
source4/torture/raw/setfileinfo.c
source4/torture/raw/unlink.c
source4/torture/raw/write.c
source4/torture/torture.c
source4/torture/torture_util.c
source4/utils/net.c
source4/utils/net_ads.c
source4/utils/net_rap.c
source4/utils/net_rpc.c
source4/utils/net_rpc_join.c
source4/utils/net_rpc_samsync.c
source4/utils/net_time.c

index 6e289895225c718df2004ffe31738c9d8a4e7917..b0dd2612b0bf3b2fb21b9ce4a6709320bae4b2d3 100644 (file)
@@ -118,7 +118,7 @@ static NTSTATUS rpc_resolve_dc(const char *server,
  *
  **/
 
-static NTSTATUS connect_to_domain_password_server(struct cli_state **cli, 
+static NTSTATUS connect_to_domain_password_server(struct smbcli_state **cli, 
                                                  const char *server, 
                                                  const char *setup_creds_as,
                                                  uint16_t sec_chan,
@@ -169,7 +169,7 @@ static NTSTATUS connect_to_domain_password_server(struct cli_state **cli,
                return NT_STATUS_NO_LOGON_SERVERS;
        
        /* Attempt connection */
-       result = cli_full_connection(cli, lp_netbios_name(), remote_machine,
+       result = smbcli_full_connection(cli, lp_netbios_name(), remote_machine,
                                     &dest_ip, 0, "IPC$", "IPC", "", "", "",0, retry);
 
        if (!NT_STATUS_IS_OK(result)) {
@@ -190,12 +190,12 @@ static NTSTATUS connect_to_domain_password_server(struct cli_state **cli,
         * into account also. This patch from "Bjart Kvarme" <bjart.kvarme@usit.uio.no>.
         */
 
-       if(cli_nt_session_open(*cli, PI_NETLOGON) == False) {
+       if(smbcli_nt_session_open(*cli, PI_NETLOGON) == False) {
                DEBUG(0,("connect_to_domain_password_server: unable to open the domain client session to \
-machine %s. Error was : %s.\n", remote_machine, cli_errstr(*cli)));
-               cli_nt_session_close(*cli);
-               cli_ulogoff(*cli);
-               cli_shutdown(*cli);
+machine %s. Error was : %s.\n", remote_machine, smbcli_errstr(*cli)));
+               smbcli_nt_session_close(*cli);
+               smbcli_ulogoff(*cli);
+               smbcli_shutdown(*cli);
                release_server_mutex();
                return NT_STATUS_NO_LOGON_SERVERS;
        }
@@ -207,14 +207,14 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(*cli)));
                return NT_STATUS_NO_MEMORY;
        }
 
-       result = cli_nt_setup_creds(*cli, sec_chan, trust_passwd, &neg_flags, 2);
+       result = smbcli_nt_setup_creds(*cli, sec_chan, trust_passwd, &neg_flags, 2);
 
         if (!NT_STATUS_IS_OK(result)) {
                DEBUG(0,("connect_to_domain_password_server: unable to setup the NETLOGON credentials to machine \
 %s. Error was : %s.\n", remote_machine, nt_errstr(result)));
-               cli_nt_session_close(*cli);
-               cli_ulogoff(*cli);
-               cli_shutdown(*cli);
+               smbcli_nt_session_close(*cli);
+               smbcli_ulogoff(*cli);
+               smbcli_shutdown(*cli);
                release_server_mutex();
                return result;
        }
@@ -228,7 +228,7 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(*cli)));
  Utility function to attempt a connection to an IP address of a DC.
 ************************************************************************/
 
-static NTSTATUS attempt_connect_to_dc(struct cli_state **cli, 
+static NTSTATUS attempt_connect_to_dc(struct smbcli_state **cli, 
                                      const char *domain, 
                                      struct in_addr *ip, 
                                      const char *setup_creds_as, 
@@ -260,7 +260,7 @@ static NTSTATUS attempt_connect_to_dc(struct cli_state **cli,
  We have been asked to dynamically determine the IP addresses of
  the PDC and BDC's for DOMAIN, and query them in turn.
 ************************************************************************/
-static NTSTATUS find_connect_dc(struct cli_state **cli, 
+static NTSTATUS find_connect_dc(struct smbcli_state **cli, 
                                 const char *domain,
                                 const char *setup_creds_as,
                                 uint16_t sec_chan,
@@ -297,7 +297,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
 {
        fstring remote_machine;
        NET_USER_INFO_3 info3;
-       struct cli_state *cli = NULL;
+       struct smbcli_state *cli = NULL;
        NTSTATUS nt_status = NT_STATUS_NO_LOGON_SERVERS;
 
        /*
@@ -333,7 +333,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
          * in the info3 structure.  
          */
 
-       nt_status = cli_netlogon_sam_network_logon(cli, mem_ctx,
+       nt_status = smbcli_netlogon_sam_network_logon(cli, mem_ctx,
                                                   user_info->smb_name.str, user_info->domain.str, 
                                                   user_info->wksta_name.str, chal, 
                                                   user_info->lm_resp, user_info->nt_resp, 
@@ -366,9 +366,9 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
         */
 
        if (NT_STATUS_IS_OK(status)) {
-               if(cli_nt_logoff(&cli, &ctr) == False) {
+               if(smbcli_nt_logoff(&cli, &ctr) == False) {
                        DEBUG(0,("domain_client_validate: unable to log off user %s in domain \
-%s to Domain controller %s. Error was %s.\n", user, domain, remote_machine, cli_errstr(&cli)));        
+%s to Domain controller %s. Error was %s.\n", user, domain, remote_machine, smbcli_errstr(&cli)));        
                        nt_status = NT_STATUS_LOGON_FAILURE;
                }
        }
@@ -378,9 +378,9 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
           to allocate the other_sids and gids structures has been deleted - so
           these pointers are no longer valid..... */
 
-       cli_nt_session_close(cli);
-       cli_ulogoff(cli);
-       cli_shutdown(cli);
+       smbcli_nt_session_close(cli);
+       smbcli_ulogoff(cli);
+       smbcli_shutdown(cli);
        release_server_mutex();
        return nt_status;
 }
index f98825e04be17252deb185cf752c4b22f624c7b0..d66415b525db0c8c19e388e3a73de94e2f34c183 100644 (file)
  Support for server level security.
 ****************************************************************************/
 
-static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
+static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 {
-       struct cli_state *cli = NULL;
+       struct smbcli_state *cli = NULL;
        fstring desthost;
        struct in_addr dest_ip;
        const char *p;
        char *pserver;
        BOOL connected_ok = False;
 
-       if (!(cli = cli_initialise(cli)))
+       if (!(cli = smbcli_initialise(cli)))
                return NULL;
 
        /* security = server just can't function with spnego */
@@ -68,7 +68,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
                        return NULL;
                }
 
-               if (cli_connect(cli, desthost, &dest_ip)) {
+               if (smbcli_connect(cli, desthost, &dest_ip)) {
                        DEBUG(3,("connected to password server %s\n",desthost));
                        connected_ok = True;
                        break;
@@ -78,7 +78,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
        if (!connected_ok) {
                release_server_mutex();
                DEBUG(0,("password server not available\n"));
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return NULL;
        }
        
@@ -86,7 +86,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
                                             desthost, &dest_ip)) {
                release_server_mutex();
                DEBUG(1,("password server fails session request\n"));
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return NULL;
        }
        
@@ -96,10 +96,10 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
        
        DEBUG(3,("got session\n"));
 
-       if (!cli_negprot(cli)) {
+       if (!smbcli_negprot(cli)) {
                DEBUG(1,("%s rejected the negprot\n",desthost));
                release_server_mutex();
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return NULL;
        }
 
@@ -107,7 +107,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
            !(cli->sec_mode & NEGOTIATE_SECURITY_USER_LEVEL)) {
                DEBUG(1,("%s isn't in user level security mode\n",desthost));
                release_server_mutex();
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return NULL;
        }
 
@@ -116,12 +116,12 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
           this one... 
        */
 
-       if (!cli_session_setup(cli, "", "", 0, "", 0,
+       if (!smbcli_session_setup(cli, "", "", 0, "", 0,
                               "")) {
                DEBUG(0,("%s rejected the initial session setup (%s)\n",
-                        desthost, cli_errstr(cli)));
+                        desthost, smbcli_errstr(cli)));
                release_server_mutex();
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return NULL;
        }
        
@@ -138,9 +138,9 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 
 static void free_server_private_data(void **private_data_pointer) 
 {
-       struct cli_state **cli = (struct cli_state **)private_data_pointer;
+       struct smbcli_state **cli = (struct smbcli_state **)private_data_pointer;
        if (*cli && (*cli)->initialised) {
-               cli_shutdown(*cli);
+               smbcli_shutdown(*cli);
        }
 }
 
@@ -150,14 +150,14 @@ static void free_server_private_data(void **private_data_pointer)
 
 static void send_server_keepalive(void **private_data_pointer) 
 {
-       struct cli_state **cli = (struct cli_state **)private_data_pointer;
+       struct smbcli_state **cli = (struct smbcli_state **)private_data_pointer;
        
        /* also send a keepalive to the password server if its still
           connected */
        if (cli && *cli && (*cli)->initialised) {
                if (!send_nbt_keepalive((*cli)->fd)) {
                        DEBUG( 2, ( "password server keepalive failed.\n"));
-                       cli_shutdown(*cli);
+                       smbcli_shutdown(*cli);
                }
        }
 }
@@ -170,7 +170,7 @@ static DATA_BLOB auth_get_challenge_server(const struct auth_context *auth_conte
                                           void **my_private_data, 
                                           TALLOC_CTX *mem_ctx)
 {
-       struct cli_state *cli = server_cryptkey(mem_ctx);
+       struct smbcli_state *cli = server_cryptkey(mem_ctx);
        
        if (cli) {
                DEBUG(3,("using password server validation\n"));
@@ -188,7 +188,7 @@ static DATA_BLOB auth_get_challenge_server(const struct auth_context *auth_conte
                } else if (cli->secblob.length < 8) {
                        /* We can't do much if we don't get a full challenge */
                        DEBUG(2,("make_auth_info_server: Didn't receive a full challenge from server\n"));
-                       cli_shutdown(cli);
+                       smbcli_shutdown(cli);
                        return data_blob(NULL, 0);
                }
 
@@ -214,7 +214,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
                                         const auth_usersupplied_info *user_info, 
                                         auth_serversupplied_info **server_info)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        static uint8_t badpass[24];
        static fstring baduser; 
        static BOOL tested_password_server = False;
@@ -288,7 +288,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
         */
 
        if ((!tested_password_server) && (lp_paranoid_server_security())) {
-               if (cli_session_setup(cli, baduser, (char *)badpass, sizeof(badpass), 
+               if (smbcli_session_setup(cli, baduser, (char *)badpass, sizeof(badpass), 
                                        (char *)badpass, sizeof(badpass), user_info->domain.str)) {
 
                        /*
@@ -302,7 +302,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
 with a bad password.\n", cli->desthost));
                                DEBUG(0,("server_validate: This is broken (and insecure) behaviour. Please do not \
 use this machine as the password server.\n"));
-                               cli_ulogoff(cli);
+                               smbcli_ulogoff(cli);
 
                                /*
                                 * Password server has the bug.
@@ -310,7 +310,7 @@ use this machine as the password server.\n"));
                                bad_password_server = True;
                                return NT_STATUS_LOGON_FAILURE;
                        }
-                       cli_ulogoff(cli);
+                       smbcli_ulogoff(cli);
                }
        } else {
 
@@ -335,27 +335,27 @@ use this machine as the password server.\n"));
 
        if (!user_info->encrypted) {
                /* Plaintext available */
-               if (!cli_session_setup(cli, user_info->smb_name.str, 
+               if (!smbcli_session_setup(cli, user_info->smb_name.str, 
                                       (char *)user_info->plaintext_password.data, 
                                       user_info->plaintext_password.length, 
                                       NULL, 0,
                                       user_info->domain.str)) {
                        DEBUG(1,("password server %s rejected the password\n", cli->desthost));
-                       /* Make this cli_nt_error() when the conversion is in */
-                       nt_status = cli_nt_error(cli);
+                       /* Make this smbcli_nt_error() when the conversion is in */
+                       nt_status = smbcli_nt_error(cli);
                } else {
                        nt_status = NT_STATUS_OK;
                }
        } else {
-               if (!cli_session_setup(cli, user_info->smb_name.str, 
+               if (!smbcli_session_setup(cli, user_info->smb_name.str, 
                                       (char *)user_info->lm_resp.data, 
                                       user_info->lm_resp.length, 
                                       (char *)user_info->nt_resp.data, 
                                       user_info->nt_resp.length, 
                                       user_info->domain.str)) {
                        DEBUG(1,("password server %s rejected the password\n", cli->desthost));
-                       /* Make this cli_nt_error() when the conversion is in */
-                       nt_status = cli_nt_error(cli);
+                       /* Make this smbcli_nt_error() when the conversion is in */
+                       nt_status = smbcli_nt_error(cli);
                } else {
                        nt_status = NT_STATUS_OK;
                }
@@ -367,7 +367,7 @@ use this machine as the password server.\n"));
                nt_status = NT_STATUS_LOGON_FAILURE;
        }
 
-       cli_ulogoff(cli);
+       smbcli_ulogoff(cli);
 
        if NT_STATUS_IS_OK(nt_status) {
                struct passwd *pass = Get_Pwnam(user_info->internal_username.str);
@@ -379,7 +379,7 @@ use this machine as the password server.\n"));
        }
 
        if (locally_made_cli) {
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
        }
 
        return(nt_status);
index abc4033f2905a7f36c8c67d38c9f7ba47512f1a7..1aae6faa24b05a921621326ac4f705a3e3a1b564 100644 (file)
@@ -26,7 +26,7 @@
 #define REGISTER 0
 #endif
 
-struct cli_state *cli;
+struct smbcli_state *cli;
 extern BOOL in_client;
 static int port = 0;
 pstring cur_dir = "\\";
@@ -94,7 +94,7 @@ static double dir_total;
 #define USENMB
 
 /* some forward declarations */
-static struct cli_state *do_connect(const char *server, const char *share);
+static struct smbcli_state *do_connect(const char *server, const char *share);
 
 
 /*******************************************************************
@@ -191,8 +191,8 @@ static void send_message(void)
        int total_len = 0;
        int grp_id;
 
-       if (!cli_message_start(cli->tree, desthost, username, &grp_id)) {
-               d_printf("message start: %s\n", cli_errstr(cli->tree));
+       if (!smbcli_message_start(cli->tree, desthost, username, &grp_id)) {
+               d_printf("message start: %s\n", smbcli_errstr(cli->tree));
                return;
        }
 
@@ -213,8 +213,8 @@ static void send_message(void)
                        msg[l] = c;   
                }
 
-               if (!cli_message_text(cli->tree, msg, l, grp_id)) {
-                       d_printf("SMBsendtxt failed (%s)\n",cli_errstr(cli->tree));
+               if (!smbcli_message_text(cli->tree, msg, l, grp_id)) {
+                       d_printf("SMBsendtxt failed (%s)\n",smbcli_errstr(cli->tree));
                        return;
                }      
                
@@ -226,8 +226,8 @@ static void send_message(void)
        else
                d_printf("sent %d bytes\n",total_len);
 
-       if (!cli_message_end(cli->tree, grp_id)) {
-               d_printf("SMBsendend failed (%s)\n",cli_errstr(cli->tree));
+       if (!smbcli_message_end(cli->tree, grp_id)) {
+               d_printf("SMBsendend failed (%s)\n",smbcli_errstr(cli->tree));
                return;
        }      
 }
@@ -241,8 +241,8 @@ static int do_dskattr(void)
 {
        int total, bsize, avail;
 
-       if (NT_STATUS_IS_ERR(cli_dskattr(cli->tree, &bsize, &total, &avail))) {
-               d_printf("Error in dskattr: %s\n",cli_errstr(cli->tree)); 
+       if (NT_STATUS_IS_ERR(smbcli_dskattr(cli->tree, &bsize, &total, &avail))) {
+               d_printf("Error in dskattr: %s\n",smbcli_errstr(cli->tree)); 
                return 1;
        }
 
@@ -290,8 +290,8 @@ static int do_cd(char *newdir)
        dos_clean_name(cur_dir);
        
        if (!strequal(cur_dir,"\\")) {
-               if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, dname))) {
-                       d_printf("cd %s: %s\n", dname, cli_errstr(cli->tree));
+               if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, dname))) {
+                       d_printf("cd %s: %s\n", dname, smbcli_errstr(cli->tree));
                        pstrcpy(cur_dir,saved_dir);
                }
        }
@@ -564,7 +564,7 @@ static void do_list_helper(file_info *f, const char *mask, void *state)
 
 
 /****************************************************************************
-a wrapper around cli_list that adds recursion
+a wrapper around smbcli_list that adds recursion
   ****************************************************************************/
 void do_list(const char *mask,uint16_t attribute,void (*fn)(file_info *),BOOL rec, BOOL dirs)
 {
@@ -591,14 +591,14 @@ void do_list(const char *mask,uint16_t attribute,void (*fn)(file_info *),BOOL re
                {
                        /*
                         * Need to copy head so that it doesn't become
-                        * invalid inside the call to cli_list.  This
+                        * invalid inside the call to smbcli_list.  This
                         * would happen if the list were expanded
                         * during the call.
                         * Fix from E. Jay Berkenbilt (ejb@ql.org)
                         */
                        pstring head;
                        pstrcpy(head, do_list_queue_head());
-                       cli_list(cli->tree, head, attribute, do_list_helper, NULL);
+                       smbcli_list(cli->tree, head, attribute, do_list_helper, NULL);
                        remove_do_list_queue_head();
                        if ((! do_list_queue_empty()) && (fn == display_finfo))
                        {
@@ -622,9 +622,9 @@ void do_list(const char *mask,uint16_t attribute,void (*fn)(file_info *),BOOL re
        }
        else
        {
-               if (cli_list(cli->tree, mask, attribute, do_list_helper, NULL) == -1)
+               if (smbcli_list(cli->tree, mask, attribute, do_list_helper, NULL) == -1)
                {
-                       d_printf("%s listing %s\n", cli_errstr(cli->tree), mask);
+                       d_printf("%s listing %s\n", smbcli_errstr(cli->tree), mask);
                }
        }
 
@@ -727,10 +727,10 @@ static int do_get(char *rname, const char *lname, BOOL reget)
                strlower(lname);
        }
 
-       fnum = cli_open(cli->tree, rname, O_RDONLY, DENY_NONE);
+       fnum = smbcli_open(cli->tree, rname, O_RDONLY, DENY_NONE);
 
        if (fnum == -1) {
-               d_printf("%s opening remote file %s\n",cli_errstr(cli->tree),rname);
+               d_printf("%s opening remote file %s\n",smbcli_errstr(cli->tree),rname);
                return 1;
        }
 
@@ -757,11 +757,11 @@ static int do_get(char *rname, const char *lname, BOOL reget)
        }
 
 
-       if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, 
+       if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, 
                           &attr, &size, NULL, NULL, NULL, NULL, NULL)) &&
-           NT_STATUS_IS_ERR(cli_getattrE(cli->tree, fnum, 
+           NT_STATUS_IS_ERR(smbcli_getattrE(cli->tree, fnum, 
                          &attr, &size, NULL, NULL, NULL))) {
-               d_printf("getattrib: %s\n",cli_errstr(cli->tree));
+               d_printf("getattrib: %s\n",smbcli_errstr(cli->tree));
                return 1;
        }
 
@@ -770,12 +770,12 @@ static int do_get(char *rname, const char *lname, BOOL reget)
 
        if(!(data = (char *)malloc(read_size))) { 
                d_printf("malloc fail for size %d\n", read_size);
-               cli_close(cli->tree, fnum);
+               smbcli_close(cli->tree, fnum);
                return 1;
        }
 
        while (1) {
-               int n = cli_read(cli->tree, fnum, data, nread + start, read_size);
+               int n = smbcli_read(cli->tree, fnum, data, nread + start, read_size);
 
                if (n <= 0) break;
  
@@ -797,8 +797,8 @@ static int do_get(char *rname, const char *lname, BOOL reget)
 
        SAFE_FREE(data);
        
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
-               d_printf("Error %s closing remote file\n",cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+               d_printf("Error %s closing remote file\n",smbcli_errstr(cli->tree));
                rc = 1;
        }
 
@@ -807,7 +807,7 @@ static int do_get(char *rname, const char *lname, BOOL reget)
        }
 
        if (archive_level >= 2 && (attr & FILE_ATTRIBUTE_ARCHIVE)) {
-               cli_setatr(cli->tree, rname, attr & ~(uint16_t)FILE_ATTRIBUTE_ARCHIVE, 0);
+               smbcli_setatr(cli->tree, rname, attr & ~(uint16_t)FILE_ATTRIBUTE_ARCHIVE, 0);
        }
 
        {
@@ -1013,9 +1013,9 @@ static NTSTATUS do_mkdir(char *name)
 {
        NTSTATUS status;
 
-       if (NT_STATUS_IS_ERR(status = cli_mkdir(cli->tree, name))) {
+       if (NT_STATUS_IS_ERR(status = smbcli_mkdir(cli->tree, name))) {
                d_printf("%s making remote directory %s\n",
-                        cli_errstr(cli->tree),name);
+                        smbcli_errstr(cli->tree),name);
                return status;
        }
 
@@ -1028,9 +1028,9 @@ show 8.3 name of a file
 static BOOL do_altname(char *name)
 {
        const char *altname;
-       if (!NT_STATUS_IS_OK(cli_qpathinfo_alt_name(cli->tree, name, &altname))) {
+       if (!NT_STATUS_IS_OK(smbcli_qpathinfo_alt_name(cli->tree, name, &altname))) {
                d_printf("%s getting alt name for %s\n",
-                        cli_errstr(cli->tree),name);
+                        smbcli_errstr(cli->tree),name);
                return(False);
        }
        d_printf("%s\n", altname);
@@ -1044,7 +1044,7 @@ static BOOL do_altname(char *name)
 ****************************************************************************/
 static int cmd_quit(void)
 {
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
        exit(0);
        /* NOTREACHED */
        return 0;
@@ -1079,7 +1079,7 @@ static int cmd_mkdir(void)
                p = strtok(ddir,"/\\");
                while (p) {
                        pstrcat(ddir2,p);
-                       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, ddir2))) { 
+                       if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, ddir2))) { 
                                do_mkdir(ddir2);
                        }
                        pstrcat(ddir2,"\\");
@@ -1133,21 +1133,21 @@ static int do_put(char *rname, char *lname, BOOL reput)
        GetTimeOfDay(&tp_start);
 
        if (reput) {
-               fnum = cli_open(cli->tree, rname, O_RDWR|O_CREAT, DENY_NONE);
+               fnum = smbcli_open(cli->tree, rname, O_RDWR|O_CREAT, DENY_NONE);
                if (fnum >= 0) {
-                       if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, NULL, &start, NULL, NULL, NULL, NULL, NULL)) &&
-                           NT_STATUS_IS_ERR(cli_getattrE(cli->tree, fnum, NULL, &start, NULL, NULL, NULL))) {
-                               d_printf("getattrib: %s\n",cli_errstr(cli->tree));
+                       if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, NULL, &start, NULL, NULL, NULL, NULL, NULL)) &&
+                           NT_STATUS_IS_ERR(smbcli_getattrE(cli->tree, fnum, NULL, &start, NULL, NULL, NULL))) {
+                               d_printf("getattrib: %s\n",smbcli_errstr(cli->tree));
                                return 1;
                        }
                }
        } else {
-               fnum = cli_open(cli->tree, rname, O_RDWR|O_CREAT|O_TRUNC, 
+               fnum = smbcli_open(cli->tree, rname, O_RDWR|O_CREAT|O_TRUNC, 
                                DENY_NONE);
        }
   
        if (fnum == -1) {
-               d_printf("%s opening remote file %s\n",cli_errstr(cli->tree),rname);
+               d_printf("%s opening remote file %s\n",smbcli_errstr(cli->tree),rname);
                return 1;
        }
 
@@ -1196,10 +1196,10 @@ static int do_put(char *rname, char *lname, BOOL reput)
                        break;
                }
 
-               ret = cli_write(cli->tree, fnum, 0, buf, nread + start, n);
+               ret = smbcli_write(cli->tree, fnum, 0, buf, nread + start, n);
 
                if (n != ret) {
-                       d_printf("Error writing file: %s\n", cli_errstr(cli->tree));
+                       d_printf("Error writing file: %s\n", smbcli_errstr(cli->tree));
                        rc = 1;
                        break;
                } 
@@ -1207,8 +1207,8 @@ static int do_put(char *rname, char *lname, BOOL reput)
                nread += n;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
-               d_printf("%s closing remote file %s\n",cli_errstr(cli->tree),rname);
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+               d_printf("%s closing remote file %s\n",smbcli_errstr(cli->tree),rname);
                x_fclose(f);
                SAFE_FREE(buf);
                return 1;
@@ -1238,7 +1238,7 @@ static int do_put(char *rname, char *lname, BOOL reput)
        }
 
        if (f == x_stdin) {
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                exit(0);
        }
        
@@ -1453,7 +1453,7 @@ static int cmd_mput(void)
                                        SAFE_FREE(rname);
                                        if(asprintf(&rname, "%s%s", cur_dir, lname) < 0) break;
                                        dos_format(rname);
-                                       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, rname)) && 
+                                       if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, rname)) && 
                                            NT_STATUS_IS_ERR(do_mkdir(rname))) {
                                                DEBUG (0, ("Unable to make dir, skipping..."));
                                                /* Skip the directory */
@@ -1570,8 +1570,8 @@ static void do_del(file_info *finfo)
        if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) 
                return;
 
-       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, mask))) {
-               d_printf("%s deleting remote file %s\n",cli_errstr(cli->tree),mask);
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, mask))) {
+               d_printf("%s deleting remote file %s\n",smbcli_errstr(cli->tree),mask);
        }
 }
 
@@ -1618,10 +1618,10 @@ static int cmd_deltree(void)
        }
        pstrcat(dname,buf);
 
-       ret = cli_deltree(cli->tree, dname);
+       ret = smbcli_deltree(cli->tree, dname);
 
        if (ret == -1) {
-               printf("Failed to delete tree %s - %s\n", dname, cli_errstr(cli->tree));
+               printf("Failed to delete tree %s - %s\n", dname, smbcli_errstr(cli->tree));
                return -1;
        }
 
@@ -1760,9 +1760,9 @@ static int cmd_acl(void)
        }
        pstrcat(fname,buf);
 
-       fnum = cli_open(cli->tree, fname, O_RDONLY, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDONLY, DENY_NONE);
        if (fnum == -1) {
-               d_printf("%s - %s\n", fname, cli_errstr(cli->tree));
+               d_printf("%s - %s\n", fname, smbcli_errstr(cli->tree));
                return -1;
        }
 
@@ -1800,7 +1800,7 @@ static int cmd_open(void)
        }
        pstrcat(mask,buf);
 
-       cli_open(cli->tree, mask, O_RDWR, DENY_ALL);
+       smbcli_open(cli->tree, mask, O_RDWR, DENY_ALL);
 
        return 0;
 }
@@ -1822,9 +1822,9 @@ static int cmd_rmdir(void)
        }
        pstrcat(mask,buf);
 
-       if (NT_STATUS_IS_ERR(cli_rmdir(cli->tree, mask))) {
+       if (NT_STATUS_IS_ERR(smbcli_rmdir(cli->tree, mask))) {
                d_printf("%s removing remote directory file %s\n",
-                        cli_errstr(cli->tree),mask);
+                        smbcli_errstr(cli->tree),mask);
        }
        
        return 0;
@@ -1855,8 +1855,8 @@ static int cmd_link(void)
        pstrcat(src,buf);
        pstrcat(dest,buf2);
 
-       if (NT_STATUS_IS_ERR(cli_unix_hardlink(cli->tree, src, dest))) {
-               d_printf("%s linking files (%s -> %s)\n", cli_errstr(cli->tree), src, dest);
+       if (NT_STATUS_IS_ERR(smbcli_unix_hardlink(cli->tree, src, dest))) {
+               d_printf("%s linking files (%s -> %s)\n", smbcli_errstr(cli->tree), src, dest);
                return 1;
        }  
 
@@ -1889,9 +1889,9 @@ static int cmd_symlink(void)
        pstrcat(src,buf);
        pstrcat(dest,buf2);
 
-       if (NT_STATUS_IS_ERR(cli_unix_symlink(cli->tree, src, dest))) {
+       if (NT_STATUS_IS_ERR(smbcli_unix_symlink(cli->tree, src, dest))) {
                d_printf("%s symlinking files (%s -> %s)\n",
-                       cli_errstr(cli->tree), src, dest);
+                       smbcli_errstr(cli->tree), src, dest);
                return 1;
        } 
 
@@ -1924,9 +1924,9 @@ static int cmd_chmod(void)
        mode = (mode_t)strtol(buf, NULL, 8);
        pstrcat(src,buf2);
 
-       if (NT_STATUS_IS_ERR(cli_unix_chmod(cli->tree, src, mode))) {
+       if (NT_STATUS_IS_ERR(smbcli_unix_chmod(cli->tree, src, mode))) {
                d_printf("%s chmod file %s 0%o\n",
-                       cli_errstr(cli->tree), src, (uint_t)mode);
+                       smbcli_errstr(cli->tree), src, (uint_t)mode);
                return 1;
        } 
 
@@ -1962,9 +1962,9 @@ static int cmd_chown(void)
        gid = (gid_t)atoi(buf2);
        pstrcat(src,buf3);
 
-       if (NT_STATUS_IS_ERR(cli_unix_chown(cli->tree, src, uid, gid))) {
+       if (NT_STATUS_IS_ERR(smbcli_unix_chown(cli->tree, src, uid, gid))) {
                d_printf("%s chown file %s uid=%d, gid=%d\n",
-                       cli_errstr(cli->tree), src, (int)uid, (int)gid);
+                       smbcli_errstr(cli->tree), src, (int)uid, (int)gid);
                return 1;
        } 
 
@@ -1991,8 +1991,8 @@ static int cmd_rename(void)
        pstrcat(src,buf);
        pstrcat(dest,buf2);
 
-       if (NT_STATUS_IS_ERR(cli_rename(cli->tree, src, dest))) {
-               d_printf("%s renaming files\n",cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_rename(cli->tree, src, dest))) {
+               d_printf("%s renaming files\n",smbcli_errstr(cli->tree));
                return 1;
        }
        
@@ -2563,7 +2563,7 @@ static char **remote_completion(const char *text, int len)
        } else
                snprintf(dirmask, sizeof(dirmask), "%s*", cur_dir);
 
-       if (cli_list(cli->tree, dirmask, 
+       if (smbcli_list(cli->tree, dirmask, 
                     FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN, 
                     completion_remote_filter, &info) < 0)
                goto cleanup;
@@ -2686,10 +2686,10 @@ static void readline_callback(void)
 
        last_t = t;
 
-       cli_transport_process(cli->transport);
+       smbcli_transport_process(cli->transport);
 
        if (cli->tree) {
-               cli_chkpath(cli->tree, "\\");
+               smbcli_chkpath(cli->tree, "\\");
        }
 }
 
@@ -2740,9 +2740,9 @@ static void process_stdin(void)
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct cli_state *do_connect(const char *server, const char *share)
+static struct smbcli_state *do_connect(const char *server, const char *share)
 {
-       struct cli_state *c;
+       struct smbcli_state *c;
        struct nmb_name called, calling;
        const char *server_n;
        struct in_addr ip;
@@ -2775,16 +2775,16 @@ static struct cli_state *do_connect(const char *server, const char *share)
        if (have_ip) ip = dest_ip;
 
        /* have to open a new connection */
-       if (!(c=cli_state_init()) || !cli_socket_connect(c, server_n, &ip)) {
+       if (!(c=smbcli_state_init()) || !smbcli_socket_connect(c, server_n, &ip)) {
                d_printf("Connection to %s failed\n", server_n);
                return NULL;
        }
 
-       if (!cli_transport_establish(c, &calling, &called)) {
+       if (!smbcli_transport_establish(c, &calling, &called)) {
                char *p;
                d_printf("session request to %s failed (%s)\n", 
-                        called.name, cli_errstr(c->tree));
-               cli_shutdown(c);
+                        called.name, smbcli_errstr(c->tree));
+               smbcli_shutdown(c);
                if ((p=strchr_m(called.name, '.'))) {
                        *p = 0;
                        goto again;
@@ -2798,9 +2798,9 @@ static struct cli_state *do_connect(const char *server, const char *share)
 
        DEBUG(4,(" session request ok\n"));
 
-       if (NT_STATUS_IS_ERR(cli_negprot(c))) {
+       if (NT_STATUS_IS_ERR(smbcli_negprot(c))) {
                d_printf("protocol negotiation failed\n");
-               cli_shutdown(c);
+               smbcli_shutdown(c);
                return NULL;
        }
 
@@ -2811,16 +2811,16 @@ static struct cli_state *do_connect(const char *server, const char *share)
                }
        }
 
-       status = cli_session_setup(c, username, password, lp_workgroup());
+       status = smbcli_session_setup(c, username, password, lp_workgroup());
        if (NT_STATUS_IS_ERR(status)) {
                d_printf("authenticated session setup failed: %s\n", nt_errstr(status));
                /* if a password was not supplied then try again with a null username */
                if (password[0] || !username[0] || use_kerberos) {
-                       status = cli_session_setup(c, "", "", lp_workgroup());
+                       status = smbcli_session_setup(c, "", "", lp_workgroup());
                }
                if (NT_STATUS_IS_ERR(status)) {
                        d_printf("session setup failed: %s\n", nt_errstr(status));
-                       cli_shutdown(c);
+                       smbcli_shutdown(c);
                        return NULL;
                }
                d_printf("Anonymous login successful\n");
@@ -2828,9 +2828,9 @@ static struct cli_state *do_connect(const char *server, const char *share)
 
        DEBUG(4,(" session setup ok\n"));
 
-       if (NT_STATUS_IS_ERR(cli_send_tconX(c, sharename, "?????", password))) {
-               d_printf("tree connect failed: %s\n", cli_errstr(c->tree));
-               cli_shutdown(c);
+       if (NT_STATUS_IS_ERR(smbcli_send_tconX(c, sharename, "?????", password))) {
+               d_printf("tree connect failed: %s\n", smbcli_errstr(c->tree));
+               smbcli_shutdown(c);
                return NULL;
        }
 
@@ -2860,7 +2860,7 @@ static int process(char *base_directory)
                process_stdin();
        }
   
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
        return rc;
 }
 
@@ -2895,7 +2895,7 @@ static int do_tar_op(char *base_directory)
        
        ret=process_tar();
 
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
 
        return(ret);
 }
@@ -2920,19 +2920,19 @@ static int do_message_op(void)
        zero_ip(&ip);
        if (have_ip) ip = dest_ip;
 
-       if (!(cli=cli_state_init()) || !cli_socket_connect(cli, server_name, &ip)) {
+       if (!(cli=smbcli_state_init()) || !smbcli_socket_connect(cli, server_name, &ip)) {
                d_printf("Connection to %s failed\n", desthost);
                return 1;
        }
 
-       if (!cli_transport_establish(cli, &calling, &called)) {
+       if (!smbcli_transport_establish(cli, &calling, &called)) {
                d_printf("session request failed\n");
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return 1;
        }
 
        send_message();
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
 
        return 0;
 }
index 69c25ba2626e43839084baebd142d293ab744376..1fa752d97774f1567daa3fe0a769f538b9e9819f 100644 (file)
@@ -67,7 +67,7 @@ typedef struct
 } stack;
 
 #define SEPARATORS " \t\n\r"
-extern struct cli_state *cli;
+extern struct smbcli_state *cli;
 
 /* These defines are for the do_setrattr routine, to indicate
  * setting and reseting of file attributes in the function call */
@@ -538,8 +538,8 @@ static BOOL ensurepath(char *fname)
     {
       safe_strcat(partpath, p, strlen(fname) + 1);
 
-      if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, partpath))) {
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, partpath)))
+      if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, partpath))) {
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, partpath)))
          {
            DEBUG(0, ("Error mkdirhiering\n"));
            return False;
@@ -577,7 +577,7 @@ static void do_setrattr(char *name, uint16_t attr, int set)
 {
        uint16_t oldattr;
 
-       if (NT_STATUS_IS_ERR(cli_getatr(cli->tree, name, &oldattr, NULL, NULL)))
+       if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, name, &oldattr, NULL, NULL)))
                return;
 
        if (set == ATTRSET) {
@@ -586,8 +586,8 @@ static void do_setrattr(char *name, uint16_t attr, int set)
                attr = oldattr & ~attr;
        }
 
-       if (NT_STATUS_IS_ERR(cli_setatr(cli->tree, name, attr, 0))) {
-               DEBUG(1,("setatr failed: %s\n", cli_errstr(cli->tree)));
+       if (NT_STATUS_IS_ERR(smbcli_setatr(cli->tree, name, attr, 0))) {
+               DEBUG(1,("setatr failed: %s\n", smbcli_errstr(cli->tree)));
        }
 }
 
@@ -637,13 +637,13 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
       return;
     }
 
-  fnum = cli_open(cli->tree, rname, O_RDONLY, DENY_NONE);
+  fnum = smbcli_open(cli->tree, rname, O_RDONLY, DENY_NONE);
 
   dos_clean_name(rname);
 
   if (fnum == -1) {
          DEBUG(0,("%s opening remote file %s (%s)\n",
-                  cli_errstr(cli->tree),rname, cur_dir));
+                  smbcli_errstr(cli->tree),rname, cur_dir));
          return;
   }
 
@@ -656,8 +656,8 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
   safe_strcpy(finfo.name,rname, strlen(rname));
   if (!finfo1) {
          size_t size;
-         if (NT_STATUS_IS_ERR(cli_getattrE(cli->tree, fnum, &finfo.mode, &size, NULL, &finfo.atime, &finfo.mtime))) {
-                 DEBUG(0, ("getattrE: %s\n", cli_errstr(cli->tree)));
+         if (NT_STATUS_IS_ERR(smbcli_getattrE(cli->tree, fnum, &finfo.mode, &size, NULL, &finfo.atime, &finfo.mtime))) {
+                 DEBUG(0, ("getattrE: %s\n", smbcli_errstr(cli->tree)));
                  return;
          }
          finfo.size = size;
@@ -695,10 +695,10 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
              
              DEBUG(3,("nread=%.0f\n",(double)nread));
              
-             datalen = cli_read(cli->tree, fnum, data, nread, read_size);
+             datalen = smbcli_read(cli->tree, fnum, data, nread, read_size);
              
              if (datalen == -1) {
-                     DEBUG(0,("Error reading file %s : %s\n", rname, cli_errstr(cli->tree)));
+                     DEBUG(0,("Error reading file %s : %s\n", rname, smbcli_errstr(cli->tree)));
                      break;
              }
              
@@ -743,7 +743,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
       ntarf++;
     }
   
-  cli_close(cli->tree, fnum);
+  smbcli_close(cli->tree, fnum);
 
   if (shallitime)
     {
@@ -959,7 +959,7 @@ static int get_file(file_info2 finfo)
   DEBUG(5, ("get_file: file: %s, size %i\n", finfo.name, (int)finfo.size));
 
   if (ensurepath(finfo.name) && 
-      (fnum=cli_open(cli->tree, finfo.name, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) == -1) {
+      (fnum=smbcli_open(cli->tree, finfo.name, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) == -1) {
       DEBUG(0, ("abandoning restore\n"));
       return(False);
   }
@@ -976,7 +976,7 @@ static int get_file(file_info2 finfo)
     dsize = MIN(dsize, rsize);  /* Should be only what is left */
     DEBUG(5, ("writing %i bytes, bpos = %i ...\n", dsize, bpos));
 
-    if (cli_write(cli->tree, fnum, 0, buffer_p + bpos, pos, dsize) != dsize) {
+    if (smbcli_write(cli->tree, fnum, 0, buffer_p + bpos, pos, dsize) != dsize) {
            DEBUG(0, ("Error writing remote file\n"));
            return 0;
     }
@@ -1029,7 +1029,7 @@ static int get_file(file_info2 finfo)
 
   /* Now close the file ... */
 
-  if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
+  if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
          DEBUG(0, ("Error closing remote file\n"));
          return(False);
   }
@@ -1038,7 +1038,7 @@ static int get_file(file_info2 finfo)
 
   DEBUG(5, ("Updating creation date on %s\n", finfo.name));
 
-  if (NT_STATUS_IS_ERR(cli_setatr(cli->tree, finfo.name, finfo.mode, finfo.mtime))) {
+  if (NT_STATUS_IS_ERR(smbcli_setatr(cli->tree, finfo.name, finfo.mode, finfo.mtime))) {
          if (tar_real_noisy) {
                  DEBUG(0, ("Could not set time on file: %s\n", finfo.name));
                  /*return(False); */ /* Ignore, as Win95 does not allow changes */
index fe8f2136397e14648c364b22c068d843a683a484..235a45a3f1df651a171993ad62c017f0ed67a537 100644 (file)
@@ -113,9 +113,9 @@ static void usr1_handler(int x)
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct cli_state *do_connection(char *the_service)
+static struct smbcli_state *do_connection(char *the_service)
 {
-       struct cli_state *c;
+       struct smbcli_state *c;
        struct nmb_name called, calling;
        char *server_n;
        struct in_addr ip;
@@ -146,11 +146,11 @@ static struct cli_state *do_connection(char *the_service)
        if (have_ip) ip = dest_ip;
 
        /* have to open a new connection */
-       if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) != smb_port) ||
-           !cli_connect(c, server_n, &ip)) {
+       if (!(c=smbcli_initialise(NULL)) || (smbcli_set_port(c, smb_port) != smb_port) ||
+           !smbcli_connect(c, server_n, &ip)) {
                DEBUG(0,("%d: Connection to %s failed\n", sys_getpid(), server_n));
                if (c) {
-                       cli_shutdown(c);
+                       smbcli_shutdown(c);
                }
                return NULL;
        }
@@ -165,11 +165,11 @@ static struct cli_state *do_connection(char *the_service)
        /* Use kerberos authentication if specified */
        c->use_kerberos = use_kerberos;
 
-       if (!cli_session_request(c, &calling, &called)) {
+       if (!smbcli_session_request(c, &calling, &called)) {
                char *p;
                DEBUG(0,("%d: session request to %s failed (%s)\n", 
-                        sys_getpid(), called.name, cli_errstr(c)));
-               cli_shutdown(c);
+                        sys_getpid(), called.name, smbcli_errstr(c)));
+               smbcli_shutdown(c);
                if ((p=strchr_m(called.name, '.'))) {
                        *p = 0;
                        goto again;
@@ -183,9 +183,9 @@ static struct cli_state *do_connection(char *the_service)
 
        DEBUG(4,("%d: session request ok\n", sys_getpid()));
 
-       if (!cli_negprot(c)) {
+       if (!smbcli_negprot(c)) {
                DEBUG(0,("%d: protocol negotiation failed\n", sys_getpid()));
-               cli_shutdown(c);
+               smbcli_shutdown(c);
                return NULL;
        }
 
@@ -209,17 +209,17 @@ static struct cli_state *do_connection(char *the_service)
            c->force_dos_errors = True;
        }
 
-       if (!cli_session_setup(c, username, 
+       if (!smbcli_session_setup(c, username, 
                               password, strlen(password),
                               password, strlen(password),
                               workgroup)) {
                /* if a password was not supplied then try again with a
                        null username */
                if (password[0] || !username[0] ||
-                               !cli_session_setup(c, "", "", 0, "", 0, workgroup)) {
+                               !smbcli_session_setup(c, "", "", 0, "", 0, workgroup)) {
                        DEBUG(0,("%d: session setup failed: %s\n",
-                               sys_getpid(), cli_errstr(c)));
-                       cli_shutdown(c);
+                               sys_getpid(), smbcli_errstr(c)));
+                       smbcli_shutdown(c);
                        return NULL;
                }
                DEBUG(0,("Anonymous login successful\n"));
@@ -227,11 +227,11 @@ static struct cli_state *do_connection(char *the_service)
 
        DEBUG(4,("%d: session setup ok\n", sys_getpid()));
 
-       if (!cli_send_tconX(c, share, "?????",
+       if (!smbcli_send_tconX(c, share, "?????",
                            password, strlen(password)+1)) {
                DEBUG(0,("%d: tree connect failed: %s\n",
-                        sys_getpid(), cli_errstr(c)));
-               cli_shutdown(c);
+                        sys_getpid(), smbcli_errstr(c)));
+               smbcli_shutdown(c);
                return NULL;
        }
 
@@ -326,7 +326,7 @@ static void smb_umount(char *mount_point)
  * not exit after open_sockets() or send_login() errors,
  * as the smbfs mount would then have no way to recover.
  */
-static void send_fs_socket(char *the_service, char *mount_point, struct cli_state *c)
+static void send_fs_socket(char *the_service, char *mount_point, struct smbcli_state *c)
 {
        int fd, closed = 0, res = 1;
        pid_t parentpid = getppid();
@@ -379,7 +379,7 @@ static void send_fs_socket(char *the_service, char *mount_point, struct cli_stat
 
                   If we don't do this we will "leak" sockets and memory on
                   each reconnection we have to make. */
-               cli_shutdown(c);
+               smbcli_shutdown(c);
                c = NULL;
 
                if (!closed) {
@@ -427,7 +427,7 @@ static void init_mount(void)
        char mount_point[MAXPATHLEN+1];
        pstring tmp;
        pstring svc2;
-       struct cli_state *c;
+       struct smbcli_state *c;
        char *args[20];
        int i, status;
 
index 24d40114f0b6a38230affc19c7e8d86ffb9b1254..25208ac93a28181f82dfb3e85ec9ae5ac60aabd1 100644 (file)
@@ -34,8 +34,8 @@ extern BOOL           in_client;      /* Boolean for client library */
  */
 
 static void            list_devices(void);
-static struct cli_state        *smb_connect(const char *, const char *, const char *, const char *, const char *);
-static int             smb_print(struct cli_state *, char *, FILE *);
+static struct smbcli_state     *smb_connect(const char *, const char *, const char *, const char *, const char *);
+static int             smb_print(struct smbcli_state *, char *, FILE *);
 
 
 /*
@@ -57,7 +57,7 @@ static int            smb_print(struct cli_state *, char *, FILE *);
   const char   *workgroup;     /* Workgroup */
   FILE         *fp;            /* File to print */
   int          status=0;               /* Status of LPD job */
-  struct cli_state *cli;       /* SMB interface */
+  struct smbcli_state *cli;    /* SMB interface */
 
   /* we expect the URI in argv[0]. Detect the case where it is in argv[1] and cope */
   if (argc > 2 && strncmp(argv[0],"smb://", 6) && !strncmp(argv[1],"smb://", 6)) {
@@ -233,7 +233,7 @@ static int          smb_print(struct cli_state *, char *, FILE *);
     if ((status = smb_print(cli, argv[3] /* title */, fp)) != 0)
       break;
 
-  cli_shutdown(cli);
+  smbcli_shutdown(cli);
 
  /*
   * Return the queue status...
@@ -262,14 +262,14 @@ list_devices(void)
  * 'smb_connect()' - Return a connection to a server.
  */
 
-static struct cli_state *              /* O - SMB connection */
+static struct smbcli_state *           /* O - SMB connection */
 smb_connect(const char *workgroup,             /* I - Workgroup */
             const char *server,                /* I - Server */
             const char *share,         /* I - Printer */
             const char *username,              /* I - Username */
             const char *password)              /* I - Password */
 {
-  struct cli_state     *c;             /* New connection */
+  struct smbcli_state  *c;             /* New connection */
   char *myname;                /* Client name */
   NTSTATUS nt_status;
 
@@ -279,7 +279,7 @@ smb_connect(const char *workgroup,          /* I - Workgroup */
 
   myname = get_myname();  
        
-  nt_status = cli_full_connection(&c, myname, server, NULL, 0, share, "?????", 
+  nt_status = smbcli_full_connection(&c, myname, server, NULL, 0, share, "?????", 
                                  username, workgroup, password, 0, NULL);
   
   free(myname);
@@ -301,7 +301,7 @@ smb_connect(const char *workgroup,          /* I - Workgroup */
  */
 
 static int                             /* O - 0 = success, non-0 = failure */
-smb_print(struct cli_state *cli,       /* I - SMB connection */
+smb_print(struct smbcli_state *cli,    /* I - SMB connection */
           char             *title,     /* I - Title/job name */
           FILE             *fp)                /* I - File to print */
 {
@@ -324,10 +324,10 @@ smb_print(struct cli_state *cli,  /* I - SMB connection */
   * Open the printer device...
   */
 
-  if ((fnum = cli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE)) == -1)
+  if ((fnum = smbcli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE)) == -1)
   {
     fprintf(stderr, "ERROR: %s opening remote file %s\n",
-            cli_errstr(cli), title);
+            smbcli_errstr(cli), title);
     return (1);
   }
 
@@ -342,19 +342,19 @@ smb_print(struct cli_state *cli,  /* I - SMB connection */
 
   while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
   {
-    if (cli_write(cli, fnum, 0, buffer, tbytes, nbytes) != nbytes)
+    if (smbcli_write(cli, fnum, 0, buffer, tbytes, nbytes) != nbytes)
     {
-      fprintf(stderr, "ERROR: Error writing file: %s\n", cli_errstr(cli));
+      fprintf(stderr, "ERROR: Error writing file: %s\n", smbcli_errstr(cli));
       break;
     }
 
     tbytes += nbytes;
   } 
 
-  if (!cli_close(cli, fnum))
+  if (!smbcli_close(cli, fnum))
   {
     fprintf(stderr, "ERROR: %s closing remote file %s\n",
-            cli_errstr(cli), title);
+            smbcli_errstr(cli), title);
     return (1);
   }
   else
index c12ff5d5fa01e134d88d931a50caddfdfed1382e..1f179ff45280282e69478b1297f606e13a649621 100644 (file)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#ifndef _CLI_CONTEXT_H
-#define _CLI_CONTEXT_H
+#ifndef _SMBCLI_CONTEXT_H
+#define _SMBCLI_CONTEXT_H
 
-struct cli_tree;  /* forward declare */
-struct cli_request;  /* forward declare */
-struct cli_session;  /* forward declare */
-struct cli_transport;  /* forward declare */
+struct smbcli_tree;  /* forward declare */
+struct smbcli_request;  /* forward declare */
+struct smbcli_session;  /* forward declare */
+struct smbcli_transport;  /* forward declare */
 
 /* context that will be and has been negotiated between the client and server */
-struct cli_negotiate {
+struct smbcli_negotiate {
        /* 
         * negotiated maximum transmit size - this is given to us by the server
         */
@@ -49,9 +49,9 @@ struct cli_negotiate {
        uint32_t sesskey;
        
        struct {
-               void (*sign_outgoing_message)(struct cli_request *req);
-               BOOL (*check_incoming_message)(struct cli_request *req);
-               void (*free_signing_context)(struct cli_transport *transport);
+               void (*sign_outgoing_message)(struct smbcli_request *req);
+               BOOL (*check_incoming_message)(struct smbcli_request *req);
+               void (*free_signing_context)(struct smbcli_transport *transport);
                void *signing_context;
                BOOL negotiated_smb_signing;
                BOOL allow_smb_signing;
@@ -72,7 +72,7 @@ struct cli_negotiate {
 };
        
 /* this is the context for a SMB socket associated with the socket itself */
-struct cli_socket {
+struct smbcli_socket {
        TALLOC_CTX *mem_ctx;    /* life of socket pool */
 
        /* when the reference count reaches zero then the socket is destroyed */
@@ -103,31 +103,31 @@ struct cli_socket {
   this structure allows applications to control the behaviour of the
   client library
 */
-struct cli_options {
+struct smbcli_options {
        uint_t use_oplocks:1;
        uint_t use_level2_oplocks:1;
        uint_t use_spnego:1;
 };
 
 /* this is the context for the client transport layer */
-struct cli_transport {
+struct smbcli_transport {
        TALLOC_CTX *mem_ctx;
 
        /* when the reference count reaches zero then the transport is destroyed */
        int reference_count;
 
        /* socket level info */
-       struct cli_socket *socket;
+       struct smbcli_socket *socket;
 
        /* the next mid to be allocated - needed for signing and
           request matching */
        uint16_t next_mid;
        
        /* negotiated protocol information */
-       struct cli_negotiate negotiate;
+       struct smbcli_negotiate negotiate;
 
        /* options to control the behaviour of the client code */
-       struct cli_options options;
+       struct smbcli_options options;
 
        /* is a readbraw pending? we need to handle that case
           specially on receiving packets */
@@ -137,7 +137,7 @@ struct cli_transport {
           called once every period seconds while we are waiting
           for a packet */
        struct {
-               void (*func)(struct cli_transport *, void *);
+               void (*func)(struct smbcli_transport *, void *);
                void *private;
                uint_t period;
        } idle;
@@ -162,17 +162,17 @@ struct cli_transport {
 
        struct {
                /* a oplock break request handler */
-               BOOL (*handler)(struct cli_transport *transport, 
+               BOOL (*handler)(struct smbcli_transport *transport, 
                                uint16_t tid, uint16_t fnum, uint8_t level, void *private);
                /* private data passed to the oplock handler */
                void *private;
        } oplock;
 
        /* a list of async requests that are pending for send on this connection */
-       struct cli_request *pending_send;
+       struct smbcli_request *pending_send;
 
        /* a list of async requests that are pending for receive on this connection */
-       struct cli_request *pending_recv;
+       struct smbcli_request *pending_recv;
 
        /* remember the called name - some sub-protocols require us to
           know the server name */
@@ -197,14 +197,14 @@ struct cli_transport {
 /* this is the context for the user */
 
 /* this is the context for the session layer */
-struct cli_session {   
+struct smbcli_session {        
        TALLOC_CTX *mem_ctx;    /* life of session */
 
        /* when the reference count reaches zero then the session is destroyed */
        int reference_count;    
        
        /* transport layer info */
-       struct cli_transport *transport;
+       struct smbcli_transport *transport;
        
        /* after a session setup the server provides us with
           a vuid identifying the security context */
@@ -220,9 +220,9 @@ struct cli_session {
 };
 
 /* 
-   cli_tree context: internal state for a tree connection. 
+   smbcli_tree context: internal state for a tree connection. 
  */
-struct cli_tree {
+struct smbcli_tree {
        /* life of tree tree */
        TALLOC_CTX *mem_ctx;
 
@@ -230,7 +230,7 @@ struct cli_tree {
        int reference_count;    
 
        /* session layer info */
-       struct cli_session *session;
+       struct smbcli_session *session;
 
        uint16_t tid;                   /* tree id, aka cnum */
        char *device;
@@ -241,30 +241,30 @@ struct cli_tree {
 /*
   a client request moves between the following 4 states.
 */
-enum cli_request_state {CLI_REQUEST_INIT, /* we are creating the request */
-                       CLI_REQUEST_SEND, /* the request is in the outgoing socket Q */
-                       CLI_REQUEST_RECV, /* we are waiting for a matching reply */
-                       CLI_REQUEST_DONE, /* the request is finished */
-                       CLI_REQUEST_ERROR}; /* a packet or transport level error has occurred */
+enum smbcli_request_state {SMBCLI_REQUEST_INIT, /* we are creating the request */
+                       SMBCLI_REQUEST_SEND, /* the request is in the outgoing socket Q */
+                       SMBCLI_REQUEST_RECV, /* we are waiting for a matching reply */
+                       SMBCLI_REQUEST_DONE, /* the request is finished */
+                       SMBCLI_REQUEST_ERROR}; /* a packet or transport level error has occurred */
 
 /* the context for a single SMB request. This is passed to any request-context 
  * functions (similar to context.h, the server version).
  * This will allow requests to be multi-threaded. */
-struct cli_request {
+struct smbcli_request {
        /* allow a request to be part of a list of requests */
-       struct cli_request *next, *prev;
+       struct smbcli_request *next, *prev;
 
        /* a talloc context for the lifetime of this request */
        TALLOC_CTX *mem_ctx;
        
        /* each request is in one of 4 possible states */
-       enum cli_request_state state;
+       enum smbcli_request_state state;
        
        /* a request always has a transport context, nearly always has
           a session context and usually has a tree context */
-       struct cli_transport *transport;
-       struct cli_session *session;
-       struct cli_tree *tree;
+       struct smbcli_transport *transport;
+       struct smbcli_session *session;
+       struct smbcli_tree *tree;
 
        /* the flags2 from the SMB request, in raw form (host byte
           order). Used to parse strings */
@@ -299,34 +299,34 @@ struct cli_request {
           library (the application), not private to the library
        */
        struct {
-               void (*fn)(struct cli_request *);
+               void (*fn)(struct smbcli_request *);
                void *private;
        } async;
 };
 
 /* 
-   cli_state: internal state used in libcli library for single-threaded callers, 
+   smbcli_state: internal state used in libcli library for single-threaded callers, 
    i.e. a single session on a single socket. 
  */
-struct cli_state {
+struct smbcli_state {
        TALLOC_CTX *mem_ctx;    /* life of client pool */
-       struct cli_transport *transport;
-       struct cli_session *session;
-       struct cli_tree *tree;
+       struct smbcli_transport *transport;
+       struct smbcli_session *session;
+       struct smbcli_tree *tree;
        struct substitute_context substitute;
 };
 
 /* useful way of catching wct errors with file and line number */
-#define CLI_CHECK_MIN_WCT(req, wcount) if ((req)->in.wct < (wcount)) { \
+#define SMBCLI_CHECK_MIN_WCT(req, wcount) if ((req)->in.wct < (wcount)) { \
       DEBUG(1,("Unexpected WCT %d at %s(%d) - expected min %d\n", (req)->in.wct, __FILE__, __LINE__, wcount)); \
       req->status = NT_STATUS_INVALID_PARAMETER; \
       goto failed; \
 }
 
-#define CLI_CHECK_WCT(req, wcount) if ((req)->in.wct != (wcount)) { \
+#define SMBCLI_CHECK_WCT(req, wcount) if ((req)->in.wct != (wcount)) { \
       DEBUG(1,("Unexpected WCT %d at %s(%d) - expected %d\n", (req)->in.wct, __FILE__, __LINE__, wcount)); \
       req->status = NT_STATUS_INVALID_PARAMETER; \
       goto failed; \
 }
 
-#endif /* _CLI_CONTEXT_H */
+#endif /* _SMBCLI_CONTEXT_H */
index c9b3f1c7c55a44a88767ebbfba902e7e933d4c8f..b7f1da28b394b017d5a8d966756bbf225a2cf329 100644 (file)
@@ -28,7 +28,7 @@
    overlap on the wire. This size gives us a nice read/write size, which
    will be a multiple of the page size on almost any system */
 #define CLI_BUFFER_SIZE (0xFFFF)
-#define CLI_DFS_MAX_REFERRAL_LEVEL 3
+#define SMBCLI_DFS_MAX_REFERRAL_LEVEL 3
 
 #define SAFETY_MARGIN 1024
 #define LARGE_WRITEX_HDR_SIZE 65
@@ -87,8 +87,8 @@ typedef struct dfs_info
        referral_info referrals[10];
 } dfs_info;
 
-/* Internal client error codes for cli_request_context.internal_error_code */
-#define CLI_ERR_INVALID_TRANS_RESPONSE         100
+/* Internal client error codes for smbcli_request_context.internal_error_code */
+#define SMBCLI_ERR_INVALID_TRANS_RESPONSE              100
 
 #define DFS_MAX_CLUSTER_SIZE 8
 /* client_context: used by cliraw callers to maintain Dfs
@@ -106,12 +106,12 @@ struct cli_client
        int connection_flags;           /* see CLI_FULL_CONN.. below */
        uint16_t max_xmit_frag;
        uint16_t max_recv_frag;
-       struct cli_state *cli[DFS_MAX_CLUSTER_SIZE];
+       struct smbcli_state *cli[DFS_MAX_CLUSTER_SIZE];
 };
 
-#define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001
-#define CLI_FULL_CONNECTION_USE_KERBEROS 0x0002
-#define CLI_FULL_CONNECTION_ANNONYMOUS_FALLBACK 0x0004
-#define CLI_FULL_CONNECTION_USE_DFS 0x0008
+#define SMBCLI_FULL_CONNECTION_DONT_SPNEGO 0x0001
+#define SMBCLI_FULL_CONNECTION_USE_KERBEROS 0x0002
+#define SMBCLI_FULL_CONNECTION_ANNONYMOUS_FALLBACK 0x0004
+#define SMBCLI_FULL_CONNECTION_USE_DFS 0x0008
 
 #endif /* _CLIENT_H */
index dee53e5f1af2386d822f44b652dae5c05a91f13a..005481cd97b8f7b48afa2caf7eaecc461ae55f8f 100644 (file)
@@ -259,7 +259,7 @@ static void map_regval_to_ads(TALLOC_CTX *ctx, ADS_MODLIST *mods,
 }
 
 
-WERROR get_remote_printer_publishing_data(struct cli_state *cli, 
+WERROR get_remote_printer_publishing_data(struct smbcli_state *cli, 
                                          TALLOC_CTX *mem_ctx,
                                          ADS_MODLIST *mods,
                                          const char *printer)
@@ -278,7 +278,7 @@ WERROR get_remote_printer_publishing_data(struct cli_state *cli,
                return WERR_NOMEM;
        }
        
-       result = cli_spoolss_open_printer_ex(cli, mem_ctx, printername, 
+       result = smbcli_spoolss_open_printer_ex(cli, mem_ctx, printername, 
                                             "", MAXIMUM_ALLOWED_ACCESS, 
                                             servername, cli->user_name, &pol);
        if (!W_ERROR_IS_OK(result)) {
@@ -287,11 +287,11 @@ WERROR get_remote_printer_publishing_data(struct cli_state *cli,
                return result;
        }
        
-       result = cli_spoolss_enumprinterdataex(cli, mem_ctx, 0, &needed, 
+       result = smbcli_spoolss_enumprinterdataex(cli, mem_ctx, 0, &needed, 
                                               &pol, SPOOL_DSDRIVER_KEY, NULL);
 
        if (W_ERROR_V(result) == ERRmoredata)
-               result = cli_spoolss_enumprinterdataex(cli, mem_ctx, needed, 
+               result = smbcli_spoolss_enumprinterdataex(cli, mem_ctx, needed, 
                                                       NULL, &pol, 
                                                       SPOOL_DSDRIVER_KEY,
                                                       &dsdriver_ctr);
@@ -308,12 +308,12 @@ WERROR get_remote_printer_publishing_data(struct cli_state *cli,
                                          dsdriver_ctr.values[i]);
        }
        
-       result = cli_spoolss_enumprinterdataex(cli, mem_ctx, 0, &needed, 
+       result = smbcli_spoolss_enumprinterdataex(cli, mem_ctx, 0, &needed, 
                                               &pol, SPOOL_DSSPOOLER_KEY, 
                                               NULL);
 
        if (W_ERROR_V(result) == ERRmoredata)
-               result = cli_spoolss_enumprinterdataex(cli, mem_ctx, needed, 
+               result = smbcli_spoolss_enumprinterdataex(cli, mem_ctx, needed, 
                                                       NULL, &pol, 
                                                       SPOOL_DSSPOOLER_KEY,
                                                       &dsspooler_ctr);
@@ -332,7 +332,7 @@ WERROR get_remote_printer_publishing_data(struct cli_state *cli,
 
        if (got_dsdriver) regval_ctr_destroy(&dsdriver_ctr);
        if (got_dsspooler) regval_ctr_destroy(&dsspooler_ctr);
-       cli_spoolss_close_printer(cli, mem_ctx, &pol);
+       smbcli_spoolss_close_printer(cli, mem_ctx, &pol);
 
        return result;
 }
index 8b064f161ecc16f3264f77b93df0e323d5ed8664..8753f26b5f0b8f6f9784eb8be0cb5d4a052583f7 100644 (file)
 #include "includes.h"
 
 /*
-  wrapper around cli_sock_connect()
+  wrapper around smbcli_sock_connect()
 */
-BOOL cli_socket_connect(struct cli_state *cli, const char *server, struct in_addr *ip)
+BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server, struct in_addr *ip)
 {
-       struct cli_socket *sock;
+       struct smbcli_socket *sock;
 
-       sock = cli_sock_init();
+       sock = smbcli_sock_init();
        if (!sock) return False;
 
-       if (!cli_sock_connect_byname(sock, server, 0)) {
-               cli_sock_close(sock);
+       if (!smbcli_sock_connect_byname(sock, server, 0)) {
+               smbcli_sock_close(sock);
                return False;
        }
        
-       cli->transport = cli_transport_init(sock);
+       cli->transport = smbcli_transport_init(sock);
        if (!cli->transport) {
-               cli_sock_close(sock);
+               smbcli_sock_close(sock);
                return False;
        }
 
        return True;
 }
 
-/* wrapper around cli_transport_connect() */
-BOOL cli_transport_establish(struct cli_state *cli, 
+/* wrapper around smbcli_transport_connect() */
+BOOL smbcli_transport_establish(struct smbcli_state *cli, 
                             struct nmb_name *calling,
                             struct nmb_name *called)
 {
-       return cli_transport_connect(cli->transport, calling, called);
+       return smbcli_transport_connect(cli->transport, calling, called);
 }
 
 /* wrapper around smb_raw_negotiate() */
-NTSTATUS cli_negprot(struct cli_state *cli)
+NTSTATUS smbcli_negprot(struct smbcli_state *cli)
 {
        return smb_raw_negotiate(cli->transport);
 }
 
 /* wrapper around smb_raw_session_setup() */
-NTSTATUS cli_session_setup(struct cli_state *cli, 
+NTSTATUS smbcli_session_setup(struct smbcli_state *cli, 
                           const char *user, 
                           const char *password, 
                           const char *domain)
@@ -68,10 +68,10 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
        NTSTATUS status;
        TALLOC_CTX *mem_ctx;
 
-       cli->session = cli_session_init(cli->transport);
+       cli->session = smbcli_session_init(cli->transport);
        if (!cli->session) return NT_STATUS_UNSUCCESSFUL;
 
-       mem_ctx = talloc_init("cli_session_setup");
+       mem_ctx = talloc_init("smbcli_session_setup");
        if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        setup.generic.level = RAW_SESSSETUP_GENERIC;
@@ -98,14 +98,14 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
 }
 
 /* wrapper around smb_tree_connect() */
-NTSTATUS cli_send_tconX(struct cli_state *cli, const char *sharename, 
+NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, 
                        const char *devtype, const char *password)
 {
        union smb_tcon tcon;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
-       cli->tree = cli_tree_init(cli->session);
+       cli->tree = smbcli_tree_init(cli->session);
        if (!cli->tree) return NT_STATUS_UNSUCCESSFUL;
 
        cli->tree->reference_count++;
@@ -132,9 +132,9 @@ NTSTATUS cli_send_tconX(struct cli_state *cli, const char *sharename,
 
 
 /*
-  easy way to get to a fully connected cli_state in one call
+  easy way to get to a fully connected smbcli_state in one call
 */
-NTSTATUS cli_full_connection(struct cli_state **ret_cli, 
+NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, 
                             const char *myname,
                             const char *host,
                             struct in_addr *ip,
@@ -146,12 +146,12 @@ NTSTATUS cli_full_connection(struct cli_state **ret_cli,
                             uint_t flags,
                             BOOL *retry)
 {
-       struct cli_tree *tree;
+       struct smbcli_tree *tree;
        NTSTATUS status;
        char *p;
        TALLOC_CTX *mem_ctx;
 
-       mem_ctx = talloc_init("cli_full_connection");
+       mem_ctx = talloc_init("smbcli_full_connection");
 
        *ret_cli = NULL;
 
@@ -162,13 +162,13 @@ NTSTATUS cli_full_connection(struct cli_state **ret_cli,
                username = talloc_strdup(mem_ctx, p+1);
        }
 
-       status = cli_tree_full_connection(&tree, myname, host, 0, sharename, devtype,
+       status = smbcli_tree_full_connection(&tree, myname, host, 0, sharename, devtype,
                                          username, domain, password);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
 
-       (*ret_cli) = cli_state_init();
+       (*ret_cli) = smbcli_state_init();
 
        (*ret_cli)->tree = tree;
        (*ret_cli)->session = tree->session;
@@ -184,7 +184,7 @@ done:
 /*
   disconnect the tree
 */
-NTSTATUS cli_tdis(struct cli_state *cli)
+NTSTATUS smbcli_tdis(struct smbcli_state *cli)
 {
        return smb_tree_disconnect(cli->tree);
 }
@@ -192,12 +192,12 @@ NTSTATUS cli_tdis(struct cli_state *cli)
 /****************************************************************************
  Initialise a client state structure.
 ****************************************************************************/
-struct cli_state *cli_state_init(void)
+struct smbcli_state *smbcli_state_init(void)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        TALLOC_CTX *mem_ctx;
 
-       mem_ctx = talloc_init("cli_state");
+       mem_ctx = talloc_init("smbcli_state");
        if (!mem_ctx) return NULL;
 
        cli = talloc_zero(mem_ctx, sizeof(*cli));
@@ -209,12 +209,12 @@ struct cli_state *cli_state_init(void)
 /****************************************************************************
  Shutdown a client structure.
 ****************************************************************************/
-void cli_shutdown(struct cli_state *cli)
+void smbcli_shutdown(struct smbcli_state *cli)
 {
        if (!cli) return;
        if (cli->tree) {
                cli->tree->reference_count++;
-               cli_tree_close(cli->tree);
+               smbcli_tree_close(cli->tree);
        }
        if (cli->mem_ctx) {
                talloc_destroy(cli->mem_ctx);
index 2bbfd9bd228e0eb3dd96032cf142c9b869d48950..aa73f5b90b2ae3bf520d9ef484c9b4d6e8bcba0a 100644 (file)
@@ -21,7 +21,7 @@
 #include "includes.h"
 
 struct delete_state {
-       struct cli_tree *tree;
+       struct smbcli_tree *tree;
        int total_deleted;
        BOOL failed;
 };
@@ -41,30 +41,30 @@ static void delete_fn(file_info *finfo, const char *name, void *state)
        asprintf(&s, "%s%s", n, finfo->name);
 
        if (finfo->mode & FILE_ATTRIBUTE_READONLY) {
-               if (NT_STATUS_IS_ERR(cli_setatr(dstate->tree, s, 0, 0))) {
+               if (NT_STATUS_IS_ERR(smbcli_setatr(dstate->tree, s, 0, 0))) {
                        DEBUG(2,("Failed to remove READONLY on %s - %s\n",
-                                s, cli_errstr(dstate->tree)));                 
+                                s, smbcli_errstr(dstate->tree)));                      
                }
        }
 
        if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
                char *s2;
                asprintf(&s2, "%s\\*", s);
-               cli_unlink(dstate->tree, s2);
-               cli_list(dstate->tree, s2, 
+               smbcli_unlink(dstate->tree, s2);
+               smbcli_list(dstate->tree, s2, 
                         FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM, 
                         delete_fn, state);
                free(s2);
-               if (NT_STATUS_IS_ERR(cli_rmdir(dstate->tree, s))) {
+               if (NT_STATUS_IS_ERR(smbcli_rmdir(dstate->tree, s))) {
                        DEBUG(2,("Failed to delete %s - %s\n", 
-                                s, cli_errstr(dstate->tree)));
+                                s, smbcli_errstr(dstate->tree)));
                        dstate->failed = True;
                }
                dstate->total_deleted++;
        } else {
-               if (NT_STATUS_IS_ERR(cli_unlink(dstate->tree, s))) {
+               if (NT_STATUS_IS_ERR(smbcli_unlink(dstate->tree, s))) {
                        DEBUG(2,("Failed to delete %s - %s\n", 
-                                s, cli_errstr(dstate->tree)));
+                                s, smbcli_errstr(dstate->tree)));
                        dstate->failed = True;
                }
                dstate->total_deleted++;
@@ -77,7 +77,7 @@ static void delete_fn(file_info *finfo, const char *name, void *state)
    recursively descend a tree deleting all files
    returns the number of files deleted, or -1 on error
 */
-int cli_deltree(struct cli_tree *tree, const char *dname)
+int smbcli_deltree(struct smbcli_tree *tree, const char *dname)
 {
        char *mask;
        struct delete_state dstate;
@@ -87,24 +87,24 @@ int cli_deltree(struct cli_tree *tree, const char *dname)
        dstate.failed = False;
 
        /* it might be a file */
-       if (NT_STATUS_IS_OK(cli_unlink(tree, dname))) {
+       if (NT_STATUS_IS_OK(smbcli_unlink(tree, dname))) {
                return 1;
        }
-       if (NT_STATUS_EQUAL(cli_nt_error(tree), NT_STATUS_OBJECT_NAME_NOT_FOUND) ||
-           NT_STATUS_EQUAL(cli_nt_error(tree), NT_STATUS_OBJECT_PATH_NOT_FOUND) ||
-           NT_STATUS_EQUAL(cli_nt_error(tree), NT_STATUS_NO_SUCH_FILE)) {
+       if (NT_STATUS_EQUAL(smbcli_nt_error(tree), NT_STATUS_OBJECT_NAME_NOT_FOUND) ||
+           NT_STATUS_EQUAL(smbcli_nt_error(tree), NT_STATUS_OBJECT_PATH_NOT_FOUND) ||
+           NT_STATUS_EQUAL(smbcli_nt_error(tree), NT_STATUS_NO_SUCH_FILE)) {
                return 0;
        }
 
        asprintf(&mask, "%s\\*", dname);
-       cli_unlink(dstate.tree, mask);
-       cli_list(dstate.tree, mask, 
+       smbcli_unlink(dstate.tree, mask);
+       smbcli_list(dstate.tree, mask, 
                 FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM, 
                 delete_fn, &dstate);
        free(mask);
-       if (NT_STATUS_IS_ERR(cli_rmdir(dstate.tree, dname))) {
+       if (NT_STATUS_IS_ERR(smbcli_rmdir(dstate.tree, dname))) {
                DEBUG(2,("Failed to delete %s - %s\n", 
-                        dname, cli_errstr(dstate.tree)));
+                        dname, smbcli_errstr(dstate.tree)));
                return -1;
        }
        dstate.total_deleted++;
index ae7a8dc6eb0674064e2694a1523dfe3fed9df8c7..674666a60a71709c8b3d0b1b51602b0b5f1a6649 100644 (file)
 
 #include "includes.h"
 
-BOOL cli_client_initialize(struct cli_client* context,
+BOOL smbcli_client_initialize(struct smbcli_client* context,
                           const char* sockops,
                           char* username, char* password, char* workgroup,
                           int flags)
 {
        int i;
        for (i=0; i < DFS_MAX_CLUSTER_SIZE ; i++) {
-               context->cli[i] = cli_raw_initialise();
+               context->cli[i] = smbcli_raw_initialise();
        }
        context->sockops = sockops;
        context->username = username;
        context->password = password;
        context->workgroup = workgroup;
        context->connection_flags = flags;
-       if (flags & CLI_FULL_CONNECTION_USE_DFS)
+       if (flags & SMBCLI_FULL_CONNECTION_USE_DFS)
                context->use_dfs = True;
        context->number_members = DFS_MAX_CLUSTER_SIZE; 
        return True;
@@ -46,7 +46,7 @@ BOOL cli_client_initialize(struct cli_client* context,
  The structure of a Dfs referral depends on the info level.
 ****************************************************************************/
 
-static int interpret_referral(struct cli_state *cli,
+static int interpret_referral(struct smbcli_state *cli,
                                   int level,char *p,referral_info *rinfo)
 {
        char* q;
@@ -99,12 +99,12 @@ static int interpret_referral(struct cli_state *cli,
 }
 
 #if 0
-int cli_select_dfs_referral(struct cli_state *cli, dfs_info* dinfo)
+int smbcli_select_dfs_referral(struct smbcli_state *cli, dfs_info* dinfo)
 {
        return (int)sys_random()%dinfo->number_referrals;
 }
 
-int cli_get_dfs_referral(struct cli_state *cli,const char *Fname, dfs_info* dinfo)
+int smbcli_get_dfs_referral(struct smbcli_state *cli,const char *Fname, dfs_info* dinfo)
 {
        struct smb_trans2 parms;
        int info_level;
@@ -123,20 +123,20 @@ int cli_get_dfs_referral(struct cli_state *cli,const char *Fname, dfs_info* dinf
        pstrcpy(fname,Fname);
 
        setup = TRANSACT2_GET_DFS_REFERRAL ;
-       SSVAL(param,0,CLI_DFS_MAX_REFERRAL_LEVEL); /* attribute */
+       SSVAL(param,0,SMBCLI_DFS_MAX_REFERRAL_LEVEL); /* attribute */
        p = param+2;
        p += clistr_push(cli, param+2, fname, -1, 
                         STR_TERMINATE);
 
        param_len = PTR_DIFF(p, param);
-       DEBUG(3,("cli_get_dfs_referral: sending request\n"));
+       DEBUG(3,("smbcli_get_dfs_referral: sending request\n"));
        
        trans_param.length = param_len;
        trans_param.data = param;
        trans_data.length = 0;
        trans_data.data = NULL;
 
-       if (!cli_send_trans(cli, SMBtrans2, 
+       if (!smbcli_send_trans(cli, SMBtrans2, 
                            NULL,                   /* Name */
                            -1, 0,                  /* fid, flags */
                            &setup, 1, 0,           /* setup, length, max */
@@ -147,25 +147,25 @@ int cli_get_dfs_referral(struct cli_state *cli,const char *Fname, dfs_info* dinf
                return 0;
        }
 
-       if (!cli_receive_trans(cli, SMBtrans2, 
+       if (!smbcli_receive_trans(cli, SMBtrans2, 
                               &rparam, &param_len,
                               &rdata, &data_len) &&
-                   cli_is_dos_error(cli)) {
+                   smbcli_is_dos_error(cli)) {
            return 0;
        }
-       //printf("cli_get_dfs_referral: received response, rdata=%p, rparam=%p\n",
+       //printf("smbcli_get_dfs_referral: received response, rdata=%p, rparam=%p\n",
        //      rdata, rparam);
 
-    if (cli_is_error(cli) || !rdata) 
+    if (smbcli_is_error(cli) || !rdata) 
                return 0;
 
        /* parse out some important return info */
-       //printf("cli_get_dfs_referral: valid response\n");
+       //printf("smbcli_get_dfs_referral: valid response\n");
        p = rdata;
        dinfo->path_consumed = SVAL(p,0);
        dinfo->number_referrals = SVAL(p,2);
        dinfo->referral_flags = SVAL(p,4);
-       DEBUG(3,("cli_get_dfs_referral: path_consumed=%d, # referrals=%d, flags=0x%x\n",
+       DEBUG(3,("smbcli_get_dfs_referral: path_consumed=%d, # referrals=%d, flags=0x%x\n",
                dinfo->path_consumed, dinfo->number_referrals,
                dinfo->referral_flags));
 
@@ -181,7 +181,7 @@ int cli_get_dfs_referral(struct cli_state *cli,const char *Fname, dfs_info* dinf
        DEBUG(3,("received %d Dfs referrals\n",
                         dinfo->number_referrals));
                         
-       dinfo->selected_referral = cli_select_dfs_referral(cli, dinfo);
+       dinfo->selected_referral = smbcli_select_dfs_referral(cli, dinfo);
        DEBUG(3, ("selected Dfs referral %d %s\n",
                dinfo->selected_referral, dinfo->referrals[dinfo->selected_referral].node));
 
@@ -190,12 +190,12 @@ int cli_get_dfs_referral(struct cli_state *cli,const char *Fname, dfs_info* dinf
 #endif
 
 /* check if the server produced Dfs redirect */
-BOOL cli_check_dfs_redirect(struct cli_state* c, char* fname,
+BOOL smbcli_check_dfs_redirect(struct smbcli_state* c, char* fname,
                dfs_info* dinfo)
 {
                //printf("check_dfs_redirect: error %s\n",
-               //      cli_errstr(c));
-        if (cli_is_dos_error(c)) {
+               //      smbcli_errstr(c));
+        if (smbcli_is_dos_error(c)) {
                        printf("got dos error\n");
                 return False;
 
@@ -204,7 +204,7 @@ BOOL cli_check_dfs_redirect(struct cli_state* c, char* fname,
 
                 /* Check NT error */
 
-                status = cli_nt_error(c);
+                status = smbcli_nt_error(c);
                 //printf("got nt error 0x%x\n", status);
 
                                if (NT_STATUS_V(NT_STATUS_PATH_NOT_COVERED) != NT_STATUS_V(status)) {
@@ -213,27 +213,27 @@ BOOL cli_check_dfs_redirect(struct cli_state* c, char* fname,
         }
     /* execute trans2 getdfsreferral */
     //printf("check_dfs_redirect: process referral\n");
-    //cli_get_dfs_referral(c, fname, dinfo);
+    //smbcli_get_dfs_referral(c, fname, dinfo);
        return True;
 }
 
-int cli_dfs_open_connection(struct cli_client* cluster,
+int smbcli_dfs_open_connection(struct smbcli_client* cluster,
                char* host, char* share, int flags)
 {
        int i;
        BOOL retry;
-       struct cli_state* c;
+       struct smbcli_state* c;
        
        // check if already connected
        for (i=0; i < DFS_MAX_CLUSTER_SIZE; i++) {
-               if (cluster->cli[i]->in_use && strequal(host, cli_state_get_host(cluster->cli[i]))
-                               && strequal(share, cli_state_get_share(cluster->cli[i]))) {
-                       DEBUG(3,("cli_dfs_open_connection: already connected to \\\\%s\\%s\n", host, share));
+               if (cluster->cli[i]->in_use && strequal(host, smbcli_state_get_host(cluster->cli[i]))
+                               && strequal(share, smbcli_state_get_share(cluster->cli[i]))) {
+                       DEBUG(3,("smbcli_dfs_open_connection: already connected to \\\\%s\\%s\n", host, share));
                        return i;
                }
        }
        // open connection
-       DEBUG(3,("cli_dfs_open_connection: opening \\\\%s\\%s %s@%s\n",
+       DEBUG(3,("smbcli_dfs_open_connection: opening \\\\%s\\%s %s@%s\n",
                host, share, cluster->username, cluster->workgroup));
        for (i=0; i < DFS_MAX_CLUSTER_SIZE; i++) {
                if (!cluster->cli[i]->in_use) {
@@ -244,19 +244,19 @@ int cli_dfs_open_connection(struct cli_client* cluster,
                return -1;
 
        c = cluster->cli[i];
-       if (NT_STATUS_IS_ERR(cli_full_connection(&c,
+       if (NT_STATUS_IS_ERR(smbcli_full_connection(&c,
                             NULL, host, NULL, 0,
                             share, "?????",
                             cluster->username, cluster->workgroup, 
                             cluster->password, flags,
                             &retry)))
                return -1;
-       cli_state_set_sockopt(cluster->cli[i], cluster->sockops);
-       cli_state_set_host(cluster->cli[i], host);
-       cli_state_set_share(cluster->cli[i], share);
+       smbcli_state_set_sockopt(cluster->cli[i], cluster->sockops);
+       smbcli_state_set_host(cluster->cli[i], host);
+       smbcli_state_set_share(cluster->cli[i], share);
        cluster->cli[i]->in_use = True;
-       DEBUG(3,("cli_dfs_open_connection: connected \\\\%s\\%s (%d) %s@%s\n",
-               cli_state_get_host(cluster->cli[i]), cli_state_get_share(cluster->cli[i]), i,
+       DEBUG(3,("smbcli_dfs_open_connection: connected \\\\%s\\%s (%d) %s@%s\n",
+               smbcli_state_get_host(cluster->cli[i]), smbcli_state_get_share(cluster->cli[i]), i,
                cluster->username, cluster->workgroup));
 
        return i;
@@ -267,7 +267,7 @@ int cli_dfs_open_connection(struct cli_client* cluster,
   into the dfs_path structure 
  **********************************************************************/
 
-BOOL cli_parse_dfs_path(char* pathname, struct dfs_path* pdp)
+BOOL smbcli_parse_dfs_path(char* pathname, struct dfs_path* pdp)
 {
        pstring pathname_local;
        char* p,*temp;
@@ -278,7 +278,7 @@ BOOL cli_parse_dfs_path(char* pathname, struct dfs_path* pdp)
        ZERO_STRUCTP(pdp);
 
        trim_string(temp,"\\","\\");
-       DEBUG(10,("temp in cli_parse_dfs_path: .%s. after trimming \\'s\n",temp));
+       DEBUG(10,("temp in smbcli_parse_dfs_path: .%s. after trimming \\'s\n",temp));
 
        /* now tokenize */
        /* parse out hostname */
@@ -308,7 +308,7 @@ BOOL cli_parse_dfs_path(char* pathname, struct dfs_path* pdp)
        return True;
 }
 
-char* rebuild_filename(char *referral_fname, struct cli_state* c,
+char* rebuild_filename(char *referral_fname, struct smbcli_state* c,
                char* fname, int path_consumed)
 {
        const char *template = "\\\\%s\\%s\\%s";
@@ -317,12 +317,12 @@ char* rebuild_filename(char *referral_fname, struct cli_state* c,
        // TODO: handle consumed length
        DEBUG(3,("rebuild_filename: %s, %d consumed of %d\n",
                fname, path_consumed, strlen(fname)));
-       if (cli_parse_dfs_path(fname, &dp)) {
+       if (smbcli_parse_dfs_path(fname, &dp)) {
                DEBUG(3,("rebuild_filename: reqpath=%s\n",
                        dp.reqpath));
                asprintf(&referral_fname,
-                       template, cli_state_get_host(c),
-                       cli_state_get_share(c), dp.reqpath);
+                       template, smbcli_state_get_host(c),
+                       smbcli_state_get_share(c), dp.reqpath);
        }
        else
                return NULL;
@@ -334,7 +334,7 @@ char* rebuild_filename(char *referral_fname, struct cli_state* c,
  Open a file (allowing for Dfs referral).
 ****************************************************************************/
 
-int cli_dfs_open(struct cli_client* cluster, int *server,
+int smbcli_dfs_open(struct smbcli_client* cluster, int *server,
        char *fname_src, int flags, int share_mode)
 {
        int referral_number;
@@ -342,15 +342,15 @@ int cli_dfs_open(struct cli_client* cluster, int *server,
        char *referral_fname;
        int fnum;
        
-       DEBUG(3,("cli_dfs_open: open %s on server %s(%d)\n",
-                       fname_src, cli_state_get_host(cluster->cli[*server]), *server));
+       DEBUG(3,("smbcli_dfs_open: open %s on server %s(%d)\n",
+                       fname_src, smbcli_state_get_host(cluster->cli[*server]), *server));
        cluster->cli[*server]->dfs_referral = *server;
-       if ((fnum = cli_open(cluster->cli[*server], fname_src, flags, share_mode)) < 0) {
-               if (cli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
+       if ((fnum = smbcli_open(cluster->cli[*server], fname_src, flags, share_mode)) < 0) {
+               if (smbcli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
                        // choose referral, check if already connected, open if not
                        referral_number = dinfo.selected_referral;
-                       DEBUG(3,("cli_dfs_open: redirecting to %s\n", dinfo.referrals[referral_number].node));
-                       cluster->cli[*server]->dfs_referral = cli_dfs_open_connection(cluster,
+                       DEBUG(3,("smbcli_dfs_open: redirecting to %s\n", dinfo.referrals[referral_number].node));
+                       cluster->cli[*server]->dfs_referral = smbcli_dfs_open_connection(cluster,
                                dinfo.referrals[referral_number].host,
                                dinfo.referrals[referral_number].share,
                                cluster->connection_flags);
@@ -361,17 +361,17 @@ int cli_dfs_open(struct cli_client* cluster, int *server,
                        if (rebuild_filename(referral_fname, cluster->cli[*server], fname_src, dinfo.path_consumed) == NULL)
                                return False;
                        fname_src = referral_fname;
-                       DEBUG(3,("cli_dfs_open: Dfs open %s on server %s(%d)\n",
-                               fname_src, cli_state_get_host(cluster->cli[*server]), *server));
-                       fnum = cli_open(cluster->cli[*server], fname_src, flags, share_mode);
+                       DEBUG(3,("smbcli_dfs_open: Dfs open %s on server %s(%d)\n",
+                               fname_src, smbcli_state_get_host(cluster->cli[*server]), *server));
+                       fnum = smbcli_open(cluster->cli[*server], fname_src, flags, share_mode);
                }
-               if (cli_is_error(cluster->cli[*server])) {
-                       printf("cli_dfs_open: open of %s failed (%s)\n",
-                               fname_src, cli_errstr(cluster->cli[*server]));
+               if (smbcli_is_error(cluster->cli[*server])) {
+                       printf("smbcli_dfs_open: open of %s failed (%s)\n",
+                               fname_src, smbcli_errstr(cluster->cli[*server]));
                        return -1;
                }
        }
-       DEBUG(3,("cli_dfs_open: open %s fnum=%d\n",
+       DEBUG(3,("smbcli_dfs_open: open %s fnum=%d\n",
                        fname_src, fnum));
        return fnum;
 }
@@ -380,7 +380,7 @@ int cli_dfs_open(struct cli_client* cluster, int *server,
  Delete a file (allowing for Dfs referral).
 ****************************************************************************/
 
-NTSTATUS cli_nt_unlink(struct cli_client* cluster, int *server,
+NTSTATUS smbcli_nt_unlink(struct smbcli_client* cluster, int *server,
        char *fname_src, uint16_t FileAttributes)
 {
        int referral_number;
@@ -388,20 +388,20 @@ NTSTATUS cli_nt_unlink(struct cli_client* cluster, int *server,
        char *referral_fname;
        struct smb_unlink parms;
        
-       DEBUG(3,("cli_nt_unlink: delete %s on server %s(%d), attributes=0x%x\n",
-                       fname_src, cli_state_get_host(cluster->cli[*server]), *server,
+       DEBUG(3,("smbcli_nt_unlink: delete %s on server %s(%d), attributes=0x%x\n",
+                       fname_src, smbcli_state_get_host(cluster->cli[*server]), *server,
                        FileAttributes));
        cluster->cli[*server]->dfs_referral = *server;
        parms.in.pattern = fname_src;
        parms.in.dirtype = FileAttributes;                      
-       if (NT_STATUS_IS_ERR(cli_raw_unlink(cluster->cli[*server], &parms))) {
-               printf("cli_nt_unlink: delete of %s failed (%s)\n",
-                               fname_src, cli_errstr(cluster->cli[*server]));
-               if (cli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
+       if (NT_STATUS_IS_ERR(smbcli_raw_unlink(cluster->cli[*server], &parms))) {
+               printf("smbcli_nt_unlink: delete of %s failed (%s)\n",
+                               fname_src, smbcli_errstr(cluster->cli[*server]));
+               if (smbcli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
                        // choose referral, check if already connected, open if not
                        referral_number = dinfo.selected_referral;
-                       DEBUG(3,("cli_nt_unlink: redirecting to %s\n", dinfo.referrals[referral_number].node));
-                       cluster->cli[*server]->dfs_referral = cli_dfs_open_connection(cluster,
+                       DEBUG(3,("smbcli_nt_unlink: redirecting to %s\n", dinfo.referrals[referral_number].node));
+                       cluster->cli[*server]->dfs_referral = smbcli_dfs_open_connection(cluster,
                                dinfo.referrals[referral_number].host,
                                dinfo.referrals[referral_number].share,
                                cluster->connection_flags);
@@ -412,38 +412,38 @@ NTSTATUS cli_nt_unlink(struct cli_client* cluster, int *server,
                        if (rebuild_filename(referral_fname, cluster->cli[*server], fname_src, dinfo.path_consumed) == NULL)
                                return NT_STATUS_INTERNAL_ERROR;
                        fname_src = referral_fname;
-                       DEBUG(3,("cli_nt_unlink: Dfs delete %s on server %s(%d)\n",
-                               fname_src, cli_state_get_host(cluster->cli[*server]), *server));
-                       cli_raw_unlink(cluster->cli[*server], &parms);
+                       DEBUG(3,("smbcli_nt_unlink: Dfs delete %s on server %s(%d)\n",
+                               fname_src, smbcli_state_get_host(cluster->cli[*server]), *server));
+                       smbcli_raw_unlink(cluster->cli[*server], &parms);
                }
-               if (cli_is_error(cluster->cli[*server])) {
-                       printf("cli_nt_unlink: delete of %s failed (%s)\n",
-                               fname_src, cli_errstr(cluster->cli[*server]));
+               if (smbcli_is_error(cluster->cli[*server])) {
+                       printf("smbcli_nt_unlink: delete of %s failed (%s)\n",
+                               fname_src, smbcli_errstr(cluster->cli[*server]));
                }
        }
-       return cli_nt_error(cluster->cli[*server]);
+       return smbcli_nt_error(cluster->cli[*server]);
 }
 
 /****************************************************************************
  Rename a file (allowing for Dfs referral).
 ****************************************************************************/
 
-BOOL cli_dfs_rename(struct cli_client* cluster, int *server,
+BOOL smbcli_dfs_rename(struct smbcli_client* cluster, int *server,
        char *fname_src, char *fname_dst)
 {
        int referral_number;
        dfs_info dinfo;
        char *referral_fname;
        
-       DEBUG(3,("cli_dfs_rename: rename %s to %s on server %s(%d)\n",
-                       fname_src, fname_dst, cli_state_get_host(cluster->cli[*server]), *server));
+       DEBUG(3,("smbcli_dfs_rename: rename %s to %s on server %s(%d)\n",
+                       fname_src, fname_dst, smbcli_state_get_host(cluster->cli[*server]), *server));
        cluster->cli[*server]->dfs_referral = *server;
-       if (!cli_rename(cluster->cli[*server], fname_src, fname_dst)) {
-               if (cli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
+       if (!smbcli_rename(cluster->cli[*server], fname_src, fname_dst)) {
+               if (smbcli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
                        // choose referral, check if already connected, open if not
                        referral_number = dinfo.selected_referral;
-                       DEBUG(3,("cli_dfs_rename: redirecting to %s\n", dinfo.referrals[referral_number].node));
-                       cluster->cli[*server]->dfs_referral = cli_dfs_open_connection(cluster,
+                       DEBUG(3,("smbcli_dfs_rename: redirecting to %s\n", dinfo.referrals[referral_number].node));
+                       cluster->cli[*server]->dfs_referral = smbcli_dfs_open_connection(cluster,
                                dinfo.referrals[referral_number].host,
                                dinfo.referrals[referral_number].share,
                                cluster->connection_flags);
@@ -454,13 +454,13 @@ BOOL cli_dfs_rename(struct cli_client* cluster, int *server,
                        if (rebuild_filename(referral_fname, cluster->cli[*server], fname_src, dinfo.path_consumed) == NULL)
                                return False;
                        fname_src = referral_fname;
-                       DEBUG(3,("cli_dfs_rename: Dfs rename %s to %s on server %s(%d)\n",
-                               fname_src, fname_dst, cli_state_get_host(cluster->cli[*server]), *server));
-                       cli_rename(cluster->cli[*server], fname_src, fname_dst);
+                       DEBUG(3,("smbcli_dfs_rename: Dfs rename %s to %s on server %s(%d)\n",
+                               fname_src, fname_dst, smbcli_state_get_host(cluster->cli[*server]), *server));
+                       smbcli_rename(cluster->cli[*server], fname_src, fname_dst);
                }
-               if (cli_is_error(cluster->cli[*server])) {
-                       printf("cli_dfs_rename: rename of %s to %s failed (%s)\n",
-                               fname_src, fname_dst, cli_errstr(cluster->cli[*server]));
+               if (smbcli_is_error(cluster->cli[*server])) {
+                       printf("smbcli_dfs_rename: rename of %s to %s failed (%s)\n",
+                               fname_src, fname_dst, smbcli_errstr(cluster->cli[*server]));
                        return False;
                }
        }
@@ -471,24 +471,24 @@ BOOL cli_dfs_rename(struct cli_client* cluster, int *server,
  Make directory (allowing for Dfs referral).
 ****************************************************************************/
 
-BOOL cli_dfs_mkdir(struct cli_client* cluster, int *server,
+BOOL smbcli_dfs_mkdir(struct smbcli_client* cluster, int *server,
        char *fname_src)
 {
        int referral_number;
        dfs_info dinfo;
        char *referral_fname;
        
-       DEBUG(3,("cli_dfs_mkdir: mkdir %s on server %s(%d)\n",
-                       fname_src, cli_state_get_host(cluster->cli[*server]), *server));
+       DEBUG(3,("smbcli_dfs_mkdir: mkdir %s on server %s(%d)\n",
+                       fname_src, smbcli_state_get_host(cluster->cli[*server]), *server));
        cluster->cli[*server]->dfs_referral = *server;                  
-       if (!cli_mkdir(cluster->cli[*server], fname_src)) {
-               printf("cli_dfs_mkdir: mkdir of %s failed (%s)\n",
-                               fname_src, cli_errstr(cluster->cli[*server]));
-               if (cli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
+       if (!smbcli_mkdir(cluster->cli[*server], fname_src)) {
+               printf("smbcli_dfs_mkdir: mkdir of %s failed (%s)\n",
+                               fname_src, smbcli_errstr(cluster->cli[*server]));
+               if (smbcli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
                        // choose referral, check if already connected, open if not
                        referral_number = dinfo.selected_referral;
-                       DEBUG(3,("cli_dfs_mkdir: redirecting to %s\n", dinfo.referrals[referral_number].node));
-                       cluster->cli[*server]->dfs_referral = cli_dfs_open_connection(cluster,
+                       DEBUG(3,("smbcli_dfs_mkdir: redirecting to %s\n", dinfo.referrals[referral_number].node));
+                       cluster->cli[*server]->dfs_referral = smbcli_dfs_open_connection(cluster,
                                dinfo.referrals[referral_number].host,
                                dinfo.referrals[referral_number].share,
                                cluster->connection_flags);
@@ -499,13 +499,13 @@ BOOL cli_dfs_mkdir(struct cli_client* cluster, int *server,
                        if (rebuild_filename(referral_fname, cluster->cli[*server], fname_src, dinfo.path_consumed) == NULL)
                                return False;
                        fname_src = referral_fname;
-                       DEBUG(3,("cli_dfs_mkdir: Dfs mkdir %s on server %s(%d)\n",
-                               fname_src, cli_state_get_host(cluster->cli[*server]), *server));
-                       cli_mkdir(cluster->cli[*server], fname_src);
+                       DEBUG(3,("smbcli_dfs_mkdir: Dfs mkdir %s on server %s(%d)\n",
+                               fname_src, smbcli_state_get_host(cluster->cli[*server]), *server));
+                       smbcli_mkdir(cluster->cli[*server], fname_src);
                }
-               if (cli_is_error(cluster->cli[*server])) {
-                       printf("cli_dfs_mkdir: mkdir of %s failed (%s)\n",
-                               fname_src, cli_errstr(cluster->cli[*server]));
+               if (smbcli_is_error(cluster->cli[*server])) {
+                       printf("smbcli_dfs_mkdir: mkdir of %s failed (%s)\n",
+                               fname_src, smbcli_errstr(cluster->cli[*server]));
                        return False;
                }
        }
@@ -516,24 +516,24 @@ BOOL cli_dfs_mkdir(struct cli_client* cluster, int *server,
  Remove directory (allowing for Dfs referral).
 ****************************************************************************/
 
-BOOL cli_dfs_rmdir(struct cli_client* cluster, int *server,
+BOOL smbcli_dfs_rmdir(struct smbcli_client* cluster, int *server,
        char *fname_src)
 {
        int referral_number;
        dfs_info dinfo;
        char *referral_fname;
        
-       DEBUG(3,("cli_dfs_rmdir: rmdir %s on server %s(%d)\n",
-                       fname_src, cli_state_get_host(cluster->cli[*server]), *server));
+       DEBUG(3,("smbcli_dfs_rmdir: rmdir %s on server %s(%d)\n",
+                       fname_src, smbcli_state_get_host(cluster->cli[*server]), *server));
        cluster->cli[*server]->dfs_referral = *server;                  
-       if (!cli_rmdir(cluster->cli[*server], fname_src)) {
-               printf("cli_dfs_rmdir: rmdir of %s failed (%s)\n",
-                               fname_src, cli_errstr(cluster->cli[*server]));
-               if (cli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
+       if (!smbcli_rmdir(cluster->cli[*server], fname_src)) {
+               printf("smbcli_dfs_rmdir: rmdir of %s failed (%s)\n",
+                               fname_src, smbcli_errstr(cluster->cli[*server]));
+               if (smbcli_check_dfs_redirect(cluster->cli[*server], fname_src, &dinfo)) {
                        // choose referral, check if already connected, open if not
                        referral_number = dinfo.selected_referral;
-                       DEBUG(3,("cli_dfs_rmdir: redirecting to %s\n", dinfo.referrals[referral_number].node));
-                       cluster->cli[*server]->dfs_referral = cli_dfs_open_connection(cluster,
+                       DEBUG(3,("smbcli_dfs_rmdir: redirecting to %s\n", dinfo.referrals[referral_number].node));
+                       cluster->cli[*server]->dfs_referral = smbcli_dfs_open_connection(cluster,
                                dinfo.referrals[referral_number].host,
                                dinfo.referrals[referral_number].share,
                                cluster->connection_flags);
@@ -544,13 +544,13 @@ BOOL cli_dfs_rmdir(struct cli_client* cluster, int *server,
                        if (rebuild_filename(referral_fname, cluster->cli[*server], fname_src, dinfo.path_consumed) == NULL)
                                return False;
                        fname_src = referral_fname;
-                       DEBUG(3,("cli_dfs_rmdir: Dfs rmdir %s on server %s(%d)\n",
-                               fname_src, cli_state_get_host(cluster->cli[*server]), *server));
-                       cli_rmdir(cluster->cli[*server], fname_src);
+                       DEBUG(3,("smbcli_dfs_rmdir: Dfs rmdir %s on server %s(%d)\n",
+                               fname_src, smbcli_state_get_host(cluster->cli[*server]), *server));
+                       smbcli_rmdir(cluster->cli[*server], fname_src);
                }
-               if (cli_is_error(cluster->cli[*server])) {
-                       printf("cli_dfs_rmdir: rmdir of %s failed (%s)\n",
-                               fname_src, cli_errstr(cluster->cli[*server]));
+               if (smbcli_is_error(cluster->cli[*server])) {
+                       printf("smbcli_dfs_rmdir: rmdir of %s failed (%s)\n",
+                               fname_src, smbcli_errstr(cluster->cli[*server]));
                        return False;
                }
        }
index b3acb9136a4b87f50efe278858cce692937fc19a..d3ebe0bf722a9d9f2ddd9e6617f45ad9cc6b00e7 100644 (file)
@@ -26,7 +26,7 @@
  Hard/Symlink a file (UNIX extensions).
 ****************************************************************************/
 
-static NTSTATUS cli_link_internal(struct cli_tree *tree, 
+static NTSTATUS smbcli_link_internal(struct smbcli_tree *tree, 
                                  const char *fname_src, 
                                  const char *fname_dst, BOOL hard_link)
 {
@@ -79,26 +79,26 @@ static uint32_t unix_perms_to_wire(mode_t perms)
 /****************************************************************************
  Symlink a file (UNIX extensions).
 ****************************************************************************/
-NTSTATUS cli_unix_symlink(struct cli_tree *tree, const char *fname_src, 
+NTSTATUS smbcli_unix_symlink(struct smbcli_tree *tree, const char *fname_src, 
                          const char *fname_dst)
 {
-       return cli_link_internal(tree, fname_src, fname_dst, False);
+       return smbcli_link_internal(tree, fname_src, fname_dst, False);
 }
 
 /****************************************************************************
  Hard a file (UNIX extensions).
 ****************************************************************************/
-NTSTATUS cli_unix_hardlink(struct cli_tree *tree, const char *fname_src, 
+NTSTATUS smbcli_unix_hardlink(struct smbcli_tree *tree, const char *fname_src, 
                           const char *fname_dst)
 {
-       return cli_link_internal(tree, fname_src, fname_dst, True);
+       return smbcli_link_internal(tree, fname_src, fname_dst, True);
 }
 
 
 /****************************************************************************
  Chmod or chown a file internal (UNIX extensions).
 ****************************************************************************/
-static NTSTATUS cli_unix_chmod_chown_internal(struct cli_tree *tree, 
+static NTSTATUS smbcli_unix_chmod_chown_internal(struct smbcli_tree *tree, 
                                              const char *fname, 
                                              uint32_t mode, uint32_t uid, 
                                              uint32_t gid)
@@ -121,9 +121,9 @@ static NTSTATUS cli_unix_chmod_chown_internal(struct cli_tree *tree,
  chmod a file (UNIX extensions).
 ****************************************************************************/
 
-NTSTATUS cli_unix_chmod(struct cli_tree *tree, const char *fname, mode_t mode)
+NTSTATUS smbcli_unix_chmod(struct smbcli_tree *tree, const char *fname, mode_t mode)
 {
-       return cli_unix_chmod_chown_internal(tree, fname, 
+       return smbcli_unix_chmod_chown_internal(tree, fname, 
                                             unix_perms_to_wire(mode), 
                                             SMB_UID_NO_CHANGE, 
                                             SMB_GID_NO_CHANGE);
@@ -132,10 +132,10 @@ NTSTATUS cli_unix_chmod(struct cli_tree *tree, const char *fname, mode_t mode)
 /****************************************************************************
  chown a file (UNIX extensions).
 ****************************************************************************/
-NTSTATUS cli_unix_chown(struct cli_tree *tree, const char *fname, uid_t uid, 
+NTSTATUS smbcli_unix_chown(struct smbcli_tree *tree, const char *fname, uid_t uid, 
                        gid_t gid)
 {
-       return cli_unix_chmod_chown_internal(tree, fname, SMB_MODE_NO_CHANGE, 
+       return smbcli_unix_chmod_chown_internal(tree, fname, SMB_MODE_NO_CHANGE, 
                                             (uint32_t)uid, (uint32_t)gid);
 }
 
@@ -143,7 +143,7 @@ NTSTATUS cli_unix_chown(struct cli_tree *tree, const char *fname, uid_t uid,
 /****************************************************************************
  Rename a file.
 ****************************************************************************/
-NTSTATUS cli_rename(struct cli_tree *tree, const char *fname_src, 
+NTSTATUS smbcli_rename(struct smbcli_tree *tree, const char *fname_src, 
                    const char *fname_dst)
 {
        union smb_rename parms;
@@ -160,7 +160,7 @@ NTSTATUS cli_rename(struct cli_tree *tree, const char *fname_src,
 /****************************************************************************
  Delete a file.
 ****************************************************************************/
-NTSTATUS cli_unlink(struct cli_tree *tree, const char *fname)
+NTSTATUS smbcli_unlink(struct smbcli_tree *tree, const char *fname)
 {
        struct smb_unlink parms;
 
@@ -177,7 +177,7 @@ NTSTATUS cli_unlink(struct cli_tree *tree, const char *fname)
 /****************************************************************************
  Create a directory.
 ****************************************************************************/
-NTSTATUS cli_mkdir(struct cli_tree *tree, const char *dname)
+NTSTATUS smbcli_mkdir(struct smbcli_tree *tree, const char *dname)
 {
        union smb_mkdir parms;
 
@@ -191,7 +191,7 @@ NTSTATUS cli_mkdir(struct cli_tree *tree, const char *dname)
 /****************************************************************************
  Remove a directory.
 ****************************************************************************/
-NTSTATUS cli_rmdir(struct cli_tree *tree, const char *dname)
+NTSTATUS smbcli_rmdir(struct smbcli_tree *tree, const char *dname)
 {
        struct smb_rmdir parms;
 
@@ -204,7 +204,7 @@ NTSTATUS cli_rmdir(struct cli_tree *tree, const char *dname)
 /****************************************************************************
  Set or clear the delete on close flag.
 ****************************************************************************/
-NTSTATUS cli_nt_delete_on_close(struct cli_tree *tree, int fnum, BOOL flag)
+NTSTATUS smbcli_nt_delete_on_close(struct smbcli_tree *tree, int fnum, BOOL flag)
 {
        union smb_setfileinfo parms;
        NTSTATUS status;
@@ -223,7 +223,7 @@ NTSTATUS cli_nt_delete_on_close(struct cli_tree *tree, int fnum, BOOL flag)
  Create/open a file - exposing the full horror of the NT API :-).
  Used in CIFS-on-CIFS NTVFS.
 ****************************************************************************/
-int cli_nt_create_full(struct cli_tree *tree, const char *fname,
+int smbcli_nt_create_full(struct smbcli_tree *tree, const char *fname,
                       uint32_t CreatFlags, uint32_t DesiredAccess,
                       uint32_t FileAttributes, uint32_t ShareAccess,
                       uint32_t CreateDisposition, uint32_t CreateOptions,
@@ -264,7 +264,7 @@ int cli_nt_create_full(struct cli_tree *tree, const char *fname,
  Open a file (using SMBopenx)
  WARNING: if you open with O_WRONLY then getattrE won't work!
 ****************************************************************************/
-int cli_open(struct cli_tree *tree, const char *fname, int flags, 
+int smbcli_open(struct smbcli_tree *tree, const char *fname, int flags, 
             int share_mode)
 {
        union smb_open open_parms;
@@ -330,7 +330,7 @@ int cli_open(struct cli_tree *tree, const char *fname, int flags,
 /****************************************************************************
  Close a file.
 ****************************************************************************/
-NTSTATUS cli_close(struct cli_tree *tree, int fnum)
+NTSTATUS smbcli_close(struct smbcli_tree *tree, int fnum)
 {
        union smb_close close_parms;
        NTSTATUS status;
@@ -346,7 +346,7 @@ NTSTATUS cli_close(struct cli_tree *tree, int fnum)
  send a lock with a specified locktype 
  this is used for testing LOCKING_ANDX_CANCEL_LOCK
 ****************************************************************************/
-NTSTATUS cli_locktype(struct cli_tree *tree, int fnum, 
+NTSTATUS smbcli_locktype(struct smbcli_tree *tree, int fnum, 
                      uint32_t offset, uint32_t len, int timeout, 
                      uint8_t locktype)
 {
@@ -374,7 +374,7 @@ NTSTATUS cli_locktype(struct cli_tree *tree, int fnum,
 /****************************************************************************
  Lock a file.
 ****************************************************************************/
-NTSTATUS cli_lock(struct cli_tree *tree, int fnum, 
+NTSTATUS smbcli_lock(struct smbcli_tree *tree, int fnum, 
                  uint32_t offset, uint32_t len, int timeout, 
                  enum brl_type lock_type)
 {
@@ -402,7 +402,7 @@ NTSTATUS cli_lock(struct cli_tree *tree, int fnum,
 /****************************************************************************
  Unlock a file.
 ****************************************************************************/
-NTSTATUS cli_unlock(struct cli_tree *tree, int fnum, uint32_t offset, uint32_t len)
+NTSTATUS smbcli_unlock(struct smbcli_tree *tree, int fnum, uint32_t offset, uint32_t len)
 {
        union smb_lock parms;
        struct smb_lock_entry lock[1];
@@ -427,7 +427,7 @@ NTSTATUS cli_unlock(struct cli_tree *tree, int fnum, uint32_t offset, uint32_t l
 /****************************************************************************
  Lock a file with 64 bit offsets.
 ****************************************************************************/
-NTSTATUS cli_lock64(struct cli_tree *tree, int fnum, 
+NTSTATUS smbcli_lock64(struct smbcli_tree *tree, int fnum, 
                    SMB_OFF_T offset, SMB_OFF_T len, int timeout, 
                    enum brl_type lock_type)
 {
@@ -437,7 +437,7 @@ NTSTATUS cli_lock64(struct cli_tree *tree, int fnum,
        NTSTATUS status;
 
        if (!(tree->session->transport->negotiate.capabilities & CAP_LARGE_FILES)) {
-               return cli_lock(tree, fnum, offset, len, timeout, lock_type);
+               return smbcli_lock(tree, fnum, offset, len, timeout, lock_type);
        }
 
        parms.lockx.level = RAW_LOCK_LOCKX;
@@ -463,7 +463,7 @@ NTSTATUS cli_lock64(struct cli_tree *tree, int fnum,
 /****************************************************************************
  Unlock a file with 64 bit offsets.
 ****************************************************************************/
-NTSTATUS cli_unlock64(struct cli_tree *tree, int fnum, SMB_OFF_T offset, 
+NTSTATUS smbcli_unlock64(struct smbcli_tree *tree, int fnum, SMB_OFF_T offset, 
                      SMB_OFF_T len)
 {
        union smb_lock parms;
@@ -471,7 +471,7 @@ NTSTATUS cli_unlock64(struct cli_tree *tree, int fnum, SMB_OFF_T offset,
        NTSTATUS status;
 
        if (!(tree->session->transport->negotiate.capabilities & CAP_LARGE_FILES)) {
-               return cli_unlock(tree, fnum, offset, len);
+               return smbcli_unlock(tree, fnum, offset, len);
        }
 
        parms.lockx.level = RAW_LOCK_LOCKX;
@@ -494,7 +494,7 @@ NTSTATUS cli_unlock64(struct cli_tree *tree, int fnum, SMB_OFF_T offset,
 /****************************************************************************
  Do a SMBgetattrE call.
 ****************************************************************************/
-NTSTATUS cli_getattrE(struct cli_tree *tree, int fnum,
+NTSTATUS smbcli_getattrE(struct smbcli_tree *tree, int fnum,
                      uint16_t *attr, size_t *size,
                      time_t *c_time, time_t *a_time, time_t *m_time)
 {              
@@ -535,7 +535,7 @@ NTSTATUS cli_getattrE(struct cli_tree *tree, int fnum,
 /****************************************************************************
  Do a SMBgetatr call
 ****************************************************************************/
-NTSTATUS cli_getatr(struct cli_tree *tree, const char *fname, 
+NTSTATUS smbcli_getatr(struct smbcli_tree *tree, const char *fname, 
                    uint16_t *attr, size_t *size, time_t *t)
 {
        union smb_fileinfo parms;
@@ -569,7 +569,7 @@ NTSTATUS cli_getatr(struct cli_tree *tree, const char *fname,
 /****************************************************************************
  Do a SMBsetatr call.
 ****************************************************************************/
-NTSTATUS cli_setatr(struct cli_tree *tree, const char *fname, uint16_t mode, 
+NTSTATUS smbcli_setatr(struct smbcli_tree *tree, const char *fname, uint16_t mode, 
                    time_t t)
 {
        union smb_setfileinfo parms;
@@ -589,7 +589,7 @@ NTSTATUS cli_setatr(struct cli_tree *tree, const char *fname, uint16_t mode,
 /****************************************************************************
  Check for existence of a dir.
 ****************************************************************************/
-NTSTATUS cli_chkpath(struct cli_tree *tree, const char *path)
+NTSTATUS smbcli_chkpath(struct smbcli_tree *tree, const char *path)
 {
        struct smb_chkpath parms;
        char *path2;
@@ -615,13 +615,13 @@ NTSTATUS cli_chkpath(struct cli_tree *tree, const char *path)
 /****************************************************************************
  Query disk space.
 ****************************************************************************/
-NTSTATUS cli_dskattr(struct cli_tree *tree, int *bsize, int *total, int *avail)
+NTSTATUS smbcli_dskattr(struct smbcli_tree *tree, int *bsize, int *total, int *avail)
 {
        union smb_fsinfo fsinfo_parms;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
-       mem_ctx = talloc_init("cli_dskattr");
+       mem_ctx = talloc_init("smbcli_dskattr");
 
        fsinfo_parms.dskattr.level = RAW_QFS_DSKATTR;
        status = smb_raw_fsinfo(tree, mem_ctx, &fsinfo_parms);
@@ -640,7 +640,7 @@ NTSTATUS cli_dskattr(struct cli_tree *tree, int *bsize, int *total, int *avail)
 /****************************************************************************
  Create and open a temporary file.
 ****************************************************************************/
-int cli_ctemp(struct cli_tree *tree, const char *path, char **tmp_path)
+int smbcli_ctemp(struct smbcli_tree *tree, const char *path, char **tmp_path)
 {
        union smb_open open_parms;
        TALLOC_CTX *mem_ctx;
index 7dac7399a7051ed6a104293699221b0d1cbc4586..e2c267cc965f5c97a9a15c2ced8473d0c2fb5de6 100644 (file)
@@ -77,7 +77,7 @@ static BOOL interpret_long_filename(enum smb_search_level level,
 }
 
 /* callback function used for trans2 search */
-static BOOL cli_list_new_callback(void *private, union smb_search_data *file)
+static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file)
 {
        struct search_private *state = (struct search_private*) private;
        file_info *tdl;
@@ -101,7 +101,7 @@ static BOOL cli_list_new_callback(void *private, union smb_search_data *file)
        return True;
 }
 
-int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, 
+int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, 
                 void (*fn)(file_info *, const char *, void *), 
                 void *caller_state)
 {
@@ -118,7 +118,7 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute,
 
        /* initialize state for search */
        state.dirlist = NULL;
-       state.mem_ctx = talloc_init("cli_list_new");
+       state.mem_ctx = talloc_init("smbcli_list_new");
        state.dirlist_len = 0;
        state.total_received = 0;
        
@@ -144,7 +144,7 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute,
                        
                        status = smb_raw_search_first(tree, 
                                                      state.mem_ctx, &first_parms,
-                                                     (void*)&state, cli_list_new_callback);
+                                                     (void*)&state, smbcli_list_new_callback);
                        if (!NT_STATUS_IS_OK(status)) {
                                talloc_destroy(state.mem_ctx);
                                return -1;
@@ -172,7 +172,7 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute,
                                                     state.mem_ctx,
                                                     &next_parms,
                                                     (void*)&state, 
-                                                    cli_list_new_callback);
+                                                    smbcli_list_new_callback);
                        
                        if (!NT_STATUS_IS_OK(status)) {
                                return -1;
@@ -219,7 +219,7 @@ static BOOL interpret_short_filename(int level,
 }
 
 /* callback function used for smb_search */
-static BOOL cli_list_old_callback(void *private, union smb_search_data *file)
+static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file)
 {
        struct search_private *state = (struct search_private*) private;
        file_info *tdl;
@@ -243,7 +243,7 @@ static BOOL cli_list_old_callback(void *private, union smb_search_data *file)
        return True;
 }
 
-int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute, 
+int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, 
                 void (*fn)(file_info *, const char *, void *), 
                 void *caller_state)
 {
@@ -259,7 +259,7 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute,
 
        /* initialize state for search */
        state.dirlist = NULL;
-       state.mem_ctx = talloc_init("cli_list_old");
+       state.mem_ctx = talloc_init("smbcli_list_old");
        state.dirlist_len = 0;
        state.total_received = 0;
        
@@ -278,7 +278,7 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute,
                        status = smb_raw_search_first(tree, state.mem_ctx, 
                                                      &first_parms,
                                                      (void*)&state, 
-                                                     cli_list_old_callback);
+                                                     smbcli_list_old_callback);
 
                        if (!NT_STATUS_IS_OK(status)) {
                                talloc_destroy(state.mem_ctx);
@@ -299,7 +299,7 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute,
                        status = smb_raw_search_next(tree, state.mem_ctx,
                                                     &next_parms,
                                                     (void*)&state, 
-                                                    cli_list_old_callback);
+                                                    smbcli_list_old_callback);
                        
                        if (!NT_STATUS_IS_OK(status)) {
                                talloc_destroy(state.mem_ctx);
@@ -326,10 +326,10 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute,
  This auto-switches between old and new style.
 ****************************************************************************/
 
-int cli_list(struct cli_tree *tree, const char *Mask,uint16_t attribute, 
+int smbcli_list(struct smbcli_tree *tree, const char *Mask,uint16_t attribute, 
             void (*fn)(file_info *, const char *, void *), void *state)
 {
        if (tree->session->transport->negotiate.protocol <= PROTOCOL_LANMAN1)
-               return cli_list_old(tree, Mask, attribute, fn, state);
-       return cli_list_new(tree, Mask, attribute, fn, state);
+               return smbcli_list_old(tree, Mask, attribute, fn, state);
+       return smbcli_list_new(tree, Mask, attribute, fn, state);
 }
index 6470f4c154b400045bd971da7be03d47c1857007..dde512159e0a594b09fd06a76cbb95d3acc5d574 100644 (file)
 /****************************************************************************
 start a message sequence
 ****************************************************************************/
-BOOL cli_message_start(struct cli_tree *tree, char *host, char *username, 
+BOOL smbcli_message_start(struct smbcli_tree *tree, char *host, char *username, 
                       int *grp)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
        
-       req = cli_request_setup(tree, SMBsendstrt, 0, 0);
-       cli_req_append_string(req, username, STR_TERMINATE);
-       cli_req_append_string(req, host, STR_TERMINATE);
-       if (!cli_request_send(req) || 
-           !cli_request_receive(req) ||
-           cli_is_error(tree)) {
-               cli_request_destroy(req);
+       req = smbcli_request_setup(tree, SMBsendstrt, 0, 0);
+       smbcli_req_append_string(req, username, STR_TERMINATE);
+       smbcli_req_append_string(req, host, STR_TERMINATE);
+       if (!smbcli_request_send(req) || 
+           !smbcli_request_receive(req) ||
+           smbcli_is_error(tree)) {
+               smbcli_request_destroy(req);
                return False;
        }
 
        *grp = SVAL(req->in.vwv, VWV(0));
-       cli_request_destroy(req);
+       smbcli_request_destroy(req);
 
        return True;
 }
@@ -50,44 +50,44 @@ BOOL cli_message_start(struct cli_tree *tree, char *host, char *username,
 /****************************************************************************
 send a message 
 ****************************************************************************/
-BOOL cli_message_text(struct cli_tree *tree, char *msg, int len, int grp)
+BOOL smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
        
-       req = cli_request_setup(tree, SMBsendtxt, 1, 0);
+       req = smbcli_request_setup(tree, SMBsendtxt, 1, 0);
        SSVAL(req->out.vwv, VWV(0), grp);
 
-       cli_req_append_bytes(req, msg, len);
+       smbcli_req_append_bytes(req, msg, len);
 
-       if (!cli_request_send(req) || 
-           !cli_request_receive(req) ||
-           cli_is_error(tree)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req) || 
+           !smbcli_request_receive(req) ||
+           smbcli_is_error(tree)) {
+               smbcli_request_destroy(req);
                return False;
        }
 
-       cli_request_destroy(req);
+       smbcli_request_destroy(req);
        return True;
 }      
 
 /****************************************************************************
 end a message 
 ****************************************************************************/
-BOOL cli_message_end(struct cli_tree *tree, int grp)
+BOOL smbcli_message_end(struct smbcli_tree *tree, int grp)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
        
-       req = cli_request_setup(tree, SMBsendend, 1, 0);
+       req = smbcli_request_setup(tree, SMBsendend, 1, 0);
        SSVAL(req->out.vwv, VWV(0), grp);
 
-       if (!cli_request_send(req) || 
-           !cli_request_receive(req) ||
-           cli_is_error(tree)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req) || 
+           !smbcli_request_receive(req) ||
+           smbcli_is_error(tree)) {
+               smbcli_request_destroy(req);
                return False;
        }
 
-       cli_request_destroy(req);
+       smbcli_request_destroy(req);
        return True;
 }      
 
index e9c8b80c4f3dd0bb2c87a8c290f11b7a879e0e4f..dd9f8d44cc3e4287f3e5e832365d6d6251613170 100644 (file)
@@ -24,7 +24,7 @@
 /****************************************************************************
   Read size bytes at offset offset using SMBreadX.
 ****************************************************************************/
-ssize_t cli_read(struct cli_tree *tree, int fnum, char *buf, off_t offset, 
+ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, char *buf, off_t offset, 
                 size_t size)
 {
        union smb_read parms;
@@ -82,7 +82,7 @@ ssize_t cli_read(struct cli_tree *tree, int fnum, char *buf, off_t offset,
               0x0004 use raw named pipe protocol
               0x0008 start of message mode named pipe protocol
 ****************************************************************************/
-ssize_t cli_write(struct cli_tree *tree,
+ssize_t smbcli_write(struct smbcli_tree *tree,
                  int fnum, uint16_t write_mode,
                  const char *buf, off_t offset, size_t size)
 {
@@ -128,7 +128,7 @@ ssize_t cli_write(struct cli_tree *tree,
 /****************************************************************************
   write to a file using a SMBwrite and not bypassing 0 byte writes
 ****************************************************************************/
-ssize_t cli_smbwrite(struct cli_tree *tree,
+ssize_t smbcli_smbwrite(struct smbcli_tree *tree,
                     int fnum, char *buf, off_t offset, size_t size1)
 {
        union smb_write parms;
index 7f3ec0f6bf1954a48ebe60fec0a0e4dd2b5f41e2..4c8b49fc675ef4ef21e5379e4b0cef249a4cca7d 100644 (file)
@@ -24,7 +24,7 @@
 /****************************************************************************
   query the security descriptor for a open file
  ****************************************************************************/
-SEC_DESC *cli_query_secdesc(struct cli_tree *tree, int fnum, 
+SEC_DESC *smbcli_query_secdesc(struct smbcli_tree *tree, int fnum, 
                            TALLOC_CTX *mem_ctx)
 {
        struct smb_nttrans parms;
@@ -72,7 +72,7 @@ SEC_DESC *cli_query_secdesc(struct cli_tree *tree, int fnum,
 /****************************************************************************
   set the security descriptor for a open file
  ****************************************************************************/
-BOOL cli_set_secdesc(struct cli_tree *tree, int fnum, SEC_DESC *sd)
+BOOL smbcli_set_secdesc(struct smbcli_tree *tree, int fnum, SEC_DESC *sd)
 {
        struct smb_nttrans parms;
        char param[8];
@@ -82,7 +82,7 @@ BOOL cli_set_secdesc(struct cli_tree *tree, int fnum, SEC_DESC *sd)
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
-       mem_ctx = talloc_init("cli_set_secdesc");
+       mem_ctx = talloc_init("smbcli_set_secdesc");
 
        prs_init(&pd, 0, mem_ctx, MARSHALL);
        prs_give_memory(&pd, NULL, 0, True);
index a83660685b8dd285e53012489b88c169c51854e1..7a37df6e1fe6620b9b9671591b29c40cdaf74957 100644 (file)
@@ -23,7 +23,7 @@
 /****************************************************************************
 send a qpathinfo call
 ****************************************************************************/
-NTSTATUS cli_qpathinfo(struct cli_tree *tree, const char *fname, 
+NTSTATUS smbcli_qpathinfo(struct smbcli_tree *tree, const char *fname, 
                       time_t *c_time, time_t *a_time, time_t *m_time, 
                       size_t *size, uint16_t *mode)
 {
@@ -31,7 +31,7 @@ NTSTATUS cli_qpathinfo(struct cli_tree *tree, const char *fname,
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
-       mem_ctx = talloc_init("cli_qpathinfo");
+       mem_ctx = talloc_init("smbcli_qpathinfo");
        if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        parms.standard.level = RAW_FILEINFO_STANDARD;
@@ -64,7 +64,7 @@ NTSTATUS cli_qpathinfo(struct cli_tree *tree, const char *fname,
 /****************************************************************************
 send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level
 ****************************************************************************/
-NTSTATUS cli_qpathinfo2(struct cli_tree *tree, const char *fname, 
+NTSTATUS smbcli_qpathinfo2(struct smbcli_tree *tree, const char *fname, 
                        time_t *c_time, time_t *a_time, time_t *m_time, 
                        time_t *w_time, size_t *size, uint16_t *mode,
                        SMB_INO_T *ino)
@@ -73,7 +73,7 @@ NTSTATUS cli_qpathinfo2(struct cli_tree *tree, const char *fname,
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
-       mem_ctx = talloc_init("cli_qfilename");
+       mem_ctx = talloc_init("smbcli_qfilename");
        if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        parms.all_info.level = RAW_FILEINFO_ALL_INFO;
@@ -110,13 +110,13 @@ NTSTATUS cli_qpathinfo2(struct cli_tree *tree, const char *fname,
 /****************************************************************************
 send a qfileinfo QUERY_FILE_NAME_INFO call
 ****************************************************************************/
-NTSTATUS cli_qfilename(struct cli_tree *tree, int fnum, const char **name)
+NTSTATUS smbcli_qfilename(struct smbcli_tree *tree, int fnum, const char **name)
 {
        union smb_fileinfo parms;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
-       mem_ctx = talloc_init("cli_qfilename");
+       mem_ctx = talloc_init("smbcli_qfilename");
        if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        parms.name_info.level = RAW_FILEINFO_NAME_INFO;
@@ -140,7 +140,7 @@ NTSTATUS cli_qfilename(struct cli_tree *tree, int fnum, const char **name)
 /****************************************************************************
 send a qfileinfo call
 ****************************************************************************/
-NTSTATUS cli_qfileinfo(struct cli_tree *tree, int fnum, 
+NTSTATUS smbcli_qfileinfo(struct smbcli_tree *tree, int fnum, 
                       uint16_t *mode, size_t *size,
                       time_t *c_time, time_t *a_time, time_t *m_time, 
                       time_t *w_time, SMB_INO_T *ino)
@@ -149,7 +149,7 @@ NTSTATUS cli_qfileinfo(struct cli_tree *tree, int fnum,
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
-       mem_ctx = talloc_init("cli_qfileinfo");
+       mem_ctx = talloc_init("smbcli_qfileinfo");
        if (!mem_ctx) 
                return NT_STATUS_NO_MEMORY;
 
@@ -191,7 +191,7 @@ NTSTATUS cli_qfileinfo(struct cli_tree *tree, int fnum,
 /****************************************************************************
 send a qpathinfo SMB_QUERY_FILE_ALT_NAME_INFO call
 ****************************************************************************/
-NTSTATUS cli_qpathinfo_alt_name(struct cli_tree *tree, const char *fname, 
+NTSTATUS smbcli_qpathinfo_alt_name(struct smbcli_tree *tree, const char *fname, 
                                const char **alt_name)
 {
        union smb_fileinfo parms;
@@ -201,14 +201,14 @@ NTSTATUS cli_qpathinfo_alt_name(struct cli_tree *tree, const char *fname,
        parms.alt_name_info.level = RAW_FILEINFO_ALT_NAME_INFO;
        parms.alt_name_info.in.fname = fname;
 
-       mem_ctx = talloc_init("cli_qpathinfo_alt_name");
+       mem_ctx = talloc_init("smbcli_qpathinfo_alt_name");
        if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        status = smb_raw_pathinfo(tree, mem_ctx, &parms);
        if (!NT_STATUS_IS_OK(status)) {
                talloc_destroy(mem_ctx);
                *alt_name = NULL;
-               return cli_nt_error(tree);
+               return smbcli_nt_error(tree);
        }
 
        if (!parms.alt_name_info.out.fname.s) {
index ffc64139e9b5ee9506bbc32c3f7ad4ffbb553a63..16e5282497b9600945d8c0b2e4fc5f2dea518cd5 100644 (file)
@@ -90,7 +90,7 @@ done:
        /* We have the netbios name and IP address of a domain controller.
           Ideally we should sent a SAMLOGON request to determine whether
           the DC is alive and kicking.  If we can catch a dead DC before
-          performing a cli_connect() we can avoid a 30-second timeout. */
+          performing a smbcli_connect() we can avoid a 30-second timeout. */
 
        DEBUG(3, ("rpc_find_dc: Returning DC %s (%s) for domain %s\n", srv_name,
                  inet_ntoa(dc_ip), domain));
index 29e44fc940fb3fa406685c9a4f94379bbe486dad..6ae21a08f46c7479f303256f9dca0e6766da996a 100644 (file)
 /****************************************************************************
 send an ack for an oplock break request
 ****************************************************************************/
-BOOL cli_oplock_ack(struct cli_tree *tree, uint16_t fnum, uint16_t ack_level)
+BOOL smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_t ack_level)
 {
        BOOL ret;
-       struct cli_request *req;
+       struct smbcli_request *req;
 
-       req = cli_request_setup(tree, SMBlockingX, 8, 0);
+       req = smbcli_request_setup(tree, SMBlockingX, 8, 0);
 
        SSVAL(req->out.vwv,VWV(0),0xFF);
        SSVAL(req->out.vwv,VWV(1),0);
@@ -43,7 +43,7 @@ BOOL cli_oplock_ack(struct cli_tree *tree, uint16_t fnum, uint16_t ack_level)
           subsystem not to allocate an id for a reply */
        req->one_way_request = 1;
 
-       ret = cli_request_send(req);    
+       ret = smbcli_request_send(req); 
 
        return ret;
 }
@@ -52,8 +52,8 @@ BOOL cli_oplock_ack(struct cli_tree *tree, uint16_t fnum, uint16_t ack_level)
 /****************************************************************************
 set the oplock handler for a connection
 ****************************************************************************/
-void cli_oplock_handler(struct cli_transport *transport, 
-                       BOOL (*handler)(struct cli_transport *, uint16_t, uint16_t, uint8_t, void *),
+void smbcli_oplock_handler(struct smbcli_transport *transport, 
+                       BOOL (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *),
                        void *private)
 {
        transport->oplock.handler = handler;
index d5373bc76f11852942268d1e093985a773caa755..b32d59f340a2db8208d94d11ef4086d4d73c97a1 100644 (file)
 #include "includes.h"
 
 #define SETUP_REQUEST_SESSION(cmd, wct, buflen) do { \
-       req = cli_request_setup_session(session, cmd, wct, buflen); \
+       req = smbcli_request_setup_session(session, cmd, wct, buflen); \
        if (!req) return NULL; \
 } while (0)
 
 /****************************************************************************
  Initialize the session context
 ****************************************************************************/
-struct cli_session *cli_session_init(struct cli_transport *transport)
+struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport)
 {
-       struct cli_session *session;
-       TALLOC_CTX *mem_ctx = talloc_init("cli_session");
+       struct smbcli_session *session;
+       TALLOC_CTX *mem_ctx = talloc_init("smbcli_session");
        if (mem_ctx == NULL) {
                return NULL;
        }
@@ -55,11 +55,11 @@ struct cli_session *cli_session_init(struct cli_transport *transport)
 /****************************************************************************
 reduce reference_count and destroy is <= 0
 ****************************************************************************/
-void cli_session_close(struct cli_session *session)
+void smbcli_session_close(struct smbcli_session *session)
 {
        session->reference_count--;
        if (session->reference_count <= 0) {
-               cli_transport_close(session->transport);
+               smbcli_transport_close(session->transport);
                talloc_destroy(session->mem_ctx);
        }
 }
@@ -67,9 +67,9 @@ void cli_session_close(struct cli_session *session)
 /****************************************************************************
  Perform a session setup (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_session_setup_send(struct cli_session *session, union smb_sesssetup *parms) 
+struct smbcli_request *smb_raw_session_setup_send(struct smbcli_session *session, union smb_sesssetup *parms) 
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        switch (parms->generic.level) {
        case RAW_SESSSETUP_GENERIC:
@@ -85,11 +85,11 @@ struct cli_request *smb_raw_session_setup_send(struct cli_session *session, unio
                SSVAL(req->out.vwv,VWV(4),parms->old.in.vc_num);
                SIVAL(req->out.vwv,VWV(5),parms->old.in.sesskey);
                SSVAL(req->out.vwv,VWV(7),parms->old.in.password.length);
-               cli_req_append_blob(req, &parms->old.in.password);
-               cli_req_append_string(req, parms->old.in.user, STR_TERMINATE);
-               cli_req_append_string(req, parms->old.in.domain, STR_TERMINATE|STR_UPPER);
-               cli_req_append_string(req, parms->old.in.os, STR_TERMINATE);
-               cli_req_append_string(req, parms->old.in.lanman, STR_TERMINATE);
+               smbcli_req_append_blob(req, &parms->old.in.password);
+               smbcli_req_append_string(req, parms->old.in.user, STR_TERMINATE);
+               smbcli_req_append_string(req, parms->old.in.domain, STR_TERMINATE|STR_UPPER);
+               smbcli_req_append_string(req, parms->old.in.os, STR_TERMINATE);
+               smbcli_req_append_string(req, parms->old.in.lanman, STR_TERMINATE);
                break;
 
        case RAW_SESSSETUP_NT1:
@@ -104,12 +104,12 @@ struct cli_request *smb_raw_session_setup_send(struct cli_session *session, unio
                SSVAL(req->out.vwv, VWV(8), parms->nt1.in.password2.length);
                SIVAL(req->out.vwv, VWV(9), 0); /* reserved */
                SIVAL(req->out.vwv, VWV(11), parms->nt1.in.capabilities);
-               cli_req_append_blob(req, &parms->nt1.in.password1);
-               cli_req_append_blob(req, &parms->nt1.in.password2);
-               cli_req_append_string(req, parms->nt1.in.user, STR_TERMINATE);
-               cli_req_append_string(req, parms->nt1.in.domain, STR_TERMINATE|STR_UPPER);
-               cli_req_append_string(req, parms->nt1.in.os, STR_TERMINATE);
-               cli_req_append_string(req, parms->nt1.in.lanman, STR_TERMINATE);
+               smbcli_req_append_blob(req, &parms->nt1.in.password1);
+               smbcli_req_append_blob(req, &parms->nt1.in.password2);
+               smbcli_req_append_string(req, parms->nt1.in.user, STR_TERMINATE);
+               smbcli_req_append_string(req, parms->nt1.in.domain, STR_TERMINATE|STR_UPPER);
+               smbcli_req_append_string(req, parms->nt1.in.os, STR_TERMINATE);
+               smbcli_req_append_string(req, parms->nt1.in.lanman, STR_TERMINATE);
                break;
 
        case RAW_SESSSETUP_SPNEGO:
@@ -123,15 +123,15 @@ struct cli_request *smb_raw_session_setup_send(struct cli_session *session, unio
                SSVAL(req->out.vwv, VWV(7), parms->spnego.in.secblob.length);
                SIVAL(req->out.vwv, VWV(8), 0); /* reserved */
                SIVAL(req->out.vwv, VWV(10), parms->spnego.in.capabilities);
-               cli_req_append_blob(req, &parms->spnego.in.secblob);
-               cli_req_append_string(req, parms->spnego.in.os, STR_TERMINATE);
-               cli_req_append_string(req, parms->spnego.in.lanman, STR_TERMINATE);
-               cli_req_append_string(req, parms->spnego.in.domain, STR_TERMINATE);
+               smbcli_req_append_blob(req, &parms->spnego.in.secblob);
+               smbcli_req_append_string(req, parms->spnego.in.os, STR_TERMINATE);
+               smbcli_req_append_string(req, parms->spnego.in.lanman, STR_TERMINATE);
+               smbcli_req_append_string(req, parms->spnego.in.domain, STR_TERMINATE);
                break;
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -142,20 +142,20 @@ struct cli_request *smb_raw_session_setup_send(struct cli_session *session, unio
 /****************************************************************************
  Perform a session setup (async recv)
 ****************************************************************************/
-NTSTATUS smb_raw_session_setup_recv(struct cli_request *req, 
+NTSTATUS smb_raw_session_setup_recv(struct smbcli_request *req, 
                                    TALLOC_CTX *mem_ctx, 
                                    union smb_sesssetup *parms) 
 {
        uint16_t len;
        char *p;
 
-       if (!cli_request_receive(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req)) {
+               return smbcli_request_destroy(req);
        }
        
        if (!NT_STATUS_IS_OK(req->status) &&
            !NT_STATUS_EQUAL(req->status,NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-               return cli_request_destroy(req);
+               return smbcli_request_destroy(req);
        }
 
        switch (parms->generic.level) {
@@ -164,35 +164,35 @@ NTSTATUS smb_raw_session_setup_recv(struct cli_request *req,
                return NT_STATUS_INVALID_LEVEL;
 
        case RAW_SESSSETUP_OLD:
-               CLI_CHECK_WCT(req, 3);
+               SMBCLI_CHECK_WCT(req, 3);
                ZERO_STRUCT(parms->old.out);
                parms->old.out.vuid = SVAL(req->in.hdr, HDR_UID);
                parms->old.out.action = SVAL(req->in.vwv, VWV(2));
                p = req->in.data;
                if (p) {
-                       p += cli_req_pull_string(req, mem_ctx, &parms->old.out.os, p, -1, STR_TERMINATE);
-                       p += cli_req_pull_string(req, mem_ctx, &parms->old.out.lanman, p, -1, STR_TERMINATE);
-                       p += cli_req_pull_string(req, mem_ctx, &parms->old.out.domain, p, -1, STR_TERMINATE);
+                       p += smbcli_req_pull_string(req, mem_ctx, &parms->old.out.os, p, -1, STR_TERMINATE);
+                       p += smbcli_req_pull_string(req, mem_ctx, &parms->old.out.lanman, p, -1, STR_TERMINATE);
+                       p += smbcli_req_pull_string(req, mem_ctx, &parms->old.out.domain, p, -1, STR_TERMINATE);
                }
                break;
 
        case RAW_SESSSETUP_NT1:
-               CLI_CHECK_WCT(req, 3);
+               SMBCLI_CHECK_WCT(req, 3);
                ZERO_STRUCT(parms->nt1.out);
                parms->nt1.out.vuid   = SVAL(req->in.hdr, HDR_UID);
                parms->nt1.out.action = SVAL(req->in.vwv, VWV(2));
                p = req->in.data;
                if (p) {
-                       p += cli_req_pull_string(req, mem_ctx, &parms->nt1.out.os, p, -1, STR_TERMINATE);
-                       p += cli_req_pull_string(req, mem_ctx, &parms->nt1.out.lanman, p, -1, STR_TERMINATE);
+                       p += smbcli_req_pull_string(req, mem_ctx, &parms->nt1.out.os, p, -1, STR_TERMINATE);
+                       p += smbcli_req_pull_string(req, mem_ctx, &parms->nt1.out.lanman, p, -1, STR_TERMINATE);
                        if (p < (req->in.data + req->in.data_size)) {
-                               p += cli_req_pull_string(req, mem_ctx, &parms->nt1.out.domain, p, -1, STR_TERMINATE);
+                               p += smbcli_req_pull_string(req, mem_ctx, &parms->nt1.out.domain, p, -1, STR_TERMINATE);
                        }
                }
                break;
 
        case RAW_SESSSETUP_SPNEGO:
-               CLI_CHECK_WCT(req, 4);
+               SMBCLI_CHECK_WCT(req, 4);
                ZERO_STRUCT(parms->spnego.out);
                parms->spnego.out.vuid   = SVAL(req->in.hdr, HDR_UID);
                parms->spnego.out.action = SVAL(req->in.vwv, VWV(2));
@@ -202,16 +202,16 @@ NTSTATUS smb_raw_session_setup_recv(struct cli_request *req,
                        break;
                }
 
-               parms->spnego.out.secblob = cli_req_pull_blob(req, mem_ctx, p, len);
+               parms->spnego.out.secblob = smbcli_req_pull_blob(req, mem_ctx, p, len);
                p += parms->spnego.out.secblob.length;
-               p += cli_req_pull_string(req, mem_ctx, &parms->spnego.out.os, p, -1, STR_TERMINATE);
-               p += cli_req_pull_string(req, mem_ctx, &parms->spnego.out.lanman, p, -1, STR_TERMINATE);
-               p += cli_req_pull_string(req, mem_ctx, &parms->spnego.out.domain, p, -1, STR_TERMINATE);
+               p += smbcli_req_pull_string(req, mem_ctx, &parms->spnego.out.os, p, -1, STR_TERMINATE);
+               p += smbcli_req_pull_string(req, mem_ctx, &parms->spnego.out.lanman, p, -1, STR_TERMINATE);
+               p += smbcli_req_pull_string(req, mem_ctx, &parms->spnego.out.domain, p, -1, STR_TERMINATE);
                break;
        }
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 /*
@@ -239,7 +239,7 @@ static DATA_BLOB nt_blob(const char *pass, DATA_BLOB challenge)
 /*
   store the user session key for a transport
 */
-void cli_session_set_user_session_key(struct cli_session *session,
+void smbcli_session_set_user_session_key(struct smbcli_session *session,
                                   const DATA_BLOB *session_key)
 {
        session->user_session_key = data_blob_talloc(session->mem_ctx, 
@@ -250,19 +250,19 @@ void cli_session_set_user_session_key(struct cli_session *session,
 /*
   setup signing for a NT1 style session setup
 */
-static void use_nt1_session_keys(struct cli_session *session, 
+static void use_nt1_session_keys(struct smbcli_session *session, 
                                 const char *password, const DATA_BLOB  *nt_response)
 {
-       struct cli_transport *transport = session->transport; 
+       struct smbcli_transport *transport = session->transport; 
        uint8_t nt_hash[16];
        DATA_BLOB session_key = data_blob(NULL, 16);
 
        E_md4hash(password, nt_hash);
        SMBsesskeygen_ntv1(nt_hash, session_key.data);
 
-       cli_transport_simple_set_signing(transport, session_key, *nt_response);
+       smbcli_transport_simple_set_signing(transport, session_key, *nt_response);
 
-       cli_session_set_user_session_key(session, &session_key);
+       smbcli_session_set_user_session_key(session, &session_key);
        data_blob_free(&session_key);
 }
 
@@ -270,7 +270,7 @@ static void use_nt1_session_keys(struct cli_session *session,
  Perform a session setup (sync interface) using generic interface and the old
  style sesssetup call
 ****************************************************************************/
-static NTSTATUS smb_raw_session_setup_generic_old(struct cli_session *session, 
+static NTSTATUS smb_raw_session_setup_generic_old(struct smbcli_session *session, 
                                                  TALLOC_CTX *mem_ctx, 
                                                  union smb_sesssetup *parms) 
 {
@@ -319,7 +319,7 @@ static NTSTATUS smb_raw_session_setup_generic_old(struct cli_session *session,
  Perform a session setup (sync interface) using generic interface and the NT1
  style sesssetup call
 ****************************************************************************/
-static NTSTATUS smb_raw_session_setup_generic_nt1(struct cli_session *session, 
+static NTSTATUS smb_raw_session_setup_generic_nt1(struct smbcli_session *session, 
                                                  TALLOC_CTX *mem_ctx,
                                                  union smb_sesssetup *parms) 
 {
@@ -375,7 +375,7 @@ static NTSTATUS smb_raw_session_setup_generic_nt1(struct cli_session *session,
  Perform a session setup (sync interface) using generic interface and the SPNEGO
  style sesssetup call
 ****************************************************************************/
-static NTSTATUS smb_raw_session_setup_generic_spnego(struct cli_session *session, 
+static NTSTATUS smb_raw_session_setup_generic_spnego(struct smbcli_session *session, 
                                                  TALLOC_CTX *mem_ctx,
                                                  union smb_sesssetup *parms) 
 {
@@ -396,7 +396,7 @@ static NTSTATUS smb_raw_session_setup_generic_spnego(struct cli_session *session
        s2.spnego.in.lanman = "Samba";
        s2.spnego.out.vuid = UID_FIELD_INVALID;
 
-       cli_temp_set_signing(session->transport);
+       smbcli_temp_set_signing(session->transport);
 
        status = gensec_client_start(&session->gensec);
        if (!NT_STATUS_IS_OK(status)) {
@@ -455,7 +455,7 @@ static NTSTATUS smb_raw_session_setup_generic_spnego(struct cli_session *session
                        session_key_err = gensec_session_key(session->gensec, &session_key);
                }
                if (NT_STATUS_IS_OK(session_key_err)) {
-                       cli_transport_simple_set_signing(session->transport, session_key, null_data_blob);
+                       smbcli_transport_simple_set_signing(session->transport, session_key, null_data_blob);
                }
                
                session->vuid = s2.spnego.out.vuid;
@@ -479,7 +479,7 @@ done:
                        return session_key_err;
                }
 
-               cli_session_set_user_session_key(session, &session_key);
+               smbcli_session_set_user_session_key(session, &session_key);
 
                parms->generic.out.vuid = s2.spnego.out.vuid;
                parms->generic.out.os = s2.spnego.out.os;
@@ -496,7 +496,7 @@ done:
 /****************************************************************************
  Perform a session setup (sync interface) using generic interface
 ****************************************************************************/
-static NTSTATUS smb_raw_session_setup_generic(struct cli_session *session, 
+static NTSTATUS smb_raw_session_setup_generic(struct smbcli_session *session, 
                                              TALLOC_CTX *mem_ctx,
                                              union smb_sesssetup *parms) 
 {
@@ -527,10 +527,10 @@ static NTSTATUS smb_raw_session_setup_generic(struct cli_session *session,
 this interface allows for RAW_SESSSETUP_GENERIC to auto-select session
 setup variant based on negotiated protocol options
 ****************************************************************************/
-NTSTATUS smb_raw_session_setup(struct cli_session *session, TALLOC_CTX *mem_ctx, 
+NTSTATUS smb_raw_session_setup(struct smbcli_session *session, TALLOC_CTX *mem_ctx, 
                               union smb_sesssetup *parms) 
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        if (parms->generic.level == RAW_SESSSETUP_GENERIC) {
                NTSTATUS ret = smb_raw_session_setup_generic(session, mem_ctx, parms);
@@ -555,17 +555,17 @@ NTSTATUS smb_raw_session_setup(struct cli_session *session, TALLOC_CTX *mem_ctx,
 /****************************************************************************
  Send a uloggoff (async send)
 *****************************************************************************/
-struct cli_request *smb_raw_ulogoff_send(struct cli_session *session)
+struct smbcli_request *smb_raw_ulogoff_send(struct smbcli_session *session)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        SETUP_REQUEST_SESSION(SMBulogoffX, 2, 0);
 
        SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE);
        SSVAL(req->out.vwv, VWV(1), 0);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -575,24 +575,24 @@ struct cli_request *smb_raw_ulogoff_send(struct cli_session *session)
 /****************************************************************************
  Send a uloggoff (sync interface)
 *****************************************************************************/
-NTSTATUS smb_raw_ulogoff(struct cli_session *session)
+NTSTATUS smb_raw_ulogoff(struct smbcli_session *session)
 {
-       struct cli_request *req = smb_raw_ulogoff_send(session);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_ulogoff_send(session);
+       return smbcli_request_simple_recv(req);
 }
 
 
 /****************************************************************************
  Send a SMBexit
 ****************************************************************************/
-NTSTATUS smb_raw_exit(struct cli_session *session)
+NTSTATUS smb_raw_exit(struct smbcli_session *session)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
-       req = cli_request_setup_session(session, SMBexit, 0, 0);
+       req = smbcli_request_setup_session(session, SMBexit, 0, 0);
 
-       if (cli_request_send(req)) {
-               cli_request_receive(req);
+       if (smbcli_request_send(req)) {
+               smbcli_request_receive(req);
        }
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
index eb5d3c034259e3f2b517b38f8ed8589ff92b870c..78d37b9be11b4d6be0e560030e1ed9889340d1bb 100644 (file)
 
 
 /*
-  create a cli_socket context
+  create a smbcli_socket context
 */
-struct cli_socket *cli_sock_init(void)
+struct smbcli_socket *smbcli_sock_init(void)
 {
-       struct cli_socket *sock;
+       struct smbcli_socket *sock;
        TALLOC_CTX *mem_ctx;
 
-       mem_ctx = talloc_init("cli_socket");
+       mem_ctx = talloc_init("smbcli_socket");
        if (!mem_ctx) return NULL;
 
        sock = talloc_zero(mem_ctx, sizeof(*sock));
@@ -51,10 +51,10 @@ struct cli_socket *cli_sock_init(void)
 }
 
 /*
-  connect a cli_socket context to an IP/port pair
+  connect a smbcli_socket context to an IP/port pair
   if port is 0 then choose 445 then 139
 */
-BOOL cli_sock_connect(struct cli_socket *sock, struct in_addr *ip, int port)
+BOOL smbcli_sock_connect(struct smbcli_socket *sock, struct in_addr *ip, int port)
 {
        if (getenv("LIBSMB_PROG")) {
                sock->fd = sock_exec(getenv("LIBSMB_PROG"));
@@ -62,8 +62,8 @@ BOOL cli_sock_connect(struct cli_socket *sock, struct in_addr *ip, int port)
        }
 
        if (port == 0) {
-               return cli_sock_connect(sock, ip, 445) ||
-                       cli_sock_connect(sock, ip, 139);
+               return smbcli_sock_connect(sock, ip, 445) ||
+                       smbcli_sock_connect(sock, ip, 139);
        }
 
        sock->dest_ip = *ip;
@@ -85,7 +85,7 @@ BOOL cli_sock_connect(struct cli_socket *sock, struct in_addr *ip, int port)
 /****************************************************************************
  mark the socket as dead
 ****************************************************************************/
-void cli_sock_dead(struct cli_socket *sock)
+void smbcli_sock_dead(struct smbcli_socket *sock)
 {
        if (sock->fd != -1) {
                close(sock->fd);
@@ -96,18 +96,18 @@ void cli_sock_dead(struct cli_socket *sock)
 /****************************************************************************
  reduce socket reference count - if it becomes zero then close
 ****************************************************************************/
-void cli_sock_close(struct cli_socket *sock)
+void smbcli_sock_close(struct smbcli_socket *sock)
 {
        sock->reference_count--;
        if (sock->reference_count <= 0) {
-               cli_sock_dead(sock);
+               smbcli_sock_dead(sock);
        }
 }
 
 /****************************************************************************
  Set socket options on a open connection.
 ****************************************************************************/
-void cli_sock_set_options(struct cli_socket *sock, const char *options)
+void smbcli_sock_set_options(struct smbcli_socket *sock, const char *options)
 {
        set_socket_options(sock->fd, options);
 }
@@ -115,7 +115,7 @@ void cli_sock_set_options(struct cli_socket *sock, const char *options)
 /****************************************************************************
  Write to socket. Return amount written.
 ****************************************************************************/
-ssize_t cli_sock_write(struct cli_socket *sock, const char *data, size_t len)
+ssize_t smbcli_sock_write(struct smbcli_socket *sock, const char *data, size_t len)
 {
        if (sock->fd == -1) {
                errno = EIO;
@@ -129,7 +129,7 @@ ssize_t cli_sock_write(struct cli_socket *sock, const char *data, size_t len)
 /****************************************************************************
  Read from socket. return amount read
 ****************************************************************************/
-ssize_t cli_sock_read(struct cli_socket *sock, char *data, size_t len)
+ssize_t smbcli_sock_read(struct smbcli_socket *sock, char *data, size_t len)
 {
        if (sock->fd == -1) {
                errno = EIO;
@@ -142,7 +142,7 @@ ssize_t cli_sock_read(struct cli_socket *sock, char *data, size_t len)
 /****************************************************************************
 resolve a hostname and connect 
 ****************************************************************************/
-BOOL cli_sock_connect_byname(struct cli_socket *sock, const char *host, int port)
+BOOL smbcli_sock_connect_byname(struct smbcli_socket *sock, const char *host, int port)
 {
        int name_type = 0x20;
        struct in_addr ip;
@@ -155,7 +155,7 @@ BOOL cli_sock_connect_byname(struct cli_socket *sock, const char *host, int port
                return sock->fd != -1;
        }
 
-       mem_ctx = talloc_init("cli_sock_connect_byname");
+       mem_ctx = talloc_init("smbcli_sock_connect_byname");
        if (!mem_ctx) return False;
 
        name = talloc_strdup(mem_ctx, host);
@@ -171,7 +171,7 @@ BOOL cli_sock_connect_byname(struct cli_socket *sock, const char *host, int port
                return False;
        }
 
-       ret = cli_sock_connect(sock, &ip, port);
+       ret = smbcli_sock_connect(sock, &ip, port);
 
        if (ret) {
                sock->hostname = talloc_steal(mem_ctx, sock->mem_ctx, name);
index 3b3c10ed01361b20f77db6a7f26088ab683f17c2..5290dd953df617d907068a11cb3f487f9951476c 100644 (file)
 /*
   an event has happened on the socket
 */
-static void cli_transport_event_handler(struct event_context *ev, struct fd_event *fde, 
+static void smbcli_transport_event_handler(struct event_context *ev, struct fd_event *fde, 
                                        time_t t, uint16_t flags)
 {
-       struct cli_transport *transport = fde->private;
+       struct smbcli_transport *transport = fde->private;
 
-       cli_transport_process(transport);
+       smbcli_transport_process(transport);
 }
 
 /*
   create a transport structure based on an established socket
 */
-struct cli_transport *cli_transport_init(struct cli_socket *sock)
+struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock)
 {
        TALLOC_CTX *mem_ctx;
-       struct cli_transport *transport;
+       struct smbcli_transport *transport;
        struct fd_event fde;
 
-       mem_ctx = talloc_init("cli_transport");
+       mem_ctx = talloc_init("smbcli_transport");
        if (!mem_ctx) return NULL;
 
        transport = talloc_zero(mem_ctx, sizeof(*transport));
@@ -59,7 +59,7 @@ struct cli_transport *cli_transport_init(struct cli_socket *sock)
        transport->options.use_spnego = lp_use_spnego();
        transport->negotiate.max_xmit = ~0;
        
-       cli_init_signing(transport);
+       smbcli_init_signing(transport);
 
        transport->socket->reference_count++;
 
@@ -67,7 +67,7 @@ struct cli_transport *cli_transport_init(struct cli_socket *sock)
 
        fde.fd = sock->fd;
        fde.flags = EVENT_FD_READ;
-       fde.handler = cli_transport_event_handler;
+       fde.handler = smbcli_transport_event_handler;
        fde.private = transport;
        fde.ref_count = 1;
 
@@ -80,11 +80,11 @@ struct cli_transport *cli_transport_init(struct cli_socket *sock)
   decrease reference count on a transport, and destroy if it becomes
   zero
 */
-void cli_transport_close(struct cli_transport *transport)
+void smbcli_transport_close(struct smbcli_transport *transport)
 {
        transport->reference_count--;
        if (transport->reference_count <= 0) {
-               cli_sock_close(transport->socket);
+               smbcli_sock_close(transport->socket);
                event_remove_fd(transport->event.ctx, transport->event.fde);
                event_remove_timed(transport->event.ctx, transport->event.te);
                event_context_destroy(transport->event.ctx);
@@ -95,14 +95,14 @@ void cli_transport_close(struct cli_transport *transport)
 /*
   mark the transport as dead
 */
-void cli_transport_dead(struct cli_transport *transport)
+void smbcli_transport_dead(struct smbcli_transport *transport)
 {
-       cli_sock_dead(transport->socket);
+       smbcli_sock_dead(transport->socket);
 
        /* all pending sends become errors */
        while (transport->pending_send) {
-               struct cli_request *req = transport->pending_send;
-               req->state = CLI_REQUEST_ERROR;
+               struct smbcli_request *req = transport->pending_send;
+               req->state = SMBCLI_REQUEST_ERROR;
                req->status = NT_STATUS_NET_WRITE_FAULT;
                DLIST_REMOVE(transport->pending_send, req);
                if (req->async.fn) {
@@ -112,8 +112,8 @@ void cli_transport_dead(struct cli_transport *transport)
 
        /* as do all pending receives */
        while (transport->pending_recv) {
-               struct cli_request *req = transport->pending_recv;
-               req->state = CLI_REQUEST_ERROR;
+               struct smbcli_request *req = transport->pending_recv;
+               req->state = SMBCLI_REQUEST_ERROR;
                req->status = NT_STATUS_NET_WRITE_FAULT;
                DLIST_REMOVE(transport->pending_recv, req);
                if (req->async.fn) {
@@ -126,7 +126,7 @@ void cli_transport_dead(struct cli_transport *transport)
 /*
   enable select for write on a transport
 */
-static void cli_transport_write_enable(struct cli_transport *transport)
+static void smbcli_transport_write_enable(struct smbcli_transport *transport)
 {
        transport->event.fde->flags |= EVENT_FD_WRITE;
 }
@@ -134,7 +134,7 @@ static void cli_transport_write_enable(struct cli_transport *transport)
 /*
   disable select for write on a transport
 */
-static void cli_transport_write_disable(struct cli_transport *transport)
+static void smbcli_transport_write_disable(struct smbcli_transport *transport)
 {
        transport->event.fde->flags &= ~EVENT_FD_WRITE;
 }
@@ -142,13 +142,13 @@ static void cli_transport_write_disable(struct cli_transport *transport)
 /****************************************************************************
 send a session request (if appropriate)
 ****************************************************************************/
-BOOL cli_transport_connect(struct cli_transport *transport,
+BOOL smbcli_transport_connect(struct smbcli_transport *transport,
                           struct nmb_name *calling, 
                           struct nmb_name *called)
 {
        char *p;
        int len = NBT_HDR_SIZE;
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        if (called) {
                transport->called = *called;
@@ -160,7 +160,7 @@ BOOL cli_transport_connect(struct cli_transport *transport,
        }
 
        /* allocate output buffer */
-       req = cli_request_setup_nonsmb(transport, NBT_HDR_SIZE + 2*nbt_mangled_name_len());
+       req = smbcli_request_setup_nonsmb(transport, NBT_HDR_SIZE + 2*nbt_mangled_name_len());
 
        /* put in the destination name */
        p = req->out.buffer + NBT_HDR_SIZE;
@@ -175,20 +175,20 @@ BOOL cli_transport_connect(struct cli_transport *transport,
        _smb_setlen(req->out.buffer,len-4);
        SCVAL(req->out.buffer,0,0x81);
 
-       if (!cli_request_send(req) ||
-           !cli_request_receive(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req) ||
+           !smbcli_request_receive(req)) {
+               smbcli_request_destroy(req);
                return False;
        }
        
        if (CVAL(req->in.buffer,0) != 0x82) {
                transport->error.etype = ETYPE_NBT;
                transport->error.e.nbt_error = CVAL(req->in.buffer,4);
-               cli_request_destroy(req);
+               smbcli_request_destroy(req);
                return False;
        }
 
-       cli_request_destroy(req);
+       smbcli_request_destroy(req);
        return True;
 }
 
@@ -196,10 +196,10 @@ BOOL cli_transport_connect(struct cli_transport *transport,
 /****************************************************************************
 get next mid in sequence
 ****************************************************************************/
-uint16_t cli_transport_next_mid(struct cli_transport *transport)
+uint16_t smbcli_transport_next_mid(struct smbcli_transport *transport)
 {
        uint16_t mid;
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        mid = transport->next_mid;
 
@@ -225,7 +225,7 @@ again:
 static void idle_handler(struct event_context *ev, 
                         struct timed_event *te, time_t t)
 {
-       struct cli_transport *transport = te->private;
+       struct smbcli_transport *transport = te->private;
        te->next_event = t + transport->idle.period;
        transport->idle.func(transport, transport->idle.private);
 }
@@ -234,8 +234,8 @@ static void idle_handler(struct event_context *ev,
   setup the idle handler for a transport
   the period is in seconds
 */
-void cli_transport_idle_handler(struct cli_transport *transport, 
-                               void (*idle_func)(struct cli_transport *, void *),
+void smbcli_transport_idle_handler(struct smbcli_transport *transport, 
+                               void (*idle_func)(struct smbcli_transport *, void *),
                                uint_t period,
                                void *private)
 {
@@ -257,27 +257,27 @@ void cli_transport_idle_handler(struct cli_transport *transport,
 /*
   process some pending sends
 */
-static void cli_transport_process_send(struct cli_transport *transport)
+static void smbcli_transport_process_send(struct smbcli_transport *transport)
 {
        while (transport->pending_send) {
-               struct cli_request *req = transport->pending_send;
+               struct smbcli_request *req = transport->pending_send;
                ssize_t ret;
-               ret = cli_sock_write(transport->socket, req->out.buffer, req->out.size);
+               ret = smbcli_sock_write(transport->socket, req->out.buffer, req->out.size);
                if (ret == -1) {
                        if (errno == EAGAIN || errno == EINTR) {
                                return;
                        }
-                       cli_transport_dead(transport);
+                       smbcli_transport_dead(transport);
                }
                req->out.buffer += ret;
                req->out.size -= ret;
                if (req->out.size == 0) {
                        DLIST_REMOVE(transport->pending_send, req);
                        if (req->one_way_request) {
-                               req->state = CLI_REQUEST_DONE;
-                               cli_request_destroy(req);
+                               req->state = SMBCLI_REQUEST_DONE;
+                               smbcli_request_destroy(req);
                        } else {
-                               req->state = CLI_REQUEST_RECV;
+                               req->state = SMBCLI_REQUEST_RECV;
                                DLIST_ADD(transport->pending_recv, req);
                        }
                }
@@ -285,19 +285,19 @@ static void cli_transport_process_send(struct cli_transport *transport)
 
        /* we're out of requests to send, so don't wait for write
           events any more */
-       cli_transport_write_disable(transport);
+       smbcli_transport_write_disable(transport);
 }
 
 /*
   we have a full request in our receive buffer - match it to a pending request
   and process
  */
-static void cli_transport_finish_recv(struct cli_transport *transport)
+static void smbcli_transport_finish_recv(struct smbcli_transport *transport)
 {
        uint8_t *buffer, *hdr, *vwv;
        int len;
        uint16_t wct, mid = 0;
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        buffer = transport->recv_buffer.buffer;
        len = transport->recv_buffer.req_size;
@@ -355,14 +355,14 @@ static void cli_transport_finish_recv(struct cli_transport *transport)
 
        /* handle non-SMB replies */
        if (req->in.size < NBT_HDR_SIZE + MIN_SMB_SIZE) {
-               req->state = CLI_REQUEST_ERROR;
+               req->state = SMBCLI_REQUEST_ERROR;
                goto error;
        }
 
        if (req->in.size < NBT_HDR_SIZE + MIN_SMB_SIZE + VWV(wct)) {
                DEBUG(2,("bad reply size for mid %d\n", mid));
                req->status = NT_STATUS_UNSUCCESSFUL;
-               req->state = CLI_REQUEST_ERROR;
+               req->state = SMBCLI_REQUEST_ERROR;
                goto error;
        }
 
@@ -394,10 +394,10 @@ static void cli_transport_finish_recv(struct cli_transport *transport)
                req->status = transport->error.e.nt_status;
        }
 
-       if (!cli_request_check_sign_mac(req)) {
+       if (!smbcli_request_check_sign_mac(req)) {
                transport->error.etype = ETYPE_SOCKET;
                transport->error.e.socket_error = SOCKET_READ_BAD_SIG;
-               req->state = CLI_REQUEST_ERROR;
+               req->state = SMBCLI_REQUEST_ERROR;
                goto error;
        };
 
@@ -406,7 +406,7 @@ async:
           notify that the reply has been received. This might destroy
           the request so it must happen last */
        DLIST_REMOVE(transport->pending_recv, req);
-       req->state = CLI_REQUEST_DONE;
+       req->state = SMBCLI_REQUEST_DONE;
        if (req->async.fn) {
                req->async.fn(req);
        }
@@ -415,21 +415,21 @@ async:
 error:
        if (req) {
                DLIST_REMOVE(transport->pending_recv, req);
-               req->state = CLI_REQUEST_ERROR;
+               req->state = SMBCLI_REQUEST_ERROR;
        }
 }
 
 /*
   process some pending receives
 */
-static void cli_transport_process_recv(struct cli_transport *transport)
+static void smbcli_transport_process_recv(struct smbcli_transport *transport)
 {
        /* a incoming packet goes through 2 stages - first we read the
           4 byte header, which tells us how much more is coming. Then
           we read the rest */
        if (transport->recv_buffer.received < NBT_HDR_SIZE) {
                ssize_t ret;
-               ret = cli_sock_read(transport->socket, 
+               ret = smbcli_sock_read(transport->socket, 
                                    transport->recv_buffer.header + 
                                    transport->recv_buffer.received,
                                    NBT_HDR_SIZE - transport->recv_buffer.received);
@@ -437,7 +437,7 @@ static void cli_transport_process_recv(struct cli_transport *transport)
                        if (errno == EINTR || errno == EAGAIN) {
                                return;
                        }
-                       cli_transport_dead(transport);
+                       smbcli_transport_dead(transport);
                        return;
                }
 
@@ -449,7 +449,7 @@ static void cli_transport_process_recv(struct cli_transport *transport)
                        transport->recv_buffer.buffer = talloc(transport->mem_ctx,
                                                               NBT_HDR_SIZE+transport->recv_buffer.req_size);
                        if (transport->recv_buffer.buffer == NULL) {
-                               cli_transport_dead(transport);
+                               smbcli_transport_dead(transport);
                                return;
                        }
                        memcpy(transport->recv_buffer.buffer, transport->recv_buffer.header, NBT_HDR_SIZE);
@@ -458,7 +458,7 @@ static void cli_transport_process_recv(struct cli_transport *transport)
 
        if (transport->recv_buffer.received < transport->recv_buffer.req_size) {
                ssize_t ret;
-               ret = cli_sock_read(transport->socket, 
+               ret = smbcli_sock_read(transport->socket, 
                                    transport->recv_buffer.buffer + 
                                    transport->recv_buffer.received,
                                    transport->recv_buffer.req_size - 
@@ -467,7 +467,7 @@ static void cli_transport_process_recv(struct cli_transport *transport)
                        if (errno == EINTR || errno == EAGAIN) {
                                return;
                        }
-                       cli_transport_dead(transport);
+                       smbcli_transport_dead(transport);
                        return;
                }
                transport->recv_buffer.received += ret;
@@ -475,7 +475,7 @@ static void cli_transport_process_recv(struct cli_transport *transport)
 
        if (transport->recv_buffer.received != 0 &&
            transport->recv_buffer.received == transport->recv_buffer.req_size) {
-               cli_transport_finish_recv(transport);
+               smbcli_transport_finish_recv(transport);
        }
 }
 
@@ -483,10 +483,10 @@ static void cli_transport_process_recv(struct cli_transport *transport)
   process some read/write requests that are pending
   return False if the socket is dead
 */
-BOOL cli_transport_process(struct cli_transport *transport)
+BOOL smbcli_transport_process(struct smbcli_transport *transport)
 {
-       cli_transport_process_send(transport);
-       cli_transport_process_recv(transport);
+       smbcli_transport_process_send(transport);
+       smbcli_transport_process_recv(transport);
        if (transport->socket->fd == -1) {
                return False;
        }
@@ -498,19 +498,19 @@ BOOL cli_transport_process(struct cli_transport *transport)
 /*
   put a request into the send queue
 */
-void cli_transport_send(struct cli_request *req)
+void smbcli_transport_send(struct smbcli_request *req)
 {
        /* check if the transport is dead */
        if (req->transport->socket->fd == -1) {
-               req->state = CLI_REQUEST_ERROR;
+               req->state = SMBCLI_REQUEST_ERROR;
                req->status = NT_STATUS_NET_WRITE_FAULT;
                return;
        }
 
        /* put it on the outgoing socket queue */
-       req->state = CLI_REQUEST_SEND;
-       DLIST_ADD_END(req->transport->pending_send, req, struct cli_request *);
+       req->state = SMBCLI_REQUEST_SEND;
+       DLIST_ADD_END(req->transport->pending_send, req, struct smbcli_request *);
 
        /* make sure we look for write events */
-       cli_transport_write_enable(req->transport);
+       smbcli_transport_write_enable(req->transport);
 }
index a580ded010db54480d358c270cf1cfac8dc921aa..b9d572fd56b796ec5c4b2ee3d358ad6084cd6321 100644 (file)
@@ -22,7 +22,7 @@
 #include "includes.h"
 
 #define SETUP_REQUEST_TREE(cmd, wct, buflen) do { \
-       req = cli_request_setup(tree, cmd, wct, buflen); \
+       req = smbcli_request_setup(tree, cmd, wct, buflen); \
        if (!req) return NULL; \
 } while (0)
 
 /****************************************************************************
  Initialize the tree context
 ****************************************************************************/
-struct cli_tree *cli_tree_init(struct cli_session *session)
+struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session)
 {
-       struct cli_tree *tree;
-       TALLOC_CTX *mem_ctx = talloc_init("cli_tree");
+       struct smbcli_tree *tree;
+       TALLOC_CTX *mem_ctx = talloc_init("smbcli_tree");
        if (mem_ctx == NULL) {
                return NULL;
        }
@@ -54,12 +54,12 @@ struct cli_tree *cli_tree_init(struct cli_session *session)
 /****************************************************************************
 reduce reference count on a tree and destroy if <= 0
 ****************************************************************************/
-void cli_tree_close(struct cli_tree *tree)
+void smbcli_tree_close(struct smbcli_tree *tree)
 {
        if (!tree) return;
        tree->reference_count--;
        if (tree->reference_count <= 0) {
-               cli_session_close(tree->session);
+               smbcli_session_close(tree->session);
                talloc_destroy(tree->mem_ctx);
        }
 }
@@ -68,16 +68,16 @@ void cli_tree_close(struct cli_tree *tree)
 /****************************************************************************
  Send a tconX (async send)
 ****************************************************************************/
-struct cli_request *smb_tree_connect_send(struct cli_tree *tree, union smb_tcon *parms)
+struct smbcli_request *smb_tree_connect_send(struct smbcli_tree *tree, union smb_tcon *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        switch (parms->tcon.level) {
        case RAW_TCON_TCON:
                SETUP_REQUEST_TREE(SMBtcon, 0, 0);
-               cli_req_append_ascii4(req, parms->tcon.in.service, STR_ASCII);
-               cli_req_append_ascii4(req, parms->tcon.in.password,STR_ASCII);
-               cli_req_append_ascii4(req, parms->tcon.in.dev,     STR_ASCII);
+               smbcli_req_append_ascii4(req, parms->tcon.in.service, STR_ASCII);
+               smbcli_req_append_ascii4(req, parms->tcon.in.password,STR_ASCII);
+               smbcli_req_append_ascii4(req, parms->tcon.in.dev,     STR_ASCII);
                break;
 
        case RAW_TCON_TCONX:
@@ -86,14 +86,14 @@ struct cli_request *smb_tree_connect_send(struct cli_tree *tree, union smb_tcon
                SSVAL(req->out.vwv, VWV(1), 0);
                SSVAL(req->out.vwv, VWV(2), parms->tconx.in.flags);
                SSVAL(req->out.vwv, VWV(3), parms->tconx.in.password.length);
-               cli_req_append_blob(req, &parms->tconx.in.password);
-               cli_req_append_string(req, parms->tconx.in.path,   STR_TERMINATE | STR_UPPER);
-               cli_req_append_string(req, parms->tconx.in.device, STR_TERMINATE | STR_ASCII);
+               smbcli_req_append_blob(req, &parms->tconx.in.password);
+               smbcli_req_append_string(req, parms->tconx.in.path,   STR_TERMINATE | STR_UPPER);
+               smbcli_req_append_string(req, parms->tconx.in.device, STR_TERMINATE | STR_ASCII);
                break;
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -103,18 +103,18 @@ struct cli_request *smb_tree_connect_send(struct cli_tree *tree, union smb_tcon
 /****************************************************************************
  Send a tconX (async recv)
 ****************************************************************************/
-NTSTATUS smb_tree_connect_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union smb_tcon *parms)
+NTSTATUS smb_tree_connect_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_tcon *parms)
 {
        char *p;
 
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
                goto failed;
        }
 
        switch (parms->tcon.level) {
        case RAW_TCON_TCON:
-               CLI_CHECK_WCT(req, 2);
+               SMBCLI_CHECK_WCT(req, 2);
                parms->tcon.out.max_xmit = SVAL(req->in.vwv, VWV(0));
                parms->tcon.out.cnum = SVAL(req->in.vwv, VWV(1));
                break;
@@ -130,23 +130,23 @@ NTSTATUS smb_tree_connect_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, uni
                p = req->in.data;
                if (!p) break;
 
-               p += cli_req_pull_string(req, mem_ctx, &parms->tconx.out.dev_type, 
+               p += smbcli_req_pull_string(req, mem_ctx, &parms->tconx.out.dev_type, 
                                         p, -1, STR_ASCII | STR_TERMINATE);
-               p += cli_req_pull_string(req, mem_ctx, &parms->tconx.out.fs_type, 
+               p += smbcli_req_pull_string(req, mem_ctx, &parms->tconx.out.fs_type, 
                                         p, -1, STR_TERMINATE);
                break;
        }
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 /****************************************************************************
  Send a tconX (sync interface)
 ****************************************************************************/
-NTSTATUS smb_tree_connect(struct cli_tree *tree, TALLOC_CTX *mem_ctx, union smb_tcon *parms)
+NTSTATUS smb_tree_connect(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_tcon *parms)
 {
-       struct cli_request *req = smb_tree_connect_send(tree, parms);
+       struct smbcli_request *req = smb_tree_connect_send(tree, parms);
        return smb_tree_connect_recv(req, mem_ctx, parms);
 }
 
@@ -154,35 +154,35 @@ NTSTATUS smb_tree_connect(struct cli_tree *tree, TALLOC_CTX *mem_ctx, union smb_
 /****************************************************************************
  Send a tree disconnect.
 ****************************************************************************/
-NTSTATUS smb_tree_disconnect(struct cli_tree *tree)
+NTSTATUS smb_tree_disconnect(struct smbcli_tree *tree)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        if (!tree) return NT_STATUS_OK;
-       req = cli_request_setup(tree, SMBtdis, 0, 0);
+       req = smbcli_request_setup(tree, SMBtdis, 0, 0);
 
-       if (cli_request_send(req)) {
-               cli_request_receive(req);
+       if (smbcli_request_send(req)) {
+               smbcli_request_receive(req);
        }
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 
 /*
-  a convenient function to establish a cli_tree from scratch, using reasonable default
+  a convenient function to establish a smbcli_tree from scratch, using reasonable default
   parameters
 */
-NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree, 
+NTSTATUS smbcli_tree_full_connection(struct smbcli_tree **ret_tree, 
                                  const char *my_name, 
                                  const char *dest_host, int port,
                                  const char *service, const char *service_type,
                                  const char *user, const char *domain, 
                                  const char *password)
 {
-       struct cli_socket *sock;
-       struct cli_transport *transport;
-       struct cli_session *session;
-       struct cli_tree *tree;
+       struct smbcli_socket *sock;
+       struct smbcli_transport *transport;
+       struct smbcli_session *session;
+       struct smbcli_tree *tree;
        NTSTATUS status;
        struct nmb_name calling;
        struct nmb_name called;
@@ -193,20 +193,20 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree,
 
        *ret_tree = NULL;
 
-       sock = cli_sock_init();
+       sock = smbcli_sock_init();
        if (!sock) {
                return NT_STATUS_NO_MEMORY;
        }
 
        /* open a TCP socket to the server */
-       if (!cli_sock_connect_byname(sock, dest_host, port)) {
+       if (!smbcli_sock_connect_byname(sock, dest_host, port)) {
                DEBUG(2,("Failed to establish socket connection - %s\n", strerror(errno)));
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       transport = cli_transport_init(sock);
+       transport = smbcli_transport_init(sock);
        if (!transport) {
-               cli_sock_close(sock);
+               smbcli_sock_close(sock);
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -214,8 +214,8 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree,
        make_nmb_name(&calling, my_name, 0x0);
        make_nmb_name(&called,  dest_host, 0x20);
 
-       if (!cli_transport_connect(transport, &calling, &called)) {
-               cli_transport_close(transport);
+       if (!smbcli_transport_connect(transport, &calling, &called)) {
+               smbcli_transport_close(transport);
                return NT_STATUS_UNSUCCESSFUL;
        }
 
@@ -223,13 +223,13 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree,
        /* negotiate protocol options with the server */
        status = smb_raw_negotiate(transport);
        if (!NT_STATUS_IS_OK(status)) {
-               cli_transport_close(transport);
+               smbcli_transport_close(transport);
                return status;
        }
 
-       session = cli_session_init(transport);
+       session = smbcli_session_init(transport);
        if (!session) {
-               cli_transport_close(transport);
+               smbcli_transport_close(transport);
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -255,16 +255,16 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree,
 
        status = smb_raw_session_setup(session, mem_ctx, &setup);
        if (!NT_STATUS_IS_OK(status)) {
-               cli_session_close(session);
+               smbcli_session_close(session);
                talloc_destroy(mem_ctx);
                return status;
        }
 
        session->vuid = setup.generic.out.vuid;
 
-       tree = cli_tree_init(session);
+       tree = smbcli_tree_init(session);
        if (!tree) {
-               cli_session_close(session);
+               smbcli_session_close(session);
                talloc_destroy(mem_ctx);
                return NT_STATUS_NO_MEMORY;
        }
@@ -288,7 +288,7 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree,
        SAFE_FREE(in_path);
 
        if (!NT_STATUS_IS_OK(status)) {
-               cli_tree_close(tree);
+               smbcli_tree_close(tree);
                talloc_destroy(mem_ctx);
                return status;
        }
index ca935915974b0ce5d75b53a1073dc5af210df5ce..77374ae8b917c1af1a2242ab8d75ce2a3f738ca4 100644 (file)
@@ -23,7 +23,7 @@
 /****************************************************************************
 fetch file ACL (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_query_secdesc_send(struct cli_tree *tree, 
+struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree, 
                                               struct smb_query_secdesc *query)
 {
        struct smb_nttrans nt;
@@ -52,7 +52,7 @@ struct cli_request *smb_raw_query_secdesc_send(struct cli_tree *tree,
 /****************************************************************************
 fetch file ACL (async recv)
 ****************************************************************************/
-NTSTATUS smb_raw_query_secdesc_recv(struct cli_request *req, 
+NTSTATUS smb_raw_query_secdesc_recv(struct smbcli_request *req, 
                                    TALLOC_CTX *mem_ctx, 
                                    struct smb_query_secdesc *query)
 {
@@ -91,11 +91,11 @@ NTSTATUS smb_raw_query_secdesc_recv(struct cli_request *req,
 /****************************************************************************
 fetch file ACL (sync interface)
 ****************************************************************************/
-NTSTATUS smb_raw_query_secdesc(struct cli_tree *tree, 
+NTSTATUS smb_raw_query_secdesc(struct smbcli_tree *tree, 
                               TALLOC_CTX *mem_ctx, 
                               struct smb_query_secdesc *query)
 {
-       struct cli_request *req = smb_raw_query_secdesc_send(tree, query);
+       struct smbcli_request *req = smb_raw_query_secdesc_send(tree, query);
        return smb_raw_query_secdesc_recv(req, mem_ctx, query);
 }
 
@@ -104,13 +104,13 @@ NTSTATUS smb_raw_query_secdesc(struct cli_tree *tree,
 /****************************************************************************
 set file ACL (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_set_secdesc_send(struct cli_tree *tree, 
+struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree, 
                                             struct smb_set_secdesc *set)
 {
        struct smb_nttrans nt;
        uint8_t params[8];
        struct ndr_push *ndr;
-       struct cli_request *req;
+       struct smbcli_request *req;
        NTSTATUS status;
 
        nt.in.max_setup = 0;
index 3b731d653b6473a9ad3a4d004088e4bc934644b5..bfb7465bd59b5611c68e621ce23812c71ce1aed9 100644 (file)
@@ -26,7 +26,7 @@
 put a dos date into a buffer (time/date format)
 This takes GMT time and puts local time for zone_offset in the buffer
 ********************************************************************/
-void raw_push_dos_date(struct cli_transport *transport,
+void raw_push_dos_date(struct smbcli_transport *transport,
                      uint8_t *buf, int offset, time_t unixdate)
 {
        push_dos_date(buf, offset, unixdate, transport->negotiate.server_zone);
@@ -36,7 +36,7 @@ void raw_push_dos_date(struct cli_transport *transport,
 put a dos date into a buffer (date/time format)
 This takes GMT time and puts local time in the buffer
 ********************************************************************/
-void raw_push_dos_date2(struct cli_transport *transport,
+void raw_push_dos_date2(struct smbcli_transport *transport,
                       char *buf, int offset, time_t unixdate)
 {
        push_dos_date2(buf, offset, unixdate, transport->negotiate.server_zone);
@@ -46,7 +46,7 @@ void raw_push_dos_date2(struct cli_transport *transport,
 put a dos 32 bit "unix like" date into a buffer. This routine takes
 GMT and converts it to LOCAL time in zone_offset before putting it
 ********************************************************************/
-void raw_push_dos_date3(struct cli_transport *transport,
+void raw_push_dos_date3(struct smbcli_transport *transport,
                       char *buf, int offset, time_t unixdate)
 {
        push_dos_date3(buf, offset, unixdate, transport->negotiate.server_zone);
@@ -55,7 +55,7 @@ void raw_push_dos_date3(struct cli_transport *transport,
 /*******************************************************************
 convert a dos date
 ********************************************************************/
-time_t raw_pull_dos_date(struct cli_transport *transport, 
+time_t raw_pull_dos_date(struct smbcli_transport *transport, 
                         const uint8_t *date_ptr)
 {
        return pull_dos_date(date_ptr, transport->negotiate.server_zone);
@@ -64,7 +64,7 @@ time_t raw_pull_dos_date(struct cli_transport *transport,
 /*******************************************************************
 like raw_pull_dos_date() but the words are reversed
 ********************************************************************/
-time_t raw_pull_dos_date2(struct cli_transport *transport, 
+time_t raw_pull_dos_date2(struct smbcli_transport *transport, 
                          const uint8_t *date_ptr)
 {
        return pull_dos_date2(date_ptr, transport->negotiate.server_zone);
@@ -74,7 +74,7 @@ time_t raw_pull_dos_date2(struct cli_transport *transport,
   create a unix GMT date from a dos date in 32 bit "unix like" format
   these arrive in server zone, with corresponding DST
   ******************************************************************/
-time_t raw_pull_dos_date3(struct cli_transport *transport,
+time_t raw_pull_dos_date3(struct smbcli_transport *transport,
                          const uint8_t *date_ptr)
 {
        return pull_dos_date3(date_ptr, transport->negotiate.server_zone);
index 0d00ffcca62464434ccd6838cc45d6a1eb3f6112..8bd8e5d8af209d5f1b1c714d635eaf48f3251ed5 100644 (file)
@@ -23,7 +23,7 @@
 #include "includes.h"
 
 #define SETUP_REQUEST(cmd, wct, buflen) do { \
-       req = cli_request_setup(tree, cmd, wct, buflen); \
+       req = smbcli_request_setup(tree, cmd, wct, buflen); \
        if (!req) return NULL; \
 } while (0)
 
 /****************************************************************************
  Rename a file - async interface
 ****************************************************************************/
-struct cli_request *smb_raw_rename_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_rename_send(struct smbcli_tree *tree,
                                        union smb_rename *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        switch (parms->generic.level) {
        case RAW_RENAME_RENAME:
                SETUP_REQUEST(SMBmv, 1, 0);
                SSVAL(req->out.vwv, VWV(0), parms->rename.in.attrib);
-               cli_req_append_ascii4(req, parms->rename.in.pattern1, STR_TERMINATE);
-               cli_req_append_ascii4(req, parms->rename.in.pattern2, STR_TERMINATE);
+               smbcli_req_append_ascii4(req, parms->rename.in.pattern1, STR_TERMINATE);
+               smbcli_req_append_ascii4(req, parms->rename.in.pattern2, STR_TERMINATE);
                break;
 
        case RAW_RENAME_NTRENAME:
@@ -49,13 +49,13 @@ struct cli_request *smb_raw_rename_send(struct cli_tree *tree,
                SSVAL(req->out.vwv, VWV(0), parms->ntrename.in.attrib);
                SSVAL(req->out.vwv, VWV(1), parms->ntrename.in.flags);
                SIVAL(req->out.vwv, VWV(2), parms->ntrename.in.cluster_size);
-               cli_req_append_ascii4(req, parms->ntrename.in.old_name, STR_TERMINATE);
-               cli_req_append_ascii4(req, parms->ntrename.in.new_name, STR_TERMINATE);
+               smbcli_req_append_ascii4(req, parms->ntrename.in.old_name, STR_TERMINATE);
+               smbcli_req_append_ascii4(req, parms->ntrename.in.new_name, STR_TERMINATE);
                break;
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -65,29 +65,29 @@ struct cli_request *smb_raw_rename_send(struct cli_tree *tree,
 /****************************************************************************
  Rename a file - sync interface
 ****************************************************************************/
-NTSTATUS smb_raw_rename(struct cli_tree *tree,
+NTSTATUS smb_raw_rename(struct smbcli_tree *tree,
                        union smb_rename *parms)
 {
-       struct cli_request *req = smb_raw_rename_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_rename_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
 
 
 /****************************************************************************
  Delete a file - async interface
 ****************************************************************************/
-struct cli_request *smb_raw_unlink_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_unlink_send(struct smbcli_tree *tree,
                                        struct smb_unlink *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        SETUP_REQUEST(SMBunlink, 1, 0);
 
        SSVAL(req->out.vwv, VWV(0), parms->in.attrib);
-       cli_req_append_ascii4(req, parms->in.pattern, STR_TERMINATE);
+       smbcli_req_append_ascii4(req, parms->in.pattern, STR_TERMINATE);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
        return req;
@@ -96,24 +96,24 @@ struct cli_request *smb_raw_unlink_send(struct cli_tree *tree,
 /*
   delete a file - sync interface
 */
-NTSTATUS smb_raw_unlink(struct cli_tree *tree,
+NTSTATUS smb_raw_unlink(struct smbcli_tree *tree,
                        struct smb_unlink *parms)
 {
-       struct cli_request *req = smb_raw_unlink_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_unlink_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
 
 
 /****************************************************************************
  create a directory  using TRANSACT2_MKDIR - async interface
 ****************************************************************************/
-static struct cli_request *smb_raw_t2mkdir_send(struct cli_tree *tree, 
+static struct smbcli_request *smb_raw_t2mkdir_send(struct smbcli_tree *tree, 
                                                union smb_mkdir *parms)
 {
        struct smb_trans2 t2;
        uint16_t setup = TRANSACT2_MKDIR;
        TALLOC_CTX *mem_ctx;
-       struct cli_request *req;
+       struct smbcli_request *req;
        uint16_t data_total;
 
        mem_ctx = talloc_init("t2mkdir");
@@ -132,7 +132,7 @@ static struct cli_request *smb_raw_t2mkdir_send(struct cli_tree *tree,
 
        SIVAL(t2.in.params.data, VWV(0), 0); /* reserved */
 
-       cli_blob_append_string(tree->session, mem_ctx, 
+       smbcli_blob_append_string(tree->session, mem_ctx, 
                               &t2.in.params, parms->t2mkdir.in.path, 0);
 
        ea_put_list(t2.in.data.data, parms->t2mkdir.in.num_eas, parms->t2mkdir.in.eas);
@@ -147,10 +147,10 @@ static struct cli_request *smb_raw_t2mkdir_send(struct cli_tree *tree,
 /****************************************************************************
  Create a directory - async interface
 ****************************************************************************/
-struct cli_request *smb_raw_mkdir_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_mkdir_send(struct smbcli_tree *tree,
                                       union smb_mkdir *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        if (parms->generic.level == RAW_MKDIR_T2MKDIR) {
                return smb_raw_t2mkdir_send(tree, parms);
@@ -162,9 +162,9 @@ struct cli_request *smb_raw_mkdir_send(struct cli_tree *tree,
 
        SETUP_REQUEST(SMBmkdir, 0, 0);
        
-       cli_req_append_ascii4(req, parms->mkdir.in.path, STR_TERMINATE);
+       smbcli_req_append_ascii4(req, parms->mkdir.in.path, STR_TERMINATE);
 
-       if (!cli_request_send(req)) {
+       if (!smbcli_request_send(req)) {
                return NULL;
        }
 
@@ -174,27 +174,27 @@ struct cli_request *smb_raw_mkdir_send(struct cli_tree *tree,
 /****************************************************************************
  Create a directory - sync interface
 ****************************************************************************/
-NTSTATUS smb_raw_mkdir(struct cli_tree *tree,
+NTSTATUS smb_raw_mkdir(struct smbcli_tree *tree,
                       union smb_mkdir *parms)
 {
-       struct cli_request *req = smb_raw_mkdir_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_mkdir_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
 
 /****************************************************************************
  Remove a directory - async interface
 ****************************************************************************/
-struct cli_request *smb_raw_rmdir_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_rmdir_send(struct smbcli_tree *tree,
                                       struct smb_rmdir *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        SETUP_REQUEST(SMBrmdir, 0, 0);
        
-       cli_req_append_ascii4(req, parms->in.path, STR_TERMINATE);
+       smbcli_req_append_ascii4(req, parms->in.path, STR_TERMINATE);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -204,24 +204,24 @@ struct cli_request *smb_raw_rmdir_send(struct cli_tree *tree,
 /****************************************************************************
  Remove a directory - sync interface
 ****************************************************************************/
-NTSTATUS smb_raw_rmdir(struct cli_tree *tree,
+NTSTATUS smb_raw_rmdir(struct smbcli_tree *tree,
                       struct smb_rmdir *parms)
 {
-       struct cli_request *req = smb_raw_rmdir_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_rmdir_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
 
 
 /****************************************************************************
  Open a file using TRANSACT2_OPEN - async send 
 ****************************************************************************/
-static struct cli_request *smb_raw_t2open_send(struct cli_tree *tree, 
+static struct smbcli_request *smb_raw_t2open_send(struct smbcli_tree *tree, 
                                               union smb_open *parms)
 {
        struct smb_trans2 t2;
        uint16_t setup = TRANSACT2_OPEN;
        TALLOC_CTX *mem_ctx = talloc_init("smb_raw_t2open");
-       struct cli_request *req;
+       struct smbcli_request *req;
        uint16_t list_size;
 
        list_size = ea_list_size(parms->t2open.in.num_eas, parms->t2open.in.eas);
@@ -248,7 +248,7 @@ static struct cli_request *smb_raw_t2open_send(struct cli_tree *tree,
        SIVAL(t2.in.params.data, VWV(11), 0);
        SSVAL(t2.in.params.data, VWV(13), 0);
 
-       cli_blob_append_string(tree->session, mem_ctx, 
+       smbcli_blob_append_string(tree->session, mem_ctx, 
                               &t2.in.params, parms->t2open.in.fname, 
                               STR_TERMINATE);
 
@@ -265,9 +265,9 @@ static struct cli_request *smb_raw_t2open_send(struct cli_tree *tree,
 /****************************************************************************
  Open a file using TRANSACT2_OPEN - async recv
 ****************************************************************************/
-static NTSTATUS smb_raw_t2open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms)
+static NTSTATUS smb_raw_t2open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms)
 {
-       struct cli_transport *transport = req?req->transport:NULL;
+       struct smbcli_transport *transport = req?req->transport:NULL;
        struct smb_trans2 t2;
        NTSTATUS status;
 
@@ -294,10 +294,10 @@ static NTSTATUS smb_raw_t2open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx
 /****************************************************************************
  Open a file - async send
 ****************************************************************************/
-struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *parms)
+struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_open *parms)
 {
        int len;
-       struct cli_request *req = NULL; 
+       struct smbcli_request *req = NULL; 
 
        switch (parms->open.level) {
        case RAW_OPEN_T2OPEN:
@@ -307,7 +307,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par
                SETUP_REQUEST(SMBopen, 2, 0);
                SSVAL(req->out.vwv, VWV(0), parms->open.in.flags);
                SSVAL(req->out.vwv, VWV(1), parms->open.in.search_attrs);
-               cli_req_append_ascii4(req, parms->open.in.fname, STR_TERMINATE);
+               smbcli_req_append_ascii4(req, parms->open.in.fname, STR_TERMINATE);
                break;
                
        case RAW_OPEN_OPENX:
@@ -324,7 +324,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par
                SIVAL(req->out.vwv, VWV(9), parms->openx.in.size);
                SIVAL(req->out.vwv, VWV(11),parms->openx.in.timeout);
                SIVAL(req->out.vwv, VWV(13),0); /* reserved */
-               cli_req_append_string(req, parms->openx.in.fname, STR_TERMINATE);
+               smbcli_req_append_string(req, parms->openx.in.fname, STR_TERMINATE);
                break;
                
        case RAW_OPEN_MKNEW:
@@ -332,7 +332,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par
                SSVAL(req->out.vwv, VWV(0), parms->mknew.in.attrib);
                raw_push_dos_date3(tree->session->transport, 
                                  req->out.vwv, VWV(1), parms->mknew.in.write_time);
-               cli_req_append_ascii4(req, parms->mknew.in.fname, STR_TERMINATE);
+               smbcli_req_append_ascii4(req, parms->mknew.in.fname, STR_TERMINATE);
                break;
 
        case RAW_OPEN_CREATE:
@@ -340,7 +340,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par
                SSVAL(req->out.vwv, VWV(0), parms->create.in.attrib);
                raw_push_dos_date3(tree->session->transport, 
                                  req->out.vwv, VWV(1), parms->create.in.write_time);
-               cli_req_append_ascii4(req, parms->create.in.fname, STR_TERMINATE);
+               smbcli_req_append_ascii4(req, parms->create.in.fname, STR_TERMINATE);
                break;
                
        case RAW_OPEN_CTEMP:
@@ -348,7 +348,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par
                SSVAL(req->out.vwv, VWV(0), parms->ctemp.in.attrib);
                raw_push_dos_date3(tree->session->transport, 
                                  req->out.vwv, VWV(1), parms->ctemp.in.write_time);
-               cli_req_append_ascii4(req, parms->ctemp.in.directory, STR_TERMINATE);
+               smbcli_req_append_ascii4(req, parms->ctemp.in.directory, STR_TERMINATE);
                break;
                
        case RAW_OPEN_SPLOPEN:
@@ -373,13 +373,13 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par
                SIVAL(req->out.vwv, 43, parms->ntcreatex.in.impersonation);
                SCVAL(req->out.vwv, 47, parms->ntcreatex.in.security_flags);
                
-               cli_req_append_string_len(req, parms->ntcreatex.in.fname, STR_TERMINATE, &len);
+               smbcli_req_append_string_len(req, parms->ntcreatex.in.fname, STR_TERMINATE, &len);
                SSVAL(req->out.vwv, 5, len);
                break;
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -389,10 +389,10 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par
 /****************************************************************************
  Open a file - async recv
 ****************************************************************************/
-NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms)
+NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
                goto failed;
        }
 
@@ -401,7 +401,7 @@ NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union s
                return smb_raw_t2open_recv(req, mem_ctx, parms);
 
        case RAW_OPEN_OPEN:
-               CLI_CHECK_WCT(req, 7);
+               SMBCLI_CHECK_WCT(req, 7);
                parms->open.out.fnum = SVAL(req->in.vwv, VWV(0));
                parms->open.out.attrib = SVAL(req->in.vwv, VWV(1));
                parms->open.out.write_time = raw_pull_dos_date3(req->transport,
@@ -411,7 +411,7 @@ NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union s
                break;
 
        case RAW_OPEN_OPENX:
-               CLI_CHECK_MIN_WCT(req, 15);
+               SMBCLI_CHECK_MIN_WCT(req, 15);
                parms->openx.out.fnum = SVAL(req->in.vwv, VWV(2));
                parms->openx.out.attrib = SVAL(req->in.vwv, VWV(3));
                parms->openx.out.write_time = raw_pull_dos_date3(req->transport,
@@ -432,35 +432,35 @@ NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union s
                break;
 
        case RAW_OPEN_MKNEW:
-               CLI_CHECK_WCT(req, 1);
+               SMBCLI_CHECK_WCT(req, 1);
                parms->mknew.out.fnum = SVAL(req->in.vwv, VWV(0));
                break;
 
        case RAW_OPEN_CREATE:
-               CLI_CHECK_WCT(req, 1);
+               SMBCLI_CHECK_WCT(req, 1);
                parms->create.out.fnum = SVAL(req->in.vwv, VWV(0));
                break;
 
        case RAW_OPEN_CTEMP:
-               CLI_CHECK_WCT(req, 1);
+               SMBCLI_CHECK_WCT(req, 1);
                parms->ctemp.out.fnum = SVAL(req->in.vwv, VWV(0));
-               cli_req_pull_string(req, mem_ctx, &parms->ctemp.out.name, req->in.data, -1, STR_TERMINATE | STR_ASCII);
+               smbcli_req_pull_string(req, mem_ctx, &parms->ctemp.out.name, req->in.data, -1, STR_TERMINATE | STR_ASCII);
                break;
 
        case RAW_OPEN_SPLOPEN:
-               CLI_CHECK_WCT(req, 1);
+               SMBCLI_CHECK_WCT(req, 1);
                parms->splopen.out.fnum = SVAL(req->in.vwv, VWV(0));
                break;
 
        case RAW_OPEN_NTCREATEX:
-               CLI_CHECK_MIN_WCT(req, 34);
+               SMBCLI_CHECK_MIN_WCT(req, 34);
                parms->ntcreatex.out.oplock_level =              CVAL(req->in.vwv, 4);
                parms->ntcreatex.out.fnum =                      SVAL(req->in.vwv, 5);
                parms->ntcreatex.out.create_action =             IVAL(req->in.vwv, 7);
-               parms->ntcreatex.out.create_time =   cli_pull_nttime(req->in.vwv, 11);
-               parms->ntcreatex.out.access_time =   cli_pull_nttime(req->in.vwv, 19);
-               parms->ntcreatex.out.write_time =    cli_pull_nttime(req->in.vwv, 27);
-               parms->ntcreatex.out.change_time =   cli_pull_nttime(req->in.vwv, 35);
+               parms->ntcreatex.out.create_time =   smbcli_pull_nttime(req->in.vwv, 11);
+               parms->ntcreatex.out.access_time =   smbcli_pull_nttime(req->in.vwv, 19);
+               parms->ntcreatex.out.write_time =    smbcli_pull_nttime(req->in.vwv, 27);
+               parms->ntcreatex.out.change_time =   smbcli_pull_nttime(req->in.vwv, 35);
                parms->ntcreatex.out.attrib =                   IVAL(req->in.vwv, 43);
                parms->ntcreatex.out.alloc_size =               BVAL(req->in.vwv, 47);
                parms->ntcreatex.out.size =                     BVAL(req->in.vwv, 55);
@@ -471,16 +471,16 @@ NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union s
        }
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 
 /****************************************************************************
  Open a file - sync interface
 ****************************************************************************/
-NTSTATUS smb_raw_open(struct cli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open *parms)
+NTSTATUS smb_raw_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open *parms)
 {
-       struct cli_request *req = smb_raw_open_send(tree, parms);
+       struct smbcli_request *req = smb_raw_open_send(tree, parms);
        return smb_raw_open_recv(req, mem_ctx, parms);
 }
 
@@ -488,9 +488,9 @@ NTSTATUS smb_raw_open(struct cli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open
 /****************************************************************************
  Close a file - async send
 ****************************************************************************/
-struct cli_request *smb_raw_close_send(struct cli_tree *tree, union smb_close *parms)
+struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_close *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        switch (parms->generic.level) {
        case RAW_CLOSE_GENERIC:
@@ -512,8 +512,8 @@ struct cli_request *smb_raw_close_send(struct cli_tree *tree, union smb_close *p
 
        if (!req) return NULL;
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -524,19 +524,19 @@ struct cli_request *smb_raw_close_send(struct cli_tree *tree, union smb_close *p
 /****************************************************************************
  Close a file - sync interface
 ****************************************************************************/
-NTSTATUS smb_raw_close(struct cli_tree *tree, union smb_close *parms)
+NTSTATUS smb_raw_close(struct smbcli_tree *tree, union smb_close *parms)
 {
-       struct cli_request *req = smb_raw_close_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_close_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
 
 
 /****************************************************************************
  Locking calls - async interface
 ****************************************************************************/
-struct cli_request *smb_raw_lock_send(struct cli_tree *tree, union smb_lock *parms)
+struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_lock *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        switch (parms->generic.level) {
        case RAW_LOCK_GENERIC:
@@ -590,8 +590,8 @@ struct cli_request *smb_raw_lock_send(struct cli_tree *tree, union smb_lock *par
        }
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -601,26 +601,26 @@ struct cli_request *smb_raw_lock_send(struct cli_tree *tree, union smb_lock *par
 /****************************************************************************
  Locking calls - sync interface
 ****************************************************************************/
-NTSTATUS smb_raw_lock(struct cli_tree *tree, union smb_lock *parms)
+NTSTATUS smb_raw_lock(struct smbcli_tree *tree, union smb_lock *parms)
 {
-       struct cli_request *req = smb_raw_lock_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_lock_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
        
 
 /****************************************************************************
  Check for existence of a dir - async send
 ****************************************************************************/
-struct cli_request *smb_raw_chkpath_send(struct cli_tree *tree, struct smb_chkpath *parms)
+struct smbcli_request *smb_raw_chkpath_send(struct smbcli_tree *tree, struct smb_chkpath *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        SETUP_REQUEST(SMBchkpth, 0, 0);
 
-       cli_req_append_ascii4(req, parms->in.path, STR_TERMINATE);
+       smbcli_req_append_ascii4(req, parms->in.path, STR_TERMINATE);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -630,10 +630,10 @@ struct cli_request *smb_raw_chkpath_send(struct cli_tree *tree, struct smb_chkpa
 /****************************************************************************
  Check for existence of a dir - sync interface
 ****************************************************************************/
-NTSTATUS smb_raw_chkpath(struct cli_tree *tree, struct smb_chkpath *parms)
+NTSTATUS smb_raw_chkpath(struct smbcli_tree *tree, struct smb_chkpath *parms)
 {
-       struct cli_request *req = smb_raw_chkpath_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_chkpath_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
 
 
@@ -643,15 +643,15 @@ NTSTATUS smb_raw_chkpath(struct cli_tree *tree, struct smb_chkpath *parms)
  flush a file - async send
  a flush to fnum 0xFFFF will flush all files
 ****************************************************************************/
-struct cli_request *smb_raw_flush_send(struct cli_tree *tree, struct smb_flush *parms)
+struct smbcli_request *smb_raw_flush_send(struct smbcli_tree *tree, struct smb_flush *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        SETUP_REQUEST(SMBflush, 1, 0);
        SSVAL(req->out.vwv, VWV(0), parms->in.fnum);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -662,20 +662,20 @@ struct cli_request *smb_raw_flush_send(struct cli_tree *tree, struct smb_flush *
 /****************************************************************************
  flush a file - sync interface
 ****************************************************************************/
-NTSTATUS smb_raw_flush(struct cli_tree *tree, struct smb_flush *parms)
+NTSTATUS smb_raw_flush(struct smbcli_tree *tree, struct smb_flush *parms)
 {
-       struct cli_request *req = smb_raw_flush_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_flush_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
 
 
 /****************************************************************************
  seek a file - async send
 ****************************************************************************/
-struct cli_request *smb_raw_seek_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_seek_send(struct smbcli_tree *tree,
                                      struct smb_seek *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        SETUP_REQUEST(SMBlseek, 4, 0);
 
@@ -683,8 +683,8 @@ struct cli_request *smb_raw_seek_send(struct cli_tree *tree,
        SSVAL(req->out.vwv, VWV(1), parms->in.mode);
        SIVALS(req->out.vwv, VWV(2), parms->in.offset);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
        return req;
@@ -693,27 +693,27 @@ struct cli_request *smb_raw_seek_send(struct cli_tree *tree,
 /****************************************************************************
  seek a file - async receive
 ****************************************************************************/
-NTSTATUS smb_raw_seek_recv(struct cli_request *req,
+NTSTATUS smb_raw_seek_recv(struct smbcli_request *req,
                                      struct smb_seek *parms)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
+               return smbcli_request_destroy(req);
        }
 
-       CLI_CHECK_WCT(req, 2);  
+       SMBCLI_CHECK_WCT(req, 2);       
        parms->out.offset = IVAL(req->in.vwv, VWV(0));
 
 failed:        
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 /*
   seek a file - sync interface
 */
-NTSTATUS smb_raw_seek(struct cli_tree *tree,
+NTSTATUS smb_raw_seek(struct smbcli_tree *tree,
                      struct smb_seek *parms)
 {
-       struct cli_request *req = smb_raw_seek_send(tree, parms);
+       struct smbcli_request *req = smb_raw_seek_send(tree, parms);
        return smb_raw_seek_recv(req, parms);
 }
index f27a0d7281b110d736d45e24ceaaf3e60d9a60d2..8dc220b0b497af9a45282031a5bf4e9f4d6f170c 100644 (file)
@@ -36,7 +36,7 @@
 /****************************************************************************
  Handle qfileinfo/qpathinfo trans2 backend.
 ****************************************************************************/
-static NTSTATUS smb_raw_info_backend(struct cli_session *session,
+static NTSTATUS smb_raw_info_backend(struct smbcli_session *session,
                                     TALLOC_CTX *mem_ctx,
                                     union smb_fileinfo *parms, 
                                     DATA_BLOB *blob)
@@ -95,10 +95,10 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session,
                if (blob->length != 36) {
                        FINFO_CHECK_SIZE(40);
                }
-               parms->basic_info.out.create_time = cli_pull_nttime(blob->data, 0);
-               parms->basic_info.out.access_time = cli_pull_nttime(blob->data, 8);
-               parms->basic_info.out.write_time =  cli_pull_nttime(blob->data, 16);
-               parms->basic_info.out.change_time = cli_pull_nttime(blob->data, 24);
+               parms->basic_info.out.create_time = smbcli_pull_nttime(blob->data, 0);
+               parms->basic_info.out.access_time = smbcli_pull_nttime(blob->data, 8);
+               parms->basic_info.out.write_time =  smbcli_pull_nttime(blob->data, 16);
+               parms->basic_info.out.change_time = smbcli_pull_nttime(blob->data, 24);
                parms->basic_info.out.attrib =                 IVAL(blob->data, 32);
                return NT_STATUS_OK;
 
@@ -121,17 +121,17 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session,
        case RAW_FILEINFO_NAME_INFO:
        case RAW_FILEINFO_NAME_INFORMATION:
                FINFO_CHECK_MIN_SIZE(4);
-               cli_blob_pull_string(session, mem_ctx, blob, 
+               smbcli_blob_pull_string(session, mem_ctx, blob, 
                                     &parms->name_info.out.fname, 0, 4, STR_UNICODE);
                return NT_STATUS_OK;
 
        case RAW_FILEINFO_ALL_INFO:
        case RAW_FILEINFO_ALL_INFORMATION:
                FINFO_CHECK_MIN_SIZE(72);
-               parms->all_info.out.create_time =           cli_pull_nttime(blob->data, 0);
-               parms->all_info.out.access_time =           cli_pull_nttime(blob->data, 8);
-               parms->all_info.out.write_time =            cli_pull_nttime(blob->data, 16);
-               parms->all_info.out.change_time =           cli_pull_nttime(blob->data, 24);
+               parms->all_info.out.create_time =           smbcli_pull_nttime(blob->data, 0);
+               parms->all_info.out.access_time =           smbcli_pull_nttime(blob->data, 8);
+               parms->all_info.out.write_time =            smbcli_pull_nttime(blob->data, 16);
+               parms->all_info.out.change_time =           smbcli_pull_nttime(blob->data, 24);
                parms->all_info.out.attrib =                IVAL(blob->data, 32);
                parms->all_info.out.alloc_size =            BVAL(blob->data, 40);
                parms->all_info.out.size =                  BVAL(blob->data, 48);
@@ -139,14 +139,14 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session,
                parms->all_info.out.delete_pending =        CVAL(blob->data, 60);
                parms->all_info.out.directory =             CVAL(blob->data, 61);
                parms->all_info.out.ea_size =               IVAL(blob->data, 64);
-               cli_blob_pull_string(session, mem_ctx, blob,
+               smbcli_blob_pull_string(session, mem_ctx, blob,
                                     &parms->all_info.out.fname, 68, 72, STR_UNICODE);
                return NT_STATUS_OK;
 
        case RAW_FILEINFO_ALT_NAME_INFO:
        case RAW_FILEINFO_ALT_NAME_INFORMATION:
                FINFO_CHECK_MIN_SIZE(4);
-               cli_blob_pull_string(session, mem_ctx, blob, 
+               smbcli_blob_pull_string(session, mem_ctx, blob, 
                                     &parms->alt_name_info.out.fname, 0, 4, STR_UNICODE);
                return NT_STATUS_OK;
 
@@ -166,7 +166,7 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session,
                        }
                        parms->stream_info.out.streams[n].size =       BVAL(blob->data, ofs +  8);
                        parms->stream_info.out.streams[n].alloc_size = BVAL(blob->data, ofs + 16);
-                       cli_blob_pull_string(session, mem_ctx, blob, 
+                       smbcli_blob_pull_string(session, mem_ctx, blob, 
                                             &parms->stream_info.out.streams[n].stream_name, 
                                             ofs+4, ofs+24, STR_UNICODE);
                        parms->stream_info.out.num_streams++;
@@ -218,9 +218,9 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session,
                FINFO_CHECK_SIZE(100);
                parms->unix_basic_info.out.end_of_file        =            BVAL(blob->data,  0);
                parms->unix_basic_info.out.num_bytes          =            BVAL(blob->data,  8);
-               parms->unix_basic_info.out.status_change_time = cli_pull_nttime(blob->data, 16);
-               parms->unix_basic_info.out.access_time        = cli_pull_nttime(blob->data, 24);
-               parms->unix_basic_info.out.change_time        = cli_pull_nttime(blob->data, 32);
+               parms->unix_basic_info.out.status_change_time = smbcli_pull_nttime(blob->data, 16);
+               parms->unix_basic_info.out.access_time        = smbcli_pull_nttime(blob->data, 24);
+               parms->unix_basic_info.out.change_time        = smbcli_pull_nttime(blob->data, 32);
                parms->unix_basic_info.out.uid                =            BVAL(blob->data, 40);
                parms->unix_basic_info.out.gid                =            BVAL(blob->data, 48);
                parms->unix_basic_info.out.file_type          =            IVAL(blob->data, 52);
@@ -232,16 +232,16 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session,
                return NT_STATUS_OK;
 
        case RAW_FILEINFO_UNIX_LINK:
-               cli_blob_pull_string(session, mem_ctx, blob, 
+               smbcli_blob_pull_string(session, mem_ctx, blob, 
                                     &parms->unix_link_info.out.link_dest, 0, 4, STR_UNICODE);
                return NT_STATUS_OK;
                
        case RAW_FILEINFO_NETWORK_OPEN_INFORMATION:             
                FINFO_CHECK_SIZE(56);
-               parms->network_open_information.out.create_time = cli_pull_nttime(blob->data,  0);
-               parms->network_open_information.out.access_time = cli_pull_nttime(blob->data,  8);
-               parms->network_open_information.out.write_time =  cli_pull_nttime(blob->data, 16);
-               parms->network_open_information.out.change_time = cli_pull_nttime(blob->data, 24);
+               parms->network_open_information.out.create_time = smbcli_pull_nttime(blob->data,  0);
+               parms->network_open_information.out.access_time = smbcli_pull_nttime(blob->data,  8);
+               parms->network_open_information.out.write_time =  smbcli_pull_nttime(blob->data, 16);
+               parms->network_open_information.out.change_time = smbcli_pull_nttime(blob->data, 24);
                parms->network_open_information.out.alloc_size =             BVAL(blob->data, 32);
                parms->network_open_information.out.size =                   BVAL(blob->data, 40);
                parms->network_open_information.out.attrib =                 IVAL(blob->data, 48);
@@ -260,12 +260,12 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session,
 /****************************************************************************
  Very raw query file info - returns param/data blobs - (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_fileinfo_blob_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tree,
                                                      uint16_t fnum, uint16_t info_level)
 {
        struct smb_trans2 tp;
        uint16_t setup = TRANSACT2_QFILEINFO;
-       struct cli_request *req;
+       struct smbcli_request *req;
        TALLOC_CTX *mem_ctx = talloc_init("raw_fileinfo");
        
        tp.in.max_setup = 0;
@@ -297,7 +297,7 @@ static struct cli_request *smb_raw_fileinfo_blob_send(struct cli_tree *tree,
 /****************************************************************************
  Very raw query file info - returns param/data blobs - (async recv)
 ****************************************************************************/
-static NTSTATUS smb_raw_fileinfo_blob_recv(struct cli_request *req,
+static NTSTATUS smb_raw_fileinfo_blob_recv(struct smbcli_request *req,
                                           TALLOC_CTX *mem_ctx,
                                           DATA_BLOB *blob)
 {
@@ -312,13 +312,13 @@ static NTSTATUS smb_raw_fileinfo_blob_recv(struct cli_request *req,
 /****************************************************************************
  Very raw query path info - returns param/data blobs (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tree,
                                                      const char *fname,
                                                      uint16_t info_level)
 {
        struct smb_trans2 tp;
        uint16_t setup = TRANSACT2_QPATHINFO;
-       struct cli_request *req;
+       struct smbcli_request *req;
        TALLOC_CTX *mem_ctx = talloc_init("raw_pathinfo");
 
        tp.in.max_setup = 0;
@@ -338,7 +338,7 @@ static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree,
 
        SSVAL(tp.in.params.data, 0, info_level);
        SIVAL(tp.in.params.data, 2, 0);
-       cli_blob_append_string(tree->session, mem_ctx, &tp.in.params,
+       smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params,
                               fname, STR_TERMINATE);
        
        req = smb_raw_trans2_send(tree, &tp);
@@ -351,18 +351,18 @@ static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree,
 /****************************************************************************
  send a SMBgetatr (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_getattr_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_getattr_send(struct smbcli_tree *tree,
                                                union smb_fileinfo *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        
-       req = cli_request_setup(tree, SMBgetatr, 0, 0);
+       req = smbcli_request_setup(tree, SMBgetatr, 0, 0);
        if (!req) return NULL;
 
-       cli_req_append_ascii4(req, parms->getattr.in.fname, STR_TERMINATE);
+       smbcli_req_append_ascii4(req, parms->getattr.in.fname, STR_TERMINATE);
        
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -372,39 +372,39 @@ static struct cli_request *smb_raw_getattr_send(struct cli_tree *tree,
 /****************************************************************************
  send a SMBgetatr (async recv)
 ****************************************************************************/
-static NTSTATUS smb_raw_getattr_recv(struct cli_request *req,
+static NTSTATUS smb_raw_getattr_recv(struct smbcli_request *req,
                                     union smb_fileinfo *parms)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
+               return smbcli_request_destroy(req);
        }
 
-       CLI_CHECK_WCT(req, 10);
+       SMBCLI_CHECK_WCT(req, 10);
        parms->getattr.out.attrib =     SVAL(req->in.vwv, VWV(0));
        parms->getattr.out.write_time = raw_pull_dos_date3(req->transport,
                                                           req->in.vwv + VWV(1));
        parms->getattr.out.size =       IVAL(req->in.vwv, VWV(3));
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 
 /****************************************************************************
  Handle SMBgetattrE (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_getattrE_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_getattrE_send(struct smbcli_tree *tree,
                                                 union smb_fileinfo *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        
-       req = cli_request_setup(tree, SMBgetattrE, 1, 0);
+       req = smbcli_request_setup(tree, SMBgetattrE, 1, 0);
        if (!req) return NULL;
        
        SSVAL(req->out.vwv, VWV(0), parms->getattre.in.fnum);
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -414,15 +414,15 @@ static struct cli_request *smb_raw_getattrE_send(struct cli_tree *tree,
 /****************************************************************************
  Handle SMBgetattrE (async send)
 ****************************************************************************/
-static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req,
+static NTSTATUS smb_raw_getattrE_recv(struct smbcli_request *req,
                                      union smb_fileinfo *parms)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
+               return smbcli_request_destroy(req);
        }
        
-       CLI_CHECK_WCT(req, 11);
+       SMBCLI_CHECK_WCT(req, 11);
        parms->getattre.out.create_time =   raw_pull_dos_date2(req->transport,
                                                               req->in.vwv + VWV(0));
        parms->getattre.out.access_time =   raw_pull_dos_date2(req->transport,
@@ -434,14 +434,14 @@ static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req,
        parms->getattre.out.attrib =        SVAL(req->in.vwv,             VWV(10));
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 
 /****************************************************************************
  Query file info (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_fileinfo_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree,
                                          union smb_fileinfo *parms)
 {
        /* pass off the non-trans2 level to specialised functions */
@@ -460,13 +460,13 @@ struct cli_request *smb_raw_fileinfo_send(struct cli_tree *tree,
 /****************************************************************************
  Query file info (async recv)
 ****************************************************************************/
-NTSTATUS smb_raw_fileinfo_recv(struct cli_request *req,
+NTSTATUS smb_raw_fileinfo_recv(struct smbcli_request *req,
                               TALLOC_CTX *mem_ctx,
                               union smb_fileinfo *parms)
 {
        DATA_BLOB blob;
        NTSTATUS status;
-       struct cli_session *session = req?req->session:NULL;
+       struct smbcli_session *session = req?req->session:NULL;
 
        if (parms->generic.level == RAW_FILEINFO_GETATTRE) {
                return smb_raw_getattrE_recv(req, parms);
@@ -486,18 +486,18 @@ NTSTATUS smb_raw_fileinfo_recv(struct cli_request *req,
 /****************************************************************************
  Query file info (sync interface)
 ****************************************************************************/
-NTSTATUS smb_raw_fileinfo(struct cli_tree *tree,
+NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree,
                          TALLOC_CTX *mem_ctx,
                          union smb_fileinfo *parms)
 {
-       struct cli_request *req = smb_raw_fileinfo_send(tree, parms);
+       struct smbcli_request *req = smb_raw_fileinfo_send(tree, parms);
        return smb_raw_fileinfo_recv(req, mem_ctx, parms);
 }
 
 /****************************************************************************
  Query path info (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_pathinfo_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree,
                                          union smb_fileinfo *parms)
 {
        if (parms->generic.level == RAW_FILEINFO_GETATTR) {
@@ -514,7 +514,7 @@ struct cli_request *smb_raw_pathinfo_send(struct cli_tree *tree,
 /****************************************************************************
  Query path info (async recv)
 ****************************************************************************/
-NTSTATUS smb_raw_pathinfo_recv(struct cli_request *req,
+NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req,
                               TALLOC_CTX *mem_ctx,
                               union smb_fileinfo *parms)
 {
@@ -525,10 +525,10 @@ NTSTATUS smb_raw_pathinfo_recv(struct cli_request *req,
 /****************************************************************************
  Query path info (sync interface)
 ****************************************************************************/
-NTSTATUS smb_raw_pathinfo(struct cli_tree *tree,
+NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree,
                          TALLOC_CTX *mem_ctx,
                          union smb_fileinfo *parms)
 {
-       struct cli_request *req = smb_raw_pathinfo_send(tree, parms);
+       struct smbcli_request *req = smb_raw_pathinfo_send(tree, parms);
        return smb_raw_pathinfo_recv(req, mem_ctx, parms);
 }
index faf375deb0afb0f99be748dc202e4c3b72cdf823..aefe8e3085bd972a1794cdb05daac22d8a6368cc 100644 (file)
 /****************************************************************************
  Query FS Info - SMBdskattr call (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_dskattr_send(struct cli_tree *tree, 
+static struct smbcli_request *smb_raw_dskattr_send(struct smbcli_tree *tree, 
                                                union smb_fsinfo *fsinfo)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
-       req = cli_request_setup(tree, SMBdskattr, 0, 0);
+       req = smbcli_request_setup(tree, SMBdskattr, 0, 0);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -43,29 +43,29 @@ static struct cli_request *smb_raw_dskattr_send(struct cli_tree *tree,
 /****************************************************************************
  Query FS Info - SMBdskattr call (async recv)
 ****************************************************************************/
-static NTSTATUS smb_raw_dskattr_recv(struct cli_request *req,
+static NTSTATUS smb_raw_dskattr_recv(struct smbcli_request *req,
                                     union smb_fsinfo *fsinfo)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
                goto failed;
        }
 
-       CLI_CHECK_WCT(req, 5);
+       SMBCLI_CHECK_WCT(req, 5);
        fsinfo->dskattr.out.units_total =     SVAL(req->in.vwv, VWV(0));
        fsinfo->dskattr.out.blocks_per_unit = SVAL(req->in.vwv, VWV(1));
        fsinfo->dskattr.out.block_size =      SVAL(req->in.vwv, VWV(2));
        fsinfo->dskattr.out.units_free =      SVAL(req->in.vwv, VWV(3));
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 
 /****************************************************************************
  RAW_QFS_ trans2 interface via blobs (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_qfsinfo_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_qfsinfo_send(struct smbcli_tree *tree,
                                                TALLOC_CTX *mem_ctx,
                                                uint16_t info_level)
 {
@@ -94,7 +94,7 @@ static struct cli_request *smb_raw_qfsinfo_send(struct cli_tree *tree,
 /****************************************************************************
  RAW_QFS_ trans2 interface via blobs (async recv)
 ****************************************************************************/
-static NTSTATUS smb_raw_qfsinfo_blob_recv(struct cli_request *req,
+static NTSTATUS smb_raw_qfsinfo_blob_recv(struct smbcli_request *req,
                                          TALLOC_CTX *mem_ctx,
                                          DATA_BLOB *blob)
 {
@@ -129,7 +129,7 @@ static NTSTATUS smb_raw_qfsinfo_blob_recv(struct cli_request *req,
 /****************************************************************************
  Query FSInfo raw interface (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_fsinfo_send(struct cli_tree *tree, 
+struct smbcli_request *smb_raw_fsinfo_send(struct smbcli_tree *tree, 
                                        TALLOC_CTX *mem_ctx, 
                                        union smb_fsinfo *fsinfo)
 {
@@ -153,14 +153,14 @@ struct cli_request *smb_raw_fsinfo_send(struct cli_tree *tree,
 /****************************************************************************
  Query FSInfo raw interface (async recv)
 ****************************************************************************/
-NTSTATUS smb_raw_fsinfo_recv(struct cli_request *req, 
+NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req, 
                             TALLOC_CTX *mem_ctx, 
                             union smb_fsinfo *fsinfo)
 {
        DATA_BLOB blob;
        NTSTATUS status;
        int i;
-       struct cli_session *session = req?req->session:NULL;
+       struct smbcli_session *session = req?req->session:NULL;
 
        if (fsinfo->generic.level == RAW_QFS_DSKATTR) {
                return smb_raw_dskattr_recv(req, fsinfo);
@@ -190,7 +190,7 @@ NTSTATUS smb_raw_fsinfo_recv(struct cli_request *req,
        case RAW_QFS_VOLUME:
                QFS_CHECK_MIN_SIZE(5);
                fsinfo->volume.out.serial_number = IVAL(blob.data, 0);
-               cli_blob_pull_string(session, mem_ctx, &blob, 
+               smbcli_blob_pull_string(session, mem_ctx, &blob, 
                                     &fsinfo->volume.out.volume_name,
                                     4, 5, STR_LEN8BIT | STR_NOALIGN);
                break;          
@@ -198,9 +198,9 @@ NTSTATUS smb_raw_fsinfo_recv(struct cli_request *req,
        case RAW_QFS_VOLUME_INFO:
        case RAW_QFS_VOLUME_INFORMATION:
                QFS_CHECK_MIN_SIZE(18);
-               fsinfo->volume_info.out.create_time   = cli_pull_nttime(blob.data, 0);
+               fsinfo->volume_info.out.create_time   = smbcli_pull_nttime(blob.data, 0);
                fsinfo->volume_info.out.serial_number = IVAL(blob.data, 8);
-               cli_blob_pull_string(session, mem_ctx, &blob, 
+               smbcli_blob_pull_string(session, mem_ctx, &blob, 
                                     &fsinfo->volume_info.out.volume_name,
                                     12, 18, STR_UNICODE);
                break;          
@@ -226,7 +226,7 @@ NTSTATUS smb_raw_fsinfo_recv(struct cli_request *req,
                QFS_CHECK_MIN_SIZE(12);
                fsinfo->attribute_info.out.fs_attr   =                 IVAL(blob.data, 0);
                fsinfo->attribute_info.out.max_file_component_length = IVAL(blob.data, 4);
-               cli_blob_pull_string(session, mem_ctx, &blob, 
+               smbcli_blob_pull_string(session, mem_ctx, &blob, 
                                     &fsinfo->attribute_info.out.fs_type,
                                     8, 12, STR_UNICODE);
                break;          
@@ -274,10 +274,10 @@ failed:
 /****************************************************************************
  Query FSInfo raw interface (sync interface)
 ****************************************************************************/
-NTSTATUS smb_raw_fsinfo(struct cli_tree *tree, 
+NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree, 
                        TALLOC_CTX *mem_ctx, 
                        union smb_fsinfo *fsinfo)
 {
-       struct cli_request *req = smb_raw_fsinfo_send(tree, mem_ctx, fsinfo);
+       struct smbcli_request *req = smb_raw_fsinfo_send(tree, mem_ctx, fsinfo);
        return smb_raw_fsinfo_recv(req, mem_ctx, fsinfo);
 }
index 271758c65c5a1cf07af6a2b9a336224f36163927..798300451b4129a4bea74d96565392def7173f1a 100644 (file)
 #include "includes.h"
 
 #define SETUP_REQUEST(cmd, wct, buflen) do { \
-       req = cli_request_setup(tree, cmd, wct, buflen); \
+       req = smbcli_request_setup(tree, cmd, wct, buflen); \
        if (!req) return NULL; \
 } while (0)
 
 /* 
    send a raw smb ioctl - async send
 */
-static struct cli_request *smb_raw_smbioctl_send(struct cli_tree *tree, 
+static struct smbcli_request *smb_raw_smbioctl_send(struct smbcli_tree *tree, 
                                                 union smb_ioctl *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        SETUP_REQUEST(SMBioctl, 3, 0);
 
        SSVAL(req->out.vwv, VWV(0), parms->ioctl.in.fnum);
        SIVAL(req->out.vwv, VWV(1), parms->ioctl.in.request);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -50,17 +50,17 @@ static struct cli_request *smb_raw_smbioctl_send(struct cli_tree *tree,
 /* 
    send a raw smb ioctl - async recv
 */
-static NTSTATUS smb_raw_smbioctl_recv(struct cli_request *req, 
+static NTSTATUS smb_raw_smbioctl_recv(struct smbcli_request *req, 
                                      TALLOC_CTX *mem_ctx, 
                                      union smb_ioctl *parms)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
+               return smbcli_request_destroy(req);
        }
 
-       parms->ioctl.out.blob = cli_req_pull_blob(req, mem_ctx, req->in.data, -1);
-       return cli_request_destroy(req);
+       parms->ioctl.out.blob = smbcli_req_pull_blob(req, mem_ctx, req->in.data, -1);
+       return smbcli_request_destroy(req);
 }
 
 
@@ -68,7 +68,7 @@ static NTSTATUS smb_raw_smbioctl_recv(struct cli_request *req,
 /****************************************************************************
 NT ioctl (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_ntioctl_send(struct cli_tree *tree, 
+static struct smbcli_request *smb_raw_ntioctl_send(struct smbcli_tree *tree, 
                                                union smb_ioctl *parms)
 {
        struct smb_nttrans nt;
@@ -93,26 +93,26 @@ static struct cli_request *smb_raw_ntioctl_send(struct cli_tree *tree,
 /****************************************************************************
 NT ioctl (async recv)
 ****************************************************************************/
-static NTSTATUS smb_raw_ntioctl_recv(struct cli_request *req, 
+static NTSTATUS smb_raw_ntioctl_recv(struct smbcli_request *req, 
                                     TALLOC_CTX *mem_ctx,
                                     union smb_ioctl *parms)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
+               return smbcli_request_destroy(req);
        }
 
-       parms->ntioctl.out.blob = cli_req_pull_blob(req, mem_ctx, req->in.data, -1);
-       return cli_request_destroy(req);
+       parms->ntioctl.out.blob = smbcli_req_pull_blob(req, mem_ctx, req->in.data, -1);
+       return smbcli_request_destroy(req);
 }
 
 
 /* 
    send a raw ioctl - async send
 */
-struct cli_request *smb_raw_ioctl_send(struct cli_tree *tree, union smb_ioctl *parms)
+struct smbcli_request *smb_raw_ioctl_send(struct smbcli_tree *tree, union smb_ioctl *parms)
 {
-       struct cli_request *req = NULL;
+       struct smbcli_request *req = NULL;
        
        switch (parms->generic.level) {
        case RAW_IOCTL_IOCTL:
@@ -130,7 +130,7 @@ struct cli_request *smb_raw_ioctl_send(struct cli_tree *tree, union smb_ioctl *p
 /* 
    recv a raw ioctl - async recv
 */
-NTSTATUS smb_raw_ioctl_recv(struct cli_request *req,
+NTSTATUS smb_raw_ioctl_recv(struct smbcli_request *req,
                            TALLOC_CTX *mem_ctx, union smb_ioctl *parms)
 {
        switch (parms->generic.level) {
@@ -146,10 +146,10 @@ NTSTATUS smb_raw_ioctl_recv(struct cli_request *req,
 /* 
    send a raw ioctl - sync interface
 */
-NTSTATUS smb_raw_ioctl(struct cli_tree *tree, 
+NTSTATUS smb_raw_ioctl(struct smbcli_tree *tree, 
                TALLOC_CTX *mem_ctx, union smb_ioctl *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        req = smb_raw_ioctl_send(tree, parms);
        return smb_raw_ioctl_recv(req, mem_ctx, parms);
 }
index 6bf35fb26db6d7c6f6363a0d1b9cfaa6cfce2e70..9b00aa6121ff3e252b5539221c5510440ded449f 100644 (file)
@@ -41,13 +41,13 @@ static const struct {
 /****************************************************************************
  Send a negprot command.
 ****************************************************************************/
-struct cli_request *smb_negprot_send(struct cli_transport *transport, int maxprotocol)
+struct smbcli_request *smb_negprot_send(struct smbcli_transport *transport, int maxprotocol)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        int i;
        uint16_t flags2 = 0;
 
-       req = cli_request_setup_transport(transport, SMBnegprot, 0, 0);
+       req = smbcli_request_setup_transport(transport, SMBnegprot, 0, 0);
        if (!req) {
                return NULL;
        }
@@ -66,12 +66,12 @@ struct cli_request *smb_negprot_send(struct cli_transport *transport, int maxpro
 
        /* setup the protocol strings */
        for (i=0; i < ARRAY_SIZE(prots) && prots[i].prot <= maxprotocol; i++) {
-               cli_req_append_bytes(req, "\2", 1);
-               cli_req_append_string(req, prots[i].name, STR_TERMINATE | STR_ASCII);
+               smbcli_req_append_bytes(req, "\2", 1);
+               smbcli_req_append_string(req, prots[i].name, STR_TERMINATE | STR_ASCII);
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -81,9 +81,9 @@ struct cli_request *smb_negprot_send(struct cli_transport *transport, int maxpro
 /****************************************************************************
  Send a negprot command.
 ****************************************************************************/
-NTSTATUS smb_raw_negotiate(struct cli_transport *transport) 
+NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport) 
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        int protocol;
 
        req = smb_negprot_send(transport, PROTOCOL_NT1);
@@ -91,18 +91,18 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport)
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
+               return smbcli_request_destroy(req);
        }
 
-       CLI_CHECK_MIN_WCT(req, 1);
+       SMBCLI_CHECK_MIN_WCT(req, 1);
 
        protocol = SVALS(req->in.vwv, VWV(0));
 
        if (protocol >= ARRAY_SIZE(prots) || protocol < 0) {
                req->status = NT_STATUS_UNSUCCESSFUL;
-               return cli_request_destroy(req);
+               return smbcli_request_destroy(req);
        }
 
        transport->negotiate.protocol = prots[protocol].prot;
@@ -111,7 +111,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport)
                NTTIME ntt;
 
                /* NT protocol */
-               CLI_CHECK_WCT(req, 17);
+               SMBCLI_CHECK_WCT(req, 17);
                transport->negotiate.sec_mode = CVAL(req->in.vwv,VWV(1));
                transport->negotiate.max_mux  = SVAL(req->in.vwv,VWV(1)+1);
                transport->negotiate.max_xmit = IVAL(req->in.vwv,VWV(3)+1);
@@ -119,7 +119,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport)
                transport->negotiate.capabilities = IVAL(req->in.vwv,VWV(9)+1);
 
                /* this time arrives in real GMT */
-               ntt = cli_pull_nttime(req->in.vwv, VWV(11)+1);
+               ntt = smbcli_pull_nttime(req->in.vwv, VWV(11)+1);
                transport->negotiate.server_time = nt_time_to_unix(ntt);                
                transport->negotiate.server_zone = SVALS(req->in.vwv,VWV(15)+1) * 60;
                transport->negotiate.key_len = CVAL(req->in.vwv,VWV(16)+1);
@@ -128,14 +128,14 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport)
                        if (req->in.data_size < 16) {
                                goto failed;
                        }
-                       transport->negotiate.server_guid = cli_req_pull_blob(req, transport->mem_ctx, req->in.data, 16);
-                       transport->negotiate.secblob = cli_req_pull_blob(req, transport->mem_ctx, req->in.data + 16, req->in.data_size - 16);
+                       transport->negotiate.server_guid = smbcli_req_pull_blob(req, transport->mem_ctx, req->in.data, 16);
+                       transport->negotiate.secblob = smbcli_req_pull_blob(req, transport->mem_ctx, req->in.data + 16, req->in.data_size - 16);
                } else {
                        if (req->in.data_size < (transport->negotiate.key_len)) {
                                goto failed;
                        }
-                       transport->negotiate.secblob = cli_req_pull_blob(req, transport->mem_ctx, req->in.data, transport->negotiate.key_len);
-                       cli_req_pull_string(req, transport->mem_ctx, &transport->negotiate.server_domain,
+                       transport->negotiate.secblob = smbcli_req_pull_blob(req, transport->mem_ctx, req->in.data, transport->negotiate.key_len);
+                       smbcli_req_pull_string(req, transport->mem_ctx, &transport->negotiate.server_domain,
                                            req->in.data+transport->negotiate.key_len,
                                            req->in.data_size-transport->negotiate.key_len, STR_UNICODE|STR_NOALIGN);
                        /* here comes the server name */
@@ -146,7 +146,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport)
                        transport->negotiate.writebraw_supported = True;
                }
        } else if (transport->negotiate.protocol >= PROTOCOL_LANMAN1) {
-               CLI_CHECK_WCT(req, 13);
+               SMBCLI_CHECK_WCT(req, 13);
                transport->negotiate.sec_mode = SVAL(req->in.vwv,VWV(1));
                transport->negotiate.max_xmit = SVAL(req->in.vwv,VWV(2));
                transport->negotiate.sesskey =  IVAL(req->in.vwv,VWV(6));
@@ -161,7 +161,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport)
                if ((SVAL(req->in.vwv,VWV(5)) & 0x2)) {
                        transport->negotiate.writebraw_supported = 1;
                }
-               transport->negotiate.secblob = cli_req_pull_blob(req, transport->mem_ctx, 
+               transport->negotiate.secblob = smbcli_req_pull_blob(req, transport->mem_ctx, 
                                                                 req->in.data, req->in.data_size);
        } else {
                /* the old core protocol */
@@ -172,10 +172,10 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport)
        }
 
        /* a way to force ascii SMB */
-       if (getenv("CLI_FORCE_ASCII")) {
+       if (getenv("SMBCLI_FORCE_ASCII")) {
                transport->negotiate.capabilities &= ~CAP_UNICODE;
        }
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
index a9215fee10bd2f10a7f3acb37800075d23b1a521..47553e735eef264e3846dae47053baa96d81f08c 100644 (file)
@@ -23,7 +23,7 @@
 /****************************************************************************
 change notify (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_changenotify_send(struct cli_tree *tree, struct smb_notify *parms)
+struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, struct smb_notify *parms)
 {
        struct smb_nttrans nt;
        uint16_t setup[4];
@@ -46,13 +46,13 @@ struct cli_request *smb_raw_changenotify_send(struct cli_tree *tree, struct smb_
 /****************************************************************************
 change notify (async recv)
 ****************************************************************************/
-NTSTATUS smb_raw_changenotify_recv(struct cli_request *req, 
+NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, 
                                   TALLOC_CTX *mem_ctx, struct smb_notify *parms)
 {
        struct smb_nttrans nt;
        NTSTATUS status;
        uint32_t ofs, i;
-       struct cli_session *session = req?req->session:NULL;
+       struct smbcli_session *session = req?req->session:NULL;
 
        status = smb_raw_nttrans_recv(req, mem_ctx, &nt);
        if (!NT_STATUS_IS_OK(status)) {
@@ -80,7 +80,7 @@ NTSTATUS smb_raw_changenotify_recv(struct cli_request *req,
 
        for (i=ofs=0; i<parms->out.num_changes; i++) {
                parms->out.changes[i].action = IVAL(nt.out.params.data, ofs+4);
-               cli_blob_pull_string(session, mem_ctx, &nt.out.params, 
+               smbcli_blob_pull_string(session, mem_ctx, &nt.out.params, 
                                     &parms->out.changes[i].name, 
                                     ofs+8, ofs+12, STR_UNICODE);
                ofs += IVAL(nt.out.params.data, ofs);
@@ -95,11 +95,11 @@ NTSTATUS smb_raw_changenotify_recv(struct cli_request *req,
  used to cancel a pending change notify request
  note that this request does not expect a response!
 ****************************************************************************/
-NTSTATUS smb_raw_ntcancel(struct cli_request *oldreq)
+NTSTATUS smb_raw_ntcancel(struct smbcli_request *oldreq)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
-       req = cli_request_setup_transport(oldreq->transport, SMBntcancel, 0, 0);
+       req = smbcli_request_setup_transport(oldreq->transport, SMBntcancel, 0, 0);
 
        SSVAL(req->out.hdr, HDR_MID, SVAL(oldreq->out.hdr, HDR_MID));   
        SSVAL(req->out.hdr, HDR_PID, SVAL(oldreq->out.hdr, HDR_PID));   
@@ -111,7 +111,7 @@ NTSTATUS smb_raw_ntcancel(struct cli_request *oldreq)
        req->sign_single_increment = 1;
        req->one_way_request = 1;
 
-       cli_request_send(req);
+       smbcli_request_send(req);
 
        return NT_STATUS_OK;
 }
index 3e3b29d2521b072ad87c30a940008348ae752d72..f0a9a063edf7631ab3e514c66520cba42f53172a 100644 (file)
@@ -22,7 +22,7 @@
 #include "includes.h"
 
 #define SETUP_REQUEST(cmd, wct, buflen) do { \
-       req = cli_request_setup(tree, cmd, wct, buflen); \
+       req = smbcli_request_setup(tree, cmd, wct, buflen); \
        if (!req) return NULL; \
 } while (0)
 
 /****************************************************************************
  low level read operation (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_read_send(struct cli_tree *tree, union smb_read *parms)
+struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_read *parms)
 {
        BOOL bigoffset = False;
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        switch (parms->generic.level) {
        case RAW_READ_GENERIC:
@@ -90,8 +90,8 @@ struct cli_request *smb_raw_read_send(struct cli_tree *tree, union smb_read *par
                break;
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -107,10 +107,10 @@ struct cli_request *smb_raw_read_send(struct cli_tree *tree, union smb_read *par
 /****************************************************************************
  low level read operation (async recv)
 ****************************************************************************/
-NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms)
+NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read *parms)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
                goto failed;
        }
 
@@ -130,10 +130,10 @@ NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms)
                break;
                
        case RAW_READ_LOCKREAD:
-               CLI_CHECK_WCT(req, 5);
+               SMBCLI_CHECK_WCT(req, 5);
                parms->lockread.out.nread = SVAL(req->in.vwv, VWV(0));
                if (parms->lockread.out.nread > parms->lockread.in.count ||
-                   !cli_raw_pull_data(req, req->in.data+3, 
+                   !smbcli_raw_pull_data(req, req->in.data+3, 
                                       parms->lockread.out.nread, parms->lockread.out.data)) {
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
                }
@@ -141,10 +141,10 @@ NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms)
 
        case RAW_READ_READ:
                /* there are 4 reserved words in the reply */
-               CLI_CHECK_WCT(req, 5);
+               SMBCLI_CHECK_WCT(req, 5);
                parms->read.out.nread = SVAL(req->in.vwv, VWV(0));
                if (parms->read.out.nread > parms->read.in.count ||
-                   !cli_raw_pull_data(req, req->in.data+3, 
+                   !smbcli_raw_pull_data(req, req->in.data+3, 
                                       parms->read.out.nread, parms->read.out.data)) {
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
                }
@@ -152,12 +152,12 @@ NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms)
 
        case RAW_READ_READX:
                /* there are 5 reserved words in the reply */
-               CLI_CHECK_WCT(req, 12);
+               SMBCLI_CHECK_WCT(req, 12);
                parms->readx.out.remaining       = SVAL(req->in.vwv, VWV(2));
                parms->readx.out.compaction_mode = SVAL(req->in.vwv, VWV(3));
                parms->readx.out.nread = SVAL(req->in.vwv, VWV(5));
                if (parms->readx.out.nread > MAX(parms->readx.in.mincnt, parms->readx.in.maxcnt) ||
-                   !cli_raw_pull_data(req, req->in.hdr + SVAL(req->in.vwv, VWV(6)), 
+                   !smbcli_raw_pull_data(req, req->in.hdr + SVAL(req->in.vwv, VWV(6)), 
                                       parms->readx.out.nread, 
                                       parms->readx.out.data)) {
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
@@ -166,15 +166,15 @@ NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms)
        }
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 /****************************************************************************
  low level read operation (sync interface)
 ****************************************************************************/
-NTSTATUS smb_raw_read(struct cli_tree *tree, union smb_read *parms)
+NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms)
 {
-       struct cli_request *req = smb_raw_read_send(tree, parms);
+       struct smbcli_request *req = smb_raw_read_send(tree, parms);
        return smb_raw_read_recv(req, parms);
 }
 
@@ -182,10 +182,10 @@ NTSTATUS smb_raw_read(struct cli_tree *tree, union smb_read *parms)
 /****************************************************************************
  raw write interface (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_write_send(struct cli_tree *tree, union smb_write *parms)
+struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_write *parms)
 {
        BOOL bigoffset = False;
-       struct cli_request *req; 
+       struct smbcli_request *req; 
 
        switch (parms->generic.level) {
        case RAW_WRITE_GENERIC:
@@ -264,8 +264,8 @@ struct cli_request *smb_raw_write_send(struct cli_tree *tree, union smb_write *p
                break;
        }
 
-       if (!cli_request_send(req)) {
-cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -276,10 +276,10 @@ cli_request_destroy(req);
 /****************************************************************************
  raw write interface (async recv)
 ****************************************************************************/
-NTSTATUS smb_raw_write_recv(struct cli_request *req, union smb_write *parms)
+NTSTATUS smb_raw_write_recv(struct smbcli_request *req, union smb_write *parms)
 {
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
                goto failed;
        }
 
@@ -287,19 +287,19 @@ NTSTATUS smb_raw_write_recv(struct cli_request *req, union smb_write *parms)
        case RAW_WRITE_GENERIC:
                break;
        case RAW_WRITE_WRITEUNLOCK:
-               CLI_CHECK_WCT(req, 1);          
+               SMBCLI_CHECK_WCT(req, 1);               
                parms->writeunlock.out.nwritten = SVAL(req->in.vwv, VWV(0));
                break;
        case RAW_WRITE_WRITE:
-               CLI_CHECK_WCT(req, 1);
+               SMBCLI_CHECK_WCT(req, 1);
                parms->write.out.nwritten = SVAL(req->in.vwv, VWV(0));
                break;
        case RAW_WRITE_WRITECLOSE:
-               CLI_CHECK_WCT(req, 1);
+               SMBCLI_CHECK_WCT(req, 1);
                parms->writeclose.out.nwritten = SVAL(req->in.vwv, VWV(0));
                break;
        case RAW_WRITE_WRITEX:
-               CLI_CHECK_WCT(req, 6);
+               SMBCLI_CHECK_WCT(req, 6);
                parms->writex.out.nwritten  = SVAL(req->in.vwv, VWV(2));
                parms->writex.out.nwritten += (CVAL(req->in.vwv, VWV(4)) << 16);
                parms->writex.out.remaining = SVAL(req->in.vwv, VWV(3));
@@ -309,14 +309,14 @@ NTSTATUS smb_raw_write_recv(struct cli_request *req, union smb_write *parms)
        }
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 /****************************************************************************
  raw write interface (sync interface)
 ****************************************************************************/
-NTSTATUS smb_raw_write(struct cli_tree *tree, union smb_write *parms)
+NTSTATUS smb_raw_write(struct smbcli_tree *tree, union smb_write *parms)
 {
-       struct cli_request *req = smb_raw_write_send(tree, parms);
+       struct smbcli_request *req = smb_raw_write_send(tree, parms);
        return smb_raw_write_recv(req, parms);
 }
index 38b8f71f5705ea6777b492da96a7fa59ce81a9d1..4143cb12ca9247666fe09393ec1e052903127ca7 100644 (file)
@@ -20,7 +20,7 @@
 */
 
 /*
-  this file implements functions for manipulating the 'struct cli_request' structure in libsmb
+  this file implements functions for manipulating the 'struct smbcli_request' structure in libsmb
 */
 
 #include "includes.h"
@@ -32,7 +32,7 @@
 #define MAX_BYTES_PER_CHAR 3
 
 /* destroy a request structure and return final status */
-NTSTATUS cli_request_destroy(struct cli_request *req)
+NTSTATUS smbcli_request_destroy(struct smbcli_request *req)
 {
        NTSTATUS status;
 
@@ -58,28 +58,28 @@ NTSTATUS cli_request_destroy(struct cli_request *req)
   low-level function to setup a request buffer for a non-SMB packet 
   at the transport level
 */
-struct cli_request *cli_request_setup_nonsmb(struct cli_transport *transport, uint_t size)
+struct smbcli_request *smbcli_request_setup_nonsmb(struct smbcli_transport *transport, uint_t size)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        TALLOC_CTX *mem_ctx;
        
        /* each request gets its own talloc context. The request
           structure itself is also allocated inside this context,
           so we need to allocate it before we construct the request
        */
-       mem_ctx = talloc_init("cli_request");
+       mem_ctx = talloc_init("smbcli_request");
        if (!mem_ctx) {
                return NULL;
        }
 
-       req = talloc(mem_ctx, sizeof(struct cli_request));
+       req = talloc(mem_ctx, sizeof(struct smbcli_request));
        if (!req) {
                return NULL;
        }
        ZERO_STRUCTP(req);
 
        /* setup the request context */
-       req->state = CLI_REQUEST_INIT;
+       req->state = SMBCLI_REQUEST_INIT;
        req->mem_ctx = mem_ctx;
        req->transport = transport;
        req->session = NULL;
@@ -103,12 +103,12 @@ struct cli_request *cli_request_setup_nonsmb(struct cli_transport *transport, ui
 /*
   setup a SMB packet at transport level
 */
-struct cli_request *cli_request_setup_transport(struct cli_transport *transport,
+struct smbcli_request *smbcli_request_setup_transport(struct smbcli_transport *transport,
                                                uint8_t command, uint_t wct, uint_t buflen)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
-       req = cli_request_setup_nonsmb(transport, NBT_HDR_SIZE + MIN_SMB_SIZE + wct*2 + buflen);
+       req = smbcli_request_setup_nonsmb(transport, NBT_HDR_SIZE + MIN_SMB_SIZE + wct*2 + buflen);
 
        if (!req) return NULL;
        
@@ -129,7 +129,7 @@ struct cli_request *cli_request_setup_transport(struct cli_transport *transport,
        SSVAL(req->out.hdr,HDR_FLG2, 0);
 
        /* assign a mid */
-       req->mid = cli_transport_next_mid(transport);
+       req->mid = smbcli_transport_next_mid(transport);
 
        /* copy the pid, uid and mid to the request */
        SSVAL(req->out.hdr, HDR_PID, 0);
@@ -146,17 +146,17 @@ struct cli_request *cli_request_setup_transport(struct cli_transport *transport,
 /*
   setup a reply in req->out with the given word count and initial data
   buffer size.  the caller will then fill in the command words and
-  data before calling cli_request_send() to send the reply on its
+  data before calling smbcli_request_send() to send the reply on its
   way. This interface is used before a session is setup.
 */
-struct cli_request *cli_request_setup_session(struct cli_session *session,
+struct smbcli_request *smbcli_request_setup_session(struct smbcli_session *session,
                                              uint8_t command, uint_t wct, uint_t buflen)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        uint16_t flags2;
        uint32_t capabilities;
 
-       req = cli_request_setup_transport(session->transport, command, wct, buflen);
+       req = smbcli_request_setup_transport(session->transport, command, wct, buflen);
 
        if (!req) return NULL;
 
@@ -189,13 +189,13 @@ struct cli_request *cli_request_setup_session(struct cli_session *session,
 /*
   setup a request for tree based commands
 */
-struct cli_request *cli_request_setup(struct cli_tree *tree,
+struct smbcli_request *smbcli_request_setup(struct smbcli_tree *tree,
                                      uint8_t command, 
                                      uint_t wct, uint_t buflen)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
-       req = cli_request_setup_session(tree->session, command, wct, buflen);
+       req = smbcli_request_setup_session(tree->session, command, wct, buflen);
        if (req) {
                req->tree = tree;
                SSVAL(req->out.hdr,HDR_TID,tree->tid);
@@ -211,7 +211,7 @@ struct cli_request *cli_request_setup(struct cli_tree *tree,
   To cope with this req->out.ptr is supplied. This will be updated to
   point at the same offset into the packet as before this call
 */
-static void cli_req_grow_allocation(struct cli_request *req, uint_t new_size)
+static void smbcli_req_grow_allocation(struct smbcli_request *req, uint_t new_size)
 {
        int delta;
        char *buf2;
@@ -252,11 +252,11 @@ static void cli_req_grow_allocation(struct cli_request *req, uint_t new_size)
   To cope with this req->out.ptr is supplied. This will be updated to
   point at the same offset into the packet as before this call
 */
-static void cli_req_grow_data(struct cli_request *req, uint_t new_size)
+static void smbcli_req_grow_data(struct smbcli_request *req, uint_t new_size)
 {
        int delta;
 
-       cli_req_grow_allocation(req, new_size);
+       smbcli_req_grow_allocation(req, new_size);
 
        delta = new_size - req->out.data_size;
 
@@ -271,15 +271,15 @@ static void cli_req_grow_data(struct cli_request *req, uint_t new_size)
 /*
   send a message
 */
-BOOL cli_request_send(struct cli_request *req)
+BOOL smbcli_request_send(struct smbcli_request *req)
 {
        if (IVAL(req->out.buffer, 0) == 0) {
                _smb_setlen(req->out.buffer, req->out.size - NBT_HDR_SIZE);
        }
 
-       cli_request_calculate_sign_mac(req);
+       smbcli_request_calculate_sign_mac(req);
 
-       cli_transport_send(req);
+       smbcli_transport_send(req);
 
        return True;
 }
@@ -288,14 +288,14 @@ BOOL cli_request_send(struct cli_request *req)
 /*
   receive a response to a packet
 */
-BOOL cli_request_receive(struct cli_request *req)
+BOOL smbcli_request_receive(struct smbcli_request *req)
 {
        /* req can be NULL when a send has failed. This eliminates lots of NULL
           checks in each module */
        if (!req) return False;
 
        /* keep receiving packets until this one is replied to */
-       while (req->state <= CLI_REQUEST_RECV) {
+       while (req->state <= SMBCLI_REQUEST_RECV) {
                event_loop_once(req->transport->event.ctx);
        }
 
@@ -307,12 +307,12 @@ BOOL cli_request_receive(struct cli_request *req)
   receive another reply to a request - this is used for requests that
   have multi-part replies (such as SMBtrans2)
 */
-BOOL cli_request_receive_more(struct cli_request *req)
+BOOL smbcli_request_receive_more(struct smbcli_request *req)
 {
-       req->state = CLI_REQUEST_RECV;
+       req->state = SMBCLI_REQUEST_RECV;
        DLIST_ADD(req->transport->pending_recv, req);
 
-       return cli_request_receive(req);
+       return smbcli_request_receive(req);
 }
 
 
@@ -320,7 +320,7 @@ BOOL cli_request_receive_more(struct cli_request *req)
   handle oplock break requests from the server - return True if the request was
   an oplock break
 */
-BOOL handle_oplock_break(struct cli_transport *transport, uint_t len, const char *hdr, const char *vwv)
+BOOL handle_oplock_break(struct smbcli_transport *transport, uint_t len, const char *hdr, const char *vwv)
 {
        /* we must be very fussy about what we consider an oplock break to avoid
           matching readbraw replies */
@@ -347,15 +347,15 @@ BOOL handle_oplock_break(struct cli_transport *transport, uint_t len, const char
   wait for a reply to be received for a packet that just returns an error
   code and nothing more
 */
-NTSTATUS cli_request_simple_recv(struct cli_request *req)
+NTSTATUS smbcli_request_simple_recv(struct smbcli_request *req)
 {
-       cli_request_receive(req);
-       return cli_request_destroy(req);
+       smbcli_request_receive(req);
+       return smbcli_request_destroy(req);
 }
 
 
 /* Return true if the last packet was in error */
-BOOL cli_request_is_error(struct cli_request *req)
+BOOL smbcli_request_is_error(struct smbcli_request *req)
 {
        return NT_STATUS_IS_ERR(req->status);
 }
@@ -365,7 +365,7 @@ BOOL cli_request_is_error(struct cli_request *req)
 
   return the number of bytes added to the packet
 */
-size_t cli_req_append_string(struct cli_request *req, const char *str, uint_t flags)
+size_t smbcli_req_append_string(struct smbcli_request *req, const char *str, uint_t flags)
 {
        size_t len;
 
@@ -376,17 +376,17 @@ size_t cli_req_append_string(struct cli_request *req, const char *str, uint_t fl
 
        len = (strlen(str)+2) * MAX_BYTES_PER_CHAR;             
 
-       cli_req_grow_allocation(req, len + req->out.data_size);
+       smbcli_req_grow_allocation(req, len + req->out.data_size);
 
        len = push_string(NULL, req->out.data + req->out.data_size, str, len, flags);
 
-       cli_req_grow_data(req, len + req->out.data_size);
+       smbcli_req_grow_data(req, len + req->out.data_size);
 
        return len;
 }
 
 /*
-  this is like cli_req_append_string but it also return the
+  this is like smbcli_req_append_string but it also return the
   non-terminated string byte length, which can be less than the number
   of bytes consumed in the packet for 2 reasons:
 
@@ -396,7 +396,7 @@ size_t cli_req_append_string(struct cli_request *req, const char *str, uint_t fl
  this is used in places where the non-terminated string byte length is
  placed in the packet as a separate field  
 */
-size_t cli_req_append_string_len(struct cli_request *req, const char *str, uint_t flags, int *len)
+size_t smbcli_req_append_string_len(struct smbcli_request *req, const char *str, uint_t flags, int *len)
 {
        int diff = 0;
        size_t ret;
@@ -412,7 +412,7 @@ size_t cli_req_append_string_len(struct cli_request *req, const char *str, uint_
        }
 
        /* do the hard work */
-       ret = cli_req_append_string(req, str, flags);
+       ret = smbcli_req_append_string(req, str, flags);
 
        /* see if we need to subtract the termination */
        if (flags & STR_TERMINATE) {
@@ -437,11 +437,11 @@ size_t cli_req_append_string_len(struct cli_request *req, const char *str, uint_
 
   if dest_len is -1 then no limit applies
 */
-size_t cli_req_append_ascii4(struct cli_request *req, const char *str, uint_t flags)
+size_t smbcli_req_append_ascii4(struct smbcli_request *req, const char *str, uint_t flags)
 {
        size_t size;
-       cli_req_append_bytes(req, (const uint8_t *)"\4", 1);
-       size = cli_req_append_string(req, str, flags);
+       smbcli_req_append_bytes(req, (const uint8_t *)"\4", 1);
+       size = smbcli_req_append_string(req, str, flags);
        return size + 1;
 }
 
@@ -452,11 +452,11 @@ size_t cli_req_append_ascii4(struct cli_request *req, const char *str, uint_t fl
 
   if dest is NULL, then put the blob at the end of the data portion of the packet
 */
-size_t cli_req_append_blob(struct cli_request *req, const DATA_BLOB *blob)
+size_t smbcli_req_append_blob(struct smbcli_request *req, const DATA_BLOB *blob)
 {
-       cli_req_grow_allocation(req, req->out.data_size + blob->length);
+       smbcli_req_grow_allocation(req, req->out.data_size + blob->length);
        memcpy(req->out.data + req->out.data_size, blob->data, blob->length);
-       cli_req_grow_data(req, req->out.data_size + blob->length);
+       smbcli_req_grow_data(req, req->out.data_size + blob->length);
        return blob->length;
 }
 
@@ -464,11 +464,11 @@ size_t cli_req_append_blob(struct cli_request *req, const DATA_BLOB *blob)
   append raw bytes into the data portion of the request packet
   return the number of bytes added
 */
-size_t cli_req_append_bytes(struct cli_request *req, const uint8_t *bytes, size_t byte_len)
+size_t smbcli_req_append_bytes(struct smbcli_request *req, const uint8_t *bytes, size_t byte_len)
 {
-       cli_req_grow_allocation(req, byte_len + req->out.data_size);
+       smbcli_req_grow_allocation(req, byte_len + req->out.data_size);
        memcpy(req->out.data + req->out.data_size, bytes, byte_len);
-       cli_req_grow_data(req, byte_len + req->out.data_size);
+       smbcli_req_grow_data(req, byte_len + req->out.data_size);
        return byte_len;
 }
 
@@ -476,15 +476,15 @@ size_t cli_req_append_bytes(struct cli_request *req, const uint8_t *bytes, size_
   append variable block (type 5 buffer) into the data portion of the request packet
   return the number of bytes added
 */
-size_t cli_req_append_var_block(struct cli_request *req, const uint8_t *bytes, uint16_t byte_len)
+size_t smbcli_req_append_var_block(struct smbcli_request *req, const uint8_t *bytes, uint16_t byte_len)
 {
-       cli_req_grow_allocation(req, byte_len + 3 + req->out.data_size);
+       smbcli_req_grow_allocation(req, byte_len + 3 + req->out.data_size);
        SCVAL(req->out.data + req->out.data_size, 0, 5);
        SSVAL(req->out.data + req->out.data_size, 1, byte_len);         /* add field length */
        if (byte_len > 0) {
                memcpy(req->out.data + req->out.data_size + 3, bytes, byte_len);
        }
-       cli_req_grow_data(req, byte_len + 3 + req->out.data_size);
+       smbcli_req_grow_data(req, byte_len + 3 + req->out.data_size);
        return byte_len + 3;
 }
 
@@ -502,7 +502,7 @@ size_t cli_req_append_var_block(struct cli_request *req, const uint8_t *bytes, u
   on failure zero is returned and *dest is set to NULL, otherwise the number
   of bytes consumed in the packet is returned
 */
-static size_t cli_req_pull_ucs2(struct cli_request *req, TALLOC_CTX *mem_ctx,
+static size_t smbcli_req_pull_ucs2(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
                                char **dest, const char *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2, alignment=0;
@@ -559,7 +559,7 @@ static size_t cli_req_pull_ucs2(struct cli_request *req, TALLOC_CTX *mem_ctx,
   on failure zero is returned and *dest is set to NULL, otherwise the number
   of bytes consumed in the packet is returned
 */
-size_t cli_req_pull_ascii(struct cli_request *req, TALLOC_CTX *mem_ctx,
+size_t smbcli_req_pull_ascii(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
                          char **dest, const char *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2;
@@ -602,15 +602,15 @@ size_t cli_req_pull_ascii(struct cli_request *req, TALLOC_CTX *mem_ctx,
   on failure zero is returned and *dest is set to NULL, otherwise the number
   of bytes consumed in the packet is returned
 */
-size_t cli_req_pull_string(struct cli_request *req, TALLOC_CTX *mem_ctx, 
+size_t smbcli_req_pull_string(struct smbcli_request *req, TALLOC_CTX *mem_ctx, 
                           char **dest, const char *src, int byte_len, uint_t flags)
 {
        if (!(flags & STR_ASCII) && 
            (((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) {
-               return cli_req_pull_ucs2(req, mem_ctx, dest, src, byte_len, flags);
+               return smbcli_req_pull_ucs2(req, mem_ctx, dest, src, byte_len, flags);
        }
 
-       return cli_req_pull_ascii(req, mem_ctx, dest, src, byte_len, flags);
+       return smbcli_req_pull_ascii(req, mem_ctx, dest, src, byte_len, flags);
 }
 
 
@@ -620,7 +620,7 @@ size_t cli_req_pull_string(struct cli_request *req, TALLOC_CTX *mem_ctx,
 
   if byte_len is -1 then limit the blob only by packet size
 */
-DATA_BLOB cli_req_pull_blob(struct cli_request *req, TALLOC_CTX *mem_ctx, const char *src, int byte_len)
+DATA_BLOB smbcli_req_pull_blob(struct smbcli_request *req, TALLOC_CTX *mem_ctx, const char *src, int byte_len)
 {
        int src_len;
 
@@ -639,7 +639,7 @@ DATA_BLOB cli_req_pull_blob(struct cli_request *req, TALLOC_CTX *mem_ctx, const
 
 /* check that a lump of data in a request is within the bounds of the data section of
    the packet */
-static BOOL cli_req_data_oob(struct cli_request *req, const char *ptr, uint32_t count)
+static BOOL smbcli_req_data_oob(struct smbcli_request *req, const char *ptr, uint32_t count)
 {
        /* be careful with wraparound! */
        if (ptr < req->in.data ||
@@ -656,11 +656,11 @@ static BOOL cli_req_data_oob(struct cli_request *req, const char *ptr, uint32_t
 
   return False if any part is outside the data portion of the packet
 */
-BOOL cli_raw_pull_data(struct cli_request *req, const char *src, int len, char *dest)
+BOOL smbcli_raw_pull_data(struct smbcli_request *req, const char *src, int len, char *dest)
 {
        if (len == 0) return True;
 
-       if (cli_req_data_oob(req, src, len)) {
+       if (smbcli_req_data_oob(req, src, len)) {
                return False;
        }
 
@@ -672,7 +672,7 @@ BOOL cli_raw_pull_data(struct cli_request *req, const char *src, int len, char *
 /*
   put a NTTIME into a packet
 */
-void cli_push_nttime(void *base, uint16_t offset, NTTIME t)
+void smbcli_push_nttime(void *base, uint16_t offset, NTTIME t)
 {
        SBVAL(base, offset, t);
 }
@@ -680,7 +680,7 @@ void cli_push_nttime(void *base, uint16_t offset, NTTIME t)
 /*
   pull a NTTIME from a packet
 */
-NTTIME cli_pull_nttime(void *base, uint16_t offset)
+NTTIME smbcli_pull_nttime(void *base, uint16_t offset)
 {
        NTTIME ret = BVAL(base, offset);
        return ret;
@@ -699,7 +699,7 @@ NTTIME cli_pull_nttime(void *base, uint16_t offset)
   on failure zero is returned and *dest is set to NULL, otherwise the number
   of bytes consumed in the blob is returned
 */
-static size_t cli_blob_pull_ucs2(TALLOC_CTX* mem_ctx,
+static size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx,
                                 DATA_BLOB *blob, const char **dest, 
                                 const char *src, int byte_len, uint_t flags)
 {
@@ -758,7 +758,7 @@ static size_t cli_blob_pull_ucs2(TALLOC_CTX* mem_ctx,
   on failure zero is returned and *dest is set to NULL, otherwise the number
   of bytes consumed in the blob is returned
 */
-static size_t cli_blob_pull_ascii(TALLOC_CTX *mem_ctx,
+static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx,
                                  DATA_BLOB *blob, const char **dest, 
                                  const char *src, int byte_len, uint_t flags)
 {
@@ -804,7 +804,7 @@ static size_t cli_blob_pull_ascii(TALLOC_CTX *mem_ctx,
   on failure zero is returned and dest->s is set to NULL, otherwise the number
   of bytes consumed in the blob is returned
 */
-size_t cli_blob_pull_string(struct cli_session *session,
+size_t smbcli_blob_pull_string(struct smbcli_session *session,
                            TALLOC_CTX *mem_ctx,
                            DATA_BLOB *blob, 
                            WIRE_STRING *dest, 
@@ -834,7 +834,7 @@ size_t cli_blob_pull_string(struct cli_session *session,
                if (flags & STR_LEN_NOTERM) {
                        extra = 2;
                }
-               return align + extra + cli_blob_pull_ucs2(mem_ctx, blob, &dest->s, 
+               return align + extra + smbcli_blob_pull_ucs2(mem_ctx, blob, &dest->s, 
                                                          blob->data+str_offset+align, 
                                                          dest->private_length, flags);
        }
@@ -843,7 +843,7 @@ size_t cli_blob_pull_string(struct cli_session *session,
                extra = 1;
        }
 
-       return extra + cli_blob_pull_ascii(mem_ctx, blob, &dest->s, 
+       return extra + smbcli_blob_pull_ascii(mem_ctx, blob, &dest->s, 
                                           blob->data+str_offset, dest->private_length, flags);
 }
 
@@ -859,7 +859,7 @@ size_t cli_blob_pull_string(struct cli_session *session,
   on failure zero is returned and dest->s is set to NULL, otherwise the number
   of bytes consumed in the blob is returned
 */
-size_t cli_blob_pull_unix_string(struct cli_session *session,
+size_t smbcli_blob_pull_unix_string(struct smbcli_session *session,
                            TALLOC_CTX *mem_ctx,
                            DATA_BLOB *blob, 
                            const char **dest, 
@@ -879,7 +879,7 @@ size_t cli_blob_pull_unix_string(struct cli_session *session,
                if (flags & STR_LEN_NOTERM) {
                        extra = 2;
                }
-               return align + extra + cli_blob_pull_ucs2(mem_ctx, blob, dest, 
+               return align + extra + smbcli_blob_pull_ucs2(mem_ctx, blob, dest, 
                                                          blob->data+str_offset+align, 
                                                          -1, flags);
        }
@@ -888,7 +888,7 @@ size_t cli_blob_pull_unix_string(struct cli_session *session,
                extra = 1;
        }
 
-       return extra + cli_blob_pull_ascii(mem_ctx, blob, dest,
+       return extra + smbcli_blob_pull_ascii(mem_ctx, blob, dest,
                                           blob->data+str_offset, -1, flags);
 }
 
@@ -896,7 +896,7 @@ size_t cli_blob_pull_unix_string(struct cli_session *session,
 /*
   append a string into a blob
 */
-size_t cli_blob_append_string(struct cli_session *session,
+size_t smbcli_blob_append_string(struct smbcli_session *session,
                              TALLOC_CTX *mem_ctx, DATA_BLOB *blob, 
                              const char *str, uint_t flags)
 {
index a4ba8e86965fceef00383352079b09c40d97699e..67410283ed64b92bd52f5700b45e6a7e5171ae5f 100644 (file)
@@ -23,7 +23,7 @@
 /****************************************************************************
  Old style search backend - process output.
 ****************************************************************************/
-static void smb_raw_search_backend(struct cli_request *req,
+static void smb_raw_search_backend(struct smbcli_request *req,
                                   TALLOC_CTX *mem_ctx,
                                   uint16_t count, 
                                   void *private,
@@ -42,12 +42,12 @@ static void smb_raw_search_backend(struct cli_request *req,
        p = req->in.data + 3;
 
        for (i=0; i < count; i++) {
-               search_data.search.search_id  = cli_req_pull_blob(req, mem_ctx, p, 21);
+               search_data.search.search_id  = smbcli_req_pull_blob(req, mem_ctx, p, 21);
                search_data.search.attrib     = CVAL(p,            21);
                search_data.search.write_time = raw_pull_dos_date(req->transport,
                                                                  p + 22);
                search_data.search.size       = IVAL(p,            26);
-               cli_req_pull_ascii(req, mem_ctx, &search_data.search.name, p+30, 13, STR_ASCII);
+               smbcli_req_pull_ascii(req, mem_ctx, &search_data.search.name, p+30, 13, STR_ASCII);
                if (!callback(private, &search_data)) {
                        break;
                }
@@ -58,27 +58,27 @@ static void smb_raw_search_backend(struct cli_request *req,
 /****************************************************************************
  Old style search first.
 ****************************************************************************/
-static NTSTATUS smb_raw_search_first_old(struct cli_tree *tree,
+static NTSTATUS smb_raw_search_first_old(struct smbcli_tree *tree,
                                         TALLOC_CTX *mem_ctx,
                                         union smb_search_first *io, void *private,
                                         BOOL (*callback)(void *private, union smb_search_data *file))
 
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
        
-       req = cli_request_setup(tree, SMBsearch, 2, 0);
+       req = smbcli_request_setup(tree, SMBsearch, 2, 0);
        if (!req) {
                return NT_STATUS_NO_MEMORY;
        }
        
        SSVAL(req->out.vwv, VWV(0), io->search_first.in.max_count);
        SSVAL(req->out.vwv, VWV(1), io->search_first.in.search_attrib);
-       cli_req_append_ascii4(req, io->search_first.in.pattern, STR_TERMINATE);
-       cli_req_append_var_block(req, NULL, 0);
+       smbcli_req_append_ascii4(req, io->search_first.in.pattern, STR_TERMINATE);
+       smbcli_req_append_var_block(req, NULL, 0);
 
-       if (!cli_request_send(req) || 
-           !cli_request_receive(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_send(req) || 
+           !smbcli_request_receive(req)) {
+               return smbcli_request_destroy(req);
        }
 
        if (NT_STATUS_IS_OK(req->status)) {
@@ -86,33 +86,33 @@ static NTSTATUS smb_raw_search_first_old(struct cli_tree *tree,
                smb_raw_search_backend(req, mem_ctx, io->search_first.out.count, private, callback);
        }
 
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 /****************************************************************************
  Old style search next.
 ****************************************************************************/
-static NTSTATUS smb_raw_search_next_old(struct cli_tree *tree,
+static NTSTATUS smb_raw_search_next_old(struct smbcli_tree *tree,
                                        TALLOC_CTX *mem_ctx,
                                        union smb_search_next *io, void *private,
                                        BOOL (*callback)(void *private, union smb_search_data *file))
 
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
        
-       req = cli_request_setup(tree, SMBsearch, 2, 0);
+       req = smbcli_request_setup(tree, SMBsearch, 2, 0);
        if (!req) {
                return NT_STATUS_NO_MEMORY;
        }
        
        SSVAL(req->out.vwv, VWV(0), io->search_next.in.max_count);
        SSVAL(req->out.vwv, VWV(1), io->search_next.in.search_attrib);
-       cli_req_append_ascii4(req, "", STR_TERMINATE);
-       cli_req_append_var_block(req, io->search_next.in.search_id.data, 21);
+       smbcli_req_append_ascii4(req, "", STR_TERMINATE);
+       smbcli_req_append_var_block(req, io->search_next.in.search_id.data, 21);
 
-       if (!cli_request_send(req) ||
-           !cli_request_receive(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_send(req) ||
+           !smbcli_request_receive(req)) {
+               return smbcli_request_destroy(req);
        }
 
        if (NT_STATUS_IS_OK(req->status)) {
@@ -120,13 +120,13 @@ static NTSTATUS smb_raw_search_next_old(struct cli_tree *tree,
                smb_raw_search_backend(req, mem_ctx, io->search_next.out.count, private, callback);
        }
        
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 /****************************************************************************
  Very raw search first - returns param/data blobs.
 ****************************************************************************/
-static NTSTATUS smb_raw_search_first_blob(struct cli_tree *tree,
+static NTSTATUS smb_raw_search_first_blob(struct smbcli_tree *tree,
                                          TALLOC_CTX *mem_ctx,  /* used to allocate output blobs */
                                          union smb_search_first *io,
                                          uint16_t info_level,
@@ -157,7 +157,7 @@ static NTSTATUS smb_raw_search_first_blob(struct cli_tree *tree,
        SSVAL(tp.in.params.data, 6, info_level);
        SIVAL(tp.in.params.data, 8, io->t2ffirst.in.storage_type);
 
-       cli_blob_append_string(tree->session, mem_ctx, &tp.in.params,
+       smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params,
                               io->t2ffirst.in.pattern, STR_TERMINATE);
 
        status = smb_raw_trans2(tree, mem_ctx, &tp);
@@ -178,7 +178,7 @@ static NTSTATUS smb_raw_search_first_blob(struct cli_tree *tree,
  Very raw search first - returns param/data blobs.
  Used in CIFS-on-CIFS NTVFS.
 ****************************************************************************/
-static NTSTATUS smb_raw_search_next_blob(struct cli_tree *tree,
+static NTSTATUS smb_raw_search_next_blob(struct smbcli_tree *tree,
                                         TALLOC_CTX *mem_ctx,
                                         union smb_search_next *io,
                                         uint16_t info_level,
@@ -209,7 +209,7 @@ static NTSTATUS smb_raw_search_next_blob(struct cli_tree *tree,
        SIVAL(tp.in.params.data, 6, io->t2fnext.in.resume_key);
        SSVAL(tp.in.params.data, 10, io->t2fnext.in.flags);
 
-       cli_blob_append_string(tree->session, mem_ctx, &tp.in.params,
+       smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params,
                               io->t2fnext.in.last_name,
                               STR_TERMINATE);
 
@@ -233,7 +233,7 @@ static NTSTATUS smb_raw_search_next_blob(struct cli_tree *tree,
   return 0 for success with end of list
   return -1 for a parse error
 */
-static int parse_trans2_search(struct cli_tree *tree,
+static int parse_trans2_search(struct smbcli_tree *tree,
                               TALLOC_CTX *mem_ctx, 
                               enum smb_search_level level,
                               uint16_t flags,
@@ -265,7 +265,7 @@ static int parse_trans2_search(struct cli_tree *tree,
                data->standard.size        = IVAL(blob->data, 12);
                data->standard.alloc_size  = IVAL(blob->data, 16);
                data->standard.attrib      = SVAL(blob->data, 20);
-               len = cli_blob_pull_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                           &data->standard.name,
                                           22, 23, STR_LEN8BIT | STR_TERMINATE | STR_LEN_NOTERM);
                return len + 23;
@@ -288,7 +288,7 @@ static int parse_trans2_search(struct cli_tree *tree,
                data->ea_size.alloc_size  = IVAL(blob->data, 16);
                data->ea_size.attrib      = SVAL(blob->data, 20);
                data->ea_size.ea_size     = IVAL(blob->data, 22);
-               len = cli_blob_pull_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                           &data->ea_size.name,
                                           26, 27, STR_LEN8BIT | STR_TERMINATE | STR_NOALIGN);
                return len + 27 + 1;
@@ -297,14 +297,14 @@ static int parse_trans2_search(struct cli_tree *tree,
                if (blob->length < 65) return -1;
                ofs                                     = IVAL(blob->data,             0);
                data->directory_info.file_index  = IVAL(blob->data,             4);
-               data->directory_info.create_time = cli_pull_nttime(blob->data,  8);
-               data->directory_info.access_time = cli_pull_nttime(blob->data, 16);
-               data->directory_info.write_time  = cli_pull_nttime(blob->data, 24);
-               data->directory_info.change_time = cli_pull_nttime(blob->data, 32);
+               data->directory_info.create_time = smbcli_pull_nttime(blob->data,  8);
+               data->directory_info.access_time = smbcli_pull_nttime(blob->data, 16);
+               data->directory_info.write_time  = smbcli_pull_nttime(blob->data, 24);
+               data->directory_info.change_time = smbcli_pull_nttime(blob->data, 32);
                data->directory_info.size        = BVAL(blob->data,            40);
                data->directory_info.alloc_size  = BVAL(blob->data,            48);
                data->directory_info.attrib      = IVAL(blob->data,            56);
-               len = cli_blob_pull_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                           &data->directory_info.name,
                                           60, 64, 0);
                if (ofs != 0 && ofs < 64+len) {
@@ -316,15 +316,15 @@ static int parse_trans2_search(struct cli_tree *tree,
                if (blob->length < 69) return -1;
                ofs                                   = IVAL(blob->data,             0);
                data->full_directory_info.file_index  = IVAL(blob->data,             4);
-               data->full_directory_info.create_time = cli_pull_nttime(blob->data,  8);
-               data->full_directory_info.access_time = cli_pull_nttime(blob->data, 16);
-               data->full_directory_info.write_time  = cli_pull_nttime(blob->data, 24);
-               data->full_directory_info.change_time = cli_pull_nttime(blob->data, 32);
+               data->full_directory_info.create_time = smbcli_pull_nttime(blob->data,  8);
+               data->full_directory_info.access_time = smbcli_pull_nttime(blob->data, 16);
+               data->full_directory_info.write_time  = smbcli_pull_nttime(blob->data, 24);
+               data->full_directory_info.change_time = smbcli_pull_nttime(blob->data, 32);
                data->full_directory_info.size        = BVAL(blob->data,            40);
                data->full_directory_info.alloc_size  = BVAL(blob->data,            48);
                data->full_directory_info.attrib      = IVAL(blob->data,            56);
                data->full_directory_info.ea_size     = IVAL(blob->data,            64);
-               len = cli_blob_pull_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                           &data->full_directory_info.name,
                                           60, 68, 0);
                if (ofs != 0 && ofs < 68+len) {
@@ -336,7 +336,7 @@ static int parse_trans2_search(struct cli_tree *tree,
                if (blob->length < 13) return -1;
                ofs                         = IVAL(blob->data,             0);
                data->name_info.file_index  = IVAL(blob->data,             4);
-               len = cli_blob_pull_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                           &data->name_info.name,
                                           8, 12, 0);
                if (ofs != 0 && ofs < 12+len) {
@@ -349,18 +349,18 @@ static int parse_trans2_search(struct cli_tree *tree,
                if (blob->length < 95) return -1;
                ofs                                          = IVAL(blob->data,             0);
                data->both_directory_info.file_index  = IVAL(blob->data,             4);
-               data->both_directory_info.create_time = cli_pull_nttime(blob->data,  8);
-               data->both_directory_info.access_time = cli_pull_nttime(blob->data, 16);
-               data->both_directory_info.write_time  = cli_pull_nttime(blob->data, 24);
-               data->both_directory_info.change_time = cli_pull_nttime(blob->data, 32);
+               data->both_directory_info.create_time = smbcli_pull_nttime(blob->data,  8);
+               data->both_directory_info.access_time = smbcli_pull_nttime(blob->data, 16);
+               data->both_directory_info.write_time  = smbcli_pull_nttime(blob->data, 24);
+               data->both_directory_info.change_time = smbcli_pull_nttime(blob->data, 32);
                data->both_directory_info.size        = BVAL(blob->data,            40);
                data->both_directory_info.alloc_size  = BVAL(blob->data,            48);
                data->both_directory_info.attrib      = IVAL(blob->data,            56);
                data->both_directory_info.ea_size     = IVAL(blob->data,            64);
-               cli_blob_pull_string(tree->session, mem_ctx, blob,
+               smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                     &data->both_directory_info.short_name,
                                     68, 70, STR_LEN8BIT | STR_UNICODE);
-               len = cli_blob_pull_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                           &data->both_directory_info.name,
                                           60, 94, 0);
                if (ofs != 0 && ofs < 94+len) {
@@ -373,16 +373,16 @@ static int parse_trans2_search(struct cli_tree *tree,
                if (blob->length < 81) return -1;
                ofs                                      = IVAL(blob->data,             0);
                data->id_full_directory_info.file_index  = IVAL(blob->data,             4);
-               data->id_full_directory_info.create_time = cli_pull_nttime(blob->data,  8);
-               data->id_full_directory_info.access_time = cli_pull_nttime(blob->data, 16);
-               data->id_full_directory_info.write_time  = cli_pull_nttime(blob->data, 24);
-               data->id_full_directory_info.change_time = cli_pull_nttime(blob->data, 32);
+               data->id_full_directory_info.create_time = smbcli_pull_nttime(blob->data,  8);
+               data->id_full_directory_info.access_time = smbcli_pull_nttime(blob->data, 16);
+               data->id_full_directory_info.write_time  = smbcli_pull_nttime(blob->data, 24);
+               data->id_full_directory_info.change_time = smbcli_pull_nttime(blob->data, 32);
                data->id_full_directory_info.size        = BVAL(blob->data,            40);
                data->id_full_directory_info.alloc_size  = BVAL(blob->data,            48);
                data->id_full_directory_info.attrib      = IVAL(blob->data,            56);
                data->id_full_directory_info.ea_size     = IVAL(blob->data,            64);
                data->id_full_directory_info.file_id     = BVAL(blob->data,            72);
-               len = cli_blob_pull_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                           &data->id_full_directory_info.name,
                                           60, 80, 0);
                if (ofs != 0 && ofs < 80+len) {
@@ -394,19 +394,19 @@ static int parse_trans2_search(struct cli_tree *tree,
                if (blob->length < 105) return -1;
                ofs                                      = IVAL(blob->data,             0);
                data->id_both_directory_info.file_index  = IVAL(blob->data,             4);
-               data->id_both_directory_info.create_time = cli_pull_nttime(blob->data,  8);
-               data->id_both_directory_info.access_time = cli_pull_nttime(blob->data, 16);
-               data->id_both_directory_info.write_time  = cli_pull_nttime(blob->data, 24);
-               data->id_both_directory_info.change_time = cli_pull_nttime(blob->data, 32);
+               data->id_both_directory_info.create_time = smbcli_pull_nttime(blob->data,  8);
+               data->id_both_directory_info.access_time = smbcli_pull_nttime(blob->data, 16);
+               data->id_both_directory_info.write_time  = smbcli_pull_nttime(blob->data, 24);
+               data->id_both_directory_info.change_time = smbcli_pull_nttime(blob->data, 32);
                data->id_both_directory_info.size        = BVAL(blob->data,            40);
                data->id_both_directory_info.alloc_size  = BVAL(blob->data,            48);
                data->id_both_directory_info.attrib      = SVAL(blob->data,            56);
                data->id_both_directory_info.ea_size     = IVAL(blob->data,            64);
-               cli_blob_pull_string(tree->session, mem_ctx, blob,
+               smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                     &data->id_both_directory_info.short_name,
                                     68, 70, STR_LEN8BIT | STR_UNICODE);
                data->id_both_directory_info.file_id     = BVAL(blob->data,            96);
-               len = cli_blob_pull_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
                                           &data->id_both_directory_info.name,
                                           60, 104, 0);
                if (ofs != 0 && ofs < 104+len) {
@@ -420,9 +420,9 @@ static int parse_trans2_search(struct cli_tree *tree,
                data->unix_info.file_index           = IVAL(blob->data,             4);
                data->unix_info.size                 = BVAL(blob->data,             8);
                data->unix_info.alloc_size           = BVAL(blob->data,            16);
-               data->unix_info.status_change_time   = cli_pull_nttime(blob->data, 24);
-               data->unix_info.access_time          = cli_pull_nttime(blob->data, 32);
-               data->unix_info.change_time          = cli_pull_nttime(blob->data, 40);
+               data->unix_info.status_change_time   = smbcli_pull_nttime(blob->data, 24);
+               data->unix_info.access_time          = smbcli_pull_nttime(blob->data, 32);
+               data->unix_info.change_time          = smbcli_pull_nttime(blob->data, 40);
                data->unix_info.uid                  = IVAL(blob->data,            48);
                data->unix_info.gid                  = IVAL(blob->data,            56);
                data->unix_info.file_type            = IVAL(blob->data,            64);
@@ -432,7 +432,7 @@ static int parse_trans2_search(struct cli_tree *tree,
                data->unix_info.permissions          = IVAL(blob->data,            92);
                data->unix_info.nlink                = IVAL(blob->data,           100);
                /* There is no length field for this name but we know it's null terminated. */
-               len = cli_blob_pull_unix_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_pull_unix_string(tree->session, mem_ctx, blob,
                                           &data->unix_info.name, 108, 0);
                if (ofs != 0 && ofs < 108+len) {
                        return -1;
@@ -447,7 +447,7 @@ static int parse_trans2_search(struct cli_tree *tree,
 /****************************************************************************
  Trans2 search backend - process output.
 ****************************************************************************/
-static NTSTATUS smb_raw_t2search_backend(struct cli_tree *tree,
+static NTSTATUS smb_raw_t2search_backend(struct smbcli_tree *tree,
                                         TALLOC_CTX *mem_ctx,
                                         enum smb_search_level level,
                                         uint16_t flags,
@@ -490,7 +490,7 @@ static NTSTATUS smb_raw_t2search_backend(struct cli_tree *tree,
 
 /* Implements trans2findfirst2 and old search
  */
-NTSTATUS smb_raw_search_first(struct cli_tree *tree,
+NTSTATUS smb_raw_search_first(struct smbcli_tree *tree,
                              TALLOC_CTX *mem_ctx,
                              union smb_search_first *io, void *private,
                              BOOL (*callback)(void *private, union smb_search_data *file))
@@ -534,7 +534,7 @@ NTSTATUS smb_raw_search_first(struct cli_tree *tree,
 
 /* Implements trans2findnext2 and old smbsearch
  */
-NTSTATUS smb_raw_search_next(struct cli_tree *tree,
+NTSTATUS smb_raw_search_next(struct smbcli_tree *tree,
                             TALLOC_CTX *mem_ctx,
                             union smb_search_next *io, void *private,
                             BOOL (*callback)(void *private, union smb_search_data *file))
@@ -578,21 +578,21 @@ NTSTATUS smb_raw_search_next(struct cli_tree *tree,
 /* 
    Implements trans2findclose2
  */
-NTSTATUS smb_raw_search_close(struct cli_tree *tree,
+NTSTATUS smb_raw_search_close(struct smbcli_tree *tree,
                              union smb_search_close *io)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        
-       req = cli_request_setup(tree, SMBfindclose, 1, 0);
+       req = smbcli_request_setup(tree, SMBfindclose, 1, 0);
        if (!req) {
                return NT_STATUS_NO_MEMORY;
        }
 
        SSVAL(req->out.vwv, VWV(0), io->findclose.in.handle);
 
-       if (cli_request_send(req)) {
-               cli_request_receive(req);
+       if (smbcli_request_send(req)) {
+               smbcli_request_receive(req);
        }
 
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
index 3dcda401f5ffdd0a74cad66114cebac355538845..b1667db50f27744043d3cf6a4834da7898f36976 100644 (file)
@@ -24,7 +24,7 @@
 /****************************************************************************
  Handle setfileinfo/setpathinfo trans2 backend.
 ****************************************************************************/
-static BOOL smb_raw_setinfo_backend(struct cli_tree *tree,
+static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree,
                                    TALLOC_CTX *mem_ctx,
                                    union smb_setfileinfo *parms, 
                                    DATA_BLOB *blob)
@@ -61,10 +61,10 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree,
        case RAW_SFILEINFO_BASIC_INFO:
        case RAW_SFILEINFO_BASIC_INFORMATION:
                NEED_BLOB(40);
-               cli_push_nttime(blob->data,  0, parms->basic_info.in.create_time);
-               cli_push_nttime(blob->data,  8, parms->basic_info.in.access_time);
-               cli_push_nttime(blob->data, 16, parms->basic_info.in.write_time);
-               cli_push_nttime(blob->data, 24, parms->basic_info.in.change_time);
+               smbcli_push_nttime(blob->data,  0, parms->basic_info.in.create_time);
+               smbcli_push_nttime(blob->data,  8, parms->basic_info.in.access_time);
+               smbcli_push_nttime(blob->data, 16, parms->basic_info.in.write_time);
+               smbcli_push_nttime(blob->data, 24, parms->basic_info.in.change_time);
                SIVAL(blob->data,           32, parms->basic_info.in.attrib);
                SIVAL(blob->data,           36, 0); /* padding */
                return True;
@@ -73,9 +73,9 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree,
                NEED_BLOB(92);
                SBVAL(blob->data, 0, parms->unix_basic.in.end_of_file);
                SBVAL(blob->data, 8, parms->unix_basic.in.num_bytes);
-               cli_push_nttime(blob->data, 16, parms->unix_basic.in.status_change_time);
-               cli_push_nttime(blob->data, 24, parms->unix_basic.in.access_time);
-               cli_push_nttime(blob->data, 32, parms->unix_basic.in.change_time);
+               smbcli_push_nttime(blob->data, 16, parms->unix_basic.in.status_change_time);
+               smbcli_push_nttime(blob->data, 24, parms->unix_basic.in.access_time);
+               smbcli_push_nttime(blob->data, 32, parms->unix_basic.in.change_time);
                SBVAL(blob->data, 40, parms->unix_basic.in.uid);
                SBVAL(blob->data, 48, parms->unix_basic.in.gid);
                SIVAL(blob->data, 56, parms->unix_basic.in.file_type);
@@ -107,7 +107,7 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree,
                NEED_BLOB(12);
                SIVAL(blob->data, 0, parms->rename_information.in.overwrite);
                SIVAL(blob->data, 4, parms->rename_information.in.root_fid);
-               len = cli_blob_append_string(tree->session, mem_ctx, blob,
+               len = smbcli_blob_append_string(tree->session, mem_ctx, blob,
                                             parms->rename_information.in.new_name, 
                                             STR_UNICODE|STR_TERMINATE);
                SIVAL(blob->data, 8, len - 2);
@@ -130,7 +130,7 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree,
 /****************************************************************************
  Very raw set file info - takes data blob (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_setfileinfo_blob_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_setfileinfo_blob_send(struct smbcli_tree *tree,
                                                         TALLOC_CTX *mem_ctx,
                                                         uint16_t fnum,
                                                         uint16_t info_level,
@@ -163,7 +163,7 @@ static struct cli_request *smb_raw_setfileinfo_blob_send(struct cli_tree *tree,
 /****************************************************************************
  Very raw set path info - takes data blob
 ****************************************************************************/
-static struct cli_request *smb_raw_setpathinfo_blob_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_setpathinfo_blob_send(struct smbcli_tree *tree,
                                                         TALLOC_CTX *mem_ctx,
                                                         const char *fname,
                                                         uint16_t info_level,
@@ -186,7 +186,7 @@ static struct cli_request *smb_raw_setpathinfo_blob_send(struct cli_tree *tree,
        }
        SSVAL(tp.in.params.data, 0, info_level);
        SSVAL(tp.in.params.data, 2, 0);
-       cli_blob_append_string(tree->session, mem_ctx, 
+       smbcli_blob_append_string(tree->session, mem_ctx, 
                               &tp.in.params,
                               fname, STR_TERMINATE);
 
@@ -198,23 +198,23 @@ static struct cli_request *smb_raw_setpathinfo_blob_send(struct cli_tree *tree,
 /****************************************************************************
  Handle setattr (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_setattr_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_setattr_send(struct smbcli_tree *tree,
                                                union smb_setfileinfo *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
-       req = cli_request_setup(tree, SMBsetatr, 8, 0);
+       req = smbcli_request_setup(tree, SMBsetatr, 8, 0);
        if (!req) return NULL;
        
        SSVAL(req->out.vwv,         VWV(0), parms->setattr.in.attrib);
        raw_push_dos_date3(tree->session->transport, 
                          req->out.vwv, VWV(1), parms->setattr.in.write_time);
        memset(req->out.vwv + VWV(3), 0, 10); /* reserved */
-       cli_req_append_ascii4(req, parms->setattr.file.fname, STR_TERMINATE);
-       cli_req_append_ascii4(req, "", STR_TERMINATE);
+       smbcli_req_append_ascii4(req, parms->setattr.file.fname, STR_TERMINATE);
+       smbcli_req_append_ascii4(req, "", STR_TERMINATE);
        
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -224,12 +224,12 @@ static struct cli_request *smb_raw_setattr_send(struct cli_tree *tree,
 /****************************************************************************
  Handle setattrE. (async send)
 ****************************************************************************/
-static struct cli_request *smb_raw_setattrE_send(struct cli_tree *tree,
+static struct smbcli_request *smb_raw_setattrE_send(struct smbcli_tree *tree,
                                                 union smb_setfileinfo *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
-       req = cli_request_setup(tree, SMBsetattrE, 7, 0);
+       req = smbcli_request_setup(tree, SMBsetattrE, 7, 0);
        if (!req) return NULL;
        
        SSVAL(req->out.vwv,         VWV(0), parms->setattre.file.fnum);
@@ -240,8 +240,8 @@ static struct cli_request *smb_raw_setattrE_send(struct cli_tree *tree,
        raw_push_dos_date2(tree->session->transport, 
                          req->out.vwv, VWV(5), parms->setattre.in.write_time);
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -251,12 +251,12 @@ static struct cli_request *smb_raw_setattrE_send(struct cli_tree *tree,
 /****************************************************************************
  Set file info (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_setfileinfo_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_setfileinfo_send(struct smbcli_tree *tree,
                                             union smb_setfileinfo *parms)
 {
        DATA_BLOB blob;
        TALLOC_CTX *mem_ctx;
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        if (parms->generic.level == RAW_SFILEINFO_SETATTRE) {
                return smb_raw_setattrE_send(tree, parms);
@@ -287,23 +287,23 @@ struct cli_request *smb_raw_setfileinfo_send(struct cli_tree *tree,
 /****************************************************************************
  Set file info (async send)
 ****************************************************************************/
-NTSTATUS smb_raw_setfileinfo(struct cli_tree *tree,
+NTSTATUS smb_raw_setfileinfo(struct smbcli_tree *tree,
                             union smb_setfileinfo *parms)
 {
-       struct cli_request *req = smb_raw_setfileinfo_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_setfileinfo_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
 
 
 /****************************************************************************
  Set path info (async send)
 ****************************************************************************/
-struct cli_request *smb_raw_setpathinfo_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_setpathinfo_send(struct smbcli_tree *tree,
                                             union smb_setfileinfo *parms)
 {
        DATA_BLOB blob;
        TALLOC_CTX *mem_ctx;
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        if (parms->generic.level == RAW_SFILEINFO_SETATTR) {
                return smb_raw_setattr_send(tree, parms);
@@ -334,9 +334,9 @@ struct cli_request *smb_raw_setpathinfo_send(struct cli_tree *tree,
 /****************************************************************************
  Set path info (sync interface)
 ****************************************************************************/
-NTSTATUS smb_raw_setpathinfo(struct cli_tree *tree,
+NTSTATUS smb_raw_setpathinfo(struct smbcli_tree *tree,
                             union smb_setfileinfo *parms)
 {
-       struct cli_request *req = smb_raw_setpathinfo_send(tree, parms);
-       return cli_request_simple_recv(req);
+       struct smbcli_request *req = smb_raw_setpathinfo_send(tree, parms);
+       return smbcli_request_simple_recv(req);
 }
index 5dde7533680db6e16cb4ca6cf6d5847a3821e27f..0c39abe8801c8532f46710fc0f4b9173d9381dc5 100644 (file)
@@ -25,7 +25,7 @@
 /*
   check out of bounds for incoming data
 */
-static BOOL raw_trans_oob(struct cli_request *req,
+static BOOL raw_trans_oob(struct smbcli_request *req,
                          uint_t offset, uint_t count)
 {
        char *ptr;
@@ -49,7 +49,7 @@ static BOOL raw_trans_oob(struct cli_request *req,
 /****************************************************************************
   receive a SMB trans or trans2 response allocating the necessary memory
   ****************************************************************************/
-NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
+NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req,
                             TALLOC_CTX *mem_ctx,
                             struct smb_trans2 *parms)
 {
@@ -63,8 +63,8 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
        parms->out.params.length = 0;
        parms->out.params.data = NULL;
 
-       if (!cli_request_receive(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req)) {
+               return smbcli_request_destroy(req);
        }
        
        /*
@@ -73,10 +73,10 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
         * be treated as such.
         */
        if (NT_STATUS_IS_ERR(req->status)) {
-               return cli_request_destroy(req);
+               return smbcli_request_destroy(req);
        }
 
-       CLI_CHECK_MIN_WCT(req, 10);
+       SMBCLI_CHECK_MIN_WCT(req, 10);
 
        /* parse out the lengths */
        total_data = SVAL(req->in.vwv, VWV(1));
@@ -88,7 +88,7 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
                if (!tdata) {
                        DEBUG(0,("smb_raw_receive_trans: failed to enlarge data buffer to %d bytes\n", total_data));
                        req->status = NT_STATUS_NO_MEMORY;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
                parms->out.data.data = tdata;
        }
@@ -98,20 +98,20 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
                if (!tparam) {
                        DEBUG(0,("smb_raw_receive_trans: failed to enlarge param buffer to %d bytes\n", total_param));
                        req->status = NT_STATUS_NO_MEMORY;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
                parms->out.params.data = tparam;
        }
 
        parms->out.setup_count = SVAL(req->in.vwv, VWV(9));
-       CLI_CHECK_WCT(req, 10 + parms->out.setup_count);
+       SMBCLI_CHECK_WCT(req, 10 + parms->out.setup_count);
 
        if (parms->out.setup_count > 0) {
                int i;
                parms->out.setup = talloc(mem_ctx, 2 * parms->out.setup_count);
                if (!parms->out.setup) {
                        req->status = NT_STATUS_NO_MEMORY;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
                for (i=0;i<parms->out.setup_count;i++) {
                        parms->out.setup[i] = SVAL(req->in.vwv, VWV(10+i));
@@ -132,7 +132,7 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
                        /* they must *only* shrink */
                        DEBUG(1,("smb_raw_receive_trans: data/params expanded!\n"));
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
 
                total_data = total_data2;
@@ -151,7 +151,7 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
                    param_count + param_disp > total_param) {
                        DEBUG(1,("smb_raw_receive_trans: Buffer overflow\n"));
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
                
                /* check the server isn't being nasty */
@@ -159,7 +159,7 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
                    raw_trans_oob(req, data_ofs, data_count)) {
                        DEBUG(1,("smb_raw_receive_trans: out of bounds parameters!\n"));
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
 
                if (data_count) {
@@ -180,17 +180,17 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req,
                if (total_data <= parms->out.data.length && total_param <= parms->out.params.length)
                        break;
        
-               if (!cli_request_receive_more(req)) {
+               if (!smbcli_request_receive_more(req)) {
                        req->status = NT_STATUS_UNSUCCESSFUL;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
        }
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
-NTSTATUS smb_raw_trans_recv(struct cli_request *req,
+NTSTATUS smb_raw_trans_recv(struct smbcli_request *req,
                             TALLOC_CTX *mem_ctx,
                             struct smb_trans2 *parms)
 {
@@ -201,12 +201,12 @@ NTSTATUS smb_raw_trans_recv(struct cli_request *req,
  trans/trans2 raw async interface - only BLOBs used in this interface.
  note that this doesn't yet support multi-part requests
 ****************************************************************************/
-struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree,
+struct smbcli_request *smb_raw_trans_send_backend(struct smbcli_tree *tree,
                                               struct smb_trans2 *parms,
                                               uint8_t command)
 {
        int wct = 14 + parms->in.setup_count;
-       struct cli_request *req; 
+       struct smbcli_request *req; 
        char *outdata,*outparam;
        int i;
        int padding;
@@ -217,7 +217,7 @@ struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree,
        else
                padding = 3;
        
-       req = cli_request_setup(tree, command, wct, padding);
+       req = smbcli_request_setup(tree, command, wct, padding);
        if (!req) {
                return NULL;
        }
@@ -230,7 +230,7 @@ struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree,
        memset(req->out.data, 0, padding);
 
        if (command == SMBtrans && parms->in.trans_name) {
-               namelen = cli_req_append_string(req, parms->in.trans_name, 
+               namelen = smbcli_req_append_string(req, parms->in.trans_name, 
                                                STR_TERMINATE);
        }
 
@@ -252,14 +252,14 @@ struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree,
                SSVAL(req->out.vwv,VWV(14)+i*2,parms->in.setup[i]);
        }
        if (parms->in.params.data)      {
-               cli_req_append_blob(req, &parms->in.params);
+               smbcli_req_append_blob(req, &parms->in.params);
        }
        if (parms->in.data.data) {
-               cli_req_append_blob(req, &parms->in.data);
+               smbcli_req_append_blob(req, &parms->in.data);
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
        
@@ -271,13 +271,13 @@ struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree,
 note that this doesn't yet support multi-part requests
 ****************************************************************************/
 
-struct cli_request *smb_raw_trans_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_trans_send(struct smbcli_tree *tree,
                                       struct smb_trans2 *parms)
 {
        return smb_raw_trans_send_backend(tree, parms, SMBtrans);
 }
 
-struct cli_request *smb_raw_trans2_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_trans2_send(struct smbcli_tree *tree,
                                       struct smb_trans2 *parms)
 {
        return smb_raw_trans_send_backend(tree, parms, SMBtrans2);
@@ -286,11 +286,11 @@ struct cli_request *smb_raw_trans2_send(struct cli_tree *tree,
 /*
   trans2 synchronous blob interface
 */
-NTSTATUS smb_raw_trans2(struct cli_tree *tree,
+NTSTATUS smb_raw_trans2(struct smbcli_tree *tree,
                        TALLOC_CTX *mem_ctx,
                        struct smb_trans2 *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        req = smb_raw_trans2_send(tree, parms);
        if (!req) return NT_STATUS_UNSUCCESSFUL;
        return smb_raw_trans2_recv(req, mem_ctx, parms);
@@ -300,11 +300,11 @@ NTSTATUS smb_raw_trans2(struct cli_tree *tree,
 /*
   trans synchronous blob interface
 */
-NTSTATUS smb_raw_trans(struct cli_tree *tree,
+NTSTATUS smb_raw_trans(struct smbcli_tree *tree,
                       TALLOC_CTX *mem_ctx,
                       struct smb_trans2 *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        req = smb_raw_trans_send(tree, parms);
        if (!req) return NT_STATUS_UNSUCCESSFUL;
        return smb_raw_trans_recv(req, mem_ctx, parms);
@@ -313,16 +313,16 @@ NTSTATUS smb_raw_trans(struct cli_tree *tree,
 /****************************************************************************
   receive a SMB nttrans response allocating the necessary memory
   ****************************************************************************/
-NTSTATUS smb_raw_nttrans_recv(struct cli_request *req,
+NTSTATUS smb_raw_nttrans_recv(struct smbcli_request *req,
                              TALLOC_CTX *mem_ctx,
                              struct smb_nttrans *parms)
 {
        uint32_t total_data, recvd_data=0;
        uint32_t total_param, recvd_param=0;
 
-       if (!cli_request_receive(req) ||
-           cli_request_is_error(req)) {
-               return cli_request_destroy(req);
+       if (!smbcli_request_receive(req) ||
+           smbcli_request_is_error(req)) {
+               return smbcli_request_destroy(req);
        }
 
        /* sanity check */
@@ -331,10 +331,10 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req,
                         "SMBnttrans", 
                         CVAL(req->in.hdr,HDR_COM)));
                req->status = NT_STATUS_UNSUCCESSFUL;
-               return cli_request_destroy(req);
+               return smbcli_request_destroy(req);
        }
 
-       CLI_CHECK_MIN_WCT(req, 18);
+       SMBCLI_CHECK_MIN_WCT(req, 18);
 
        /* parse out the lengths */
        total_param = IVAL(req->in.vwv, 3);
@@ -346,18 +346,18 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req,
        if (parms->out.data.length != total_data ||
            parms->out.params.length != total_param) {
                req->status = NT_STATUS_NO_MEMORY;
-               return cli_request_destroy(req);
+               return smbcli_request_destroy(req);
        }
 
        parms->out.setup_count = CVAL(req->in.vwv, 35);
-       CLI_CHECK_WCT(req, 18 + parms->out.setup_count);
+       SMBCLI_CHECK_WCT(req, 18 + parms->out.setup_count);
 
        if (parms->out.setup_count > 0) {
                int i;
                parms->out.setup = talloc(mem_ctx, 2 * parms->out.setup_count);
                if (!parms->out.setup) {
                        req->status = NT_STATUS_NO_MEMORY;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
                for (i=0;i<parms->out.setup_count;i++) {
                        parms->out.setup[i] = SVAL(req->in.vwv, VWV(18+i));
@@ -379,7 +379,7 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req,
                        /* they must *only* shrink */
                        DEBUG(1,("smb_raw_receive_nttrans: data/params expanded!\n"));
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
 
                total_data = total_data2;
@@ -400,7 +400,7 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req,
                    param_count + param_disp > total_param) {
                        DEBUG(1,("smb_raw_receive_nttrans: Buffer overflow\n"));
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
                
                /* check the server isn't being nasty */
@@ -408,7 +408,7 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req,
                    raw_trans_oob(req, data_ofs, data_count)) {
                        DEBUG(1,("smb_raw_receive_nttrans: out of bounds parameters!\n"));
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
 
                if (data_count) {
@@ -431,9 +431,9 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req,
                        break;
                }
                
-               if (!cli_request_receive(req) ||
-                   cli_request_is_error(req)) {
-                       return cli_request_destroy(req);
+               if (!smbcli_request_receive(req) ||
+                   smbcli_request_is_error(req)) {
+                       return smbcli_request_destroy(req);
                }
                
                /* sanity check */
@@ -441,12 +441,12 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req,
                        DEBUG(0,("smb_raw_receive_nttrans: Expected nttranss, got command 0x%02x\n",
                                 CVAL(req->in.hdr, HDR_COM)));
                        req->status = NT_STATUS_UNSUCCESSFUL;
-                       return cli_request_destroy(req);
+                       return smbcli_request_destroy(req);
                }
        }
 
 failed:
-       return cli_request_destroy(req);
+       return smbcli_request_destroy(req);
 }
 
 
@@ -454,10 +454,10 @@ failed:
  nttrans raw - only BLOBs used in this interface.
  at the moment we only handle a single primary request 
 ****************************************************************************/
-struct cli_request *smb_raw_nttrans_send(struct cli_tree *tree,
+struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree,
                                         struct smb_nttrans *parms)
 {
-       struct cli_request *req; 
+       struct smbcli_request *req; 
        char *outdata, *outparam;
        int i;
        int align = 0;
@@ -467,7 +467,7 @@ struct cli_request *smb_raw_nttrans_send(struct cli_tree *tree,
                align = 3;
        }
        
-       req = cli_request_setup(tree, SMBnttrans, 
+       req = smbcli_request_setup(tree, SMBnttrans, 
                                19 + parms->in.setup_count, 
                                align +
                                parms->in.params.length +
@@ -502,8 +502,8 @@ struct cli_request *smb_raw_nttrans_send(struct cli_tree *tree,
                memcpy(outparam, parms->in.data.data, parms->in.data.length);
        }
 
-       if (!cli_request_send(req)) {
-               cli_request_destroy(req);
+       if (!smbcli_request_send(req)) {
+               smbcli_request_destroy(req);
                return NULL;
        }
 
@@ -514,11 +514,11 @@ struct cli_request *smb_raw_nttrans_send(struct cli_tree *tree,
 /****************************************************************************
   receive a SMB nttrans response allocating the necessary memory
   ****************************************************************************/
-NTSTATUS smb_raw_nttrans(struct cli_tree *tree,
+NTSTATUS smb_raw_nttrans(struct smbcli_tree *tree,
                         TALLOC_CTX *mem_ctx,
                         struct smb_nttrans *parms)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        req = smb_raw_nttrans_send(tree, parms);
        if (!req) {
index 9c02fe50ecc569fdd4a9867ce6e0235f59adb61f..ddde58fd889d7c60ec46b26802719ac7239d1633 100644 (file)
@@ -30,7 +30,7 @@ struct smb_basic_signing_context {
 /***********************************************************
  SMB signing - Common code before we set a new signing implementation
 ************************************************************/
-static BOOL set_smb_signing_common(struct cli_transport *transport)
+static BOOL set_smb_signing_common(struct smbcli_transport *transport)
 {
        if (!(transport->negotiate.sec_mode & 
              (NEGOTIATE_SECURITY_SIGNATURES_REQUIRED|NEGOTIATE_SECURITY_SIGNATURES_ENABLED))) {
@@ -58,7 +58,7 @@ static BOOL set_smb_signing_common(struct cli_transport *transport)
 /***********************************************************
  SMB signing - Common code for 'real' implementations
 ************************************************************/
-static BOOL set_smb_signing_real_common(struct cli_transport *transport) 
+static BOOL set_smb_signing_real_common(struct smbcli_transport *transport) 
 {
        if (transport->negotiate.sign_info.mandatory_signing) {
                DEBUG(5, ("Mandatory SMB signing enabled!\n"));
@@ -77,7 +77,7 @@ static void mark_packet_signed(struct request_buffer *out)
        SSVAL(out->hdr, HDR_FLG2, flags2);
 }
 
-static BOOL signing_good(struct cli_request *req, unsigned int seq, BOOL good) 
+static BOOL signing_good(struct smbcli_request *req, unsigned int seq, BOOL good) 
 {
        if (good) {
                if (!req->transport->negotiate.sign_info.doing_signing) {
@@ -96,7 +96,7 @@ static BOOL signing_good(struct cli_request *req, unsigned int seq, BOOL good)
                        req->transport->negotiate.sign_info.doing_signing = False;
                        if (req->transport->negotiate.sign_info.free_signing_context)
                                req->transport->negotiate.sign_info.free_signing_context(req->transport);
-                       cli_null_set_signing(req->transport);
+                       smbcli_null_set_signing(req->transport);
                        return True;
                } else {
                        /* bad packet after signing started - fail and disconnect. */
@@ -206,7 +206,7 @@ BOOL check_signed_incoming_message(struct request_buffer *in, DATA_BLOB *mac_key
 /***********************************************************
  SMB signing - Simple implementation - calculate a MAC to send.
 ************************************************************/
-static void cli_request_simple_sign_outgoing_message(struct cli_request *req)
+static void smbcli_request_simple_sign_outgoing_message(struct smbcli_request *req)
 {
        struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context;
 
@@ -233,7 +233,7 @@ static void cli_request_simple_sign_outgoing_message(struct cli_request *req)
 /***********************************************************
  SMB signing - Simple implementation - check a MAC sent by server.
 ************************************************************/
-static BOOL cli_request_simple_check_incoming_message(struct cli_request *req)
+static BOOL smbcli_request_simple_check_incoming_message(struct smbcli_request *req)
 {
        struct smb_basic_signing_context *data 
                = req->transport->negotiate.sign_info.signing_context;
@@ -249,7 +249,7 @@ static BOOL cli_request_simple_check_incoming_message(struct cli_request *req)
 /***********************************************************
  SMB signing - Simple implementation - free signing context
 ************************************************************/
-static void cli_transport_simple_free_signing_context(struct cli_transport *transport)
+static void smbcli_transport_simple_free_signing_context(struct smbcli_transport *transport)
 {
        struct smb_basic_signing_context *data = transport->negotiate.sign_info.signing_context;
 
@@ -263,7 +263,7 @@ static void cli_transport_simple_free_signing_context(struct cli_transport *tran
 /***********************************************************
  SMB signing - Simple implementation - setup the MAC key.
 ************************************************************/
-BOOL cli_transport_simple_set_signing(struct cli_transport *transport,
+BOOL smbcli_transport_simple_set_signing(struct smbcli_transport *transport,
                                      const DATA_BLOB user_session_key, 
                                      const DATA_BLOB response)
 {
@@ -293,9 +293,9 @@ BOOL cli_transport_simple_set_signing(struct cli_transport *transport,
        /* Initialise the sequence number */
        data->next_seq_num = 0;
 
-       transport->negotiate.sign_info.sign_outgoing_message = cli_request_simple_sign_outgoing_message;
-       transport->negotiate.sign_info.check_incoming_message = cli_request_simple_check_incoming_message;
-       transport->negotiate.sign_info.free_signing_context = cli_transport_simple_free_signing_context;
+       transport->negotiate.sign_info.sign_outgoing_message = smbcli_request_simple_sign_outgoing_message;
+       transport->negotiate.sign_info.check_incoming_message = smbcli_request_simple_check_incoming_message;
+       transport->negotiate.sign_info.free_signing_context = smbcli_transport_simple_free_signing_context;
 
        return True;
 }
@@ -304,7 +304,7 @@ BOOL cli_transport_simple_set_signing(struct cli_transport *transport,
 /***********************************************************
  SMB signing - NULL implementation - calculate a MAC to send.
 ************************************************************/
-static void cli_request_null_sign_outgoing_message(struct cli_request *req)
+static void smbcli_request_null_sign_outgoing_message(struct smbcli_request *req)
 {
        /* we can't zero out the sig, as we might be trying to send a
           transport request - which is NBT-level, not SMB level and doesn't
@@ -315,7 +315,7 @@ static void cli_request_null_sign_outgoing_message(struct cli_request *req)
 /***********************************************************
  SMB signing - NULL implementation - check a MAC sent by server.
 ************************************************************/
-static BOOL cli_request_null_check_incoming_message(struct cli_request *req)
+static BOOL smbcli_request_null_check_incoming_message(struct smbcli_request *req)
 {
        return True;
 }
@@ -324,7 +324,7 @@ static BOOL cli_request_null_check_incoming_message(struct cli_request *req)
 /***********************************************************
  SMB signing - NULL implementation - free signing context
 ************************************************************/
-static void cli_null_free_signing_context(struct cli_transport *transport)
+static void smbcli_null_free_signing_context(struct smbcli_transport *transport)
 {
 }
 
@@ -334,13 +334,13 @@ static void cli_null_free_signing_context(struct cli_transport *transport)
  @note Used as an initialisation only - it will not correctly
        shut down a real signing mechanism
 */
-BOOL cli_null_set_signing(struct cli_transport *transport)
+BOOL smbcli_null_set_signing(struct smbcli_transport *transport)
 {
        transport->negotiate.sign_info.signing_context = NULL;
        
-       transport->negotiate.sign_info.sign_outgoing_message = cli_request_null_sign_outgoing_message;
-       transport->negotiate.sign_info.check_incoming_message = cli_request_null_check_incoming_message;
-       transport->negotiate.sign_info.free_signing_context = cli_null_free_signing_context;
+       transport->negotiate.sign_info.sign_outgoing_message = smbcli_request_null_sign_outgoing_message;
+       transport->negotiate.sign_info.check_incoming_message = smbcli_request_null_check_incoming_message;
+       transport->negotiate.sign_info.free_signing_context = smbcli_null_free_signing_context;
 
        return True;
 }
@@ -348,7 +348,7 @@ BOOL cli_null_set_signing(struct cli_transport *transport)
 /***********************************************************
  SMB signing - TEMP implementation - calculate a MAC to send.
 ************************************************************/
-static void cli_request_temp_sign_outgoing_message(struct cli_request *req)
+static void smbcli_request_temp_sign_outgoing_message(struct smbcli_request *req)
 {
        /* mark the packet as signed - BEFORE we sign it...*/
        mark_packet_signed(&req->out);
@@ -363,7 +363,7 @@ static void cli_request_temp_sign_outgoing_message(struct cli_request *req)
 /***********************************************************
  SMB signing - TEMP implementation - check a MAC sent by server.
 ************************************************************/
-static BOOL cli_request_temp_check_incoming_message(struct cli_request *req)
+static BOOL smbcli_request_temp_check_incoming_message(struct smbcli_request *req)
 {
        return True;
 }
@@ -371,7 +371,7 @@ static BOOL cli_request_temp_check_incoming_message(struct cli_request *req)
 /***********************************************************
  SMB signing - NULL implementation - free signing context
 ************************************************************/
-static void cli_temp_free_signing_context(struct cli_transport *transport)
+static void smbcli_temp_free_signing_context(struct smbcli_transport *transport)
 {
        return;
 }
@@ -382,7 +382,7 @@ static void cli_temp_free_signing_context(struct cli_transport *transport)
  @note Used as an initialisation only - it will not correctly
        shut down a real signing mechanism
 */
-BOOL cli_temp_set_signing(struct cli_transport *transport)
+BOOL smbcli_temp_set_signing(struct smbcli_transport *transport)
 {
        if (!set_smb_signing_common(transport)) {
                return False;
@@ -390,9 +390,9 @@ BOOL cli_temp_set_signing(struct cli_transport *transport)
 
        transport->negotiate.sign_info.signing_context = NULL;
        
-       transport->negotiate.sign_info.sign_outgoing_message = cli_request_temp_sign_outgoing_message;
-       transport->negotiate.sign_info.check_incoming_message = cli_request_temp_check_incoming_message;
-       transport->negotiate.sign_info.free_signing_context = cli_temp_free_signing_context;
+       transport->negotiate.sign_info.sign_outgoing_message = smbcli_request_temp_sign_outgoing_message;
+       transport->negotiate.sign_info.check_incoming_message = smbcli_request_temp_check_incoming_message;
+       transport->negotiate.sign_info.free_signing_context = smbcli_temp_free_signing_context;
 
        return True;
 }
@@ -400,20 +400,20 @@ BOOL cli_temp_set_signing(struct cli_transport *transport)
 /**
  * Free the signing context
  */
-void cli_transport_free_signing_context(struct cli_transport *transport) 
+void smbcli_transport_free_signing_context(struct smbcli_transport *transport) 
 {
        if (transport->negotiate.sign_info.free_signing_context) {
                transport->negotiate.sign_info.free_signing_context(transport);
        }
 
-       cli_null_set_signing(transport);
+       smbcli_null_set_signing(transport);
 }
 
 
 /**
  * Sign a packet with the current mechanism
  */
-void cli_request_calculate_sign_mac(struct cli_request *req)
+void smbcli_request_calculate_sign_mac(struct smbcli_request *req)
 {
        req->transport->negotiate.sign_info.sign_outgoing_message(req);
 }
@@ -424,7 +424,7 @@ void cli_request_calculate_sign_mac(struct cli_request *req)
  * @return False if we had an established signing connection
  *         which had a back checksum, True otherwise
  */
-BOOL cli_request_check_sign_mac(struct cli_request *req) 
+BOOL smbcli_request_check_sign_mac(struct smbcli_request *req) 
 {
        BOOL good;
 
@@ -442,9 +442,9 @@ BOOL cli_request_check_sign_mac(struct cli_request *req)
 }
 
 
-BOOL cli_init_signing(struct cli_transport *transport) 
+BOOL smbcli_init_signing(struct smbcli_transport *transport) 
 {
-       if (!cli_null_set_signing(transport)) {
+       if (!smbcli_null_set_signing(transport)) {
                return False;
        }
        
index d852cd0d210456917ffc8f32295228cc21a720fb..e7e413bbcba4085ee55884f4f311c64ff5b29f90 100644 (file)
@@ -25,7 +25,7 @@
 /***************************************************************************
  Return an error message from the last response
 ****************************************************************************/
-const char *cli_errstr(struct cli_tree *tree)
+const char *smbcli_errstr(struct smbcli_tree *tree)
 {   
        switch (tree->session->transport->error.etype) {
        case ETYPE_DOS:
@@ -49,7 +49,7 @@ const char *cli_errstr(struct cli_tree *tree)
 
 
 /* Return the 32-bit NT status code from the last packet */
-NTSTATUS cli_nt_error(struct cli_tree *tree)
+NTSTATUS smbcli_nt_error(struct smbcli_tree *tree)
 {
        switch (tree->session->transport->error.etype) {
        case ETYPE_NT:
@@ -75,7 +75,7 @@ NTSTATUS cli_nt_error(struct cli_tree *tree)
 
 /* Return the DOS error from the last packet - an error class and an error
    code. */
-void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode)
+void smbcli_dos_error(struct smbcli_state *cli, uint8_t *eclass, uint32_t *ecode)
 {
        if (cli->transport->error.etype == ETYPE_DOS) {
                ntstatus_to_dos(cli->transport->error.e.nt_status, 
@@ -89,13 +89,13 @@ void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode)
 
 
 /* Return true if the last packet was an error */
-BOOL cli_is_error(struct cli_tree *tree)
+BOOL smbcli_is_error(struct smbcli_tree *tree)
 {
-       return NT_STATUS_IS_ERR(cli_nt_error(tree));
+       return NT_STATUS_IS_ERR(smbcli_nt_error(tree));
 }
 
 /* Return true if the last error was a DOS error */
-BOOL cli_is_dos_error(struct cli_tree *tree)
+BOOL smbcli_is_dos_error(struct smbcli_tree *tree)
 {
        return tree->session->transport->error.etype == ETYPE_DOS;
 }
index 56dee7381a0ccd35627c8795e9e0a35e56a1f72a..3efa1dbbc9633956be655d783aa0177c389921ee 100644 (file)
@@ -29,7 +29,7 @@
  of the ".." name.
 *******************************************************************/
 
-BOOL mask_match(struct cli_state *cli, const char *string, char *pattern, BOOL is_case_sensitive)
+BOOL mask_match(struct smbcli_state *cli, const char *string, char *pattern, BOOL is_case_sensitive)
 {
        fstring p2, s2;
 
index a02fdaa38b0ae807145a64ac15591636e08add72..a50b4edc88a1db762fc8f7cd6f24c3b7d89f4249 100644 (file)
@@ -190,20 +190,20 @@ void SMBNTencrypt(const char *passwd, uint8_t *c8, uint8_t *p24)
 /* Does the md5 encryption from the Key Response for NTLMv2. */
 void SMBOWFencrypt_ntv2(const uint8_t kr[16],
                        const DATA_BLOB *srv_chal,
-                       const DATA_BLOB *cli_chal,
+                       const DATA_BLOB *smbcli_chal,
                        uint8_t resp_buf[16])
 {
        HMACMD5Context ctx;
 
        hmac_md5_init_limK_to_64(kr, 16, &ctx);
        hmac_md5_update(srv_chal->data, srv_chal->length, &ctx);
-       hmac_md5_update(cli_chal->data, cli_chal->length, &ctx);
+       hmac_md5_update(smbcli_chal->data, smbcli_chal->length, &ctx);
        hmac_md5_final(resp_buf, &ctx);
 
 #ifdef DEBUG_PASSWORD
-       DEBUG(100, ("SMBOWFencrypt_ntv2: srv_chal, cli_chal, resp_buf\n"));
+       DEBUG(100, ("SMBOWFencrypt_ntv2: srv_chal, smbcli_chal, resp_buf\n"));
        dump_data(100, srv_chal->data, srv_chal->length);
-       dump_data(100, cli_chal->data, cli_chal->length);
+       dump_data(100, smbcli_chal->data, smbcli_chal->length);
        dump_data(100, resp_buf, 16);
 #endif
 }
index 95e157b700d370940cdaf5cacb6f023e66206bfe..51722c8a04e6c9158dba3fd079266dbdfaf0547b 100644 (file)
 /* transport private information used by SMB pipe transport */
 struct smb_private {
        uint16_t fnum;
-       struct cli_tree *tree;
+       struct smbcli_tree *tree;
 };
 
-static struct cli_request *dcerpc_raw_send(struct dcerpc_pipe *p, DATA_BLOB *blob)
+static struct smbcli_request *dcerpc_raw_send(struct dcerpc_pipe *p, DATA_BLOB *blob)
 {
        struct smb_private *smb = p->transport.private;
        struct smb_trans2 trans;
        uint16_t setup[2];
-       struct cli_request *req;
+       struct smbcli_request *req;
        TALLOC_CTX *mem_ctx;
 
        mem_ctx = talloc_init("dcerpc_raw_send");
@@ -64,7 +64,7 @@ static struct cli_request *dcerpc_raw_send(struct dcerpc_pipe *p, DATA_BLOB *blo
 
 
 static NTSTATUS dcerpc_raw_recv(struct dcerpc_pipe *p, 
-                               struct cli_request *req,
+                               struct smbcli_request *req,
                                TALLOC_CTX *mem_ctx,
                                DATA_BLOB *blob)
 {
@@ -154,7 +154,7 @@ static NTSTATUS smb_full_request(struct dcerpc_pipe *p,
                                 DATA_BLOB *request_blob,
                                 DATA_BLOB *reply_blob)
 {
-       struct cli_request *req;
+       struct smbcli_request *req;
        req = dcerpc_raw_send(p, request_blob);
        return dcerpc_raw_recv(p, req, mem_ctx, reply_blob);
 }
@@ -282,7 +282,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);
-       cli_tree_close(smb->tree);
+       smbcli_tree_close(smb->tree);
 
        return NT_STATUS_OK;
 }
@@ -300,7 +300,7 @@ static const char *smb_peer_name(struct dcerpc_pipe *p)
    open a rpc connection to a named pipe 
 */
 NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe **p, 
-                             struct cli_tree *tree,
+                             struct smbcli_tree *tree,
                              const char *pipe_name)
 {
        struct smb_private *smb;
@@ -380,7 +380,7 @@ NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe **p,
 /*
   return the SMB tree used for a dcerpc over SMB pipe
 */
-struct cli_tree *dcerpc_smb_tree(struct dcerpc_pipe *p)
+struct smbcli_tree *dcerpc_smb_tree(struct dcerpc_pipe *p)
 {
        struct smb_private *smb = p->transport.private;
 
index d5cd2ab6fe4745700d80f0b186d577534f11412c..7f3d49061a3d88bf17ee58034f9faf51141bc615 100644 (file)
@@ -435,7 +435,7 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
 {
        NTSTATUS status;
        BOOL retry;
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        const char *pipe_name;
        
        if (!binding->options || !binding->options[0]) {
@@ -458,12 +458,12 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
        }
            
        if ((binding->flags & DCERPC_SCHANNEL_ANY) || !username || !username[0]) {
-               status = cli_full_connection(&cli, lp_netbios_name(),
+               status = smbcli_full_connection(&cli, lp_netbios_name(),
                                             binding->host, NULL, 
                                             "ipc$", "?????", 
                                             "", "", NULL, 0, &retry);
        } else {
-               status = cli_full_connection(&cli, lp_netbios_name(),
+               status = smbcli_full_connection(&cli, lp_netbios_name(),
                                             binding->host, NULL, 
                                             "ipc$", "?????", 
                                             username, domain,
@@ -477,14 +477,14 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
        status = dcerpc_pipe_open_smb(p, cli->tree, pipe_name);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("Failed to open pipe %s - %s\n", pipe_name, nt_errstr(status)));
-               cli_tdis(cli);
-               cli_shutdown(cli);
+               smbcli_tdis(cli);
+               smbcli_shutdown(cli);
                 return status;
         }
        
        /* this ensures that the reference count is decremented so
           a pipe close will really close the link */
-       cli_tree_close(cli->tree);
+       smbcli_tree_close(cli->tree);
        
        (*p)->flags = binding->flags;
 
@@ -649,7 +649,7 @@ NTSTATUS dcerpc_secondary_connection(struct dcerpc_pipe *p, struct dcerpc_pipe *
                                     const char *pipe_uuid,
                                     uint32_t pipe_version)
 {
-       struct cli_tree *tree;
+       struct smbcli_tree *tree;
        NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
        struct dcerpc_binding b;
 
@@ -697,7 +697,7 @@ NTSTATUS dcerpc_secondary_connection(struct dcerpc_pipe *p, struct dcerpc_pipe *
 NTSTATUS dcerpc_fetch_session_key(struct dcerpc_pipe *p,
                                  DATA_BLOB *session_key)
 {
-       struct cli_tree *tree;
+       struct smbcli_tree *tree;
 
        if (p->security_state.generic_state) {
                return gensec_session_key(p->security_state.generic_state, session_key);
index fd94a923c90cbf6d03e0a229ace8b65661d90a8f..9020ba2bba9f4f0783c3d9a9fa6aa13c7b216227 100644 (file)
@@ -29,8 +29,8 @@
 
 /* this is stored in ntvfs_private */
 struct cvfs_private {
-       struct cli_tree *tree;
-       struct cli_transport *transport;
+       struct smbcli_tree *tree;
+       struct smbcli_transport *transport;
        struct smbsrv_tcon *tcon;
        const char *map_calls;
 };
@@ -48,7 +48,7 @@ struct async_info {
   this function won't be needed once all of the cifs backend
   and the core of smbd is converted to use async calls
 */
-static void idle_func(struct cli_transport *transport, void *p_private)
+static void idle_func(struct smbcli_transport *transport, void *p_private)
 {
        struct cvfs_private *private = p_private;
        if (socket_pending(private->tcon->smb_conn->connection->socket->fde->fd)) {
@@ -60,7 +60,7 @@ static void idle_func(struct cli_transport *transport, void *p_private)
   a handler for oplock break events from the server - these need to be passed
   along to the client
  */
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
+static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
 {
        struct cvfs_private *private = p_private;
        
@@ -78,7 +78,7 @@ static void cifs_socket_handler(struct event_context *ev, struct fd_event *fde,
        
        DEBUG(5,("cifs_socket_handler event on fd %d\n", fde->fd));
        
-       if (!cli_transport_process(private->transport)) {
+       if (!smbcli_transport_process(private->transport)) {
                /* the connection to our server is dead */
                close_cnum(tcon);
        }
@@ -121,7 +121,7 @@ static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename)
 
        req->tcon->ntvfs_private = (void *)private;
 
-       status = cli_tree_full_connection(&private->tree, 
+       status = smbcli_tree_full_connection(&private->tree, 
                                          "vfs_cifs",
                                          host,
                                          0,
@@ -157,8 +157,8 @@ static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename)
        }         
 
        /* we need to receive oplock break requests from the server */
-       cli_oplock_handler(private->transport, oplock_handler, private);
-       cli_transport_idle_handler(private->transport, idle_func, 1, private);
+       smbcli_oplock_handler(private->transport, oplock_handler, private);
+       smbcli_transport_idle_handler(private->transport, idle_func, 1, private);
 
        private->transport->event.fde->handler = cifs_socket_handler;
        private->transport->event.fde->private = private;
@@ -179,7 +179,7 @@ static NTSTATUS cvfs_disconnect(struct smbsrv_tcon *tcon)
        struct cvfs_private *private = tcon->ntvfs_private;
 
        smb_tree_disconnect(private->tree);
-       cli_tree_close(private->tree);
+       smbcli_tree_close(private->tree);
 
        return NT_STATUS_OK;
 }
@@ -189,11 +189,11 @@ static NTSTATUS cvfs_disconnect(struct smbsrv_tcon *tcon)
   this handler can only be used for functions that don't return any
   parameters (those that just return a status code)
  */
-static void async_simple(struct cli_request *c_req)
+static void async_simple(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
-       req->async.status = cli_request_simple_recv(c_req);
+       req->async.status = smbcli_request_simple_recv(c_req);
        req->async.send_fn(req);
 }
 
@@ -223,7 +223,7 @@ static void async_simple(struct cli_request *c_req)
 static NTSTATUS cvfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        /* see if the front end will allow us to perform this
           function asynchronously.  */
@@ -239,7 +239,7 @@ static NTSTATUS cvfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
 /*
   a handler for async ioctl replies
  */
-static void async_ioctl(struct cli_request *c_req)
+static void async_ioctl(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
@@ -253,7 +253,7 @@ static void async_ioctl(struct cli_request *c_req)
 static NTSTATUS cvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        /* see if the front end will allow us to perform this
           function asynchronously.  */
@@ -272,7 +272,7 @@ static NTSTATUS cvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
 static NTSTATUS cvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_chkpath(private->tree, cp);
@@ -286,7 +286,7 @@ static NTSTATUS cvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
 /*
   a handler for async qpathinfo replies
  */
-static void async_qpathinfo(struct cli_request *c_req)
+static void async_qpathinfo(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
@@ -300,7 +300,7 @@ static void async_qpathinfo(struct cli_request *c_req)
 static NTSTATUS cvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_pathinfo(private->tree, req->mem_ctx, info);
@@ -314,7 +314,7 @@ static NTSTATUS cvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *i
 /*
   a handler for async qfileinfo replies
  */
-static void async_qfileinfo(struct cli_request *c_req)
+static void async_qfileinfo(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
@@ -328,7 +328,7 @@ static void async_qfileinfo(struct cli_request *c_req)
 static NTSTATUS cvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_fileinfo(private->tree, req->mem_ctx, info);
@@ -346,7 +346,7 @@ static NTSTATUS cvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *i
 static NTSTATUS cvfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_setpathinfo(private->tree, st);
@@ -361,7 +361,7 @@ static NTSTATUS cvfs_setpathinfo(struct smbsrv_request *req, union smb_setfilein
 /*
   a handler for async open replies
  */
-static void async_open(struct cli_request *c_req)
+static void async_open(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
@@ -375,7 +375,7 @@ static void async_open(struct cli_request *c_req)
 static NTSTATUS cvfs_open(struct smbsrv_request *req, union smb_open *io)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (private->map_calls && in_list("open", private->map_calls, True) &&
            io->generic.level != RAW_OPEN_GENERIC) {
@@ -397,7 +397,7 @@ static NTSTATUS cvfs_open(struct smbsrv_request *req, union smb_open *io)
 static NTSTATUS cvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_mkdir(private->tree, md);
@@ -414,7 +414,7 @@ static NTSTATUS cvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
 static NTSTATUS cvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_rmdir(private->tree, rd);
@@ -430,7 +430,7 @@ static NTSTATUS cvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
 static NTSTATUS cvfs_rename(struct smbsrv_request *req, union smb_rename *ren)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_rename(private->tree, ren);
@@ -452,7 +452,7 @@ static NTSTATUS cvfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
 /*
   a handler for async read replies
  */
-static void async_read(struct cli_request *c_req)
+static void async_read(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
@@ -466,7 +466,7 @@ static void async_read(struct cli_request *c_req)
 static NTSTATUS cvfs_read(struct smbsrv_request *req, union smb_read *rd)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_read(private->tree, rd);
@@ -480,7 +480,7 @@ static NTSTATUS cvfs_read(struct smbsrv_request *req, union smb_read *rd)
 /*
   a handler for async write replies
  */
-static void async_write(struct cli_request *c_req)
+static void async_write(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
@@ -494,7 +494,7 @@ static void async_write(struct cli_request *c_req)
 static NTSTATUS cvfs_write(struct smbsrv_request *req, union smb_write *wr)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_write(private->tree, wr);
@@ -527,7 +527,7 @@ static NTSTATUS cvfs_flush(struct smbsrv_request *req, struct smb_flush *io)
 static NTSTATUS cvfs_close(struct smbsrv_request *req, union smb_close *io)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_close(private->tree, io);
@@ -552,7 +552,7 @@ static NTSTATUS cvfs_exit(struct smbsrv_request *req)
 static NTSTATUS cvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_lock(private->tree, lck);
@@ -569,7 +569,7 @@ static NTSTATUS cvfs_setfileinfo(struct smbsrv_request *req,
                                 union smb_setfileinfo *info)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_setfileinfo(private->tree, info);
@@ -583,7 +583,7 @@ static NTSTATUS cvfs_setfileinfo(struct smbsrv_request *req,
 /*
   a handler for async fsinfo replies
  */
-static void async_fsinfo(struct cli_request *c_req)
+static void async_fsinfo(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
@@ -597,7 +597,7 @@ static void async_fsinfo(struct cli_request *c_req)
 static NTSTATUS cvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_fsinfo(private->tree, req->mem_ctx, fs);
@@ -649,7 +649,7 @@ static NTSTATUS cvfs_search_close(struct smbsrv_request *req, union smb_search_c
 /*
   a handler for async trans2 replies
  */
-static void async_trans2(struct cli_request *c_req)
+static void async_trans2(struct smbcli_request *c_req)
 {
        struct async_info *async = c_req->async.private;
        struct smbsrv_request *req = async->req;
@@ -661,7 +661,7 @@ static void async_trans2(struct cli_request *c_req)
 static NTSTATUS cvfs_trans2(struct smbsrv_request *req, struct smb_trans2 *trans2)
 {
        struct cvfs_private *private = req->tcon->ntvfs_private;
-       struct cli_request *c_req;
+       struct smbcli_request *c_req;
 
        if (!req->async.send_fn) {
                return smb_raw_trans2(private->tree, req->mem_ctx, trans2);
index 9fe2baa30006976c479e0ade2fde5c7eee8c04c7..5da8d2643b47f5b2e12a092b820df31ad966bf4a 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "includes.h"
 
-int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *fname);
+int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname);
 
 struct trans2_blobs {
        struct trans2_blobs *next, *prev;
@@ -29,7 +29,7 @@ struct trans2_blobs {
 };
 
 /* look for aliases for a query */
-static void gen_aliases(struct cli_state *cli, struct smb_trans2 *t2, int level_offset)
+static void gen_aliases(struct smbcli_state *cli, struct smb_trans2 *t2, int level_offset)
 {
        TALLOC_CTX *mem_ctx;
        uint16_t level;
@@ -78,7 +78,7 @@ static void gen_aliases(struct cli_state *cli, struct smb_trans2 *t2, int level_
 }
 
 /* look for qfsinfo aliases */
-static void qfsinfo_aliases(struct cli_state *cli)
+static void qfsinfo_aliases(struct smbcli_state *cli)
 {
        struct smb_trans2 t2;
        uint16_t setup = TRANSACT2_QFSINFO;
@@ -99,7 +99,7 @@ static void qfsinfo_aliases(struct cli_state *cli)
 }
 
 /* look for qfileinfo aliases */
-static void qfileinfo_aliases(struct cli_state *cli)
+static void qfileinfo_aliases(struct smbcli_state *cli)
 {
        struct smb_trans2 t2;
        uint16_t setup = TRANSACT2_QFILEINFO;
@@ -118,25 +118,25 @@ static void qfileinfo_aliases(struct cli_state *cli)
        t2.in.params = data_blob(NULL, 4);
        t2.in.data = data_blob(NULL, 0);
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        fnum = create_complex_file(cli, cli->mem_ctx, fname);
        if (fnum == -1) {
-               printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
 
        SSVAL(t2.in.params.data, 0, fnum);
 
        gen_aliases(cli, &t2, 2);
 
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 }
 
 
 /* look for qpathinfo aliases */
-static void qpathinfo_aliases(struct cli_state *cli)
+static void qpathinfo_aliases(struct smbcli_state *cli)
 {
        struct smb_trans2 t2;
        uint16_t setup = TRANSACT2_QPATHINFO;
@@ -158,29 +158,29 @@ static void qpathinfo_aliases(struct cli_state *cli)
        t2.in.params = data_blob_talloc(mem_ctx, NULL, 6);
        t2.in.data = data_blob(NULL, 0);
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        fnum = create_complex_file(cli, cli->mem_ctx, fname);
        if (fnum == -1) {
-               printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
-       cli_close(cli->tree, fnum);
+       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_close(cli->tree, fnum);
 
        SIVAL(t2.in.params.data, 2, 0);
 
-       cli_blob_append_string(cli->session, mem_ctx, &t2.in.params, 
+       smbcli_blob_append_string(cli->session, mem_ctx, &t2.in.params, 
                               fname, STR_TERMINATE);
 
        gen_aliases(cli, &t2, 0);
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        talloc_destroy(mem_ctx);
 }
 
 
 /* look for trans2 findfirst aliases */
-static void findfirst_aliases(struct cli_state *cli)
+static void findfirst_aliases(struct smbcli_state *cli)
 {
        struct smb_trans2 t2;
        uint16_t setup = TRANSACT2_FINDFIRST;
@@ -202,14 +202,14 @@ static void findfirst_aliases(struct cli_state *cli)
        t2.in.params = data_blob_talloc(mem_ctx, NULL, 12);
        t2.in.data = data_blob(NULL, 0);
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        fnum = create_complex_file(cli, cli->mem_ctx, fname);
        if (fnum == -1) {
-               printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
-       cli_close(cli->tree, fnum);
+       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_close(cli->tree, fnum);
 
        SSVAL(t2.in.params.data, 0, 0);
        SSVAL(t2.in.params.data, 2, 1);
@@ -217,19 +217,19 @@ static void findfirst_aliases(struct cli_state *cli)
        SSVAL(t2.in.params.data, 6, 0);
        SIVAL(t2.in.params.data, 8, 0);
 
-       cli_blob_append_string(cli->session, mem_ctx, &t2.in.params, 
+       smbcli_blob_append_string(cli->session, mem_ctx, &t2.in.params, 
                               fname, STR_TERMINATE);
 
        gen_aliases(cli, &t2, 6);
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        talloc_destroy(mem_ctx);
 }
 
 
 
 /* look for aliases for a set function */
-static void gen_set_aliases(struct cli_state *cli, struct smb_trans2 *t2, int level_offset)
+static void gen_set_aliases(struct smbcli_state *cli, struct smb_trans2 *t2, int level_offset)
 {
        TALLOC_CTX *mem_ctx;
        uint16_t level;
@@ -295,7 +295,7 @@ static void gen_set_aliases(struct cli_state *cli, struct smb_trans2 *t2, int le
 
 
 /* look for setfileinfo aliases */
-static void setfileinfo_aliases(struct cli_state *cli)
+static void setfileinfo_aliases(struct smbcli_state *cli)
 {
        struct smb_trans2 t2;
        uint16_t setup = TRANSACT2_SETFILEINFO;
@@ -314,25 +314,25 @@ static void setfileinfo_aliases(struct cli_state *cli)
        t2.in.params = data_blob(NULL, 6);
        t2.in.data = data_blob(NULL, 0);
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        fnum = create_complex_file(cli, cli->mem_ctx, fname);
        if (fnum == -1) {
-               printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
 
        SSVAL(t2.in.params.data, 0, fnum);
        SSVAL(t2.in.params.data, 4, 0);
 
        gen_set_aliases(cli, &t2, 2);
 
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 }
 
 /* look for setpathinfo aliases */
-static void setpathinfo_aliases(struct cli_state *cli)
+static void setpathinfo_aliases(struct smbcli_state *cli)
 {
        struct smb_trans2 t2;
        uint16_t setup = TRANSACT2_SETPATHINFO;
@@ -354,25 +354,25 @@ static void setpathinfo_aliases(struct cli_state *cli)
        t2.in.params = data_blob_talloc(mem_ctx, NULL, 4);
        t2.in.data = data_blob(NULL, 0);
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        fnum = create_complex_file(cli, cli->mem_ctx, fname);
        if (fnum == -1) {
-               printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
-       cli_close(cli->tree, fnum);
+       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_close(cli->tree, fnum);
 
        SSVAL(t2.in.params.data, 2, 0);
 
-       cli_blob_append_string(cli->session, mem_ctx, &t2.in.params, 
+       smbcli_blob_append_string(cli->session, mem_ctx, &t2.in.params, 
                               fname, STR_TERMINATE);
 
        gen_set_aliases(cli, &t2, 0);
 
-       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fname))) {
-               printf("unlink: %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
+               printf("unlink: %s\n", smbcli_errstr(cli->tree));
        }
        talloc_destroy(mem_ctx);
 }
@@ -381,7 +381,7 @@ static void setpathinfo_aliases(struct cli_state *cli)
 /* look for aliased info levels in trans2 calls */
 BOOL torture_trans2_aliases(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
 
        if (!torture_open_connection(&cli)) {
                return False;
index 5febf873bd1022362ecdca6d92f0dea26edb59df..d769501326ac4e6c469a62b37abcc23bcb9dfb6d 100644 (file)
@@ -29,7 +29,7 @@
 
    the prefix BASEDIR is added before the name
 */
-static NTSTATUS unicode_open(struct cli_tree *tree,
+static NTSTATUS unicode_open(struct smbcli_tree *tree,
                             TALLOC_CTX *mem_ctx,
                             uint32_t open_disposition, 
                             const uint32_t *u_name, 
@@ -90,7 +90,7 @@ static NTSTATUS unicode_open(struct cli_tree *tree,
 /*
   see if the server recognises composed characters
 */
-static BOOL test_composed(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_composed(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        const uint32_t name1[] = {0x61, 0x308};
        const uint32_t name2[] = {0xe4};
@@ -119,7 +119,7 @@ static BOOL test_composed(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 /*
   see if the server recognises a naked diacritical
 */
-static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_diacritical(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        const uint32_t name1[] = {0x308};
        const uint32_t name2[] = {0x308, 0x308};
@@ -150,7 +150,7 @@ static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 /*
   see if the server recognises a partial surrogate pair
 */
-static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_surrogate(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        const uint32_t name1[] = {0xd800};
        const uint32_t name2[] = {0xdc00};
@@ -189,7 +189,7 @@ static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 /*
   see if the server recognises wide-a characters
 */
-static BOOL test_widea(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        const uint32_t name1[] = {'a'};
        const uint32_t name2[] = {0xff41};
@@ -228,7 +228,7 @@ static BOOL test_widea(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
 BOOL torture_charset(int dummy)
 {
-       static struct cli_state *cli;
+       static struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
@@ -240,12 +240,12 @@ BOOL torture_charset(int dummy)
 
        printf("Starting charset tests\n");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1) {
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
                printf("Failed to clean " BASEDIR "\n");
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
index ec4a8352404475fa6f6213f663275f0103c1fa76..66a1b37eecb02335716c025999e889f379b96a2f 100644 (file)
@@ -1405,7 +1405,7 @@ static void progress_bar(uint_t i, uint_t total)
  */
 BOOL torture_denytest1(int dummy)
 {
-       static struct cli_state *cli1;
+       static struct smbcli_state *cli1;
        int fnum1, fnum2;
        int i;
        BOOL correct = True;
@@ -1421,10 +1421,10 @@ BOOL torture_denytest1(int dummy)
        printf("Testing deny modes with 1 connection\n");
 
        for (i=0;i<2;i++) {
-               cli_unlink(cli1->tree, fnames[i]);
-               fnum1 = cli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
-               cli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
-               cli_close(cli1->tree, fnum1);
+               smbcli_unlink(cli1->tree, fnames[i]);
+               fnum1 = smbcli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
+               smbcli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
+               smbcli_close(cli1->tree, fnum1);
        }
 
        printf("testing %d entries\n", ARRAY_SIZE(denytable1));
@@ -1437,10 +1437,10 @@ BOOL torture_denytest1(int dummy)
 
                progress_bar(i, ARRAY_SIZE(denytable1));
 
-               fnum1 = cli_open(cli1->tree, fname, 
+               fnum1 = smbcli_open(cli1->tree, fname, 
                                 denytable1[i].mode1,
                                 denytable1[i].deny1);
-               fnum2 = cli_open(cli1->tree, fname, 
+               fnum2 = smbcli_open(cli1->tree, fname, 
                                 denytable1[i].mode2,
                                 denytable1[i].deny2);
 
@@ -1451,10 +1451,10 @@ BOOL torture_denytest1(int dummy)
                } else {
                        char x = 1;
                        res = A_0;
-                       if (cli_read(cli1->tree, fnum2, (void *)&x, 0, 1) == 1) {
+                       if (smbcli_read(cli1->tree, fnum2, (void *)&x, 0, 1) == 1) {
                                res += A_R;
                        }
-                       if (cli_write(cli1->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
+                       if (smbcli_write(cli1->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
                                res += A_W;
                        }
                }
@@ -1479,12 +1479,12 @@ BOOL torture_denytest1(int dummy)
                               resultstr(denytable1[i].result));
                }
 
-               cli_close(cli1->tree, fnum1);
-               cli_close(cli1->tree, fnum2);
+               smbcli_close(cli1->tree, fnum1);
+               smbcli_close(cli1->tree, fnum2);
        }
 
        for (i=0;i<2;i++) {
-               cli_unlink(cli1->tree, fnames[i]);
+               smbcli_unlink(cli1->tree, fnames[i]);
        }
                
        if (!torture_close_connection(cli1)) {
@@ -1501,7 +1501,7 @@ BOOL torture_denytest1(int dummy)
  */
 BOOL torture_denytest2(int dummy)
 {
-       static struct cli_state *cli1, *cli2;
+       static struct smbcli_state *cli1, *cli2;
        int fnum1, fnum2;
        int i;
        BOOL correct = True;
@@ -1517,10 +1517,10 @@ BOOL torture_denytest2(int dummy)
        printf("Testing deny modes with 2 connections\n");
 
        for (i=0;i<2;i++) {
-               cli_unlink(cli1->tree, fnames[i]);
-               fnum1 = cli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
-               cli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
-               cli_close(cli1->tree, fnum1);
+               smbcli_unlink(cli1->tree, fnames[i]);
+               fnum1 = smbcli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
+               smbcli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
+               smbcli_close(cli1->tree, fnum1);
        }
 
        GetTimeOfDay(&tv_start);
@@ -1531,10 +1531,10 @@ BOOL torture_denytest2(int dummy)
 
                progress_bar(i, ARRAY_SIZE(denytable1));
 
-               fnum1 = cli_open(cli1->tree, fname, 
+               fnum1 = smbcli_open(cli1->tree, fname, 
                                 denytable2[i].mode1,
                                 denytable2[i].deny1);
-               fnum2 = cli_open(cli2->tree, fname, 
+               fnum2 = smbcli_open(cli2->tree, fname, 
                                 denytable2[i].mode2,
                                 denytable2[i].deny2);
 
@@ -1545,10 +1545,10 @@ BOOL torture_denytest2(int dummy)
                } else {
                        char x = 1;
                        res = A_0;
-                       if (cli_read(cli2->tree, fnum2, (void *)&x, 0, 1) == 1) {
+                       if (smbcli_read(cli2->tree, fnum2, (void *)&x, 0, 1) == 1) {
                                res += A_R;
                        }
-                       if (cli_write(cli2->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
+                       if (smbcli_write(cli2->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
                                res += A_W;
                        }
                }
@@ -1573,12 +1573,12 @@ BOOL torture_denytest2(int dummy)
                               resultstr(denytable2[i].result));
                }
 
-               cli_close(cli1->tree, fnum1);
-               cli_close(cli2->tree, fnum2);
+               smbcli_close(cli1->tree, fnum1);
+               smbcli_close(cli2->tree, fnum2);
        }
                
        for (i=0;i<2;i++) {
-               cli_unlink(cli1->tree, fnames[i]);
+               smbcli_unlink(cli1->tree, fnames[i]);
        }
 
        if (!torture_close_connection(cli1)) {
index 79d49aded37b36a43d08ef503b6a584b6424597f..eb2d517f6daa9de1ddccccf9c2eaa2e32a7df693 100644 (file)
@@ -23,7 +23,7 @@
 #define DFS_SERVER_COUNT 6
 #define DFS_FILE_COUNT 8
 extern char *host, *share, *password, *username;
-static struct cli_client context;
+static struct smbcli_client context;
 static const char *sockops="TCP_NODELAY";
 
 /*
@@ -39,59 +39,59 @@ BOOL torture_dfs_basic(int dummy)
        const char *template = "\\\\%s\\%s\\dfstest%d.tmp";
        char *filedata;
        int server_count = 0;
-       int connection_flags = CLI_FULL_CONNECTION_USE_KERBEROS
-                               | CLI_FULL_CONNECTION_USE_DFS
+       int connection_flags = SMBCLI_FULL_CONNECTION_USE_KERBEROS
+                               | SMBCLI_FULL_CONNECTION_USE_DFS
                                ;
        
        printf("starting dfs_basic_test\n");
-       cli_client_initialize(&context, sockops, username, password, lp_workgroup(), connection_flags);
+       smbcli_client_initialize(&context, sockops, username, password, lp_workgroup(), connection_flags);
 
-       if ((current_server = cli_dfs_open_connection(&context, host, share, connection_flags) < 0))
+       if ((current_server = smbcli_dfs_open_connection(&context, host, share, connection_flags) < 0))
                return False;
 
        for (i=0; i < DFS_FILE_COUNT ; i++) {
                file_server[i] = 0;
                DEBUG(4,("host=%s share=%s cli host=%s cli share=%s\n",
-                       host, share, cli_state_get_host(context.cli[file_server[i]]),
-                       cli_state_get_share(context.cli[file_server[i]])));
-               host = cli_state_get_host(context.cli[file_server[i]]);
-               share = cli_state_get_share(context.cli[file_server[i]]);
+                       host, share, smbcli_state_get_host(context.cli[file_server[i]]),
+                       smbcli_state_get_share(context.cli[file_server[i]])));
+               host = smbcli_state_get_host(context.cli[file_server[i]]);
+               share = smbcli_state_get_share(context.cli[file_server[i]]);
                asprintf(&fname[i], template, host, share, i);
                DEBUG(3,("unlinking %s\n", fname[i]));
-               cli_nt_unlink(&context, &file_server[i], fname[i], 0);
+               smbcli_nt_unlink(&context, &file_server[i], fname[i], 0);
        }
        
        for (i=0; i < DFS_FILE_COUNT ; i++) {
-               host = cli_state_get_host(context.cli[file_server[i]]);
-               share = cli_state_get_share(context.cli[file_server[i]]);
+               host = smbcli_state_get_host(context.cli[file_server[i]]);
+               share = smbcli_state_get_share(context.cli[file_server[i]]);
                asprintf(&fname[i], template, host, share, i);
                DEBUG(3,("open %s on server %s(%d)\n",
                        fname[i], host, file_server[i]));
-               fnum[i] = cli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+               fnum[i] = smbcli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
                if (fnum[i] == -1)
                {
-                       printf("open of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+                       printf("open of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
                asprintf(&filedata, "%s %d", fname[i], fnum[i]);
                DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
                        strlen(filedata), filedata, fname[i], fnum[i],
                        host, file_server[i]));
-               if (cli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+               if (smbcli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
                {
-                       printf("write failed (%s)\n", cli_errstr(context.cli[file_server[i]]));
+                       printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
 
-               if (!cli_close(context.cli[file_server[i]], fnum[i])) {
-                       printf("close of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+               if (!smbcli_close(context.cli[file_server[i]], fnum[i])) {
+                       printf("close of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
        }
        DEBUG(3,("used Dfs servers:"));
        for (i=0; i < DFS_SERVER_COUNT ; i++) {
                server_count++;
-               DEBUG(3,(" %s(%d)",     cli_state_get_host(context.cli[file_server[i]]), i));
+               DEBUG(3,(" %s(%d)",     smbcli_state_get_host(context.cli[file_server[i]]), i));
                if (!torture_close_connection(context.cli[i]))
                        return False;
        }
@@ -119,63 +119,63 @@ BOOL torture_dfs_rename(int dummy)
        const char *template2new = "\\\\%s\\%s\\~dfstestnew.txt";
        char *filedata, *newdata;
        int server_count = 0;
-       int connection_flags = CLI_FULL_CONNECTION_USE_KERBEROS
-                               | CLI_FULL_CONNECTION_USE_DFS
+       int connection_flags = SMBCLI_FULL_CONNECTION_USE_KERBEROS
+                               | SMBCLI_FULL_CONNECTION_USE_DFS
                                ;
 
        printf("starting dfs_rename_test\n");
-       cli_client_initialize(&context, sockops, username, password,
+       smbcli_client_initialize(&context, sockops, username, password,
                              lp_workgroup(), connection_flags);
        
-       if ((current_server = cli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
+       if ((current_server = smbcli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
                return False;
        
        for (i=0; i < DFS_FILE_COUNT ; i++) {
                file_server[i] = 0;
                slprintf(fname[i],sizeof(fstring)-1,template, host, share, i);
                DEBUG(3,("unlinking %s\n", fname[i]));
-               cli_nt_unlink(&context, &file_server[i], fname[i], 0);
+               smbcli_nt_unlink(&context, &file_server[i], fname[i], 0);
        }
        /* Simple rename test */
        for (i=0; i < 1 ; i++) {
                slprintf(fname[i],sizeof(fstring)-1,template,
-                       cli_state_get_host(context.cli[file_server[i]]),
-                       cli_state_get_share(context.cli[file_server[i]]), i);
+                       smbcli_state_get_host(context.cli[file_server[i]]),
+                       smbcli_state_get_share(context.cli[file_server[i]]), i);
                DEBUG(3,("open %s on server %s(%d)\n",
-                       fname[i], cli_state_get_host(context.cli[file_server[i]]), file_server[i]));
+                       fname[i], smbcli_state_get_host(context.cli[file_server[i]]), file_server[i]));
                        
-               fnum[i] = cli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+               fnum[i] = smbcli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
                if (fnum[i] == -1) {
-                       printf("open of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+                       printf("open of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
                asprintf(&filedata, "%s %d", fname[i], (int)getpid());
                DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
                        strlen(filedata), filedata, fname[i], fnum[i],
-                       cli_state_get_host(context.cli[file_server[i]]), file_server[i]));
-               if (cli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+                       smbcli_state_get_host(context.cli[file_server[i]]), file_server[i]));
+               if (smbcli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
                {
-                       printf("write failed (%s)\n", cli_errstr(context.cli[file_server[i]]));
+                       printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
 
-               if (!cli_close(context.cli[file_server[i]], fnum[i])) {
-                       printf("close of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+               if (!smbcli_close(context.cli[file_server[i]], fnum[i])) {
+                       printf("close of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
        }
        // now attempt to rename the file
        DEBUG(3,("rename %s to %s on server %s(%d)\n",
-                       fname[0], fname[1], cli_state_get_host(context.cli[file_server[i]]), file_server[0]));
-       if (!cli_dfs_rename(&context, &file_server[0], fname[0], fname[1])) {
-               printf("rename of %s to %s failed (%s)\n", fname[0], fname[1], cli_errstr(context.cli[file_server[0]]));
+                       fname[0], fname[1], smbcli_state_get_host(context.cli[file_server[i]]), file_server[0]));
+       if (!smbcli_dfs_rename(&context, &file_server[0], fname[0], fname[1])) {
+               printf("rename of %s to %s failed (%s)\n", fname[0], fname[1], smbcli_errstr(context.cli[file_server[0]]));
                return False;
        }
        // clean up
        DEBUG(3,("used Dfs servers:"));
        for (i=0; i < DFS_SERVER_COUNT ; i++) {
                server_count++;
-               DEBUG(3,(" %s(%d)",     cli_state_get_host(context.cli[file_server[i]]), i));
+               DEBUG(3,(" %s(%d)",     smbcli_state_get_host(context.cli[file_server[i]]), i));
                if (!torture_close_connection(context.cli[i]))
                        return False;
        }
@@ -187,10 +187,10 @@ BOOL torture_dfs_rename(int dummy)
         * Then open, write to new temp name file (~x.new), close.
         * Then rename old file name to old temp name file (~x.old).
         * Then rename new temp name file to oroginal name (x). */
-       cli_client_initialize(&context, sockops, username, password,
+       smbcli_client_initialize(&context, sockops, username, password,
                              lp_workgroup(), connection_flags);
        
-       if ((current_server = cli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
+       if ((current_server = smbcli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
                return False;    
        slprintf(fname[0],sizeof(fname[0])-1,template2orig, host, share);
        slprintf(fname[1],sizeof(fname[1])-1,template2old, host, share);
@@ -199,99 +199,99 @@ BOOL torture_dfs_rename(int dummy)
                file_server[i] = 0;
                fnum[i] = 0;
                DEBUG(3,("unlinking %s\n", fname[i]));
-               cli_nt_unlink(&context, &file_server[i], fname[i], 0);
+               smbcli_nt_unlink(&context, &file_server[i], fname[i], 0);
        }
        asprintf(&fname[0],template2orig,
-                       cli_state_get_host(context.cli[0]),
-                       cli_state_get_share(context.cli[0]), 0);
+                       smbcli_state_get_host(context.cli[0]),
+                       smbcli_state_get_share(context.cli[0]), 0);
        asprintf(&fname[1],template2old,
-                       cli_state_get_host(context.cli[1]),
-                       cli_state_get_share(context.cli[1]), 1);
+                       smbcli_state_get_host(context.cli[1]),
+                       smbcli_state_get_share(context.cli[1]), 1);
        asprintf(&fname[2],template2new,
-                       cli_state_get_host(context.cli[2]),
-                       cli_state_get_share(context.cli[2]), 2);
+                       smbcli_state_get_host(context.cli[2]),
+                       smbcli_state_get_share(context.cli[2]), 2);
        DEBUG(3,("edit(MS Word) %s on server %s(%d)\n",
-                       fname[0], cli_state_get_host(context.cli[0]), file_server[0]));
+                       fname[0], smbcli_state_get_host(context.cli[0]), file_server[0]));
        DEBUG(3,("open %s on server %s(%d)\n",
-               fname[0], cli_state_get_host(context.cli[0]), file_server[0]));
+               fname[0], smbcli_state_get_host(context.cli[0]), file_server[0]));
                        
-       fnum[0] = cli_dfs_open(&context, &file_server[0], fname[0], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum[0] = smbcli_dfs_open(&context, &file_server[0], fname[0], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum[0] == -1)
        {
-               printf("open of %s failed (%s)\n", fname[0], cli_errstr(context.cli[file_server[0]]));
+               printf("open of %s failed (%s)\n", fname[0], smbcli_errstr(context.cli[file_server[0]]));
                return False;
        }
        slprintf(filedata, sizeof(fstring)-1, "%s %d", fname[0], (int)getpid());
        DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
                strlen(filedata), filedata, fname[0], fnum[0],
-               cli_state_get_host(context.cli[0]), file_server[0]));
-       if (cli_write(context.cli[file_server[0]], fnum[0], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+               smbcli_state_get_host(context.cli[0]), file_server[0]));
+       if (smbcli_write(context.cli[file_server[0]], fnum[0], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
        {
-               printf("write failed (%s)\n", cli_errstr(context.cli[file_server[0]]));
+               printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[0]]));
                return False;
        }
        // read data from original file
        DEBUG(3,("read %s (fid %d) on server %s(%d)\n",
-               fname[0], fnum[0], cli_state_get_host(context.cli[0]), file_server[0]));
-       if (cli_read(context.cli[file_server[0]], fnum[0], filedata, 0, strlen(filedata)) != strlen(filedata))
+               fname[0], fnum[0], smbcli_state_get_host(context.cli[0]), file_server[0]));
+       if (smbcli_read(context.cli[file_server[0]], fnum[0], filedata, 0, strlen(filedata)) != strlen(filedata))
        {
-               printf("read failed (%s)", cli_errstr(context.cli[file_server[0]]));
+               printf("read failed (%s)", smbcli_errstr(context.cli[file_server[0]]));
                return False;
        }
        DEBUG(3,("close %s on server %s(%d)\n",
-               fname[0], cli_state_get_host(context.cli[0]), file_server[0]));
-       if (!cli_close(context.cli[file_server[0]], fnum[0])) {
-               printf("close of %s failed (%s)\n", fname[0], cli_errstr(context.cli[file_server[0]]));
+               fname[0], smbcli_state_get_host(context.cli[0]), file_server[0]));
+       if (!smbcli_close(context.cli[file_server[0]], fnum[0])) {
+               printf("close of %s failed (%s)\n", fname[0], smbcli_errstr(context.cli[file_server[0]]));
                return False;
        }
        // open new temp file, write data
        DEBUG(3,("open %s on server %s(%d)\n",
-               fname[2], cli_state_get_host(context.cli[2]), file_server[2]));
-       fnum[2] = cli_dfs_open(&context, &file_server[2], fname[2], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+               fname[2], smbcli_state_get_host(context.cli[2]), file_server[2]));
+       fnum[2] = smbcli_dfs_open(&context, &file_server[2], fname[2], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum[2] == -1)
        {
-               printf("open of %s failed (%s)\n", fname[2], cli_errstr(context.cli[file_server[2]]));
+               printf("open of %s failed (%s)\n", fname[2], smbcli_errstr(context.cli[file_server[2]]));
                return False;
        }
        DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
                strlen(filedata), filedata, fname[2], fnum[2],
-               cli_state_get_host(context.cli[2]), file_server[2]));
-       if (cli_write(context.cli[file_server[2]], fnum[2], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+               smbcli_state_get_host(context.cli[2]), file_server[2]));
+       if (smbcli_write(context.cli[file_server[2]], fnum[2], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
        {
-               printf("write failed (%s)\n", cli_errstr(context.cli[file_server[2]]));
+               printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[2]]));
                return False;
        }
        slprintf(newdata, sizeof(fstring)-1, "new data: %s %d", fname[0], (int)getpid());
        DEBUG(3,("write new data %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
                strlen(newdata), newdata, fname[2], fnum[2],
-               cli_state_get_host(context.cli[2]), file_server[2]));
-       if (cli_write(context.cli[file_server[2]], fnum[2], 0, newdata, strlen(filedata), strlen(newdata)) != strlen(newdata))
+               smbcli_state_get_host(context.cli[2]), file_server[2]));
+       if (smbcli_write(context.cli[file_server[2]], fnum[2], 0, newdata, strlen(filedata), strlen(newdata)) != strlen(newdata))
        {
-               printf("write failed (%s)\n", cli_errstr(context.cli[file_server[2]]));
+               printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[2]]));
                return False;
        }
        DEBUG(3,("close %s on server %s(%d)\n",
-               fname[2], cli_state_get_host(context.cli[2]), file_server[2]));
-       if (!cli_close(context.cli[file_server[2]], fnum[2])) {
-               printf("close of %s failed (%s)\n", fname[2], cli_errstr(context.cli[file_server[2]]));
+               fname[2], smbcli_state_get_host(context.cli[2]), file_server[2]));
+       if (!smbcli_close(context.cli[file_server[2]], fnum[2])) {
+               printf("close of %s failed (%s)\n", fname[2], smbcli_errstr(context.cli[file_server[2]]));
                return False;
        }
        DEBUG(3,("close successful %s on server %s(%d)\n",
-               fname[2], cli_state_get_host(context.cli[2]), file_server[2]));
+               fname[2], smbcli_state_get_host(context.cli[2]), file_server[2]));
        // rename original file to temp 
        DEBUG(4,("file_server[0]=%d\n", file_server[0]));
-       DEBUG(4,("context.cli[file_server[0]].desthost=%s\n", cli_state_get_host(context.cli[0])));
+       DEBUG(4,("context.cli[file_server[0]].desthost=%s\n", smbcli_state_get_host(context.cli[0])));
        DEBUG(3,("rename %s to %s on server %s(%d)\n",
-                       fname[0], fname[1], cli_state_get_host(context.cli[0]), file_server[0]));
-       if (!cli_dfs_rename(&context, &file_server[0], fname[0], fname[1])) {
-               printf("rename of %s to %s failed (%s)\n", fname[0], fname[1], cli_errstr(context.cli[file_server[0]]));
+                       fname[0], fname[1], smbcli_state_get_host(context.cli[0]), file_server[0]));
+       if (!smbcli_dfs_rename(&context, &file_server[0], fname[0], fname[1])) {
+               printf("rename of %s to %s failed (%s)\n", fname[0], fname[1], smbcli_errstr(context.cli[file_server[0]]));
                return False;
        }
        // name new temp file to original
        DEBUG(3,("rename %s to %s on server %s(%d)\n",
-                       fname[2], fname[0], cli_state_get_host(context.cli[2]), file_server[2]));
-       if (!cli_dfs_rename(&context, &file_server[2], fname[2], fname[0])) {
-               printf("rename of %s to %s failed (%s)\n", fname[2], fname[0], cli_errstr(context.cli[file_server[2]]));
+                       fname[2], fname[0], smbcli_state_get_host(context.cli[2]), file_server[2]));
+       if (!smbcli_dfs_rename(&context, &file_server[2], fname[2], fname[0])) {
+               printf("rename of %s to %s failed (%s)\n", fname[2], fname[0], smbcli_errstr(context.cli[file_server[2]]));
                return False;
        }
        printf("Dfstest: passed MS Word rename test\n");
@@ -299,7 +299,7 @@ BOOL torture_dfs_rename(int dummy)
        DEBUG(3,("used Dfs servers:"));
        for (i=0; i < DFS_SERVER_COUNT ; i++) {
                server_count++;
-               DEBUG(3,(" %s(%d)",     cli_state_get_host(context.cli[i]), i));
+               DEBUG(3,(" %s(%d)",     smbcli_state_get_host(context.cli[i]), i));
                if (!torture_close_connection(context.cli[i]))
                        return False;
        }
@@ -309,7 +309,7 @@ BOOL torture_dfs_rename(int dummy)
        return True;
 }
 struct list_fn_parms {
-       struct cli_client *context;
+       struct smbcli_client *context;
        char* rname;
 } list_fn_parms;
 
@@ -321,7 +321,7 @@ void delete_file(file_info *finfo, const char *rname)
        
        DEBUG(3,("deleting file %s in %s\n", finfo->name, rname));
        asprintf(&fname, "%s\\%s", rname, finfo->name);
-       cli_nt_unlink(&context, &server, fname, 0);
+       smbcli_nt_unlink(&context, &server, fname, 0);
 }
 void delete_directory(file_info *finfo, const char *rname)
 {
@@ -330,12 +330,12 @@ void delete_directory(file_info *finfo, const char *rname)
        
        DEBUG(3,("deleting directory %s in %s\n", finfo->name, rname));
        asprintf(&dname, "%s%s\\*", rname, finfo->name);
-       cli_nt_unlink(&context, &server, dname, 0);
+       smbcli_nt_unlink(&context, &server, dname, 0);
        asprintf(&dname, "%s%s\\*", rname, finfo->name);
        asprintf(&rname2, "%s%s", rname, finfo->name);                  
-       cli_search(context.cli[0], dname, FILE_ATTRIBUTE_DIRECTORY,
+       smbcli_search(context.cli[0], dname, FILE_ATTRIBUTE_DIRECTORY,
                dfs_list_fn, (void*)rname2);
-       cli_dfs_rmdir(&context, &server, rname2);
+       smbcli_dfs_rmdir(&context, &server, rname2);
 }
 
 void dfs_list_fn(file_info *finfo, const char *name, void* parmsp)
@@ -371,47 +371,47 @@ BOOL torture_dfs_random(int dummy)
        char *filedata;
        int server_count = 0;
        int file_count;
-       int connection_flags = CLI_FULL_CONNECTION_USE_KERBEROS
-                               | CLI_FULL_CONNECTION_USE_DFS
+       int connection_flags = SMBCLI_FULL_CONNECTION_USE_KERBEROS
+                               | SMBCLI_FULL_CONNECTION_USE_DFS
                                ;
        
        printf("starting dfs_random_test\n");
-       cli_client_initialize(&context, sockops, username, password,
+       smbcli_client_initialize(&context, sockops, username, password,
                              lp_workgroup(), connection_flags);
 
-       if ((dir_server[0] = cli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
+       if ((dir_server[0] = smbcli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
                return False;
 
        // get list of directories named dfsdir*.
        // delete all files in these directories using wild card,
        // then delete directory.
        asprintf(&rname, "\\\\%s\\%s\\",
-                       cli_state_get_host(context.cli[0]),
-                       cli_state_get_share(context.cli[0]));
+                       smbcli_state_get_host(context.cli[0]),
+                       smbcli_state_get_share(context.cli[0]));
        asprintf(&fname[0], alltemplate,
-                       cli_state_get_host(context.cli[0]),
-                       cli_state_get_share(context.cli[0]));
+                       smbcli_state_get_host(context.cli[0]),
+                       smbcli_state_get_share(context.cli[0]));
        DEBUG(3,("deleting files %s in %s on server %s(%d)\n",
-               fname[0], rname, cli_state_get_host(context.cli[0]), dir_server[0]));
-       file_count = cli_search(context.cli[0], fname[0], FILE_ATTRIBUTE_DIRECTORY, dfs_list_fn, (void*)rname);
+               fname[0], rname, smbcli_state_get_host(context.cli[0]), dir_server[0]));
+       file_count = smbcli_search(context.cli[0], fname[0], FILE_ATTRIBUTE_DIRECTORY, dfs_list_fn, (void*)rname);
 
        // create random directory names with 0-n levels
        asprintf(&dname[0], "\\\\%s\\%s\\",
-                       cli_state_get_host(context.cli[0]),
-                       cli_state_get_share(context.cli[0]));
+                       smbcli_state_get_host(context.cli[0]),
+                       smbcli_state_get_share(context.cli[0]));
        DEBUG(3,("creating directories in %s on server %s(%d)\n",
-               rname, cli_state_get_host(context.cli[0]), dir_server[0]));
+               rname, smbcli_state_get_host(context.cli[0]), dir_server[0]));
        for (i=1; i < DFS_RANDOM_DIR_COUNT; i++) {
                dir_server[i] = 0;
                asprintf(&dname[i],
                        "\\\\%s\\%s\\dfsdir%d.tmp",
-                       cli_state_get_host(context.cli[dir_server[i]]),
-                       cli_state_get_share(context.cli[dir_server[i]]),
+                       smbcli_state_get_host(context.cli[dir_server[i]]),
+                       smbcli_state_get_share(context.cli[dir_server[i]]),
                        (int)sys_random()%10000);
                DEBUG(3,("mkdir %s on server %s(%d)\n",
-                       dname[i], cli_state_get_host(context.cli[dir_server[i]]), dir_server[i]));
-               if (!cli_dfs_mkdir(&context, &dir_server[i], dname[i])) {
-                       printf("mkdir of %s failed (%s)\n", dname[i], cli_errstr(context.cli[dir_server[i]]));
+                       dname[i], smbcli_state_get_host(context.cli[dir_server[i]]), dir_server[i]));
+               if (!smbcli_dfs_mkdir(&context, &dir_server[i], dname[i])) {
+                       printf("mkdir of %s failed (%s)\n", dname[i], smbcli_errstr(context.cli[dir_server[i]]));
                        return False;
                }
        }
@@ -422,33 +422,33 @@ BOOL torture_dfs_random(int dummy)
                file_server[i] = dir_server[dn];
                asprintf(&fname[i], ftemplate, dname[dn], i);
                DEBUG(3,("open %s on server %s(%d)\n",
-                       fname[i], cli_state_get_host(context.cli[dir_server[i]]), file_server[i]));
-               fnum[i] = cli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+                       fname[i], smbcli_state_get_host(context.cli[dir_server[i]]), file_server[i]));
+               fnum[i] = smbcli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
                if (fnum[i] == -1)
                {
-                       printf("open of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+                       printf("open of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
 
                asprintf(&filedata, "%s %d", fname[i], fnum[i]);
                DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
                        strlen(filedata), filedata, fname[i], fnum[i],
-                       cli_state_get_host(context.cli[dir_server[i]]), file_server[i]));
-               if (cli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+                       smbcli_state_get_host(context.cli[dir_server[i]]), file_server[i]));
+               if (smbcli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
                {
-                       printf("write failed (%s)\n", cli_errstr(context.cli[file_server[i]]));
+                       printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
 
-               if (!cli_close(context.cli[file_server[i]], fnum[i])) {
-                       printf("close of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+               if (!smbcli_close(context.cli[file_server[i]], fnum[i])) {
+                       printf("close of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
                        return False;
                }
        }
        DEBUG(3,("used Dfs servers:"));
        for (i=0; i < DFS_SERVER_COUNT ; i++) {
                server_count++;
-               DEBUG(3,(" %s(%d)",     cli_state_get_host(context.cli[i]), i));
+               DEBUG(3,(" %s(%d)",     smbcli_state_get_host(context.cli[i]), i));
                if (!torture_close_connection(context.cli[i]))
                        return False;
        }
index 4859ee7c4cf7e96335599247c4510e03aadaa5cb..c0c77f950f8a45e439b1ff375e47ca852b244f0f 100644 (file)
@@ -26,7 +26,7 @@ static TDB_CONTEXT *tdb;
 
 static uint_t total, collisions, failures;
 
-static BOOL test_one(struct cli_state *cli, const char *name)
+static BOOL test_one(struct smbcli_state *cli, const char *name)
 {
        int fnum;
        const char *shortname;
@@ -36,48 +36,48 @@ static BOOL test_one(struct cli_state *cli, const char *name)
 
        total++;
 
-       fnum = cli_open(cli->tree, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum = smbcli_open(cli->tree, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum == -1) {
-               printf("open of %s failed (%s)\n", name, cli_errstr(cli->tree));
+               printf("open of %s failed (%s)\n", name, smbcli_errstr(cli->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
-               printf("close of %s failed (%s)\n", name, cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+               printf("close of %s failed (%s)\n", name, smbcli_errstr(cli->tree));
                return False;
        }
 
        /* get the short name */
-       status = cli_qpathinfo_alt_name(cli->tree, name, &shortname);
+       status = smbcli_qpathinfo_alt_name(cli->tree, name, &shortname);
        if (!NT_STATUS_IS_OK(status)) {
-               printf("query altname of %s failed (%s)\n", name, cli_errstr(cli->tree));
+               printf("query altname of %s failed (%s)\n", name, smbcli_errstr(cli->tree));
                return False;
        }
 
        snprintf(name2, sizeof(name2), "\\mangle_test\\%s", shortname);
-       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, name2))) {
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, name2))) {
                printf("unlink of %s  (%s) failed (%s)\n", 
-                      name2, name, cli_errstr(cli->tree));
+                      name2, name, smbcli_errstr(cli->tree));
                return False;
        }
 
        /* recreate by short name */
-       fnum = cli_open(cli->tree, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum = smbcli_open(cli->tree, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum == -1) {
-               printf("open2 of %s failed (%s)\n", name2, cli_errstr(cli->tree));
+               printf("open2 of %s failed (%s)\n", name2, smbcli_errstr(cli->tree));
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
-               printf("close of %s failed (%s)\n", name, cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+               printf("close of %s failed (%s)\n", name, smbcli_errstr(cli->tree));
                return False;
        }
 
        /* and unlink by long name */
-       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, name))) {
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, name))) {
                printf("unlink2 of %s  (%s) failed (%s)\n", 
-                      name, name2, cli_errstr(cli->tree));
+                      name, name2, smbcli_errstr(cli->tree));
                failures++;
-               cli_unlink(cli->tree, name2);
+               smbcli_unlink(cli->tree, name2);
                return True;
        }
 
@@ -151,7 +151,7 @@ static void gen_name(char *name)
 BOOL torture_mangle(int dummy)
 {
        extern int torture_numops;
-       static struct cli_state *cli;
+       static struct smbcli_state *cli;
        int i;
 
        printf("starting mangle test\n");
@@ -167,10 +167,10 @@ BOOL torture_mangle(int dummy)
                return False;
        }
 
-       cli_unlink(cli->tree, "\\mangle_test\\*");
-       cli_rmdir(cli->tree, "\\mangle_test");
+       smbcli_unlink(cli->tree, "\\mangle_test\\*");
+       smbcli_rmdir(cli->tree, "\\mangle_test");
 
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\mangle_test"))) {
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\mangle_test"))) {
                printf("ERROR: Failed to make directory\n");
                return False;
        }
@@ -189,8 +189,8 @@ BOOL torture_mangle(int dummy)
                }
        }
 
-       cli_unlink(cli->tree, "\\mangle_test\\*");
-       if (NT_STATUS_IS_ERR(cli_rmdir(cli->tree, "\\mangle_test"))) {
+       smbcli_unlink(cli->tree, "\\mangle_test\\*");
+       if (NT_STATUS_IS_ERR(smbcli_rmdir(cli->tree, "\\mangle_test"))) {
                printf("ERROR: Failed to remove directory\n");
                return False;
        }
index 20a467100b0fc25c45633fbad39dc17d23d8e2d6..f8a0539f1eadd26ad7fde333c7c237a1bb40cfc9 100644 (file)
@@ -45,7 +45,7 @@ static void trans2_check_hit(const char *format, int op, int level, NTSTATUS sta
 /****************************************************************************
 check for existance of a trans2 call
 ****************************************************************************/
-static NTSTATUS try_trans2(struct cli_state *cli, 
+static NTSTATUS try_trans2(struct smbcli_state *cli, 
                           int op,
                           char *param, char *data,
                           int param_len, int data_len,
@@ -81,7 +81,7 @@ static NTSTATUS try_trans2(struct cli_state *cli,
 }
 
 
-static NTSTATUS try_trans2_len(struct cli_state *cli, 
+static NTSTATUS try_trans2_len(struct smbcli_state *cli, 
                             const char *format,
                             int op, int level,
                             char *param, char *data,
@@ -117,7 +117,7 @@ static NTSTATUS try_trans2_len(struct cli_state *cli,
 /****************************************************************************
 check whether a trans2 opnum exists at all
 ****************************************************************************/
-static BOOL trans2_op_exists(struct cli_state *cli, int op)
+static BOOL trans2_op_exists(struct smbcli_state *cli, int op)
 {
        int data_len = 0;
        int param_len = 0;
@@ -151,7 +151,7 @@ static BOOL trans2_op_exists(struct cli_state *cli, int op)
 /****************************************************************************
 check for existance of a trans2 call
 ****************************************************************************/
-static BOOL scan_trans2(struct cli_state *cli, int op, int level, 
+static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, 
                        int fnum, int dnum, int qfnum, const char *fname)
 {
        int data_len = 0;
@@ -217,19 +217,19 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
 
        status = try_trans2_len(cli, "newfile", op, level, param, data, param_len, &data_len, 
                                &rparam_len, &rdata_len);
-       cli_unlink(cli->tree, "\\newfile.dat");
-       cli_rmdir(cli->tree, "\\newfile.dat");
+       smbcli_unlink(cli->tree, "\\newfile.dat");
+       smbcli_rmdir(cli->tree, "\\newfile.dat");
        if (NT_STATUS_IS_OK(status)) return True;
 
        /* try dfs style  */
-       cli_mkdir(cli->tree, "\\testdir");
+       smbcli_mkdir(cli->tree, "\\testdir");
        param_len = 2;
        SSVAL(param, 0, level);
        param_len += push_string(NULL, &param[2], "\\testdir", sizeof(pstring)-3, STR_TERMINATE|STR_UNICODE);
 
        status = try_trans2_len(cli, "dfs", op, level, param, data, param_len, &data_len, 
                                &rparam_len, &rdata_len);
-       cli_rmdir(cli->tree, "\\testdir");
+       smbcli_rmdir(cli->tree, "\\testdir");
        if (NT_STATUS_IS_OK(status)) return True;
 
        return False;
@@ -238,7 +238,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
 
 BOOL torture_trans2_scan(int dummy)
 {
-       static struct cli_state *cli;
+       static struct smbcli_state *cli;
        int op, level;
        const char *fname = "\\scanner.dat";
        int fnum, dnum, qfnum;
@@ -249,19 +249,19 @@ BOOL torture_trans2_scan(int dummy)
                return False;
        }
 
-       fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
        if (fnum == -1) {
-               printf("file open failed - %s\n", cli_errstr(cli->tree));
+               printf("file open failed - %s\n", smbcli_errstr(cli->tree));
        }
-       dnum = cli_nt_create_full(cli->tree, "\\", 
+       dnum = smbcli_nt_create_full(cli->tree, "\\", 
                                  0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
                                  NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE, 
                                  NTCREATEX_DISP_OPEN, 
                                  NTCREATEX_OPTIONS_DIRECTORY, 0);
        if (dnum == -1) {
-               printf("directory open failed - %s\n", cli_errstr(cli->tree));
+               printf("directory open failed - %s\n", smbcli_errstr(cli->tree));
        }
-       qfnum = cli_nt_create_full(cli->tree, "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION", 
+       qfnum = smbcli_nt_create_full(cli->tree, "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION", 
                                   NTCREATEX_FLAGS_EXTENDED, 
                                   SEC_RIGHTS_MAXIMUM_ALLOWED, 
                                   0,
@@ -269,7 +269,7 @@ BOOL torture_trans2_scan(int dummy)
                                   NTCREATEX_DISP_OPEN, 
                                   0, 0);
        if (qfnum == -1) {
-               printf("quota open failed - %s\n", cli_errstr(cli->tree));
+               printf("quota open failed - %s\n", smbcli_errstr(cli->tree));
        }
 
        for (op=OP_MIN; op<=OP_MAX; op++) {
@@ -321,7 +321,7 @@ static void nttrans_check_hit(const char *format, int op, int level, NTSTATUS st
 /****************************************************************************
 check for existence of a nttrans call
 ****************************************************************************/
-static NTSTATUS try_nttrans(struct cli_state *cli, 
+static NTSTATUS try_nttrans(struct smbcli_state *cli, 
                            int op,
                            char *param, char *data,
                            int param_len, int data_len,
@@ -363,7 +363,7 @@ static NTSTATUS try_nttrans(struct cli_state *cli,
 }
 
 
-static NTSTATUS try_nttrans_len(struct cli_state *cli, 
+static NTSTATUS try_nttrans_len(struct smbcli_state *cli, 
                             const char *format,
                             int op, int level,
                             char *param, char *data,
@@ -398,7 +398,7 @@ static NTSTATUS try_nttrans_len(struct cli_state *cli,
 /****************************************************************************
 check for existance of a nttrans call
 ****************************************************************************/
-static BOOL scan_nttrans(struct cli_state *cli, int op, int level, 
+static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, 
                        int fnum, int dnum, const char *fname)
 {
        int data_len = 0;
@@ -456,19 +456,19 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
 
        status = try_nttrans_len(cli, "newfile", op, level, param, data, param_len, &data_len, 
                                &rparam_len, &rdata_len);
-       cli_unlink(cli->tree, "\\newfile.dat");
-       cli_rmdir(cli->tree, "\\newfile.dat");
+       smbcli_unlink(cli->tree, "\\newfile.dat");
+       smbcli_rmdir(cli->tree, "\\newfile.dat");
        if (NT_STATUS_IS_OK(status)) return True;
 
        /* try dfs style  */
-       cli_mkdir(cli->tree, "\\testdir");
+       smbcli_mkdir(cli->tree, "\\testdir");
        param_len = 2;
        SSVAL(param, 0, level);
        param_len += push_string(NULL, &param[2], "\\testdir", -1, STR_TERMINATE | STR_UNICODE);
 
        status = try_nttrans_len(cli, "dfs", op, level, param, data, param_len, &data_len, 
                                &rparam_len, &rdata_len);
-       cli_rmdir(cli->tree, "\\testdir");
+       smbcli_rmdir(cli->tree, "\\testdir");
        if (NT_STATUS_IS_OK(status)) return True;
 
        return False;
@@ -477,7 +477,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
 
 BOOL torture_nttrans_scan(int dummy)
 {
-       static struct cli_state *cli;
+       static struct smbcli_state *cli;
        int op, level;
        const char *fname = "\\scanner.dat";
        int fnum, dnum;
@@ -488,9 +488,9 @@ BOOL torture_nttrans_scan(int dummy)
                return False;
        }
 
-       fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, 
+       fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, 
                         DENY_NONE);
-       dnum = cli_open(cli->tree, "\\", O_RDONLY, DENY_NONE);
+       dnum = smbcli_open(cli->tree, "\\", O_RDONLY, DENY_NONE);
 
        for (op=OP_MIN; op<=OP_MAX; op++) {
                printf("Scanning op=%d\n", op);
@@ -517,9 +517,9 @@ BOOL torture_nttrans_scan(int dummy)
 /* scan for valid base SMB requests */
 BOOL torture_smb_scan(int dummy)
 {
-       static struct cli_state *cli;
+       static struct smbcli_state *cli;
        int op;
-       struct cli_request *req;
+       struct smbcli_request *req;
        NTSTATUS status;
 
        for (op=0x0;op<=0xFF;op++) {
@@ -529,30 +529,30 @@ BOOL torture_smb_scan(int dummy)
                        return False;
                }
 
-               req = cli_request_setup(cli->tree, op, 0, 0);
+               req = smbcli_request_setup(cli->tree, op, 0, 0);
 
-               if (!cli_request_send(req)) {
-                       cli_request_destroy(req);
+               if (!smbcli_request_send(req)) {
+                       smbcli_request_destroy(req);
                        break;
                }
 
                usleep(10000);
-               cli_transport_process(cli->transport);
-               if (req->state > CLI_REQUEST_RECV) {
-                       status = cli_request_simple_recv(req);
+               smbcli_transport_process(cli->transport);
+               if (req->state > SMBCLI_REQUEST_RECV) {
+                       status = smbcli_request_simple_recv(req);
                        printf("op=0x%x status=%s\n", op, nt_errstr(status));
                        torture_close_connection(cli);
                        continue;
                }
 
                sleep(1);
-               cli_transport_process(cli->transport);
-               if (req->state > CLI_REQUEST_RECV) {
-                       status = cli_request_simple_recv(req);
+               smbcli_transport_process(cli->transport);
+               if (req->state > SMBCLI_REQUEST_RECV) {
+                       status = smbcli_request_simple_recv(req);
                        printf("op=0x%x status=%s\n", op, nt_errstr(status));
                } else {
                        printf("op=0x%x no reply\n", op);
-                       cli_request_destroy(req);
+                       smbcli_request_destroy(req);
                        continue; /* don't attempt close! */
                }
 
index 08cc4bb9b0cdc0cc4a47f16a3929f03fc4cd3788..f98e1b1b4ad2993be43fccbb659cc6cf12518b06 100644 (file)
@@ -22,7 +22,7 @@
 
 BOOL torture_utable(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        fstring fname;
        const char *alt_name;
        int fnum;
@@ -41,8 +41,8 @@ BOOL torture_utable(int dummy)
 
        memset(valid, 0, sizeof(valid));
 
-       cli_mkdir(cli->tree, "\\utable");
-       cli_unlink(cli->tree, "\\utable\\*");
+       smbcli_mkdir(cli->tree, "\\utable");
+       smbcli_unlink(cli->tree, "\\utable\\*");
 
        for (c=1; c < 0x10000; c++) {
                char *p;
@@ -56,13 +56,13 @@ BOOL torture_utable(int dummy)
                p[len] = 0;
                fstrcat(fname,"_a_long_extension");
 
-               fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, 
+               fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, 
                                DENY_NONE);
                if (fnum == -1) continue;
 
                chars_allowed++;
 
-               cli_qpathinfo_alt_name(cli->tree, fname, &alt_name);
+               smbcli_qpathinfo_alt_name(cli->tree, fname, &alt_name);
 
                if (strncmp(alt_name, "X_A_L", 5) != 0) {
                        alt_allowed++;
@@ -70,8 +70,8 @@ BOOL torture_utable(int dummy)
                        d_printf("fname=[%s] alt_name=[%s]\n", fname, alt_name);
                }
 
-               cli_close(cli->tree, fnum);
-               cli_unlink(cli->tree, fname);
+               smbcli_close(cli->tree, fnum);
+               smbcli_unlink(cli->tree, fname);
 
                if (c % 100 == 0) {
                        printf("%d (%d/%d)\r", c, chars_allowed, alt_allowed);
@@ -79,7 +79,7 @@ BOOL torture_utable(int dummy)
        }
        printf("%d (%d/%d)\n", c, chars_allowed, alt_allowed);
 
-       cli_rmdir(cli->tree, "\\utable");
+       smbcli_rmdir(cli->tree, "\\utable");
 
        d_printf("%d chars allowed   %d alt chars allowed\n", chars_allowed, alt_allowed);
 
@@ -116,7 +116,7 @@ static char *form_name(int c)
 
 BOOL torture_casetable(int dummy)
 {
-       static struct cli_state *cli;
+       static struct smbcli_state *cli;
        char *fname;
        int fnum;
        int c, i;
@@ -132,8 +132,8 @@ BOOL torture_casetable(int dummy)
 
        memset(equiv, 0, sizeof(equiv));
 
-       cli_deltree(cli->tree, "\\utable");
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\utable"))) {
+       smbcli_deltree(cli->tree, "\\utable");
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\utable"))) {
                printf("Failed to create utable directory!\n");
                return False;
        }
@@ -146,7 +146,7 @@ BOOL torture_casetable(int dummy)
                d_printf("%04x (%c)\n", c, isprint(c)?c:'.');
 
                fname = form_name(c);
-               fnum = cli_nt_create_full(cli->tree, fname, 0,
+               fnum = smbcli_nt_create_full(cli->tree, fname, 0,
 #if 0
                                          SEC_RIGHT_MAXIMUM_ALLOWED, 
 #else
@@ -163,7 +163,7 @@ BOOL torture_casetable(int dummy)
 
                size = 0;
 
-               if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, NULL, &size, 
+               if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, NULL, &size, 
                                                   NULL, NULL, NULL, NULL, NULL))) continue;
 
                if (size > 0) {
@@ -173,11 +173,11 @@ BOOL torture_casetable(int dummy)
                        if (size/sizeof(int) >= MAX_EQUIVALENCE) {
                                printf("too many chars match?? size=%d c=0x%04x\n",
                                       size, c);
-                               cli_close(cli->tree, fnum);
+                               smbcli_close(cli->tree, fnum);
                                return False;
                        }
 
-                       cli_read(cli->tree, fnum, (char *)c2, 0, size);
+                       smbcli_read(cli->tree, fnum, (char *)c2, 0, size);
                        printf("%04x: ", c);
                        equiv[c][0] = c;
                        for (i=0; i<size/sizeof(int); i++) {
@@ -188,12 +188,12 @@ BOOL torture_casetable(int dummy)
                        fflush(stdout);
                }
 
-               cli_write(cli->tree, fnum, 0, (char *)&c, size, sizeof(c));
-               cli_close(cli->tree, fnum);
+               smbcli_write(cli->tree, fnum, 0, (char *)&c, size, sizeof(c));
+               smbcli_close(cli->tree, fnum);
        }
 
-       cli_unlink(cli->tree, "\\utable\\*");
-       cli_rmdir(cli->tree, "\\utable");
+       smbcli_unlink(cli->tree, "\\utable\\*");
+       smbcli_rmdir(cli->tree, "\\utable");
 
        return True;
 }
index e45d9f0124f4ba6d4853b4424c420c78ce5f3d16..53dd83ac153250636a829c15781c1002cfe5f393 100644 (file)
@@ -51,7 +51,7 @@ static uint_t num_open_handles;
 /* state information for the servers. We open NINSTANCES connections to
    each server */
 static struct {
-       struct cli_state *cli[NINSTANCES];
+       struct smbcli_state *cli[NINSTANCES];
        char *server_name;
        char *share_name;
        char *username;
@@ -94,8 +94,8 @@ static struct {
 
 #define BAD_HANDLE 0xFFFE
 
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private);
-static void idle_func(struct cli_transport *transport, void *private);
+static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private);
+static void idle_func(struct smbcli_transport *transport, void *private);
 
 /*
   check if a string should be ignored. This is used as the basis
@@ -127,7 +127,7 @@ static BOOL connect_servers_fast(void)
        for (h=0;h<options.max_open_handles;h++) {
                if (!open_handles[h].active) continue;
                for (i=0;i<NSERVERS;i++) {
-                       if (NT_STATUS_IS_ERR((cli_close(servers[i].cli[open_handles[h].instance]->tree,
+                       if (NT_STATUS_IS_ERR((smbcli_close(servers[i].cli[open_handles[h].instance]->tree,
                                       open_handles[h].server_fnum[i])))) {
                                return False;
                        }
@@ -158,8 +158,8 @@ static BOOL connect_servers(void)
        for (i=0;i<NSERVERS;i++) {
                for (j=0;j<NINSTANCES;j++) {
                        if (servers[i].cli[j]) {
-                               cli_tdis(servers[i].cli[j]);
-                               cli_shutdown(servers[i].cli[j]);
+                               smbcli_tdis(servers[i].cli[j]);
+                               smbcli_shutdown(servers[i].cli[j]);
                                servers[i].cli[j] = NULL;
                        }
                }
@@ -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 = cli_full_connection(&servers[i].cli[j],
+                       status = smbcli_full_connection(&servers[i].cli[j],
                                                     "gentest",
                                                     servers[i].server_name, NULL, 
                                                     servers[i].share_name, "?????", 
@@ -184,8 +184,8 @@ static BOOL connect_servers(void)
                                return False;
                        }
 
-                       cli_oplock_handler(servers[i].cli[j]->transport, oplock_handler, NULL);
-                       cli_transport_idle_handler(servers[i].cli[j]->transport, idle_func, 1, NULL);
+                       smbcli_oplock_handler(servers[i].cli[j]->transport, oplock_handler, NULL);
+                       smbcli_transport_idle_handler(servers[i].cli[j]->transport, idle_func, 1, NULL);
                }
        }
 
@@ -234,10 +234,10 @@ static void gen_add_handle(int instance, const char *name, uint16_t fnums[NSERVE
                /* we have to force close a random handle */
                h = random() % options.max_open_handles;
                for (i=0;i<NSERVERS;i++) {
-                       if (NT_STATUS_IS_ERR((cli_close(servers[i].cli[open_handles[h].instance]->tree, 
+                       if (NT_STATUS_IS_ERR((smbcli_close(servers[i].cli[open_handles[h].instance]->tree, 
                                       open_handles[h].server_fnum[i])))) {
                                printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n",
-                                      cli_errstr(servers[i].cli[open_handles[h].instance]->tree));
+                                      smbcli_errstr(servers[i].cli[open_handles[h].instance]->tree));
                        }
                }
                printf("Recovered handle %d\n", h);
@@ -670,13 +670,13 @@ static struct ea_struct gen_ea_struct(void)
 /*
   this is called when a change notify reply comes in
 */
-static void async_notify(struct cli_request *req)
+static void async_notify(struct smbcli_request *req)
 {
        struct smb_notify notify;
        NTSTATUS status;
        int i, j;
        uint16_t tid;
-       struct cli_transport *transport = req->transport;
+       struct smbcli_transport *transport = req->transport;
 
        tid = SVAL(req->in.hdr, HDR_TID);
 
@@ -704,13 +704,13 @@ static void async_notify(struct cli_request *req)
 /*
   the oplock handler will either ack the break or close the file
 */
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
+static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
 {
        union smb_close io;
        NTSTATUS status;
        int i, j;
        BOOL do_close;
-       struct cli_tree *tree = NULL;
+       struct smbcli_tree *tree = NULL;
 
        srandom(current_op.seed);
        do_close = gen_chance(50);
@@ -736,7 +736,7 @@ static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16
 
        if (!do_close) {
                printf("oplock ack fnum=%d\n", fnum);
-               return cli_oplock_ack(tree, fnum, level);
+               return smbcli_oplock_ack(tree, fnum, level);
        }
 
        printf("oplock close fnum=%d\n", fnum);
@@ -758,14 +758,14 @@ static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16
   an operation on another connection blocking until that break is acked
   we check for operations on all transports in the idle function
 */
-static void idle_func(struct cli_transport *transport, void *private)
+static void idle_func(struct smbcli_transport *transport, void *private)
 {
        int i, j;
        for (i=0;i<NSERVERS;i++) {
                for (j=0;j<NINSTANCES;j++) {
                        if (servers[i].cli[j] &&
                            transport != servers[i].cli[j]->transport) {
-                               cli_transport_process(servers[i].cli[j]->transport);
+                               smbcli_transport_process(servers[i].cli[j]->transport);
                        }
                }
        }
@@ -803,7 +803,7 @@ static void check_pending(void)
 
        for (j=0;j<NINSTANCES;j++) {
                for (i=0;i<NSERVERS;i++) {
-                       cli_transport_process(servers[i].cli[j]->transport);
+                       smbcli_transport_process(servers[i].cli[j]->transport);
                }
        }       
 }
@@ -938,7 +938,7 @@ again:
        ZERO_STRUCT(oplocks); \
        ZERO_STRUCT(notifies); \
        for (i=0;i<NSERVERS;i++) { \
-               struct cli_tree *tree = servers[i].cli[instance]->tree; \
+               struct smbcli_tree *tree = servers[i].cli[instance]->tree; \
                status[i] = call; \
        } \
        current_op.status = status[0]; \
@@ -1780,7 +1780,7 @@ static BOOL handler_notify(int instance)
        GEN_SET_FNUM(in.fnum);
 
        for (n=0;n<NSERVERS;n++) {
-               struct cli_request *req;
+               struct smbcli_request *req;
                req = smb_raw_changenotify_send(servers[n].cli[instance]->tree, &parm[n]);
                req->async.fn = async_notify;
        }
@@ -1795,14 +1795,14 @@ static void wipe_files(void)
 {
        int i;
        for (i=0;i<NSERVERS;i++) {
-               int n = cli_deltree(servers[i].cli[0]->tree, "\\gentest");
+               int n = smbcli_deltree(servers[i].cli[0]->tree, "\\gentest");
                if (n == -1) {
                        printf("Failed to wipe tree on server %d\n", i);
                        exit(1);
                }
-               if (NT_STATUS_IS_ERR(cli_mkdir(servers[i].cli[0]->tree, "\\gentest"))) {
+               if (NT_STATUS_IS_ERR(smbcli_mkdir(servers[i].cli[0]->tree, "\\gentest"))) {
                        printf("Failed to create \\gentest - %s\n",
-                              cli_errstr(servers[i].cli[0]->tree));
+                              smbcli_errstr(servers[i].cli[0]->tree));
                        exit(1);
                }
                if (n > 0) {
index 383520260c2a9daf8c177ae71a5fdb414083cd1f..e56684a5a43dc3161c32b3f3879f05679c81f0e5 100644 (file)
@@ -102,9 +102,9 @@ static struct record *recorded;
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct cli_state *connect_one(char *share, int snum)
+static struct smbcli_state *connect_one(char *share, int snum)
 {
-       struct cli_state *c;
+       struct smbcli_state *c;
        fstring server, myname;
        uint_t flags = 0;
        NTSTATUS status;
@@ -119,10 +119,10 @@ static struct cli_state *connect_one(char *share, int snum)
        slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), snum);
 
        if (use_kerberos)
-               flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+               flags |= SMBCLI_FULL_CONNECTION_USE_KERBEROS;
 
        do {
-               status = cli_full_connection(&c, myname,
+               status = smbcli_full_connection(&c, myname,
                                             server, NULL,  
                                             share, "?????", 
                                             username[snum], lp_workgroup(), 
@@ -140,7 +140,7 @@ static struct cli_state *connect_one(char *share, int snum)
 }
 
 
-static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES],
+static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES],
                      char *share[NSERVERS])
 {
        int server, conn, f;
@@ -150,11 +150,11 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS
                if (cli[server][conn]) {
                        for (f=0;f<NFILES;f++) {
                                if (fnum[server][conn][f] != -1) {
-                                       cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
+                                       smbcli_close(cli[server][conn]->tree, fnum[server][conn][f]);
                                        fnum[server][conn][f] = -1;
                                }
                        }
-                       cli_shutdown(cli[server][conn]);
+                       smbcli_shutdown(cli[server][conn]);
                }
                cli[server][conn] = connect_one(share[server], server);
                if (!cli[server][conn]) {
@@ -166,7 +166,7 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS
 
 
 
-static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                     int fnum[NSERVERS][NCONNECTIONS][NFILES],
                     struct record *rec)
 {
@@ -183,10 +183,10 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        case OP_LOCK:
                /* set a lock */
                for (server=0;server<NSERVERS;server++) {
-                       ret[server] = NT_STATUS_IS_OK(cli_lock64(cli[server][conn]->tree, 
+                       ret[server] = NT_STATUS_IS_OK(smbcli_lock64(cli[server][conn]->tree, 
                                                 fnum[server][conn][f],
                                                 start, len, LOCK_TIMEOUT, op));
-                       status[server] = cli_nt_error(cli[server][conn]->tree);
+                       status[server] = smbcli_nt_error(cli[server][conn]->tree);
                        if (!exact_error_codes && 
                            NT_STATUS_EQUAL(status[server], 
                                            NT_STATUS_FILE_LOCK_CONFLICT)) {
@@ -206,10 +206,10 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        case OP_UNLOCK:
                /* unset a lock */
                for (server=0;server<NSERVERS;server++) {
-                       ret[server] = NT_STATUS_IS_OK(cli_unlock64(cli[server][conn]->tree, 
+                       ret[server] = NT_STATUS_IS_OK(smbcli_unlock64(cli[server][conn]->tree, 
                                                   fnum[server][conn][f],
                                                   start, len));
-                       status[server] = cli_nt_error(cli[server][conn]->tree);
+                       status[server] = smbcli_nt_error(cli[server][conn]->tree);
                }
                if (showall || 
                    (!hide_unlock_fails && !NT_STATUS_EQUAL(status[0],status[1]))) {
@@ -225,11 +225,11 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        case OP_REOPEN:
                /* reopen the file */
                for (server=0;server<NSERVERS;server++) {
-                       cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
+                       smbcli_close(cli[server][conn]->tree, fnum[server][conn][f]);
                        fnum[server][conn][f] = -1;
                }
                for (server=0;server<NSERVERS;server++) {
-                       fnum[server][conn][f] = cli_open(cli[server][conn]->tree, FILENAME,
+                       fnum[server][conn][f] = smbcli_open(cli[server][conn]->tree, FILENAME,
                                                         O_RDWR|O_CREAT,
                                                         DENY_NONE);
                        if (fnum[server][conn][f] == -1) {
@@ -247,7 +247,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        return True;
 }
 
-static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static void close_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                        int fnum[NSERVERS][NCONNECTIONS][NFILES])
 {
        int server, conn, f; 
@@ -256,16 +256,16 @@ static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        for (conn=0;conn<NCONNECTIONS;conn++)
        for (f=0;f<NFILES;f++) {
                if (fnum[server][conn][f] != -1) {
-                       cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
+                       smbcli_close(cli[server][conn]->tree, fnum[server][conn][f]);
                        fnum[server][conn][f] = -1;
                }
        }
        for (server=0;server<NSERVERS;server++) {
-               cli_unlink(cli[server][0]->tree, FILENAME);
+               smbcli_unlink(cli[server][0]->tree, FILENAME);
        }
 }
 
-static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static void open_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                       int fnum[NSERVERS][NCONNECTIONS][NFILES])
 {
        int server, conn, f; 
@@ -273,7 +273,7 @@ static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        for (server=0;server<NSERVERS;server++)
        for (conn=0;conn<NCONNECTIONS;conn++)
        for (f=0;f<NFILES;f++) {
-               fnum[server][conn][f] = cli_open(cli[server][conn]->tree, FILENAME,
+               fnum[server][conn][f] = smbcli_open(cli[server][conn]->tree, FILENAME,
                                                 O_RDWR|O_CREAT,
                                                 DENY_NONE);
                if (fnum[server][conn][f] == -1) {
@@ -285,7 +285,7 @@ static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
 }
 
 
-static int retest(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                   int fnum[NSERVERS][NCONNECTIONS][NFILES],
                   int n)
 {
@@ -311,7 +311,7 @@ static int retest(struct cli_state *cli[NSERVERS][NCONNECTIONS],
  */
 static void test_locks(char *share[NSERVERS])
 {
-       struct cli_state *cli[NSERVERS][NCONNECTIONS];
+       struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
        int fnum[NSERVERS][NCONNECTIONS][NFILES];
        int n, i, n1, skip, r1, r2; 
 
index 40227d29979b40b162c1fe1a68d9ae93d8a62ab5..63f71f2004557732bfd3111d0377c1c95f8f4d18 100644 (file)
@@ -60,13 +60,13 @@ struct record {
 
 static struct record *recorded;
 
-static int try_open(struct cli_state *c, char *nfs, int fstype, const char *fname, int flags)
+static int try_open(struct smbcli_state *c, char *nfs, int fstype, const char *fname, int flags)
 {
        pstring path;
 
        switch (fstype) {
        case FSTYPE_SMB:
-               return cli_open(c, fname, flags, DENY_NONE);
+               return smbcli_open(c, fname, flags, DENY_NONE);
 
        case FSTYPE_NFS:
                slprintf(path, sizeof(path), "%s%s", nfs, fname);
@@ -77,11 +77,11 @@ static int try_open(struct cli_state *c, char *nfs, int fstype, const char *fnam
        return -1;
 }
 
-static BOOL try_close(struct cli_state *c, int fstype, int fd)
+static BOOL try_close(struct smbcli_state *c, int fstype, int fd)
 {
        switch (fstype) {
        case FSTYPE_SMB:
-               return cli_close(c, fd);
+               return smbcli_close(c, fd);
 
        case FSTYPE_NFS:
                return close(fd) == 0;
@@ -90,7 +90,7 @@ static BOOL try_close(struct cli_state *c, int fstype, int fd)
        return False;
 }
 
-static BOOL try_lock(struct cli_state *c, int fstype, 
+static BOOL try_lock(struct smbcli_state *c, int fstype, 
                     int fd, uint_t start, uint_t len,
                     enum brl_type op)
 {
@@ -98,7 +98,7 @@ static BOOL try_lock(struct cli_state *c, int fstype,
 
        switch (fstype) {
        case FSTYPE_SMB:
-               return cli_lock(c, fd, start, len, LOCK_TIMEOUT, op);
+               return smbcli_lock(c, fd, start, len, LOCK_TIMEOUT, op);
 
        case FSTYPE_NFS:
                lock.l_type = (op==READ_LOCK) ? F_RDLCK:F_WRLCK;
@@ -112,14 +112,14 @@ static BOOL try_lock(struct cli_state *c, int fstype,
        return False;
 }
 
-static BOOL try_unlock(struct cli_state *c, int fstype, 
+static BOOL try_unlock(struct smbcli_state *c, int fstype, 
                       int fd, uint_t start, uint_t len)
 {
        struct flock lock;
 
        switch (fstype) {
        case FSTYPE_SMB:
-               return cli_unlock(c, fd, start, len);
+               return smbcli_unlock(c, fd, start, len);
 
        case FSTYPE_NFS:
                lock.l_type = F_UNLCK;
@@ -147,9 +147,9 @@ static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid,
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct cli_state *connect_one(char *share)
+static struct smbcli_state *connect_one(char *share)
 {
-       struct cli_state *c;
+       struct smbcli_state *c;
        char *server_n;
        fstring server;
        fstring myname;
@@ -173,12 +173,12 @@ static struct cli_state *connect_one(char *share)
 
        slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
 
-       nt_status = cli_full_connection(&c, myname, server_n, NULL, 0, share, "?????", 
+       nt_status = smbcli_full_connection(&c, myname, server_n, NULL, 0, share, "?????", 
                                        username, lp_workgroup(), password, 0,
                                        NULL);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
-               DEBUG(0, ("cli_full_connection failed with error %s\n", nt_errstr(nt_status)));
+               DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
                return NULL;
        }
 
@@ -188,7 +188,7 @@ static struct cli_state *connect_one(char *share)
 }
 
 
-static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                      char *nfs[NSERVERS], 
                      int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
                      char *share1, char *share2)
@@ -204,10 +204,10 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        for (conn=0;conn<NCONNECTIONS;conn++) {
                if (cli[server][conn]) {
                        for (f=0;f<NFILES;f++) {
-                               cli_close(cli[server][conn], fnum[server][fstype][conn][f]);
+                               smbcli_close(cli[server][conn], fnum[server][fstype][conn][f]);
                        }
-                       cli_ulogoff(cli[server][conn]);
-                       cli_shutdown(cli[server][conn]);
+                       smbcli_ulogoff(cli[server][conn]);
+                       smbcli_shutdown(cli[server][conn]);
                }
                cli[server][conn] = connect_one(share[server]);
                if (!cli[server][conn]) {
@@ -219,7 +219,7 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS],
 
 
 
-static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                     char *nfs[NSERVERS],
                     int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
                     struct record *rec)
@@ -292,7 +292,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        return True;
 }
 
-static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static void close_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                        char *nfs[NSERVERS],
                        int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES])
 {
@@ -308,11 +308,11 @@ static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
                }
        }
        for (server=0;server<NSERVERS;server++) {
-               cli_unlink(cli[server][0], FILENAME);
+               smbcli_unlink(cli[server][0], FILENAME);
        }
 }
 
-static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static void open_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                       char *nfs[NSERVERS],
                       int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES])
 {
@@ -333,7 +333,7 @@ static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
 }
 
 
-static int retest(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], 
                  char *nfs[NSERVERS],
                  int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
                  int n)
@@ -360,7 +360,7 @@ static int retest(struct cli_state *cli[NSERVERS][NCONNECTIONS],
  */
 static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2)
 {
-       struct cli_state *cli[NSERVERS][NCONNECTIONS];
+       struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
        char *nfs[NSERVERS];
        int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES];
        int n, i, n1; 
index 6a511d8b49ab99d15912ab42fc3cc4753b01e268..4c219c630e9a5f1ee65929de3c31038a8967220b 100644 (file)
@@ -123,7 +123,7 @@ static int ms_fnmatch_lanman(const char *pattern, const char *string)
        return ms_fnmatch_lanman_core(pattern, string);
 }
 
-static BOOL reg_match_one(struct cli_state *cli, const char *pattern, const char *file)
+static BOOL reg_match_one(struct smbcli_state *cli, const char *pattern, const char *file)
 {
        /* oh what a weird world this is */
        if (old_list && strcmp(pattern, "*.*") == 0) return True;
@@ -139,7 +139,7 @@ static BOOL reg_match_one(struct cli_state *cli, const char *pattern, const char
        return ms_fnmatch(pattern, file, cli->transport->negotiate.protocol)==0;
 }
 
-static char *reg_test(struct cli_state *cli, char *pattern, char *long_name, char *short_name)
+static char *reg_test(struct smbcli_state *cli, char *pattern, char *long_name, char *short_name)
 {
        static fstring ret;
        fstrcpy(ret, "---");
@@ -157,9 +157,9 @@ static char *reg_test(struct cli_state *cli, char *pattern, char *long_name, cha
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct cli_state *connect_one(char *share)
+static struct smbcli_state *connect_one(char *share)
 {
-       struct cli_state *c;
+       struct smbcli_state *c;
        fstring server;
        uint_t flags = 0;
        NTSTATUS status;
@@ -170,7 +170,7 @@ static struct cli_state *connect_one(char *share)
        *share = 0;
        share++;
 
-       status = cli_full_connection(&c, "masktest",
+       status = smbcli_full_connection(&c, "masktest",
                                     server, NULL, 
                                     share, "?????", 
                                     username, lp_workgroup(), 
@@ -204,7 +204,7 @@ static void listfn(file_info *f, const char *s, void *state)
        f_info_hit = True;
 }
 
-static void get_real_name(struct cli_state *cli, 
+static void get_real_name(struct smbcli_state *cli, 
                          pstring long_name, fstring short_name)
 {
        const char *mask;
@@ -216,7 +216,7 @@ static void get_real_name(struct cli_state *cli,
 
        f_info_hit = False;
 
-       cli_list_new(cli->tree, mask, 
+       smbcli_list_new(cli->tree, mask, 
                     FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY, 
                     listfn, NULL);
 
@@ -232,7 +232,7 @@ static void get_real_name(struct cli_state *cli,
        }
 }
 
-static void testpair(struct cli_state *cli, char *mask, char *file)
+static void testpair(struct smbcli_state *cli, char *mask, char *file)
 {
        int fnum;
        fstring res1;
@@ -245,18 +245,18 @@ static void testpair(struct cli_state *cli, char *mask, char *file)
 
        fstrcpy(res1, "---");
 
-       fnum = cli_open(cli->tree, file, O_CREAT|O_TRUNC|O_RDWR, 0);
+       fnum = smbcli_open(cli->tree, file, O_CREAT|O_TRUNC|O_RDWR, 0);
        if (fnum == -1) {
                DEBUG(0,("Can't create %s\n", file));
                return;
        }
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        resultp = res1;
        fstrcpy(short_name, "");
        get_real_name(cli, long_name, short_name);
        fstrcpy(res1, "---");
-       cli_list(cli->tree, mask, 
+       smbcli_list(cli->tree, mask, 
                 FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY, 
                 listfn, NULL);
 
@@ -268,22 +268,22 @@ static void testpair(struct cli_state *cli, char *mask, char *file)
                if (die_on_error) exit(1);
        }
 
-       cli_unlink(cli->tree, file);
+       smbcli_unlink(cli->tree, file);
 
        if (count % 100 == 0) DEBUG(0,("%d\n", count));
 }
 
 static void test_mask(int argc, char *argv[], 
-                     struct cli_state *cli)
+                     struct smbcli_state *cli)
 {
        pstring mask, file;
        int l1, l2, i, l;
        int mc_len = strlen(maskchars);
        int fc_len = strlen(filechars);
 
-       cli_mkdir(cli->tree, "\\masktest");
+       smbcli_mkdir(cli->tree, "\\masktest");
 
-       cli_unlink(cli->tree, "\\masktest\\*");
+       smbcli_unlink(cli->tree, "\\masktest\\*");
 
        if (argc >= 2) {
                while (argc >= 2) {
@@ -326,7 +326,7 @@ static void test_mask(int argc, char *argv[],
        }
 
  finished:
-       cli_rmdir(cli->tree, "\\masktest");
+       smbcli_rmdir(cli->tree, "\\masktest");
 }
 
 
@@ -361,7 +361,7 @@ static void usage(void)
  int main(int argc,char *argv[])
 {
        char *share;
-       struct cli_state *cli;  
+       struct smbcli_state *cli;       
        int opt;
        char *p;
        int seed;
index 30291a829e0b075a19170a9fe8a108bf7ad18669..316e87ce9949c2f425bf337e4b9ba66b64ec032d 100644 (file)
@@ -28,7 +28,7 @@ static const char *loadfile;
 #define ival(s) strtol(s, NULL, 0)
 
 /* run a test that simulates an approximate netbench client load */
-static BOOL run_netbench(struct cli_state *cli, int client)
+static BOOL run_netbench(struct smbcli_state *cli, int client)
 {
        int i;
        pstring line;
@@ -164,7 +164,7 @@ BOOL torture_nbench(int dummy)
 {
        BOOL correct = True;
        extern int torture_nprocs;
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        const char *p;
 
        p = lp_parm_string(-1, "torture", "timelimit");
index a7a82027a393cab7b548b25a25f401295fed1cb4..9b6ec7943d43c0b9be7642dd72e124eb7d06a9ed 100644 (file)
@@ -138,18 +138,18 @@ static int find_handle(int handle)
 
 
 
-static struct cli_state *c;
+static struct smbcli_state *c;
 
 /*
   a handler function for oplock break requests
 */
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
+static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
 {
-       struct cli_tree *tree = private;
-       return cli_oplock_ack(tree, fnum, level);
+       struct smbcli_tree *tree = private;
+       return smbcli_oplock_ack(tree, fnum, level);
 }
 
-void nb_setup(struct cli_state *cli, int id, int warmupt)
+void nb_setup(struct smbcli_state *cli, int id, int warmupt)
 {
        warmup = warmupt;
        nbio_id = id;
@@ -162,7 +162,7 @@ void nb_setup(struct cli_state *cli, int id, int warmupt)
                printf("skipping I/O\n");
 
        if (cli) {
-               cli_oplock_handler(cli->transport, oplock_handler, cli->tree);
+               smbcli_oplock_handler(cli->transport, oplock_handler, cli->tree);
        }
 }
 
@@ -560,7 +560,7 @@ void nb_qfsinfo(int level, NTSTATUS status)
        TALLOC_CTX *mem_ctx;
        NTSTATUS ret;
 
-       mem_ctx = talloc_init("cli_dskattr");
+       mem_ctx = talloc_init("smbcli_dskattr");
 
        io.generic.level = level;
        ret = smb_raw_fsinfo(c->tree, mem_ctx, &io);
@@ -582,7 +582,7 @@ void nb_findfirst(const char *mask, int level, int maxcnt, int count, NTSTATUS s
        TALLOC_CTX *mem_ctx;
        NTSTATUS ret;
 
-       mem_ctx = talloc_init("cli_dskattr");
+       mem_ctx = talloc_init("smbcli_dskattr");
 
        io.t2ffirst.level = level;
        io.t2ffirst.in.max_count = maxcnt;
@@ -630,14 +630,14 @@ void nb_deltree(const char *dname)
                free(f);
        }
 
-       total_deleted = cli_deltree(c->tree, dname);
+       total_deleted = smbcli_deltree(c->tree, dname);
 
        if (total_deleted == -1) {
                printf("Failed to cleanup tree %s - exiting\n", dname);
                exit(1);
        }
 
-       cli_rmdir(c->tree, dname);
+       smbcli_rmdir(c->tree, dname);
 }
 
 void nb_cleanup(const char *cname)
@@ -646,6 +646,6 @@ void nb_cleanup(const char *cname)
        asprintf(&dname, "\\clients\\%s", cname);
        nb_deltree(dname);
        free(dname);
-       cli_rmdir(c->tree, "clients");
+       smbcli_rmdir(c->tree, "clients");
        children[nbio_id].done = 1;
 }
index 2ed069fd61f69fb25cd6e9bd282aab217e23f599..0a5ef6d34e275d96dbdf91a076a5a60f759fbe9d 100644 (file)
@@ -155,7 +155,7 @@ static NTSTATUS rap_pull_string(TALLOC_CTX *mem_ctx, struct ndr_pull *ndr,
        return NT_STATUS_OK;
 }
 
-static NTSTATUS rap_cli_do_call(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+static NTSTATUS rap_cli_do_call(struct smbcli_state *cli, TALLOC_CTX *mem_ctx,
                                struct rap_call *call)
 {
        NTSTATUS result;
@@ -212,7 +212,7 @@ static NTSTATUS rap_cli_do_call(struct cli_state *cli, TALLOC_CTX *mem_ctx,
                                goto done; \
                         } while (0)
 
-static NTSTATUS cli_rap_netshareenum(struct cli_state *cli,
+static NTSTATUS smbcli_rap_netshareenum(struct smbcli_state *cli,
                                     TALLOC_CTX *mem_ctx,
                                     struct rap_NetShareEnum *r)
 {
@@ -282,7 +282,7 @@ static NTSTATUS cli_rap_netshareenum(struct cli_state *cli,
        return result;
 }
 
-static BOOL test_netshareenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_netshareenum(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        struct rap_NetShareEnum r;
        int i;
@@ -290,7 +290,7 @@ static BOOL test_netshareenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        r.in.level = 1;
        r.in.bufsize = 8192;
 
-       if (!NT_STATUS_IS_OK(cli_rap_netshareenum(cli, mem_ctx, &r)))
+       if (!NT_STATUS_IS_OK(smbcli_rap_netshareenum(cli, mem_ctx, &r)))
                return False;
 
        for (i=0; i<r.out.count; i++) {
@@ -302,7 +302,7 @@ static BOOL test_netshareenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        return True;
 }
 
-static NTSTATUS cli_rap_netserverenum2(struct cli_state *cli,
+static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_state *cli,
                                       TALLOC_CTX *mem_ctx,
                                       struct rap_NetServerEnum2 *r)
 {
@@ -377,7 +377,7 @@ static NTSTATUS cli_rap_netserverenum2(struct cli_state *cli,
        return result;
 }
 
-static BOOL test_netserverenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_netserverenum(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        struct rap_NetServerEnum2 r;
        int i;
@@ -388,7 +388,7 @@ static BOOL test_netserverenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        r.in.servertype = 0x80000000;
        r.in.domain = NULL;
 
-       if (!NT_STATUS_IS_OK(cli_rap_netserverenum2(cli, mem_ctx, &r)))
+       if (!NT_STATUS_IS_OK(smbcli_rap_netserverenum2(cli, mem_ctx, &r)))
                return False;
 
        for (i=0; i<r.out.count; i++) {
@@ -409,7 +409,7 @@ static BOOL test_netserverenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
 
 
-static BOOL test_rap(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_rap(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        BOOL res = True;
 
@@ -424,7 +424,7 @@ static BOOL test_rap(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
 BOOL torture_raw_rap(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index 4b063bfa484d001335e7dd20925e7d5533664c7a..b5f03dd3a1d97e7badf5bd540ce2051a4bf2c75d 100644 (file)
@@ -31,7 +31,7 @@
        }} while (0)
 
 
-static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        struct smb_chkpath io;
        NTSTATUS status;
@@ -49,7 +49,7 @@ static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\test.txt");
        if (fnum == -1) {
-               printf("failed to open test.txt - %s\n", cli_errstr(cli->tree));
+               printf("failed to open test.txt - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -126,7 +126,7 @@ static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        return ret;
 }
 
@@ -135,7 +135,7 @@ done:
 */
 BOOL torture_raw_chkpath(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        int fnum;
        TALLOC_CTX *mem_ctx;
@@ -146,33 +146,33 @@ BOOL torture_raw_chkpath(int dummy)
 
        mem_ctx = talloc_init("torture_raw_chkpath");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1) {
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
                printf("Failed to clean " BASEDIR "\n");
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR "\\nt"))) {
-               printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt"))) {
+               printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR "\\nt\\Visual Studio"))) {
-               printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt\\Visual Studio"))) {
+               printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR "\\nt\\Visual Studio\\VB98"))) {
-               printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt\\Visual Studio\\VB98"))) {
+               printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
        fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\nt\\Visual Studio\\VB98\\vb6.exe");
        if (fnum == -1) {
-               printf("failed to open \\nt\\Visual Studio\\VB98\\vb6.exe - %s\n", cli_errstr(cli->tree));
+               printf("failed to open \\nt\\Visual Studio\\VB98\\vb6.exe - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -184,7 +184,7 @@ BOOL torture_raw_chkpath(int dummy)
  done:
 
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
 
        torture_close_connection(cli);
        talloc_destroy(mem_ctx);
index e2221946a07ed48cbe13552daad94beb5886b054..1007226ded9294fde31aeb8a454077ad2688d25f 100644 (file)
@@ -25,7 +25,7 @@
 */
 BOOL torture_raw_close(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
        union smb_close io;
@@ -100,7 +100,7 @@ BOOL torture_raw_close(int dummy)
        }
            
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        REOPEN;
 
        finfo2.generic.in.fname = fname;
@@ -137,7 +137,7 @@ BOOL torture_raw_close(int dummy)
        CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
 
        printf("testing flush\n");
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        io_flush.in.fnum = fnum;
        status = smb_raw_flush(cli->tree, &io_flush);
@@ -162,8 +162,8 @@ BOOL torture_raw_close(int dummy)
        
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
        torture_close_connection(cli);
        talloc_destroy(mem_ctx);
        return ret;
index 29aa915b5dbb6e84ff8eee3aff4c122462fc1072..763edffeb21a16d56f94cf2e66c62ae854440127 100644 (file)
 /*
   test session ops
 */
-static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        NTSTATUS status;
        BOOL ret = True;
        char *username, *domain, *password;
-       struct cli_session *session;
-       struct cli_tree *tree;
+       struct smbcli_session *session;
+       struct smbcli_tree *tree;
        union smb_sesssetup setup;
        union smb_open io;
        union smb_write wr;
@@ -59,9 +59,9 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("TESTING SESSION HANDLING\n");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -70,7 +70,7 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        domain = lp_workgroup();
 
        printf("create a second security context on the same transport\n");
-       session = cli_session_init(cli->transport);
+       session = smbcli_session_init(cli->transport);
        setup.generic.level = RAW_SESSSETUP_GENERIC;
        setup.generic.in.sesskey = cli->transport->negotiate.sesskey;
        setup.generic.in.capabilities = 0; /* ignored in secondary session setup */
@@ -84,7 +84,7 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        session->vuid = setup.generic.out.vuid;
 
        printf("use the same tree as the existing connection\n");
-       tree = cli_tree_init(session);
+       tree = smbcli_tree_init(session);
        tree->tid = cli->tree->tid;
        cli->tree->reference_count++;
 
@@ -141,7 +141,7 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        /* close down the new tree, which will also close the session
           as the reference count will be 0 */
-       cli_tree_close(tree);
+       smbcli_tree_close(tree);
        
 done:
        return ret;
@@ -151,12 +151,12 @@ done:
 /*
   test tree ops
 */
-static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        NTSTATUS status;
        BOOL ret = True;
        char *share;
-       struct cli_tree *tree;
+       struct smbcli_tree *tree;
        union smb_tcon tcon;
        union smb_open io;
        union smb_write wr;
@@ -167,16 +167,16 @@ static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("TESTING TREE HANDLING\n");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        share = lp_parm_string(-1, "torture", "share");
 
        printf("create a second tree context on the same session\n");
-       tree = cli_tree_init(cli->session);
+       tree = smbcli_tree_init(cli->session);
 
        tcon.generic.level = RAW_TCON_TCONX;
        tcon.tconx.in.flags = 0;
@@ -245,7 +245,7 @@ static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
 
        /* close down the new tree */
-       cli_tree_close(tree);
+       smbcli_tree_close(tree);
        
 done:
        return ret;
@@ -255,7 +255,7 @@ done:
 /*
   test pid ops
 */
-static BOOL test_pid(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_pid(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        NTSTATUS status;
        BOOL ret = True;
@@ -269,9 +269,9 @@ static BOOL test_pid(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("TESTING PID HANDLING\n");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -357,7 +357,7 @@ done:
 */
 BOOL torture_raw_context(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
@@ -380,7 +380,7 @@ BOOL torture_raw_context(int dummy)
        }
 
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
 
        torture_close_connection(cli);
        talloc_destroy(mem_ctx);
index 4fd296d8115a3c66e6fd50753d09d2a90747109b..f7ce954c941369578a250ffe9e48eb4286a9d239 100644 (file)
@@ -33,7 +33,7 @@
 
 
 /* test some ioctls */
-static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ioctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_ioctl ctl;
        int fnum;
@@ -45,7 +45,7 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        fnum = create_complex_file(cli, mem_ctx, fname);
        if (fnum == -1) {
-               printf("Failed to create test.dat - %s\n", cli_errstr(cli->tree));
+               printf("Failed to create test.dat - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -64,12 +64,12 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        return ret;
 }
 
 /* test some filesystem control functions */
-static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        int fnum;
        NTSTATUS status;
@@ -81,7 +81,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        fnum = create_complex_file(cli, mem_ctx, fname);
        if (fnum == -1) {
-               printf("Failed to create test.dat - %s\n", cli_errstr(cli->tree));
+               printf("Failed to create test.dat - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -114,7 +114,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 #endif
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        return ret;
 }
 
@@ -123,7 +123,7 @@ done:
 */
 BOOL torture_raw_ioctl(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
@@ -133,12 +133,12 @@ BOOL torture_raw_ioctl(int dummy)
 
        mem_ctx = talloc_init("torture_raw_ioctl");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1) {
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
                printf("Failed to clean " BASEDIR "\n");
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -151,7 +151,7 @@ BOOL torture_raw_ioctl(int dummy)
        }
 
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
 
        torture_close_connection(cli);
        talloc_destroy(mem_ctx);
index 9a9b8415681fb57f62423f77fe0d74bc7658f399..a076f62152f1116a2c4e6b8921d51e4ded97484b 100644 (file)
@@ -42,7 +42,7 @@
 /*
   test SMBlock and SMBunlock ops
 */
-static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_lock io;
        NTSTATUS status;
@@ -50,18 +50,18 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        int fnum;
        const char *fname = BASEDIR "\\test.txt";
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_LOCK_LOCK\n");
        io.generic.level = RAW_LOCK_LOCK;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -133,9 +133,9 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -143,7 +143,7 @@ done:
 /*
   test locking&X ops
 */
-static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_lockx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_lock io;
        struct smb_lock_entry lock[1];
@@ -152,18 +152,18 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        int fnum;
        const char *fname = BASEDIR "\\test.txt";
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_LOCK_LOCKX\n");
        io.generic.level = RAW_LOCK_LOCKX;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -182,9 +182,9 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -192,7 +192,7 @@ done:
 /*
   test high pid
 */
-static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_pidhigh(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_lock io;
        struct smb_lock_entry lock[1];
@@ -202,9 +202,9 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        const char *fname = BASEDIR "\\test.txt";
        char c = 1;
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -213,15 +213,15 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        cli->session->pid = 1;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
 
-       if (cli_write(cli->tree, fnum, 0, &c, 0, 1) != 1) {
-               printf("Failed to write 1 byte - %s\n", cli_errstr(cli->tree));
+       if (smbcli_write(cli->tree, fnum, 0, &c, 0, 1) != 1) {
+               printf("Failed to write 1 byte - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -239,8 +239,8 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_lock(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
 
-       if (cli_read(cli->tree, fnum, &c, 0, 1) != 1) {
-               printf("Failed to read 1 byte - %s\n", cli_errstr(cli->tree));
+       if (smbcli_read(cli->tree, fnum, &c, 0, 1) != 1) {
+               printf("Failed to read 1 byte - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -249,7 +249,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        cli->session->pid = 2;
 
-       if (cli_read(cli->tree, fnum, &c, 0, 1) == 1) {
+       if (smbcli_read(cli->tree, fnum, &c, 0, 1) == 1) {
                printf("pid is incorrect handled for read with lock!\n");
                ret = False;
                goto done;
@@ -257,7 +257,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        cli->session->pid = 0x10001;
 
-       if (cli_read(cli->tree, fnum, &c, 0, 1) != 1) {
+       if (smbcli_read(cli->tree, fnum, &c, 0, 1) != 1) {
                printf("High pid is used on this server!\n");
                ret = False;
        } else {
@@ -265,9 +265,9 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        }
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -277,7 +277,7 @@ done:
 */
 BOOL torture_raw_lock(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index b614800106ad28ac63b2e8ee476defb4c53760d0..bc2ddbb5446a107947e71c1a1d644fd20f3f21d0 100644 (file)
@@ -31,7 +31,7 @@
 /*
   test mkdir ops
 */
-static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_mkdir md;
        struct smb_rmdir rd;
@@ -40,8 +40,8 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        BOOL ret = True;
 
        /* cleanup */
-       cli_rmdir(cli->tree, path);
-       cli_unlink(cli->tree, path);
+       smbcli_rmdir(cli->tree, path);
+       smbcli_unlink(cli->tree, path);
 
        /* 
           basic mkdir
@@ -69,7 +69,7 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        printf("testing mkdir collision with file\n");
 
        /* name collision with a file */
-       cli_close(cli->tree, create_complex_file(cli, mem_ctx, path));
+       smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, path));
        status = smb_raw_mkdir(cli->tree, &md);
        CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
 
@@ -79,7 +79,7 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_rmdir(cli->tree, &rd);
        CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY);
 
-       cli_unlink(cli->tree, path);
+       smbcli_unlink(cli->tree, path);
 
        printf("testing invalid dir\n");
 
@@ -110,8 +110,8 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
 
 done:
-       cli_rmdir(cli->tree, path);
-       cli_unlink(cli->tree, path);
+       smbcli_rmdir(cli->tree, path);
+       smbcli_unlink(cli->tree, path);
        return ret;
 }
 
@@ -121,7 +121,7 @@ done:
 */
 BOOL torture_raw_mkdir(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index 8b3bcc12e3b75db91fc2a2f8c25cdd33371d3d6e..1554206455dc97a2555408ab4964e4ec30d267de 100644 (file)
 /*
   test the delayed reply to a open that leads to a sharing violation
 */
-static BOOL test_mux_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mux_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
        NTSTATUS status;
        int fnum;
        BOOL ret = True;
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        printf("testing multiplexed open/open/close\n");
 
@@ -74,13 +74,13 @@ static BOOL test_mux_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        req = smb_raw_open_send(cli->tree, &io);
        
        /* and close the file */
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        /* see if the async open succeeded */
        status = smb_raw_open_recv(req, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
 
-       cli_close(cli->tree, io.ntcreatex.out.fnum);
+       smbcli_close(cli->tree, io.ntcreatex.out.fnum);
 
 done:
        return ret;
@@ -90,19 +90,19 @@ done:
 /*
   test a write that hits a byte range lock and send the close after the write
 */
-static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_write io;
        NTSTATUS status;
        int fnum;
        BOOL ret = True;
-       struct cli_request *req;
+       struct smbcli_request *req;
 
        printf("testing multiplexed lock/write/close\n");
 
-       fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("open failed in mux_write - %s\n", cli_errstr(cli->tree));
+               printf("open failed in mux_write - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -110,8 +110,8 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        cli->session->pid = 1;
 
        /* lock a range */
-       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK))) {
-               printf("lock failed in mux_write - %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK))) {
+               printf("lock failed in mux_write - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -130,13 +130,13 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        /* unlock the range */
        cli->session->pid = 1;
-       cli_unlock(cli->tree, fnum, 0, 4);
+       smbcli_unlock(cli->tree, fnum, 0, 4);
 
        /* and recv the async write reply */
        status = smb_raw_write_recv(req, &io);
        CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
 
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
 done:
        return ret;
@@ -146,20 +146,20 @@ done:
 /*
   test a lock that conflicts with an existing lock
 */
-static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mux_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_lock io;
        NTSTATUS status;
        int fnum;
        BOOL ret = True;
-       struct cli_request *req;
+       struct smbcli_request *req;
        struct smb_lock_entry lock[1];
 
        printf("TESTING MULTIPLEXED LOCK/LOCK/UNLOCK\n");
 
-       fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("open failed in mux_write - %s\n", cli_errstr(cli->tree));
+               printf("open failed in mux_write - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -197,12 +197,12 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("recv the async reply\n");
-       status = cli_request_simple_recv(req);
+       status = smbcli_request_simple_recv(req);
        CHECK_STATUS(status, NT_STATUS_OK);     
 
        printf("reopening with an exit\n");
        smb_raw_exit(cli->session);
-       fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
 
        printf("Now trying with a cancel\n");
 
@@ -237,10 +237,10 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_lock(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
 
-       status = cli_request_simple_recv(req);
+       status = smbcli_request_simple_recv(req);
        CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);     
 
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
 done:
        return ret;
@@ -253,7 +253,7 @@ done:
 */
 BOOL torture_raw_mux(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
                
@@ -264,14 +264,14 @@ BOOL torture_raw_mux(int dummy)
        mem_ctx = talloc_init("torture_raw_mux");
 
        /* cleanup */
-       if (cli_deltree(cli->tree, BASEDIR) == -1) {
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
                printf("Failed to cleanup " BASEDIR "\n");
                ret = False;
                goto done;
        }
 
 
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
                printf("Failed to create %s\n", BASEDIR);
                ret = False;
                goto done;
@@ -291,7 +291,7 @@ BOOL torture_raw_mux(int dummy)
 
 done:
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        torture_close_connection(cli);
        talloc_destroy(mem_ctx);
        return ret;
index b94474aa43c16e3d4f84466627a8e022860e26eb..6e7cf218ea8c153cdda247aa4366ad9b479837c7 100644 (file)
 */
 BOOL torture_raw_notify(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
        struct smb_notify notify;
        union smb_open io;
        int fnum = -1;
-       struct cli_request *req;
+       struct smbcli_request *req;
                
        if (!torture_open_connection(&cli)) {
                return False;
@@ -68,7 +68,7 @@ BOOL torture_raw_notify(int dummy)
        mem_ctx = talloc_init("torture_raw_notify");
 
        /* cleanup */
-       if (cli_deltree(cli->tree, BASEDIR) == -1) {
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
                printf("Failed to cleanup " BASEDIR "\n");
                ret = False;
                goto done;
@@ -103,7 +103,7 @@ BOOL torture_raw_notify(int dummy)
        printf("testing notify mkdir\n");
 
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       cli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
        CHECK_STATUS(status, NT_STATUS_OK);
@@ -115,7 +115,7 @@ BOOL torture_raw_notify(int dummy)
        printf("testing notify rmdir\n");
 
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       cli_rmdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
        CHECK_STATUS(status, NT_STATUS_OK);
@@ -127,13 +127,13 @@ BOOL torture_raw_notify(int dummy)
 
        req = smb_raw_changenotify_send(cli->tree, &notify);
        smb_raw_ntcancel(req);
-       cli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
        status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
        CHECK_STATUS(status, NT_STATUS_CANCELLED);
 
 done:
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        torture_close_connection(cli);
        talloc_destroy(mem_ctx);
        return ret;
index 8a4e09374bab8ae7ac6c8896583722e59069ef59..8cdc18fe2f0e397b969561df28aa772f814d9a02 100644 (file)
@@ -28,11 +28,11 @@ enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR};
 /*
   check if a open file can be read/written
 */
-static enum rdwr_mode check_rdwr(struct cli_tree *tree, int fnum)
+static enum rdwr_mode check_rdwr(struct smbcli_tree *tree, int fnum)
 {
        char c = 1;
-       BOOL can_read  = (cli_read(tree, fnum, &c, 0, 1) == 1);
-       BOOL can_write = (cli_write(tree, fnum, 0, &c, 0, 1) == 1);
+       BOOL can_read  = (smbcli_read(tree, fnum, &c, 0, 1) == 1);
+       BOOL can_write = (smbcli_write(tree, fnum, 0, &c, 0, 1) == 1);
        if ( can_read &&  can_write) return RDWR_RDWR;
        if ( can_read && !can_write) return RDWR_RDONLY;
        if (!can_read &&  can_write) return RDWR_WRONLY;
@@ -64,7 +64,7 @@ static const char *rdwr_string(enum rdwr_mode m)
 #define CREATE_FILE do { \
        fnum = create_complex_file(cli, mem_ctx, fname); \
        if (fnum == -1) { \
-               printf("(%d) Failed to create %s - %s\n", __LINE__, fname, cli_errstr(cli->tree)); \
+               printf("(%d) Failed to create %s - %s\n", __LINE__, fname, smbcli_errstr(cli->tree)); \
                ret = False; \
                goto done; \
        }} while (0)
@@ -144,7 +144,7 @@ static const char *rdwr_string(enum rdwr_mode m)
 /*
   test RAW_OPEN_OPEN
 */
-static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
        union smb_fileinfo finfo;
@@ -163,9 +163,9 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
        fnum = io.open.out.fnum;
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        CREATE_FILE;
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
@@ -176,8 +176,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
        fnum2 = io.open.out.fnum;
        CHECK_RDWR(fnum2, RDWR_RDWR);
-       cli_close(cli->tree, fnum2);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum2);
+       smbcli_close(cli->tree, fnum);
 
        /* check the read/write modes */
        io.open.level = RAW_OPEN_OPEN;
@@ -189,21 +189,21 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
        fnum = io.open.out.fnum;
        CHECK_RDWR(fnum, RDWR_RDONLY);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        io.open.in.flags = OPEN_FLAGS_OPEN_WRITE;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
        fnum = io.open.out.fnum;
        CHECK_RDWR(fnum, RDWR_WRONLY);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        io.open.in.flags = OPEN_FLAGS_OPEN_RDWR;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
        fnum = io.open.out.fnum;
        CHECK_RDWR(fnum, RDWR_RDWR);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        /* check the share modes roughly - not a complete matrix */
        io.open.in.flags = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_WRITE;
@@ -226,8 +226,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
        fnum2 = io.open.out.fnum;
        CHECK_RDWR(fnum2, RDWR_RDONLY);
-       cli_close(cli->tree, fnum);
-       cli_close(cli->tree, fnum2);
+       smbcli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum2);
 
 
        /* check the returned write time */
@@ -245,8 +245,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_ALL_INFO(io.open.out.attrib, attrib);
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        return ret;
 }
@@ -255,7 +255,7 @@ done:
 /*
   test RAW_OPEN_OPENX
 */
-static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
        union smb_fileinfo finfo;
@@ -284,7 +284,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        };
 
        printf("Checking RAW_OPEN_OPENX\n");
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        io.openx.level = RAW_OPEN_OPENX;
        io.openx.in.fname = fname;
@@ -301,11 +301,11 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                if (open_funcs[i].with_file) {
                        fnum = create_complex_file(cli, mem_ctx, fname);
                        if (fnum == -1) {
-                               d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
+                               d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
                                ret = False;
                                goto done;
                        }
-                       cli_close(cli->tree, fnum);
+                       smbcli_close(cli->tree, fnum);
                }
                io.openx.in.open_func = open_funcs[i].open_func;
                status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -316,8 +316,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                        ret = False;
                }
                if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
-                       cli_close(cli->tree, io.openx.out.fnum);
-                       cli_unlink(cli->tree, fname);
+                       smbcli_close(cli->tree, io.openx.out.fnum);
+                       smbcli_unlink(cli->tree, fname);
                }
        }
 
@@ -336,8 +336,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(io.openx.out.ftype, 0);
        CHECK_VAL(io.openx.out.devstate, 0);
        CHECK_VAL(io.openx.out.action, OPENX_ACTION_CREATED);
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        /* check the fields when the file already existed */
        fnum2 = create_complex_file(cli, mem_ctx, fname);
@@ -345,7 +345,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                ret = False;
                goto done;
        }
-       cli_close(cli->tree, fnum2);
+       smbcli_close(cli->tree, fnum2);
 
        io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -357,7 +357,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(io.openx.out.action, OPENX_ACTION_EXISTED);
        CHECK_VAL(io.openx.out.unknown, 0);
        CHECK_ALL_INFO(io.openx.out.attrib, attrib);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        /* now check the search attrib for hidden files - win2003 ignores this? */
        SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
@@ -366,15 +366,15 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        io.openx.in.search_attrs = FILE_ATTRIBUTE_HIDDEN;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
-       cli_close(cli->tree, io.openx.out.fnum);
+       smbcli_close(cli->tree, io.openx.out.fnum);
 
        io.openx.in.search_attrs = 0;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
-       cli_close(cli->tree, io.openx.out.fnum);
+       smbcli_close(cli->tree, io.openx.out.fnum);
 
        SET_ATTRIB(FILE_ATTRIBUTE_NORMAL);
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        /* and check attrib on create */
        io.openx.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
@@ -383,8 +383,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, attrib);
-       cli_close(cli->tree, io.openx.out.fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, io.openx.out.fnum);
+       smbcli_unlink(cli->tree, fname);
 
        /* check timeout on create - win2003 ignores the timeout! */
        io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
@@ -404,8 +404,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                       __LINE__, (int)end_timer());
                ret = False;
        }
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        /* now this is a really weird one - open for execute implies create?! */
        io.openx.in.fname = fname;
@@ -419,7 +419,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        io.openx.in.timeout = 0;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
-       cli_close(cli->tree, io.openx.out.fnum);
+       smbcli_close(cli->tree, io.openx.out.fnum);
 
        /* check the extended return flag */
        io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO | OPENX_FLAGS_EXTENDED_RETURN;
@@ -427,11 +427,11 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_VAL(io.openx.out.access_mask, STD_RIGHT_ALL_ACCESS);
-       cli_close(cli->tree, io.openx.out.fnum);
+       smbcli_close(cli->tree, io.openx.out.fnum);
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        return ret;
 }
@@ -444,7 +444,7 @@ done:
   is why you see all the ACCESS_DENIED results below. When we finally work this out then this
   test will make more sense
 */
-static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
        union smb_fileinfo finfo;
@@ -496,11 +496,11 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                if (open_funcs[i].with_file) {
                        fnum = create_complex_file(cli, mem_ctx, fname);
                        if (fnum == -1) {
-                               d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
+                               d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
                                ret = False;
                                goto done;
                        }
-                       cli_close(cli->tree, fnum);
+                       smbcli_close(cli->tree, fnum);
                }
                io.t2open.in.open_func = open_funcs[i].open_func;
                status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -511,14 +511,14 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                        ret = False;
                }
                if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
-                       cli_close(cli->tree, io.t2open.out.fnum);
-                       cli_unlink(cli->tree, fname);
+                       smbcli_close(cli->tree, io.t2open.out.fnum);
+                       smbcli_unlink(cli->tree, fname);
                }
        }
 
        /* check the basic return fields */
        fnum = create_complex_file(cli, mem_ctx, fname);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
@@ -531,7 +531,7 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(io.t2open.out.ftype, 0);
        CHECK_VAL(io.t2open.out.devstate, 0);
        CHECK_VAL(io.t2open.out.action, OPENX_ACTION_EXISTED);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        /* now check the search attrib for hidden files - win2003 ignores this? */
        SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
@@ -539,14 +539,14 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
-       cli_close(cli->tree, io.t2open.out.fnum);
+       smbcli_close(cli->tree, io.t2open.out.fnum);
 
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
-       cli_close(cli->tree, io.t2open.out.fnum);
+       smbcli_close(cli->tree, io.t2open.out.fnum);
 
        SET_ATTRIB(FILE_ATTRIBUTE_NORMAL);
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        /* and check attrib on create */
        io.t2open.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
@@ -562,8 +562,8 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        return ret;
 }
@@ -572,7 +572,7 @@ done:
 /*
   test RAW_OPEN_NTCREATEX
 */
-static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
        union smb_fileinfo finfo;
@@ -622,13 +622,13 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        /* test the open disposition */
        for (i=0; i<ARRAY_SIZE(open_funcs); i++) {
                if (open_funcs[i].with_file) {
-                       fnum = cli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
+                       fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
                        if (fnum == -1) {
-                               d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
+                               d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
                                ret = False;
                                goto done;
                        }
-                       cli_close(cli->tree, fnum);
+                       smbcli_close(cli->tree, fnum);
                }
                io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
                status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -639,8 +639,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                        ret = False;
                }
                if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
-                       cli_close(cli->tree, io.ntcreatex.out.fnum);
-                       cli_unlink(cli->tree, fname);
+                       smbcli_close(cli->tree, io.ntcreatex.out.fnum);
+                       smbcli_unlink(cli->tree, fname);
                }
        }
 
@@ -664,14 +664,14 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
 
        /* check fields when the file already existed */
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
        fnum = create_complex_file(cli, mem_ctx, fname);
        if (fnum == -1) {
                ret = False;
                goto done;
        }
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -689,8 +689,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_ALL_INFO(io.ntcreatex.out.size, size);
        CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
        CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
 
        /* create a directory */
@@ -704,8 +704,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        io.ntcreatex.in.fname = dname;
        fname = dname;
 
-       cli_rmdir(cli->tree, fname);
-       cli_unlink(cli->tree, fname);
+       smbcli_rmdir(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        io.ntcreatex.in.access_mask = SEC_RIGHT_MAXIMUM_ALLOWED;
        io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -730,12 +730,12 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(io.ntcreatex.out.size, 0);
        CHECK_VAL(io.ntcreatex.out.alloc_size, 0);
        CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
        
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        return ret;
 }
@@ -748,7 +748,7 @@ done:
   open_disposition==NTCREATEX_DISP_OVERWRITE_IF. Windows 2003 allows the
   second open.
 */
-static BOOL test_ntcreatex_brlocked(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io, io1;
        union smb_lock io2;
@@ -808,16 +808,16 @@ static BOOL test_ntcreatex_brlocked(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
 
  done:
-       cli_close(cli->tree, io.ntcreatex.out.fnum);
-       cli_close(cli->tree, io1.ntcreatex.out.fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, io.ntcreatex.out.fnum);
+       smbcli_close(cli->tree, io1.ntcreatex.out.fnum);
+       smbcli_unlink(cli->tree, fname);
        return ret;
 }
 
 /*
   test RAW_OPEN_MKNEW
 */
-static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
        const char *fname = BASEDIR "\\torture_mknew.txt";
@@ -840,8 +840,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
 
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        /* make sure write_time works */
        io.mknew.in.write_time = basetime;
@@ -850,8 +850,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        fnum = io.mknew.out.fnum;
        CHECK_TIME(basetime, write_time);
 
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        /* make sure file_attrs works */
        io.mknew.in.attrib = FILE_ATTRIBUTE_HIDDEN;
@@ -861,8 +861,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib);
        
 done:
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        return ret;
 }
@@ -871,7 +871,7 @@ done:
 /*
   test RAW_OPEN_CREATE
 */
-static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
        const char *fname = BASEDIR "\\torture_create.txt";
@@ -894,9 +894,9 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
 
-       cli_close(cli->tree, io.create.out.fnum);
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, io.create.out.fnum);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        /* make sure write_time works */
        io.create.in.write_time = basetime;
@@ -905,8 +905,8 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        fnum = io.create.out.fnum;
        CHECK_TIME(basetime, write_time);
 
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        /* make sure file_attrs works */
        io.create.in.attrib = FILE_ATTRIBUTE_HIDDEN;
@@ -916,8 +916,8 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib);
        
 done:
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        return ret;
 }
@@ -926,7 +926,7 @@ done:
 /*
   test RAW_OPEN_CTEMP
 */
-static BOOL test_ctemp(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
        NTSTATUS status;
@@ -959,9 +959,9 @@ static BOOL test_ctemp(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_TIME(basetime, write_time);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        if (fname) {
-               cli_unlink(cli->tree, fname);
+               smbcli_unlink(cli->tree, fname);
        }
 
        return ret;
@@ -971,7 +971,7 @@ done:
 */
 BOOL torture_raw_open(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
@@ -981,12 +981,12 @@ BOOL torture_raw_open(int dummy)
 
        mem_ctx = talloc_init("torture_raw_open");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1) {
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
                printf("Failed to clean " BASEDIR "\n");
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -1023,7 +1023,7 @@ BOOL torture_raw_open(int dummy)
        }
 
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
 
        torture_close_connection(cli);
        talloc_destroy(mem_ctx);
index 6d6953354b31d6de5a82b933344b84a8276b0a17..4b531a6950f6642b0c9682e260b065a385feaf33 100644 (file)
@@ -45,26 +45,26 @@ static struct {
 /*
   a handler function for oplock break requests
 */
-static BOOL oplock_handler_ack(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
+static BOOL oplock_handler_ack(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
 {
-       struct cli_tree *tree = private;
+       struct smbcli_tree *tree = private;
        break_info.fnum = fnum;
        break_info.level = level;
        break_info.count++;
 
        printf("Acking in oplock handler\n");
 
-       return cli_oplock_ack(tree, fnum, level);
+       return smbcli_oplock_ack(tree, fnum, level);
 }
 
 /*
   a handler function for oplock break requests - close the file
 */
-static BOOL oplock_handler_close(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
+static BOOL oplock_handler_close(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
 {
        union smb_close io;
        NTSTATUS status;
-       struct cli_tree *tree = private;
+       struct smbcli_tree *tree = private;
 
        break_info.fnum = fnum;
        break_info.level = level;
@@ -87,7 +87,7 @@ static BOOL oplock_handler_close(struct cli_transport *transport, uint16_t tid,
 /*
   test oplock ops
 */
-static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_oplock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        const char *fname = "\\test_oplock.dat";
        NTSTATUS status;
@@ -98,9 +98,9 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        uint16_t fnum=0, fnum2=0;
 
        /* cleanup */
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
-       cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+       smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
 
        /*
          base ntcreatex parms
@@ -133,7 +133,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
        CHECK_VAL(break_info.count, 0);
 
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        /*
          with a batch oplock we get a break
@@ -159,11 +159,11 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(break_info.count, 1);
 
 
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        printf("if we close on break then the unlink can succeed\n");
        ZERO_STRUCT(break_info);
-       cli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
+       smbcli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
                NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
@@ -184,8 +184,8 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("a self read should not cause a break\n");
        ZERO_STRUCT(break_info);
-       cli_close(cli->tree, fnum);
-       cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+       smbcli_close(cli->tree, fnum);
+       smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
 
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
@@ -207,8 +207,8 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("a 2nd open should give a break\n");
        ZERO_STRUCT(break_info);
-       cli_close(cli->tree, fnum);
-       cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+       smbcli_close(cli->tree, fnum);
+       smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
 
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
@@ -230,8 +230,8 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("a 2nd open should get an oplock when we close instead of ack\n");
        ZERO_STRUCT(break_info);
-       cli_close(cli->tree, fnum);
-       cli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
+       smbcli_close(cli->tree, fnum);
+       smbcli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
 
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
@@ -255,11 +255,11 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(break_info.fnum, fnum2);
        CHECK_VAL(break_info.level, 1);
        
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        printf("open with batch oplock\n");
        ZERO_STRUCT(break_info);
-       cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+       smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
 
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
@@ -284,9 +284,9 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(break_info.fnum, 0);
        CHECK_VAL(break_info.level, 0);
 
-       cli_close(cli->tree, fnum);
-       cli_close(cli->tree, fnum2);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum2);
+       smbcli_unlink(cli->tree, fname);
 
        printf("open with attributes only can create file\n");
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
@@ -302,7 +302,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        printf("Subsequent normal open should break oplock on attribute only open to level II\n");
 
        ZERO_STRUCT(break_info);
-       cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+       smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
 
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
@@ -317,9 +317,9 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_close(cli->tree, fnum2);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum2);
+       smbcli_unlink(cli->tree, fname);
        return ret;
 }
 
@@ -329,7 +329,7 @@ done:
 */
 BOOL torture_raw_oplock(int dummy)
 {
-       struct cli_state *cli1;
+       struct smbcli_state *cli1;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index 4bade0f6e25774566262f5cfe3bafbcce236792c..251a2de85d208ec5322a48dbd7f6280139caf813 100644 (file)
@@ -149,7 +149,7 @@ static union smb_fileinfo *fname_find(const char *name)
 */
 BOOL torture_raw_qfileinfo(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int i;
        BOOL ret = True;
        int count;
@@ -171,7 +171,7 @@ BOOL torture_raw_qfileinfo(int dummy)
 
        fnum = create_complex_file(cli, mem_ctx, fname);
        if (fnum == -1) {
-               printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -552,8 +552,8 @@ BOOL torture_raw_qfileinfo(int dummy)
        NAME_CHECK("ALT_NAME_INFORMATION", alt_name_info, fname, STR_UNICODE);
 
        /* and make sure we can open by alternate name */
-       cli_close(cli->tree, fnum);
-       fnum = cli_nt_create_full(cli->tree, correct_name, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, 
+       smbcli_close(cli->tree, fnum);
+       fnum = smbcli_nt_create_full(cli->tree, correct_name, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, 
                                  FILE_ATTRIBUTE_NORMAL,
                                  NTCREATEX_SHARE_ACCESS_DELETE|
                                  NTCREATEX_SHARE_ACCESS_READ|
@@ -561,7 +561,7 @@ BOOL torture_raw_qfileinfo(int dummy)
                                  NTCREATEX_DISP_OVERWRITE_IF, 
                                  0, 0);
        if (fnum == -1) {
-               printf("Unable to open by alt_name - %s\n", cli_errstr(cli->tree));
+               printf("Unable to open by alt_name - %s\n", smbcli_errstr(cli->tree));
                ret = False;
        }
 
@@ -704,8 +704,8 @@ BOOL torture_raw_qfileinfo(int dummy)
        
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        torture_close_connection(cli);
        talloc_destroy(mem_ctx);
index 775755ddcb5e0793ff0e654b7e11631a9899cb26..41bc09f94e8cd95bb63276ec90c2cc275d3c5ede 100644 (file)
@@ -109,7 +109,7 @@ static union smb_fsinfo *find(const char *name)
 */
 BOOL torture_raw_qfsinfo(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int i;
        BOOL ret = True;
        int count;
index 5fba3f1b31ba182ff08d94e4ff5461baace3b7b7..afec805cd497bb8b243b0d6c9bc559816d66245e 100644 (file)
@@ -76,7 +76,7 @@ static BOOL check_buffer(char *buf, uint_t seed, int len, int line)
 /*
   test read ops
 */
-static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_read(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_read io;
        NTSTATUS status;
@@ -90,18 +90,18 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        buf = talloc_zero(mem_ctx, maxsize);
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_READ_READ\n");
        io.generic.level = RAW_READ_READ;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -129,7 +129,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
        io.read.in.fnum = fnum;
 
-       cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
+       smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
 
        printf("Trying small read\n");
        io.read.in.fnum = fnum;
@@ -165,7 +165,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.read.out.nread, 0);
 
        setup_buffer(buf, seed, maxsize);
-       cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
+       smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
        memset(buf, 0, maxsize);
 
        printf("Trying large read\n");
@@ -178,7 +178,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -192,9 +192,9 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -202,7 +202,7 @@ done:
 /*
   test lockread ops
 */
-static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_lockread(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_read io;
        NTSTATUS status;
@@ -216,18 +216,18 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        buf = talloc_zero(mem_ctx, maxsize);
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_READ_LOCKREAD\n");
        io.generic.level = RAW_READ_LOCKREAD;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -260,7 +260,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
        io.lockread.in.fnum = fnum;
 
-       cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
+       smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
 
        printf("Trying small read\n");
        io.lockread.in.fnum = fnum;
@@ -270,7 +270,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_read(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
 
-       cli_unlock(cli->tree, fnum, 0, 1);
+       smbcli_unlock(cli->tree, fnum, 0, 1);
 
        status = smb_raw_read(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
@@ -286,7 +286,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        io.lockread.in.count = strlen(test_data);
        status = smb_raw_read(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-       cli_unlock(cli->tree, fnum, 0, strlen(test_data));
+       smbcli_unlock(cli->tree, fnum, 0, strlen(test_data));
        status = smb_raw_read(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
 
@@ -305,7 +305,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.lockread.out.nread, 0);
 
        setup_buffer(buf, seed, maxsize);
-       cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
+       smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
        memset(buf, 0, maxsize);
 
        printf("Trying large read\n");
@@ -313,16 +313,16 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        io.lockread.in.count = ~0;
        status = smb_raw_read(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-       cli_unlock(cli->tree, fnum, 1, strlen(test_data));
+       smbcli_unlock(cli->tree, fnum, 1, strlen(test_data));
        status = smb_raw_read(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_BUFFER(buf, seed, io.lockread.out.nread);
-       cli_unlock(cli->tree, fnum, 0, 0xFFFF);
+       smbcli_unlock(cli->tree, fnum, 0, 0xFFFF);
 
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -336,8 +336,8 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_close(cli->tree, fnum);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -345,7 +345,7 @@ done:
 /*
   test readx ops
 */
-static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_readx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_read io;
        NTSTATUS status;
@@ -359,17 +359,17 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        buf = talloc_zero(mem_ctx, maxsize);
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_READ_READX\n");
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -404,7 +404,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
        io.readx.in.fnum = fnum;
 
-       cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
+       smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
 
        printf("Trying small read\n");
        io.readx.in.fnum = fnum;
@@ -449,7 +449,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.readx.out.compaction_mode, 0);
 
        setup_buffer(buf, seed, maxsize);
-       cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
+       smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
        memset(buf, 0, maxsize);
 
        printf("Trying large read\n");
@@ -489,7 +489,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -510,7 +510,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_VALUE(io.readx.out.nread, 0);
 
-       if (NT_STATUS_IS_ERR(cli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_ERR(smbcli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -521,8 +521,8 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.readx.out.nread, 0);
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_close(cli->tree, fnum);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -530,7 +530,7 @@ done:
 /*
   test readbraw ops
 */
-static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_readbraw(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_read io;
        NTSTATUS status;
@@ -544,17 +544,17 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        buf = talloc_zero(mem_ctx, maxsize);
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_READ_READBRAW\n");
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -586,7 +586,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.readbraw.out.nread, 0);
        io.readbraw.in.fnum = fnum;
 
-       cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
+       smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
 
        printf("Trying small read\n");
        io.readbraw.in.fnum = fnum;
@@ -624,7 +624,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.readbraw.out.nread, 0);
 
        setup_buffer(buf, seed, maxsize);
-       cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
+       smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
        memset(buf, 0, maxsize);
 
        printf("Trying large read\n");
@@ -658,7 +658,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -692,8 +692,8 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.readbraw.out.nread, 0);
 
 done:
-       cli_close(cli->tree, fnum);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_close(cli->tree, fnum);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -703,7 +703,7 @@ done:
 */
 BOOL torture_raw_read(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index 98a6ce5fdea33e5fbbb6d7903b290fcbdccdd6a4..e75d9d0fc70a1707d2e2184490508662047d4c8d 100644 (file)
@@ -40,7 +40,7 @@
 /*
   test SMBmv ops
 */
-static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_rename io;
        NTSTATUS status;
@@ -51,9 +51,9 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Testing SMBmv\n");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -118,9 +118,9 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -129,7 +129,7 @@ done:
 /*
   test SMBntrename ops
 */
-static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_rename io;
        NTSTATUS status;
@@ -141,9 +141,9 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Testing SMBntrename\n");
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -222,7 +222,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
 
-       cli_unlink(cli->tree, fname2);
+       smbcli_unlink(cli->tree, fname2);
 
        finfo.generic.in.fname = fname1;
        status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
@@ -254,7 +254,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
 
-       cli_unlink(cli->tree, fname2);
+       smbcli_unlink(cli->tree, fname2);
 
        finfo.generic.in.fname = fname1;
        status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
@@ -303,15 +303,15 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 #if 0
        {
                char buf[16384];
-               fnum = cli_open(cli->tree, fname1, O_RDWR, DENY_NONE);
+               fnum = smbcli_open(cli->tree, fname1, O_RDWR, DENY_NONE);
                memset(buf, 1, sizeof(buf));
-               cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
-               cli_close(cli->tree, fnum);
+               smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
+               smbcli_close(cli->tree, fnum);
 
-               fnum = cli_open(cli->tree, fname2, O_RDWR, DENY_NONE);
+               fnum = smbcli_open(cli->tree, fname2, O_RDWR, DENY_NONE);
                memset(buf, 1, sizeof(buf));
-               cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf)-1);
-               cli_close(cli->tree, fnum);
+               smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf)-1);
+               smbcli_close(cli->tree, fnum);
 
                torture_all_info(cli->tree, fname1);
                torture_all_info(cli->tree, fname2);
@@ -353,7 +353,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        
 done:
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -363,7 +363,7 @@ done:
 */
 BOOL torture_raw_rename(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index 698f405fb4b45855b120b6f2b1ca0f14c2b3615f..55dd732e6aaee6a83d5c019d68437b230bdb7e92 100644 (file)
@@ -38,7 +38,7 @@ static BOOL single_search_callback(void *private, union smb_search_data *file)
 /*
   do a single file (non-wildcard) search 
 */
-static NTSTATUS single_search(struct cli_state *cli, 
+static NTSTATUS single_search(struct smbcli_state *cli, 
                              TALLOC_CTX *mem_ctx,
                              const char *pattern,
                              enum smb_search_level level,
@@ -102,7 +102,7 @@ static union smb_search_data *find(const char *name)
 /* 
    basic testing of all RAW_SEARCH_* calls using a single file
 */
-static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        BOOL ret = True;
        int fnum;
@@ -116,7 +116,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        fnum = create_complex_file(cli, mem_ctx, fname);
        if (fnum == -1) {
-               printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -356,7 +356,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
 done:
        smb_raw_exit(cli->session);
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        return ret;
 }
@@ -391,7 +391,7 @@ enum continue_type {CONT_FLAGS, CONT_NAME, CONT_RESUME_KEY};
 /*
   do a single file (non-wildcard) search 
 */
-static NTSTATUS multiple_search(struct cli_state *cli, 
+static NTSTATUS multiple_search(struct smbcli_state *cli, 
                                TALLOC_CTX *mem_ctx,
                                const char *pattern,
                                enum smb_search_level level,
@@ -539,7 +539,7 @@ static int search_old_compare(union smb_search_data *d1, union smb_search_data *
 /* 
    basic testing of search calls using many files
 */
-static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        const int num_files = 700;
        int i, fnum, t;
@@ -568,9 +568,9 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                {"SEARCH",              "ID",    RAW_SEARCH_SEARCH,              CONT_RESUME_KEY}
        };
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 || 
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 || 
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -578,14 +578,14 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        for (i=0;i<num_files;i++) {
                asprintf(&fname, BASEDIR "\\t%03d-%d.txt", i, i);
-               fnum = cli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
+               fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
                if (fnum == -1) {
-                       printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+                       printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                        ret = False;
                        goto done;
                }
                free(fname);
-               cli_close(cli->tree, fnum);
+               smbcli_close(cli->tree, fnum);
        }
 
 
@@ -645,7 +645,7 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
 done:
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
 
        return ret;
 }
@@ -656,7 +656,7 @@ done:
 */
 BOOL torture_raw_search(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index 89528c72ad7e9ac7ab56065d91b17557fb8aeae8..b78efc0da4dca0ef3ad72c5605d6309b8a319b6f 100644 (file)
@@ -41,7 +41,7 @@
 /*
   test seek ops
 */
-static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        struct smb_seek io;
        union smb_fileinfo finfo;
@@ -52,15 +52,15 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        const char *fname = BASEDIR "\\test.txt";
        char c[2];
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to open test.txt - %s\n", cli_errstr(cli->tree));
+               printf("Failed to open test.txt - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -138,8 +138,8 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("trying write to update offset\n");
        ZERO_STRUCT(c);
-       if (cli_write(cli->tree, fnum, 0, c, 0, 2) != 2) {
-               printf("Write failed - %s\n", cli_errstr(cli->tree));
+       if (smbcli_write(cli->tree, fnum, 0, c, 0, 2) != 2) {
+               printf("Write failed - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;              
        }
@@ -158,8 +158,8 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_VALUE(io.out.offset, 2);
        
-       if (cli_read(cli->tree, fnum, c, 0, 1) != 1) {
-               printf("Read failed - %s\n", cli_errstr(cli->tree));
+       if (smbcli_read(cli->tree, fnum, c, 0, 1) != 1) {
+               printf("Read failed - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;              
        }
@@ -176,9 +176,9 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.out.offset, 1);
 
        printf("Testing position information\n");
-       fnum2 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+       fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
        if (fnum2 == -1) {
-               printf("2nd open failed - %s\n", cli_errstr(cli->tree));
+               printf("2nd open failed - %s\n", smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -223,7 +223,7 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
 done:
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -233,7 +233,7 @@ done:
 */
 BOOL torture_raw_seek(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index fb2e0633e86f00905261ee430b377d386ed01d0f..2f86a322619c66a5fd66a78d2f575de0b03eae70 100644 (file)
@@ -28,7 +28,7 @@
 */
 BOOL torture_raw_sfileinfo(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
        int fnum_saved, d_fnum, fnum2, fnum = -1;
@@ -55,22 +55,22 @@ BOOL torture_raw_sfileinfo(int dummy)
 
        mem_ctx = talloc_init("torture_sfileinfo");
 
-       cli_deltree(cli->tree, BASEDIR);
-       cli_mkdir(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_mkdir(cli->tree, BASEDIR);
 
 #define RECREATE_FILE(fname) do { \
-       if (fnum != -1) cli_close(cli->tree, fnum); \
+       if (fnum != -1) smbcli_close(cli->tree, fnum); \
        fnum = create_complex_file(cli, mem_ctx, fname); \
        if (fnum == -1) { \
                printf("(%d) ERROR: open of %s failed (%s)\n", \
-                      __LINE__, fname, cli_errstr(cli->tree)); \
+                      __LINE__, fname, smbcli_errstr(cli->tree)); \
                ret = False; \
                goto done; \
        }} while (0)
 
 #define RECREATE_BOTH do { \
                RECREATE_FILE(path_fname); \
-               cli_close(cli->tree, fnum); \
+               smbcli_close(cli->tree, fnum); \
                RECREATE_FILE(fnum_fname); \
        } while (0)
 
@@ -408,8 +408,8 @@ BOOL torture_raw_sfileinfo(int dummy)
        CHECK_VALUE(MODE_INFORMATION, mode_information, mode, 0);
 #if 1
        printf("finally the rename_information level\n");
-       cli_close(cli->tree, create_complex_file(cli, mem_ctx, fnum_fname_new));
-       cli_close(cli->tree, create_complex_file(cli, mem_ctx, path_fname_new));
+       smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, fnum_fname_new));
+       smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, path_fname_new));
 
        sfinfo.rename_information.in.overwrite = 0;
        sfinfo.rename_information.in.root_fid  = 0;
@@ -444,7 +444,7 @@ BOOL torture_raw_sfileinfo(int dummy)
        printf("Trying rename with dest file open and delete_on_close\n");
        CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_ACCESS_DENIED);
 
-       cli_close(cli->tree, fnum2);
+       smbcli_close(cli->tree, fnum2);
        CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
        CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname);
 
@@ -459,7 +459,7 @@ BOOL torture_raw_sfileinfo(int dummy)
        sfinfo.rename_information.in.overwrite = 0;
        CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
        CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname_new);
-       cli_close(cli->tree, fnum2);
+       smbcli_close(cli->tree, fnum2);
 
        sfinfo.rename_information.in.new_name  = fnum_fname+strlen(BASEDIR)+1;
        sfinfo.rename_information.in.overwrite = 0;
@@ -499,12 +499,12 @@ BOOL torture_raw_sfileinfo(int dummy)
 
 done:
        smb_raw_exit(cli->session);
-       cli_close(cli->tree, fnum);
-       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fnum_fname))) {
-               printf("Failed to delete %s - %s\n", fnum_fname, cli_errstr(cli->tree));
+       smbcli_close(cli->tree, fnum);
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fnum_fname))) {
+               printf("Failed to delete %s - %s\n", fnum_fname, smbcli_errstr(cli->tree));
        }
-       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, path_fname))) {
-               printf("Failed to delete %s - %s\n", path_fname, cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, path_fname))) {
+               printf("Failed to delete %s - %s\n", path_fname, smbcli_errstr(cli->tree));
        }
 
        torture_close_connection(cli);
@@ -518,7 +518,7 @@ done:
 */
 BOOL torture_raw_sfileinfo_bug(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        TALLOC_CTX *mem_ctx;
        const char *fname = "\\bug3.txt";
        union smb_setfileinfo sfinfo;
@@ -537,7 +537,7 @@ BOOL torture_raw_sfileinfo_bug(int dummy)
        mem_ctx = talloc_init("torture_sfileinfo");
 
        fnum = create_complex_file(cli, mem_ctx, fname);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        sfinfo.generic.level = RAW_SFILEINFO_STANDARD;
        sfinfo.generic.file.fname = fname;
index f4598bc1d7ff482db5b3902f05118314b78e81ba..0d2f36f37c524516135f33c1b42206f0f60fdd83 100644 (file)
 /*
   test unlink ops
 */
-static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_unlink(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        struct smb_unlink io;
        NTSTATUS status;
        BOOL ret = True;
        const char *fname = BASEDIR "\\test.txt";
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -52,7 +52,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_unlink(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
 
-       cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
+       smbcli_close(cli->tree, smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
 
        io.in.pattern = fname;
        io.in.attrib = 0;
@@ -60,7 +60,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying a hidden file\n");
-       cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
+       smbcli_close(cli->tree, smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
        torture_set_file_attribute(cli->tree, fname, FILE_ATTRIBUTE_HIDDEN);
 
        io.in.pattern = fname;
@@ -101,7 +101,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_FILE_IS_A_DIRECTORY);
 
        printf("Trying wildcards\n");
-       cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
+       smbcli_close(cli->tree, smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
        io.in.pattern = BASEDIR "\\t*.t";
        io.in.attrib = 0;
        status = smb_raw_unlink(cli->tree, &io);
@@ -128,7 +128,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
 done:
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -138,7 +138,7 @@ done:
 */
 BOOL torture_raw_unlink(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index 8873ca5ae82e710f012bf248de4e1650e2d9a4d2..77c73a42b40fe8da66ea5d349d0474e38066ce72 100644 (file)
@@ -89,7 +89,7 @@ static BOOL check_buffer(char *buf, uint_t seed, int len, int line)
 /*
   test write ops
 */
-static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_write io;
        NTSTATUS status;
@@ -103,18 +103,18 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        buf = talloc_zero(mem_ctx, maxsize);
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_WRITE_WRITE\n");
        io.generic.level = RAW_WRITE_WRITE;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -140,7 +140,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.write.out.nwritten, io.write.in.count);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -159,7 +159,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.write.out.nwritten, 4000);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -190,7 +190,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_ALL_INFO(io.write.in.count + (uint64_t)io.write.in.offset, size);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, io.write.in.offset, 4000) != 4000) {
+       if (smbcli_read(cli->tree, fnum, buf, io.write.in.offset, 4000) != 4000) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -198,9 +198,9 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_BUFFER(buf, seed, 4000);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -208,7 +208,7 @@ done:
 /*
   test writex ops
 */
-static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_writex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_write io;
        NTSTATUS status;
@@ -222,18 +222,18 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        buf = talloc_zero(mem_ctx, maxsize);
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_WRITE_WRITEX\n");
        io.generic.level = RAW_WRITE_WRITEX;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -260,7 +260,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.writex.out.nwritten, io.writex.in.count);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -279,7 +279,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.writex.out.nwritten, 4000);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -312,7 +312,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -340,7 +340,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_ALL_INFO(io.writex.in.count + (uint64_t)io.writex.in.offset, size);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
+       if (smbcli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -360,7 +360,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
                CHECK_ALL_INFO(io.writex.in.count + (uint64_t)io.writex.in.offset, size);
 
                memset(buf, 0, maxsize);
-               if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
+               if (smbcli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
                        printf("read failed at %d\n", __LINE__);
                        ret = False;
                        goto done;
@@ -372,9 +372,9 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        setup_buffer(buf, seed, maxsize);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -382,7 +382,7 @@ done:
 /*
   test write unlock ops
 */
-static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_writeunlock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_write io;
        NTSTATUS status;
@@ -396,18 +396,18 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        buf = talloc_zero(mem_ctx, maxsize);
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_WRITE_WRITEUNLOCK\n");
        io.generic.level = RAW_WRITE_WRITEUNLOCK;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -430,7 +430,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        io.writeunlock.in.data = buf;
        status = smb_raw_write(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
-       if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -439,14 +439,14 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(IVAL(buf,0), 0);
 
        setup_buffer(buf, seed, maxsize);
-       cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count, 
+       smbcli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count, 
                 0, WRITE_LOCK);
        status = smb_raw_write(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_VALUE(io.writeunlock.out.nwritten, io.writeunlock.in.count);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -460,7 +460,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        io.writeunlock.in.count = 4000;
        io.writeunlock.in.offset = 0;
        io.writeunlock.in.data = buf;
-       cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count, 
+       smbcli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count, 
                 0, WRITE_LOCK);
        status = smb_raw_write(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
@@ -470,7 +470,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -495,7 +495,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        io.writeunlock.in.count = 4000;
        io.writeunlock.in.offset = 0xFFFFFFFF - 2000;
        io.writeunlock.in.data = buf;
-       cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count, 
+       smbcli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count, 
                 0, WRITE_LOCK);
        status = smb_raw_write(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
@@ -503,7 +503,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_ALL_INFO(io.writeunlock.in.count + (uint64_t)io.writeunlock.in.offset, size);
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
+       if (smbcli_read(cli->tree, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -511,9 +511,9 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_BUFFER(buf, seed, 4000);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -521,7 +521,7 @@ done:
 /*
   test write close ops
 */
-static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_writeclose(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_write io;
        NTSTATUS status;
@@ -535,18 +535,18 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        buf = talloc_zero(mem_ctx, maxsize);
 
-       if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
-               printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+           NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+               printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Testing RAW_WRITE_WRITECLOSE\n");
        io.generic.level = RAW_WRITE_WRITECLOSE;
        
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum == -1) {
-               printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+               printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
                ret = False;
                goto done;
        }
@@ -577,10 +577,10 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_write(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
 
-       fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
        io.writeclose.in.fnum = fnum;
 
-       if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -593,11 +593,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_VALUE(io.writeclose.out.nwritten, io.writeclose.in.count);
 
-       fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
        io.writeclose.in.fnum = fnum;
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -618,11 +618,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        status = smb_raw_write(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
 
-       fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
        io.writeclose.in.fnum = fnum;
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
+       if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -652,11 +652,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_VALUE(io.writeclose.out.nwritten, 4000);
        CHECK_ALL_INFO(io.writeclose.in.count + (uint64_t)io.writeclose.in.offset, size);
 
-       fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
        io.writeclose.in.fnum = fnum;
 
        memset(buf, 0, maxsize);
-       if (cli_read(cli->tree, fnum, buf, io.writeclose.in.offset, 4000) != 4000) {
+       if (smbcli_read(cli->tree, fnum, buf, io.writeclose.in.offset, 4000) != 4000) {
                printf("read failed at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -664,9 +664,9 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_BUFFER(buf, seed, 4000);
 
 done:
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
        smb_raw_exit(cli->session);
-       cli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
 
@@ -676,7 +676,7 @@ done:
 */
 BOOL torture_raw_write(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL ret = True;
        TALLOC_CTX *mem_ctx;
 
index 90f622620053bb5e20db3686564f05b2a2993ce9..78a15d22fd4b734952e952b0892a86d0f218b7ad 100644 (file)
@@ -25,7 +25,7 @@ int torture_numops=100;
 int torture_entries=1000;
 int torture_failures=1;
 static int procnum; /* records process count number when forking */
-static struct cli_state *current_cli;
+static struct smbcli_state *current_cli;
 static BOOL use_oplocks;
 static BOOL use_level_II_oplocks;
 static BOOL use_kerberos;
@@ -34,11 +34,11 @@ BOOL torture_showall = False;
 
 #define CHECK_MAX_FAILURES(label) do { if (++failures >= torture_failures) goto label; } while (0)
 
-static struct cli_state *open_nbt_connection(void)
+static struct smbcli_state *open_nbt_connection(void)
 {
        struct nmb_name called, calling;
        struct in_addr ip;
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        const char *host = lp_parm_string(-1, "torture", "host");
 
        make_nmb_name(&calling, lp_netbios_name(), 0x0);
@@ -46,35 +46,35 @@ static struct cli_state *open_nbt_connection(void)
 
        zero_ip(&ip);
 
-       cli = cli_state_init();
+       cli = smbcli_state_init();
        if (!cli) {
-               printf("Failed initialize cli_struct to connect with %s\n", host);
+               printf("Failed initialize smbcli_struct to connect with %s\n", host);
                return NULL;
        }
 
-       if (!cli_socket_connect(cli, host, &ip)) {
+       if (!smbcli_socket_connect(cli, host, &ip)) {
                printf("Failed to connect with %s\n", host);
                return cli;
        }
 
        cli->transport->socket->timeout = 120000; /* set a really long timeout (2 minutes) */
 
-       if (!cli_transport_establish(cli, &calling, &called)) {
+       if (!smbcli_transport_establish(cli, &calling, &called)) {
                /*
                 * Well, that failed, try *SMBSERVER ... 
                 * However, we must reconnect as well ...
                 */
-               if (!cli_socket_connect(cli, host, &ip)) {
+               if (!smbcli_socket_connect(cli, host, &ip)) {
                        printf("Failed to connect with %s\n", host);
                        return False;
                }
 
                make_nmb_name(&called, "*SMBSERVER", 0x20);
-               if (!cli_transport_establish(cli, &calling, &called)) {
+               if (!smbcli_transport_establish(cli, &calling, &called)) {
                        printf("%s rejected the session\n",host);
                        printf("We tried with a called name of %s & %s\n",
                                host, "*SMBSERVER");
-                       cli_shutdown(cli);
+                       smbcli_shutdown(cli);
                        return NULL;
                }
        }
@@ -82,7 +82,7 @@ static struct cli_state *open_nbt_connection(void)
        return cli;
 }
 
-BOOL torture_open_connection_share(struct cli_state **c, 
+BOOL torture_open_connection_share(struct smbcli_state **c, 
                                   const char *hostname, 
                                   const char *sharename)
 {
@@ -93,9 +93,9 @@ BOOL torture_open_connection_share(struct cli_state **c,
        const char *password = lp_parm_string(-1, "torture", "password");
 
        if (use_kerberos)
-               flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+               flags |= SMBCLI_FULL_CONNECTION_USE_KERBEROS;
 
-       status = cli_full_connection(c, lp_netbios_name(),
+       status = smbcli_full_connection(c, lp_netbios_name(),
                                     hostname, NULL, 
                                     sharename, "?????", 
                                     username, username[0]?lp_workgroup():"",
@@ -112,7 +112,7 @@ BOOL torture_open_connection_share(struct cli_state **c,
        return True;
 }
 
-BOOL torture_open_connection(struct cli_state **c)
+BOOL torture_open_connection(struct smbcli_state **c)
 {
        const char *host = lp_parm_string(-1, "torture", "host");
        const char *share = lp_parm_string(-1, "torture", "share");
@@ -122,17 +122,17 @@ BOOL torture_open_connection(struct cli_state **c)
 
 
 
-BOOL torture_close_connection(struct cli_state *c)
+BOOL torture_close_connection(struct smbcli_state *c)
 {
        BOOL ret = True;
-       DEBUG(9,("torture_close_connection: cli_state@%p\n", c));
+       DEBUG(9,("torture_close_connection: smbcli_state@%p\n", c));
        if (!c) return True;
-       if (NT_STATUS_IS_ERR(cli_tdis(c))) {
-               printf("tdis failed (%s)\n", cli_errstr(c->tree));
+       if (NT_STATUS_IS_ERR(smbcli_tdis(c))) {
+               printf("tdis failed (%s)\n", smbcli_errstr(c->tree));
                ret = False;
        }
-       DEBUG(9,("torture_close_connection: call cli_shutdown\n"));
-       cli_shutdown(c);
+       DEBUG(9,("torture_close_connection: call smbcli_shutdown\n"));
+       smbcli_shutdown(c);
        DEBUG(9,("torture_close_connection: exit\n"));
        return ret;
 }
@@ -169,16 +169,16 @@ NTSTATUS torture_rpc_close(struct dcerpc_pipe *p)
 
 
 /* check if the server produced the expected error code */
-static BOOL check_error(int line, struct cli_state *c, 
+static BOOL check_error(int line, struct smbcli_state *c, 
                        uint8_t eclass, uint32_t ecode, NTSTATUS nterr)
 {
-        if (cli_is_dos_error(c->tree)) {
+        if (smbcli_is_dos_error(c->tree)) {
                 uint8_t class;
                 uint32_t num;
 
                 /* Check DOS error */
 
-                cli_dos_error(c, &class, &num);
+                smbcli_dos_error(c, &class, &num);
 
                 if (eclass != class || ecode != num) {
                         printf("unexpected error code class=%d code=%d\n", 
@@ -193,7 +193,7 @@ static BOOL check_error(int line, struct cli_state *c,
 
                 /* Check NT error */
 
-                status = cli_nt_error(c->tree);
+                status = smbcli_nt_error(c->tree);
 
                 if (NT_STATUS_V(nterr) != NT_STATUS_V(status)) {
                         printf("unexpected error code %s\n", nt_errstr(status));
@@ -206,16 +206,16 @@ static BOOL check_error(int line, struct cli_state *c,
 }
 
 
-static BOOL wait_lock(struct cli_state *c, int fnum, uint32_t offset, uint32_t len)
+static BOOL wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len)
 {
-       while (NT_STATUS_IS_ERR(cli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
+       while (NT_STATUS_IS_ERR(smbcli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
                if (!check_error(__LINE__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False;
        }
        return True;
 }
 
 
-static BOOL rw_torture(struct cli_state *c)
+static BOOL rw_torture(struct smbcli_state *c)
 {
        const char *lockfname = "\\torture.lck";
        char *fname;
@@ -226,12 +226,12 @@ static BOOL rw_torture(struct cli_state *c)
        char buf[1024];
        BOOL correct = True;
 
-       fnum2 = cli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, 
+       fnum2 = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, 
                         DENY_NONE);
        if (fnum2 == -1)
-               fnum2 = cli_open(c->tree, lockfname, O_RDWR, DENY_NONE);
+               fnum2 = smbcli_open(c->tree, lockfname, O_RDWR, DENY_NONE);
        if (fnum2 == -1) {
-               printf("open of %s failed (%s)\n", lockfname, cli_errstr(c->tree));
+               printf("open of %s failed (%s)\n", lockfname, smbcli_errstr(c->tree));
                return False;
        }
 
@@ -247,31 +247,31 @@ static BOOL rw_torture(struct cli_state *c)
                        return False;
                }
 
-               fnum = cli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL);
+               fnum = smbcli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL);
                if (fnum == -1) {
-                       printf("open failed (%s)\n", cli_errstr(c->tree));
+                       printf("open failed (%s)\n", smbcli_errstr(c->tree));
                        correct = False;
                        break;
                }
 
-               if (cli_write(c->tree, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) {
-                       printf("write failed (%s)\n", cli_errstr(c->tree));
+               if (smbcli_write(c->tree, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) {
+                       printf("write failed (%s)\n", smbcli_errstr(c->tree));
                        correct = False;
                }
 
                for (j=0;j<50;j++) {
-                       if (cli_write(c->tree, fnum, 0, (char *)buf, 
+                       if (smbcli_write(c->tree, fnum, 0, (char *)buf, 
                                      sizeof(pid)+(j*sizeof(buf)), 
                                      sizeof(buf)) != sizeof(buf)) {
-                               printf("write failed (%s)\n", cli_errstr(c->tree));
+                               printf("write failed (%s)\n", smbcli_errstr(c->tree));
                                correct = False;
                        }
                }
 
                pid2 = 0;
 
-               if (cli_read(c->tree, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) {
-                       printf("read failed (%s)\n", cli_errstr(c->tree));
+               if (smbcli_read(c->tree, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) {
+                       printf("read failed (%s)\n", smbcli_errstr(c->tree));
                        correct = False;
                }
 
@@ -280,32 +280,32 @@ static BOOL rw_torture(struct cli_state *c)
                        correct = False;
                }
 
-               if (NT_STATUS_IS_ERR(cli_close(c->tree, fnum))) {
-                       printf("close failed (%s)\n", cli_errstr(c->tree));
+               if (NT_STATUS_IS_ERR(smbcli_close(c->tree, fnum))) {
+                       printf("close failed (%s)\n", smbcli_errstr(c->tree));
                        correct = False;
                }
 
-               if (NT_STATUS_IS_ERR(cli_unlink(c->tree, fname))) {
-                       printf("unlink failed (%s)\n", cli_errstr(c->tree));
+               if (NT_STATUS_IS_ERR(smbcli_unlink(c->tree, fname))) {
+                       printf("unlink failed (%s)\n", smbcli_errstr(c->tree));
                        correct = False;
                }
 
-               if (NT_STATUS_IS_ERR(cli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) {
-                       printf("unlock failed (%s)\n", cli_errstr(c->tree));
+               if (NT_STATUS_IS_ERR(smbcli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) {
+                       printf("unlock failed (%s)\n", smbcli_errstr(c->tree));
                        correct = False;
                }
                free(fname);
        }
 
-       cli_close(c->tree, fnum2);
-       cli_unlink(c->tree, lockfname);
+       smbcli_close(c->tree, fnum2);
+       smbcli_unlink(c->tree, lockfname);
 
        printf("%d\n", i);
 
        return correct;
 }
 
-static BOOL run_torture(struct cli_state *cli, int dummy)
+static BOOL run_torture(struct smbcli_state *cli, int dummy)
 {
         BOOL ret;
 
@@ -318,7 +318,7 @@ static BOOL run_torture(struct cli_state *cli, int dummy)
        return ret;
 }
 
-static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
+static BOOL rw_torture3(struct smbcli_state *c, const char *lockfname)
 {
        int fnum = -1;
        uint_t i = 0;
@@ -337,11 +337,11 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
 
        if (procnum == 0)
        {
-               fnum = cli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, 
+               fnum = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, 
                                DENY_NONE);
                if (fnum == -1) {
                        printf("first open read/write of %s failed (%s)\n",
-                                       lockfname, cli_errstr(c->tree));
+                                       lockfname, smbcli_errstr(c->tree));
                        return False;
                }
        }
@@ -349,13 +349,13 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
        {
                for (i = 0; i < 500 && fnum == -1; i++)
                {
-                       fnum = cli_open(c->tree, lockfname, O_RDONLY, 
+                       fnum = smbcli_open(c->tree, lockfname, O_RDONLY, 
                                        DENY_NONE);
                        msleep(10);
                }
                if (fnum == -1) {
                        printf("second open read-only of %s failed (%s)\n",
-                                       lockfname, cli_errstr(c->tree));
+                                       lockfname, smbcli_errstr(c->tree));
                        return False;
                }
        }
@@ -378,20 +378,20 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
                                sent = sizeof(buf) - count;
                        }
 
-                       if (cli_write(c->tree, fnum, 0, buf+count, count, (size_t)sent) != sent) {
-                               printf("write failed (%s)\n", cli_errstr(c->tree));
+                       if (smbcli_write(c->tree, fnum, 0, buf+count, count, (size_t)sent) != sent) {
+                               printf("write failed (%s)\n", smbcli_errstr(c->tree));
                                correct = False;
                        }
                }
                else
                {
-                       sent = cli_read(c->tree, fnum, buf_rd+count, count,
+                       sent = smbcli_read(c->tree, fnum, buf_rd+count, count,
                                        sizeof(buf)-count);
                        if (sent < 0)
                        {
                                printf("read failed offset:%d size:%d (%s)\n",
                                                count, sizeof(buf)-count,
-                                               cli_errstr(c->tree));
+                                               smbcli_errstr(c->tree));
                                correct = False;
                                sent = 0;
                        }
@@ -410,15 +410,15 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
 
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(c->tree, fnum))) {
-               printf("close failed (%s)\n", cli_errstr(c->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(c->tree, fnum))) {
+               printf("close failed (%s)\n", smbcli_errstr(c->tree));
                correct = False;
        }
 
        return correct;
 }
 
-static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
+static BOOL rw_torture2(struct smbcli_state *c1, struct smbcli_state *c2)
 {
        const char *lockfname = "\\torture2.lck";
        int fnum1;
@@ -429,23 +429,23 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
        BOOL correct = True;
        ssize_t bytes_read, bytes_written;
 
-       if (cli_deltree(c1->tree, lockfname) == -1) {
-               printf("unlink failed (%s)\n", cli_errstr(c1->tree));
+       if (smbcli_deltree(c1->tree, lockfname) == -1) {
+               printf("unlink failed (%s)\n", smbcli_errstr(c1->tree));
        }
 
-       fnum1 = cli_open(c1->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, 
+       fnum1 = smbcli_open(c1->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, 
                         DENY_NONE);
        if (fnum1 == -1) {
                printf("first open read/write of %s failed (%s)\n",
-                               lockfname, cli_errstr(c1->tree));
+                               lockfname, smbcli_errstr(c1->tree));
                return False;
        }
-       fnum2 = cli_open(c2->tree, lockfname, O_RDONLY, 
+       fnum2 = smbcli_open(c2->tree, lockfname, O_RDONLY, 
                         DENY_NONE);
        if (fnum2 == -1) {
                printf("second open read-only of %s failed (%s)\n",
-                               lockfname, cli_errstr(c2->tree));
-               cli_close(c1->tree, fnum1);
+                               lockfname, smbcli_errstr(c2->tree));
+               smbcli_close(c1->tree, fnum1);
                return False;
        }
 
@@ -460,15 +460,15 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
 
                generate_random_buffer(buf, buf_size);
 
-               if ((bytes_written = cli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) {
-                       printf("write failed (%s)\n", cli_errstr(c1->tree));
+               if ((bytes_written = smbcli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) {
+                       printf("write failed (%s)\n", smbcli_errstr(c1->tree));
                        printf("wrote %d, expected %d\n", bytes_written, buf_size); 
                        correct = False;
                        break;
                }
 
-               if ((bytes_read = cli_read(c2->tree, fnum2, buf_rd, 0, buf_size)) != buf_size) {
-                       printf("read failed (%s)\n", cli_errstr(c2->tree));
+               if ((bytes_read = smbcli_read(c2->tree, fnum2, buf_rd, 0, buf_size)) != buf_size) {
+                       printf("read failed (%s)\n", smbcli_errstr(c2->tree));
                        printf("read %d, expected %d\n", bytes_read, buf_size); 
                        correct = False;
                        break;
@@ -482,17 +482,17 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
                }
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(c2->tree, fnum2))) {
-               printf("close failed (%s)\n", cli_errstr(c2->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(c2->tree, fnum2))) {
+               printf("close failed (%s)\n", smbcli_errstr(c2->tree));
                correct = False;
        }
-       if (NT_STATUS_IS_ERR(cli_close(c1->tree, fnum1))) {
-               printf("close failed (%s)\n", cli_errstr(c1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(c1->tree, fnum1))) {
+               printf("close failed (%s)\n", smbcli_errstr(c1->tree));
                correct = False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_unlink(c1->tree, lockfname))) {
-               printf("unlink failed (%s)\n", cli_errstr(c1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_unlink(c1->tree, lockfname))) {
+               printf("unlink failed (%s)\n", smbcli_errstr(c1->tree));
                correct = False;
        }
 
@@ -501,7 +501,7 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
 
 static BOOL run_readwritetest(int dummy)
 {
-       struct cli_state *cli1, *cli2;
+       struct smbcli_state *cli1, *cli2;
        BOOL test1, test2 = True;
 
        if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
@@ -529,7 +529,7 @@ static BOOL run_readwritetest(int dummy)
        return (test1 && test2);
 }
 
-static BOOL run_readwritemulti(struct cli_state *cli, int dummy)
+static BOOL run_readwritemulti(struct smbcli_state *cli, int dummy)
 {
        BOOL test;
 
@@ -552,7 +552,7 @@ static BOOL run_readwritemulti(struct cli_state *cli, int dummy)
  */
 static BOOL run_locktest1(int dummy)
 {
-       struct cli_state *cli1, *cli2;
+       struct smbcli_state *cli1, *cli2;
        const char *fname = "\\lockt1.lck";
        int fnum1, fnum2, fnum3;
        time_t t1, t2;
@@ -564,31 +564,31 @@ static BOOL run_locktest1(int dummy)
 
        printf("starting locktest1\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum1 == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
-       fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+       fnum2 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
        if (fnum2 == -1) {
-               printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("open2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
-       fnum3 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
+       fnum3 = smbcli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
        if (fnum3 == -1) {
-               printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("open3 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
-               printf("lock1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
+               printf("lock1 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
 
-       if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
                printf("lock2 succeeded! This is a locking bug\n");
                return False;
        } else {
@@ -600,7 +600,7 @@ static BOOL run_locktest1(int dummy)
        lock_timeout = (6 + (random() % 20));
        printf("Testing lock timeout with timeout=%u\n", lock_timeout);
        t1 = time(NULL);
-       if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK))) {
+       if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK))) {
                printf("lock3 succeeded! This is a locking bug\n");
                return False;
        } else {
@@ -615,12 +615,12 @@ static BOOL run_locktest1(int dummy)
        printf("server slept for %u seconds for a %u second timeout\n",
               (uint_t)(t2-t1), lock_timeout);
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
-               printf("close1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) {
+               printf("close1 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
                printf("lock4 succeeded! This is a locking bug\n");
                return False;
        } else {
@@ -628,18 +628,18 @@ static BOOL run_locktest1(int dummy)
                                 NT_STATUS_FILE_LOCK_CONFLICT)) return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close2 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum3))) {
-               printf("close3 failed (%s)\n", cli_errstr(cli2->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum3))) {
+               printf("close3 failed (%s)\n", smbcli_errstr(cli2->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, fname))) {
-               printf("unlink failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli1->tree, fname))) {
+               printf("unlink failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
@@ -662,14 +662,14 @@ static BOOL run_locktest1(int dummy)
  */
 static BOOL run_tcon_test(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        const char *fname = "\\tcontest.tmp";
        int fnum1;
        uint16_t cnum1, cnum2, cnum3;
        uint16_t vuid1, vuid2;
        char buf[4];
        BOOL ret = True;
-       struct cli_tree *tree1;
+       struct smbcli_tree *tree1;
        const char *host = lp_parm_string(-1, "torture", "host");
        const char *share = lp_parm_string(-1, "torture", "share");
        const char *password = lp_parm_string(-1, "torture", "password");
@@ -680,13 +680,13 @@ static BOOL run_tcon_test(int dummy)
 
        printf("starting tcontest\n");
 
-       if (cli_deltree(cli->tree, fname) == -1) {
-               printf("unlink of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, fname) == -1) {
+               printf("unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       fnum1 = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum1 == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -694,16 +694,16 @@ static BOOL run_tcon_test(int dummy)
        vuid1 = cli->session->vuid;
 
        memset(&buf, 0, 4); /* init buf so valgrind won't complain */
-       if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) != 4) {
-               printf("initial write failed (%s)\n", cli_errstr(cli->tree));
+       if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) != 4) {
+               printf("initial write failed (%s)\n", smbcli_errstr(cli->tree));
                return False;
        }
 
        tree1 = cli->tree;      /* save old tree connection */
-       if (NT_STATUS_IS_ERR(cli_send_tconX(cli, share, "?????", password))) {
+       if (NT_STATUS_IS_ERR(smbcli_send_tconX(cli, share, "?????", password))) {
                printf("%s refused 2nd tree connect (%s)\n", host,
-                          cli_errstr(cli->tree));
-               cli_shutdown(cli);
+                          smbcli_errstr(cli->tree));
+               smbcli_shutdown(cli);
                return False;
        }
 
@@ -714,47 +714,47 @@ static BOOL run_tcon_test(int dummy)
        /* try a write with the wrong tid */
        cli->tree->tid = cnum2;
 
-       if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
+       if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
                printf("* server allows write with wrong TID\n");
                ret = False;
        } else {
-               printf("server fails write with wrong TID : %s\n", cli_errstr(cli->tree));
+               printf("server fails write with wrong TID : %s\n", smbcli_errstr(cli->tree));
        }
 
 
        /* try a write with an invalid tid */
        cli->tree->tid = cnum3;
 
-       if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
+       if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
                printf("* server allows write with invalid TID\n");
                ret = False;
        } else {
-               printf("server fails write with invalid TID : %s\n", cli_errstr(cli->tree));
+               printf("server fails write with invalid TID : %s\n", smbcli_errstr(cli->tree));
        }
 
        /* try a write with an invalid vuid */
        cli->session->vuid = vuid2;
        cli->tree->tid = cnum1;
 
-       if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
+       if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
                printf("* server allows write with invalid VUID\n");
                ret = False;
        } else {
-               printf("server fails write with invalid VUID : %s\n", cli_errstr(cli->tree));
+               printf("server fails write with invalid VUID : %s\n", smbcli_errstr(cli->tree));
        }
 
        cli->session->vuid = vuid1;
        cli->tree->tid = cnum1;
 
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum1))) {
-               printf("close failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum1))) {
+               printf("close failed (%s)\n", smbcli_errstr(cli->tree));
                return False;
        }
 
        cli->tree->tid = cnum2;
 
-       if (NT_STATUS_IS_ERR(cli_tdis(cli))) {
-               printf("secondary tdis failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_tdis(cli))) {
+               printf("secondary tdis failed (%s)\n", smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -770,7 +770,7 @@ static BOOL run_tcon_test(int dummy)
 
 
 
-static BOOL tcon_devtest(struct cli_state *cli,
+static BOOL tcon_devtest(struct smbcli_state *cli,
                         const char *myshare, const char *devtype,
                         NTSTATUS expected_error)
 {
@@ -778,7 +778,7 @@ static BOOL tcon_devtest(struct cli_state *cli,
        BOOL ret;
        const char *password = lp_parm_string(-1, "torture", "password");
 
-       status = NT_STATUS_IS_OK(cli_send_tconX(cli, myshare, devtype, 
+       status = NT_STATUS_IS_OK(smbcli_send_tconX(cli, myshare, devtype, 
                                                password));
 
        printf("Trying share %s with devtype %s\n", myshare, devtype);
@@ -792,7 +792,7 @@ static BOOL tcon_devtest(struct cli_state *cli,
                               myshare, devtype);
                        ret = False;
                }
-               cli_tdis(cli);
+               smbcli_tdis(cli);
        } else {
                if (status) {
                        printf("tconx to share %s with type %s "
@@ -800,7 +800,7 @@ static BOOL tcon_devtest(struct cli_state *cli,
                               myshare, devtype);
                        ret = False;
                } else {
-                       if (NT_STATUS_EQUAL(cli_nt_error(cli->tree),
+                       if (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),
                                            expected_error)) {
                                ret = True;
                        } else {
@@ -817,7 +817,7 @@ static BOOL tcon_devtest(struct cli_state *cli,
  */
 static BOOL run_tcon_devtype_test(int dummy)
 {
-       struct cli_state *cli1 = NULL;
+       struct smbcli_state *cli1 = NULL;
        BOOL retry;
        int flags = 0;
        NTSTATUS status;
@@ -827,7 +827,7 @@ static BOOL run_tcon_devtype_test(int dummy)
        const char *username = lp_parm_string(-1, "torture", "username");
        const char *password = lp_parm_string(-1, "torture", "password");
        
-       status = cli_full_connection(&cli1, lp_netbios_name(),
+       status = smbcli_full_connection(&cli1, lp_netbios_name(),
                                     host, NULL, 
                                     share, "?????",
                                     username, lp_workgroup(),
@@ -868,7 +868,7 @@ static BOOL run_tcon_devtype_test(int dummy)
        if (!tcon_devtest(cli1, share, "FOOBA", NT_STATUS_BAD_DEVICE_TYPE))
                ret = False;
 
-       cli_shutdown(cli1);
+       smbcli_shutdown(cli1);
 
        if (ret)
                printf("Passed tcondevtest\n");
@@ -890,7 +890,7 @@ static BOOL run_tcon_devtype_test(int dummy)
 */
 static BOOL run_locktest2(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        const char *fname = "\\lockt2.lck";
        int fnum1, fnum2, fnum3;
        BOOL correct = True;
@@ -901,40 +901,40 @@ static BOOL run_locktest2(int dummy)
 
        printf("starting locktest2\n");
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        printf("Testing pid context\n");
        
        cli->session->pid = 1;
 
-       fnum1 = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum1 == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                return False;
        }
 
-       fnum2 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+       fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
        if (fnum2 == -1) {
-               printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("open2 of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                return False;
        }
 
        cli->session->pid = 2;
 
-       fnum3 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+       fnum3 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
        if (fnum3 == -1) {
-               printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("open3 of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                return False;
        }
 
        cli->session->pid = 1;
 
-       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
-               printf("lock1 failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
+               printf("lock1 failed (%s)\n", smbcli_errstr(cli->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
                printf("WRITE lock1 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -942,7 +942,7 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_LOCK_NOT_GRANTED)) return False;
        }
 
-       if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK))) {
                printf("WRITE lock2 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -950,7 +950,7 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_LOCK_NOT_GRANTED)) return False;
        }
 
-       if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK))) {
+       if (NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK))) {
                printf("READ lock2 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -958,18 +958,18 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_FILE_LOCK_CONFLICT)) return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK))) {
-               printf("lock at 100 failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK))) {
+               printf("lock at 100 failed (%s)\n", smbcli_errstr(cli->tree));
        }
 
        cli->session->pid = 2;
 
-       if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 100, 4))) {
+       if (NT_STATUS_IS_OK(smbcli_unlock(cli->tree, fnum1, 100, 4))) {
                printf("unlock at 100 succeeded! This is a locking bug\n");
                correct = False;
        }
 
-       if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 0, 4))) {
+       if (NT_STATUS_IS_OK(smbcli_unlock(cli->tree, fnum1, 0, 4))) {
                printf("unlock1 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -978,7 +978,7 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_RANGE_NOT_LOCKED)) return False;
        }
 
-       if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 0, 8))) {
+       if (NT_STATUS_IS_OK(smbcli_unlock(cli->tree, fnum1, 0, 8))) {
                printf("unlock2 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -987,7 +987,7 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_RANGE_NOT_LOCKED)) return False;
        }
 
-       if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
+       if (NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
                printf("lock3 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -996,18 +996,18 @@ static BOOL run_locktest2(int dummy)
 
        cli->session->pid = 1;
 
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum1))) {
-               printf("close1 failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum1))) {
+               printf("close1 failed (%s)\n", smbcli_errstr(cli->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum2))) {
-               printf("close2 failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum2))) {
+               printf("close2 failed (%s)\n", smbcli_errstr(cli->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum3))) {
-               printf("close3 failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum3))) {
+               printf("close3 failed (%s)\n", smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -1028,7 +1028,7 @@ static BOOL run_locktest2(int dummy)
 */
 static BOOL run_locktest3(int dummy)
 {
-       struct cli_state *cli1, *cli2;
+       struct smbcli_state *cli1, *cli2;
        const char *fname = "\\lockt3.lck";
        int fnum1, fnum2, i;
        uint32_t offset;
@@ -1044,16 +1044,16 @@ static BOOL run_locktest3(int dummy)
 
        printf("Testing 32 bit offset ranges\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum1 == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
-       fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
+       fnum2 = smbcli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
        if (fnum2 == -1) {
-               printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("open2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                return False;
        }
 
@@ -1061,17 +1061,17 @@ static BOOL run_locktest3(int dummy)
 
        for (offset=i=0;i<torture_numops;i++) {
                NEXT_OFFSET;
-               if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
+               if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
                        printf("lock1 %d failed (%s)\n", 
                               i,
-                              cli_errstr(cli1->tree));
+                              smbcli_errstr(cli1->tree));
                        return False;
                }
 
-               if (NT_STATUS_IS_ERR(cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
+               if (NT_STATUS_IS_ERR(smbcli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
                        printf("lock2 %d failed (%s)\n", 
                               i,
-                              cli_errstr(cli1->tree));
+                              smbcli_errstr(cli1->tree));
                        return False;
                }
        }
@@ -1081,22 +1081,22 @@ static BOOL run_locktest3(int dummy)
        for (offset=i=0;i<torture_numops;i++) {
                NEXT_OFFSET;
 
-               if (NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, offset-2, 1, 0, WRITE_LOCK))) {
+               if (NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, offset-2, 1, 0, WRITE_LOCK))) {
                        printf("error: lock1 %d succeeded!\n", i);
                        return False;
                }
 
-               if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, offset-1, 1, 0, WRITE_LOCK))) {
+               if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, offset-1, 1, 0, WRITE_LOCK))) {
                        printf("error: lock2 %d succeeded!\n", i);
                        return False;
                }
 
-               if (NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
+               if (NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
                        printf("error: lock3 %d succeeded!\n", i);
                        return False;
                }
 
-               if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
+               if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
                        printf("error: lock4 %d succeeded!\n", i);
                        return False;
                }
@@ -1107,33 +1107,33 @@ static BOOL run_locktest3(int dummy)
        for (offset=i=0;i<torture_numops;i++) {
                NEXT_OFFSET;
 
-               if (NT_STATUS_IS_ERR(cli_unlock(cli1->tree, fnum1, offset-1, 1))) {
+               if (NT_STATUS_IS_ERR(smbcli_unlock(cli1->tree, fnum1, offset-1, 1))) {
                        printf("unlock1 %d failed (%s)\n", 
                               i,
-                              cli_errstr(cli1->tree));
+                              smbcli_errstr(cli1->tree));
                        return False;
                }
 
-               if (NT_STATUS_IS_ERR(cli_unlock(cli2->tree, fnum2, offset-2, 1))) {
+               if (NT_STATUS_IS_ERR(smbcli_unlock(cli2->tree, fnum2, offset-2, 1))) {
                        printf("unlock2 %d failed (%s)\n", 
                               i,
-                              cli_errstr(cli1->tree));
+                              smbcli_errstr(cli1->tree));
                        return False;
                }
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close1 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
-               printf("close2 failed (%s)\n", cli_errstr(cli2->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+               printf("close2 failed (%s)\n", smbcli_errstr(cli2->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, fname))) {
-               printf("unlink failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli1->tree, fname))) {
+               printf("unlink failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
@@ -1159,7 +1159,7 @@ static BOOL run_locktest3(int dummy)
 */
 static BOOL run_locktest4(int dummy)
 {
-       struct cli_state *cli1, *cli2;
+       struct smbcli_state *cli1, *cli2;
        const char *fname = "\\lockt4.lck";
        int fnum1, fnum2, f;
        BOOL ret;
@@ -1172,149 +1172,149 @@ static BOOL run_locktest4(int dummy)
 
        printf("starting locktest4\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
-       fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum2 = smbcli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
 
        memset(buf, 0, sizeof(buf));
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
                printf("Failed to create file\n");
                correct = False;
                goto fail;
        }
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK));
        EXPECTED(ret, False);
        printf("the same process %s set overlapping write locks\n", ret?"can":"cannot");
            
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("the same process %s set overlapping read locks\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK));
        EXPECTED(ret, False);
        printf("a different connection %s set overlapping write locks\n", ret?"can":"cannot");
            
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK)) &&
-               NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK)) &&
+               NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("a different connection %s set overlapping read locks\n", ret?"can":"cannot");
        
-       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK))) &&
-             NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK)));
+       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK))) &&
+             NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK)));
        EXPECTED(ret, False);
        printf("a different pid %s set overlapping write locks\n", ret?"can":"cannot");
            
-       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK))) &&
-             NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK)));
+       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK))) &&
+             NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK)));
        EXPECTED(ret, True);
        printf("a different pid %s set overlapping read locks\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("the same process %s set the same read lock twice\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK));
        EXPECTED(ret, False);
        printf("the same process %s set the same write lock twice\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK));
        EXPECTED(ret, False);
        printf("the same process %s overlay a read lock with a write lock\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("the same process %s overlay a write lock with a read lock\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK))) &&
-             NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK)));
+       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK))) &&
+             NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK)));
        EXPECTED(ret, False);
        printf("a different pid %s overlay a write lock with a read lock\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 110, 6));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 110, 6));
        EXPECTED(ret, False);
        printf("the same process %s coalesce read locks\n", ret?"can":"cannot");
 
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK)) &&
-             (cli_read(cli2->tree, fnum2, buf, 120, 4) == 4);
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK)) &&
+             (smbcli_read(cli2->tree, fnum2, buf, 120, 4) == 4);
        EXPECTED(ret, False);
        printf("this server %s strict write locking\n", ret?"doesn't do":"does");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) &&
-             (cli_write(cli2->tree, fnum2, 0, buf, 130, 4) == 4);
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) &&
+             (smbcli_write(cli2->tree, fnum2, 0, buf, 130, 4) == 4);
        EXPECTED(ret, False);
        printf("this server %s strict read locking\n", ret?"doesn't do":"does");
 
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 140, 4)) &&
-             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 140, 4));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 140, 4)) &&
+             NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 140, 4));
        EXPECTED(ret, True);
        printf("this server %s do recursive read locking\n", ret?"does":"doesn't");
 
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 150, 4, 0, WRITE_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 150, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 150, 4)) &&
-             (cli_read(cli2->tree, fnum2, buf, 150, 4) == 4) &&
-             !(cli_write(cli2->tree, fnum2, 0, buf, 150, 4) == 4) &&
-             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 150, 4));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 150, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 150, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 150, 4)) &&
+             (smbcli_read(cli2->tree, fnum2, buf, 150, 4) == 4) &&
+             !(smbcli_write(cli2->tree, fnum2, 0, buf, 150, 4) == 4) &&
+             NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 150, 4));
        EXPECTED(ret, True);
        printf("this server %s do recursive lock overlays\n", ret?"does":"doesn't");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 160, 4)) &&
-             (cli_write(cli2->tree, fnum2, 0, buf, 160, 4) == 4) &&            
-             (cli_read(cli2->tree, fnum2, buf, 160, 4) == 4);          
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 160, 4)) &&
+             (smbcli_write(cli2->tree, fnum2, 0, buf, 160, 4) == 4) &&         
+             (smbcli_read(cli2->tree, fnum2, buf, 160, 4) == 4);               
        EXPECTED(ret, True);
        printf("the same process %s remove a read lock using write locking\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK)) &&
-             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 170, 4)) &&
-             (cli_write(cli2->tree, fnum2, 0, buf, 170, 4) == 4) &&            
-             (cli_read(cli2->tree, fnum2, buf, 170, 4) == 4);          
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 170, 4)) &&
+             (smbcli_write(cli2->tree, fnum2, 0, buf, 170, 4) == 4) &&         
+             (smbcli_read(cli2->tree, fnum2, buf, 170, 4) == 4);               
        EXPECTED(ret, True);
        printf("the same process %s remove a write lock using read locking\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 190, 4, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 190, 4)) &&
-             !(cli_write(cli2->tree, fnum2, 0, buf, 190, 4) == 4) &&           
-             (cli_read(cli2->tree, fnum2, buf, 190, 4) == 4);          
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 190, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 190, 4)) &&
+             !(smbcli_write(cli2->tree, fnum2, 0, buf, 190, 4) == 4) &&                
+             (smbcli_read(cli2->tree, fnum2, buf, 190, 4) == 4);               
        EXPECTED(ret, True);
        printf("the same process %s remove the first lock first\n", ret?"does":"doesn't");
 
-       cli_close(cli1->tree, fnum1);
-       cli_close(cli2->tree, fnum2);
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
-       f = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, f, 0, 1, 0, READ_LOCK)) &&
-             NT_STATUS_IS_OK(cli_close(cli1->tree, fnum1)) &&
-             ((fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE)) != -1) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
-        cli_close(cli1->tree, f);
-       cli_close(cli1->tree, fnum1);
+       smbcli_close(cli1->tree, fnum1);
+       smbcli_close(cli2->tree, fnum2);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+       f = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, f, 0, 1, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_close(cli1->tree, fnum1)) &&
+             ((fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE)) != -1) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
+        smbcli_close(cli1->tree, f);
+       smbcli_close(cli1->tree, fnum1);
        EXPECTED(ret, True);
        printf("the server %s have the NT byte range lock bug\n", !ret?"does":"doesn't");
 
  fail:
-       cli_close(cli1->tree, fnum1);
-       cli_close(cli2->tree, fnum2);
-       cli_unlink(cli1->tree, fname);
+       smbcli_close(cli1->tree, fnum1);
+       smbcli_close(cli2->tree, fnum2);
+       smbcli_unlink(cli1->tree, fname);
        torture_close_connection(cli1);
        torture_close_connection(cli2);
 
@@ -1327,7 +1327,7 @@ static BOOL run_locktest4(int dummy)
 */
 static BOOL run_locktest5(int dummy)
 {
-       struct cli_state *cli1, *cli2;
+       struct smbcli_state *cli1, *cli2;
        const char *fname = "\\lockt5.lck";
        int fnum1, fnum2, fnum3;
        BOOL ret;
@@ -1340,56 +1340,56 @@ static BOOL run_locktest5(int dummy)
 
        printf("starting locktest5\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
-       fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
-       fnum3 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum2 = smbcli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
+       fnum3 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
 
        memset(buf, 0, sizeof(buf));
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
                printf("Failed to create file\n");
                correct = False;
                goto fail;
        }
 
        /* Check for NT bug... */
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
-                 NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum3, 0, 1, 0, READ_LOCK));
-       cli_close(cli1->tree, fnum1);
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
+                 NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum3, 0, 1, 0, READ_LOCK));
+       smbcli_close(cli1->tree, fnum1);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
        EXPECTED(ret, True);
        printf("this server %s the NT locking bug\n", ret ? "doesn't have" : "has");
-       cli_close(cli1->tree, fnum1);
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
-       cli_unlock(cli1->tree, fnum3, 0, 1);
+       smbcli_close(cli1->tree, fnum1);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+       smbcli_unlock(cli1->tree, fnum3, 0, 1);
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
-             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("the same process %s overlay a write with a read lock\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
        EXPECTED(ret, False);
 
        printf("a different processs %s get a read lock on the first process lock stack\n", ret?"can":"cannot");
 
        /* Unlock the process 2 lock. */
-       cli_unlock(cli2->tree, fnum2, 0, 4);
+       smbcli_unlock(cli2->tree, fnum2, 0, 4);
 
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK));
        EXPECTED(ret, False);
 
        printf("the same processs on a different fnum %s get a read lock\n", ret?"can":"cannot");
 
        /* Unlock the process 1 fnum3 lock. */
-       cli_unlock(cli1->tree, fnum3, 0, 4);
+       smbcli_unlock(cli1->tree, fnum3, 0, 4);
 
        /* Stack 2 more locks here. */
-       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)) &&
-                 NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)) &&
+                 NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK));
 
        EXPECTED(ret, True);
        printf("the same process %s stack read locks\n", ret?"can":"cannot");
@@ -1397,40 +1397,40 @@ static BOOL run_locktest5(int dummy)
        /* Unlock the first process lock, then check this was the WRITE lock that was
                removed. */
 
-ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4)) &&
-       NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
+ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) &&
+       NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
 
        EXPECTED(ret, True);
        printf("the first unlock removes the %s lock\n", ret?"WRITE":"READ");
 
        /* Unlock the process 2 lock. */
-       cli_unlock(cli2->tree, fnum2, 0, 4);
+       smbcli_unlock(cli2->tree, fnum2, 0, 4);
 
        /* We should have 3 stacked locks here. Ensure we need to do 3 unlocks. */
 
-       ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 1, 1)) &&
-                 NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4)) &&
-                 NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4));
+       ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 1, 1)) &&
+                 NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) &&
+                 NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4));
 
        EXPECTED(ret, True);
        printf("the same process %s unlock the stack of 4 locks\n", ret?"can":"cannot"); 
 
        /* Ensure the next unlock fails. */
-       ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4));
+       ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4));
        EXPECTED(ret, False);
        printf("the same process %s count the lock stack\n", !ret?"can":"cannot"); 
 
        /* Ensure connection 2 can get a write lock. */
-       ret = NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK));
+       ret = NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK));
        EXPECTED(ret, True);
 
        printf("a different processs %s get a write lock on the unlocked stack\n", ret?"can":"cannot");
 
 
  fail:
-       cli_close(cli1->tree, fnum1);
-       cli_close(cli2->tree, fnum2);
-       cli_unlink(cli1->tree, fname);
+       smbcli_close(cli1->tree, fnum1);
+       smbcli_close(cli2->tree, fnum2);
+       smbcli_unlink(cli1->tree, fname);
        if (!torture_close_connection(cli1)) {
                correct = False;
        }
@@ -1448,7 +1448,7 @@ ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4)) &&
 */
 static BOOL run_locktest6(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        const char *fname[1] = { "\\lock6.txt" };
        int i;
        int fnum;
@@ -1463,19 +1463,19 @@ static BOOL run_locktest6(int dummy)
        for (i=0;i<1;i++) {
                printf("Testing %s\n", fname[i]);
 
-               cli_unlink(cli->tree, fname[i]);
+               smbcli_unlink(cli->tree, fname[i]);
 
-               fnum = cli_open(cli->tree, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
-               status = cli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE);
-               cli_close(cli->tree, fnum);
+               fnum = smbcli_open(cli->tree, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+               status = smbcli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE);
+               smbcli_close(cli->tree, fnum);
                printf("CHANGE_LOCKTYPE gave %s\n", nt_errstr(status));
 
-               fnum = cli_open(cli->tree, fname[i], O_RDWR, DENY_NONE);
-               status = cli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CANCEL_LOCK);
-               cli_close(cli->tree, fnum);
+               fnum = smbcli_open(cli->tree, fname[i], O_RDWR, DENY_NONE);
+               status = smbcli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CANCEL_LOCK);
+               smbcli_close(cli->tree, fnum);
                printf("CANCEL_LOCK gave %s\n", nt_errstr(status));
 
-               cli_unlink(cli->tree, fname[i]);
+               smbcli_unlink(cli->tree, fname[i]);
        }
 
        torture_close_connection(cli);
@@ -1486,7 +1486,7 @@ static BOOL run_locktest6(int dummy)
 
 static BOOL run_locktest7(int dummy)
 {
-       struct cli_state *cli1;
+       struct smbcli_state *cli1;
        const char *fname = "\\lockt7.lck";
        int fnum1;
        int fnum2;
@@ -1500,36 +1500,36 @@ static BOOL run_locktest7(int dummy)
 
        printf("starting locktest7\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
 
        memset(buf, 0, sizeof(buf));
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
                printf("Failed to create file\n");
                goto fail;
        }
 
        cli1->session->pid = 1;
 
-       if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK))) {
-               printf("Unable to apply read lock on range 130:4, error was %s\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK))) {
+               printf("Unable to apply read lock on range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
                goto fail;
        } else {
                printf("pid1 successfully locked range 130:4 for READ\n");
        }
 
-       if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
-               printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree));
+       if (smbcli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
+               printf("pid1 unable to read the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
                goto fail;
        } else {
                printf("pid1 successfully read the range 130:4\n");
        }
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
-               printf("pid1 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree));
-               if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
+               printf("pid1 unable to write to the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
+               if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
                        printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
                        goto fail;
                }
@@ -1540,15 +1540,15 @@ static BOOL run_locktest7(int dummy)
 
        cli1->session->pid = 2;
 
-       if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
-               printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree));
+       if (smbcli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
+               printf("pid2 unable to read the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
        } else {
                printf("pid2 successfully read the range 130:4\n");
        }
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
-               printf("pid2 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree));
-               if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
+               printf("pid2 unable to write to the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
+               if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
                        printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
                        goto fail;
                }
@@ -1558,24 +1558,24 @@ static BOOL run_locktest7(int dummy)
        }
 
        cli1->session->pid = 1;
-       cli_unlock(cli1->tree, fnum1, 130, 4);
+       smbcli_unlock(cli1->tree, fnum1, 130, 4);
 
-       if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 130, 4, 0, WRITE_LOCK))) {
-               printf("Unable to apply write lock on range 130:4, error was %s\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 130, 4, 0, WRITE_LOCK))) {
+               printf("Unable to apply write lock on range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
                goto fail;
        } else {
                printf("pid1 successfully locked range 130:4 for WRITE\n");
        }
 
-       if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
-               printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree));
+       if (smbcli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
+               printf("pid1 unable to read the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
                goto fail;
        } else {
                printf("pid1 successfully read the range 130:4\n");
        }
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
-               printf("pid1 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree));
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
+               printf("pid1 unable to write to the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
                goto fail;
        } else {
                printf("pid1 successfully wrote to the range 130:4\n");
@@ -1583,9 +1583,9 @@ static BOOL run_locktest7(int dummy)
 
        cli1->session->pid = 2;
 
-       if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
-               printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree));
-               if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+       if (smbcli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
+               printf("pid2 unable to read the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
+               if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
                        printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
                        goto fail;
                }
@@ -1594,9 +1594,9 @@ static BOOL run_locktest7(int dummy)
                goto fail;
        }
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
-               printf("pid2 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree));
-               if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
+               printf("pid2 unable to write to the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
+               if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
                        printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
                        goto fail;
                }
@@ -1607,7 +1607,7 @@ static BOOL run_locktest7(int dummy)
 
        printf("Testing truncate of locked file.\n");
 
-       fnum2 = cli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE);
+       fnum2 = smbcli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE);
 
        if (fnum2 == -1) {
                printf("Unable to truncate locked file.\n");
@@ -1617,8 +1617,8 @@ static BOOL run_locktest7(int dummy)
                printf("Truncated locked file.\n");
        }
 
-       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &size, NULL))) {
-               printf("getatr failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &size, NULL))) {
+               printf("getatr failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
@@ -1631,13 +1631,13 @@ static BOOL run_locktest7(int dummy)
 
        cli1->session->pid = 1;
 
-       cli_unlock(cli1->tree, fnum1, 130, 4);
+       smbcli_unlock(cli1->tree, fnum1, 130, 4);
        correct = True;
 
 fail:
-       cli_close(cli1->tree, fnum1);
-       cli_close(cli1->tree, fnum2);
-       cli_unlink(cli1->tree, fname);
+       smbcli_close(cli1->tree, fnum1);
+       smbcli_close(cli1->tree, fnum2);
+       smbcli_unlink(cli1->tree, fname);
        torture_close_connection(cli1);
 
        printf("finished locktest7\n");
@@ -1650,7 +1650,7 @@ security hole)
 */
 static BOOL run_fdpasstest(int dummy)
 {
-       struct cli_state *cli1, *cli2;
+       struct smbcli_state *cli1, *cli2;
        const char *fname = "\\fdpass.tst";
        int fnum1, oldtid;
        pstring buf;
@@ -1661,20 +1661,20 @@ static BOOL run_fdpasstest(int dummy)
 
        printf("starting fdpasstest\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
        printf("Opening a file on connection 1\n");
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum1 == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
 
        printf("writing to file on connection 1\n");
 
-       if (cli_write(cli1->tree, fnum1, 0, "hello world\n", 0, 13) != 13) {
-               printf("write failed (%s)\n", cli_errstr(cli1->tree));
+       if (smbcli_write(cli1->tree, fnum1, 0, "hello world\n", 0, 13) != 13) {
+               printf("write failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
@@ -1685,14 +1685,14 @@ static BOOL run_fdpasstest(int dummy)
 
        printf("reading from file on connection 2\n");
 
-       if (cli_read(cli2->tree, fnum1, buf, 0, 13) == 13) {
+       if (smbcli_read(cli2->tree, fnum1, buf, 0, 13) == 13) {
                printf("read succeeded! nasty security hole [%s]\n",
                       buf);
                return False;
        }
 
-       cli_close(cli1->tree, fnum1);
-       cli_unlink(cli1->tree, fname);
+       smbcli_close(cli1->tree, fnum1);
+       smbcli_unlink(cli1->tree, fname);
 
        cli2->tree->tid = oldtid;
 
@@ -1711,7 +1711,7 @@ static BOOL run_fdpasstest(int dummy)
 */
 static BOOL run_unlinktest(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        const char *fname = "\\unlink.tst";
        int fnum;
        BOOL correct = True;
@@ -1722,21 +1722,21 @@ static BOOL run_unlinktest(int dummy)
 
        printf("starting unlink test\n");
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        cli->session->pid = 1;
 
        printf("Opening a file\n");
 
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                return False;
        }
 
        printf("Unlinking a open file\n");
 
-       if (NT_STATUS_IS_OK(cli_unlink(cli->tree, fname))) {
+       if (NT_STATUS_IS_OK(smbcli_unlink(cli->tree, fname))) {
                printf("error: server allowed unlink on an open file\n");
                correct = False;
        } else {
@@ -1744,8 +1744,8 @@ static BOOL run_unlinktest(int dummy)
                                      NT_STATUS_SHARING_VIOLATION);
        }
 
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
        if (!torture_close_connection(cli)) {
                correct = False;
@@ -1760,7 +1760,7 @@ static BOOL run_unlinktest(int dummy)
 /*
 test the timing of deferred open requests
 */
-static BOOL run_deferopen(struct cli_state *cli, int dummy)
+static BOOL run_deferopen(struct smbcli_state *cli, int dummy)
 {
        const char *fname = "\\defer_open_test.dat";
        int retries=4;
@@ -1780,14 +1780,14 @@ static BOOL run_deferopen(struct cli_state *cli, int dummy)
                do {
                        struct timeval tv_start, tv_end;
                        GetTimeOfDay(&tv_start);
-                       fnum = cli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+                       fnum = smbcli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
                                FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE,
                                NTCREATEX_DISP_OPEN_IF, 0, 0);
                        if (fnum != -1) {
                                break;
                        }
                        GetTimeOfDay(&tv_end);
-                       if (NT_STATUS_EQUAL(cli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
+                       if (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
                                /* Sharing violation errors need to be 1 second apart. */
                                int64_t tdif = usec_time_diff(&tv_end, &tv_start);
                                if (tdif < 500000 || tdif > 1500000) {
@@ -1796,10 +1796,10 @@ static BOOL run_deferopen(struct cli_state *cli, int dummy)
                                                tdif % (int64_t)1000000);
                                }
                        }
-               } while (NT_STATUS_EQUAL(cli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION));
+               } while (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION));
 
                if (fnum == -1) {
-                       fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree));
+                       fprintf(stderr,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree));
                        return False;
                }
 
@@ -1807,17 +1807,17 @@ static BOOL run_deferopen(struct cli_state *cli, int dummy)
 
                sleep(10);
                i++;
-               if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
-                       fprintf(stderr,"Failed to close %s, error=%s\n", fname, cli_errstr(cli->tree));
+               if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+                       fprintf(stderr,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree));
                        return False;
                }
                sleep(2);
        }
 
-       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fname))) {
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
                /* All until the last unlink will fail with sharing violation. */
-               if (!NT_STATUS_EQUAL(cli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
-                       printf("unlink of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               if (!NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
+                       printf("unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                        correct = False;
                }
        }
@@ -1832,7 +1832,7 @@ static BOOL run_deferopen(struct cli_state *cli, int dummy)
 /*
 test how many open files this server supports on the one socket
 */
-static BOOL run_maxfidtest(struct cli_state *cli, int dummy)
+static BOOL run_maxfidtest(struct smbcli_state *cli, int dummy)
 {
        const char *template = "\\maxfid.%d.%d";
        char *fname;
@@ -1849,11 +1849,11 @@ static BOOL run_maxfidtest(struct cli_state *cli, int dummy)
 
        for (i=0; i<0x11000; i++) {
                asprintf(&fname, template, i,(int)getpid());
-               if ((fnums[i] = cli_open(cli->tree, fname, 
+               if ((fnums[i] = smbcli_open(cli->tree, fname, 
                                        O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) ==
                    -1) {
                        printf("open of %s failed (%s)\n", 
-                              fname, cli_errstr(cli->tree));
+                              fname, smbcli_errstr(cli->tree));
                        printf("maximum fnum is %d\n", i);
                        break;
                }
@@ -1866,12 +1866,12 @@ static BOOL run_maxfidtest(struct cli_state *cli, int dummy)
        printf("cleaning up\n");
        for (;i>=0;i--) {
                asprintf(&fname, template, i,(int)getpid());
-               if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnums[i]))) {
-                       printf("Close of fnum %d failed - %s\n", fnums[i], cli_errstr(cli->tree));
+               if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[i]))) {
+                       printf("Close of fnum %d failed - %s\n", fnums[i], smbcli_errstr(cli->tree));
                }
-               if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fname))) {
+               if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
                        printf("unlink of %s failed (%s)\n", 
-                              fname, cli_errstr(cli->tree));
+                              fname, smbcli_errstr(cli->tree));
                        correct = False;
                }
                free(fname);
@@ -1890,7 +1890,7 @@ static BOOL run_maxfidtest(struct cli_state *cli, int dummy)
 static BOOL run_negprot_nowait(int dummy)
 {
        int i;
-       struct cli_state *cli, *cli2;
+       struct smbcli_state *cli, *cli2;
        BOOL correct = True;
 
        printf("starting negprot nowait test\n");
@@ -1903,18 +1903,18 @@ static BOOL run_negprot_nowait(int dummy)
        printf("Filling send buffer\n");
 
        for (i=0;i<10000;i++) {
-               struct cli_request *req;
+               struct smbcli_request *req;
                time_t t1 = time(NULL);
                req = smb_negprot_send(cli->transport, PROTOCOL_NT1);
-               while (req->state == CLI_REQUEST_SEND && time(NULL) < t1+5) {
-                       cli_transport_process(cli->transport);
+               while (req->state == SMBCLI_REQUEST_SEND && time(NULL) < t1+5) {
+                       smbcli_transport_process(cli->transport);
                }
-               if (req->state == CLI_REQUEST_ERROR) {
+               if (req->state == SMBCLI_REQUEST_ERROR) {
                        printf("Failed to fill pipe - %s\n", nt_errstr(req->status));
                        torture_close_connection(cli);
                        return correct;
                }
-               if (req->state == CLI_REQUEST_SEND) {
+               if (req->state == SMBCLI_REQUEST_SEND) {
                        break;
                }
        }
@@ -1953,7 +1953,7 @@ static BOOL run_negprot_nowait(int dummy)
 */
 static BOOL run_attrtest(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int fnum;
        time_t t, t2;
        const char *fname = "\\attrib123456789.tst";
@@ -1965,13 +1965,13 @@ static BOOL run_attrtest(int dummy)
                return False;
        }
 
-       cli_unlink(cli->tree, fname);
-       fnum = cli_open(cli->tree, fname, 
+       smbcli_unlink(cli->tree, fname);
+       fnum = smbcli_open(cli->tree, fname, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
-       if (NT_STATUS_IS_ERR(cli_getatr(cli->tree, fname, NULL, NULL, &t))) {
-               printf("getatr failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, fname, NULL, NULL, &t))) {
+               printf("getatr failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        }
 
@@ -1988,13 +1988,13 @@ static BOOL run_attrtest(int dummy)
 
        printf("Setting file time to %s", ctime(&t2));
 
-       if (NT_STATUS_IS_ERR(cli_setatr(cli->tree, fname, 0, t2))) {
-               printf("setatr failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_setatr(cli->tree, fname, 0, t2))) {
+               printf("setatr failed (%s)\n", smbcli_errstr(cli->tree));
                correct = True;
        }
 
-       if (NT_STATUS_IS_ERR(cli_getatr(cli->tree, fname, NULL, NULL, &t))) {
-               printf("getatr failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, fname, NULL, NULL, &t))) {
+               printf("getatr failed (%s)\n", smbcli_errstr(cli->tree));
                correct = True;
        }
 
@@ -2007,7 +2007,7 @@ static BOOL run_attrtest(int dummy)
                correct = True;
        }
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        if (!torture_close_connection(cli)) {
                correct = False;
@@ -2024,7 +2024,7 @@ static BOOL run_attrtest(int dummy)
 */
 static BOOL run_trans2test(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int fnum;
        size_t size;
        time_t c_time, a_time, m_time, w_time, m_time2;
@@ -2040,22 +2040,22 @@ static BOOL run_trans2test(int dummy)
                return False;
        }
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        printf("Testing qfileinfo\n");
        
-       fnum = cli_open(cli->tree, fname, 
+       fnum = smbcli_open(cli->tree, fname, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
-       if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time,
+       if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time,
                           NULL, NULL))) {
-               printf("ERROR: qfileinfo failed (%s)\n", cli_errstr(cli->tree));
+               printf("ERROR: qfileinfo failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        }
 
        printf("Testing NAME_INFO\n");
 
-       if (NT_STATUS_IS_ERR(cli_qfilename(cli->tree, fnum, &pname))) {
-               printf("ERROR: qfilename failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_qfilename(cli->tree, fnum, &pname))) {
+               printf("ERROR: qfilename failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        }
 
@@ -2065,21 +2065,21 @@ static BOOL run_trans2test(int dummy)
                correct = False;
        }
 
-       cli_close(cli->tree, fnum);
-       cli_unlink(cli->tree, fname);
+       smbcli_close(cli->tree, fnum);
+       smbcli_unlink(cli->tree, fname);
 
-       fnum = cli_open(cli->tree, fname, 
+       fnum = smbcli_open(cli->tree, fname, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
        if (fnum == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                return False;
        }
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
        printf("Checking for sticky create times\n");
 
-       if (NT_STATUS_IS_ERR(cli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL))) {
-               printf("ERROR: qpathinfo failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL))) {
+               printf("ERROR: qpathinfo failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        } else {
                if (c_time != m_time) {
@@ -2100,12 +2100,12 @@ static BOOL run_trans2test(int dummy)
        }
 
 
-       cli_unlink(cli->tree, fname);
-       fnum = cli_open(cli->tree, fname, 
+       smbcli_unlink(cli->tree, fname);
+       fnum = smbcli_open(cli->tree, fname, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
-       cli_close(cli->tree, fnum);
-       if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
-               printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
+       smbcli_close(cli->tree, fnum);
+       if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
+               printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        } else {
                if (w_time < 60*60*24*2) {
@@ -2115,27 +2115,27 @@ static BOOL run_trans2test(int dummy)
                }
        }
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
 
        /* check if the server updates the directory modification time
            when creating a new file */
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, dname))) {
-               printf("ERROR: mkdir failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, dname))) {
+               printf("ERROR: mkdir failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        }
        sleep(3);
-       if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
-               printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
+               printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        }
 
-       fnum = cli_open(cli->tree, fname2, 
+       fnum = smbcli_open(cli->tree, fname2, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
-       cli_write(cli->tree, fnum,  0, (char *)&fnum, 0, sizeof(fnum));
-       cli_close(cli->tree, fnum);
-       if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) {
-               printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
+       smbcli_write(cli->tree, fnum,  0, (char *)&fnum, 0, sizeof(fnum));
+       smbcli_close(cli->tree, fnum);
+       if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) {
+               printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        } else {
                if (m_time2 == m_time) {
@@ -2143,8 +2143,8 @@ static BOOL run_trans2test(int dummy)
                        correct = False;
                }
        }
-       cli_unlink(cli->tree, fname2);
-       cli_rmdir(cli->tree, dname);
+       smbcli_unlink(cli->tree, fname2);
+       smbcli_rmdir(cli->tree, dname);
 
        if (!torture_close_connection(cli)) {
                correct = False;
@@ -2160,8 +2160,8 @@ static BOOL run_trans2test(int dummy)
  */
 static BOOL run_deletetest(int dummy)
 {
-       struct cli_state *cli1;
-       struct cli_state *cli2 = NULL;
+       struct smbcli_state *cli1;
+       struct smbcli_state *cli2 = NULL;
        const char *fname = "\\delete.file";
        int fnum1 = -1;
        int fnum2 = -1;
@@ -2175,26 +2175,26 @@ static BOOL run_deletetest(int dummy)
        
        /* Test 1 - this should delete the file on close. */
        
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF, 
                                   NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
        
        if (fnum1 == -1) {
-               printf("[1] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[1] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[1] close failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[1] close failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
        if (fnum1 != -1) {
                printf("[1] open of %s succeeded (should fail)\n", fname);
                correct = False;
@@ -2205,52 +2205,52 @@ static BOOL run_deletetest(int dummy)
        
        /* Test 2 - this should delete the file on close. */
        
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
                                   FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, 
                                   NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
        
        if (fnum1 == -1) {
-               printf("[2] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[2] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
-               printf("[2] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+               printf("[2] setting delete_on_close failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[2] close failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[2] close failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
        if (fnum1 != -1) {
                printf("[2] open of %s succeeded should have been deleted on close !\n", fname);
-               if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-                       printf("[2] close failed (%s)\n", cli_errstr(cli1->tree));
+               if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+                       printf("[2] close failed (%s)\n", smbcli_errstr(cli1->tree));
                        correct = False;
                        goto fail;
                }
-               cli_unlink(cli1->tree, fname);
+               smbcli_unlink(cli1->tree, fname);
        } else
                printf("second delete on close test succeeded.\n");
        
        /* Test 3 - ... */
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("[3] open - 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[3] open - 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
@@ -2258,7 +2258,7 @@ static BOOL run_deletetest(int dummy)
        /* This should fail with a sharing violation - open for delete is only compatible
           with SHARE_DELETE. */
 
-       fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, 
                                   NTCREATEX_DISP_OPEN, 0, 0);
 
@@ -2270,52 +2270,52 @@ static BOOL run_deletetest(int dummy)
 
        /* This should succeed. */
 
-       fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
                        NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN, 0, 0);
 
        if (fnum2 == -1) {
-               printf("[3] open  - 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[3] open  - 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
-       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
-               printf("[3] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+               printf("[3] setting delete_on_close failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[3] close 1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[3] close 1 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
-               printf("[3] close 2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) {
+               printf("[3] close 2 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
        /* This should fail - file should no longer be there. */
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
        if (fnum1 != -1) {
                printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
-               if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-                       printf("[3] close failed (%s)\n", cli_errstr(cli1->tree));
+               if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+                       printf("[3] close failed (%s)\n", smbcli_errstr(cli1->tree));
                }
-               cli_unlink(cli1->tree, fname);
+               smbcli_unlink(cli1->tree, fname);
                correct = False;
                goto fail;
        } else
                printf("third delete on close test succeeded.\n");
 
        /* Test 4 ... */
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, 
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, 
                                   SA_RIGHT_FILE_READ_DATA  | 
                                   SA_RIGHT_FILE_WRITE_DATA |
                                   STD_RIGHT_DELETE_ACCESS,
@@ -2324,38 +2324,38 @@ static BOOL run_deletetest(int dummy)
                                   NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
                                                                
        if (fnum1 == -1) {
-               printf("[4] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[4] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
        /* This should succeed. */
-       fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ,
+       fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ,
                                   FILE_ATTRIBUTE_NORMAL, 
                                   NTCREATEX_SHARE_ACCESS_READ  | 
                                   NTCREATEX_SHARE_ACCESS_WRITE |
                                   NTCREATEX_SHARE_ACCESS_DELETE, 
                                   NTCREATEX_DISP_OPEN, 0, 0);
        if (fnum2 == -1) {
-               printf("[4] open  - 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[4] open  - 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
-               printf("[4] close - 1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) {
+               printf("[4] close - 1 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
-               printf("[4] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+               printf("[4] setting delete_on_close failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
        /* This should fail - no more opens once delete on close set. */
-       fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ,
+       fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ,
                                   FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE,
                                   NTCREATEX_DISP_OPEN, 0, 0);
        if (fnum2 != -1) {
@@ -2365,33 +2365,33 @@ static BOOL run_deletetest(int dummy)
        } else
                printf("fourth delete on close test succeeded.\n");
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[4] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[4] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
        /* Test 5 ... */
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
        
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum1 == -1) {
-               printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[5] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
        /* This should fail - only allowed on NT opens with DELETE access. */
 
-       if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+       if (NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[5] setting delete_on_close on OpenX file succeeded - should fail !\n");
                correct = False;
                goto fail;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[5] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[5] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
@@ -2399,10 +2399,10 @@ static BOOL run_deletetest(int dummy)
        printf("fifth delete on close test succeeded.\n");
        
        /* Test 6 ... */
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, 
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, 
                                   SA_RIGHT_FILE_READ_DATA | SA_RIGHT_FILE_WRITE_DATA,
                                   FILE_ATTRIBUTE_NORMAL, 
                                   NTCREATEX_SHARE_ACCESS_READ  |
@@ -2411,21 +2411,21 @@ static BOOL run_deletetest(int dummy)
                                   NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
        
        if (fnum1 == -1) {
-               printf("[6] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[6] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
        /* This should fail - only allowed on NT opens with DELETE access. */
        
-       if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+       if (NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[6] setting delete_on_close on file with no delete access succeeded - should fail !\n");
                correct = False;
                goto fail;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[6] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[6] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
@@ -2433,50 +2433,50 @@ static BOOL run_deletetest(int dummy)
        printf("sixth delete on close test succeeded.\n");
        
        /* Test 7 ... */
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, 
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, 
                                   SA_RIGHT_FILE_READ_DATA  | 
                                   SA_RIGHT_FILE_WRITE_DATA |
                                   STD_RIGHT_DELETE_ACCESS,
                                   FILE_ATTRIBUTE_NORMAL, 0, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
                                                                
        if (fnum1 == -1) {
-               printf("[7] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[7] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
-       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+       if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[7] setting delete_on_close on file failed !\n");
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, False))) {
+       if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, False))) {
                printf("[7] unsetting delete_on_close on file failed !\n");
                correct = False;
                goto fail;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[7] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
        /* This next open should succeed - we reset the flag. */
        
-       fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
        if (fnum1 == -1) {
-               printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[5] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[7] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
@@ -2484,8 +2484,8 @@ static BOOL run_deletetest(int dummy)
        printf("seventh delete on close test succeeded.\n");
        
        /* Test 7 ... */
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
        
        if (!torture_open_connection(&cli2)) {
                printf("[8] failed to open second connection.\n");
@@ -2493,46 +2493,46 @@ static BOOL run_deletetest(int dummy)
                goto fail;
        }
 
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
                                   FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE,
                                   NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
        
        if (fnum1 == -1) {
-               printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[8] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
-       fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
+       fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
                                   FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE,
                                   NTCREATEX_DISP_OPEN, 0, 0);
        
        if (fnum2 == -1) {
-               printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[8] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
-       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+       if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[8] setting delete_on_close on file failed !\n");
                correct = False;
                goto fail;
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[8] close - 1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[8] close - 1 failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
-               printf("[8] close - 2 failed (%s)\n", cli_errstr(cli2->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+               printf("[8] close - 2 failed (%s)\n", smbcli_errstr(cli2->tree));
                correct = False;
                goto fail;
        }
 
        /* This should fail.. */
-       fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
        if (fnum1 != -1) {
                printf("[8] open of %s succeeded should have been deleted on close !\n", fname);
                goto fail;
@@ -2541,7 +2541,7 @@ static BOOL run_deletetest(int dummy)
                printf("eighth delete on close test succeeded.\n");
 
        /* This should fail - we need to set DELETE_ACCESS. */
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0,SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA,
                                   FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
        
        if (fnum1 != -1) {
@@ -2552,23 +2552,23 @@ static BOOL run_deletetest(int dummy)
 
        printf("ninth delete on close test succeeded.\n");
 
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
                                   FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
        if (fnum1 == -1) {
-               printf("[10] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("[10] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
        /* This should delete the file. */
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("[10] close failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("[10] close failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
        /* This should fail.. */
-       fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
        if (fnum1 != -1) {
                printf("[10] open of %s succeeded should have been deleted on close !\n", fname);
                goto fail;
@@ -2582,10 +2582,10 @@ static BOOL run_deletetest(int dummy)
         * intialized, because these functions don't handle
         * uninitialized connections. */
                
-       cli_close(cli1->tree, fnum1);
-       cli_close(cli1->tree, fnum2);
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_close(cli1->tree, fnum1);
+       smbcli_close(cli1->tree, fnum2);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
 
        if (!torture_close_connection(cli1)) {
                correct = False;
@@ -2602,7 +2602,7 @@ static BOOL run_deletetest(int dummy)
  */
 static BOOL run_properties(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        BOOL correct = True;
        
        printf("starting properties test\n");
@@ -2648,7 +2648,7 @@ static BOOL run_properties(int dummy)
  */
 static BOOL run_xcopy(int dummy)
 {
-       struct cli_state *cli1;
+       struct smbcli_state *cli1;
        const char *fname = "\\test.txt";
        BOOL correct = True;
        int fnum1, fnum2;
@@ -2659,22 +2659,22 @@ static BOOL run_xcopy(int dummy)
                return False;
        }
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
                                   FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 
                                   0x4044, 0);
 
        if (fnum1 == -1) {
-               printf("First open failed - %s\n", cli_errstr(cli1->tree));
+               printf("First open failed - %s\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       fnum2 = cli_nt_create_full(cli1->tree, fname, 0,
+       fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0,
                                   SECOND_DESIRED_ACCESS, 0,
                                   NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN, 
                                   0x200000, 0);
        if (fnum2 == -1) {
-               printf("second open failed - %s\n", cli_errstr(cli1->tree));
+               printf("second open failed - %s\n", smbcli_errstr(cli1->tree));
                return False;
        }
        
@@ -2690,7 +2690,7 @@ static BOOL run_xcopy(int dummy)
  */
 static BOOL run_rename(int dummy)
 {
-       struct cli_state *cli1;
+       struct smbcli_state *cli1;
        const char *fname = "\\test.txt";
        const char *fname1 = "\\test1.txt";
        BOOL correct = True;
@@ -2702,76 +2702,76 @@ static BOOL run_rename(int dummy)
                return False;
        }
        
-       cli_unlink(cli1->tree, fname);
-       cli_unlink(cli1->tree, fname1);
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
+       smbcli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname1);
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_READ, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("First open failed - %s\n", cli_errstr(cli1->tree));
+               printf("First open failed - %s\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
-               printf("First rename failed (this is correct) - %s\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_rename(cli1->tree, fname, fname1))) {
+               printf("First rename failed (this is correct) - %s\n", smbcli_errstr(cli1->tree));
        } else {
                printf("First rename succeeded - this should have failed !\n");
                correct = False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close - 1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close - 1 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       cli_unlink(cli1->tree, fname);
-       cli_unlink(cli1->tree, fname1);
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
+       smbcli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname1);
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_DELETE|NTCREATEX_SHARE_ACCESS_READ, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("Second open failed - %s\n", cli_errstr(cli1->tree));
+               printf("Second open failed - %s\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
-               printf("Second rename failed - this should have succeeded - %s\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_rename(cli1->tree, fname, fname1))) {
+               printf("Second rename failed - this should have succeeded - %s\n", smbcli_errstr(cli1->tree));
                correct = False;
        } else {
                printf("Second rename succeeded\n");
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       cli_unlink(cli1->tree, fname);
-       cli_unlink(cli1->tree, fname1);
+       smbcli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname1);
 
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("Third open failed - %s\n", cli_errstr(cli1->tree));
+               printf("Third open failed - %s\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
 
-       if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
-               printf("Third rename failed - this should have succeeded - %s\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_rename(cli1->tree, fname, fname1))) {
+               printf("Third rename failed - this should have succeeded - %s\n", smbcli_errstr(cli1->tree));
                correct = False;
        } else {
                printf("Third rename succeeded\n");
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close - 3 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close - 3 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
-       cli_unlink(cli1->tree, fname);
-       cli_unlink(cli1->tree, fname1);
+       smbcli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname1);
 
        if (!torture_close_connection(cli1)) {
                correct = False;
@@ -2786,7 +2786,7 @@ static BOOL run_rename(int dummy)
 */
 static BOOL run_pipe_number(int dummy)
 {
-       struct cli_state *cli1;
+       struct smbcli_state *cli1;
        const char *pipe_name = "\\WKSSVC";
        int fnum;
        int num_pipes = 0;
@@ -2797,11 +2797,11 @@ static BOOL run_pipe_number(int dummy)
        }
 
        while(1) {
-               fnum = cli_nt_create_full(cli1->tree, pipe_name, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
+               fnum = smbcli_nt_create_full(cli1->tree, pipe_name, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OPEN_IF, 0, 0);
 
                if (fnum == -1) {
-                       printf("Open of pipe %s failed with error (%s)\n", pipe_name, cli_errstr(cli1->tree));
+                       printf("Open of pipe %s failed with error (%s)\n", pipe_name, smbcli_errstr(cli1->tree));
                        break;
                }
                num_pipes++;
@@ -2825,12 +2825,12 @@ static BOOL run_pipe_number(int dummy)
  static BOOL torture_holdcon(int dummy)
 {
        int i;
-       struct cli_state **cli;
+       struct smbcli_state **cli;
        int num_dead = 0;
 
        printf("Opening %d connections\n", torture_numops);
        
-       cli = malloc(sizeof(struct cli_state *) * torture_numops);
+       cli = malloc(sizeof(struct smbcli_state *) * torture_numops);
 
        for (i=0;i<torture_numops;i++) {
                if (!torture_open_connection(&cli[i])) {
@@ -2846,7 +2846,7 @@ static BOOL run_pipe_number(int dummy)
                for (i=0;i<torture_numops;i++) {
                        NTSTATUS status;
                        if (cli[i]) {
-                               status = cli_chkpath(cli[i]->tree, "\\");
+                               status = smbcli_chkpath(cli[i]->tree, "\\");
                                if (!NT_STATUS_IS_OK(status)) {
                                        printf("Connection %d is dead\n", i);
                                        cli[i] = NULL;
@@ -2874,7 +2874,7 @@ static BOOL run_pipe_number(int dummy)
 
 static BOOL run_vuidtest(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        const char *fname = "\\vuid.tst";
        int fnum;
        size_t size;
@@ -2890,9 +2890,9 @@ static BOOL run_vuidtest(int dummy)
                return False;
        }
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
-       fnum = cli_open(cli->tree, fname, 
+       fnum = smbcli_open(cli->tree, fname, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
 
        orig_vuid = cli->session->vuid;
@@ -2901,7 +2901,7 @@ static BOOL run_vuidtest(int dummy)
 
        printf("Testing qfileinfo with wrong vuid\n");
        
-       if (NT_STATUS_IS_OK(result = cli_qfileinfo(cli->tree, fnum, NULL,
+       if (NT_STATUS_IS_OK(result = smbcli_qfileinfo(cli->tree, fnum, NULL,
                                                   &size, &c_time, &a_time,
                                                   &m_time, NULL, NULL))) {
                printf("ERROR: qfileinfo passed with wrong vuid\n");
@@ -2913,18 +2913,18 @@ static BOOL run_vuidtest(int dummy)
             (cli->transport->error.e.dos.ecode != ERRbaduid) ) {
                printf("ERROR: qfileinfo should have returned DOS error "
                       "ERRSRV:ERRbaduid\n  but returned %s\n",
-                      cli_errstr(cli->tree));
+                      smbcli_errstr(cli->tree));
                correct = False;
        }
 
        cli->session->vuid -= 1234;
 
-       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
-               printf("close failed (%s)\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+               printf("close failed (%s)\n", smbcli_errstr(cli->tree));
                correct = False;
        }
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
        if (!torture_close_connection(cli)) {
                correct = False;
@@ -2940,8 +2940,8 @@ static BOOL run_vuidtest(int dummy)
  */
  static BOOL run_opentest(int dummy)
 {
-       static struct cli_state *cli1;
-       static struct cli_state *cli2;
+       static struct smbcli_state *cli1;
+       static struct smbcli_state *cli2;
        const char *fname = "\\readonly.file";
        int fnum1, fnum2;
        char buf[20];
@@ -2956,35 +2956,35 @@ static BOOL run_vuidtest(int dummy)
                return False;
        }
        
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
        
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum1 == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close2 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
        
-       if (NT_STATUS_IS_ERR(cli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0))) {
-               printf("cli_setatr failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0))) {
+               printf("smbcli_setatr failed (%s)\n", smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test1);
                return False;
        }
        
-       fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
        if (fnum1 == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test1);
                return False;
        }
        
        /* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */
-       fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_ALL);
+       fnum2 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_ALL);
        
         if (check_error(__LINE__, cli1, ERRDOS, ERRnoaccess, 
                        NT_STATUS_ACCESS_DENIED)) {
@@ -2993,40 +2993,40 @@ static BOOL run_vuidtest(int dummy)
        
        printf("finished open test 1\n");
 error_test1:
-       cli_close(cli1->tree, fnum1);
+       smbcli_close(cli1->tree, fnum1);
        
        /* Now try not readonly and ensure ERRbadshare is returned. */
        
-       cli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
        
-       fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
        if (fnum1 == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
        
        /* This will fail - but the error should be ERRshare. */
-       fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_ALL);
+       fnum2 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_ALL);
        
        if (check_error(__LINE__, cli1, ERRDOS, ERRbadshare, 
                        NT_STATUS_SHARING_VIOLATION)) {
                printf("correct error code ERRDOS/ERRbadshare returned\n");
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close2 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
        
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
        
        printf("finished open test 2\n");
        
        /* Test truncate open disposition on file opened for read. */
        
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum1 == -1) {
-               printf("(3) open (1) of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("(3) open (1) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
        
@@ -3034,19 +3034,19 @@ error_test1:
        
        memset(buf, '\0', 20);
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) {
-               printf("write failed (%s)\n", cli_errstr(cli1->tree));
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) {
+               printf("write failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("(3) close1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("(3) close1 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
        
        /* Ensure size == 20. */
-       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
-               printf("(3) getatr failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
+               printf("(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test3);
                return False;
        }
@@ -3059,21 +3059,21 @@ error_test1:
 
        /* Now test if we can truncate a file opened for readonly. */
        
-       fnum1 = cli_open(cli1->tree, fname, O_RDONLY|O_TRUNC, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY|O_TRUNC, DENY_NONE);
        if (fnum1 == -1) {
-               printf("(3) open (2) of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("(3) open (2) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test3);
                return False;
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close2 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
 
        /* Ensure size == 0. */
-       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
-               printf("(3) getatr failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
+               printf("(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test3);
                return False;
        }
@@ -3085,22 +3085,22 @@ error_test1:
        }
        printf("finished open test 3\n");
 error_test3:   
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
 
        printf("testing ctemp\n");
-       fnum1 = cli_ctemp(cli1->tree, "\\", &tmp_path);
+       fnum1 = smbcli_ctemp(cli1->tree, "\\", &tmp_path);
        if (fnum1 == -1) {
-               printf("ctemp failed (%s)\n", cli_errstr(cli1->tree));
+               printf("ctemp failed (%s)\n", smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test4);
                return False;
        }
        printf("ctemp gave path %s\n", tmp_path);
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("close of temp failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("close of temp failed (%s)\n", smbcli_errstr(cli1->tree));
        }
-       if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, tmp_path))) {
-               printf("unlink of temp failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_unlink(cli1->tree, tmp_path))) {
+               printf("unlink of temp failed (%s)\n", smbcli_errstr(cli1->tree));
        }
 error_test4:   
        /* Test the non-io opens... */
@@ -3109,165 +3109,165 @@ error_test4:
                return False;
        }
        
-       cli_setatr(cli2->tree, fname, 0, 0);
-       cli_unlink(cli2->tree, fname);
+       smbcli_setatr(cli2->tree, fname, 0, 0);
+       smbcli_unlink(cli2->tree, fname);
        
        printf("TEST #1 testing 2 non-io opens (no delete)\n");
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("test 1 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("test 1 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test10);
                return False;
        }
 
-       fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
        if (fnum2 == -1) {
-               printf("test 1 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("test 1 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                CHECK_MAX_FAILURES(error_test10);
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
-               printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+               printf("test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                return False;
        }
 
        printf("non-io open test #1 passed.\n");
 error_test10:
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
        printf("TEST #2 testing 2 non-io opens (first with delete)\n");
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("test 2 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("test 2 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test20);
                return False;
        }
 
-       fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
 
        if (fnum2 == -1) {
-               printf("test 2 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("test 2 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                CHECK_MAX_FAILURES(error_test20);
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
-               printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+               printf("test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
 
        printf("non-io open test #2 passed.\n");
 error_test20:
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
        printf("TEST #3 testing 2 non-io opens (second with delete)\n");
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("test 3 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("test 3 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test30);
                return False;
        }
 
-       fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
 
        if (fnum2 == -1) {
-               printf("test 3 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("test 3 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                CHECK_MAX_FAILURES(error_test30);
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("test 3 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("test 3 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
-               printf("test 3 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+               printf("test 3 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                return False;
        }
 
        printf("non-io open test #3 passed.\n");
 error_test30:
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
        printf("TEST #4 testing 2 non-io opens (both with delete)\n");
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("test 4 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("test 4 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test40);
                return False;
        }
 
-       fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
 
        if (fnum2 != -1) {
-               printf("test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                CHECK_MAX_FAILURES(error_test40);
                return False;
        }
 
-       printf("test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2->tree), "sharing violation");
+       printf("test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation");
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("test 4 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("test 4 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
 
        printf("non-io open test #4 passed.\n");
 error_test40:
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
        printf("TEST #5 testing 2 non-io opens (both with delete - both with file share delete)\n");
        
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("test 5 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("test 5 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test50);
                return False;
        }
 
-       fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN_IF, 0, 0);
 
        if (fnum2 == -1) {
-               printf("test 5 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("test 5 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                CHECK_MAX_FAILURES(error_test50);
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("test 5 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("test 5 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
-               printf("test 5 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+               printf("test 5 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                return False;
        }
 
@@ -3275,33 +3275,33 @@ error_test40:
 error_test50:
        printf("TEST #6 testing 1 non-io open, one io open\n");
        
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("test 6 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("test 6 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test60);
                return False;
        }
 
-       fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_READ, NTCREATEX_DISP_OPEN_IF, 0, 0);
 
        if (fnum2 == -1) {
-               printf("test 6 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("test 6 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                CHECK_MAX_FAILURES(error_test60);
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("test 6 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("test 6 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
-               printf("test 6 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+               printf("test 6 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                return False;
        }
 
@@ -3309,30 +3309,30 @@ error_test50:
 error_test60:
        printf("TEST #7 testing 1 non-io open, one io open with delete\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
+       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
        if (fnum1 == -1) {
-               printf("test 7 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("test 7 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test70);
                return False;
        }
 
-       fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+       fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
                                   NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN_IF, 0, 0);
 
        if (fnum2 != -1) {
-               printf("test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2->tree));
+               printf("test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree));
                CHECK_MAX_FAILURES(error_test70);
                return False;
        }
 
-       printf("test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2->tree), "sharing violation");
+       printf("test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation");
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("test 7 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("test 7 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
 
@@ -3342,11 +3342,11 @@ error_test70:
 
        printf("TEST #8 testing one normal open, followed by lock, followed by open with truncate\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
-       fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
        if (fnum1 == -1) {
-               printf("(8) open (1) of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("(8) open (1) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
        
@@ -3354,14 +3354,14 @@ error_test70:
        
        memset(buf, '\0', 20);
 
-       if (cli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) {
-               printf("(8) write failed (%s)\n", cli_errstr(cli1->tree));
+       if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) {
+               printf("(8) write failed (%s)\n", smbcli_errstr(cli1->tree));
                correct = False;
        }
 
        /* Ensure size == 20. */
-       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
-               printf("(8) getatr (1) failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
+               printf("(8) getatr (1) failed (%s)\n", smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test80);
                return False;
        }
@@ -3373,21 +3373,21 @@ error_test70:
        }
 
        /* Get an exclusive lock on the open file. */
-       if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
-               printf("(8) lock1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
+               printf("(8) lock1 failed (%s)\n", smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test80);
                return False;
        }
 
-       fnum2 = cli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE);
+       fnum2 = smbcli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE);
        if (fnum1 == -1) {
-               printf("(8) open (2) of %s with truncate failed (%s)\n", fname, cli_errstr(cli1->tree));
+               printf("(8) open (2) of %s with truncate failed (%s)\n", fname, smbcli_errstr(cli1->tree));
                return False;
        }
 
        /* Ensure size == 0. */
-       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
-               printf("(8) getatr (2) failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
+               printf("(8) getatr (2) failed (%s)\n", smbcli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test80);
                return False;
        }
@@ -3398,13 +3398,13 @@ error_test70:
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-               printf("(8) close1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+               printf("(8) close1 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
        
-       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
-               printf("(8) close1 failed (%s)\n", cli_errstr(cli1->tree));
+       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) {
+               printf("(8) close1 failed (%s)\n", smbcli_errstr(cli1->tree));
                return False;
        }
        
@@ -3412,7 +3412,7 @@ error_test80:
 
        printf("open test #8 passed.\n");
 
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
 
        if (!torture_close_connection(cli1)) {
                correct = False;
@@ -3483,7 +3483,7 @@ static struct trunc_open_results attr_results[] = {
 
 static BOOL run_openattrtest(int dummy)
 {
-       struct cli_state *cli1;
+       struct smbcli_state *cli1;
        const char *fname = "\\openattr.file";
        int fnum1;
        BOOL correct = True;
@@ -3498,23 +3498,23 @@ static BOOL run_openattrtest(int dummy)
        }
        
        for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32_t); i++) {
-               cli_setatr(cli1->tree, fname, 0, 0);
-               cli_unlink(cli1->tree, fname);
-               fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_WRITE_DATA, open_attrs_table[i],
+               smbcli_setatr(cli1->tree, fname, 0, 0);
+               smbcli_unlink(cli1->tree, fname);
+               fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_WRITE_DATA, open_attrs_table[i],
                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
 
                if (fnum1 == -1) {
-                       printf("open %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1->tree));
+                       printf("open %d (1) of %s failed (%s)\n", i, fname, smbcli_errstr(cli1->tree));
                        return False;
                }
 
-               if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-                       printf("close %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1->tree));
+               if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+                       printf("close %d (1) of %s failed (%s)\n", i, fname, smbcli_errstr(cli1->tree));
                        return False;
                }
 
                for (j = 0; j < ARRAY_SIZE(open_attrs_table); j++) {
-                       fnum1 = cli_nt_create_full(cli1->tree, fname, 0, 
+                       fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, 
                                                   SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA, 
                                                   open_attrs_table[j],
                                                   NTCREATEX_SHARE_ACCESS_NONE, 
@@ -3526,15 +3526,15 @@ static BOOL run_openattrtest(int dummy)
                                                printf("[%d] trunc open 0x%x -> 0x%x of %s failed - should have succeeded !(0x%x:%s)\n",
                                                                k, open_attrs_table[i],
                                                                open_attrs_table[j],
-                                                               fname, NT_STATUS_V(cli_nt_error(cli1->tree)), cli_errstr(cli1->tree));
+                                                               fname, NT_STATUS_V(smbcli_nt_error(cli1->tree)), smbcli_errstr(cli1->tree));
                                                correct = False;
                                                CHECK_MAX_FAILURES(error_exit);
                                        }
                                }
-                               if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_ACCESS_DENIED)) {
+                               if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_ACCESS_DENIED)) {
                                        printf("[%d] trunc open 0x%x -> 0x%x failed with wrong error code %s\n",
                                                        k, open_attrs_table[i], open_attrs_table[j],
-                                                       cli_errstr(cli1->tree));
+                                                       smbcli_errstr(cli1->tree));
                                        correct = False;
                                        CHECK_MAX_FAILURES(error_exit);
                                }
@@ -3545,13 +3545,13 @@ static BOOL run_openattrtest(int dummy)
                                continue;
                        }
 
-                       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
-                               printf("close %d (2) of %s failed (%s)\n", j, fname, cli_errstr(cli1->tree));
+                       if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+                               printf("close %d (2) of %s failed (%s)\n", j, fname, smbcli_errstr(cli1->tree));
                                return False;
                        }
 
-                       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, &attr, NULL, NULL))) {
-                               printf("getatr(2) failed (%s)\n", cli_errstr(cli1->tree));
+                       if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, &attr, NULL, NULL))) {
+                               printf("getatr(2) failed (%s)\n", smbcli_errstr(cli1->tree));
                                return False;
                        }
 
@@ -3580,8 +3580,8 @@ static BOOL run_openattrtest(int dummy)
                }
        }
 error_exit:
-       cli_setatr(cli1->tree, fname, 0, 0);
-       cli_unlink(cli1->tree, fname);
+       smbcli_setatr(cli1->tree, fname, 0, 0);
+       smbcli_unlink(cli1->tree, fname);
 
        printf("open attr test %s.\n", correct ? "passed" : "failed");
 
@@ -3602,7 +3602,7 @@ static void list_fn(file_info *finfo, const char *name, void *state)
 static BOOL run_dirtest(int dummy)
 {
        int i;
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int fnum;
        double t1;
        BOOL correct = True;
@@ -3619,20 +3619,20 @@ static BOOL run_dirtest(int dummy)
        for (i=0;i<torture_numops;i++) {
                char *fname;
                asprintf(&fname, "\\%x", (int)random());
-               fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+               fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
                if (fnum == -1) {
                        fprintf(stderr,"Failed to open %s\n", fname);
                        return False;
                }
-               cli_close(cli->tree, fnum);
+               smbcli_close(cli->tree, fnum);
                free(fname);
        }
 
        t1 = end_timer();
 
-       printf("Matched %d\n", cli_list(cli->tree, "a*.*", 0, list_fn, NULL));
-       printf("Matched %d\n", cli_list(cli->tree, "b*.*", 0, list_fn, NULL));
-       printf("Matched %d\n", cli_list(cli->tree, "xyzabc", 0, list_fn, NULL));
+       printf("Matched %d\n", smbcli_list(cli->tree, "a*.*", 0, list_fn, NULL));
+       printf("Matched %d\n", smbcli_list(cli->tree, "b*.*", 0, list_fn, NULL));
+       printf("Matched %d\n", smbcli_list(cli->tree, "xyzabc", 0, list_fn, NULL));
 
        printf("dirtest core %g seconds\n", end_timer() - t1);
 
@@ -3640,7 +3640,7 @@ static BOOL run_dirtest(int dummy)
        for (i=0;i<torture_numops;i++) {
                char *fname;
                asprintf(&fname, "\\%x", (int)random());
-               cli_unlink(cli->tree, fname);
+               smbcli_unlink(cli->tree, fname);
                free(fname);
        }
 
@@ -3658,7 +3658,7 @@ static BOOL run_dirtest(int dummy)
  */
 BOOL torture_ioctl_test(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        uint16_t device, function;
        int fnum;
        const char *fname = "\\ioctl.dat";
@@ -3674,11 +3674,11 @@ BOOL torture_ioctl_test(int dummy)
 
        printf("starting ioctl test\n");
 
-       cli_unlink(cli->tree, fname);
+       smbcli_unlink(cli->tree, fname);
 
-       fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum == -1) {
-               printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+               printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -3686,7 +3686,7 @@ BOOL torture_ioctl_test(int dummy)
        parms.ioctl.in.fnum = fnum;
        parms.ioctl.in.request = IOCTL_QUERY_JOB_INFO;
        status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
-       printf("ioctl job info: %s\n", cli_errstr(cli->tree));
+       printf("ioctl job info: %s\n", smbcli_errstr(cli->tree));
 
        for (device=0;device<0x100;device++) {
                printf("testing device=0x%x\n", device);
@@ -3714,7 +3714,7 @@ BOOL torture_ioctl_test(int dummy)
  */
 BOOL torture_chkpath_test(int dummy)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int fnum;
        BOOL ret;
 
@@ -3727,38 +3727,38 @@ BOOL torture_chkpath_test(int dummy)
        printf("Testing valid and invalid paths\n");
 
        /* cleanup from an old run */
-       cli_rmdir(cli->tree, "\\chkpath.dir\\dir2");
-       cli_unlink(cli->tree, "\\chkpath.dir\\*");
-       cli_rmdir(cli->tree, "\\chkpath.dir");
+       smbcli_rmdir(cli->tree, "\\chkpath.dir\\dir2");
+       smbcli_unlink(cli->tree, "\\chkpath.dir\\*");
+       smbcli_rmdir(cli->tree, "\\chkpath.dir");
 
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\chkpath.dir"))) {
-               printf("mkdir1 failed : %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\chkpath.dir"))) {
+               printf("mkdir1 failed : %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\chkpath.dir\\dir2"))) {
-               printf("mkdir2 failed : %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\chkpath.dir\\dir2"))) {
+               printf("mkdir2 failed : %s\n", smbcli_errstr(cli->tree));
                return False;
        }
 
-       fnum = cli_open(cli->tree, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+       fnum = smbcli_open(cli->tree, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
        if (fnum == -1) {
-               printf("open1 failed (%s)\n", cli_errstr(cli->tree));
+               printf("open1 failed (%s)\n", smbcli_errstr(cli->tree));
                return False;
        }
-       cli_close(cli->tree, fnum);
+       smbcli_close(cli->tree, fnum);
 
-       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir"))) {
-               printf("chkpath1 failed: %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir"))) {
+               printf("chkpath1 failed: %s\n", smbcli_errstr(cli->tree));
                ret = False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\dir2"))) {
-               printf("chkpath2 failed: %s\n", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\dir2"))) {
+               printf("chkpath2 failed: %s\n", smbcli_errstr(cli->tree));
                ret = False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt"))) {
+       if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt"))) {
                ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath, 
                                  NT_STATUS_NOT_A_DIRECTORY);
        } else {
@@ -3766,7 +3766,7 @@ BOOL torture_chkpath_test(int dummy)
                ret = False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt"))) {
+       if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt"))) {
                ret = check_error(__LINE__, cli, ERRDOS, ERRbadfile, 
                                  NT_STATUS_OBJECT_NAME_NOT_FOUND);
        } else {
@@ -3774,7 +3774,7 @@ BOOL torture_chkpath_test(int dummy)
                ret = False;
        }
 
-       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt"))) {
+       if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt"))) {
                ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath, 
                                  NT_STATUS_OBJECT_PATH_NOT_FOUND);
        } else {
@@ -3782,9 +3782,9 @@ BOOL torture_chkpath_test(int dummy)
                ret = False;
        }
 
-       cli_rmdir(cli->tree, "\\chkpath.dir\\dir2");
-       cli_unlink(cli->tree, "\\chkpath.dir\\*");
-       cli_rmdir(cli->tree, "\\chkpath.dir");
+       smbcli_rmdir(cli->tree, "\\chkpath.dir\\dir2");
+       smbcli_unlink(cli->tree, "\\chkpath.dir\\*");
+       smbcli_rmdir(cli->tree, "\\chkpath.dir");
 
        if (!torture_close_connection(cli)) {
                return False;
@@ -3796,7 +3796,7 @@ BOOL torture_chkpath_test(int dummy)
 static BOOL run_dirtest1(int dummy)
 {
        int i;
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int fnum, num_seen;
        BOOL correct = True;
 
@@ -3806,12 +3806,12 @@ static BOOL run_dirtest1(int dummy)
                return False;
        }
 
-       if (cli_deltree(cli->tree, "\\LISTDIR") == -1) {
-               fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, "\\LISTDIR") == -1) {
+               fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", smbcli_errstr(cli->tree));
                return False;
        }
-       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\LISTDIR"))) {
-               fprintf(stderr,"Failed to mkdir %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree));
+       if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\LISTDIR"))) {
+               fprintf(stderr,"Failed to mkdir %s, error=%s\n", "\\LISTDIR", smbcli_errstr(cli->tree));
                return False;
        }
 
@@ -3821,27 +3821,27 @@ static BOOL run_dirtest1(int dummy)
        for (i=0;i<torture_entries;i++) {
                char *fname;
                asprintf(&fname, "\\LISTDIR\\f%d", i);
-               fnum = cli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
+               fnum = smbcli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
                                   NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
                if (fnum == -1) {
-                       fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree));
+                       fprintf(stderr,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree));
                        return False;
                }
                free(fname);
-               cli_close(cli->tree, fnum);
+               smbcli_close(cli->tree, fnum);
        }
        for (i=0;i<torture_entries;i++) {
                char *fname;
                asprintf(&fname, "\\LISTDIR\\d%d", i);
-               if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, fname))) {
-                       fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree));
+               if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) {
+                       fprintf(stderr,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree));
                        return False;
                }
                free(fname);
        }
 
        /* Now ensure that doing an old list sees both files and directories. */
-       num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
+       num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
        printf("num_seen = %d\n", num_seen );
        /* We should see (torture_entries) each of files & directories + . and .. */
        if (num_seen != (2*torture_entries)+2) {
@@ -3854,7 +3854,7 @@ static BOOL run_dirtest1(int dummy)
        /* Ensure if we have the "must have" bits we only see the
         * relevant entries.
         */
-       num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
+       num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
        printf("num_seen = %d\n", num_seen );
        if (num_seen != torture_entries+2) {
                correct = False;
@@ -3862,7 +3862,7 @@ static BOOL run_dirtest1(int dummy)
                        torture_entries+2, num_seen);
        }
 
-       num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
+       num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
        printf("num_seen = %d\n", num_seen );
        if (num_seen != torture_entries) {
                correct = False;
@@ -3871,15 +3871,15 @@ static BOOL run_dirtest1(int dummy)
        }
 
        /* Delete everything. */
-       if (cli_deltree(cli->tree, "\\LISTDIR") == -1) {
-               fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree));
+       if (smbcli_deltree(cli->tree, "\\LISTDIR") == -1) {
+               fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", smbcli_errstr(cli->tree));
                return False;
        }
 
 #if 0
-       printf("Matched %d\n", cli_list(cli->tree, "a*.*", 0, list_fn, NULL));
-       printf("Matched %d\n", cli_list(cli->tree, "b*.*", 0, list_fn, NULL));
-       printf("Matched %d\n", cli_list(cli->tree, "xyzabc", 0, list_fn, NULL));
+       printf("Matched %d\n", smbcli_list(cli->tree, "a*.*", 0, list_fn, NULL));
+       printf("Matched %d\n", smbcli_list(cli->tree, "b*.*", 0, list_fn, NULL));
+       printf("Matched %d\n", smbcli_list(cli->tree, "xyzabc", 0, list_fn, NULL));
 #endif
 
        if (!torture_close_connection(cli)) {
@@ -3897,7 +3897,7 @@ static BOOL run_dirtest1(int dummy)
  */
 static BOOL run_deny3test(int dummy)
 {
-       struct cli_state *cli1, *cli2;
+       struct smbcli_state *cli1, *cli2;
        int fnum1, fnum2;
        const char *fname;
 
@@ -3914,23 +3914,23 @@ static BOOL run_deny3test(int dummy)
 
        fname = "\\deny_dos1.dat";
 
-       cli_unlink(cli1->tree, fname);
-       fnum1 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
-       fnum2 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
-       if (fnum1 != -1) cli_close(cli1->tree, fnum1);
-       if (fnum2 != -1) cli_close(cli1->tree, fnum2);
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
+       fnum1 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
+       fnum2 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
+       if (fnum1 != -1) smbcli_close(cli1->tree, fnum1);
+       if (fnum2 != -1) smbcli_close(cli1->tree, fnum2);
+       smbcli_unlink(cli1->tree, fname);
        printf("fnum1=%d fnum2=%d\n", fnum1, fnum2);
 
 
        fname = "\\deny_dos2.dat";
 
-       cli_unlink(cli1->tree, fname);
-       fnum1 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
-       fnum2 = cli_open(cli2->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
-       if (fnum1 != -1) cli_close(cli1->tree, fnum1);
-       if (fnum2 != -1) cli_close(cli2->tree, fnum2);
-       cli_unlink(cli1->tree, fname);
+       smbcli_unlink(cli1->tree, fname);
+       fnum1 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
+       fnum2 = smbcli_open(cli2->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
+       if (fnum1 != -1) smbcli_close(cli1->tree, fnum1);
+       if (fnum2 != -1) smbcli_close(cli2->tree, fnum2);
+       smbcli_unlink(cli1->tree, fname);
        printf("fnum1=%d fnum2=%d\n", fnum1, fnum2);
 
 
@@ -3968,7 +3968,7 @@ static void sigcont(void)
 {
 }
 
-double torture_create_procs(BOOL (*fn)(struct cli_state *, int), BOOL *result)
+double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result)
 {
        int i, status;
        volatile pid_t *child_status;
index 33bfddd7229923a8caf8412f1ede8044d427c883..bb7f6eb4c28e7effb05d646f02ce2cb7db5b1e34 100644 (file)
@@ -39,7 +39,7 @@ double end_timer(void)
 /*
   create a directory, returning a handle to it
 */
-int create_directory_handle(struct cli_tree *tree, const char *dname)
+int create_directory_handle(struct smbcli_tree *tree, const char *dname)
 {
        NTSTATUS status;
        union smb_open io;
@@ -74,7 +74,7 @@ int create_directory_handle(struct cli_tree *tree, const char *dname)
   sometimes we need a fairly complex file to work with, so we can test
   all possible attributes. 
 */
-int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *fname)
+int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname)
 {
        int fnum;
        char buf[7] = "abc";
@@ -83,8 +83,8 @@ int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *
        time_t t = (time(NULL) & ~1);
        NTSTATUS status;
 
-       cli_unlink(cli->tree, fname);
-       fnum = cli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+       smbcli_unlink(cli->tree, fname);
+       fnum = smbcli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
                                  FILE_ATTRIBUTE_NORMAL,
                                  NTCREATEX_SHARE_ACCESS_DELETE|
                                  NTCREATEX_SHARE_ACCESS_READ|
@@ -93,7 +93,7 @@ int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *
                                  0, 0);
        if (fnum == -1) return -1;
 
-       cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
+       smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
 
        /* setup some EAs */
        setfile.generic.level = RAW_SFILEINFO_EA_SET;
@@ -242,7 +242,7 @@ void dump_all_info(TALLOC_CTX *mem_ctx, union smb_fileinfo *finfo)
 /*
   dump file infor by name
 */
-void torture_all_info(struct cli_tree *tree, const char *fname)
+void torture_all_info(struct smbcli_tree *tree, const char *fname)
 {
        TALLOC_CTX *mem_ctx = talloc_init(fname);
        union smb_fileinfo finfo;
@@ -304,7 +304,7 @@ BOOL split_username(const char *pair, char **user, char **pass)
 /*
   set a attribute on a file
 */
-BOOL torture_set_file_attribute(struct cli_tree *tree, const char *fname, uint16_t attrib)
+BOOL torture_set_file_attribute(struct smbcli_tree *tree, const char *fname, uint16_t attrib)
 {
        union smb_setfileinfo sfinfo;
        NTSTATUS status;
@@ -322,7 +322,7 @@ BOOL torture_set_file_attribute(struct cli_tree *tree, const char *fname, uint16
 /*
   set a file descriptor as sparse
 */
-NTSTATUS torture_set_sparse(struct cli_tree *tree, int fnum)
+NTSTATUS torture_set_sparse(struct smbcli_tree *tree, int fnum)
 {
        union smb_ioctl nt;
        NTSTATUS status;
index 5ccc50242fbb246a01aecdd7f6ce6f528b20c9ff..6db62ea6b04dd75195baddaad41fc238c01b5c53 100644 (file)
@@ -105,7 +105,7 @@ int net_run_function(int argc, const char **argv, struct functable *table,
 /****************************************************************************
 connect to \\server\ipc$  
 ****************************************************************************/
-NTSTATUS connect_to_ipc(struct cli_state **c, struct in_addr *server_ip,
+NTSTATUS connect_to_ipc(struct smbcli_state **c, struct in_addr *server_ip,
                                        const char *server_name)
 {
        NTSTATUS nt_status;
@@ -117,7 +117,7 @@ NTSTATUS connect_to_ipc(struct cli_state **c, struct in_addr *server_ip,
                }
        }
        
-       nt_status = cli_full_connection(c, opt_requester_name, server_name, 
+       nt_status = smbcli_full_connection(c, opt_requester_name, server_name, 
                                        server_ip, opt_port,
                                        "IPC$", "IPC",  
                                        opt_user_name, opt_workgroup,
@@ -142,12 +142,12 @@ NTSTATUS connect_to_ipc(struct cli_state **c, struct in_addr *server_ip,
 /****************************************************************************
 connect to \\server\ipc$ anonymously
 ****************************************************************************/
-NTSTATUS connect_to_ipc_anonymous(struct cli_state **c,
+NTSTATUS connect_to_ipc_anonymous(struct smbcli_state **c,
                        struct in_addr *server_ip, const char *server_name)
 {
        NTSTATUS nt_status;
 
-       nt_status = cli_full_connection(c, opt_requester_name, server_name, 
+       nt_status = smbcli_full_connection(c, opt_requester_name, server_name, 
                                        server_ip, opt_port,
                                        "IPC$", "IPC",  
                                        "", "",
@@ -248,11 +248,11 @@ BOOL net_find_dc(struct in_addr *server_ip, fstring server_name, const char *dom
 }
 
 
-struct cli_state *net_make_ipc_connection(uint_t flags)
+struct smbcli_state *net_make_ipc_connection(uint_t flags)
 {
        char *server_name = NULL;
        struct in_addr server_ip;
-       struct cli_state *cli = NULL;
+       struct smbcli_state *cli = NULL;
        NTSTATUS nt_status;
 
        if (!net_find_server(flags, &server_ip, &server_name)) {
index 9febb694a9d42885e4fe1c70d5cea1419183125c..f7bfdcac3b940abd604e49040dad810a45d6176c 100644 (file)
@@ -768,7 +768,7 @@ static int net_ads_printer_publish(int argc, const char **argv)
         ADS_STRUCT *ads;
         ADS_STATUS rc;
        const char *servername;
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        struct in_addr          server_ip;
        NTSTATUS nt_status;
        TALLOC_CTX *mem_ctx = talloc_init("net_ads_printer_publish");
@@ -793,15 +793,15 @@ static int net_ads_printer_publish(int argc, const char **argv)
 
        resolve_name(servername, &server_ip, 0x20);
 
-       nt_status = cli_full_connection(&cli, lp_netbios_name(), servername, 
+       nt_status = smbcli_full_connection(&cli, lp_netbios_name(), servername, 
                                        &server_ip, 0,
                                        "IPC$", "IPC",  
                                        opt_user_name, opt_workgroup,
                                        opt_password ? opt_password : "", 
-                                       CLI_FULL_CONNECTION_USE_KERBEROS, 
+                                       SMBCLI_FULL_CONNECTION_USE_KERBEROS, 
                                        NULL);
 
-       cli_nt_session_open(cli, PI_SPOOLSS);
+       smbcli_nt_session_open(cli, PI_SPOOLSS);
        get_remote_printer_publishing_data(cli, mem_ctx, &mods, argv[0]);
 
         rc = ads_add_printer_entry(ads, prt_dn, mem_ctx, &mods);
index c97b9dc9c11477f8139040b2de796ce247e3aea8..77875d373308d45b0d91beb7de4ea5fcf6705342 100644 (file)
@@ -77,7 +77,7 @@ static void one_file_fn(const char *pPath, const char *pUser, uint16_t perms,
 
 static int rap_file_close(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        if (argc == 0) {
                d_printf("\nMissing fileid of file to close\n\n");
@@ -87,14 +87,14 @@ static int rap_file_close(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0))) 
                 return -1;
 
-       ret = cli_NetFileClose(cli, atoi(argv[0]));
-       cli_shutdown(cli);
+       ret = smbcli_NetFileClose(cli, atoi(argv[0]));
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_file_info(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        if (argc == 0)
                return net_rap_file_usage(argc, argv);
@@ -102,8 +102,8 @@ static int rap_file_info(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0))) 
                 return -1;
 
-       ret = cli_NetFileGetInfo(cli, atoi(argv[0]), one_file_fn);
-       cli_shutdown(cli);
+       ret = smbcli_NetFileGetInfo(cli, atoi(argv[0]), one_file_fn);
+       smbcli_shutdown(cli);
        return ret;
 }
 
@@ -126,7 +126,7 @@ int net_rap_file(int argc, const char **argv)
        };
        
        if (argc == 0) {
-               struct cli_state *cli;
+               struct smbcli_state *cli;
                int ret;
                
                if (!(cli = net_make_ipc_connection(0))) 
@@ -137,8 +137,8 @@ int net_rap_file(int argc, const char **argv)
                 "\nEnumerating open files on remote server:\n\n"\
                 "\nFileId  Opened by            Perms  Locks  Path \n"\
                 "------  ---------            -----  -----  ---- \n");
-               ret = cli_NetFileEnum(cli, NULL, NULL, file_fn);
-               cli_shutdown(cli);
+               ret = smbcli_NetFileEnum(cli, NULL, NULL, file_fn);
+               smbcli_shutdown(cli);
                return ret;
        }
        
@@ -165,7 +165,7 @@ static void share_fn(const char *share_name, uint32_t type,
 
 static int rap_share_delete(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (argc == 0) {
@@ -176,14 +176,14 @@ static int rap_share_delete(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0))) 
                 return -1;
 
-       ret = cli_NetShareDelete(cli, argv[0]);
-       cli_shutdown(cli);
+       ret = smbcli_NetShareDelete(cli, argv[0]);
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_share_add(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        RAP_SHARE_INFO_2 sinfo;
@@ -212,8 +212,8 @@ static int rap_share_add(int argc, const char **argv)
        memset(sinfo.password, '\0', sizeof(sinfo.password));
        sinfo.reserved2 = '\0';
        
-       ret = cli_NetShareAdd(cli, &sinfo);
-       cli_shutdown(cli);
+       ret = smbcli_NetShareAdd(cli, &sinfo);
+       smbcli_shutdown(cli);
        return ret;
 }
 
@@ -228,7 +228,7 @@ int net_rap_share(int argc, const char **argv)
        };
 
        if (argc == 0) {
-               struct cli_state *cli;
+               struct smbcli_state *cli;
                int ret;
                
                if (!(cli = net_make_ipc_connection(0))) 
@@ -239,10 +239,10 @@ int net_rap_share(int argc, const char **argv)
        "\nEnumerating shared resources (exports) on remote server:\n\n"\
        "\nShare name   Type     Description\n"\
        "----------   ----     -----------\n");
-                       ret = cli_RNetShareEnum(cli, long_share_fn, NULL);
+                       ret = smbcli_RNetShareEnum(cli, long_share_fn, NULL);
                }
-               ret = cli_RNetShareEnum(cli, share_fn, NULL);
-               cli_shutdown(cli);
+               ret = smbcli_RNetShareEnum(cli, share_fn, NULL);
+               smbcli_shutdown(cli);
                return ret;
        }
 
@@ -310,7 +310,7 @@ static void display_conns_func(uint16_t conn_id, uint16_t conn_type, uint16_t op
 static int rap_session_info(int argc, const char **argv)
 {
        const char *sessname;
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (!(cli = net_make_ipc_connection(0))) 
@@ -321,22 +321,22 @@ static int rap_session_info(int argc, const char **argv)
 
        sessname = argv[0];
 
-       ret = cli_NetSessionGetInfo(cli, sessname, display_session_func);
+       ret = smbcli_NetSessionGetInfo(cli, sessname, display_session_func);
        if (ret < 0) {
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                 return ret;
        }
 
        d_printf("Share name     Type     # Opens\n-------------------------"\
                 "-----------------------------------------------------\n");
-       ret = cli_NetConnectionEnum(cli, sessname, display_conns_func);
-       cli_shutdown(cli);
+       ret = smbcli_NetConnectionEnum(cli, sessname, display_conns_func);
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_session_delete(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (!(cli = net_make_ipc_connection(0))) 
@@ -345,8 +345,8 @@ static int rap_session_delete(int argc, const char **argv)
        if (argc == 0) 
                 return net_rap_session_usage(argc, argv);
 
-       ret = cli_NetSessionDel(cli, argv[0]);
-       cli_shutdown(cli);
+       ret = smbcli_NetSessionDel(cli, argv[0]);
+       smbcli_shutdown(cli);
        return ret;
 }
 
@@ -360,7 +360,7 @@ int net_rap_session(int argc, const char **argv)
        };
 
        if (argc == 0) {
-               struct cli_state *cli;
+               struct smbcli_state *cli;
                int ret;
                
                if (!(cli = net_make_ipc_connection(0))) 
@@ -370,9 +370,9 @@ int net_rap_session(int argc, const char **argv)
                         "Client Type        Opens Idle time\n"\
                         "------------------------------------------"\
                         "------------------------------------\n");
-               ret = cli_NetSessionEnum(cli, list_sessions_func);
+               ret = smbcli_NetSessionEnum(cli, list_sessions_func);
 
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return ret;
        }
 
@@ -402,7 +402,7 @@ int net_rap_server_usage(int argc, const char **argv)
                    
 int net_rap_server(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (!(cli = net_make_ipc_connection(0))) 
@@ -412,9 +412,9 @@ int net_rap_server(int argc, const char **argv)
                 "\tServer name          Server description\n"\
                 "\t-------------        ----------------------------\n");
 
-       ret = cli_NetServerEnum(cli, cli->server_domain, SV_TYPE_ALL, 
+       ret = smbcli_NetServerEnum(cli, cli->server_domain, SV_TYPE_ALL, 
                                display_server_func,NULL); 
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
        return ret;     
 }
                      
@@ -430,7 +430,7 @@ int net_rap_domain_usage(int argc, const char **argv)
                  
 int net_rap_domain(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (!(cli = net_make_ipc_connection(0))) 
@@ -440,9 +440,9 @@ int net_rap_domain(int argc, const char **argv)
                 "\tDomain name          Server name of Browse Master\n"\
                 "\t-------------        ----------------------------\n");
 
-       ret = cli_NetServerEnum(cli, cli->server_domain, SV_TYPE_DOMAIN_ENUM,
+       ret = smbcli_NetServerEnum(cli, cli->server_domain, SV_TYPE_DOMAIN_ENUM,
                                display_server_func,NULL);      
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
        return ret;     
 }
                      
@@ -525,7 +525,7 @@ static void enum_jobs(uint16_t jobid, const char *ownername,
 
 static int rap_printq_info(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (argc == 0) 
@@ -535,14 +535,14 @@ static int rap_printq_info(int argc, const char **argv)
                 return -1;
 
        d_printf(PRINTQ_ENUM_DISPLAY, cli->desthost); /* list header */
-       ret = cli_NetPrintQGetInfo(cli, argv[0], enum_queue, enum_jobs);
-       cli_shutdown(cli);
+       ret = smbcli_NetPrintQGetInfo(cli, argv[0], enum_queue, enum_jobs);
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_printq_delete(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (argc == 0) 
@@ -551,14 +551,14 @@ static int rap_printq_delete(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0))) 
                 return -1;
 
-       ret = cli_printjob_del(cli, atoi(argv[0]));
-       cli_shutdown(cli);
+       ret = smbcli_printjob_del(cli, atoi(argv[0]));
+       smbcli_shutdown(cli);
        return ret;
 }
 
 int net_rap_printq(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        struct functable func[] = {
@@ -572,8 +572,8 @@ int net_rap_printq(int argc, const char **argv)
                        return -1;
 
                d_printf(PRINTQ_ENUM_DISPLAY, cli->desthost); /* list header */
-               ret = cli_NetPrintQEnum(cli, enum_queue, enum_jobs);
-               cli_shutdown(cli);
+               ret = smbcli_NetPrintQEnum(cli, enum_queue, enum_jobs);
+               smbcli_shutdown(cli);
                return ret;
        }
 
@@ -608,7 +608,7 @@ static void group_member_fn(const char *user_name, void *state)
 
 static int rap_user_delete(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (argc == 0) {
@@ -619,14 +619,14 @@ static int rap_user_delete(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0))) 
                 return -1;
 
-       ret = cli_NetUserDelete(cli, argv[0]);
-       cli_shutdown(cli);
+       ret = smbcli_NetUserDelete(cli, argv[0]);
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_user_add(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        RAP_USER_INFO_1 userinfo;
 
@@ -649,15 +649,15 @@ static int rap_user_add(int argc, const char **argv)
        userinfo.home_dir = NULL;
        userinfo.logon_script = NULL;
 
-       ret = cli_NetUserAdd(cli, &userinfo);
+       ret = smbcli_NetUserAdd(cli, &userinfo);
 
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_user_info(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        if (argc == 0) {
                d_printf("\n\nUser name not specified\n");
@@ -667,8 +667,8 @@ static int rap_user_info(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0)))
                 return -1;
 
-       ret = cli_NetUserGetGroups(cli, argv[0], group_member_fn, NULL);
-       cli_shutdown(cli);
+       ret = smbcli_NetUserGetGroups(cli, argv[0], group_member_fn, NULL);
+       smbcli_shutdown(cli);
        return ret;
 }
 
@@ -683,18 +683,18 @@ int net_rap_user(int argc, const char **argv)
        };
 
        if (argc == 0) {
-               struct cli_state *cli;
+               struct smbcli_state *cli;
                if (!(cli = net_make_ipc_connection(0)))
                         goto done;
                if (opt_long_list_entries) {
                        d_printf("\nUser name             Comment"\
                                 "\n-----------------------------\n");
-                       ret = cli_RNetUserEnum(cli, long_user_fn, NULL);
-                       cli_shutdown(cli);
+                       ret = smbcli_RNetUserEnum(cli, long_user_fn, NULL);
+                       smbcli_shutdown(cli);
                        goto done;
                }
-               ret = cli_RNetUserEnum(cli, user_fn, NULL); 
-               cli_shutdown(cli);
+               ret = smbcli_RNetUserEnum(cli, user_fn, NULL); 
+               smbcli_shutdown(cli);
                goto done;
        }
 
@@ -725,7 +725,7 @@ static void group_fn(const char *group_name, const char *comment, void *state)
 
 static int rap_group_delete(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        if (argc == 0) {
                d_printf("\n\nGroup name not specified\n");
@@ -735,14 +735,14 @@ static int rap_group_delete(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0)))
                 return -1;
 
-       ret = cli_NetGroupDelete(cli, argv[0]);
-       cli_shutdown(cli);
+       ret = smbcli_NetGroupDelete(cli, argv[0]);
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_group_add(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        RAP_GROUP_INFO_1 grinfo;
 
@@ -759,8 +759,8 @@ static int rap_group_add(int argc, const char **argv)
        grinfo.reserved1 = '\0';
        grinfo.comment = smb_xstrdup(opt_comment);
        
-       ret = cli_NetGroupAdd(cli, &grinfo);
-       cli_shutdown(cli);
+       ret = smbcli_NetGroupAdd(cli, &grinfo);
+       smbcli_shutdown(cli);
        return ret;
 }
 
@@ -773,19 +773,19 @@ int net_rap_group(int argc, const char **argv)
        };
 
        if (argc == 0) {
-               struct cli_state *cli;
+               struct smbcli_state *cli;
                int ret;
                if (!(cli = net_make_ipc_connection(0)))
                         return -1;
                if (opt_long_list_entries) {
                        d_printf("Group name            Comment\n");
                        d_printf("-----------------------------\n");
-                       ret = cli_RNetGroupEnum(cli, long_group_fn, NULL);
-                       cli_shutdown(cli);
+                       ret = smbcli_RNetGroupEnum(cli, long_group_fn, NULL);
+                       smbcli_shutdown(cli);
                        return ret;
                }
-               ret = cli_RNetGroupEnum(cli, group_fn, NULL); 
-               cli_shutdown(cli);
+               ret = smbcli_RNetGroupEnum(cli, group_fn, NULL); 
+               smbcli_shutdown(cli);
                return ret;
        }
 
@@ -809,7 +809,7 @@ int net_rap_groupmember_usage(int argc, const char **argv)
 
 static int rap_groupmember_add(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        if (argc != 2) {
                d_printf("\n\nGroup or user name not specified\n");
@@ -819,14 +819,14 @@ static int rap_groupmember_add(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0)))
                 return -1;
 
-       ret = cli_NetGroupAddUser(cli, argv[0], argv[1]);
-       cli_shutdown(cli);
+       ret = smbcli_NetGroupAddUser(cli, argv[0], argv[1]);
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_groupmember_delete(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        if (argc != 2) {
                d_printf("\n\nGroup or user name not specified\n");
@@ -836,14 +836,14 @@ static int rap_groupmember_delete(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0)))
                 return -1;
 
-       ret = cli_NetGroupDelUser(cli, argv[0], argv[1]);
-       cli_shutdown(cli);
+       ret = smbcli_NetGroupDelUser(cli, argv[0], argv[1]);
+       smbcli_shutdown(cli);
        return ret;
 }
 
 static int rap_groupmember_list(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        if (argc == 0) {
                d_printf("\n\nGroup name not specified\n");
@@ -853,8 +853,8 @@ static int rap_groupmember_list(int argc, const char **argv)
        if (!(cli = net_make_ipc_connection(0)))
                 return -1;
 
-       ret = cli_NetGroupGetUsers(cli, argv[0], group_member_fn, NULL ); 
-       cli_shutdown(cli);
+       ret = smbcli_NetGroupGetUsers(cli, argv[0], group_member_fn, NULL ); 
+       smbcli_shutdown(cli);
        return ret;
 }
 
@@ -918,7 +918,7 @@ int net_rap_service(int argc, const char **argv)
        };
 
        if (argc == 0) {
-               struct cli_state *cli;
+               struct smbcli_state *cli;
                int ret;
                if (!(cli = net_make_ipc_connection(0))) 
                        return -1;
@@ -926,10 +926,10 @@ int net_rap_service(int argc, const char **argv)
                if (opt_long_list_entries) {
                        d_printf("Service name          Comment\n");
                        d_printf("-----------------------------\n");
-                       ret = cli_RNetServiceEnum(cli, long_group_fn, NULL);
+                       ret = smbcli_RNetServiceEnum(cli, long_group_fn, NULL);
                }
-               ret = cli_RNetServiceEnum(cli, group_fn, NULL); 
-               cli_shutdown(cli);
+               ret = smbcli_RNetServiceEnum(cli, group_fn, NULL); 
+               smbcli_shutdown(cli);
                return ret;
        }
 
@@ -948,7 +948,7 @@ int net_rap_password_usage(int argc, const char **argv)
 
 int net_rap_password(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        int ret;
        
        if (argc < 3) 
@@ -958,8 +958,8 @@ int net_rap_password(int argc, const char **argv)
                 return -1;
 
        /* BB Add check for password lengths? */
-       ret = cli_oem_change_password(cli, argv[0], argv[2], argv[1]);
-       cli_shutdown(cli);
+       ret = smbcli_oem_change_password(cli, argv[0], argv[2], argv[1]);
+       smbcli_shutdown(cli);
        return ret;
 }
 
index fb42493a8bdff82a7a7e0da39300d114c1fbb563..2d1120e882c4c01bcfb267004224add573bd1db4 100644 (file)
 
 
 /* A function of this type is passed to the 'run_rpc_command' wrapper */
-typedef NTSTATUS (*rpc_command_fn)(const DOM_SID *, struct cli_state *, TALLOC_CTX *, int, const char **);
+typedef NTSTATUS (*rpc_command_fn)(const DOM_SID *, struct smbcli_state *, TALLOC_CTX *, int, const char **);
 
 /**
  * Many of the RPC functions need the domain sid.  This function gets
  *  it at the start of every run 
  *
- * @param cli A cli_state already connected to the remote machine
+ * @param cli A smbcli_state already connected to the remote machine
  *
  * @return The Domain SID of the remote machine.
  **/
 
-static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
+static DOM_SID *net_get_remote_domain_sid(struct smbcli_state *cli)
 {
        DOM_SID *domain_sid;
        POLICY_HND pol;
@@ -69,26 +69,26 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
        }
 
 
-       if (!cli_nt_session_open (cli, PI_LSARPC)) {
+       if (!smbcli_nt_session_open (cli, PI_LSARPC)) {
                fprintf(stderr, "could not initialise lsa pipe\n");
                goto error;
        }
        
-       result = cli_lsa_open_policy(cli, mem_ctx, True, 
+       result = smbcli_lsa_open_policy(cli, mem_ctx, True, 
                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
                                     &pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto error;
        }
 
-       result = cli_lsa_query_info_policy(cli, mem_ctx, &pol, info_class, 
+       result = smbcli_lsa_query_info_policy(cli, mem_ctx, &pol, info_class, 
                                           domain_name, domain_sid);
        if (!NT_STATUS_IS_OK(result)) {
                goto error;
        }
 
-       cli_lsa_close(cli, mem_ctx, &pol);
-       cli_nt_session_close(cli);
+       smbcli_lsa_close(cli, mem_ctx, &pol);
+       smbcli_nt_session_close(cli);
        talloc_destroy(mem_ctx);
 
        return domain_sid;
@@ -115,20 +115,20 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
  * @return A shell status integer (0 for success)
  */
 
-static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int conn_flags,
+static int run_rpc_command(struct smbcli_state *smbcli_arg, const int pipe_idx, int conn_flags,
                            rpc_command_fn fn,
                            int argc, const char **argv) 
 {
-       struct cli_state *cli = NULL;
+       struct smbcli_state *cli = NULL;
        TALLOC_CTX *mem_ctx;
        NTSTATUS nt_status;
        DOM_SID *domain_sid;
 
-       /* make use of cli_state handed over as an argument, if possible */
-       if (!cli_arg)
+       /* make use of smbcli_state handed over as an argument, if possible */
+       if (!smbcli_arg)
                cli = net_make_ipc_connection(conn_flags);
        else
-               cli = cli_arg;
+               cli = smbcli_arg;
 
        if (!cli) {
                return -1;
@@ -140,11 +140,11 @@ static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int co
        
        if (!(mem_ctx = talloc_init("run_rpc_command"))) {
                DEBUG(0, ("talloc_init() failed\n"));
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return -1;
        }
        
-       if (!cli_nt_session_open(cli, pipe_idx)) {
+       if (!smbcli_nt_session_open(cli, pipe_idx)) {
                DEBUG(0, ("Could not initialise pipe\n"));
        }
        
@@ -158,11 +158,11 @@ static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int co
                
            
        if (cli->nt_pipe_fnum)
-               cli_nt_session_close(cli);
+               smbcli_nt_session_close(cli);
        
        /* close the connection only if it was opened here */
-       if (!cli_arg)
-               cli_shutdown(cli);
+       if (!smbcli_arg)
+               smbcli_shutdown(cli);
        
        talloc_destroy(mem_ctx);
 
@@ -180,7 +180,7 @@ static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int co
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid aquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on compleation of the function.
  * @param argc  Standard main() style argc
  * @param argc  Standard main() style argv.  Initial components are already
@@ -189,7 +189,7 @@ static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int co
  * @return Normal NTSTATUS return.
  **/
 
-static NTSTATUS rpc_changetrustpw_internals(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx, 
+static NTSTATUS rpc_changetrustpw_internals(const DOM_SID *domain_sid, struct smbcli_state *cli, TALLOC_CTX *mem_ctx, 
                                       int argc, const char **argv) {
        
        return trust_pw_find_change_and_store_it(cli, mem_ctx, opt_target_workgroup);
@@ -226,7 +226,7 @@ static int rpc_changetrustpw(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid aquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on compleation of the function.
  * @param argc  Standard main() style argc
  * @param argc  Standard main() style argv.  Initial components are already
@@ -235,7 +235,7 @@ static int rpc_changetrustpw(int argc, const char **argv)
  * @return Normal NTSTATUS return.
  **/
 
-static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx, 
+static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct smbcli_state *cli, TALLOC_CTX *mem_ctx, 
                                       int argc, const char **argv) {
        
        fstring trust_passwd;
@@ -335,7 +335,7 @@ int net_rpc_join(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -345,7 +345,7 @@ int net_rpc_join(int argc, const char **argv)
  **/
 
 static NTSTATUS 
-rpc_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_info_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                   TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        POLICY_HND connect_pol, domain_pol;
@@ -356,14 +356,14 @@ rpc_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        sid_to_string(sid_str, domain_sid);
 
        /* Get sam policy handle */     
-       result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
+       result = smbcli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
                                  &connect_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
        
        /* Get domain policy handle */
-       result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+       result = smbcli_samr_open_domain(cli, mem_ctx, &connect_pol,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      domain_sid, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
@@ -371,7 +371,7 @@ rpc_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        }
 
        ZERO_STRUCT(ctr);
-       result = cli_samr_query_dom_info(cli, mem_ctx, &domain_pol,
+       result = smbcli_samr_query_dom_info(cli, mem_ctx, &domain_pol,
                                         2, &ctr);
        if (NT_STATUS_IS_OK(result)) {
                TALLOC_CTX *ctx = talloc_init("rpc_info_internals");
@@ -410,7 +410,7 @@ int net_rpc_info(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -420,7 +420,7 @@ int net_rpc_info(int argc, const char **argv)
  **/
 
 static NTSTATUS 
-rpc_getsid_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_getsid_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                   TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        fstring sid_str;
@@ -473,7 +473,7 @@ static int rpc_user_usage(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -482,7 +482,7 @@ static int rpc_user_usage(int argc, const char **argv)
  * @return Normal NTSTATUS return.
  **/
 
-static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx, 
+static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid, struct smbcli_state *cli, TALLOC_CTX *mem_ctx, 
                                       int argc, const char **argv) {
        
        POLICY_HND connect_pol, domain_pol, user_pol;
@@ -501,7 +501,7 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid, struct cli_sta
 
        /* Get sam policy handle */
        
-       result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
+       result = smbcli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
                                  &connect_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -509,7 +509,7 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid, struct cli_sta
        
        /* Get domain policy handle */
        
-       result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+       result = smbcli_samr_open_domain(cli, mem_ctx, &connect_pol,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      domain_sid, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
@@ -521,7 +521,7 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid, struct cli_sta
        acb_info = ACB_NORMAL;
        unknown = 0xe005000b; /* No idea what this is - a permission mask? */
 
-       result = cli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
+       result = smbcli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
                                          acct_name, acb_info, unknown,
                                          &user_pol, &user_rid);
        if (!NT_STATUS_IS_OK(result)) {
@@ -561,7 +561,7 @@ static int rpc_user_add(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -571,7 +571,7 @@ static int rpc_user_add(int argc, const char **argv)
  **/
 
 static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid, 
-                                      struct cli_state *cli, 
+                                      struct smbcli_state *cli, 
                                       TALLOC_CTX *mem_ctx, 
                                       int argc, const char **argv)
 {
@@ -585,14 +585,14 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
        }
        /* Get sam policy and domain handles */
 
-       result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
+       result = smbcli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
                                  &connect_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+       result = smbcli_samr_open_domain(cli, mem_ctx, &connect_pol,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      domain_sid, &domain_pol);
 
@@ -606,7 +606,7 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
                uint32_t *user_rids, num_rids, *name_types;
                uint32_t flags = 0x000003e8; /* Unknown */
 
-               result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol,
+               result = smbcli_samr_lookup_names(cli, mem_ctx, &domain_pol,
                                               flags, 1, &argv[0],
                                               &num_rids, &user_rids,
                                               &name_types);
@@ -615,7 +615,7 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
                        goto done;
                }
 
-               result = cli_samr_open_user(cli, mem_ctx, &domain_pol,
+               result = smbcli_samr_open_user(cli, mem_ctx, &domain_pol,
                                            MAXIMUM_ALLOWED_ACCESS,
                                            user_rids[0], &user_pol);
 
@@ -626,7 +626,7 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
 
        /* Delete user */
 
-       result = cli_samr_delete_dom_user(cli, mem_ctx, &user_pol);
+       result = smbcli_samr_delete_dom_user(cli, mem_ctx, &user_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -662,7 +662,7 @@ static int rpc_user_delete(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -672,7 +672,7 @@ static int rpc_user_delete(int argc, const char **argv)
  **/
 
 static NTSTATUS 
-rpc_user_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_user_info_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                        TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        POLICY_HND connect_pol, domain_pol, user_pol;
@@ -690,31 +690,31 @@ rpc_user_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        }
        /* Get sam policy handle */
        
-       result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
+       result = smbcli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
                                  &connect_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
        
        /* Get domain policy handle */
        
-       result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+       result = smbcli_samr_open_domain(cli, mem_ctx, &connect_pol,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      domain_sid, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
        /* Get handle on user */
 
-       result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol,
+       result = smbcli_samr_lookup_names(cli, mem_ctx, &domain_pol,
                                       flags, 1, &argv[0],
                                       &num_rids, &rids, &name_types);
 
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = cli_samr_open_user(cli, mem_ctx, &domain_pol,
+       result = smbcli_samr_open_user(cli, mem_ctx, &domain_pol,
                                    MAXIMUM_ALLOWED_ACCESS,
                                    rids[0], &user_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = cli_samr_query_usergroups(cli, mem_ctx, &user_pol,
+       result = smbcli_samr_query_usergroups(cli, mem_ctx, &user_pol,
                                           &num_rids, &user_gids);
 
        /* Look up rids */
@@ -724,7 +724,7 @@ rpc_user_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        for (i = 0; i < num_rids; i++)
                 rids[i] = user_gids[i].g_rid;
 
-       result = cli_samr_lookup_rids(cli, mem_ctx, &domain_pol,
+       result = smbcli_samr_lookup_rids(cli, mem_ctx, &domain_pol,
                                      flags, num_rids, rids,
                                      &num_names, &names, &name_types);
 
@@ -764,7 +764,7 @@ static int rpc_user_info(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -774,7 +774,7 @@ static int rpc_user_info(int argc, const char **argv)
  **/
 
 static NTSTATUS 
-rpc_user_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_user_list_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                        TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        POLICY_HND connect_pol, domain_pol;
@@ -785,7 +785,7 @@ rpc_user_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
 
        /* Get sam policy handle */
        
-       result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
+       result = smbcli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
                                  &connect_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -793,7 +793,7 @@ rpc_user_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        
        /* Get domain policy handle */
        
-       result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+       result = smbcli_samr_open_domain(cli, mem_ctx, &connect_pol,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      domain_sid, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
@@ -814,7 +814,7 @@ rpc_user_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
                get_query_dispinfo_params(
                        loop_count, &max_entries, &max_size);
 
-               result = cli_samr_query_dispinfo(cli, mem_ctx, &domain_pol,
+               result = smbcli_samr_query_dispinfo(cli, mem_ctx, &domain_pol,
                                                 &start_idx, 1, &num_entries,
                                                 max_entries, max_size, &ctr);
                loop_count++;
@@ -885,7 +885,7 @@ static int rpc_group_usage(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -895,7 +895,7 @@ static int rpc_group_usage(int argc, const char **argv)
  **/
 
 static NTSTATUS 
-rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_group_list_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                         TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        POLICY_HND connect_pol, domain_pol;
@@ -908,7 +908,7 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
 
        /* Get sam policy handle */
        
-       result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
+       result = smbcli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
                                  &connect_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -916,7 +916,7 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        
        /* Get domain policy handle */
        
-       result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+       result = smbcli_samr_open_domain(cli, mem_ctx, &connect_pol,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      domain_sid, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
@@ -928,7 +928,7 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
                d_printf("\nGroup name            Comment"\
                         "\n-----------------------------\n");
        do {
-               result = cli_samr_enum_dom_groups(cli, mem_ctx, &domain_pol,
+               result = smbcli_samr_enum_dom_groups(cli, mem_ctx, &domain_pol,
                                                  &start_idx, max_entries,
                                                  &groups, &num_entries);
                                                 
@@ -943,7 +943,7 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        } while (!NT_STATUS_IS_OK(result));
        /* query domain aliases */
        do {
-               result = cli_samr_enum_als_groups(cli, mem_ctx, &domain_pol,
+               result = smbcli_samr_enum_als_groups(cli, mem_ctx, &domain_pol,
                                                  &start_idx, max_entries,
                                                  &groups, &num_entries);
                                                 
@@ -956,10 +956,10 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
                                printf("%-21.21s\n", groups[i].acct_name);
                }
        } while (!NT_STATUS_IS_OK(result));
-       cli_samr_close(cli, mem_ctx, &domain_pol);
+       smbcli_samr_close(cli, mem_ctx, &domain_pol);
        /* Get builtin policy handle */
        
-       result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+       result = smbcli_samr_open_domain(cli, mem_ctx, &connect_pol,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      &global_sid_Builtin, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
@@ -967,7 +967,7 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        }
        /* query builtin aliases */
        do {
-               result = cli_samr_enum_als_groups(cli, mem_ctx, &domain_pol,
+               result = smbcli_samr_enum_als_groups(cli, mem_ctx, &domain_pol,
                                                  &start_idx, max_entries,
                                                  &groups, &num_entries);
                                                 
@@ -1028,7 +1028,7 @@ static int rpc_share_usage(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -1037,7 +1037,7 @@ static int rpc_share_usage(int argc, const char **argv)
  * @return Normal NTSTATUS return.
  **/
 static NTSTATUS 
-rpc_share_add_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_share_add_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                        TALLOC_CTX *mem_ctx,int argc, const char **argv)
 {
        WERROR result;
@@ -1052,7 +1052,7 @@ rpc_share_add_internals(const DOM_SID *domain_sid, struct cli_state *cli,
                return NT_STATUS_UNSUCCESSFUL;
        *path++ = '\0';
 
-       result = cli_srvsvc_net_share_add(cli, mem_ctx, sharename, type,
+       result = smbcli_srvsvc_net_share_add(cli, mem_ctx, sharename, type,
                                          opt_comment, perms, opt_maxusers,
                                          num_users, path, password);
        return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
@@ -1076,7 +1076,7 @@ static int rpc_share_add(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -1085,12 +1085,12 @@ static int rpc_share_add(int argc, const char **argv)
  * @return Normal NTSTATUS return.
  **/
 static NTSTATUS 
-rpc_share_del_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_share_del_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                        TALLOC_CTX *mem_ctx,int argc, const char **argv)
 {
        WERROR result;
 
-       result = cli_srvsvc_net_share_del(cli, mem_ctx, argv[0]);
+       result = smbcli_srvsvc_net_share_del(cli, mem_ctx, argv[0]);
        return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
 }
 
@@ -1144,7 +1144,7 @@ static void display_share_info_1(SRV_SHARE_INFO_1 *info1)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -1154,7 +1154,7 @@ static void display_share_info_1(SRV_SHARE_INFO_1 *info1)
  **/
 
 static NTSTATUS 
-rpc_share_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_share_list_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                         TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        SRV_SHARE_INFO_CTR ctr;
@@ -1164,7 +1164,7 @@ rpc_share_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
 
        init_enum_hnd(&hnd, 0);
 
-       result = cli_srvsvc_net_share_enum(
+       result = smbcli_srvsvc_net_share_enum(
                cli, mem_ctx, 1, &ctr, preferred_len, &hnd);
 
        if (!W_ERROR_IS_OK(result))
@@ -1221,7 +1221,7 @@ static int rpc_file_usage(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -1230,11 +1230,11 @@ static int rpc_file_usage(int argc, const char **argv)
  * @return Normal NTSTATUS return.
  **/
 static NTSTATUS 
-rpc_file_close_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_file_close_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                         TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        WERROR result;
-       result = cli_srvsvc_net_file_close(cli, mem_ctx, atoi(argv[0]));
+       result = smbcli_srvsvc_net_file_close(cli, mem_ctx, atoi(argv[0]));
        return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
 }
 
@@ -1284,7 +1284,7 @@ static void display_file_info_3(FILE_INFO_3 *info3, FILE_INFO_3_STR *str3)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -1294,7 +1294,7 @@ static void display_file_info_3(FILE_INFO_3 *info3, FILE_INFO_3_STR *str3)
  **/
 
 static NTSTATUS 
-rpc_file_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+rpc_file_list_internals(const DOM_SID *domain_sid, struct smbcli_state *cli,
                        TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        SRV_FILE_INFO_CTR ctr;
@@ -1309,7 +1309,7 @@ rpc_file_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
        if (argc > 0)
                username = smb_xstrdup(argv[0]);
                
-       result = cli_srvsvc_net_file_enum(
+       result = smbcli_srvsvc_net_file_enum(
                cli, mem_ctx, 3, username, &ctr, preferred_len, &hnd);
 
        if (!W_ERROR_IS_OK(result))
@@ -1388,7 +1388,7 @@ int net_rpc_file(int argc, const char **argv)
  * argc, argv which are passed through. 
  *
  * @param domain_sid The domain sid aquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on compleation of the function.
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
@@ -1397,12 +1397,12 @@ int net_rpc_file(int argc, const char **argv)
  * @return Normal NTSTATUS return.
  **/
 
-static NTSTATUS rpc_shutdown_abort_internals(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx, 
+static NTSTATUS rpc_shutdown_abort_internals(const DOM_SID *domain_sid, struct smbcli_state *cli, TALLOC_CTX *mem_ctx, 
                                             int argc, const char **argv) 
 {
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        
-       result = cli_reg_abort_shutdown(cli, mem_ctx);
+       result = smbcli_reg_abort_shutdown(cli, mem_ctx);
        
        if (NT_STATUS_IS_OK(result))
                DEBUG(5,("cmd_reg_abort_shutdown: query succeeded\n"));
@@ -1436,7 +1436,7 @@ static int rpc_shutdown_abort(int argc, const char **argv)
  * argc, argv which are passes through. 
  *
  * @param domain_sid The domain sid aquired from the remote server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on compleation of the function.
  * @param argc  Standard main() style argc
  * @param argc  Standard main() style argv.  Initial components are already
@@ -1445,7 +1445,7 @@ static int rpc_shutdown_abort(int argc, const char **argv)
  * @return Normal NTSTATUS return.
  **/
 
-static NTSTATUS rpc_shutdown_internals(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx, 
+static NTSTATUS rpc_shutdown_internals(const DOM_SID *domain_sid, struct smbcli_state *cli, TALLOC_CTX *mem_ctx, 
                                       int argc, const char **argv) 
 {
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
@@ -1484,7 +1484,7 @@ static NTSTATUS rpc_shutdown_internals(const DOM_SID *domain_sid, struct cli_sta
        }
 
        /* create an entry */
-       result = cli_reg_shutdown(cli, mem_ctx, msg, timeout, opt_reboot, opt_force);
+       result = smbcli_reg_shutdown(cli, mem_ctx, msg, timeout, opt_reboot, opt_force);
 
        if (NT_STATUS_IS_OK(result))
                DEBUG(5,("Shutdown of remote machine succeeded\n"));
@@ -1521,7 +1521,7 @@ static int rpc_shutdown(int argc, const char **argv)
  * function.
  *
  * @param domain_sid The domain sid acquired from the server
- * @param cli A cli_state connected to the server.
+ * @param cli A smbcli_state connected to the server.
  * @param mem_ctx Talloc context, destoyed on completion of the function.
  * @param argc  Standard main() style argc
  * @param argc  Standard main() style argv.  Initial components are already
@@ -1530,7 +1530,7 @@ static int rpc_shutdown(int argc, const char **argv)
  * @return normal NTSTATUS return code
  */
 
-static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx, 
+static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, struct smbcli_state *cli, TALLOC_CTX *mem_ctx, 
                                            int argc, const char **argv) {
 
        POLICY_HND connect_pol, domain_pol, user_pol;
@@ -1555,14 +1555,14 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, struct cli
        strupper(acct_name);
 
        /* Get samr policy handle */
-       result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
+       result = smbcli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
                                  &connect_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
        
        /* Get domain policy handle */
-       result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+       result = smbcli_samr_open_domain(cli, mem_ctx, &connect_pol,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      domain_sid, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
@@ -1574,7 +1574,7 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, struct cli
        unknown = 0xe005000b; /* No idea what this is - a permission mask?
                                 mimir: yes, most probably it is */
 
-       result = cli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
+       result = smbcli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
                                          acct_name, acb_info, unknown,
                                          &user_pol, &user_rid);
        if (!NT_STATUS_IS_OK(result)) {
@@ -1630,7 +1630,7 @@ static int rpc_trustdom_del(int argc, const char **argv)
 
 static int rpc_trustdom_establish(int argc, const char **argv)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        struct in_addr server_ip;
        POLICY_HND connect_hnd;
        TALLOC_CTX *mem_ctx;
@@ -1699,7 +1699,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
         * Use NetServerEnum2 to make sure we're talking to a proper server
         */
         
-       if (!cli_get_pdc_name(cli, domain_name, (char*)pdc_name)) {
+       if (!smbcli_get_pdc_name(cli, domain_name, (char*)pdc_name)) {
                DEBUG(0, ("NetServerEnum2 error: Couldn't find primary domain controller\
                         for domain %s\n", domain_name));
        }
@@ -1709,7 +1709,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
         * note: It is now used only to get unicode domain name
         */
        
-       if (!cli_nt_session_open(cli, PI_WKSSVC)) {
+       if (!smbcli_nt_session_open(cli, PI_WKSSVC)) {
                DEBUG(0, ("Couldn't not initialise wkssvc pipe\n"));
                return -1;
        }
@@ -1717,11 +1717,11 @@ static int rpc_trustdom_establish(int argc, const char **argv)
        if (!(mem_ctx = talloc_init("establishing trust relationship to domain %s",
                        domain_name))) {
                DEBUG(0, ("talloc_init() failed\n"));
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return -1;
        }
        
-       nt_status = cli_wks_query_info(cli, mem_ctx, &wks_info);
+       nt_status = smbcli_wks_query_info(cli, mem_ctx, &wks_info);
        
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("WksQueryInfo call failed.\n"));
@@ -1729,7 +1729,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
        }
 
        if (cli->nt_pipe_fnum)
-               cli_nt_session_close(cli);
+               smbcli_nt_session_close(cli);
 
 
        /*
@@ -1738,17 +1738,17 @@ static int rpc_trustdom_establish(int argc, const char **argv)
         
        if (!(mem_ctx = talloc_init("rpc_trustdom_establish"))) {
                DEBUG(0, ("talloc_init() failed\n"));
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return -1;
        }
 
-       if (!cli_nt_session_open(cli, PI_LSARPC)) {
+       if (!smbcli_nt_session_open(cli, PI_LSARPC)) {
                DEBUG(0, ("Could not initialise lsa pipe\n"));
-               cli_shutdown(cli);
+               smbcli_shutdown(cli);
                return -1;
        }
 
-       nt_status = cli_lsa_open_policy2(cli, mem_ctx, True, SEC_RIGHTS_QUERY_VALUE,
+       nt_status = smbcli_lsa_open_policy2(cli, mem_ctx, True, SEC_RIGHTS_QUERY_VALUE,
                                         &connect_hnd);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("Couldn't open policy handle. Error was %s\n",
@@ -1758,7 +1758,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
 
        /* Querying info level 5 */
        
-       nt_status = cli_lsa_query_info_policy(cli, mem_ctx, &connect_hnd,
+       nt_status = smbcli_lsa_query_info_policy(cli, mem_ctx, &connect_hnd,
                                              5 /* info level */, domain_name,
                                              &domain_sid);
        if (NT_STATUS_IS_ERR(nt_status)) {
@@ -1788,7 +1788,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
         * Close the pipes and clean up
         */
         
-       nt_status = cli_lsa_close(cli, mem_ctx, &connect_hnd);
+       nt_status = smbcli_lsa_close(cli, mem_ctx, &connect_hnd);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("Couldn't close LSA pipe. Error was %s\n",
                        nt_errstr(nt_status)));
@@ -1796,7 +1796,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
        }
 
        if (cli->nt_pipe_fnum)
-               cli_nt_session_close(cli);
+               smbcli_nt_session_close(cli);
         
        talloc_destroy(mem_ctx);
         
@@ -1853,7 +1853,7 @@ static int rpc_trustdom_usage(int argc, const char **argv)
 }
 
 
-static NTSTATUS rpc_query_domain_sid(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_query_domain_sid(const DOM_SID *domain_sid, struct smbcli_state *cli, TALLOC_CTX *mem_ctx,
                               int argc, const char **argv)
 {
        fstring str_sid;
@@ -1867,7 +1867,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
 {
        /* common variables */
        TALLOC_CTX* mem_ctx;
-       struct cli_state *cli, *remote_cli;
+       struct smbcli_state *cli, *remote_cli;
        NTSTATUS nt_status;
        const char *domain_name = NULL;
        DOM_SID queried_dom_sid;
@@ -1913,12 +1913,12 @@ static int rpc_trustdom_list(int argc, const char **argv)
                return -1;
        };
 
-       if (!cli_nt_session_open(cli, PI_LSARPC)) {
+       if (!smbcli_nt_session_open(cli, PI_LSARPC)) {
                DEBUG(0, ("Could not initialise lsa pipe\n"));
                return -1;
        };
 
-       nt_status = cli_lsa_open_policy2(cli, mem_ctx, True, SEC_RIGHTS_QUERY_VALUE,
+       nt_status = smbcli_lsa_open_policy2(cli, mem_ctx, True, SEC_RIGHTS_QUERY_VALUE,
                                        &connect_hnd);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("Couldn't open policy handle. Error was %s\n",
@@ -1927,7 +1927,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
        };
        
        /* query info level 5 to obtain sid of a domain being queried */
-       nt_status = cli_lsa_query_info_policy(cli, mem_ctx, &connect_hnd,
+       nt_status = smbcli_lsa_query_info_policy(cli, mem_ctx, &connect_hnd,
                                        5 /* info level */, domain_name, &queried_dom_sid);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("LSA Query Info failed. Returned error was %s\n",
@@ -1943,7 +1943,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
        d_printf("Trusted domains list:\n\n");
 
        do {
-               nt_status = cli_lsa_enum_trust_dom(cli, mem_ctx, &connect_hnd, &enum_ctx,
+               nt_status = smbcli_lsa_enum_trust_dom(cli, mem_ctx, &connect_hnd, &enum_ctx,
                                                   &num_domains,
                                                   &trusted_dom_names, &domain_sids);
                
@@ -1974,14 +1974,14 @@ static int rpc_trustdom_list(int argc, const char **argv)
        } while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
 
        /* close this connection before doing next one */
-       nt_status = cli_lsa_close(cli, mem_ctx, &connect_hnd);
+       nt_status = smbcli_lsa_close(cli, mem_ctx, &connect_hnd);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("Couldn't properly close lsa policy handle. Error was %s\n",
                        nt_errstr(nt_status)));
                return -1;
        };
        
-       cli_nt_session_close(cli);
+       smbcli_nt_session_close(cli);
 
        /*
         * Listing trusting domains (stored in passdb backend, if local)
@@ -1992,13 +1992,13 @@ static int rpc_trustdom_list(int argc, const char **argv)
        /*
         * Open \PIPE\samr and get needed policy handles
         */
-       if (!cli_nt_session_open(cli, PI_SAMR)) {
+       if (!smbcli_nt_session_open(cli, PI_SAMR)) {
                DEBUG(0, ("Could not initialise samr pipe\n"));
                return -1;
        };
        
        /* SamrConnect */
-       nt_status = cli_samr_connect(cli, mem_ctx, SA_RIGHT_SAM_OPEN_DOMAIN,
+       nt_status = smbcli_samr_connect(cli, mem_ctx, SA_RIGHT_SAM_OPEN_DOMAIN,
                                                                 &connect_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Couldn't open SAMR policy handle. Error was %s\n",
@@ -2008,7 +2008,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
        
        /* SamrOpenDomain - we have to open domain policy handle in order to be
           able to enumerate accounts*/
-       nt_status = cli_samr_open_domain(cli, mem_ctx, &connect_hnd,
+       nt_status = smbcli_samr_open_domain(cli, mem_ctx, &connect_hnd,
                                                                         SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
                                                                         &queried_dom_sid, &domain_hnd);                                                                         
        if (!NT_STATUS_IS_OK(nt_status)) {
@@ -2024,7 +2024,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
        enum_ctx = 0;   /* reset enumeration context from last enumeration */
        do {
                        
-               nt_status = cli_samr_enum_dom_users(cli, mem_ctx, &domain_hnd,
+               nt_status = smbcli_samr_enum_dom_users(cli, mem_ctx, &domain_hnd,
                                                    &enum_ctx, ACB_DOMTRUST, 0xffff,
                                                    &trusting_dom_names, &trusting_dom_rids,
                                                    &num_domains);
@@ -2066,7 +2066,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
                                if (run_rpc_command(remote_cli, PI_LSARPC, 0, rpc_query_domain_sid, argc, argv))
                                        d_printf("couldn't get domain's sid\n");
 
-                               cli_shutdown(remote_cli);
+                               smbcli_shutdown(remote_cli);
                        
                        } else {
                                d_printf("domain controller is not responding\n");
@@ -2078,19 +2078,19 @@ static int rpc_trustdom_list(int argc, const char **argv)
        } while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
 
        /* close opened samr and domain policy handles */
-       nt_status = cli_samr_close(cli, mem_ctx, &domain_hnd);
+       nt_status = smbcli_samr_close(cli, mem_ctx, &domain_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Couldn't properly close domain policy handle for domain %s\n", domain_name));
        };
        
-       nt_status = cli_samr_close(cli, mem_ctx, &connect_hnd);
+       nt_status = smbcli_samr_close(cli, mem_ctx, &connect_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Couldn't properly close samr policy handle for domain %s\n", domain_name));
        };
        
        /* close samr pipe and connection to IPC$ */
-       cli_nt_session_close(cli);
-       cli_shutdown(cli);
+       smbcli_nt_session_close(cli);
+       smbcli_shutdown(cli);
 
        talloc_destroy(mem_ctx);         
        return 0;
@@ -2133,7 +2133,7 @@ static int rpc_trustdom(int argc, const char **argv)
  */
 BOOL net_rpc_check(uint_t flags)
 {
-       struct cli_state cli;
+       struct smbcli_state cli;
        BOOL ret = False;
        struct in_addr server_ip;
        char *server_name = NULL;
@@ -2143,22 +2143,22 @@ BOOL net_rpc_check(uint_t flags)
                return False;
 
        ZERO_STRUCT(cli);
-       if (cli_initialise(&cli) == False)
+       if (smbcli_initialise(&cli) == False)
                return False;
 
-       if (!cli_connect(&cli, server_name, &server_ip))
+       if (!smbcli_connect(&cli, server_name, &server_ip))
                goto done;
        if (!attempt_netbios_session_request(&cli, lp_netbios_name(), 
                                             server_name, &server_ip))
                goto done;
-       if (!cli_negprot(&cli))
+       if (!smbcli_negprot(&cli))
                goto done;
        if (cli.protocol < PROTOCOL_NT1)
                goto done;
 
        ret = True;
  done:
-       cli_shutdown(&cli);
+       smbcli_shutdown(&cli);
        return ret;
 }
 
index 43bd56d251e1024656f5708d0a1b9b500b25a95a..9f915550aff6ecd2ff5c2979cad5fc4e5dae4cf7 100644 (file)
@@ -44,7 +44,7 @@
  **/
 int net_rpc_join_ok(const char *domain)
 {
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        uint8_t stored_md4_trust_password[16];
        int retval = 1;
        uint32_t channel;
@@ -56,7 +56,7 @@ int net_rpc_join_ok(const char *domain)
                return 1;
        }
 
-       if (!cli_nt_session_open(cli, PI_NETLOGON)) {
+       if (!smbcli_nt_session_open(cli, PI_NETLOGON)) {
                DEBUG(0,("Error connecting to NETLOGON pipe\n"));
                goto done;
        }
@@ -74,7 +74,7 @@ int net_rpc_join_ok(const char *domain)
                channel = SEC_CHAN_WKSTA;
        }
 
-       CHECK_RPC_ERR(cli_nt_setup_creds(cli, 
+       CHECK_RPC_ERR(smbcli_nt_setup_creds(cli, 
                                         channel,
                                         stored_md4_trust_password, &neg_flags, 2),
                          "error in domain join verification");
@@ -84,9 +84,9 @@ int net_rpc_join_ok(const char *domain)
 done:
        /* Close down pipe - this will clean up open policy handles */
        if (cli->nt_pipe_fnum)
-               cli_nt_session_close(cli);
+               smbcli_nt_session_close(cli);
 
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
 
        return retval;
 }
@@ -106,7 +106,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
 
        /* libsmb variables */
 
-       struct cli_state *cli;
+       struct smbcli_state *cli;
        TALLOC_CTX *mem_ctx;
         uint32_t acb_info;
 
@@ -148,38 +148,38 @@ int net_rpc_join_newstyle(int argc, const char **argv)
 
        /* Fetch domain sid */
 
-       if (!cli_nt_session_open(cli, PI_LSARPC)) {
+       if (!smbcli_nt_session_open(cli, PI_LSARPC)) {
                DEBUG(0, ("Error connecting to SAM pipe\n"));
                goto done;
        }
 
 
-       CHECK_RPC_ERR(cli_lsa_open_policy(cli, mem_ctx, True,
+       CHECK_RPC_ERR(smbcli_lsa_open_policy(cli, mem_ctx, True,
                                          SEC_RIGHTS_MAXIMUM_ALLOWED,
                                          &lsa_pol),
                      "error opening lsa policy handle");
 
-       CHECK_RPC_ERR(cli_lsa_query_info_policy(cli, mem_ctx, &lsa_pol,
+       CHECK_RPC_ERR(smbcli_lsa_query_info_policy(cli, mem_ctx, &lsa_pol,
                                                5, domain, &domain_sid),
                      "error querying info policy");
 
-       cli_lsa_close(cli, mem_ctx, &lsa_pol);
+       smbcli_lsa_close(cli, mem_ctx, &lsa_pol);
 
-       cli_nt_session_close(cli); /* Done with this pipe */
+       smbcli_nt_session_close(cli); /* Done with this pipe */
 
        /* Create domain user */
-       if (!cli_nt_session_open(cli, PI_SAMR)) {
+       if (!smbcli_nt_session_open(cli, PI_SAMR)) {
                DEBUG(0, ("Error connecting to SAM pipe\n"));
                goto done;
        }
 
-       CHECK_RPC_ERR(cli_samr_connect(cli, mem_ctx, 
+       CHECK_RPC_ERR(smbcli_samr_connect(cli, mem_ctx, 
                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
                                       &sam_pol),
                      "could not connect to SAM database");
 
        
-       CHECK_RPC_ERR(cli_samr_open_domain(cli, mem_ctx, &sam_pol,
+       CHECK_RPC_ERR(smbcli_samr_open_domain(cli, mem_ctx, &sam_pol,
                                           SEC_RIGHTS_MAXIMUM_ALLOWED,
                                           &domain_sid, &domain_pol),
                      "could not open domain");
@@ -191,7 +191,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
 
         acb_info = ((lp_server_role() == ROLE_DOMAIN_BDC) || lp_server_role() == ROLE_DOMAIN_PDC) ? ACB_SVRTRUST : ACB_WSTRUST;
 
-       result = cli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
+       result = smbcli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
                                          acct_name, acb_info,
                                          0xe005000b, &user_pol, 
                                          &user_rid);
@@ -213,9 +213,9 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        /* We *must* do this.... don't ask... */
 
        if (NT_STATUS_IS_OK(result))
-               cli_samr_close(cli, mem_ctx, &user_pol);
+               smbcli_samr_close(cli, mem_ctx, &user_pol);
 
-       CHECK_RPC_ERR_DEBUG(cli_samr_lookup_names(cli, mem_ctx,
+       CHECK_RPC_ERR_DEBUG(smbcli_samr_lookup_names(cli, mem_ctx,
                                                  &domain_pol, flags,
                                                  1, &const_acct_name, 
                                                  &num_rids,
@@ -233,7 +233,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        /* Open handle on user */
 
        CHECK_RPC_ERR_DEBUG(
-               cli_samr_open_user(cli, mem_ctx, &domain_pol,
+               smbcli_samr_open_user(cli, mem_ctx, &domain_pol,
                                   SEC_RIGHTS_MAXIMUM_ALLOWED,
                                   user_rid, &user_pol),
                ("could not re-open existing user %s: %s\n",
@@ -264,7 +264,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        ctr.switch_value = 24;
        ctr.info.id24 = &p24;
 
-       CHECK_RPC_ERR(cli_samr_set_userinfo(cli, mem_ctx, &user_pol, 24, 
+       CHECK_RPC_ERR(smbcli_samr_set_userinfo(cli, mem_ctx, &user_pol, 24, 
                                            cli->user_session_key, &ctr),
                      "error setting trust account password");
 
@@ -286,7 +286,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        /* Ignoring the return value is necessary for joining a domain
           as a normal user with "Add workstation to domain" privilege. */
 
-       result = cli_samr_set_userinfo2(cli, mem_ctx, &user_pol, 0x10, 
+       result = smbcli_samr_set_userinfo2(cli, mem_ctx, &user_pol, 0x10, 
                                        sess_key, &ctr);
 
        /* Now store the secret in the secrets database */
@@ -303,8 +303,8 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        }
 
        /* Now check the whole process from top-to-bottom */
-       cli_samr_close(cli, mem_ctx, &user_pol);
-       cli_nt_session_close(cli); /* Done with this pipe */
+       smbcli_samr_close(cli, mem_ctx, &user_pol);
+       smbcli_nt_session_close(cli); /* Done with this pipe */
 
        retval = net_rpc_join_ok(domain);
        
@@ -312,7 +312,7 @@ done:
        /* Close down pipe - this will clean up open policy handles */
 
        if (cli->nt_pipe_fnum)
-               cli_nt_session_close(cli);
+               smbcli_nt_session_close(cli);
 
        /* Display success or failure */
 
@@ -323,7 +323,7 @@ done:
                printf("Joined domain %s.\n",domain);
        }
        
-       cli_shutdown(cli);
+       smbcli_shutdown(cli);
 
        SAFE_FREE(clear_trust_password);
 
index 3a6b754f3719f87f84395dd4f346baccf238feb4..1b0cbc6c76a1803767ba84ee68069457aab2309d 100644 (file)
@@ -118,7 +118,7 @@ static void display_sam_entry(SAM_DELTA_HDR *hdr_delta, SAM_DELTA_CTR *delta)
 }
 
 
-static void dump_database(struct cli_state *cli, uint_t db_type, DOM_CRED *ret_creds)
+static void dump_database(struct smbcli_state *cli, uint_t db_type, DOM_CRED *ret_creds)
 {
        uint_t sync_context = 0;
         NTSTATUS result;
@@ -135,7 +135,7 @@ static void dump_database(struct cli_state *cli, uint_t db_type, DOM_CRED *ret_c
        d_printf("Dumping database %u\n", db_type);
 
        do {
-               result = cli_netlogon_sam_sync(cli, mem_ctx, ret_creds, db_type,
+               result = smbcli_netlogon_sam_sync(cli, mem_ctx, ret_creds, db_type,
                                               sync_context,
                                               &num_deltas, &hdr_deltas, &deltas);
                clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), ret_creds);
@@ -152,7 +152,7 @@ static void dump_database(struct cli_state *cli, uint_t db_type, DOM_CRED *ret_c
 int rpc_samdump(int argc, const char **argv)
 {
         NTSTATUS result;
-       struct cli_state *cli = NULL;
+       struct smbcli_state *cli = NULL;
        uint8_t trust_password[16];
        DOM_CRED ret_creds;
        uint32_t neg_flags = 0x000001ff;
@@ -165,7 +165,7 @@ int rpc_samdump(int argc, const char **argv)
                return 1;
        }
 
-       if (!cli_nt_session_open(cli, PI_NETLOGON)) {
+       if (!smbcli_nt_session_open(cli, PI_NETLOGON)) {
                DEBUG(0,("Error connecting to NETLOGON pipe\n"));
                goto fail;
        }
@@ -175,7 +175,7 @@ int rpc_samdump(int argc, const char **argv)
                goto fail;
        }
        
-       result = cli_nt_setup_creds(cli, SEC_CHAN_BDC,  trust_password, &neg_flags, 2);
+       result = smbcli_nt_setup_creds(cli, SEC_CHAN_BDC,  trust_password, &neg_flags, 2);
        if (!NT_STATUS_IS_OK(result)) {
                d_printf("Failed to setup BDC creds\n");
                goto fail;
@@ -185,13 +185,13 @@ int rpc_samdump(int argc, const char **argv)
        dump_database(cli, SAM_DATABASE_BUILTIN, &ret_creds);
        dump_database(cli, SAM_DATABASE_PRIVS, &ret_creds);
 
-       cli_nt_session_close(cli);
+       smbcli_nt_session_close(cli);
         
         return 0;
 
 fail:
        if (cli) {
-               cli_nt_session_close(cli);
+               smbcli_nt_session_close(cli);
        }
        return -1;
 }
@@ -635,7 +635,7 @@ fetch_sam_entry(SAM_DELTA_HDR *hdr_delta, SAM_DELTA_CTR *delta,
 }
 
 static void
-fetch_database(struct cli_state *cli, uint_t db_type, DOM_CRED *ret_creds,
+fetch_database(struct smbcli_state *cli, uint_t db_type, DOM_CRED *ret_creds,
               DOM_SID dom_sid)
 {
        uint_t sync_context = 0;
@@ -653,7 +653,7 @@ fetch_database(struct cli_state *cli, uint_t db_type, DOM_CRED *ret_creds,
        d_printf("Fetching database %u\n", db_type);
 
        do {
-               result = cli_netlogon_sam_sync(cli, mem_ctx, ret_creds,
+               result = smbcli_netlogon_sam_sync(cli, mem_ctx, ret_creds,
                                               db_type, sync_context,
                                               &num_deltas,
                                               &hdr_deltas, &deltas);
@@ -672,7 +672,7 @@ fetch_database(struct cli_state *cli, uint_t db_type, DOM_CRED *ret_creds,
 int rpc_vampire(int argc, const char **argv)
 {
         NTSTATUS result;
-       struct cli_state *cli = NULL;
+       struct smbcli_state *cli = NULL;
        uint8_t trust_password[16];
        DOM_CRED ret_creds;
        uint32_t neg_flags = 0x000001ff;
@@ -686,7 +686,7 @@ int rpc_vampire(int argc, const char **argv)
                return 1;
        }
 
-       if (!cli_nt_session_open(cli, PI_NETLOGON)) {
+       if (!smbcli_nt_session_open(cli, PI_NETLOGON)) {
                DEBUG(0,("Error connecting to NETLOGON pipe\n"));
                goto fail;
        }
@@ -697,7 +697,7 @@ int rpc_vampire(int argc, const char **argv)
                goto fail;
        }
        
-       result = cli_nt_setup_creds(cli, SEC_CHAN_BDC,  trust_password,
+       result = smbcli_nt_setup_creds(cli, SEC_CHAN_BDC,  trust_password,
                                    &neg_flags, 2);
        if (!NT_STATUS_IS_OK(result)) {
                d_printf("Failed to setup BDC creds\n");
@@ -713,13 +713,13 @@ int rpc_vampire(int argc, const char **argv)
        /* Currently we crash on PRIVS somewhere in unmarshalling */
        /* Dump_database(cli, SAM_DATABASE_PRIVS, &ret_creds); */
 
-       cli_nt_session_close(cli);
+       smbcli_nt_session_close(cli);
         
         return 0;
 
 fail:
        if (cli) {
-               cli_nt_session_close(cli);
+               smbcli_nt_session_close(cli);
        }
        return -1;
 }
index 4e6ce2336d4ff9e5dc371dea80074ac4dd4e956d..f7220c94242ddb5977d6f21137fd227044af0724 100644 (file)
 /*
   return the time on a server. This does not require any authentication
 */
-static time_t cli_servertime(const char *host, struct in_addr *ip, int *zone)
+static time_t smbcli_servertime(const char *host, struct in_addr *ip, int *zone)
 {
        struct nmb_name calling, called;
        time_t ret = 0;
-       struct cli_state *cli = NULL;
+       struct smbcli_state *cli = NULL;
 
-       cli = cli_initialise(NULL);
+       cli = smbcli_initialise(NULL);
        if (!cli) goto done;
 
-       if (!cli_connect(cli, host, ip)) {
+       if (!smbcli_connect(cli, host, ip)) {
                fprintf(stderr,"Can't contact server\n");
                goto done;
        }
@@ -45,11 +45,11 @@ static time_t cli_servertime(const char *host, struct in_addr *ip, int *zone)
                make_nmb_name(&called, "*SMBSERVER", 0x20);
        }
 
-       if (!cli_session_request(cli, &calling, &called)) {
+       if (!smbcli_session_request(cli, &calling, &called)) {
                fprintf(stderr,"Session request failed\n");
                goto done;
        }
-       if (!cli_negprot(cli)) {
+       if (!smbcli_negprot(cli)) {
                fprintf(stderr,"Protocol negotiation failed\n");
                goto done;
        }
@@ -58,14 +58,14 @@ static time_t cli_servertime(const char *host, struct in_addr *ip, int *zone)
        if (zone) *zone = cli->serverzone;
 
 done:
-       if (cli) cli_shutdown(cli);
+       if (cli) smbcli_shutdown(cli);
        return ret;
 }
 
 /* find the servers time on the opt_host host */
 static time_t nettime(int *zone)
 {
-       return cli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, zone);
+       return smbcli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, zone);
 }
 
 /* return a time as a string ready to be passed to /bin/date */
@@ -172,7 +172,7 @@ int net_time(int argc, const char **argv)
        }
 
        /* default - print the time */
-       t = cli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, NULL);
+       t = smbcli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, NULL);
        if (t == 0) return -1;
 
        d_printf("%s", ctime(&t));