]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: prepare fsp_str_dbg() for atnames
authorRalph Boehme <slow@samba.org>
Sun, 17 May 2020 05:53:42 +0000 (07:53 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 21 May 2020 20:38:35 +0000 (20:38 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/filename_util.c

index 00a5fcda9972994d637ff2c992a6b2f060e75ef4..418dd20327b00e8217b807ca27691a85c11abee0 100644 (file)
@@ -180,7 +180,29 @@ const char *smb_fname_str_dbg(const struct smb_filename *smb_fname)
  */
 const char *fsp_str_dbg(const struct files_struct *fsp)
 {
-       return smb_fname_str_dbg(fsp->fsp_name);
+       const char *name = NULL;
+
+       name = smb_fname_str_dbg(fsp->fsp_name);
+       if (name == NULL) {
+               return "";
+       }
+
+       if (fsp->dirfsp == NULL || fsp->dirfsp == fsp->conn->cwd_fsp) {
+               return name;
+       }
+
+       if (ISDOT(fsp->dirfsp->fsp_name->base_name)) {
+               return name;
+       }
+
+       name = talloc_asprintf(talloc_tos(),
+                              "%s/%s",
+                              fsp->dirfsp->fsp_name->base_name,
+                              fsp->fsp_name->base_name);
+       if (name == NULL) {
+               return "";
+       }
+       return name;
 }
 
 /**