s3:libsmb: get rid of cli_state_remote_name
[samba.git] / source3 / client / client.c
index 95500b086216354ef8e016af9a297e67cdc3f3e4..f3ba63fde39f5474dc4eee937960e29e9280f27a 100644 (file)
@@ -37,6 +37,7 @@
 #include "trans2.h"
 #include "libsmb/nmblib.h"
 #include "include/ntioctl.h"
+#include "../libcli/smb/smbXcli_base.h"
 
 #ifndef REGISTER
 #define REGISTER 0
@@ -251,7 +252,7 @@ static int readfile(uint8_t *b, int n, XFILE *f)
 
 struct push_state {
        XFILE *f;
-       SMB_OFF_T nread;
+       off_t nread;
 };
 
 static size_t push_source(uint8_t *buf, size_t n, void *priv)
@@ -1070,9 +1071,9 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
        bool newhandle = false;
        struct timespec tp_start;
        uint16 attr;
-       SMB_OFF_T size;
+       off_t size;
        off_t start = 0;
-       SMB_OFF_T nread = 0;
+       off_t nread = 0;
        int rc = 0;
        struct cli_state *targetcli = NULL;
        char *targetname = NULL;
@@ -1678,7 +1679,7 @@ static int do_allinfo(const char *name)
 {
        fstring altname;
        struct timespec b_time, a_time, m_time, c_time;
-       SMB_OFF_T size;
+       off_t size;
        uint16_t mode;
        SMB_INO_T ino;
        NTTIME tmp;
@@ -1838,7 +1839,7 @@ static int do_put(const char *rname, const char *lname, bool reput)
        TALLOC_CTX *ctx = talloc_tos();
        uint16_t fnum;
        XFILE *f;
-       SMB_OFF_T start = 0;
+       off_t start = 0;
        int rc = 0;
        struct timespec tp_start;
        struct cli_state *targetcli;
@@ -2074,7 +2075,7 @@ static int cmd_select(void)
 static int file_find(struct file_list **list, const char *directory,
                      const char *expression, bool match)
 {
-       SMB_STRUCT_DIR *dir;
+       DIR *dir;
        struct file_list *entry;
         struct stat statbuf;
         int ret;
@@ -2082,7 +2083,7 @@ static int file_find(struct file_list **list, const char *directory,
        bool isdir;
        const char *dname;
 
-        dir = sys_opendir(directory);
+        dir = opendir(directory);
        if (!dir)
                return -1;
 
@@ -2111,14 +2112,14 @@ static int file_find(struct file_list **list, const char *directory,
 
                                if (ret == -1) {
                                        SAFE_FREE(path);
-                                       sys_closedir(dir);
+                                       closedir(dir);
                                        return -1;
                                }
                        }
                        entry = SMB_MALLOC_P(struct file_list);
                        if (!entry) {
                                d_printf("Out of memory in file_find\n");
-                               sys_closedir(dir);
+                               closedir(dir);
                                return -1;
                        }
                        entry->file_path = path;
@@ -2129,7 +2130,7 @@ static int file_find(struct file_list **list, const char *directory,
                }
         }
 
-       sys_closedir(dir);
+       closedir(dir);
        return 0;
 }
 
@@ -3923,7 +3924,7 @@ static int cmd_notify(void)
                goto fail;
        }
        status = cli_ntcreate(
-               cli, name, 0, READ_CONTROL_ACCESS, 0,
+               cli, name, 0, FILE_READ_DATA, 0,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_OPEN, 0, 0, &fnum);
        if (!NT_STATUS_IS_OK(status)) {
@@ -4495,7 +4496,7 @@ static int cmd_show_connect( void )
                return 1;
        }
 
-       d_printf("//%s/%s\n", cli_state_remote_name(targetcli), targetcli->share);
+       d_printf("//%s/%s\n", smbXcli_conn_remote_name(targetcli->conn), targetcli->share);
        return 0;
 }