summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpcbind/pmap_svc.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2001-03-22 04:31:30 +0000
committeralfred <alfred@FreeBSD.org>2001-03-22 04:31:30 +0000
commit281af9370ca4060089860089233faf33682090ff (patch)
tree06c8eb9ac0e2912253da3c85456a24984746c85d /usr.sbin/rpcbind/pmap_svc.c
parent2067928f4eb6211420175a84f11a6c8c20eeead0 (diff)
downloadFreeBSD-src-281af9370ca4060089860089233faf33682090ff.zip
FreeBSD-src-281af9370ca4060089860089233faf33682090ff.tar.gz
Hopefully fix some of the bugs in passing credentials over UNIX domain sockets.
Make struct cmessage visible from socket.h (about 4 places were defining it for themselves which wasn't good) Make __rpc_get_local_uid() useable and give it prototype that's visible. Fix some issues with printing out usernames from rpcbind and keyserv.
Diffstat (limited to 'usr.sbin/rpcbind/pmap_svc.c')
-rw-r--r--usr.sbin/rpcbind/pmap_svc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/rpcbind/pmap_svc.c b/usr.sbin/rpcbind/pmap_svc.c
index b2cedd9..26467d1 100644
--- a/usr.sbin/rpcbind/pmap_svc.c
+++ b/usr.sbin/rpcbind/pmap_svc.c
@@ -173,7 +173,7 @@ pmapproc_change(struct svc_req *rqstp, SVCXPRT *xprt, unsigned long op)
RPCB rpcbreg;
long ans;
struct sockaddr_in *who;
- struct cmsgcred *cmcred;
+ uid_t uid;
char uidbuf[32];
#ifdef RPCBIND_DEBUG
@@ -194,19 +194,18 @@ pmapproc_change(struct svc_req *rqstp, SVCXPRT *xprt, unsigned long op)
}
who = svc_getcaller(xprt);
- cmcred = __svc_getcallercreds(xprt);
/*
* Can't use getpwnam here. We might end up calling ourselves
* and looping.
*/
- if (cmcred == NULL)
+ if (__rpc_get_local_uid(xprt, &uid) < 0)
rpcbreg.r_owner = "unknown";
- else if (cmcred->cmcred_uid == 0)
+ else if (uid == 0)
rpcbreg.r_owner = "superuser";
else {
/* r_owner will be strdup-ed later */
- snprintf(uidbuf, sizeof uidbuf, "%d", cmcred->cmcred_uid);
+ snprintf(uidbuf, sizeof uidbuf, "%d", uid);
rpcbreg.r_owner = uidbuf;
}
OpenPOWER on IntegriCloud