smbd: refuse_symlink() - do not fail if the file does not exist
authorUri Simchoni <uri@samba.org>
Thu, 2 Mar 2017 06:46:44 +0000 (08:46 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 2 Mar 2017 21:30:23 +0000 (22:30 +0100)
If the file does not exist, it is not a symlink. Current callers
use this function to see if extended attributes can be set / fetched.
Allow them to try and leave the error code at the discretion of the
VFS.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/trans2.c

index f58aacf4f344590f2ecb960740b33c5b951576e4..a2214616dd1aba5c644599473dc2b2ea8ddb2cfa 100644 (file)
@@ -75,8 +75,11 @@ static NTSTATUS refuse_symlink(connection_struct *conn,
                int ret = vfs_stat_smb_basename(conn,
                                smb_fname,
                                &sbuf);
-               if (ret == -1) {
+               if (ret == -1 && errno != ENOENT) {
                        return map_nt_error_from_unix(errno);
+               } else if (ret == -1) {
+                       /* it's not a symlink.. */
+                       return NT_STATUS_OK;
                }
                pst = &sbuf;
        }