set_ids_from_arg()
Change the caller's identifiers, based on a given string
Synopsis:
#include <login.h>
int set_ids_from_arg( const char *string );
Arguments:
- string
- The formatted string containing the information about the IDs to set; see below.
Library:
liblogin
Use the -l login option to qcc to link against this library.
Description:
The set_ids_from_arg() function changes the caller's user ID, group ID, and supplementary group IDs, based on the given string. The string can be in one of the following forms:
- uid[:gid[,sup_gid]*]
- All IDs must be numbers. The user ID and the group ID are separated by a colon, and can be followed by an arbitrary number of supplementary group IDs separated by commas. The user ID is mandatory; we recommend that you also specify the group ID.
- user_name[,sup_gid]*
- This form depends on the /etc/passwd and /etc/group files, so that set_ids_from_arg() can determine the user ID and the group ID from the user_name. The name can be followed by an arbitrary number of numeric supplementary group IDs separated by commas.
Returns:
0 on success, or -1 if an error occurred (errno is set).
Classification:
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
Page updated:
