forked from pool/libtirpc
Accepting request 597811 from home:tsaupe:branches:Base:System
fix socket leak introduced by change rpc protocol version patch (bsc#1087925) OBS-URL: https://build.opensuse.org/request/show/597811 OBS-URL: https://build.opensuse.org/package/show/Base:System/libtirpc?expand=0&rev=73
This commit is contained in:
parent
ff07e61a12
commit
dc7d719fc1
@ -0,0 +1,73 @@
|
||||
From 25d38d744997d5ff03d8b0f2cdd79c0fb7185cca Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Blume <Thomas.Blume@suse.com>
|
||||
Date: Wed, 18 Apr 2018 08:44:49 -0400
|
||||
Subject: [PATCH] Fix regression introduced by change rpc version order patch
|
||||
|
||||
Fix a socket leak introduced by commit 5e7b57bc20bd9cadff
|
||||
(rpcinfo: change order of version to be tried to 4, 3, 2)
|
||||
The new function __try_protocol_version_2 doesn't return
|
||||
the client, so it can't be closed via CLNT_DESTROY in the
|
||||
calling function.
|
||||
|
||||
Signed-off-by: Thomas Blume <Thomas.Blume@suse.com>
|
||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||
---
|
||||
src/rpcb_clnt.c | 18 ++++++++++++++----
|
||||
1 file changed, 14 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c
|
||||
index a94fc73..4b44364 100644
|
||||
--- a/src/rpcb_clnt.c
|
||||
+++ b/src/rpcb_clnt.c
|
||||
@@ -752,7 +752,7 @@ __try_protocol_version_2(program, version, nconf, host, tp)
|
||||
|
||||
client = getpmaphandle(nconf, host, &parms.r_addr);
|
||||
if (client == NULL)
|
||||
- return (NULL);
|
||||
+ goto error;
|
||||
|
||||
/*
|
||||
* Set retry timeout.
|
||||
@@ -771,11 +771,11 @@ __try_protocol_version_2(program, version, nconf, host, tp)
|
||||
if (clnt_st != RPC_SUCCESS) {
|
||||
rpc_createerr.cf_stat = RPC_PMAPFAILURE;
|
||||
clnt_geterr(client, &rpc_createerr.cf_error);
|
||||
- return (NULL);
|
||||
+ goto error;
|
||||
} else if (port == 0) {
|
||||
pmapaddress = NULL;
|
||||
rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
|
||||
- return (NULL);
|
||||
+ goto error;
|
||||
}
|
||||
port = htons(port);
|
||||
CLNT_CONTROL(client, CLGET_SVC_ADDR, (char *)&remote);
|
||||
@@ -789,14 +789,24 @@ __try_protocol_version_2(program, version, nconf, host, tp)
|
||||
free(pmapaddress);
|
||||
pmapaddress = NULL;
|
||||
}
|
||||
- return (NULL);
|
||||
+ goto error;
|
||||
}
|
||||
memcpy(pmapaddress->buf, remote.buf, remote.len);
|
||||
memcpy(&((char *)pmapaddress->buf)[sizeof (short)],
|
||||
(char *)(void *)&port, sizeof (short));
|
||||
pmapaddress->len = pmapaddress->maxlen = remote.len;
|
||||
|
||||
+ CLNT_DESTROY(client);
|
||||
return pmapaddress;
|
||||
+
|
||||
+error:
|
||||
+ if (client) {
|
||||
+ CLNT_DESTROY(client);
|
||||
+ client = NULL;
|
||||
+
|
||||
+ }
|
||||
+ return (NULL);
|
||||
+
|
||||
}
|
||||
#endif
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 12 08:06:23 UTC 2018 - Thomas.Blume@suse.com
|
||||
|
||||
- fix socket leak introduced by change-rpc-protocol-version-order patch
|
||||
(bsc#1087925)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 5 13:26:43 CEST 2018 - kukuk@suse.de
|
||||
|
||||
|
@ -39,6 +39,7 @@ Patch0: 000-bindresvport_blacklist.patch
|
||||
Patch1: 001-new-rpcbindsock-path.patch
|
||||
# Revert upstream change until tirpc 1.0.4 with a final solutions comes out
|
||||
Patch2: 002-revert-binddynport.patch
|
||||
Patch3: 0001-Fix-regression-introduced-by-change-rpc-version-orde.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%define debug_package_requires libtirpc3 = %{version}-%{release}
|
||||
|
||||
@ -88,6 +89,7 @@ TCP over IPv4.
|
||||
%patch1 -p1
|
||||
%endif
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
%build
|
||||
sed -i -e 's|@includedir@/tirpc|@includedir@|g' libtirpc.pc.in
|
||||
|
Loading…
Reference in New Issue
Block a user