UNIX Authentication on the Client Side
To use UNIX authentication, the programmer first creates the Remote Procedure Call (RPC) client handle and then sets the authentication parameter.
The RPC client handle is created as follows:
clnt = clntudp_create (address, prognum, versnum, wait, sockp)
The UNIX authentication parameter
is set as follows:
clnt->cl_auth = authunix_create_default();
Each remote procedure call associated with the client (clnt) then carries the following UNIX-style authentication
credentials structure:
/*
* UNIX style credentials.
*/
struct authunix_parms {
u_long aup_time; /* credentials creation time */
char *aup_machname; /* host name where client is */
int aup_uid; /* client's UNIX effective uid */
int aup_gid; /* client's current group id */
u_int aup_len; /* element length of aup_gids */
int *aup_gids; /* array of groups user is in */
};
The authunix_create_default subroutine sets these fields
by invoking the appropriate subroutines. The UNIX-style authentication
is valid until destroyed with the following routine:
auth_destroy(clnt->cl_auth);