summaryrefslogtreecommitdiff
path: root/src/rpcbind.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpcbind.c')
-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 */