Patch for unix_mode

George Sexton gsexton at
Mon Apr 28 14:03:12 GMT 2003

This patch enables the command line attrib program to make files read-only
when the force create mode is set to RW. It is often desirable to have files
created read-write, but have the ability to change the file to read-only.
One package that extensively uses Read-Only attributes is Microsoft Visual
Source Safe.

The application of "force security mode" here rather than "force create
mode" is more intuitive, and more along the lines of what an administrator
would expect to be happening. I don't think it's intuitive that the value of
"force create mode" applies to any other operation besides creation of the

diff -rU5 samba-2.2.8a/source/smbd/dosmode.c
--- samba-2.2.8a/source/smbd/dosmode.c	2002-04-30 07:28:19.000000000 -0600
+++ samba-2.2.8aRO/source/smbd/dosmode.c	2003-04-28 07:49:23.000000000 -0600
@@ -102,11 +102,11 @@
         &  (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH);
     } else {
       /* Apply mode mask */
       result &= lp_create_mask(SNUM(conn));
       /* Add in force bits */
-      result |= lp_force_create_mode(SNUM(conn));
+      result |= lp_force_security_mode(SNUM(conn));

   DEBUG(3,("unix_mode(%s) returning 0%o\n",fname,(int)result ));

George Sexton
MH Software, Inc.
Voice: 303 438 9585

More information about the samba-technical mailing list