vfs_preopen: Fix for O_NOFOLLOW
authorVolker Lendecke <vl@samba.org>
Wed, 26 Jun 2019 15:42:54 +0000 (17:42 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 28 Jun 2019 15:00:31 +0000 (17:00 +0200)
Since 4301505d977449d core smbd code passes O_NOFOLLOW together with
[O_RDONLY|O_RDWR] as flags. This breaks activating vfs_preopen, we
need to look at *just* the access mode.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/modules/vfs_preopen.c

index 24d33fafacdc45f40723c02b69db75098d8fcf96..27d218e1b87536bfb8955c71a4ff4922def3cc37 100644 (file)
@@ -400,7 +400,7 @@ static int preopen_open(vfs_handle_struct *handle,
                return -1;
        }
 
-       if (flags != O_RDONLY) {
+       if ((flags & O_ACCMODE) != O_RDONLY) {
                return res;
        }