libgslutil  1.2.3
Functions
CGI program support routine

Functions

int usergroup_cgi (void)
 Set user/group for CGI program. More...
 
void usergroup_cgi_or_die (void)
 Set user/group for CGI program, die on failure. More...
 

Detailed Description

Support routines for manipulating user/group ID within CGI programs. Relies on an environment variable (REMOTE_USER) set by the web server as per the CGI standard, and sets the user/group ID as appropriate (falling back to nobody). Intended for running CGI programs as the logged-in user.

Function Documentation

◆ usergroup_cgi()

int usergroup_cgi ( void  )

Set user/group for CGI program.

Return values
-1on error (and see errno).
0on success.

Reads the environment variable REMOTE_USER and sets the process's UID, GID and auxiliary groups based on its value. If REMOTE_USER is not set, then it uses nobody.

◆ usergroup_cgi_or_die()

void usergroup_cgi_or_die ( void  )

Set user/group for CGI program, die on failure.

As per usergroup_cgi(), but always succeeds (or aborts the program).