summaryrefslogtreecommitdiff
path: root/source3/smbd/dosmode.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-08-25 06:40:42 +0000
committerAndrew Tridgell <tridge@samba.org>1998-08-25 06:40:42 +0000
commit2c065107b149797e2a42a6c119f883d30be411eb (patch)
tree8bc6207a508911fa09f8651fd60dfce4e63c4eac /source3/smbd/dosmode.c
parent5ae06b99c06313d1465b03d5120e7fbf6a87b9e5 (diff)
downloadsamba-2c065107b149797e2a42a6c119f883d30be411eb.tar.gz
samba-2c065107b149797e2a42a6c119f883d30be411eb.tar.bz2
samba-2c065107b149797e2a42a6c119f883d30be411eb.zip
changed the default permissions code to do this:
if ((sbuf->st_mode & S_IWUSR) == 0) result |= aRONLY; rather than the very complex user/group permissions checks we do currently. This is equivalent ot setting "alternate permissions = yes" in the old code. The change is motivated by three main reasons: 1) it's basically impossible to second guess whether a file is writeable without trying to open it for writing. ACLs, root squash etc just make it too hard. 2) setting it not RONLY if the owner can write is closer to what NT does (eg. look at a cdrom - files are not marked read only). 3) it prevents the silly problem of copying files from a read only share to a writeable share and then finding you can't write to them as windows preserves the RONLY flag. Lots of people get bitten by this when they drag a folder from a Samba drive. It also hurts some install programs. I have also added a new flag type for loadparm.c called FLAG_DEPRECATED which I've set for "alternate permissions". I'll soon add code to testparm to give a warning about deprecated options. (This used to be commit c4363a12fdc0be329ca2bfeb1d7b89bfe90031dc)
Diffstat (limited to 'source3/smbd/dosmode.c')
-rw-r--r--source3/smbd/dosmode.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 9db3e208b5..da7fdfb973 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -78,22 +78,11 @@ mode_t unix_mode(connection_struct *conn,int dosmode)
int dos_mode(connection_struct *conn,char *path,struct stat *sbuf)
{
int result = 0;
- extern struct current_user current_user;
DEBUG(8,("dos_mode: %s\n", path));
- if (CAN_WRITE(conn) && !lp_alternate_permissions(SNUM(conn))) {
- if (!((sbuf->st_mode & S_IWOTH) ||
- conn->admin_user ||
- ((sbuf->st_mode & S_IWUSR) && current_user.uid==sbuf->st_uid) ||
- ((sbuf->st_mode & S_IWGRP) &&
- in_group(sbuf->st_gid,current_user.gid,
- current_user.ngroups,current_user.groups))))
- result |= aRONLY;
- } else {
- if ((sbuf->st_mode & S_IWUSR) == 0)
+ if ((sbuf->st_mode & S_IWUSR) == 0)
result |= aRONLY;
- }
if (MAP_ARCHIVE(conn) && ((sbuf->st_mode & S_IXUSR) != 0))
result |= aARCH;