#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)whoami_proc.c 2.3 89/07/11 4.0 RPCSRC";
* whoami_proc.c: secure identity verifier and reporter: server proc
#include <rpc/key_prot.h>
* Report on the server's notion of the client's identity.
whoami_iask_1(nullarg
, rqstp
)
static remote_identity whoisthem
;
static char username
[MAXNETNAMELEN
+1];
static char realname
[MAXNETNAMELEN
+1]; /* really gecos field */
static int grouplist
[NGROUPS
];
char publickey
[HEXKEYBYTES
+1];
struct authdes_cred
*des_cred
;
switch (rqstp
->rq_cred
.oa_flavor
)
whoisthem
.remote_username
= username
;
whoisthem
.remote_realname
= realname
;
whoisthem
.gids
.gids_val
= grouplist
;
des_cred
= (struct authdes_cred
*) rqstp
->rq_clntcred
;
* Check to see if the netname being used is in the public key
* database (if not, reject this (potential) imposter).
if (! getpublickey(des_cred
->adc_fullname
.name
, publickey
))
svcerr_weakauth(rqstp
->rq_xprt
);
* Get the info that the client wants.
if (! netname2user(des_cred
->adc_fullname
.name
, &whoisthem
.uid
,
&whoisthem
.gid
, &whoisthem
.gids
.gids_len
,
whoisthem
.gids
.gids_val
))
{ /* netname not found */
whoisthem
.authenticated
= FALSE
;
strcpy(whoisthem
.remote_username
, "nobody");
strcpy(whoisthem
.remote_realname
, "INTERLOPER!");
whoisthem
.gids
.gids_len
= 0;
/* else we found the netname */
whoisthem
.authenticated
= TRUE
;
pwdent
= getpwuid(whoisthem
.uid
);
strcpy(whoisthem
.remote_username
, pwdent
->pw_name
);
strcpy(whoisthem
.remote_realname
, pwdent
->pw_gecos
);
svcerr_weakauth(rqstp
->rq_xprt
);
* Return server's netname. AUTH_NONE is valid.
* This routine allows this server to be started under any uid,
* and the client can ask us our netname for use in authdes_create().
whoami_whoru_1(nullarg
, rqstp
)
static char servername
[MAXNETNAMELEN
+1];