Add patch to clean sockets.

This commit is contained in:
Bojan Smojver 2017-09-19 07:22:54 +10:00
parent f5708ae118
commit 39d1b75d13
2 changed files with 109 additions and 1 deletions

View File

@ -0,0 +1,104 @@
From 46ffb9818eb51ce769b4747592bd60316e4ac2bd Mon Sep 17 00:00:00 2001
From: Koichiro IWAO <meta@vmeta.jp>
Date: Wed, 12 Jul 2017 17:48:00 +0900
Subject: [PATCH] sesman: delete socket files when session exits
---
sesman/session.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sesman/session.h | 7 +++++++
2 files changed, 70 insertions(+)
diff --git a/sesman/session.c b/sesman/session.c
index f2dc087d7..ae3194da0 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -796,6 +796,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
auth_end(data);
g_sigterm(display_pid);
g_sigterm(chansrv_pid);
+ cleanup_sockets(display);
g_deinit();
g_exit(0);
}
@@ -1116,3 +1117,65 @@ session_get_byuser(const char *user, int *cnt, unsigned char flags)
(*cnt) = count;
return sess;
}
+
+/******************************************************************************/
+int
+cleanup_sockets(int display)
+{
+ log_message(LOG_LEVEL_DEBUG, "cleanup_sockets:");
+ char file[256];
+ int error;
+
+ error = 0;
+
+ g_snprintf(file, 255, CHANSRV_PORT_OUT_STR, display);
+ if (g_file_exist(file))
+ {
+ log_message(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
+ if (g_file_delete(file) == 0)
+ {
+ log_message(LOG_LEVEL_DEBUG,
+ "cleanup_sockets: failed to delete %s", file);
+ error++;
+ }
+ }
+
+ g_snprintf(file, 255, CHANSRV_PORT_IN_STR, display);
+ if (g_file_exist(file))
+ {
+ log_message(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
+ if (g_file_delete(file) == 0)
+ {
+ log_message(LOG_LEVEL_DEBUG,
+ "cleanup_sockets: failed to delete %s", file);
+ error++;
+ }
+ }
+
+ g_snprintf(file, 255, XRDP_CHANSRV_STR, display);
+ if (g_file_exist(file))
+ {
+ log_message(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
+ if (g_file_delete(file) == 0)
+ {
+ log_message(LOG_LEVEL_DEBUG,
+ "cleanup_sockets: failed to delete %s", file);
+ error++;
+ }
+ }
+
+ g_snprintf(file, 255, CHANSRV_API_STR, display);
+ if (g_file_exist(file))
+ {
+ log_message(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
+ if (g_file_delete(file) == 0)
+ {
+ log_message(LOG_LEVEL_DEBUG,
+ "cleanup_sockets: failed to delete %s", file);
+ error++;
+ }
+ }
+
+ return error;
+
+}
diff --git a/sesman/session.h b/sesman/session.h
index a9884a211..10cd4d572 100644
--- a/sesman/session.h
+++ b/sesman/session.h
@@ -150,4 +150,11 @@ session_get_bypid(int pid);
struct SCP_DISCONNECTED_SESSION*
session_get_byuser(const char *user, int *cnt, unsigned char flags);
+/**
+ *
+ * @brief delete socket files
+ * @param display number
+ * @return non-zero value (number of errors) if failed
+ */
+int cleanup_sockets(int display);
#endif

View File

@ -7,7 +7,7 @@ Summary: Open source remote desktop protocol (RDP) server
Name: xrdp
Epoch: 1
Version: 0.9.3
Release: 1%{?dist}
Release: 2%{?dist}
License: ASL 2.0
Group: Applications/Internet
URL: http://www.xrdp.org/
@ -24,6 +24,7 @@ Patch2: xrdp-0.9.3-service.patch
Patch3: xrdp-0.9.2-setpriv.patch
Patch4: xrdp-0.9.2-scripts-libexec.patch
Patch5: xrdp-0.9.2-split-line.patch
Patch6: xrdp-0.9.3-clean-sockets.patch
BuildRequires: libX11-devel
BuildRequires: libXfixes-devel
@ -259,6 +260,9 @@ fi
%{_datadir}/selinux/*/%{name}.pp
%changelog
* Tue Sep 19 2017 Bojan Smojver <bojan@rexurive.com> - 1:0.9.3-2
- Add patch to clean up sockets
* Thu Aug 10 2017 Bojan Smojver <bojan@rexurive.com> - 1:0.9.3-1
- Bump up to 0.9.3