packages: xorg-app-xdm/xdm.pamd, xorg-app-xdm/xorg-app-xdm.spec, xorg-app-x...

kosmo kosmo at pld-linux.org
Wed Dec 22 19:29:25 CET 2010


Author: kosmo                        Date: Wed Dec 22 18:29:25 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- use ConsoleKit.
The pam_ck_connector.so module used by XDM did not register session
in ConsoleKit as XDM does not set PAM evironment variables required
by the module.
Newly introduced xorg-app-xdm-consolekit.patch (taken from OpenSUSE)
adds ConsoleKit support to xdm making pam_ck_connector.so obsolete.

---- Files affected:
packages/xorg-app-xdm:
   xdm.pamd (1.12 -> 1.13) , xorg-app-xdm.spec (1.42 -> 1.43) , xorg-app-xdm-consolekit.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/xorg-app-xdm/xdm.pamd
diff -u packages/xorg-app-xdm/xdm.pamd:1.12 packages/xorg-app-xdm/xdm.pamd:1.13
--- packages/xorg-app-xdm/xdm.pamd:1.12	Sat Oct 27 15:06:48 2007
+++ packages/xorg-app-xdm/xdm.pamd	Wed Dec 22 19:29:20 2010
@@ -9,4 +9,3 @@
 session		optional	pam_keyinit.so force revoke
 session		include		system-auth
 session		optional	pam_console.so
-session		optional	pam_ck_connector.so

================================================================
Index: packages/xorg-app-xdm/xorg-app-xdm.spec
diff -u packages/xorg-app-xdm/xorg-app-xdm.spec:1.42 packages/xorg-app-xdm/xorg-app-xdm.spec:1.43
--- packages/xorg-app-xdm/xorg-app-xdm.spec:1.42	Thu May 27 08:50:03 2010
+++ packages/xorg-app-xdm/xorg-app-xdm.spec	Wed Dec 22 19:29:20 2010
@@ -21,8 +21,10 @@
 Patch0:		%{name}-Xsession.patch
 Patch1:		%{name}-pam_tty.patch
 Patch2:		%{name}-config.patch
-Patch3:		%{name}-selinux.patch
+Patch3:		%{name}-consolekit.patch
+Patch4:		%{name}-selinux.patch
 URL:		http://xorg.freedesktop.org/
+BuildRequires:	ConsoleKit-devel
 BuildRequires:	autoconf >= 2.60
 BuildRequires:	automake
 BuildRequires:	cpp
@@ -80,6 +82,7 @@
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 %build
 %{__libtoolize}
@@ -94,6 +97,7 @@
 	--with-authdir=/var/lib/xdm \
 	--with-bw-pixmap=xdm-pld-logo-bw.xpm \
 	--with-color-pixmap=xdm-pld-logo.xpm \
+	--with-consolekit \
 	--with-default-vt=vt9 \
 	--with-pixmapdir=%{_sysconfdir}/X11/xdm/pixmaps \
 	--with-selinux \
@@ -179,6 +183,16 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.43  2010/12/22 18:29:20  kosmo
+- use ConsoleKit.
+
+The pam_ck_connector.so module used by XDM did not register session
+in ConsoleKit as XDM does not set PAM evironment variables required
+by the module.
+
+Newly introduced xorg-app-xdm-consolekit.patch (taken from OpenSUSE)
+adds ConsoleKit support to xdm making pam_ck_connector.so obsolete.
+
 Revision 1.42  2010/05/27 06:50:03  qboosh
 - updated to 1.1.10
 - enable selinux support (added selinux patch to fix configure bug)

================================================================
Index: packages/xorg-app-xdm/xorg-app-xdm-consolekit.patch
diff -u /dev/null packages/xorg-app-xdm/xorg-app-xdm-consolekit.patch:1.1
--- /dev/null	Wed Dec 22 19:29:26 2010
+++ packages/xorg-app-xdm/xorg-app-xdm-consolekit.patch	Wed Dec 22 19:29:20 2010
@@ -0,0 +1,243 @@
+---
+ configure.ac |   14 ++++++++
+ dm.h         |    3 +
+ resource.c   |   13 +++++++
+ session.c    |  100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ xdm.man.cpp  |    6 +++
+ 5 files changed, 135 insertions(+), 1 deletion(-)
+
+Index: xdm-1.1.10/configure.ac
+===================================================================
+--- xdm-1.1.10.orig/configure.ac
++++ xdm-1.1.10/configure.ac
+@@ -434,6 +434,20 @@ fi
+ 
+ AM_CONDITIONAL(DYNAMIC_GREETER, test x$DYNAMIC_GREETER = xyes)
+ 
++# ConsoleKit support
++AC_ARG_WITH(consolekit, AC_HELP_STRING([--with-consolekit], [Use ConsoleKit]),
++	[USE_CONSOLEKIT=$withval], [USE_CONSOLEKIT=yes])
++if test x"$USE_CONSOLEKIT" != xno; then
++	PKG_CHECK_MODULES(CK_CONNECTOR, ck-connector,
++		[USE_CONSOLEKIT=yes], [USE_CONSOLEKIT=no])
++	if test x"$USE_CONSOLEKIT" = xyes; then
++		AC_DEFINE([USE_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit])
++		XDM_CFLAGS="$XDM_CFLAGS $CK_CONNECTOR_CFLAGS"
++		XDM_LIBS="$XDM_LIBS $CK_CONNECTOR_LIBS"
++	fi
++fi
++dnl AM_CONDITIONAL(USE_CONSOLEKIT, test$USE_CONSOLEKIT = xyes)
++
+ #
+ #  XDM
+ #
+Index: xdm-1.1.10/session.c
+===================================================================
+--- xdm-1.1.10.orig/session.c
++++ xdm-1.1.10/session.c
+@@ -67,6 +67,11 @@ extern int key_setnet(struct key_netstar
+ # endif
+ #endif /* USE_PAM */
+ 
++#ifdef USE_CONSOLEKIT
++#include <ck-connector.h>
++#include <dbus/dbus.h>
++#endif
++
+ #ifdef __SCO__
+ # include <prot.h>
+ #endif
+@@ -514,6 +519,97 @@ UnsecureDisplay (struct display *d, Disp
+     }
+ }
+ 
++#ifdef USE_CONSOLEKIT
++
++static CkConnector *connector;
++
++static int openCKSession(struct verify_info *verify, struct display *d)
++{
++    int ret;
++    DBusError error;
++    char  *remote_host_name = "";
++    dbus_bool_t is_local;
++    char *display_name = "";
++    char *display_device = "";
++    char devtmp[16];
++
++    if (!use_consolekit)
++	return 1;
++
++    is_local = d->displayType.location == Local;
++    if (d->peerlen > 0 && d->peer)
++	remote_host_name = d->peer;
++    if (d->name)
++	display_name = d->name;
++    /* how can we get the corresponding tty at best...? */
++    if (d->windowPath) {
++	display_device = strchr(d->windowPath, ':');
++	if (display_device && display_device[1])
++	    display_device++;
++	else
++	    display_device = d->windowPath;
++	snprintf(devtmp, sizeof(devtmp), "/dev/tty%s", display_device);
++	display_device = devtmp;
++    }
++
++    connector = ck_connector_new();
++    if (!connector) {
++	LogOutOfMem("ck_connector");
++	return 0;
++    }
++
++    dbus_error_init(&error);
++    ret = ck_connector_open_session_with_parameters(
++		connector, &error,
++		"unix-user", &verify->uid,
++		"x11-display", &display_name,
++		"x11-display-device", &display_device,
++		"remote-host-name", &remote_host_name,
++		"is-local", &is_local,
++		NULL);
++    if (!ret) {
++	if (dbus_error_is_set(&error)) {
++	    LogError("Dbus error: %s\n", error.message);
++	    dbus_error_free(&error);
++	} else {
++	    LogError("ConsoleKit error\n");
++	}
++	LogError("console-kit-daemon not running?\n");
++	ck_connector_unref(connector);
++	connector = NULL;
++	return 0;
++    }
++
++    verify->userEnviron = setEnv(verify->userEnviron,
++		"XDG_SESSION_COOKIE", ck_connector_get_cookie(connector));
++    return 1;
++}
++
++static void closeCKSession(void)
++{
++    DBusError error;
++
++    if (!connector)
++	return;
++
++    dbus_error_init(&error);
++    if (!ck_connector_close_session(connector, &error)) {
++	if (dbus_error_is_set(&error)) {
++	    LogError("Dbus error: %s\n", error.message);
++	    dbus_error_free(&error);
++	} else {
++	    LogError("ConsoleKit close error\n");
++	}
++	LogError("console-kit-daemon not running?\n");
++    }
++    ck_connector_unref(connector);
++    connector = NULL;
++}
++#else
++#define openCKSession(v,d)	1
++#define closeCKSession()
++#endif
++
+ void
+ SessionExit (struct display *d, int status, int removeAuth)
+ {
+@@ -528,6 +624,8 @@ SessionExit (struct display *d, int stat
+     }
+ #endif
+ 
++    closeCKSession();
++
+     /* make sure the server gets reset after the session is over */
+     if (d->serverPid >= 2 && d->resetSignal)
+ 	kill (d->serverPid, d->resetSignal);
+@@ -610,6 +708,10 @@ StartClient (
+ #ifdef USE_PAM
+     if (pamh) pam_open_session(pamh, 0);
+ #endif
++
++    if (!openCKSession(verify, d))
++	return 0;
++
+     switch (pid = fork ()) {
+     case 0:
+ 	CleanUpChild ();
+Index: xdm-1.1.10/dm.h
+===================================================================
+--- xdm-1.1.10.orig/dm.h
++++ xdm-1.1.10/dm.h
+@@ -323,6 +323,9 @@ extern char	*randomFile;
+ extern char	*prngdSocket;
+ extern int	prngdPort;
+ # endif
++#ifdef USE_CONSOLEKIT
++extern int	use_consolekit;
++#endif
+ 
+ extern char	*greeterLib;
+ extern char	*willing;
+Index: xdm-1.1.10/resource.c
+===================================================================
+--- xdm-1.1.10.orig/resource.c
++++ xdm-1.1.10/resource.c
+@@ -65,6 +65,9 @@ char	*randomDevice;
+ char	*prngdSocket;
+ int	prngdPort;
+ #endif
++#ifdef USE_CONSOLEKIT
++int	use_consolekit;
++#endif
+ 
+ char	*greeterLib;
+ char	*willing;
+@@ -196,6 +199,10 @@ struct dmResources {
+ 				"false"} ,
+ { "willing",	"Willing",	DM_STRING,	&willing,
+ 				""} ,
++#ifdef USE_CONSOLEKIT
++{ "consoleKit",	"ConsoleKit",	DM_BOOL,	(char **) &use_consolekit,
++				"true"} ,
++#endif
+ };
+ 
+ #define NUM_DM_RESOURCES	(sizeof DmResources / sizeof DmResources[0])
+@@ -378,7 +385,11 @@ XrmOptionDescRec optionTable [] = {
+ {"-debug",	"*debugLevel",		XrmoptionSepArg,	(caddr_t) NULL },
+ {"-xrm",	NULL,			XrmoptionResArg,	(caddr_t) NULL },
+ {"-daemon",	".daemonMode",		XrmoptionNoArg,		"true"         },
+-{"-nodaemon",	".daemonMode",		XrmoptionNoArg,		"false"        }
++{"-nodaemon",	".daemonMode",		XrmoptionNoArg,		"false"        },
++#ifdef USE_CONSOLEKIT
++{"-consolekit",	".consoleKit",		XrmoptionNoArg,		"true"  },
++{"-noconsolekit", ".consoleKit",	XrmoptionNoArg,		"false" }
++#endif
+ };
+ 
+ static int	originalArgc;
+Index: xdm-1.1.10/xdm.man.cpp
+===================================================================
+--- xdm-1.1.10.orig/xdm.man.cpp
++++ xdm-1.1.10/xdm.man.cpp
+@@ -48,6 +48,8 @@ xdm \- X Display Manager with support fo
+ ] [
+ .B \-session
+ .I session_program
++] [
++.B \-noconsolekit
+ ]
+ .SH DESCRIPTION
+ .I Xdm
+@@ -215,6 +217,10 @@ indicates the program to run as the sess
+ .IP "\fB\-xrm\fP \fIresource_specification\fP"
+ Allows an arbitrary resource to be specified, as in most
+ X Toolkit applications.
++.IP "\fB\-noconsolekit\fP"
++Specifies ``false'' as the value for the \fBDisplayManager.consoleKit\fP
++resource.
++This suppresses the session management using ConsoleKit.
+ .SH RESOURCES
+ At many stages the actions of
+ .I xdm
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/xorg-app-xdm/xdm.pamd?r1=1.12&r2=1.13&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/xorg-app-xdm/xorg-app-xdm.spec?r1=1.42&r2=1.43&f=u



More information about the pld-cvs-commit mailing list