s3:libsmb: Generate the inode only based on the path component
authorAndreas Schneider <asn@samba.org>
Wed, 18 Dec 2019 12:27:26 +0000 (13:27 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 19 Dec 2019 14:20:41 +0000 (14:20 +0000)
Currently we use the full smb url which includes also username and
password.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/libsmb_dir.c
source3/libsmb/libsmb_stat.c

index 8eecde0668e6c186a27fedfca27b58867b800e16..22a3c6354e635482e6e308a52be9562463e9e16f 100644 (file)
@@ -1276,6 +1276,15 @@ const struct libsmb_file_info *SMBC_readdirplus2_ctx(SMBCCTX *context,
        struct smbc_dirplus_list *dp_list = NULL;
        ino_t ino;
        char *full_pathname = NULL;
+       char *workgroup = NULL;
+       char *server = NULL;
+       uint16_t port = 0;
+       char *share = NULL;
+       char *path = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *options = NULL;
+       int rc;
        TALLOC_CTX *frame = NULL;
 
        /*
@@ -1333,8 +1342,25 @@ const struct libsmb_file_info *SMBC_readdirplus2_ctx(SMBCCTX *context,
                return NULL;
        }
 
+       rc = SMBC_parse_path(frame,
+                            context,
+                            full_pathname,
+                            &workgroup,
+                            &server,
+                            &port,
+                            &share,
+                            &path,
+                            &user,
+                            &password,
+                            &options);
+       if (rc != 0) {
+               TALLOC_FREE(frame);
+               errno = ENOENT;
+               return NULL;
+       }
+
        setup_stat(st,
-               full_pathname,
+               path,
                smb_finfo->size,
                smb_finfo->attrs,
                ino,
index 0db9be3677bacbcfc749dad9e97416ceb1782247..03db33e8173c516d290561480aad56d79219df94 100644 (file)
@@ -190,7 +190,7 @@ SMBC_stat_ctx(SMBCCTX *context,
        }
 
        setup_stat(st,
-               fname,
+               path,
                size,
                mode,
                ino,
@@ -296,7 +296,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
        }
 
        setup_stat(st,
-               file->fname,
+               path,
                size,
                mode,
                ino,