Delete-on-close Query - SMB

This is a discussion on Delete-on-close Query - SMB ; Running Samba 3.0.23 on HPUX 11.11 Samba is setup up so that it can read, write, create files in a directory but NOT delete. When attempting to delete a file in this directory from a client via a share, the ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Delete-on-close Query

  1. Delete-on-close Query

    Running Samba 3.0.23 on HPUX 11.11

    Samba is setup up so that it can read, write, create files in a directory
    but NOT delete.

    When attempting to delete a file in this directory from a client via a
    share, the file is NOT deleted but there is NO error message displayed on
    the client. The file is not deleted due to "permission denied" but there is
    no indication of this error on the windows client.

    I think the reason for this is that if Samba cannot delete the file via
    SMB_VFS_UNLINK, no error is set even if the error is due to EACESS. The
    relevant piece of code is in function close_remove_share_mode() as follows:

    } else if(SMB_VFS_UNLINK(conn,fsp->fsp_name) != 0) {
    /*
    * This call can potentially fail as another
    smbd may have
    * had the file open with delete on close
    set and deleted
    * it when its last reference to this file
    went away. Hence
    * we log this but not at debug level zero.
    */

    DEBUG(5,("close_remove_share_mode: file %s.
    Delete on close was set "
    "and unlink failed with error %s\n",
    fsp->fsp_name, strerror(errno) ));

    As you can see, if the UNLINK fails is assumes it's because of "another smbd
    may have had the file open with delete". In my case, it's NOT because of
    this but because of lack of permission to delete the file.

    I added code to return error is the UNLINK fails due to EACESS and still no
    error message on the windows client if the delete is attempted.

    Anyone encountered this problem or know what this is all about?



  2. Re: Delete-on-close Query

    On Thu, 27 Jul 2006 22:57:12 +0000, Cesar Neri wrote:

    > Running Samba 3.0.23 on HPUX 11.11
    >
    > Samba is setup up so that it can read, write, create files in a directory
    > but NOT delete.
    >
    > When attempting to delete a file in this directory from a client via a
    > share, the file is NOT deleted but there is NO error message displayed on
    > the client. The file is not deleted due to "permission denied" but there
    > is no indication of this error on the windows client.


    Your problem is caused by the fact that modern (ie. XP) redirectors
    delete files by opening them with delete-on-close access and the
    insist that the access denied message be returned on the open call,
    not on the actual delete (which takes place on the close) or they
    won't display an error. Yes this is insane (I wonder if Microsoft
    documented this in their "new" EU docs, but that's another matter :-).

    For Samba to duplicate this ensure you have "acl check permissions = true"
    for this share.

    Jeremy.

+ Reply to Thread