|
Ian Kent |
dff17c |
autofs-5.1.4 - fix fd leak in rpc_do_create_client()
|
|
Ian Kent |
dff17c |
|
|
Ian Kent |
dff17c |
From: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
dff17c |
|
|
Ian Kent |
dff17c |
Commit 94f87e203a (fix create_client() RPC client handling) fixed
|
|
Ian Kent |
dff17c |
possible use of an invalid RPC client handle but the change neglected
|
|
Ian Kent |
dff17c |
to account for a check in rpc_do_create_client() that would open a new
|
|
Ian Kent |
dff17c |
file descriptor without checking if the passed in descriptor was
|
|
Ian Kent |
dff17c |
already opened.
|
|
Ian Kent |
dff17c |
|
|
Ian Kent |
dff17c |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
dff17c |
---
|
|
Ian Kent |
dff17c |
CHANGELOG | 1 +
|
|
Ian Kent |
dff17c |
lib/rpc_subs.c | 4 ++--
|
|
Ian Kent |
dff17c |
2 files changed, 3 insertions(+), 2 deletions(-)
|
|
Ian Kent |
dff17c |
|
|
Ian Kent |
dff17c |
--- autofs-5.1.4.orig/CHANGELOG
|
|
Ian Kent |
dff17c |
+++ autofs-5.1.4/CHANGELOG
|
|
Ian Kent |
dff17c |
@@ -67,6 +67,7 @@
|
|
Ian Kent |
dff17c |
- fix prefix option handling in expand_entry().
|
|
Ian Kent |
dff17c |
- fix sublink option not set from defaults.
|
|
Ian Kent |
dff17c |
- fix error return in do_nfs_mount().
|
|
Ian Kent |
dff17c |
+- fix fd leak in rpc_do_create_client().
|
|
Ian Kent |
dff17c |
|
|
Ian Kent |
dff17c |
24/05/2017 autofs-5.1.3
|
|
Ian Kent |
dff17c |
=======================
|
|
Ian Kent |
dff17c |
--- autofs-5.1.4.orig/lib/rpc_subs.c
|
|
Ian Kent |
dff17c |
+++ autofs-5.1.4/lib/rpc_subs.c
|
|
Ian Kent |
dff17c |
@@ -183,7 +183,7 @@ static int rpc_do_create_client(struct s
|
|
Ian Kent |
dff17c |
in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
|
Ian Kent |
dff17c |
slen = sizeof(struct sockaddr_in);
|
|
Ian Kent |
dff17c |
|
|
Ian Kent |
dff17c |
- if (!info->client) {
|
|
Ian Kent |
dff17c |
+ if (!info->client && *fd == RPC_ANYSOCK) {
|
|
Ian Kent |
dff17c |
struct sockaddr *laddr;
|
|
Ian Kent |
dff17c |
|
|
Ian Kent |
dff17c |
*fd = open_sock(addr->sa_family, type, proto);
|
|
Ian Kent |
dff17c |
@@ -296,7 +296,7 @@ static int rpc_do_create_client(struct s
|
|
Ian Kent |
dff17c |
* it would bind to a reserved port, which has been shown to
|
|
Ian Kent |
dff17c |
* exhaust the reserved port range in some situations.
|
|
Ian Kent |
dff17c |
*/
|
|
Ian Kent |
dff17c |
- if (!info->client) {
|
|
Ian Kent |
dff17c |
+ if (!info->client && *fd == RPC_ANYSOCK) {
|
|
Ian Kent |
dff17c |
*fd = open_sock(addr->sa_family, type, proto);
|
|
Ian Kent |
dff17c |
if (*fd < 0) {
|
|
Ian Kent |
dff17c |
ret = -errno;
|