summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlaf Kirch <okir@suse.de>2008-09-30 12:01:24 -0400
committerSteve Dickson <steved@redhat.com>2008-09-30 12:01:24 -0400
commit1d92cd58eb471765eba08ec819f7b5ae1d5e96ab (patch)
treedf8b28df892fe8a77934981eeae5d8df827fe94b
parent566f261ff6bae2842e2e64aaf70d2e31acc1efe7 (diff)
downloadrpcbind-1d92cd58eb471765eba08ec819f7b5ae1d5e96ab.tar.gz
Support portmap on AF_LOCAL, too
This patch makes sure we support portmap (aka rpcbind v2) on ipv4 _and_ af_local. That allows rpcbind to identify the owner of a socket much better than by relying on privileged ports to tell root from non-root users. Signed-off-by: Olaf Kirch <okir@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--src/rpcbind.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/rpcbind.c b/src/rpcbind.c
index e0e7ddf..ad23b37 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -554,12 +554,6 @@ init_transport(struct netconfig *nconf)
(si.si_proto == IPPROTO_TCP || si.si_proto == IPPROTO_UDP)) {
struct pmaplist *pml;
- if (!svc_register(my_xprt, PMAPPROG, PMAPVERS,
- pmap_service, 0)) {
- syslog(LOG_ERR, "could not register on %s",
- nconf->nc_netid);
- goto error;
- }
pml = malloc(sizeof (struct pmaplist));
if (pml == NULL) {
syslog(LOG_ERR, "no memory!");
@@ -606,6 +600,19 @@ init_transport(struct netconfig *nconf)
/* Also add version 2 stuff to rpcbind list */
rbllist_add(PMAPPROG, PMAPVERS, nconf, &taddr.addr);
}
+
+ /* We need to support portmap over IPv4. It makes sense to
+ * support it over AF_LOCAL as well, because that allows
+ * rpcbind to identify the owner of a socket much better
+ * than by relying on privileged ports to tell root from
+ * non-root users. */
+ if (si.si_af == AF_INET || si.si_af == AF_LOCAL) {
+ if (!svc_register(my_xprt, PMAPPROG, PMAPVERS, pmap_service, 0)) {
+ syslog(LOG_ERR, "could not register on %s",
+ nconf->nc_netid);
+ goto error;
+ }
+ }
#endif
/* version 3 registration */