User and Group ID Services
Overview
// typedefs typedef uid_t apr_uid_t; typedef gid_t apr_gid_t; // global functions apr_status_t apr_uid_current( apr_uid_t* userid, apr_gid_t* groupid, apr_pool_t* p ); apr_status_t apr_uid_name_get( char** username, apr_uid_t userid, apr_pool_t* p ); apr_status_t apr_uid_get( apr_uid_t* userid, apr_gid_t* groupid, const char* username, apr_pool_t* p ); apr_status_t apr_uid_homepath_get( char** dirname, const char* username, apr_pool_t* p ); apr_status_t apr_gid_name_get( char** groupname, apr_gid_t groupid, apr_pool_t* p ); apr_status_t apr_gid_get( apr_gid_t* groupid, const char* groupname, apr_pool_t* p ); // macros #define apr_gid_compare( \ left, \ right \ ) #define apr_uid_compare( \ left, \ right \ )
Detailed Documentation
Typedefs
typedef uid_t apr_uid_t
Structure for determining user ownership.
typedef gid_t apr_gid_t
Structure for determining group ownership.
Global Functions
apr_status_t apr_uid_current( apr_uid_t* userid, apr_gid_t* groupid, apr_pool_t* p )
Get the userid (and groupid) of the calling process This function is available only if APR_HAS_USER is defined.
Parameters:
userid |
Returns the user id |
groupid |
Returns the user’s group id |
p |
The pool from which to allocate working space |
apr_status_t apr_uid_name_get( char** username, apr_uid_t userid, apr_pool_t* p )
Get the user name for a specified userid This function is available only if APR_HAS_USER is defined.
Parameters:
username |
Pointer to new string containing user name (on output) |
userid |
The userid |
p |
The pool from which to allocate the string |
apr_status_t apr_uid_get( apr_uid_t* userid, apr_gid_t* groupid, const char* username, apr_pool_t* p )
Get the userid (and groupid) for the specified username This function is available only if APR_HAS_USER is defined.
Parameters:
userid |
Returns the user id |
groupid |
Returns the user’s group id |
username |
The username to look up |
p |
The pool from which to allocate working space |
apr_status_t apr_uid_homepath_get( char** dirname, const char* username, apr_pool_t* p )
Get the home directory for the named user This function is available only if APR_HAS_USER is defined.
Parameters:
dirname |
Pointer to new string containing directory name (on output) |
username |
The named user |
p |
The pool from which to allocate the string |
apr_status_t apr_gid_name_get( char** groupname, apr_gid_t groupid, apr_pool_t* p )
Get the group name for a specified groupid This function is available only if APR_HAS_USER is defined.
Parameters:
groupname |
Pointer to new string containing group name (on output) |
groupid |
The groupid |
p |
The pool from which to allocate the string |
apr_status_t apr_gid_get( apr_gid_t* groupid, const char* groupname, apr_pool_t* p )
Get the groupid for a specified group name This function is available only if APR_HAS_USER is defined.
Parameters:
groupid |
Pointer to the group id (on output) |
groupname |
The group name to look up |
p |
The pool from which to allocate the string |
Macros
#define apr_gid_compare( \ left, \ right \ )
Compare two group identifiers for equality. This function is available only if APR_HAS_USER is defined.
Parameters:
left |
One gid to test |
right |
Another gid to test |
Returns:
APR_SUCCESS if the apr_gid_t structures identify the same group, APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
#define apr_uid_compare( \ left, \ right \ )
Compare two user identifiers for equality. This function is available only if APR_HAS_USER is defined.
Parameters:
left |
One uid to test |
right |
Another uid to test |
Returns:
APR_SUCCESS if the apr_uid_t structures identify the same user, APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.