- Add ConsoleKit support (#233183)
This commit is contained in:
parent
3a3a125773
commit
40b3ee2454
167
xinit-1.0.2-2-poke-ck.patch
Normal file
167
xinit-1.0.2-2-poke-ck.patch
Normal file
@ -0,0 +1,167 @@
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 55648bc..07e40cd 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -91,7 +91,7 @@ AC_ARG_WITH(xinit,
|
||||
[XINIT="$DEFAULT_XINIT"])
|
||||
|
||||
# Checks for pkg-config packages
|
||||
-PKG_CHECK_MODULES(XINIT, x11)
|
||||
+PKG_CHECK_MODULES(XINIT, x11 ck-connector)
|
||||
|
||||
case $host_os in
|
||||
*bsd*)
|
||||
diff --git a/startx.cpp b/startx.cpp
|
||||
index eba83b8..f091fa5 100644
|
||||
--- a/startx.cpp
|
||||
+++ b/startx.cpp
|
||||
@@ -217,6 +217,12 @@ done
|
||||
|
||||
#endif
|
||||
|
||||
+if [ x"$display" != x ]; then
|
||||
+ export DISPLAY=$display
|
||||
+else
|
||||
+ export DISPLAY=:0
|
||||
+fi
|
||||
+
|
||||
#if defined(__SCO__) || defined(__UNIXWARE__)
|
||||
if [ "$REMOTE_SERVER" = "TRUE" ]; then
|
||||
exec SHELL_CMD ${client}
|
||||
diff --git a/xinit.c b/xinit.c
|
||||
index 818f754..de97791 100644
|
||||
--- a/xinit.c
|
||||
+++ b/xinit.c
|
||||
@@ -1,3 +1,4 @@
|
||||
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||
/* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */
|
||||
/* $XdotOrg: $ */
|
||||
|
||||
@@ -37,6 +38,13 @@ in this Software without prior written authorization from The Open Group.
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
+#define USE_CONKIT
|
||||
+#ifdef USE_CONKIT
|
||||
+#include <ck-connector.h>
|
||||
+#include <X11/Xatom.h>
|
||||
+static CkConnector *ckc = NULL;
|
||||
+#endif /* USE_CONKIT */
|
||||
+
|
||||
#ifdef X_POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
|
||||
#include <signal.h>
|
||||
@@ -558,6 +566,39 @@ processTimeout(int timeout, char *string)
|
||||
return( serverpid != pidfound );
|
||||
}
|
||||
|
||||
+
|
||||
+#ifdef USE_CONKIT
|
||||
+static void
|
||||
+register_new_session_with_console_kit (void)
|
||||
+{
|
||||
+ static char conkitbuf[256];
|
||||
+ DBusError error;
|
||||
+
|
||||
+ ckc = ck_connector_new ();
|
||||
+ if (ckc == NULL) {
|
||||
+ Error ("Cannot register with ConsoleKit: OOM creating CkConnector\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ dbus_error_init (&error);
|
||||
+ if (!ck_connector_open_session (ckc, &error)) {
|
||||
+ Error ("Cannot register with ConsoleKit: %s: %s\n", error.name, error.message);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /* If we managed to register with ConsoleKit, put the
|
||||
+ * environment variable XDG_SESSION_COOKIE=cookie as second
|
||||
+ * element in newenviron. See set_environment() where we
|
||||
+ * earlier have made sure there is room...
|
||||
+ */
|
||||
+ conkitbuf[sizeof (conkitbuf) - 1] = '\0';
|
||||
+ snprintf (conkitbuf, sizeof (conkitbuf) - 1, "XDG_SESSION_COOKIE=%s", ck_connector_get_cookie (ckc));
|
||||
+ newenviron[1] = conkitbuf;
|
||||
+out:
|
||||
+ ;
|
||||
+}
|
||||
+#endif /* USE_CONKIT */
|
||||
+
|
||||
static int
|
||||
startServer(char *server[])
|
||||
{
|
||||
@@ -685,6 +726,12 @@ startServer(char *server[])
|
||||
break;
|
||||
}
|
||||
|
||||
+#ifdef USE_CONKIT
|
||||
+ if (serverpid != -1 ) {
|
||||
+ register_new_session_with_console_kit ();
|
||||
+ }
|
||||
+#endif /* USE_CONKIT */
|
||||
+
|
||||
return(serverpid);
|
||||
}
|
||||
|
||||
@@ -748,6 +795,13 @@ shutdown(void)
|
||||
clientpid);
|
||||
}
|
||||
|
||||
+#ifdef USE_CONKIT
|
||||
+ if (ckc != NULL) {
|
||||
+ ck_connector_unref (ckc);
|
||||
+ ckc = NULL;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (serverpid < 0)
|
||||
return;
|
||||
errno = 0;
|
||||
@@ -784,6 +838,13 @@ shutdown(void)
|
||||
* make a new copy of environment that has room for DISPLAY
|
||||
*/
|
||||
|
||||
+
|
||||
+#ifdef USE_CONKIT
|
||||
+#define NUM_EXTRA_ENV_VARS 3
|
||||
+#else
|
||||
+#define NUM_EXTRA_ENV_VARS 2
|
||||
+#endif
|
||||
+
|
||||
static void
|
||||
set_environment(void)
|
||||
{
|
||||
@@ -795,11 +856,11 @@ set_environment(void)
|
||||
for (oldPtr = environ; *oldPtr; oldPtr++) ;
|
||||
|
||||
nenvvars = (oldPtr - environ);
|
||||
- newenviron = (char **) malloc ((nenvvars + 2) * sizeof(char **));
|
||||
+ newenviron = (char **) malloc ((nenvvars + NUM_EXTRA_ENV_VARS) * sizeof(char **));
|
||||
if (!newenviron) {
|
||||
fprintf (stderr,
|
||||
"%s: unable to allocate %d pointers for environment\n",
|
||||
- program, nenvvars + 2);
|
||||
+ program, nenvvars + NUM_EXTRA_ENV_VARS);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -809,9 +870,17 @@ set_environment(void)
|
||||
newPtr = newenviron;
|
||||
*newPtr++ = displaybuf;
|
||||
|
||||
+#ifdef USE_CONKIT
|
||||
+ *newPtr++ = "XDG_SESSION_COOKIE=";
|
||||
+#endif
|
||||
+
|
||||
/* copy pointers to other variables */
|
||||
for (oldPtr = environ; *oldPtr; oldPtr++) {
|
||||
+#ifdef USE_CONKIT
|
||||
+ if (strncmp (*oldPtr, "DISPLAY=", 8) != 0 && strncmp (*oldPtr, "XDG_SESSION_COOKIE=", 19) != 0) {
|
||||
+#else
|
||||
if (strncmp (*oldPtr, "DISPLAY=", 8) != 0) {
|
||||
+#endif
|
||||
*newPtr++ = *oldPtr;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
Summary: X.Org X11 X Window System xinit startup scripts
|
||||
Name: xorg-x11-%{pkgname}
|
||||
Version: 1.0.2
|
||||
Release: 15%{?dist}
|
||||
Release: 16%{?dist}
|
||||
License: MIT/X11
|
||||
Group: User Interface/X
|
||||
URL: http://www.x.org
|
||||
@ -23,15 +23,22 @@ Source17: localuser.sh
|
||||
|
||||
Patch0: ftp://ftp.freedesktop.org/pub/xorg/X11R7.1/patches/xinit-1.0.2-setuid.diff
|
||||
Patch1: xinit-1.0.2-client-session.patch
|
||||
Patch2: xinit-1.0.2-2-poke-ck.patch
|
||||
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: libX11-devel
|
||||
BuildRequires: ConsoleKit-devel
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: libtool
|
||||
# NOTE: startx needs xauth in order to run, but that is not picked up
|
||||
# automatically by rpm. (Bug #173684)
|
||||
Requires: xauth
|
||||
# next two are for localuser.sh
|
||||
Requires: coreutils
|
||||
Requires: xorg-x11-server-utils
|
||||
Requires: ConsoleKit-x11
|
||||
Requires: ConsoleKit-libs
|
||||
|
||||
# NOTE: xinit, startx moved to xorg-x11-xinit during the X.Org X11R7
|
||||
# modularization. These Obsoletes lines ensure upgrades work smoothly.
|
||||
@ -49,8 +56,10 @@ X.Org X11 X Window System xinit startup scripts
|
||||
%setup -q -n %{pkgname}-%{version}
|
||||
%patch0 -p0 -b .setuid
|
||||
%patch1 -p1 -b .client-session
|
||||
%patch2 -p1 -b .poke-ck
|
||||
|
||||
%build
|
||||
autoreconf
|
||||
%configure
|
||||
# FIXME: Upstream should default to XINITDIR being this. Make a patch to
|
||||
# Makefile.am and submit it in a bug report or check into CVS.
|
||||
@ -102,6 +111,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_mandir}/man1/xinit.1x*
|
||||
|
||||
%changelog
|
||||
* Mon Apr 02 2007 David Zeuthen <davidz@redhat.com> 1.0.2-16
|
||||
- Add ConsoleKit support (#233183)
|
||||
|
||||
* Mon Nov 27 2006 Adam Jackson <ajax@redhat.com> 1.0.2-15
|
||||
- Bump EVR to fix 6 to 7 updates.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user