Add const to the smb_filename argument of smbd_check_access_rights().
authorJeremy Allison <jra@samba.org>
Fri, 4 Nov 2011 22:39:55 +0000 (15:39 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 4 Nov 2011 22:39:55 +0000 (15:39 -0700)
source3/smbd/file_access.c
source3/smbd/open.c
source3/smbd/proto.h

index 74855649ea2fe2b4b971581b2660f3445f0373d7..c2203673f3d86236eb1abb4b1c946232536a9227 100644 (file)
@@ -80,7 +80,7 @@ bool can_access_file_acl(struct connection_struct *conn,
 ****************************************************************************/
 
 bool can_delete_file_in_directory(connection_struct *conn,
-                                 struct smb_filename *smb_fname)
+                                 const struct smb_filename *smb_fname)
 {
        TALLOC_CTX *ctx = talloc_tos();
        char *dname = NULL;
@@ -130,18 +130,10 @@ bool can_delete_file_in_directory(connection_struct *conn,
        /* sticky bit means delete only by owner of file or by root or
         * by owner of directory. */
        if (smb_fname_parent->st.st_ex_mode & S_ISVTX) {
-               if(SMB_VFS_STAT(conn, smb_fname) != 0) {
-                       if (errno == ENOENT) {
-                               /* If the file doesn't already exist then
-                                * yes we'll be able to delete it. */
-                               ret = true;
-                               goto out;
-                       }
-                       DEBUG(10,("can_delete_file_in_directory: can't "
-                                 "stat file %s (%s)",
-                                 smb_fname_str_dbg(smb_fname),
-                                 strerror(errno) ));
-                       ret = false;
+               if (!VALID_STAT(smb_fname->st)) {
+                       /* If the file doesn't already exist then
+                        * yes we'll be able to delete it. */
+                       ret = true;
                        goto out;
                }
 
index bd022ecd59966e9b33f2fa323a03dbf4b0abbaf1..2f79908b626cdad904740f4cde33f818ee39c787 100644 (file)
@@ -44,7 +44,7 @@ struct deferred_open_record {
 ****************************************************************************/
 
 static bool parent_override_delete(connection_struct *conn,
-                                       struct smb_filename *smb_fname,
+                                       const struct smb_filename *smb_fname,
                                        uint32_t access_mask,
                                        uint32_t rejected_mask)
 {
@@ -61,7 +61,7 @@ static bool parent_override_delete(connection_struct *conn,
 ****************************************************************************/
 
 NTSTATUS smbd_check_access_rights(struct connection_struct *conn,
-                               struct smb_filename *smb_fname,
+                               const struct smb_filename *smb_fname,
                                uint32_t access_mask)
 {
        /* Check if we have rights to open. */
index ff56b15dd0bd8fe0dc26e46deede8f9785877055..0b7c28fb9112b538594eff18154d9cda677f17cf 100644 (file)
@@ -307,7 +307,7 @@ bool can_access_file_acl(struct connection_struct *conn,
                         const struct smb_filename *smb_fname,
                         uint32_t access_mask);
 bool can_delete_file_in_directory(connection_struct *conn,
-                                 struct smb_filename *smb_fname);
+                                 const struct smb_filename *smb_fname);
 bool can_access_file_data(connection_struct *conn,
                          const struct smb_filename *smb_fname,
                          uint32 access_mask);
@@ -581,7 +581,7 @@ void reply_nttranss(struct smb_request *req);
 /* The following definitions come from smbd/open.c  */
 
 NTSTATUS smbd_check_access_rights(struct connection_struct *conn,
-                               struct smb_filename *smb_fname,
+                               const struct smb_filename *smb_fname,
                                uint32_t access_mask);
 NTSTATUS fd_close(files_struct *fsp);
 void change_file_owner_to_parent(connection_struct *conn,