diff options
author | Jeremy Allison <jra@samba.org> | 2005-10-14 01:09:37 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:04:59 -0500 |
commit | a1eb5255042c3ff246e27a3cd3cdfd869c5542d3 (patch) | |
tree | d3bc22ba07ca4b99d07d23eb7bc4d3e00dfef02c /source3/smbd/dosmode.c | |
parent | ca0a4c8c68c5b2ed1d6ef0e524500fba77ef4b3c (diff) | |
download | samba-a1eb5255042c3ff246e27a3cd3cdfd869c5542d3.tar.gz samba-a1eb5255042c3ff246e27a3cd3cdfd869c5542d3.tar.xz samba-a1eb5255042c3ff246e27a3cd3cdfd869c5542d3.zip |
r10979: After discussions on IRC about profile shares,
added new parameter : map readonly = [yes|no|permissions]
If yes: map inverse of user "w" bit to mean readonly.
If no: never set DOS readonly bit.
If permissions: check file permissions for user and set readonly
bit if the current user cannot write.
If store dos attributes is set to yes then this parameter
is ignored.
Jeremy.
(This used to be commit da4238d18c7a57d1264db8517fb027a10a11baed)
Diffstat (limited to 'source3/smbd/dosmode.c')
-rw-r--r-- | source3/smbd/dosmode.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index efbd5f04cb9..fec148b8e63 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -129,14 +129,19 @@ mode_t unix_mode(connection_struct *conn, int dosmode, const char *fname, BOOL c uint32 dos_mode_from_sbuf(connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) { int result = 0; + enum mapreadonly_options ro_opts = (enum mapreadonly_options)lp_map_readonly(SNUM(conn)); - if (lp_acl_check_permissions(SNUM(conn))) { + if (ro_opts == MAP_READONLY_YES) { + /* Original Samba method - map inverse of user "w" bit. */ + if ((sbuf->st_mode & S_IWUSR) == 0) { + result |= aRONLY; + } + } else if (ro_opts == MAP_READONLY_PERMISSIONS) { + /* Check actual permissions for read-only. */ if (!can_write_to_file(conn, path, sbuf)) { result |= aRONLY; } - } else if ((sbuf->st_mode & S_IWUSR) == 0) { - result |= aRONLY; - } + } /* Else never set the readonly bit. */ if (MAP_ARCHIVE(conn) && ((sbuf->st_mode & S_IXUSR) != 0)) result |= aARCH; |