Skip to content

Commit

Permalink
Make superuser the owner of registers from the kernel.
Browse files Browse the repository at this point in the history
Registers from the kernel do not come in on AF_LOCAL
sockets so the exact owners of the service can not be determined.
But given the fact the loopback address is used and a privilege
port used, it can be assumed the owner of the service should
be the superuser.

Signed-off-by: Steve Dickson <[email protected]>
  • Loading branch information
stevedd committed Mar 17, 2011
1 parent a81ad2e commit baa19e4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/rpcb_svc_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -1372,10 +1372,13 @@ static char *
getowner(SVCXPRT *transp, char *owner, size_t ownersize)
{
uid_t uid;

if (__rpc_get_local_uid(transp, &uid) < 0)
snprintf(owner, ownersize, "unknown");
else if (uid == 0)

if (__rpc_get_local_uid(transp, &uid) < 0) {
if (is_localroot(svc_getrpccaller(transp)))
snprintf(owner, ownersize, "superuser");
else
snprintf(owner, ownersize, "unknown");
} else if (uid == 0)
snprintf(owner, ownersize, "superuser");
else
snprintf(owner, ownersize, "%d", uid);
Expand Down

0 comments on commit baa19e4

Please sign in to comment.