s3: smbd: VFS: Add vfs_stat_smb_basename() - to be called when we *know* stream name...
authorJeremy Allison <jra@samba.org>
Fri, 1 May 2015 19:50:51 +0000 (12:50 -0700)
committerRalph Böhme <slow@samba.org>
Tue, 5 May 2015 12:01:25 +0000 (14:01 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11249

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/proto.h
source3/smbd/vfs.c

index a5144d5e0781c753eafea23681fb314a4e83fd9f..5a7d16d345b186b4fd031f947556f283e8d673a1 100644 (file)
@@ -1179,6 +1179,8 @@ int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
                       SMB_STRUCT_STAT *psbuf);
 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
                        SMB_STRUCT_STAT *psbuf);
+int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname,
+                       SMB_STRUCT_STAT *psbuf);
 NTSTATUS vfs_stat_fsp(files_struct *fsp);
 NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
 NTSTATUS vfs_streaminfo(connection_struct *conn,
index ebd3440e73f62bade8339691ad6e28e1a6528994..b8525501742e8491d60ceff7205ca3fb97aa7a35 100644 (file)
@@ -1330,6 +1330,32 @@ int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
        return ret;
 }
 
+/**
+ * XXX: This is temporary and there should be no callers of this once
+ * smb_filename is plumbed through all path based operations.
+ *
+ * Called when we know stream name parsing has already been done.
+ */
+int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname,
+                      SMB_STRUCT_STAT *psbuf)
+{
+       struct smb_filename smb_fname = {
+                       .base_name = discard_const_p(char, fname)
+       };
+       int ret;
+
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(conn, &smb_fname);
+       } else {
+               ret = SMB_VFS_STAT(conn, &smb_fname);
+       }
+
+       if (ret != -1) {
+               *psbuf = smb_fname.st;
+       }
+       return ret;
+}
+
 /**
  * Ensure LSTAT is called for POSIX paths.
  */