Restore the use of reserve ports in clnt_create (bz 1562169)

Signed-off-by: Steve Dickson <steved@redhat.com>
This commit is contained in:
Steve Dickson 2018-04-12 10:40:28 -04:00
parent 100528bdac
commit 5f1f1be3e1
2 changed files with 72 additions and 3 deletions

View File

@ -0,0 +1,64 @@
commit 2802259184ada839793152ed0a0f130065f82dfd
Author: Steve Dickson <steved@redhat.com>
Date: Thu Apr 12 10:24:02 2018 -0400
clnt_create: Restore using reserve ports for client connections
Commit 46e04a73 changed clnt_create(3) not to
use reserve ports when binding a connection to
a server.
For certain legacy apps, like some of the NIS commands,
the client has to used reserve port to be able
to communicate with the server.
So the use of reserve ports in clnt_create(3)
has been restored.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/src/clnt_generic.c b/src/clnt_generic.c
index e5a314f..3f3dabf 100644
--- a/src/clnt_generic.c
+++ b/src/clnt_generic.c
@@ -47,7 +47,6 @@
extern bool_t __rpc_is_local_host(const char *);
int __rpc_raise_fd(int);
-extern int __binddynport(int fd);
#ifndef NETIDLEN
#define NETIDLEN 32
@@ -341,8 +340,7 @@ clnt_tli_create(int fd, const struct netconfig *nconf,
servtype = nconf->nc_semantics;
if (!__rpc_fd2sockinfo(fd, &si))
goto err;
- if (__binddynport(fd) == -1)
- goto err;
+ bindresvport(fd, NULL);
} else {
if (!__rpc_fd2sockinfo(fd, &si))
goto err;
diff --git a/src/rpc_soc.c b/src/rpc_soc.c
index af6c482..5a6eeb7 100644
--- a/src/rpc_soc.c
+++ b/src/rpc_soc.c
@@ -67,8 +67,6 @@
extern mutex_t rpcsoc_lock;
-extern int __binddynport(int fd);
-
static CLIENT *clnt_com_create(struct sockaddr_in *, rpcprog_t, rpcvers_t,
int *, u_int, u_int, char *, int);
static SVCXPRT *svc_com_create(int, u_int, u_int, char *);
@@ -147,8 +145,7 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp, flags)
bindaddr.maxlen = bindaddr.len = sizeof (struct sockaddr_in);
bindaddr.buf = raddr;
- if (__binddynport(fd) == -1)
- goto err;
+ bindresvport(fd, NULL);
cl = clnt_tli_create(fd, nconf, &bindaddr, prog, vers,
sendsz, recvsz);
if (cl) {

View File

@ -2,13 +2,15 @@
Name: libtirpc
Version: 1.0.3
Release: 0%{?dist}
Release: 1%{?dist}
Summary: Transport Independent RPC Library
Group: System Environment/Libraries
License: SISSL and BSD
URL: http://nfsv4.bullopensource.org/
Source0: http://downloads.sourceforge.net/libtirpc/libtirpc-%{version}.tar.bz2
Patch001: libtirpc-1.0.3-clntcreate.patch
BuildRequires: automake, autoconf, libtool, pkgconfig
BuildRequires: krb5-devel
@ -36,7 +38,7 @@ developing programs which use the tirpc library.
%prep
%setup -q
%autosetup -p1
# Remove .orig files
find . -name "*.orig" | xargs rm -f
@ -127,7 +129,10 @@ mv %{buildroot}%{_mandir}/man3 %{buildroot}%{_mandir}/man3t
%{_mandir}/*/*
%changelog
* Wed Mar 14 2018 Steve Dickson <steved@redhat.com> 1.0.2-0
* Thu Apr 12 2018 Steve Dickson <steved@redhat.com> 1.0.3-1
- Restore the use of reserve ports in clnt_create (bz 1562169)
* Wed Mar 14 2018 Steve Dickson <steved@redhat.com> 1.0.3-0
- Update to latest upstream release: libtirpc-1-0-3
* Tue Mar 6 2018 Steve Dickson <steved@redhat.com> 1.0.2-6.rc2