The branch, master has been updated
       via  8e04c69e027260e7e1f0a4cf3e58e31ed4084d8b (commit)
       via  f4530f6d2a0688e350c3c7be23f256ebceffa636 (commit)
       via  841efce8b5e931a7ec910afb7d0d8b6a123c6900 (commit)
       via  82c3f505fe2e50022b5102e6388dc3b830d235da (commit)
       via  c9b8a017147211d86662f40dcf835b152ab90cf4 (commit)
       via  5a8d70d465f28ae02f4df7a3c2905e028c2e3142 (commit)
       via  635e5e7ff038378d28c52bd5f81d24db99a77a76 (commit)
       via  12a5db45e2814b6992210d8f30908ab3e8b6bc65 (commit)
      from  04c3dfde0f0bc12daf0922a0fe578e3bde587fc8 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8e04c69e027260e7e1f0a4cf3e58e31ed4084d8b
Author: Tim Prouty <tpro...@samba.org>
Date:   Mon Jul 20 14:32:32 2009 -0700

    s3: Add some asserts to the filename util functions
    
    In the smb_filename struct stream_name must equal NULL if there
    is no stream name.  These asserts should catch any future offenders
    of this invariant early.

commit f4530f6d2a0688e350c3c7be23f256ebceffa636
Author: Tim Prouty <tpro...@samba.org>
Date:   Fri Jul 10 15:43:21 2009 -0700

    s3: Plumb smb_filename through open_fake_file

commit 841efce8b5e931a7ec910afb7d0d8b6a123c6900
Author: Tim Prouty <tpro...@samba.org>
Date:   Fri Jul 10 15:35:08 2009 -0700

    s3: Separate out a new file: filename_utils.c
    
    This is to ease the linking pain of everything that links LOCKING_OBJ

commit 82c3f505fe2e50022b5102e6388dc3b830d235da
Author: Tim Prouty <tpro...@samba.org>
Date:   Fri Jul 10 15:10:35 2009 -0700

    s3: Move is_ntfs_stream*() to filename.c

commit c9b8a017147211d86662f40dcf835b152ab90cf4
Author: Tim Prouty <tpro...@samba.org>
Date:   Fri Jul 10 18:11:32 2009 -0700

    s3: Finish plumbing the fsp->fsp_name smb_fname conversion through the 
modules.

commit 5a8d70d465f28ae02f4df7a3c2905e028c2e3142
Author: Tim Prouty <tpro...@samba.org>
Date:   Fri Jul 10 14:50:37 2009 -0700

    s3: Change fsp->fsp_name to be an smb_filename struct!

commit 635e5e7ff038378d28c52bd5f81d24db99a77a76
Author: Tim Prouty <tpro...@samba.org>
Date:   Fri Jul 10 11:50:30 2009 -0700

    s3 onefs oplocks: Replace static fstring with talloc'd dbg_ctx()

commit 12a5db45e2814b6992210d8f30908ab3e8b6bc65
Author: Tim Prouty <tpro...@samba.org>
Date:   Fri Jul 10 10:38:56 2009 -0700

    s3: Change file_structs to be allocated with talloc instead of malloc

-----------------------------------------------------------------------

Summary of changes:
 source3/Makefile.in                        |   14 +-
 source3/include/proto.h                    |   52 ++++---
 source3/include/smb.h                      |    2 +-
 source3/locking/brlock.c                   |    4 +-
 source3/locking/locking.c                  |   29 ++--
 source3/locking/posix.c                    |   37 +++--
 source3/modules/nfs4_acls.c                |   34 ++--
 source3/modules/onefs_acl.c                |   51 +++---
 source3/modules/onefs_open.c               |   18 +-
 source3/modules/onefs_streams.c            |   10 +-
 source3/modules/vfs_acl_tdb.c              |   98 +++++------
 source3/modules/vfs_acl_xattr.c            |   60 ++++---
 source3/modules/vfs_afsacl.c               |   35 +++--
 source3/modules/vfs_aixacl2.c              |   16 +-
 source3/modules/vfs_audit.c                |    4 +-
 source3/modules/vfs_cacheprime.c           |    2 +-
 source3/modules/vfs_default.c              |    4 +-
 source3/modules/vfs_extd_audit.c           |    8 +-
 source3/modules/vfs_full_audit.c           |   93 ++++++-----
 source3/modules/vfs_gpfs.c                 |   33 +++-
 source3/modules/vfs_hpuxacl.c              |   20 ++-
 source3/modules/vfs_hpuxacl.h              |    2 +-
 source3/modules/vfs_shadow_copy2.c         |    4 +-
 source3/modules/vfs_smb_traffic_analyzer.c |   18 +-
 source3/modules/vfs_streams_xattr.c        |   25 +--
 source3/modules/vfs_tsmsm.c                |    6 +-
 source3/modules/vfs_zfsacl.c               |   11 +-
 source3/printing/printfsp.c                |   10 +-
 source3/smbd/aio.c                         |   28 ++--
 source3/smbd/blocking.c                    |   15 +-
 source3/smbd/close.c                       |  163 ++++++++-----------
 source3/smbd/dosmode.c                     |    2 +-
 source3/smbd/fake_file.c                   |   29 +++-
 source3/smbd/fileio.c                      |   57 +++----
 source3/smbd/filename.c                    |  195 ----------------------
 source3/smbd/filename_util.c               |  206 +++++++++++++++++++++++
 source3/smbd/files.c                       |   89 +++++++---
 source3/smbd/ipc.c                         |    2 +-
 source3/smbd/notify.c                      |    7 +-
 source3/smbd/nttrans.c                     |   44 ++----
 source3/smbd/open.c                        |   87 +++++------
 source3/smbd/oplock.c                      |   24 ++-
 source3/smbd/oplock_irix.c                 |   13 +-
 source3/smbd/oplock_linux.c                |    9 +-
 source3/smbd/oplock_onefs.c                |   41 +++---
 source3/smbd/pipes.c                       |   19 ++-
 source3/smbd/posix_acls.c                  |  247 +++++++++++++---------------
 source3/smbd/reply.c                       |  139 +++++++---------
 source3/smbd/smb2_close.c                  |    2 +-
 source3/smbd/smb2_create.c                 |   19 +--
 source3/smbd/smb2_flush.c                  |    2 +-
 source3/smbd/smb2_getinfo.c                |   29 +--
 source3/smbd/smb2_notify.c                 |    2 +-
 source3/smbd/smb2_read.c                   |    4 +-
 source3/smbd/smb2_setinfo.c                |   25 +--
 source3/smbd/smb2_write.c                  |    6 +-
 source3/smbd/trans2.c                      |   70 ++++----
 source3/smbd/vfs.c                         |   91 +++++++++--
 source3/torture/cmd_vfs.c                  |   13 +-
 59 files changed, 1236 insertions(+), 1143 deletions(-)
 create mode 100644 source3/smbd/filename_util.c


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index f6396ef..e6d0cf0 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -667,6 +667,8 @@ OPLOCK_OBJ = smbd/oplock.o smbd/oplock_irix.o 
smbd/oplock_linux.o \
 
 NOTIFY_OBJ = smbd/notify.o smbd/notify_inotify.o smbd/notify_internal.o
 
+FNAME_UTIL_OBJ = smbd/filename_util.o
+
 VFS_DEFAULT_OBJ = modules/vfs_default.o
 VFS_AUDIT_OBJ = modules/vfs_audit.o
 VFS_EXTD_AUDIT_OBJ = modules/vfs_extd_audit.o
@@ -786,7 +788,7 @@ SMBD_OBJ_BASE = $(PARAM_WITHOUT_REG_OBJ) $(SMBD_OBJ_SRV) 
$(LIBSMB_OBJ) \
                $(RPC_SERVER_OBJ) $(RPC_PARSE_OBJ) \
                $(LOCKING_OBJ) $(PASSDB_OBJ) $(PRINTING_OBJ) $(PROFILE_OBJ) \
                $(LIB_OBJ) $(PRINTBACKEND_OBJ) $(OPLOCK_OBJ) \
-               $(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \
+               $(NOTIFY_OBJ) $(FNAME_UTIL_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \
                $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(AVAHI_OBJ) \
                $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \
                $(REG_FULL_OBJ) $(POPT_LIB_OBJ) $(BUILDOPT_OBJ) \
@@ -828,16 +830,16 @@ SWAT_OBJ = $(SWAT_OBJ1) $(PARAM_OBJ) $(PRINTING_OBJ) 
$(PRINTBASE_OBJ) $(LIBSMB_O
           $(LOCKING_OBJ) $(PASSDB_OBJ) $(KRBCLIENT_OBJ) \
           $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) $(PLAINTEXT_AUTH_OBJ) \
           $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) 
$(LIBMSRPC_OBJ) \
-           $(PASSCHANGE_OBJ) $(LDB_OBJ)
+           $(PASSCHANGE_OBJ) $(LDB_OBJ) $(FNAME_UTIL_OBJ)
 
 STATUS_OBJ = utils/status.o utils/status_profile.o \
             $(LOCKING_OBJ) $(PARAM_OBJ) \
              $(PROFILE_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
-            $(LIBSAMBA_OBJ)
+            $(LIBSAMBA_OBJ) $(FNAME_UTIL_OBJ)
 
 SMBCONTROL_OBJ = utils/smbcontrol.o $(LOCKING_OBJ) $(PARAM_OBJ) \
        $(PROFILE_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
-       $(LIBSAMBA_OBJ) \
+       $(LIBSAMBA_OBJ) $(FNAME_UTIL_OBJ) \
        $(PRINTBASE_OBJ)
 
 SMBTREE_OBJ = utils/smbtree.o $(PARAM_OBJ) \
@@ -1033,7 +1035,7 @@ MSGTEST_OBJ = torture/msgtest.o $(PARAM_OBJ) 
$(LIBSMB_OBJ) $(LDB_OBJ) $(KRBCLIEN
 
 LOCKTEST_OBJ = torture/locktest.o $(PARAM_OBJ) $(LOCKING_OBJ) $(KRBCLIENT_OBJ) 
\
                $(LIBSMB_OBJ) $(LDB_OBJ) $(LIB_NONSMBD_OBJ) \
-               $(LIBNDR_GEN_OBJ0)
+               $(LIBNDR_GEN_OBJ0) $(FNAME_UTIL_OBJ)
 
 NSSTEST_OBJ = torture/nsstest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(LDB_OBJ) 
$(KRBCLIENT_OBJ) \
                  $(LIB_NONSMBD_OBJ) \
@@ -1052,7 +1054,7 @@ LOG2PCAP_OBJ = utils/log2pcaphex.o
 
 LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) 
$(LDB_OBJ) \
                $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
-               $(LIBNDR_GEN_OBJ0)
+               $(LIBNDR_GEN_OBJ0) $(FNAME_UTIL_OBJ)
 
 SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
                $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 695e14b..c48cebc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6266,11 +6266,11 @@ void reply_openerror(struct smb_request *req, NTSTATUS 
status);
 
 /* The following definitions come from smbd/fake_file.c  */
 
-enum FAKE_FILE_TYPE is_fake_file(const char *fname);
+enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname);
 NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
                                uint16_t current_vuid,
                                enum FAKE_FILE_TYPE fake_file_type,
-                               const char *fname,
+                               const struct smb_filename *smb_fname,
                                uint32 access_mask,
                                files_struct **result);
 NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
@@ -6307,24 +6307,6 @@ int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst);
 
 /* The following definitions come from smbd/filename.c  */
 
-NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename 
*smb_fname,
-                             char **full_name);
-NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
-                                   const char *stream_name,
-                                   const SMB_STRUCT_STAT *psbuf,
-                                   struct smb_filename **smb_fname_out);
-NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
-                                         const char *fname,
-                                         const SMB_STRUCT_STAT *psbuf,
-                                         struct smb_filename **smb_fname_out);
-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);
-const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
-NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
-                          const struct smb_filename *smb_fname_in,
-                          struct smb_filename **smb_fname_out);
 NTSTATUS unix_convert(TALLOC_CTX *ctx,
                      connection_struct *conn,
                      const char *orig_path,
@@ -6341,6 +6323,26 @@ NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
                        struct smb_filename **pp_smb_fname,
                        char **pp_name);
 
+/* The following definitions come from smbd/filename_utils.c */
+
+NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename 
*smb_fname,
+                             char **full_name);
+NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
+                                   const char *stream_name,
+                                   const SMB_STRUCT_STAT *psbuf,
+                                   struct smb_filename **smb_fname_out);
+NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
+                                         const char *fname,
+                                         const SMB_STRUCT_STAT *psbuf,
+                                         struct smb_filename **smb_fname_out);
+const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
+const char *fsp_str_dbg(const struct files_struct *fsp);
+NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
+                          const struct smb_filename *smb_fname_in,
+                          struct smb_filename **smb_fname_out);
+bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
+bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
+
 /* The following definitions come from smbd/files.c  */
 
 NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
@@ -6365,9 +6367,11 @@ void file_sync_all(connection_struct *conn);
 void file_free(struct smb_request *req, files_struct *fsp);
 files_struct *file_fnum(uint16 fnum);
 files_struct *file_fsp(struct smb_request *req, uint16 fid);
-void dup_file_fsp(struct smb_request *req, files_struct *from,
+NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
                      uint32 access_mask, uint32 share_access,
                      uint32 create_options, files_struct *to);
+NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
+                          const struct smb_filename *smb_fname_in);
 
 /* The following definitions come from smbd/ipc.c  */
 
@@ -6545,8 +6549,6 @@ void send_nt_replies(connection_struct *conn,
                        struct smb_request *req, NTSTATUS nt_error,
                     char *params, int paramsize,
                     char *pdata, int datasize);
-bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
-bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
 void reply_ntcreate_and_X(struct smb_request *req);
 void reply_ntcancel(struct smb_request *req);
 void reply_ntrename(struct smb_request *req);
@@ -7114,6 +7116,10 @@ char *vfs_readdirname(connection_struct *conn, void *p, 
SMB_STRUCT_STAT *sbuf);
 int vfs_ChDir(connection_struct *conn, const char *path);
 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
 NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
+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);
 
 /* The following definitions come from torture/denytest.c  */
 
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 2e9cf1b..94ed218 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -452,7 +452,7 @@ typedef struct files_struct {
        bool lockdb_clean;
        bool initial_delete_on_close; /* Only set at NTCreateX if file was 
created. */
        bool posix_open;
-       char *fsp_name;
+       struct smb_filename *fsp_name;
 
        struct vfs_fsp_data *vfs_extension;
        struct fake_file_handle *fake_file_handle;
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index be2948c..e238ec9 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1196,7 +1196,7 @@ bool brl_locktest(struct byte_range_lock *br_lck,
 
                DEBUG(10,("brl_locktest: posix start=%.0f len=%.0f %s for fnum 
%d file %s\n",
                        (double)start, (double)size, ret ? "locked" : 
"unlocked",
-                       fsp->fnum, fsp->fsp_name ));
+                       fsp->fnum, fsp_str_dbg(fsp)));
 
                /* We need to return the inverse of is_posix_locked. */
                ret = !ret;
@@ -1262,7 +1262,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
 
                DEBUG(10,("brl_lockquery: posix start=%.0f len=%.0f %s for fnum 
%d file %s\n",
                        (double)*pstart, (double)*psize, ret ? "locked" : 
"unlocked",
-                       fsp->fnum, fsp->fsp_name ));
+                       fsp->fnum, fsp_str_dbg(fsp)));
 
                if (ret) {
                        /* Hmmm. No clue what to set smbpid to - use -1. */
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 91fe137..fba871c 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -109,11 +109,11 @@ bool strict_lock_default(files_struct *fsp, struct 
lock_struct *plock)
 
        if (strict_locking == Auto) {
                if  (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) && 
(plock->lock_type == READ_LOCK || plock->lock_type == WRITE_LOCK)) {
-                       DEBUG(10,("is_locked: optimisation - exclusive oplock 
on file %s\n", fsp->fsp_name ));
+                       DEBUG(10,("is_locked: optimisation - exclusive oplock 
on file %s\n", fsp_str_dbg(fsp)));
                        ret = True;
                } else if ((fsp->oplock_type == LEVEL_II_OPLOCK) &&
                           (plock->lock_type == READ_LOCK)) {
-                       DEBUG(10,("is_locked: optimisation - level II oplock on 
file %s\n", fsp->fsp_name ));
+                       DEBUG(10,("is_locked: optimisation - level II oplock on 
file %s\n", fsp_str_dbg(fsp)));
                        ret = True;
                } else {
                        struct byte_range_lock *br_lck = 
brl_get_locks_readonly(talloc_tos(), fsp);
@@ -149,7 +149,7 @@ bool strict_lock_default(files_struct *fsp, struct 
lock_struct *plock)
                        lock_flav_name(plock->lock_flav),
                        (double)plock->start, (double)plock->size,
                        ret ? "unlocked" : "locked",
-                       plock->fnum, fsp->fsp_name ));
+                       plock->fnum, fsp_str_dbg(fsp)));
 
        return ret;
 }
@@ -259,7 +259,7 @@ struct byte_range_lock *do_lock(struct messaging_context 
*msg_ctx,
                "blocking_lock=%s requested for fnum %d file %s\n",
                lock_flav_name(lock_flav), lock_type_name(lock_type),
                (double)offset, (double)count, blocking_lock ? "true" :
-               "false", fsp->fnum, fsp->fsp_name));
+               "false", fsp->fnum, fsp_str_dbg(fsp)));
 
        br_lck = brl_get_locks(talloc_tos(), fsp);
        if (!br_lck) {
@@ -308,7 +308,8 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
        }
        
        DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for fnum %d 
file %s\n",
-                 (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
+                 (double)offset, (double)count, fsp->fnum,
+                 fsp_str_dbg(fsp)));
 
        br_lck = brl_get_locks(talloc_tos(), fsp);
        if (!br_lck) {
@@ -358,7 +359,8 @@ NTSTATUS do_lock_cancel(files_struct *fsp,
        }
 
        DEBUG(10,("do_lock_cancel: cancel start=%.0f len=%.0f requested for 
fnum %d file %s\n",
-                 (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
+                 (double)offset, (double)count, fsp->fnum,
+                 fsp_str_dbg(fsp)));
 
        br_lck = brl_get_locks(talloc_tos(), fsp);
        if (!br_lck) {
@@ -1311,7 +1313,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, bool 
delete_on_close,
            !lp_delete_readonly(SNUM(fsp->conn))) {
                DEBUG(10,("can_set_delete_on_close: file %s delete on close "
                          "flag set but file attribute is readonly.\n",
-                         fsp->fsp_name ));
+                         fsp_str_dbg(fsp)));
                return NT_STATUS_CANNOT_DELETE;
        }
 
@@ -1322,7 +1324,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, bool 
delete_on_close,
        if (!CAN_WRITE(fsp->conn)) {
                DEBUG(10,("can_set_delete_on_close: file %s delete on "
                          "close flag set but write access denied on share.\n",
-                         fsp->fsp_name ));
+                         fsp_str_dbg(fsp)));
                return NT_STATUS_ACCESS_DENIED;
        }
 
@@ -1334,13 +1336,15 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, 
bool delete_on_close,
        if (!(fsp->access_mask & DELETE_ACCESS)) {
                DEBUG(10,("can_set_delete_on_close: file %s delete on "
                          "close flag set but delete access denied.\n",
-                         fsp->fsp_name ));
+                         fsp_str_dbg(fsp)));
                return NT_STATUS_ACCESS_DENIED;
        }
 
        /* Don't allow delete on close for non-empty directories. */
        if (fsp->is_directory) {
-               return can_delete_directory(fsp->conn, fsp->fsp_name);
+               SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name));
+               return can_delete_directory(fsp->conn,
+                                           fsp->fsp_name->base_name);
        }
 
        return NT_STATUS_OK;
@@ -1422,7 +1426,7 @@ bool set_delete_on_close(files_struct *fsp, bool 
delete_on_close, const UNIX_USE
        DEBUG(10,("set_delete_on_close: %s delete on close flag for "
                  "fnum = %d, file %s\n",
                  delete_on_close ? "Adding" : "Removing", fsp->fnum,
-                 fsp->fsp_name ));
+                 fsp_str_dbg(fsp)));
 
        lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
                                  NULL);
@@ -1443,7 +1447,8 @@ bool set_delete_on_close(files_struct *fsp, bool 
delete_on_close, const UNIX_USE
        set_delete_on_close_lck(lck, delete_on_close, tok);
 
        if (fsp->is_directory) {
-               send_stat_cache_delete_message(fsp->fsp_name);
+               SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name));
+               send_stat_cache_delete_message(fsp->fsp_name->base_name);
        }
 
        TALLOC_FREE(lck);
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 9b51c3a..33ffaf9 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -280,8 +280,9 @@ bool is_posix_locked(files_struct *fsp,
        SMB_OFF_T count;
        int posix_lock_type = map_posix_lock_type(fsp,*plock_type);
 
-       DEBUG(10,("is_posix_locked: File %s, offset = %.0f, count = %.0f, type 
= %s\n",
-               fsp->fsp_name, (double)*pu_offset, (double)*pu_count, 
posix_lock_type_name(*plock_type) ));
+       DEBUG(10,("is_posix_locked: File %s, offset = %.0f, count = %.0f, "
+                 "type = %s\n", fsp_str_dbg(fsp), (double)*pu_offset,
+                 (double)*pu_count,  posix_lock_type_name(*plock_type)));
 
        /*
         * If the requested lock won't fit in the POSIX range, we will
@@ -424,7 +425,7 @@ static void increment_windows_lock_ref_count(files_struct 
*fsp)
        TALLOC_FREE(rec);
 
        DEBUG(10,("increment_windows_lock_ref_count for file now %s = %d\n",
-                 fsp->fsp_name, lock_ref_count ));
+                 fsp_str_dbg(fsp), lock_ref_count));
 }
 
 /****************************************************************************
@@ -460,7 +461,7 @@ void reduce_windows_lock_ref_count(files_struct *fsp, 
unsigned int dcount)
        TALLOC_FREE(rec);
 
        DEBUG(10,("reduce_windows_lock_ref_count for file now %s = %d\n",
-                 fsp->fsp_name, lock_ref_count ));
+                 fsp_str_dbg(fsp), lock_ref_count));
 }
 
 static void decrement_windows_lock_ref_count(files_struct *fsp)
@@ -492,7 +493,7 @@ static int get_windows_lock_ref_count(files_struct *fsp)
        }
 
        DEBUG(10,("get_windows_lock_count for file %s = %d\n",
-                 fsp->fsp_name, lock_ref_count ));
+                 fsp_str_dbg(fsp), lock_ref_count));
 
        return lock_ref_count;
 }
@@ -518,7 +519,7 @@ static void delete_windows_lock_ref_count(files_struct *fsp)
        TALLOC_FREE(rec);
 
        DEBUG(10,("delete_windows_lock_ref_count for file %s\n",
-                 fsp->fsp_name));
+                 fsp_str_dbg(fsp)));
 }
 
 /****************************************************************************
@@ -555,7 +556,7 @@ static void add_fd_to_close_entry(files_struct *fsp)
        TALLOC_FREE(rec);
 
        DEBUG(10,("add_fd_to_close_entry: added fd %d file %s\n",
-                 fsp->fh->fd, fsp->fsp_name ));
+                 fsp->fh->fd, fsp_str_dbg(fsp)));
 }
 
 /****************************************************************************
@@ -945,8 +946,10 @@ bool set_posix_lock_windows_flavour(files_struct *fsp,
        struct lock_list *llist = NULL;
        struct lock_list *ll = NULL;
 
-       DEBUG(5,("set_posix_lock_windows_flavour: File %s, offset = %.0f, count 
= %.0f, type = %s\n",
-                       fsp->fsp_name, (double)u_offset, (double)u_count, 
posix_lock_type_name(lock_type) ));
+       DEBUG(5,("set_posix_lock_windows_flavour: File %s, offset = %.0f, "
+                "count = %.0f, type = %s\n", fsp_str_dbg(fsp),
+                (double)u_offset, (double)u_count,
+                posix_lock_type_name(lock_type)));
 
        /*
         * If the requested lock won't fit in the POSIX range, we will
@@ -1079,8 +1082,9 @@ bool release_posix_lock_windows_flavour(files_struct *fsp,
        struct lock_list *ulist = NULL;
        struct lock_list *ul = NULL;
 
-       DEBUG(5,("release_posix_lock_windows_flavour: File %s, offset = %.0f, 
count = %.0f\n",
-               fsp->fsp_name, (double)u_offset, (double)u_count ));
+       DEBUG(5,("release_posix_lock_windows_flavour: File %s, offset = %.0f, "
+                "count = %.0f\n", fsp_str_dbg(fsp),
+                (double)u_offset, (double)u_count));
 
        /* Remember the number of Windows locks we have on this dev/ino pair. */
        decrement_windows_lock_ref_count(fsp);
@@ -1197,8 +1201,10 @@ bool set_posix_lock_posix_flavour(files_struct *fsp,
        SMB_OFF_T count;
        int posix_lock_type = map_posix_lock_type(fsp,lock_type);
 
-       DEBUG(5,("set_posix_lock_posix_flavour: File %s, offset = %.0f, count = 
%.0f, type = %s\n",
-                       fsp->fsp_name, (double)u_offset, (double)u_count, 
posix_lock_type_name(lock_type) ));
+       DEBUG(5,("set_posix_lock_posix_flavour: File %s, offset = %.0f, count "
+                "= %.0f, type = %s\n", fsp_str_dbg(fsp),
+                (double)u_offset, (double)u_count,
+                posix_lock_type_name(lock_type)));
 
        /*
         * If the requested lock won't fit in the POSIX range, we will
@@ -1241,8 +1247,9 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
        struct lock_list *ulist = NULL;
        struct lock_list *ul = NULL;
 
-       DEBUG(5,("release_posix_lock_posix_flavour: File %s, offset = %.0f, 
count = %.0f\n",
-               fsp->fsp_name, (double)u_offset, (double)u_count ));
+       DEBUG(5,("release_posix_lock_posix_flavour: File %s, offset = %.0f, "
+                "count = %.0f\n", fsp_str_dbg(fsp),
+                (double)u_offset, (double)u_count));
 
        /*
         * If the requested lock won't fit in the POSIX range, we will
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 9b3c872..748f17d 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -183,7 +183,8 @@ static int smbacl4_fGetFileOwner(files_struct *fsp, 
SMB_STRUCT_STAT *psbuf)
        memset(psbuf, 0, sizeof(SMB_STRUCT_STAT));
 
        if (fsp->is_directory || fsp->fh->fd == -1) {
-               return smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, psbuf);
+               return smbacl4_GetFileOwner(fsp->conn,
+                                           fsp->fsp_name->base_name, psbuf);
        }
        if (SMB_VFS_FSTAT(fsp, psbuf) != 0)
        {
@@ -327,7 +328,7 @@ NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
 {
        SMB_STRUCT_STAT sbuf;
 
-       DEBUG(10, ("smb_fget_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
+       DEBUG(10, ("smb_fget_nt_acl_nfs4 invoked for %s\n", fsp_str_dbg(fsp)));
 
        if (smbacl4_fGetFileOwner(fsp, &sbuf)) {
                return map_nt_error_from_unix(errno);
@@ -717,7 +718,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
        gid_t newGID = (gid_t)-1;
        int saved_errno;
 
-       DEBUG(10, ("smb_set_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
+       DEBUG(10, ("smb_set_nt_acl_nfs4 invoked for %s\n", fsp_str_dbg(fsp)));
 
        if ((security_info_sent & (DACL_SECURITY_INFORMATION |
                GROUP_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION)) == 0)
@@ -743,26 +744,23 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
                }
                if (((newUID != (uid_t)-1) && (sbuf.st_ex_uid != newUID)) ||
                    ((newGID != (gid_t)-1) && (sbuf.st_ex_gid != newGID))) {
-                       struct smb_filename *smb_fname = NULL;
-                       NTSTATUS status;
 
-                       status = create_synthetic_smb_fname_split(talloc_tos(),
-                           fsp->fsp_name, NULL, &smb_fname);
-                       if (!NT_STATUS_IS_OK(status)) {
-                               return status;
-                       }
-                       if(try_chown(fsp->conn, smb_fname, newUID, newGID)) {
-                               DEBUG(3,("chown %s, %u, %u failed. Error = 
%s.\n",
-                                        fsp->fsp_name, (unsigned int)newUID, 
(unsigned int)newGID, 
+                       if(try_chown(fsp->conn, fsp->fsp_name, newUID,
+                                    newGID)) {
+                               DEBUG(3,("chown %s, %u, %u failed. Error = "
+                                        "%s.\n", fsp_str_dbg(fsp),
+                                        (unsigned int)newUID,
+                                        (unsigned int)newGID,
                                         strerror(errno)));
-                               TALLOC_FREE(smb_fname);
                                return map_nt_error_from_unix(errno);
                        }
-                       TALLOC_FREE(smb_fname);
 
                        DEBUG(10,("chown %s, %u, %u succeeded.\n",
-                                 fsp->fsp_name, (unsigned int)newUID, 
(unsigned int)newGID));
-                       if (smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, 
&sbuf))
+                                 fsp_str_dbg(fsp), (unsigned int)newUID,
+                                 (unsigned int)newGID));
+                       if (smbacl4_GetFileOwner(fsp->conn,
+                                                fsp->fsp_name->base_name,
+                                                &sbuf))
                                return map_nt_error_from_unix(errno);
 
                        /* If we successfully chowned, we know we must
@@ -777,7 +775,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
                return NT_STATUS_OK;
        }
 
-       theacl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, &params,
+       theacl = smbacl4_win2nfs4(fsp->fsp_name->base_name, psd->dacl, &params,
                                  sbuf.st_ex_uid, sbuf.st_ex_gid);
        if (!theacl)
                return map_nt_error_from_unix(errno);
diff --git a/source3/modules/onefs_acl.c b/source3/modules/onefs_acl.c


-- 
Samba Shared Repository

Reply via email to