[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
acl: fix Solaris 10+ code
From: |
Bruno Haible |
Subject: |
acl: fix Solaris 10+ code |
Date: |
Sun, 8 Jun 2008 16:36:50 +0200 |
User-agent: |
KMail/1.5.4 |
I said, I don't touch Paul Eggert's code for Solaris 10+/11 systems. But
here it is buggy: The POSIX-draft like code contains special handling for
setuid/setgid modes (because the ACL contains only the 0777 part of the mode).
But it is missing in the Solaris 10+/11 code.
I'm committing this. Please proofread; I cannot test it since I don't have
access to such systems.
2008-06-08 Bruno Haible <address@hidden>
Fix bug with setuid modes in Solaris 10+ code.
* lib/set-mode-acl.c (qset_acl): Call chmod_or_fchmod when acl_set
succeeded, when the mode contains some special bits.
*** lib/set-mode-acl.c.orig 2008-06-08 16:29:25.000000000 +0200
--- lib/set-mode-acl.c 2008-06-08 16:21:48.000000000 +0200
***************
*** 206,211 ****
--- 206,213 ----
acl_t *aclp;
char acl_text[] = "user::---,group::---,mask:---,other:---";
+ int ret;
+ int saved_errno;
if (mode & S_IRUSR) acl_text[ 6] = 'r';
if (mode & S_IWUSR) acl_text[ 7] = 'w';
***************
*** 222,240 ****
errno = ENOMEM;
return -1;
}
! else
{
! int ret = (desc < 0 ? acl_set (name, aclp) : facl_set (desc, aclp));
! int saved_errno = errno;
! acl_free (aclp);
! if (ret == 0 || saved_errno != ENOSYS)
! {
! errno = saved_errno;
! return ret;
! }
}
! return chmod_or_fchmod (name, desc, mode);
# else /* Solaris, Cygwin, general case */
--- 224,248 ----
errno = ENOMEM;
return -1;
}
!
! ret = (desc < 0 ? acl_set (name, aclp) : facl_set (desc, aclp));
! saved_errno = errno;
! acl_free (aclp);
! if (ret < 0)
{
! if (saved_errno == ENOSYS)
! return chmod_or_fchmod (name, desc, mode);
! errno = saved_errno;
! return -1;
}
! if (mode & (S_ISUID | S_ISGID | S_ISVTX))
! {
! /* We did not call chmod so far, so the special bits have not yet
! been set. */
! return chmod_or_fchmod (name, desc, mode);
! }
! return 0;
# else /* Solaris, Cygwin, general case */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- acl: fix Solaris 10+ code,
Bruno Haible <=