Function login_cap_sys::setusercontext[][src]

pub unsafe extern "C" fn setusercontext(
    _lc: *mut login_cap_t,
    _pwd: *mut passwd,
    _uid: uid_t,
    _flags: c_uint
) -> c_int
Expand description

From login_getclass(3):

The setusercontext() function sets the resources according to flags.  The
lc argument, if not NULL, contains the class information that should be
used. The pwd argument, if not NULL, provides information about the
user. Both lc and pwd cannot be NULL.  The uid argument is used in place
of the user ID contained in the pwd structure when calling setuid(2).
The setusercontext() function returns 0 on success and -1 on failure.
The various bits available to be or-ed together to make up flags are:

LOGIN_SETENV          Sets environment variables specified by the setenv
					  keyword.
LOGIN_SETGROUP        Set the group ID and call initgroups(3).  Requires
                      the pwd field be specified.

LOGIN_SETLOGIN        Sets the login name by setlogin(2).  Requires the
                      pwd field be specified.

LOGIN_SETPATH         Sets the PATH environment variable.

LOGIN_SETPRIORITY     Sets the priority by setpriority(2).

LOGIN_SETRESOURCES    Sets the various system resources by setrlimit(2).

LOGIN_SETUMASK        Sets the umask by umask(2).

LOGIN_SETUSER         Sets the user ID to uid by setuid(2).

LOGIN_SETALL          Sets all of the above.