@@ -501,9 +501,12 @@ static struct rmtcallfd_list *rmttail;
int
create_rmtcall_fd(struct netconfig *nconf)
{
- int fd;
+ int fd, cc;
struct rmtcallfd_list *rmt;
SVCXPRT *xprt;
+ struct __rpc_sockinfo si;
+ struct sockaddr_storage ss;
+ struct t_bind bindaddr;
if ((fd = __rpc_nconf2fd(nconf)) == -1) {
if (debugging)
@@ -512,6 +515,20 @@ create_rmtcall_fd(struct netconfig *nconf)
nconf->nc_device, errno);
return (-1);
}
+
+ if (!__rpc_nconf2sockinfo(nconf, &si)) {
+ xlog(LOG_ERR, "create_rmtcall_fd: cannot get information for %s",
+ nconf->nc_netid);
+ return (-1);
+ }
+ memset(&ss, 0, sizeof ss);
+ ss.ss_family = si.si_af;
+ cc = bind(fd, (struct sockaddr *)(void *)&ss,
+ (socklen_t)si.si_alen);
+ if (cc < 0) {
+ xlog(LOG_ERR, "create_rmtcall_fd: could not bind to anonymous port");
+ return (-1);
+ }
xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0);
if (xprt == NULL) {
if (debugging)
Sockets use for remote calls are preallocated which mean the a port will be tied up for as long as rpcbind runs. Make sure that port is not a privileged port by binding the socket before calling svc_tli_create() Signed-off-by: Steve Dickson <steved@redhat.com> --- src/rpcb_svc_com.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)