apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/user/win32 groupinfo.c userinfo.c
Date Sun, 28 Jan 2001 23:20:49 GMT
wrowe       01/01/28 15:20:49

  Modified:    .        CHANGES
               include  apr_user.h
               user/win32 groupinfo.c userinfo.c
  Log:
    User and Group goodness.  If anyone objects to the non-typesafe unix
    implementation of apr_compare_users/groups - feel free to add saftey.
  
  Revision  Changes    Path
  1.51      +6 -1      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- CHANGES	2001/01/28 12:18:38	1.50
  +++ CHANGES	2001/01/28 23:20:47	1.51
  @@ -1,5 +1,10 @@
   Changes with APR b1  
   
  +  *) Added apr_compare_users() and apr_compare_groups() for more complex
  +     apr_uid_t and apr_gid_t structures.  Enabled both .user and .group
  +     results from WinNT/2000 stat/getfileinfo, but expect to find that 
  +     .group is 'None' in most cases.  [William Rowe]
  +
     *) Replace configure --with-optim option by using the environment
        variable OPTIM instead.  This is needed because configure options
        do not support multiple flags separated by spaces.  [Roy Fielding]
  @@ -9,7 +14,7 @@
   
     *) Abstracted apr_get_username and apr_get_groupname for unix and win32.
        Modified Win32 apr_uid_t and apr_gid_t to use PSIDs, and elimintated
  -     the uid_t and gid_t definitions.
  +     the uid_t and gid_t definitions.  [William Rowe]
   
     *) Radically refactored apr_stat/lstat/getfileinfo/dir_read for Win32
        to assure we are retrieving what we expect to retrieve, and reporting
  
  
  
  1.7       +28 -0     apr/include/apr_user.h
  
  Index: apr_user.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_user.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- apr_user.h	2001/01/28 01:26:19	1.6
  +++ apr_user.h	2001/01/28 23:20:47	1.7
  @@ -110,6 +110,20 @@
   APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *userid, apr_pool_t
*p);
   
   /***
  + * Compare two user identifiers for equality.
  + * @param left One uid to test
  + * @param right Another uid to test
  + * @deffunc apr_status_t apr_compare_users(apr_uid_t left, apr_uid_t right)
  + * @tip Returns APR_SUCCESS if the apr_uid_t strutures identify the same user,
  + * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
  + */
  +#ifdef 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)
  +#endif
  +
  +/***
    * Get the group name for a specified groupid
    * @param dirname Pointer to new string containing group name (on output)
    * @param userid The groupid
  @@ -118,6 +132,20 @@
    * @tip 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);
  +
  +/***
  + * Compare two group identifiers for equality.
  + * @param left One gid to test
  + * @param right Another gid to test
  + * @deffunc apr_status_t apr_compare_groups(apr_gid_t left, apr_gid_t right)
  + * @tip Returns APR_SUCCESS if the apr_gid_t strutures identify the same group,
  + * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
  + */
  +#ifdef 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)
  +#endif
   
   #endif  /* ! APR_HAS_USER */
   
  
  
  
  1.2       +12 -1     apr/user/win32/groupinfo.c
  
  Index: groupinfo.c
  ===================================================================
  RCS file: /home/cvs/apr/user/win32/groupinfo.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- groupinfo.c	2001/01/28 01:34:27	1.1
  +++ groupinfo.c	2001/01/28 23:20:48	1.2
  @@ -72,9 +72,20 @@
           return APR_BADARG;
       if (!LookupAccountSid(NULL, groupid, name, &cbname, domain, &cbdomain, &type))
           return apr_get_os_error();
  -    if (type != SidTypeGroup && type != SidTypeWellKnownGroup)
  +    if (type != SidTypeGroup && type != SidTypeWellKnownGroup 
  +                             && type != SidTypeAlias)
           return APR_BADARG;
       *groupname = apr_pstrdup(p, name);
       return APR_SUCCESS;
   }
     
  +APR_DECLARE(apr_status_t) apr_compare_groups(apr_gid_t left, apr_gid_t right)
  +{
  +    if (!left || !right)
  +        return APR_BADARG;
  +    if (!IsValidSid(left) || !IsValidSid(right))
  +        return APR_BADARG;
  +    if (!EqualSid(left, right))
  +        return APR_EMISMATCH;
  +    return APR_SUCCESS;
  +}
  
  
  
  1.2       +11 -1     apr/user/win32/userinfo.c
  
  Index: userinfo.c
  ===================================================================
  RCS file: /home/cvs/apr/user/win32/userinfo.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- userinfo.c	2001/01/28 01:34:27	1.1
  +++ userinfo.c	2001/01/28 23:20:48	1.2
  @@ -74,9 +74,19 @@
           return APR_BADARG;
       if (!LookupAccountSid(NULL, userid, name, &cbname, domain, &cbdomain, &type))
           return apr_get_os_error();
  -    if (type != SidTypeUser)
  +    if (type != SidTypeUser && type != SidTypeAlias)
           return APR_BADARG;
       *username = apr_pstrdup(p, name);
       return APR_SUCCESS;
   }
     
  +APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right)
  +{
  +    if (!left || !right)
  +        return APR_BADARG;
  +    if (!IsValidSid(left) || !IsValidSid(right))
  +        return APR_BADARG;
  +    if (!EqualSid(left, right))
  +        return APR_EMISMATCH;
  +    return APR_SUCCESS;
  +}
  
  
  

Mime
View raw message