summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2014-01-06 13:35:00 +0000
committerLars Wendler <polynomial-c@gentoo.org>2014-01-06 13:35:00 +0000
commitbef971081ee03cd0a54455f632c8e37605853609 (patch)
treee4f19af379b673ae9c19f60d6ed9f38a45ae4a12 /net-libs/libssh/files
parentsci-visualization/nonolith-connect: Punt base.eclass (diff)
downloadgentoo-2-bef971081ee03cd0a54455f632c8e37605853609.tar.gz
gentoo-2-bef971081ee03cd0a54455f632c8e37605853609.tar.bz2
gentoo-2-bef971081ee03cd0a54455f632c8e37605853609.zip
Revbump to address a memleak bug and crashes seen with x2goclient (bug #493738). Removed old (broken) rc versions
(Portage version: 2.2.8/cvs/Linux x86_64, signed Manifest commit with key 0x981CA6FC)
Diffstat (limited to 'net-libs/libssh/files')
-rw-r--r--net-libs/libssh/files/libssh-0.6.0_rc3-memleak_fix.patch20
-rw-r--r--net-libs/libssh/files/libssh-0.6.0_rc3-x2goclient_crash_fix-1.patch37
-rw-r--r--net-libs/libssh/files/libssh-0.6.0_rc3-x2goclient_crash_fix-2.patch94
3 files changed, 151 insertions, 0 deletions
diff --git a/net-libs/libssh/files/libssh-0.6.0_rc3-memleak_fix.patch b/net-libs/libssh/files/libssh-0.6.0_rc3-memleak_fix.patch
new file mode 100644
index 000000000000..46ce6925134d
--- /dev/null
+++ b/net-libs/libssh/files/libssh-0.6.0_rc3-memleak_fix.patch
@@ -0,0 +1,20 @@
+From f3e37000632cb380516bdb9d26fba4dc4e41d6f7 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Sun, 05 Jan 2014 22:05:13 +0000
+Subject: session: Fix a possible memory leak.
+
+---
+diff --git a/src/session.c b/src/session.c
+index 171779c..3a607d0 100644
+--- a/src/session.c
++++ b/src/session.c
+@@ -255,6 +255,7 @@ void ssh_free(ssh_session session) {
+ ssh_list_free(session->opts.identity);
+ }
+
++ SAFE_FREE(session->auth_auto_state);
+ SAFE_FREE(session->serverbanner);
+ SAFE_FREE(session->clientbanner);
+ SAFE_FREE(session->banner);
+--
+cgit v0.9.1
diff --git a/net-libs/libssh/files/libssh-0.6.0_rc3-x2goclient_crash_fix-1.patch b/net-libs/libssh/files/libssh-0.6.0_rc3-x2goclient_crash_fix-1.patch
new file mode 100644
index 000000000000..8b4c7aeab589
--- /dev/null
+++ b/net-libs/libssh/files/libssh-0.6.0_rc3-x2goclient_crash_fix-1.patch
@@ -0,0 +1,37 @@
+From 8f162e3b13aa85aaa1257b775e1dc5d103f45570 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Sun, 22 Dec 2013 21:08:45 +0000
+Subject: poll: Correctly free ssh_event_fd_wrapper.
+
+This is allocated by ssh_event_add_fd.
+---
+(limited to 'src/poll.c')
+
+diff --git a/src/poll.c b/src/poll.c
+index 2fce52a..4d92e3f 100644
+--- a/src/poll.c
++++ b/src/poll.c
+@@ -852,12 +852,18 @@ int ssh_event_remove_fd(ssh_event event, socket_t fd) {
+ for (i = 0; i < used; i++) {
+ if(fd == event->ctx->pollfds[i].fd) {
+ ssh_poll_handle p = event->ctx->pollptrs[i];
+- struct ssh_event_fd_wrapper *pw = p->cb_data;
++ if (p->cb == ssh_event_fd_wrapper_callback) {
++ struct ssh_event_fd_wrapper *pw = p->cb_data;
++ SAFE_FREE(pw);
++ }
+
+- ssh_poll_ctx_remove(event->ctx, p);
+- free(pw);
++ /*
++ * The free function calls ssh_poll_ctx_remove() and decrements
++ * event->ctx->polls_used.
++ */
+ ssh_poll_free(p);
+ rc = SSH_OK;
++
+ /* restart the loop */
+ used = event->ctx->polls_used;
+ i = 0;
+--
+cgit v0.9.1
diff --git a/net-libs/libssh/files/libssh-0.6.0_rc3-x2goclient_crash_fix-2.patch b/net-libs/libssh/files/libssh-0.6.0_rc3-x2goclient_crash_fix-2.patch
new file mode 100644
index 000000000000..b38955eff7d5
--- /dev/null
+++ b/net-libs/libssh/files/libssh-0.6.0_rc3-x2goclient_crash_fix-2.patch
@@ -0,0 +1,94 @@
+From 41fe03e0d61b14bc41ad658cf2d582802237323a Mon Sep 17 00:00:00 2001
+From: Aris Adamantiadis <aris@0xbadc0de.be>
+Date: Sun, 05 Jan 2014 21:33:45 +0000
+Subject: poll: fix poll_handles ownerships
+
+---
+diff --git a/src/poll.c b/src/poll.c
+index 4d92e3f..f79e165 100644
+--- a/src/poll.c
++++ b/src/poll.c
+@@ -64,6 +64,7 @@
+
+ struct ssh_poll_handle_struct {
+ ssh_poll_ctx ctx;
++ ssh_session session;
+ union {
+ socket_t fd;
+ size_t idx;
+@@ -790,6 +791,10 @@ int ssh_event_add_session(ssh_event event, ssh_session session) {
+ p = session->default_poll_ctx->pollptrs[i];
+ ssh_poll_ctx_remove(session->default_poll_ctx, p);
+ ssh_poll_ctx_add(event->ctx, p);
++ /* associate the pollhandler with a session so we can put it back
++ * at ssh_event_free()
++ */
++ p->session = session;
+ }
+ #ifdef WITH_SERVER
+ iterator = ssh_list_get_iterator(event->sessions);
+@@ -852,6 +857,10 @@ int ssh_event_remove_fd(ssh_event event, socket_t fd) {
+ for (i = 0; i < used; i++) {
+ if(fd == event->ctx->pollfds[i].fd) {
+ ssh_poll_handle p = event->ctx->pollptrs[i];
++ if (p->session != NULL){
++ /* we cannot free that handle, it's owned by its session */
++ continue;
++ }
+ if (p->cb == ssh_event_fd_wrapper_callback) {
+ struct ssh_event_fd_wrapper *pw = p->cb_data;
+ SAFE_FREE(pw);
+@@ -886,7 +895,6 @@ int ssh_event_remove_session(ssh_event event, ssh_session session) {
+ ssh_poll_handle p;
+ register size_t i, used;
+ int rc = SSH_ERROR;
+- socket_t session_fd;
+ #ifdef WITH_SERVER
+ struct ssh_iterator *iterator;
+ #endif
+@@ -895,14 +903,15 @@ int ssh_event_remove_session(ssh_event event, ssh_session session) {
+ return SSH_ERROR;
+ }
+
+- session_fd = ssh_get_fd(session);
+ used = event->ctx->polls_used;
+ for(i = 0; i < used; i++) {
+- if(session_fd == event->ctx->pollfds[i].fd) {
+- p = event->ctx->pollptrs[i];
++ p = event->ctx->pollptrs[i];
++ if(p->session == session){
+ ssh_poll_ctx_remove(event->ctx, p);
++ p->session = NULL;
+ ssh_poll_ctx_add(session->default_poll_ctx, p);
+ rc = SSH_OK;
++ used = 0;
+ }
+ }
+ #ifdef WITH_SERVER
+@@ -929,10 +938,23 @@ int ssh_event_remove_session(ssh_event event, ssh_session session) {
+ *
+ */
+ void ssh_event_free(ssh_event event) {
+- if(event == NULL) {
++ int used, i;
++ ssh_poll_handle p;
++ if(event == NULL) {
+ return;
+ }
+ if(event->ctx != NULL) {
++ used = event->ctx->polls_used;
++ for(i = 0; i < used; i++) {
++ p = event->ctx->pollptrs[i];
++ if(p->session != NULL){
++ ssh_poll_ctx_remove(event->ctx, p);
++ ssh_poll_ctx_add(p->session->default_poll_ctx, p);
++ p->session = NULL;
++ used = 0;
++ }
++ }
++
+ ssh_poll_ctx_free(event->ctx);
+ }
+ #ifdef WITH_SERVER
+--
+cgit v0.9.1