summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorBjörn Jacke <bj@sernet.de>2012-07-04 00:33:41 +0200
committerBjoern Jacke <bj@sernet.de>2012-07-04 12:01:20 +0200
commitb40fb6eec55cecc30d7500bb6b9799e2e9324f44 (patch)
tree093fa7fcac3662b3749e60827554a749d4ae15fe /source3
parent74bf0c6ec63955156f7acf673e2c5846bb8b212a (diff)
downloadsamba-b40fb6eec55cecc30d7500bb6b9799e2e9324f44.tar.gz
s3: if we know a file is immutable, report it to be readonly
on *BSD we get the immutable flag via st_flags, we should use that if possible.
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/dosmode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 823d44d0aaf..747ba2169a0 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -170,6 +170,12 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn,
int result = 0;
enum mapreadonly_options ro_opts = (enum mapreadonly_options)lp_map_readonly(SNUM(conn));
+#if defined(UF_IMMUTABLE) && defined(SF_IMMUTABLE)
+ /* if we can find out if a file is immutable we should report it r/o */
+ if (smb_fname->st.st_ex_flags & (UF_IMMUTABLE | SF_IMMUTABLE)) {
+ result |= FILE_ATTRIBUTE_READONLY;
+ }
+#endif
if (ro_opts == MAP_READONLY_YES) {
/* Original Samba method - map inverse of user "w" bit. */
if ((smb_fname->st.st_ex_mode & S_IWUSR) == 0) {