You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2004/05/05 04:57:41 UTC
cvs commit: apr/include apr_file_info.h
trawick 2004/05/04 19:57:41
Modified: . Tag: APR_0_9_BRANCH CHANGES
file_io/unix Tag: APR_0_9_BRANCH fileacc.c
include Tag: APR_0_9_BRANCH apr_file_info.h
Log:
backport this from 1.0-dev:
* include/apr_file_info.h, file_io/unix/fileacc.c (apr_unix_mode2perms,
apr_unix_perms2mode): Support setuid, setgid and sticky bits.
Submitted by: Andr� Malo
Revision Changes Path
No revision
No revision
1.426.2.19 +3 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.426.2.18
retrieving revision 1.426.2.19
diff -u -r1.426.2.18 -r1.426.2.19
--- CHANGES 4 May 2004 00:46:03 -0000 1.426.2.18
+++ CHANGES 5 May 2004 02:57:41 -0000 1.426.2.19
@@ -1,5 +1,8 @@
Changes with APR 0.9.5
+ *) Support setuid, setgid and sticky file permissions bits on Unix.
+ [Andr� Malo]
+
*) Fix sign error in apr_file_seek(APR_END).
[Greg Hudson <ghudson MIT.EDU>]
No revision
No revision
1.56.2.2 +16 -0 apr/file_io/unix/fileacc.c
Index: fileacc.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/fileacc.c,v
retrieving revision 1.56.2.1
retrieving revision 1.56.2.2
diff -u -r1.56.2.1 -r1.56.2.2
--- fileacc.c 13 Feb 2004 09:33:43 -0000 1.56.2.1
+++ fileacc.c 5 May 2004 02:57:41 -0000 1.56.2.2
@@ -35,6 +35,8 @@
{
mode_t mode = 0;
+ if (perms & APR_USETID)
+ mode |= S_ISUID;
if (perms & APR_UREAD)
mode |= S_IRUSR;
if (perms & APR_UWRITE)
@@ -42,6 +44,8 @@
if (perms & APR_UEXECUTE)
mode |= S_IXUSR;
+ if (perms & APR_GSETID)
+ mode |= S_ISGID;
if (perms & APR_GREAD)
mode |= S_IRGRP;
if (perms & APR_GWRITE)
@@ -49,6 +53,10 @@
if (perms & APR_GEXECUTE)
mode |= S_IXGRP;
+#ifdef S_ISVTX
+ if (perms & APR_WSTICKY)
+ mode |= S_ISVTX;
+#endif
if (perms & APR_WREAD)
mode |= S_IROTH;
if (perms & APR_WWRITE)
@@ -63,6 +71,8 @@
{
apr_fileperms_t perms = 0;
+ if (mode & S_ISUID)
+ perms |= APR_USETID;
if (mode & S_IRUSR)
perms |= APR_UREAD;
if (mode & S_IWUSR)
@@ -70,6 +80,8 @@
if (mode & S_IXUSR)
perms |= APR_UEXECUTE;
+ if (mode & S_ISGID)
+ perms |= APR_GSETID;
if (mode & S_IRGRP)
perms |= APR_GREAD;
if (mode & S_IWGRP)
@@ -77,6 +89,10 @@
if (mode & S_IXGRP)
perms |= APR_GEXECUTE;
+#ifdef S_ISVTX
+ if (mode & S_ISVTX)
+ perms |= APR_WSTICKY;
+#endif
if (mode & S_IROTH)
perms |= APR_WREAD;
if (mode & S_IWOTH)
No revision
No revision
1.40.2.5 +3 -0 apr/include/apr_file_info.h
Index: apr_file_info.h
===================================================================
RCS file: /home/cvs/apr/include/apr_file_info.h,v
retrieving revision 1.40.2.4
retrieving revision 1.40.2.5
diff -u -r1.40.2.4 -r1.40.2.5
--- apr_file_info.h 20 Mar 2004 15:49:57 -0000 1.40.2.4
+++ apr_file_info.h 5 May 2004 02:57:41 -0000 1.40.2.5
@@ -75,14 +75,17 @@
* @{
*/
+#define APR_USETID 0x0800 /**< Set user id */
#define APR_UREAD 0x0400 /**< Read by user */
#define APR_UWRITE 0x0200 /**< Write by user */
#define APR_UEXECUTE 0x0100 /**< Execute by user */
+#define APR_GSETID 0x0080 /**< Set group id */
#define APR_GREAD 0x0040 /**< Read by group */
#define APR_GWRITE 0x0020 /**< Write by group */
#define APR_GEXECUTE 0x0010 /**< Execute by group */
+#define APR_WSTICKY 0x0008 /**< Sticky bit */
#define APR_WREAD 0x0004 /**< Read by others */
#define APR_WWRITE 0x0002 /**< Write by others */
#define APR_WEXECUTE 0x0001 /**< Execute by others */