]> git.draconx.ca Git - gentoo-draconx.git/commitdiff
libxcb: Add 1.7 with auth memory leak fix.
authorNick Bowler <nbowler@elliptictech.com>
Wed, 29 Jun 2011 20:41:05 +0000 (16:41 -0400)
committerNick Bowler <nbowler@elliptictech.com>
Wed, 29 Jun 2011 20:42:21 +0000 (16:42 -0400)
This fix has been in git for a long time, but there seems to be no new
release in sight.

x11-libs/libxcb/Manifest [new file with mode: 0644]
x11-libs/libxcb/files/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch [new file with mode: 0644]
x11-libs/libxcb/files/libxcb-1.7-interix.patch [new file with mode: 0644]
x11-libs/libxcb/libxcb-1.7.ebuild [new file with mode: 0644]

diff --git a/x11-libs/libxcb/Manifest b/x11-libs/libxcb/Manifest
new file mode 100644 (file)
index 0000000..4858f4a
--- /dev/null
@@ -0,0 +1,4 @@
+AUX 0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch 1370 RMD160 3862d6bcdebe7eeef70bf2ddbe0684156a08acbe SHA1 ae48e8f0c583842f0b3d568fa13c464d0a341aa8 SHA256 670af0269cec25f89c80bcfb36fe412bfd5fec01175fcf544521582773151f7f
+AUX libxcb-1.7-interix.patch 2963 RMD160 5df5ea09b03a4be7052114b0504d3d2a3017a49e SHA1 39e76ffd95cacd84fbda1f46e04171e5c5ba0301 SHA256 291cd66ba133f341e48f281578cd80dfa22c908b81990933e9feb616973b9587
+DIST libxcb-1.7.tar.bz2 318619 RMD160 f6748b9751e339c2669a6b9322b421abbbff7afb SHA1 7540f0587907bce421914f0ddb813810cb2f36f8 SHA256 e776dc35e2a66094e7308ce2e045fb4e27cf3ca30ab1813a8fc08538140724df
+EBUILD libxcb-1.7.ebuild 1216 RMD160 2cf281bd24417ffa6db73f6c5b0ab32709a3ff83 SHA1 422a350ba9788e1401b65bf9cded54cc48a6fca0 SHA256 2e201f22ab334fee158913ee1c36edd1a58a6f0413c5a77bb447ad0af4deaa0b
diff --git a/x11-libs/libxcb/files/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch b/x11-libs/libxcb/files/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch
new file mode 100644 (file)
index 0000000..91805b1
--- /dev/null
@@ -0,0 +1,41 @@
+From 2272f6421cabc916fabae78faad568b1c96af618 Mon Sep 17 00:00:00 2001
+From: Nick Bowler <nbowler@elliptictech.com>
+Date: Wed, 10 Nov 2010 10:11:36 -0500
+Subject: [PATCH] xcb_auth: Fix memory leak in _xcb_get_auth_info.
+
+If the initial get_peer_sock_name(getpeername ...) succeeds, the
+pointer to allocated memory is overwritten by the later call to
+get_peer_sock_name(getsockname ...).  Fix that up by freeing
+the allocated memory before overwriting the pointer.
+
+Signed-off-by: Nick Bowler <nbowler@draconx.ca>
+---
+ src/xcb_auth.c |   11 ++++++++---
+ 1 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/src/xcb_auth.c b/src/xcb_auth.c
+index 1af27fc..4839b78 100644
+--- a/src/xcb_auth.c
++++ b/src/xcb_auth.c
+@@ -327,10 +327,15 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
+     if (!info->namelen)
+         goto no_auth;   /* out of memory */
+-    if (!gotsockname && (sockname = get_peer_sock_name(getsockname, fd)) == NULL)
++    if (!gotsockname)
+     {
+-        free(info->name);
+-        goto no_auth;   /* can only authenticate sockets */
++        free(sockname);
++
++        if ((sockname = get_peer_sock_name(getsockname, fd)) == NULL)
++        {
++            free(info->name);
++            goto no_auth;   /* can only authenticate sockets */
++        }
+     }
+     ret = compute_auth(info, authptr, sockname);
+-- 
+1.7.2.2
+
diff --git a/x11-libs/libxcb/files/libxcb-1.7-interix.patch b/x11-libs/libxcb/files/libxcb-1.7-interix.patch
new file mode 100644 (file)
index 0000000..4317f62
--- /dev/null
@@ -0,0 +1,103 @@
+reported upstream: http://lists.freedesktop.org/archives/xcb/2011-June/007095.html
+
+diff -ru libxcb-1.7.orig/configure.ac libxcb-1.7/configure.ac
+--- libxcb-1.7.orig/configure.ac       2011-06-08 09:12:30 +0200
++++ libxcb-1.7/configure.ac    2011-06-08 09:54:49 +0200
+@@ -72,6 +72,8 @@
+ AC_SEARCH_LIBS(getaddrinfo, socket)
+ AC_SEARCH_LIBS(connect, socket)
++AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE(HAVE_GETADDRINFO, 1, [getaddrinfo() function is available])], )
++
+ case $host_os in
+ linux*)
+       AC_DEFINE([HAVE_ABSTRACT_SOCKETS], 1, [Define if your platform supports abstract sockets])
+diff -ru libxcb-1.7.orig/src/xcb_auth.c libxcb-1.7/src/xcb_auth.c
+--- libxcb-1.7.orig/src/xcb_auth.c     2011-06-08 09:12:30 +0200
++++ libxcb-1.7/src/xcb_auth.c  2011-06-08 09:54:49 +0200
+@@ -33,6 +33,12 @@
+ #include <sys/param.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <arpa/inet.h>
++
++#ifdef __INTERIX
++/* _don't_ ask. interix has INADDR_LOOPBACK in here. */
++#include <rpc/types.h>
++#endif
+ #include "xcb.h"
+ #include "xcbint.h"
+diff -ru libxcb-1.7.orig/src/xcb_util.c libxcb-1.7/src/xcb_util.c
+--- libxcb-1.7.orig/src/xcb_util.c     2011-06-08 09:12:30 +0200
++++ libxcb-1.7/src/xcb_util.c  2011-06-08 09:56:23 +0200
+@@ -44,6 +44,7 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <string.h>
++#include <arpa/inet.h>
+ #include "xcb.h"
+ #include "xcbext.h"
+@@ -281,10 +282,12 @@
+ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port)
+ {
+     int fd = -1;
++#if HAVE_GETADDRINFO
+     struct addrinfo hints;
+     char service[6]; /* "65535" with the trailing '\0' */
+     struct addrinfo *results, *addr;
+     char *bracket;
++#endif
+     if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol)
+ #ifdef AF_INET6
+@@ -296,6 +299,7 @@
+     if (*host == '\0')
+       host = "localhost";
++#if HAVE_GETADDRINFO
+     memset(&hints, 0, sizeof(hints));
+ #ifdef AI_ADDRCONFIG
+     hints.ai_flags |= AI_ADDRCONFIG;
+@@ -338,6 +342,40 @@
+     }
+     freeaddrinfo(results);
+     return fd;
++#else
++    {
++        struct hostent* _h;
++        struct sockaddr_in _s;
++        struct in_addr ** _c;
++
++        if((_h = gethostbyname(host)) == NULL)
++            return -1;
++
++        _c = (struct in_addr**)_h->h_addr_list;
++        fd = -1;
++
++        while(*_c) {
++            _s.sin_family = AF_INET;
++            _s.sin_port = htons(port);
++            _s.sin_addr = *(*_c);
++
++            fd = _xcb_socket(_s.sin_family, SOCK_STREAM, 0);
++            if(fd >= 0) {
++                int on = 1;
++                setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
++                setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
++
++                if(connect(fd, (struct sockaddr*)&_s, sizeof(_s)) >= 0)
++                    break;
++                close(fd);
++                fd = -1;
++            }
++            ++_c;
++        }
++
++        return fd;
++    }
++#endif
+ }
+ static int _xcb_open_unix(char *protocol, const char *file)
diff --git a/x11-libs/libxcb/libxcb-1.7.ebuild b/x11-libs/libxcb/libxcb-1.7.ebuild
new file mode 100644 (file)
index 0000000..edf5cd5
--- /dev/null
@@ -0,0 +1,39 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/libxcb/libxcb-1.7.ebuild,v 1.13 2011/06/08 15:48:51 scarabeus Exp $
+
+EAPI=3
+
+XORG_EAUTORECONF=yes
+inherit python xorg-2
+
+DESCRIPTION="X C-language Bindings library"
+HOMEPAGE="http://xcb.freedesktop.org/"
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xcb/libxcb"
+[[ ${PV} != 9999* ]] && \
+       SRC_URI="http://xcb.freedesktop.org/dist/${P}.tar.bz2"
+
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc selinux"
+
+RDEPEND="x11-libs/libXau
+       x11-libs/libXdmcp
+       dev-libs/libpthread-stubs
+       >=x11-proto/xcb-proto-1.6"
+DEPEND="${RDEPEND}
+       doc? ( app-doc/doxygen )
+       dev-libs/libxslt
+       =dev-lang/python-2*[xml]"
+
+       PATCHES=( "${FILESDIR}/${P}-interix.patch"
+               "${FILESDIR}/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch")
+
+pkg_setup() {
+       python_set_active_version 2
+       xorg-2_pkg_setup
+       XORG_CONFIGURE_OPTIONS=(
+               $(use_enable doc build-docs)
+               $(use_enable selinux)
+               --enable-xinput
+       )
+}