r6378: Other systems may not return 1 for checking WRITE permission.
authorJeremy Allison <jra@samba.org>
Mon, 18 Apr 2005 22:53:51 +0000 (22:53 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:56:39 +0000 (10:56 -0500)
Canaonicalise any +ve return to 1.
Jeremy.

source/smbd/posix_acls.c

index 353f9a3b0384fe68fc0bd3aee98298229abeac09..04429d0456d3ba1028bf6051f8c2377ea18108b5 100644 (file)
@@ -3742,6 +3742,7 @@ BOOL set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *
 
 /****************************************************************************
  Check for POSIX group ACLs. If none use stat entry.
+ Return -1 if no match, 0 if match and denied, 1 if match and allowed.
 ****************************************************************************/
 
 static int check_posix_acl_group_write(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf)
@@ -3782,6 +3783,12 @@ static int check_posix_acl_group_write(connection_struct *conn, const char *fnam
                        goto check_stat;
                }
 
+               /*
+                * Solaris returns 2 for this if write is available.
+                * canonicalize to 0 or 1.
+                */     
+               have_write = (have_write ? 1 : 0);
+
                switch(tagtype) {
                        case SMB_ACL_MASK:
                                if (!have_write) {
@@ -3845,6 +3852,12 @@ match on user %u -> %s.\n", fname, (unsigned int)*puid, ret ? "can write" : "can
                        goto check_stat;
                }
 
+               /*
+                * Solaris returns 2 for this if write is available.
+                * canonicalize to 0 or 1.
+                */     
+               have_write = (have_write ? 1 : 0);
+
                switch(tagtype) {
                        case SMB_ACL_GROUP:
                        {