Other Information Passed to Server Procedures
Server procedures often want more information about a remote procedure call than just its arguments. For example, getting authentication information is important to procedures that implement some level of security.
This additional information is supplied to the server procedure
as a second argument. The following example program that allows only
root users to print a message on the console, demonstrates the use
of the second argument:
int *
printmessage_1(msg, rq)
char **msg;
struct svc_req *rq;
{
static in result; /* Must be static */
FILE *f;
struct authunix_parms *aup;
aup=(struct authunix_parms *)rq->rq_clntcred;
if (aup->aup_uid !=0) {
result=0;
return (&result);
}
/*
*Same code as before.
*/
}