projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5aeafeb
)
Fix bug with setuid modes in Solaris 10+ code.
author
Bruno Haible
<bruno@clisp.org>
Sun, 8 Jun 2008 14:33:02 +0000
(16:33 +0200)
committer
Bruno Haible
<bruno@clisp.org>
Sun, 8 Jun 2008 14:33:02 +0000
(16:33 +0200)
ChangeLog
patch
|
blob
|
history
lib/set-mode-acl.c
patch
|
blob
|
history
diff --git
a/ChangeLog
b/ChangeLog
index 91239adce608e108d8db01b9dd4a4dc48134fd97..a8a464f747662e81e14c2a576ac74ccf956698ff 100644
(file)
--- a/
ChangeLog
+++ b/
ChangeLog
@@
-1,3
+1,9
@@
+2008-06-08 Bruno Haible <bruno@clisp.org>
+
+ 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.
+
2008-06-08 Bruno Haible <bruno@clisp.org>
Add support for Solaris 7..10 ACLs.
2008-06-08 Bruno Haible <bruno@clisp.org>
Add support for Solaris 7..10 ACLs.
diff --git
a/lib/set-mode-acl.c
b/lib/set-mode-acl.c
index f0965b539a92dff7b520f8068b1b538d0e51ad1b..0a7fa73ce8b12a7a881a58d013132b515e077815 100644
(file)
--- a/
lib/set-mode-acl.c
+++ b/
lib/set-mode-acl.c
@@
-206,6
+206,8
@@
qset_acl (char const *name, int desc, mode_t mode)
acl_t *aclp;
char acl_text[] = "user::---,group::---,mask:---,other:---";
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';
if (mode & S_IRUSR) acl_text[ 6] = 'r';
if (mode & S_IWUSR) acl_text[ 7] = 'w';
@@
-222,19
+224,25
@@
qset_acl (char const *name, int desc, mode_t mode)
errno = ENOMEM;
return -1;
}
errno = ENOMEM;
return -1;
}
- else
+
+ ret = (desc < 0 ? acl_set (name, aclp) : facl_set (desc, aclp));
+ saved_errno = errno;
+ acl_free (aclp);
+ if (ret < 0)
{
{
- 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;
- }
+ if (saved_errno == ENOSYS)
+ return chmod_or_fchmod (name, desc, mode);
+ errno = saved_errno;
+ return -1;
}
}
- return chmod_or_fchmod (name, desc, mode);
+ 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 */
# else /* Solaris, Cygwin, general case */