Hi! I noticed that dazuko 2.0.6 running on Linux 2.6 cannot tell if file
was opened O_WRONLY or O_RDWR, they are both reported as O_WRONLY.

I guess the problem happened because the open flags are not bit masks
like the MAY_* flags passed to inode_permission callback.

The patch below seems to correct open flag reporting.

--- orig/dazuko_linux26.c
+++ mod/dazuko_linux26.c
@@ -734,15 +734,22 @@
        }
        else
        {
-               /* mask == 0 is passed in when a file is created */
-               if (mask == 0 || (mask & (MAY_WRITE|MAY_APPEND)) != 0)
+               if (mask == MAY_READ)
                {
-                       event_p.flags |= O_WRONLY;
+                       event_p.flags = O_RDONLY;
                        event_p.set_flags = 1;
-               }
-               if ((mask & MAY_READ) != 0)
+               }
+               /* mask == 0 is passed in when a file is created */
+               else if (mask == 0 || (mask & (MAY_WRITE|MAY_APPEND)) != 0)
                {
-                       event_p.flags |= O_RDONLY;
+                       if ((mask & MAY_READ) != 0)
+                       {
+                               event_p.flags = O_RDWR;
+                       }
+                       else
+                       {
+                               event_p.flags = O_WRONLY;
+                       }
                        event_p.set_flags = 1;
                }
        }



-- 
Sami Tikka                          tel: +358 9 2520 5115
Senior Software Engineer            fax: +358 9 2520 5013
F-Secure Corporation                http://www.F-Secure.com/
Be Sure.


_______________________________________________
Dazuko-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/dazuko-devel

Reply via email to