You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2004/04/21 23:11:21 UTC

cvs commit: apr/file_io/unix fileacc.c

jorton      2004/04/21 14:11:21

  Modified:    .        CHANGES
               include  apr_file_info.h
               file_io/unix fileacc.c
  Log:
  * 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 <nd...@perlig.de>
  
  Revision  Changes    Path
  1.463     +4 -1      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.462
  retrieving revision 1.463
  diff -w -d -u -r1.462 -r1.463
  --- CHANGES	21 Apr 2004 01:01:28 -0000	1.462
  +++ CHANGES	21 Apr 2004 21:11:21 -0000	1.463
  @@ -7,6 +7,9 @@
   
   Changes with APR 1.0
   
  +  *) Support setuid, setgid and sticky file permissions bits on Unix.
  +     [Andr� Malo]
  +
     *) Add new functions apr_signal_block, apr_signal_unblock to block/unblock
        the delivery of a particular signal. [Madhusudan Mathihalli]
   
  
  
  
  1.45      +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.44
  retrieving revision 1.45
  diff -w -d -u -r1.44 -r1.45
  --- apr_file_info.h	19 Feb 2004 09:55:12 -0000	1.44
  +++ apr_file_info.h	21 Apr 2004 21:11:21 -0000	1.45
  @@ -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 */
  
  
  
  1.58      +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.57
  retrieving revision 1.58
  diff -w -d -u -r1.57 -r1.58
  --- fileacc.c	13 Feb 2004 09:38:25 -0000	1.57
  +++ fileacc.c	21 Apr 2004 21:11:21 -0000	1.58
  @@ -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)