summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2011-03-16 13:58:15 -0400
committerSteve Dickson <steved@redhat.com>2011-03-17 10:19:26 -0400
commitbaa19e40d997cdd75ceefd99bb5c4677fd4f260f (patch)
tree78370e4464dbb165601675461639bf49393acff1
parenta81ad2e02d4bdf4066a987ba7363c3e9dcd33f42 (diff)
downloadrpcbind-baa19e40d997cdd75ceefd99bb5c4677fd4f260f.tar.gz
Make superuser the owner of registers from the kernel.
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 <steved@redhat.com>
-rw-r--r--src/rpcb_svc_com.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
index 291421f..5bb9a44 100644
--- a/src/rpcb_svc_com.c
+++ b/src/rpcb_svc_com.c
@@ -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);