commit:     31d39424920068b244f74223e501fc462a40ca3a
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 27 21:15:02 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Nov 27 21:16:56 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31d39424

x11-misc/x11vnc: add upstream fixes for -unixpw handling #567612

 .../x11vnc-0.9.14-libvncserver-defines-1.patch     |  50 ++++
 .../x11vnc-0.9.14-libvncserver-defines-2.patch     | 264 +++++++++++++++++++++
 x11-misc/x11vnc/x11vnc-0.9.14-r1.ebuild            |  65 +++++
 3 files changed, 379 insertions(+)

diff --git a/x11-misc/x11vnc/files/x11vnc-0.9.14-libvncserver-defines-1.patch 
b/x11-misc/x11vnc/files/x11vnc-0.9.14-libvncserver-defines-1.patch
new file mode 100644
index 00000000..9129e3c
--- /dev/null
+++ b/x11-misc/x11vnc/files/x11vnc-0.9.14-libvncserver-defines-1.patch
@@ -0,0 +1,50 @@
+https://bugs.gentoo.org/567612
+
+From a6852d61dce708bf5185a7e42770475a070433bc Mon Sep 17 00:00:00 2001
+From: Christian Beier <dontm...@freeshell.org>
+Date: Fri, 27 Nov 2015 15:57:51 +0100
+Subject: [PATCH] Fix the remaining HAVE_WAITPID occurences.
+
+---
+ src/sslhelper.c | 4 ++--
+ src/unixpw.c    | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/sslhelper.c b/src/sslhelper.c
+index bae897fd22d1..8045d7706ba5 100644
+--- a/src/sslhelper.c
++++ b/src/sslhelper.c
+@@ -2964,7 +2964,7 @@ void ssl_helper_pid(pid_t pid, int sock) {
+                                       }
+                               }
+ 
+-#if LIBVNCSERVER_HAVE_SYS_WAIT_H && LIBVNCSERVER_HAVE_WAITPID 
++#if LIBVNCSERVER_HAVE_SYS_WAIT_H && HAVE_WAITPID
+                               wret = waitpid(helpers[i], &status, WNOHANG); 
+ 
+ if (db) fprintf(stderr, "waitpid(%d)\n", helpers[i]);
+@@ -3000,7 +3000,7 @@ if (db) fprintf(stderr, "ssl_helper_pid(%d, %d)\n", pid, 
sock);
+       for (i=0; i < HPSIZE; i++) {
+               if (helpers[i] == pid) {
+                       if (sock == -1) {
+-#if LIBVNCSERVER_HAVE_SYS_WAIT_H && LIBVNCSERVER_HAVE_WAITPID 
++#if LIBVNCSERVER_HAVE_SYS_WAIT_H && HAVE_WAITPID
+                               pid_t wret;
+                               wret = waitpid(helpers[i], &status, WNOHANG); 
+ 
+diff --git a/src/unixpw.c b/src/unixpw.c
+index 4267b5ccf659..3a548808881f 100644
+--- a/src/unixpw.c
++++ b/src/unixpw.c
+@@ -56,7 +56,7 @@ extern char *crypt(const char*, const char *);
+ #include "default8x16.h"
+ 
+ #if LIBVNCSERVER_HAVE_FORK
+-#if LIBVNCSERVER_HAVE_SYS_WAIT_H && LIBVNCSERVER_HAVE_WAITPID
++#if LIBVNCSERVER_HAVE_SYS_WAIT_H && HAVE_WAITPID
+ #define UNIXPW_SU
+ #endif
+ #endif
+-- 
+2.11.0.rc2
+

diff --git a/x11-misc/x11vnc/files/x11vnc-0.9.14-libvncserver-defines-2.patch 
b/x11-misc/x11vnc/files/x11vnc-0.9.14-libvncserver-defines-2.patch
new file mode 100644
index 00000000..d010837
--- /dev/null
+++ b/x11-misc/x11vnc/files/x11vnc-0.9.14-libvncserver-defines-2.patch
@@ -0,0 +1,264 @@
+https://bugs.gentoo.org/567612
+
+From e70123d8f778e3f0c3bf1606f68a70b0d9748c6a Mon Sep 17 00:00:00 2001
+From: Christian Beier <dontm...@freeshell.org>
+Date: Tue, 1 Dec 2015 14:14:00 +0100
+Subject: [PATCH] Fix the remaining x11vnc-specific defines that are not in
+ LibVNCServer anymore.
+
+---
+ src/macosx.c        |  4 ++--
+ src/macosx_opengl.c |  2 +-
+ src/screen.c        |  2 +-
+ src/uinput.c        |  4 ++--
+ src/unixpw.c        | 30 +++++++++++++++---------------
+ src/user.c          |  6 +++---
+ src/v4l.c           |  2 +-
+ src/x11vnc.h        |  8 ++++----
+ 8 files changed, 29 insertions(+), 29 deletions(-)
+
+diff --git a/src/macosx.c b/src/macosx.c
+index 6645018968c3..df622db0232d 100644
+--- a/src/macosx.c
++++ b/src/macosx.c
+@@ -33,7 +33,7 @@ so, delete this exception statement from your version.
+ /* -- macosx.c -- */
+ 
+ #include "config.h"
+-#if (defined(__MACH__) && defined(__APPLE__) && 
defined(LIBVNCSERVER_HAVE_MACOSX_NATIVE_DISPLAY))
++#if (defined(__MACH__) && defined(__APPLE__) && 
defined(HAVE_MACOSX_NATIVE_DISPLAY))
+ 
+ #define DOMAC 1
+ 
+@@ -748,5 +748,5 @@ int macosx_check_clipped(int win, int *list, int n) {
+ }
+ 
+ 
+-#endif        /* LIBVNCSERVER_HAVE_MACOSX_NATIVE_DISPLAY */
++#endif        /* HAVE_MACOSX_NATIVE_DISPLAY */
+ 
+diff --git a/src/macosx_opengl.c b/src/macosx_opengl.c
+index 97882797452e..4efc7be94c2e 100644
+--- a/src/macosx_opengl.c
++++ b/src/macosx_opengl.c
+@@ -38,7 +38,7 @@ so, delete this exception statement from your version.
+ #include <ApplicationServices/ApplicationServices.h>
+ 
+ #include <rfb/rfb.h>
+-#if LIBVNCSERVER_HAVE_MACOSX_OPENGL_H
++#if HAVE_MACOSX_OPENGL_H
+ #include <OpenGL/OpenGL.h>
+ #include <OpenGL/gl.h>
+ #endif
+diff --git a/src/screen.c b/src/screen.c
+index 5d37761c9038..bda46903b59a 100644
+--- a/src/screen.c
++++ b/src/screen.c
+@@ -2119,7 +2119,7 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
+ 
+       if (sscanf(str, "shm:%d", &shmid) == 1) {
+               /* shm:N */
+-#if HAVE_XSHM || LIBVNCSERVER_HAVE_SHMAT
++#if HAVE_XSHM || HAVE_SHMAT
+               raw_fb_addr = (char *) shmat(shmid, 0, SHM_RDONLY);
+               if (! raw_fb_addr) {
+                       rfbLogEnable(1);
+diff --git a/src/uinput.c b/src/uinput.c
+index ac0324f1b0f0..d9e2b2656a5f 100644
+--- a/src/uinput.c
++++ b/src/uinput.c
+@@ -42,8 +42,8 @@ so, delete this exception statement from your version.
+ #include "allowed_input_t.h"
+ 
+ #if LIBVNCSERVER_HAVE_SYS_IOCTL_H
+-#if LIBVNCSERVER_HAVE_LINUX_INPUT_H
+-#if LIBVNCSERVER_HAVE_LINUX_UINPUT_H
++#if HAVE_LINUX_INPUT_H
++#if HAVE_LINUX_UINPUT_H
+ #define UINPUT_OK
+ #endif
+ #endif
+diff --git a/src/unixpw.c b/src/unixpw.c
+index 3a548808881f..66b776f1e8a4 100644
+--- a/src/unixpw.c
++++ b/src/unixpw.c
+@@ -62,14 +62,14 @@ extern char *crypt(const char*, const char *);
+ #endif
+ 
+ #ifdef IGNORE_GETSPNAM
+-#undef LIBVNCSERVER_HAVE_GETSPNAM
+-#define LIBVNCSERVER_HAVE_GETSPNAM 0
++#undef HAVE_GETSPNAM
++#define HAVE_GETSPNAM 0
+ #endif
+ 
+-#if LIBVNCSERVER_HAVE_PWD_H && LIBVNCSERVER_HAVE_GETPWNAM
++#if LIBVNCSERVER_HAVE_PWD_H && HAVE_GETPWNAM
+ #if LIBVNCSERVER_HAVE_CRYPT || LIBVNCSERVER_HAVE_LIBCRYPT || HAVE_LIBCRYPT
+ #define UNIXPW_CRYPT
+-#if LIBVNCSERVER_HAVE_GETSPNAM
++#if HAVE_GETSPNAM
+ #include <shadow.h>
+ #endif
+ #endif
+@@ -78,10 +78,10 @@ extern char *crypt(const char*, const char *);
+ #if LIBVNCSERVER_HAVE_SYS_IOCTL_H
+ #include <sys/ioctl.h>
+ #endif
+-#if LIBVNCSERVER_HAVE_TERMIOS_H
++#if HAVE_TERMIOS_H
+ #include <termios.h>
+ #endif
+-#if LIBVNCSERVER_HAVE_SYS_STROPTS_H
++#if HAVE_SYS_STROPTS_H
+ #include <sys/stropts.h>
+ #endif
+ 
+@@ -520,7 +520,7 @@ char *get_pty_ptmx(int *fd_p) {
+ 
+       *fd_p = -1;
+ 
+-#if LIBVNCSERVER_HAVE_GRANTPT
++#if HAVE_GRANTPT
+ 
+       for (i=0; i < ndevs; i++) {
+ #ifdef O_NOCTTY
+@@ -628,7 +628,7 @@ char *get_pty(int *fd_p) {
+ #ifdef IS_BSD
+       return get_pty_loop(fd_p);
+ #else
+-#if LIBVNCSERVER_HAVE_GRANTPT
++#if HAVE_GRANTPT
+       used_get_pty_ptmx = 1;
+       return get_pty_ptmx(fd_p);
+ #else
+@@ -644,16 +644,16 @@ void try_to_be_nobody(void) {
+       pw = getpwnam("nobody");
+ 
+       if (pw) {
+-#if LIBVNCSERVER_HAVE_SETUID
++#if HAVE_SETUID
+               setuid(pw->pw_uid);
+ #endif
+-#if LIBVNCSERVER_HAVE_SETEUID
++#if HAVE_SETEUID
+               seteuid(pw->pw_uid);
+ #endif
+-#if LIBVNCSERVER_HAVE_SETGID
++#if HAVE_SETGID
+               setgid(pw->pw_gid);
+ #endif
+-#if LIBVNCSERVER_HAVE_SETEGID
++#if HAVE_SETEGID
+               setegid(pw->pw_gid);
+ #endif
+       }
+@@ -788,7 +788,7 @@ int crypt_verify(char *user, char *pass) {
+ 
+       if (strlen(realpw) < 12) {
+               /* e.g. "x", try getspnam(), sometimes root for inetd, etc */
+-#if LIBVNCSERVER_HAVE_GETSPNAM
++#if HAVE_GETSPNAM
+               struct spwd *sp = getspnam(user);
+               if (sp != NULL && sp->sp_pwdp != NULL) {
+                       if (db) fprintf(stderr, "using getspnam()\n");
+@@ -1086,7 +1086,7 @@ int su_verify(char *user, char *pass, char *cmd, char 
*rbuf, int *rbuf_size, int
+ 
+ /* streams options fixups, handle cases as they are found: */
+ #if defined(__hpux)
+-#if LIBVNCSERVER_HAVE_SYS_STROPTS_H
++#if HAVE_SYS_STROPTS_H
+ #if LIBVNCSERVER_HAVE_SYS_IOCTL_H && defined(I_PUSH)
+               if (used_get_pty_ptmx) {
+                       ioctl(sfd, I_PUSH, "ptem");
+@@ -1127,7 +1127,7 @@ int su_verify(char *user, char *pass, char *cmd, char 
*rbuf, int *rbuf_size, int
+               chdir("/");
+ 
+               try_to_be_nobody();
+-#if LIBVNCSERVER_HAVE_GETUID
++#if HAVE_GETUID
+               if (getuid() == 0 || geteuid() == 0) {
+                       exit(1);
+               }
+diff --git a/src/user.c b/src/user.c
+index b759a61ae50a..aa14814de2b7 100644
+--- a/src/user.c
++++ b/src/user.c
+@@ -140,7 +140,7 @@ void check_switched_user(void) {
+ /* utilities for switching users */
+ static char *get_login_list(int with_display) {
+       char *out;
+-#if LIBVNCSERVER_HAVE_UTMPX_H
++#if HAVE_UTMPX_H
+       int i, cnt, max = 200, ut_namesize = 32;
+       int dpymax = 1000, sawdpy[1000];
+       struct utmpx *utx;
+@@ -761,7 +761,7 @@ static int switch_user_env(uid_t uid, gid_t gid, char 
*name, char *home, int fb_
+       int reset_fb = 0;
+       int grp_ok = 0;
+ 
+-#if !LIBVNCSERVER_HAVE_SETUID
++#if !HAVE_SETUID
+       return 0;
+ #else
+       /*
+@@ -773,7 +773,7 @@ static int switch_user_env(uid_t uid, gid_t gid, char 
*name, char *home, int fb_
+               clean_shm(0);
+               free_tiles();
+       }
+-#if LIBVNCSERVER_HAVE_INITGROUPS
++#if HAVE_INITGROUPS
+ #if LIBVNCSERVER_HAVE_PWD_H
+       if (getpwuid(uid) != NULL && getenv("X11VNC_SINGLE_GROUP") == NULL) {
+               struct passwd *p = getpwuid(uid);
+diff --git a/src/v4l.c b/src/v4l.c
+index 86c33a6b9e75..8a3581362599 100644
+--- a/src/v4l.c
++++ b/src/v4l.c
+@@ -41,7 +41,7 @@ so, delete this exception statement from your version.
+ #include "keyboard.h"
+ #include "allowed_input_t.h"
+ 
+-#if LIBVNCSERVER_HAVE_LINUX_VIDEODEV_H
++#if HAVE_LINUX_VIDEODEV_H
+ #if LIBVNCSERVER_HAVE_SYS_IOCTL_H
+ #include <sys/ioctl.h>
+ #define CONFIG_VIDEO_V4L1_COMPAT
+diff --git a/src/x11vnc.h b/src/x11vnc.h
+index 7a84703eabc8..79319a420eec 100644
+--- a/src/x11vnc.h
++++ b/src/x11vnc.h
+@@ -255,10 +255,10 @@ so, delete this exception statement from your version.
+ #endif
+ 
+ #if (SMALL_FOOTPRINT > 2)
+-#undef LIBVNCSERVER_HAVE_UTMPX_H
++#undef HAVE_UTMPX_H
+ #undef LIBVNCSERVER_HAVE_PWD_H
+ #undef REMOTE_CONTROL
+-#define LIBVNCSERVER_HAVE_UTMPX_H 0
++#define HAVE_UTMPX_H 0
+ #define LIBVNCSERVER_HAVE_PWD_H 0
+ #define REMOTE_CONTROL 0
+ #endif
+@@ -308,7 +308,7 @@ so, delete this exception statement from your version.
+ #include <sys/shm.h>
+ #include <X11/extensions/XShm.h>
+ #endif
+-#if LIBVNCSERVER_HAVE_SHMAT
++#if HAVE_SHMAT
+ #include <sys/ipc.h>
+ #include <sys/shm.h>
+ #endif
+@@ -392,7 +392,7 @@ extern int h_errno;
+ #if LIBVNCSERVER_HAVE_SYS_WAIT_H
+ #include <sys/wait.h>
+ #endif
+-#if LIBVNCSERVER_HAVE_UTMPX_H
++#if HAVE_UTMPX_H
+ #include <utmpx.h>
+ #endif
+ 
+-- 
+2.11.0.rc2
+

diff --git a/x11-misc/x11vnc/x11vnc-0.9.14-r1.ebuild 
b/x11-misc/x11vnc/x11vnc-0.9.14-r1.ebuild
new file mode 100644
index 00000000..43e7b13
--- /dev/null
+++ b/x11-misc/x11vnc/x11vnc-0.9.14-r1.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit autotools eutils vcs-snapshot
+
+DESCRIPTION="A VNC server for real X displays"
+HOMEPAGE="https://libvnc.github.io/";
+SRC_URI="https://github.com/LibVNC/x11vnc/archive/0.9.14.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh 
~sparc ~x86 ~x86-fbsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux 
~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="crypt fbcon libressl ssl xinerama zeroconf"
+
+RDEPEND=">=net-libs/libvncserver-0.9.8
+       x11-libs/libX11
+       x11-libs/libXdamage
+       x11-libs/libXext
+       x11-libs/libXfixes
+       x11-libs/libXrandr
+       >=x11-libs/libXtst-1.1.0
+       ssl? (
+               !libressl? ( dev-libs/openssl:0= )
+               libressl? ( dev-libs/libressl:= )
+       )
+       xinerama? ( x11-libs/libXinerama )
+       zeroconf? ( >=net-dns/avahi-0.6.4 )
+"
+DEPEND="${RDEPEND}
+       x11-libs/libXt
+       x11-proto/inputproto
+       x11-proto/trapproto
+       x11-proto/recordproto
+       x11-proto/xproto
+       x11-proto/xextproto
+       xinerama? ( x11-proto/xineramaproto )"
+
+DOCS=(ChangeLog README)
+
+src_prepare() {
+       epatch "${FILESDIR}"/${PN}-0.9.13-fix-compiler-detection.patch
+       epatch "${FILESDIR}"/${P}-libvncserver-defines-1.patch #567612
+       epatch "${FILESDIR}"/${P}-libvncserver-defines-2.patch #567612
+       eautoreconf
+}
+
+src_configure() {
+       # --without-v4l because of missing video4linux 2.x support wrt #389079
+       econf \
+               $(use_with crypt) \
+               $(use_with fbcon fbdev) \
+               $(use_with ssl) \
+               $(use_with ssl crypto) \
+               --without-v4l \
+               $(use_with xinerama) \
+               $(use_with zeroconf avahi)
+}
+
+src_install() {
+       default
+       doinitd "${FILESDIR}/x11vnc.init.d"
+       doconfd "${FILESDIR}/x11vnc.conf.d"
+}

Reply via email to