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&nbs