Added the O_NOFOLLOW flag if follow symlinks is set off.
[ira/wip.git] / source / smbd / open.c
index 72f73deb84bb7a22aeee38b047127df1ab6ca8e4..b42c1bacc34dba2c96fae3a4284eea4494a7cfa7 100644 (file)
@@ -37,6 +37,12 @@ static int fd_open(struct connection_struct *conn, char *fname,
 #ifdef O_NONBLOCK
        flags |= O_NONBLOCK;
 #endif
+
+#ifdef O_NOFOLLOW
+       if (!lp_symlinks(SNUM(conn)))
+               flags |= O_NOFOLLOW;
+#endif
+
        fd = conn->vfs_ops.open(conn,fname,flags,mode);
 
        /* Fix for files ending in '.' */