apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/include apr_user.h
Date Tue, 20 Nov 2001 22:44:46 GMT
wrowe       01/11/20 14:44:46

  Modified:    user/unix groupinfo.c
               include  apr_user.h
  Log:
    Implement apr_get_groupid [to mirror apr_get_userid]
  
  Revision  Changes    Path
  1.6       +19 -0     apr/user/unix/groupinfo.c
  
  Index: groupinfo.c
  ===================================================================
  RCS file: /home/cvs/apr/user/unix/groupinfo.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- groupinfo.c	2001/07/20 12:36:13	1.5
  +++ groupinfo.c	2001/11/20 22:44:46	1.6
  @@ -86,3 +86,22 @@
       return APR_SUCCESS;
   }
     
  +APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, const char *groupname, apr_pool_t
*p)
  +{
  +    struct group *gr;
  +#ifndef BEOS
  +
  +#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R)
  +    struct group grp;
  +    char grbuf[512];
  +
  +    if (getgrnam_r(&grpname, &gr, grbuf, sizeof(grbuf))) {
  +#else
  +    if ((gr = getgrnam(groupname)) == NULL) {
  +#endif
  +        return errno;
  +    }
  +    *groupid = gr->gr_gid;
  +#endif
  +    return APR_SUCCESS;
  +}
  
  
  
  1.16      +13 -4     apr/include/apr_user.h
  
  Index: apr_user.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_user.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- apr_user.h	2001/08/24 17:55:45	1.15
  +++ apr_user.h	2001/11/20 22:44:46	1.16
  @@ -144,19 +144,28 @@
   #if defined(WIN32)
   APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right);
   #else
  -#define apr_compare_users(left,right) ((left == right) ? APR_SUCCESS : APR_EMISMATCH)
  +#define apr_compare_users(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
   #endif
   
   /**
    * Get the group name for a specified groupid
  - * @param dirname Pointer to new string containing group name (on output)
  - * @param userid The groupid
  + * @param groupname Pointer to new string containing group name (on output)
  + * @param groupid The groupid
    * @param p The pool from which to allocate the string
    * @remark This function is available only if APR_HAS_USER is defined.
    */
   APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname, apr_gid_t groupid, apr_pool_t
*p);
   
   /**
  + * Get the groupid for a specified group name
  + * @param groupid Pointer to the group id (on output)
  + * @param groupname The group name to look up
  + * @param p The pool from which to allocate the string
  + * @remark This function is available only if APR_HAS_USER is defined.
  + */
  +APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, const char *groupname, apr_pool_t
*p);
  +
  +/**
    * Compare two group identifiers for equality.
    * @param left One gid to test
    * @param right Another gid to test
  @@ -167,7 +176,7 @@
   #if defined(WIN32)
   APR_DECLARE(apr_status_t) apr_compare_groups(apr_gid_t left, apr_gid_t right);
   #else
  -#define apr_compare_groups(left,right) ((left == right) ? APR_SUCCESS : APR_EMISMATCH)
  +#define apr_compare_groups(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
   #endif
   
   #endif  /* ! APR_HAS_USER */
  
  
  

Mime
View raw message