summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2009-07-14 17:41:18 +0200
committerMichael Biebl <biebl@debian.org>2009-07-14 17:41:18 +0200
commitb78e497569d2fc75e25c65c3f9f78c8580887c0b (patch)
tree3f8bf4dd1b6be9554b2da77d82c400697121df24 /src
parent1f223c41689bbbd64f8749ff7c09967a49407022 (diff)
downloadconsolekit-upstream/0.3.0.tar.gz
Imported Upstream version 0.3.0upstream/0.3.0
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am25
-rw-r--r--src/Makefile.in111
-rw-r--r--src/ck-event-logger.c28
-rw-r--r--src/ck-job.c1
-rw-r--r--src/ck-log-event.h8
-rw-r--r--src/ck-manager-glue.h10
-rw-r--r--src/ck-manager.c69
-rw-r--r--src/ck-manager.xml70
-rw-r--r--src/ck-seat-glue.h4
-rw-r--r--src/ck-seat.c8
-rw-r--r--src/ck-seat.xml39
-rw-r--r--src/ck-session-glue.h29
-rw-r--r--src/ck-session-leader.c137
-rw-r--r--src/ck-session-leader.h63
-rw-r--r--src/ck-session.c50
-rw-r--r--src/ck-session.h6
-rw-r--r--src/ck-session.xml78
-rw-r--r--src/ck-sysdeps-freebsd.c9
-rw-r--r--src/ck-sysdeps-linux.c66
-rw-r--r--src/ck-sysdeps-solaris.c9
-rw-r--r--src/ck-sysdeps.h2
-rw-r--r--src/ck-vt-monitor.c1
-rw-r--r--src/main.c65
-rw-r--r--src/org.freedesktop.ConsoleKit.Manager.xml343
-rw-r--r--src/org.freedesktop.ConsoleKit.Seat.xml163
-rw-r--r--src/org.freedesktop.ConsoleKit.Session.xml435
-rwxr-xr-xsrc/test-open-session-with-parameters20
27 files changed, 1449 insertions, 400 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8d5d83b..cbe8a09 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,12 +75,19 @@ BUILT_SOURCES = \
ck-marshal.h \
$(NULL)
-ck-manager-glue.h: ck-manager.xml Makefile.am
- dbus-binding-tool --prefix=ck_manager --mode=glib-server --output=ck-manager-glue.h ck-manager.xml
-ck-seat-glue.h: ck-seat.xml Makefile.am
- dbus-binding-tool --prefix=ck_seat --mode=glib-server --output=ck-seat-glue.h ck-seat.xml
-ck-session-glue.h: ck-session.xml Makefile.am
- dbus-binding-tool --prefix=ck_session --mode=glib-server --output=ck-session-glue.h ck-session.xml
+dbusifdir = $(datadir)/dbus-1/interfaces
+dbusif_DATA = \
+ org.freedesktop.ConsoleKit.Manager.xml \
+ org.freedesktop.ConsoleKit.Seat.xml \
+ org.freedesktop.ConsoleKit.Session.xml \
+ $(NULL)
+
+ck-manager-glue.h: org.freedesktop.ConsoleKit.Manager.xml Makefile.am
+ dbus-binding-tool --prefix=ck_manager --mode=glib-server --output=ck-manager-glue.h org.freedesktop.ConsoleKit.Manager.xml
+ck-seat-glue.h: org.freedesktop.ConsoleKit.Seat.xml Makefile.am
+ dbus-binding-tool --prefix=ck_seat --mode=glib-server --output=ck-seat-glue.h org.freedesktop.ConsoleKit.Seat.xml
+ck-session-glue.h: org.freedesktop.ConsoleKit.Session.xml Makefile.am
+ dbus-binding-tool --prefix=ck_session --mode=glib-server --output=ck-session-glue.h org.freedesktop.ConsoleKit.Session.xml
ck-marshal.c: ck-marshal.list
echo "#include \"ck-marshal.h\"" > $@ && \
@@ -183,9 +190,7 @@ test_tty_idle_monitor_LDADD = \
EXTRA_DIST = \
ck-marshal.list \
- ck-manager.xml \
- ck-seat.xml \
- ck-session.xml \
+ $(dbusif_DATA) \
valgrind.sh \
test-open-session \
test-open-session-with-parameters \
@@ -199,6 +204,6 @@ MAINTAINERCLEANFILES = \
install-data-local:
-mkdir -p $(DESTDIR)$(sysconfdir)/ConsoleKit/run-session.d
- -mkdir -p $(DESTDIR)$(libdir)/ConsoleKit/run-session.d
+ -mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d
-mkdir -p $(DESTDIR)$(localstatedir)/run/ConsoleKit
-mkdir -p $(DESTDIR)$(localstatedir)/log/ConsoleKit
diff --git a/src/Makefile.in b/src/Makefile.in
index 7021cd8..40bcd58 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,7 @@
@SET_MAKE@
+
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -79,7 +80,7 @@ am_libck_la_OBJECTS = ck-sysdeps-unix.lo $(am__objects_1) \
$(am__objects_2) $(am__objects_3) $(am__objects_4)
libck_la_OBJECTS = $(am_libck_la_OBJECTS)
am__EXEEXT_1 =
-am__installdirs = "$(DESTDIR)$(sbindir)"
+am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(dbusifdir)"
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
am__console_kit_daemon_SOURCES_DIST = main.c ck-manager.h ck-manager.c \
@@ -126,7 +127,7 @@ am_test_vt_monitor_OBJECTS = ck-vt-monitor.$(OBJEXT) \
test_vt_monitor_OBJECTS = $(am_test_vt_monitor_OBJECTS)
test_vt_monitor_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) libck.la $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -157,6 +158,14 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+dbusifDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dbusif_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
@@ -192,6 +201,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@@ -231,6 +241,7 @@ MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGFMT_OPTS = @MSGFMT_OPTS@
+NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -250,6 +261,7 @@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
RANLIB = @RANLIB@
RBAC_LIBS = @RBAC_LIBS@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -260,6 +272,7 @@ VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
XGETTEXT = @XGETTEXT@
XMLTO = @XMLTO@
+XSLTPROC = @XSLTPROC@
Z_LIBS = @Z_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -363,6 +376,13 @@ BUILT_SOURCES = \
ck-marshal.h \
$(NULL)
+dbusifdir = $(datadir)/dbus-1/interfaces
+dbusif_DATA = \
+ org.freedesktop.ConsoleKit.Manager.xml \
+ org.freedesktop.ConsoleKit.Seat.xml \
+ org.freedesktop.ConsoleKit.Session.xml \
+ $(NULL)
+
console_kit_daemon_SOURCES = main.c ck-manager.h ck-manager.c \
ck-vt-monitor.h ck-vt-monitor.c ck-tty-idle-monitor.h \
ck-tty-idle-monitor.c ck-file-monitor.h ck-job.h ck-job.c \
@@ -426,9 +446,7 @@ test_tty_idle_monitor_LDADD = \
EXTRA_DIST = \
ck-marshal.list \
- ck-manager.xml \
- ck-seat.xml \
- ck-session.xml \
+ $(dbusif_DATA) \
valgrind.sh \
test-open-session \
test-open-session-with-parameters \
@@ -502,8 +520,8 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS)
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
else :; fi; \
done
@@ -589,6 +607,23 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+install-dbusifDATA: $(dbusif_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(dbusifdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusifdir)"
+ @list='$(dbusif_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dbusifDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(dbusifdir)/$$f'"; \
+ $(dbusifDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dbusifdir)/$$f"; \
+ done
+
+uninstall-dbusifDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dbusif_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(dbusifdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(dbusifdir)/$$f"; \
+ done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -665,8 +700,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
@@ -691,8 +726,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -702,13 +737,12 @@ ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
- here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
@@ -767,10 +801,10 @@ distdir: $(DISTFILES)
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA)
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(sbindir)"; do \
+ for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(dbusifdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -822,7 +856,7 @@ info: info-recursive
info-am:
-install-data-am: install-data-local
+install-data-am: install-data-local install-dbusifDATA
install-dvi: install-dvi-recursive
@@ -858,7 +892,7 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-sbinPROGRAMS
+uninstall-am: uninstall-dbusifDATA uninstall-sbinPROGRAMS
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
@@ -870,23 +904,24 @@ uninstall-am: uninstall-sbinPROGRAMS
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
- install-data-local install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-sbinPROGRAMS install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
- uninstall-sbinPROGRAMS
-
-
-ck-manager-glue.h: ck-manager.xml Makefile.am
- dbus-binding-tool --prefix=ck_manager --mode=glib-server --output=ck-manager-glue.h ck-manager.xml
-ck-seat-glue.h: ck-seat.xml Makefile.am
- dbus-binding-tool --prefix=ck_seat --mode=glib-server --output=ck-seat-glue.h ck-seat.xml
-ck-session-glue.h: ck-session.xml Makefile.am
- dbus-binding-tool --prefix=ck_session --mode=glib-server --output=ck-session-glue.h ck-session.xml
+ install-data-local install-dbusifDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sbinPROGRAMS install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-dbusifDATA uninstall-sbinPROGRAMS
+
+
+ck-manager-glue.h: org.freedesktop.ConsoleKit.Manager.xml Makefile.am
+ dbus-binding-tool --prefix=ck_manager --mode=glib-server --output=ck-manager-glue.h org.freedesktop.ConsoleKit.Manager.xml
+ck-seat-glue.h: org.freedesktop.ConsoleKit.Seat.xml Makefile.am
+ dbus-binding-tool --prefix=ck_seat --mode=glib-server --output=ck-seat-glue.h org.freedesktop.ConsoleKit.Seat.xml
+ck-session-glue.h: org.freedesktop.ConsoleKit.Session.xml Makefile.am
+ dbus-binding-tool --prefix=ck_session --mode=glib-server --output=ck-session-glue.h org.freedesktop.ConsoleKit.Session.xml
ck-marshal.c: ck-marshal.list
echo "#include \"ck-marshal.h\"" > $@ && \
@@ -897,7 +932,7 @@ ck-marshal.h: ck-marshal.list
install-data-local:
-mkdir -p $(DESTDIR)$(sysconfdir)/ConsoleKit/run-session.d
- -mkdir -p $(DESTDIR)$(libdir)/ConsoleKit/run-session.d
+ -mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d
-mkdir -p $(DESTDIR)$(localstatedir)/run/ConsoleKit
-mkdir -p $(DESTDIR)$(localstatedir)/log/ConsoleKit
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/ck-event-logger.c b/src/ck-event-logger.c
index 2fded87..92bf987 100644
--- a/src/ck-event-logger.c
+++ b/src/ck-event-logger.c
@@ -254,12 +254,16 @@ writer_thread_start (CkEventLogger *event_logger)
{
CkLogEvent *event;
- while ((event = g_async_queue_pop (event_logger->priv->event_queue)) != NULL) {
+ while (1) {
+ event = g_async_queue_pop (event_logger->priv->event_queue);
+ if (event == NULL || event->type == CK_LOG_EVENT_NONE) {
+ break;
+ }
write_log_for_event (event_logger, event);
ck_log_event_free (event);
}
- g_thread_exit (NULL);
+ g_debug ("Writer thread received None event - exiting");
return NULL;
}
@@ -274,7 +278,7 @@ create_writer_thread (CkEventLogger *event_logger)
event_logger->priv->writer_thread = g_thread_create_full ((GThreadFunc)writer_thread_start,
event_logger,
65536,
- FALSE,
+ TRUE,
TRUE,
G_THREAD_PRIORITY_NORMAL,
&error);
@@ -284,6 +288,22 @@ create_writer_thread (CkEventLogger *event_logger)
}
}
+static void
+destroy_writer_thread (CkEventLogger *event_logger)
+{
+ CkLogEvent event;
+
+ event.type = CK_LOG_EVENT_NONE;
+
+ g_debug ("Destroying writer thread");
+ g_async_queue_push (event_logger->priv->event_queue,
+ &event);
+#if 1
+ g_debug ("Joining writer thread");
+ g_thread_join (event_logger->priv->writer_thread);
+#endif
+}
+
static GObject *
ck_event_logger_constructor (GType type,
guint n_construct_properties,
@@ -394,6 +414,8 @@ ck_event_logger_finalize (GObject *object)
g_return_if_fail (event_logger->priv != NULL);
+ destroy_writer_thread (event_logger);
+
if (event_logger->priv->event_queue != NULL) {
g_async_queue_unref (event_logger->priv->event_queue);
}
diff --git a/src/ck-job.c b/src/ck-job.c
index 891c743..87fe33a 100644
--- a/src/ck-job.c
+++ b/src/ck-job.c
@@ -183,7 +183,6 @@ out_watch (GIOChannel *source,
switch (status) {
case G_IO_STATUS_NORMAL:
- g_debug ("command output: %s", line);
g_string_append (job->priv->std_out, line);
break;
case G_IO_STATUS_EOF:
diff --git a/src/ck-log-event.h b/src/ck-log-event.h
index 149f49b..64dec58 100644
--- a/src/ck-log-event.h
+++ b/src/ck-log-event.h
@@ -27,7 +27,8 @@ G_BEGIN_DECLS
typedef enum
{
- CK_LOG_EVENT_START = 0,
+ CK_LOG_EVENT_NONE = 0,
+ CK_LOG_EVENT_START,
CK_LOG_EVENT_STOP,
CK_LOG_EVENT_SYSTEM_START,
CK_LOG_EVENT_SYSTEM_STOP,
@@ -44,6 +45,10 @@ typedef enum
typedef struct
{
+} CkLogNoneEvent;
+
+typedef struct
+{
} CkLogSystemStopEvent;
typedef struct
@@ -117,6 +122,7 @@ typedef struct
typedef struct
{
union {
+ CkLogNoneEvent none;
CkLogSystemRestartEvent system_start;
CkLogSystemStopEvent system_stop;
CkLogSystemRestartEvent system_restart;
diff --git a/src/ck-manager-glue.h b/src/ck-manager-glue.h
index b82aabc..a63a24c 100644
--- a/src/ck-manager-glue.h
+++ b/src/ck-manager-glue.h
@@ -53,7 +53,7 @@ G_BEGIN_DECLS
#endif /* !G_ENABLE_DEBUG */
-/* BOOLEAN:POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.D3GI6T:1) */
+/* BOOLEAN:POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.SK5TEU:1) */
extern void dbus_glib_marshal_ck_manager_BOOLEAN__POINTER_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
@@ -100,11 +100,11 @@ dbus_glib_marshal_ck_manager_BOOLEAN__POINTER_POINTER (GClosure *closure,
g_value_set_boolean (return_value, v_return);
}
-/* NONE:UINT,POINTER (/tmp/dbus-binding-tool-c-marshallers.D3GI6T:2) */
+/* NONE:UINT,POINTER (/tmp/dbus-binding-tool-c-marshallers.SK5TEU:2) */
#define dbus_glib_marshal_ck_manager_VOID__UINT_POINTER g_cclosure_marshal_VOID__UINT_POINTER
#define dbus_glib_marshal_ck_manager_NONE__UINT_POINTER dbus_glib_marshal_ck_manager_VOID__UINT_POINTER
-/* NONE:STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.D3GI6T:3) */
+/* NONE:STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.SK5TEU:3) */
extern void dbus_glib_marshal_ck_manager_VOID__STRING_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
@@ -148,11 +148,11 @@ dbus_glib_marshal_ck_manager_VOID__STRING_POINTER (GClosure *closure,
}
#define dbus_glib_marshal_ck_manager_NONE__STRING_POINTER dbus_glib_marshal_ck_manager_VOID__STRING_POINTER
-/* NONE:POINTER (/tmp/dbus-binding-tool-c-marshallers.D3GI6T:4) */
+/* NONE:POINTER (/tmp/dbus-binding-tool-c-marshallers.SK5TEU:4) */
#define dbus_glib_marshal_ck_manager_VOID__POINTER g_cclosure_marshal_VOID__POINTER
#define dbus_glib_marshal_ck_manager_NONE__POINTER dbus_glib_marshal_ck_manager_VOID__POINTER
-/* NONE:BOXED,POINTER (/tmp/dbus-binding-tool-c-marshallers.D3GI6T:5) */
+/* NONE:BOXED,POINTER (/tmp/dbus-binding-tool-c-marshallers.SK5TEU:5) */
extern void dbus_glib_marshal_ck_manager_VOID__BOXED_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
diff --git a/src/ck-manager.c b/src/ck-manager.c
index bf4926f..bcb9350 100644
--- a/src/ck-manager.c
+++ b/src/ck-manager.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
- * Copyright (C) 2006-2007 William Jon McCann <mccann@jhu.edu>
+ * Copyright (C) 2006-2008 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,11 +39,9 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#ifdef HAVE_POLKIT
+#if defined HAVE_POLKIT
#include <polkit/polkit.h>
-#endif
-
-#ifdef ENABLE_RBAC_SHUTDOWN
+#elif defined ENABLE_RBAC_SHUTDOWN
#include <auth_attr.h>
#include <secdb.h>
#endif
@@ -1123,8 +1121,9 @@ _check_polkit_for_action (CkManager *manager,
if (pk_result != POLKIT_RESULT_YES) {
error = g_error_new (CK_MANAGER_ERROR,
CK_MANAGER_ERROR_NOT_PRIVILEGED,
- "Not privileged for action: %s",
- action);
+ "Not privileged for action: %s %s",
+ action,
+ polkit_result_to_string_representation (pk_result));
dbus_error_free (&dbus_error);
dbus_g_method_return_error (context, error);
g_error_free (error);
@@ -1339,17 +1338,18 @@ ck_manager_restart (CkManager *manager,
g_debug ("ConsoleKit Restart: %s", action);
-#ifdef HAVE_POLKIT
+#if defined HAVE_POLKIT
res = _check_polkit_for_action (manager, context, action);
if (! res) {
goto out;
}
-#endif
-
-#ifdef ENABLE_RBAC_SHUTDOWN
+#elif defined ENABLE_RBAC_SHUTDOWN
if (! check_rbac_permissions (manager, context)) {
goto out;
}
+#else
+ g_warning ("Compiled without PolicyKit or RBAC support!");
+ goto out;
#endif
g_debug ("ConsoleKit preforming Restart: %s", action);
@@ -1357,7 +1357,7 @@ ck_manager_restart (CkManager *manager,
log_system_restart_event (manager);
error = NULL;
- res = g_spawn_command_line_async (LIBDIR "/ConsoleKit/scripts/ck-system-restart",
+ res = g_spawn_command_line_async (PREFIX "/lib/ConsoleKit/scripts/ck-system-restart",
&error);
if (! res) {
GError *new_error;
@@ -1398,16 +1398,18 @@ ck_manager_stop (CkManager *manager,
action = "org.freedesktop.consolekit.system.stop";
}
-#ifdef HAVE_POLKIT
+#if defined HAVE_POLKIT
res = _check_polkit_for_action (manager, context, action);
if (! res) {
goto out;
}
-#endif
-
-#ifdef ENABLE_RBAC_SHUTDOWN
- if (!check_rbac_permissions (manager, context))
+#elif defined ENABLE_RBAC_SHUTDOWN
+ if (!check_rbac_permissions (manager, context)) {
goto out;
+ }
+#else
+ g_warning ("Compiled without PolicyKit or RBAC support!");
+ goto out;
#endif
g_debug ("Stopping system");
@@ -1415,7 +1417,7 @@ ck_manager_stop (CkManager *manager,
log_system_stop_event (manager);
error = NULL;
- res = g_spawn_command_line_async (LIBDIR "/ConsoleKit/scripts/ck-system-stop",
+ res = g_spawn_command_line_async (PREFIX "/lib/ConsoleKit/scripts/ck-system-stop",
&error);
if (! res) {
GError *new_error;
@@ -1922,22 +1924,16 @@ create_session_for_sender (CkManager *manager,
ck_session_leader_set_service_name (leader, sender);
ck_session_leader_set_session_id (leader, ssid);
ck_session_leader_set_cookie (leader, cookie);
+ ck_session_leader_set_override_parameters (leader, parameters);
/* need to store the leader info first so the pending request can be revoked */
g_hash_table_insert (manager->priv->leaders,
g_strdup (cookie),
g_object_ref (leader));
- if (parameters == NULL) {
- generate_session_for_leader (manager,
- leader,
- context);
- } else {
- verify_and_open_session_for_leader (manager,
- leader,
- parameters,
- context);
- }
+ generate_session_for_leader (manager,
+ leader,
+ context);
g_free (cookie);
g_free (ssid);
@@ -1986,6 +1982,7 @@ ck_manager_get_session_for_cookie (CkManager *manager,
_("Unable to get information about the calling process"));
dbus_g_method_return_error (context, error);
g_error_free (error);
+ g_debug ("CkManager: Unable to lookup caller info - failing");
return FALSE;
}
@@ -2004,10 +2001,14 @@ ck_manager_get_session_for_cookie (CkManager *manager,
dbus_g_method_return_error (context, error);
g_error_free (error);
+
+ g_debug ("CkManager: Unable to lookup info for caller - failing");
+
return FALSE;
}
/* FIXME: should we restrict this by uid? */
+
ck_process_stat_free (stat);
leader = g_hash_table_lookup (manager->priv->leaders, cookie);
@@ -2018,6 +2019,7 @@ ck_manager_get_session_for_cookie (CkManager *manager,
_("Unable to find session for cookie"));
dbus_g_method_return_error (context, error);
g_error_free (error);
+ g_debug ("CkManager: Unable to lookup cookie for caller - failing");
return FALSE;
}
@@ -2029,11 +2031,14 @@ ck_manager_get_session_for_cookie (CkManager *manager,
_("Unable to find session for cookie"));
dbus_g_method_return_error (context, error);
g_error_free (error);
+ g_debug ("CkManager: Unable to lookup session for cookie - failing");
return FALSE;
}
ck_session_get_id (session, &ssid, NULL);
+ g_debug ("CkManager: Found session '%s'", ssid);
+
dbus_g_method_return (context, ssid);
g_free (ssid);
@@ -2522,9 +2527,9 @@ ck_manager_class_init (CkManagerClass *klass)
G_STRUCT_OFFSET (CkManagerClass, seat_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
- 1, G_TYPE_STRING);
+ 1, DBUS_TYPE_G_OBJECT_PATH);
signals [SEAT_REMOVED] =
g_signal_new ("seat-removed",
G_TYPE_FROM_CLASS (object_class),
@@ -2532,9 +2537,9 @@ ck_manager_class_init (CkManagerClass *klass)
G_STRUCT_OFFSET (CkManagerClass, seat_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
- 1, G_TYPE_STRING);
+ 1, DBUS_TYPE_G_OBJECT_PATH);
signals [SYSTEM_IDLE_HINT_CHANGED] =
g_signal_new ("system-idle-hint-changed",
G_TYPE_FROM_CLASS (object_class),
diff --git a/src/ck-manager.xml b/src/ck-manager.xml
deleted file mode 100644
index 0ca74fa..0000000
--- a/src/ck-manager.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node name="/org/freedesktop/ConsoleKit/Manager">
- <interface name="org.freedesktop.ConsoleKit.Manager">
- <method name="Restart">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- </method>
- <method name="Stop">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- </method>
- <method name="OpenSession">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="cookie" direction="out" type="s"/>
- </method>
- <method name="OpenSessionWithParameters">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="parameters" direction="in" type="a(sv)"/>
- <arg name="cookie" direction="out" type="s"/>
- </method>
- <method name="CloseSession">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="cookie" direction="in" type="s"/>
- <arg name="result" direction="out" type="b"/>
- </method>
- <method name="GetSeats">
- <arg name="seats" direction="out" type="ao"/>
- </method>
- <method name="GetSessions">
- <arg name="sessions" direction="out" type="ao"/>
- </method>
- <method name="GetSessionForCookie">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="cookie" direction="in" type="s"/>
- <arg name="ssid" direction="out" type="o"/>
- </method>
- <method name="GetSessionForUnixProcess">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="pid" direction="in" type="u"/>
- <arg name="ssid" direction="out" type="o"/>
- </method>
- <method name="GetCurrentSession">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="ssid" direction="out" type="o"/>
- </method>
- <method name="GetSessionsForUnixUser">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="uid" direction="in" type="u"/>
- <arg name="sessions" direction="out" type="ao"/>
- </method>
- <method name="GetSessionsForUser">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="uid" direction="in" type="u"/>
- <arg name="sessions" direction="out" type="ao"/>
- </method>
- <method name="GetSystemIdleHint">
- <arg name="idle_hint" type="b" direction="out"/>
- </method>
- <method name="GetSystemIdleSinceHint">
- <arg name="iso8601_datetime" type="s" direction="out"/>
- </method>
- <signal name="SeatAdded">
- <arg name="sid" type="o"/>
- </signal>
- <signal name="SeatRemoved">
- <arg name="sid" type="o"/>
- </signal>
- <signal name="SystemIdleHintChanged">
- <arg name="hint" type="b"/>
- </signal>
- </interface>
-</node>
diff --git a/src/ck-seat-glue.h b/src/ck-seat-glue.h
index 264ba13..56c30fb 100644
--- a/src/ck-seat-glue.h
+++ b/src/ck-seat-glue.h
@@ -53,7 +53,7 @@ G_BEGIN_DECLS
#endif /* !G_ENABLE_DEBUG */
-/* BOOLEAN:POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.G1XI6T:1) */
+/* BOOLEAN:POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.R9SUEU:1) */
extern void dbus_glib_marshal_ck_seat_BOOLEAN__POINTER_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
@@ -100,7 +100,7 @@ dbus_glib_marshal_ck_seat_BOOLEAN__POINTER_POINTER (GClosure *closure,
g_value_set_boolean (return_value, v_return);
}
-/* NONE:BOXED,POINTER (/tmp/dbus-binding-tool-c-marshallers.G1XI6T:2) */
+/* NONE:BOXED,POINTER (/tmp/dbus-binding-tool-c-marshallers.R9SUEU:2) */
extern void dbus_glib_marshal_ck_seat_VOID__BOXED_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
diff --git a/src/ck-seat.c b/src/ck-seat.c
index 009452e..c2f70da 100644
--- a/src/ck-seat.c
+++ b/src/ck-seat.c
@@ -926,18 +926,18 @@ ck_seat_class_init (CkSeatClass *klass)
G_STRUCT_OFFSET (CkSeatClass, session_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
- 1, G_TYPE_STRING);
+ 1, DBUS_TYPE_G_OBJECT_PATH);
signals [SESSION_REMOVED] = g_signal_new ("session-removed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (CkSeatClass, session_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
- 1, G_TYPE_STRING);
+ 1, DBUS_TYPE_G_OBJECT_PATH);
signals [DEVICE_ADDED] = g_signal_new ("device-added",
G_TYPE_FROM_CLASS (object_class),
diff --git a/src/ck-seat.xml b/src/ck-seat.xml
deleted file mode 100644
index b66fcaa..0000000
--- a/src/ck-seat.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="org.freedesktop.ConsoleKit.Seat">
- <method name="GetId">
- <arg name="sid" direction="out" type="o"/>
- </method>
- <method name="GetSessions">
- <arg name="sessions" direction="out" type="ao"/>
- </method>
- <method name="GetDevices">
- <arg name="devices" direction="out" type="a(ss)"/>
- </method>
- <method name="GetActiveSession">
- <arg name="ssid" direction="out" type="o"/>
- </method>
- <method name="CanActivateSessions">
- <arg name="can_activate" direction="out" type="b"/>
- </method>
- <method name="ActivateSession">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="ssid" direction="in" type="o"/>
- </method>
- <signal name="ActiveSessionChanged">
- <arg name="ssid" type="o"/>
- </signal>
- <signal name="SessionAdded">
- <arg name="ssid" type="o"/>
- </signal>
- <signal name="SessionRemoved">
- <arg name="ssid" type="o"/>
- </signal>
- <signal name="DeviceAdded">
- <arg name="device" type="(ss)"/>
- </signal>
- <signal name="DeviceRemoved">
- <arg name="device" type="(ss)"/>
- </signal>
- </interface>
-</node>
diff --git a/src/ck-session-glue.h b/src/ck-session-glue.h
index c06173f..146c5ca 100644
--- a/src/ck-session-glue.h
+++ b/src/ck-session-glue.h
@@ -53,7 +53,7 @@ G_BEGIN_DECLS
#endif /* !G_ENABLE_DEBUG */
-/* BOOLEAN:POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.P39I6T:1) */
+/* BOOLEAN:POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.7ID1EU:1) */
extern void dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
@@ -100,7 +100,7 @@ dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER (GClosure *closure,
g_value_set_boolean (return_value, v_return);
}
-/* NONE:BOOLEAN,POINTER (/tmp/dbus-binding-tool-c-marshallers.P39I6T:2) */
+/* NONE:BOOLEAN,POINTER (/tmp/dbus-binding-tool-c-marshallers.7ID1EU:2) */
extern void dbus_glib_marshal_ck_session_VOID__BOOLEAN_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
@@ -144,7 +144,7 @@ dbus_glib_marshal_ck_session_VOID__BOOLEAN_POINTER (GClosure *closure,
}
#define dbus_glib_marshal_ck_session_NONE__BOOLEAN_POINTER dbus_glib_marshal_ck_session_VOID__BOOLEAN_POINTER
-/* NONE:POINTER (/tmp/dbus-binding-tool-c-marshallers.P39I6T:3) */
+/* NONE:POINTER (/tmp/dbus-binding-tool-c-marshallers.7ID1EU:3) */
#define dbus_glib_marshal_ck_session_VOID__POINTER g_cclosure_marshal_VOID__POINTER
#define dbus_glib_marshal_ck_session_NONE__POINTER dbus_glib_marshal_ck_session_VOID__POINTER
@@ -163,22 +163,23 @@ static const DBusGMethodInfo dbus_glib_ck_session_methods[] = {
{ (GCallback) ck_session_get_x11_display_device, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 371 },
{ (GCallback) ck_session_get_display_device, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 456 },
{ (GCallback) ck_session_get_remote_host_name, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 534 },
- { (GCallback) ck_session_is_active, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 615 },
- { (GCallback) ck_session_is_local, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 677 },
- { (GCallback) ck_session_get_creation_time, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 737 },
- { (GCallback) ck_session_activate, dbus_glib_marshal_ck_session_NONE__POINTER, 816 },
- { (GCallback) ck_session_lock, dbus_glib_marshal_ck_session_NONE__POINTER, 863 },
- { (GCallback) ck_session_unlock, dbus_glib_marshal_ck_session_NONE__POINTER, 906 },
- { (GCallback) ck_session_get_idle_hint, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 951 },
- { (GCallback) ck_session_get_idle_since_hint, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 1019 },
- { (GCallback) ck_session_set_idle_hint, dbus_glib_marshal_ck_session_NONE__BOOLEAN_POINTER, 1099 },
+ { (GCallback) ck_session_get_login_session_id, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 615 },
+ { (GCallback) ck_session_is_active, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 696 },
+ { (GCallback) ck_session_is_local, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 758 },
+ { (GCallback) ck_session_get_creation_time, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 818 },
+ { (GCallback) ck_session_activate, dbus_glib_marshal_ck_session_NONE__POINTER, 897 },
+ { (GCallback) ck_session_lock, dbus_glib_marshal_ck_session_NONE__POINTER, 944 },
+ { (GCallback) ck_session_unlock, dbus_glib_marshal_ck_session_NONE__POINTER, 987 },
+ { (GCallback) ck_session_get_idle_hint, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 1032 },
+ { (GCallback) ck_session_get_idle_since_hint, dbus_glib_marshal_ck_session_BOOLEAN__POINTER_POINTER, 1100 },
+ { (GCallback) ck_session_set_idle_hint, dbus_glib_marshal_ck_session_NONE__BOOLEAN_POINTER, 1180 },
};
const DBusGObjectInfo dbus_glib_ck_session_object_info = {
0,
dbus_glib_ck_session_methods,
- 18,
-"org.freedesktop.ConsoleKit.Session\0GetId\0S\0ssid\0O\0F\0N\0o\0\0org.freedesktop.ConsoleKit.Session\0GetSeatId\0S\0sid\0O\0F\0N\0o\0\0org.freedesktop.ConsoleKit.Session\0GetSessionType\0S\0type\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetUser\0S\0uid\0O\0F\0N\0i\0\0org.freedesktop.ConsoleKit.Session\0GetUnixUser\0S\0uid\0O\0F\0N\0i\0\0org.freedesktop.ConsoleKit.Session\0GetX11Display\0S\0display\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetX11DisplayDevice\0S\0x11_display_device\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetDisplayDevice\0S\0display_device\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetRemoteHostName\0S\0remote_host_name\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0IsActive\0S\0active\0O\0F\0N\0b\0\0org.freedesktop.ConsoleKit.Session\0IsLocal\0S\0local\0O\0F\0N\0b\0\0org.freedesktop.ConsoleKit.Session\0GetCreationTime\0S\0iso8601_datetime\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0Activate\0A\0\0org.freedesktop.ConsoleKit.Session\0Lock\0A\0\0org.freedesktop.ConsoleKit.Session\0Unlock\0A\0\0org.freedesktop.ConsoleKit.Session\0GetIdleHint\0S\0idle_hint\0O\0F\0N\0b\0\0org.freedesktop.ConsoleKit.Session\0GetIdleSinceHint\0S\0iso8601_datetime\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0SetIdleHint\0A\0idle_hint\0I\0b\0\0\0",
+ 19,
+"org.freedesktop.ConsoleKit.Session\0GetId\0S\0ssid\0O\0F\0N\0o\0\0org.freedesktop.ConsoleKit.Session\0GetSeatId\0S\0sid\0O\0F\0N\0o\0\0org.freedesktop.ConsoleKit.Session\0GetSessionType\0S\0type\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetUser\0S\0uid\0O\0F\0N\0u\0\0org.freedesktop.ConsoleKit.Session\0GetUnixUser\0S\0uid\0O\0F\0N\0u\0\0org.freedesktop.ConsoleKit.Session\0GetX11Display\0S\0display\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetX11DisplayDevice\0S\0x11_display_device\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetDisplayDevice\0S\0display_device\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetRemoteHostName\0S\0remote_host_name\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0GetLoginSessionId\0S\0login_session_id\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0IsActive\0S\0active\0O\0F\0N\0b\0\0org.freedesktop.ConsoleKit.Session\0IsLocal\0S\0local\0O\0F\0N\0b\0\0org.freedesktop.ConsoleKit.Session\0GetCreationTime\0S\0iso8601_datetime\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0Activate\0A\0\0org.freedesktop.ConsoleKit.Session\0Lock\0A\0\0org.freedesktop.ConsoleKit.Session\0Unlock\0A\0\0org.freedesktop.ConsoleKit.Session\0GetIdleHint\0S\0idle_hint\0O\0F\0N\0b\0\0org.freedesktop.ConsoleKit.Session\0GetIdleSinceHint\0S\0iso8601_datetime\0O\0F\0N\0s\0\0org.freedesktop.ConsoleKit.Session\0SetIdleHint\0A\0idle_hint\0I\0b\0\0\0",
"org.freedesktop.ConsoleKit.Session\0ActiveChanged\0org.freedesktop.ConsoleKit.Session\0IdleHintChanged\0org.freedesktop.ConsoleKit.Session\0Lock\0org.freedesktop.ConsoleKit.Session\0Unlock\0\0",
"org.freedesktop.ConsoleKit.Session\0unix-user\0org.freedesktop.ConsoleKit.Session\0user\0org.freedesktop.ConsoleKit.Session\0session-type\0org.freedesktop.ConsoleKit.Session\0remote-host-name\0org.freedesktop.ConsoleKit.Session\0display-device\0org.freedesktop.ConsoleKit.Session\0x11-display\0org.freedesktop.ConsoleKit.Session\0x11-display-device\0org.freedesktop.ConsoleKit.Session\0active\0org.freedesktop.ConsoleKit.Session\0is-local\0org.freedesktop.ConsoleKit.Session\0idle-hint\0\0"
};
diff --git a/src/ck-session-leader.c b/src/ck-session-leader.c
index 756feac..322b7fd 100644
--- a/src/ck-session-leader.c
+++ b/src/ck-session-leader.c
@@ -58,6 +58,7 @@ struct CkSessionLeaderPrivate
char *cookie;
GList *pending_jobs;
gboolean cancelled;
+ GHashTable *override_parameters;
};
enum {
@@ -190,6 +191,39 @@ add_param_string (GPtrArray *parameters,
g_ptr_array_add (parameters, g_value_get_boxed (&param_val));
}
+static gboolean
+have_override_parameter (CkSessionLeader *leader,
+ const char *prop_name)
+{
+ gpointer data;
+
+ if (leader->priv->override_parameters == NULL) {
+ return FALSE;
+ }
+
+ if (prop_name == NULL) {
+ return FALSE;
+ }
+
+ data = g_hash_table_lookup (leader->priv->override_parameters, prop_name);
+ if (data == NULL) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+add_to_parameters (gpointer key,
+ gpointer data,
+ GPtrArray *parameters)
+{
+ gpointer data_copy;
+
+ data_copy = g_boxed_copy (CK_TYPE_PARAMETER_STRUCT, data);
+ g_ptr_array_add (parameters, data_copy);
+}
+
typedef void (* CkAddParamFunc) (GPtrArray *arr,
const char *key,
const char *value);
@@ -198,6 +232,7 @@ static struct {
char *key;
CkAddParamFunc func;
} parse_ops[] = {
+ { "login-session-id", add_param_string },
{ "display-device", add_param_string },
{ "x11-display-device", add_param_string },
{ "x11-display", add_param_string },
@@ -208,7 +243,8 @@ static struct {
};
static GPtrArray *
-parse_output (const char *output)
+parse_output (CkSessionLeader *leader,
+ const char *output)
{
GPtrArray *parameters;
char **lines;
@@ -222,6 +258,7 @@ parse_output (const char *output)
parameters = g_ptr_array_sized_new (10);
+ /* first add generated params */
for (i = 0; lines[i] != NULL; i++) {
char **vals;
@@ -231,6 +268,12 @@ parse_output (const char *output)
continue;
}
+ /* we're going to override this anyway so just shortcut out */
+ if (have_override_parameter (leader, vals[0])) {
+ g_strfreev (vals);
+ continue;
+ }
+
for (j = 0; j < G_N_ELEMENTS (parse_ops); j++) {
if (strcmp (vals[0], parse_ops[j].key) == 0) {
parse_ops[j].func (parameters, vals[0], vals[1]);
@@ -239,13 +282,16 @@ parse_output (const char *output)
}
g_strfreev (vals);
}
-
g_strfreev (lines);
+ /* now overlay the overrides */
+ g_hash_table_foreach (leader->priv->override_parameters,
+ (GHFunc)add_to_parameters,
+ parameters);
+
return parameters;
}
-
static void
parameters_free (GPtrArray *parameters)
{
@@ -262,6 +308,61 @@ parameters_free (GPtrArray *parameters)
g_ptr_array_free (parameters, TRUE);
}
+static void
+save_parameters (CkSessionLeader *leader,
+ const GPtrArray *parameters)
+{
+ int i;
+
+ for (i = 0; i < parameters->len; i++) {
+ gpointer data;
+ data = g_ptr_array_index (parameters, i);
+
+ /* filter out the nulls? - sure why not */
+
+ if (data != NULL) {
+ gpointer data_copy;
+ GValue val_struct = { 0, };
+ char *prop_name;
+ gboolean res;
+
+ g_value_init (&val_struct, CK_TYPE_PARAMETER_STRUCT);
+ g_value_set_static_boxed (&val_struct, g_ptr_array_index (parameters, i));
+
+ res = dbus_g_type_struct_get (&val_struct,
+ 0, &prop_name,
+ G_MAXUINT);
+ if (! res) {
+ g_debug ("Unable to extract parameter input");
+ g_free (prop_name);
+ continue;
+ }
+
+ if (prop_name == NULL) {
+ g_debug ("Skipping NULL parameter");
+ g_free (prop_name);
+ continue;
+ }
+
+ if (strcmp (prop_name, "id") == 0
+ || strcmp (prop_name, "cookie") == 0) {
+ g_debug ("Skipping restricted parameter: %s", prop_name);
+ g_free (prop_name);
+ continue;
+ }
+
+ g_debug ("Setting override parameters for: %s", prop_name);
+
+ data_copy = g_boxed_copy (CK_TYPE_PARAMETER_STRUCT, data);
+
+ /* takes ownership */
+ g_hash_table_insert (leader->priv->override_parameters,
+ prop_name,
+ data_copy);
+ }
+ }
+}
+
typedef struct {
CkSessionLeader *leader;
CkSessionLeaderDoneFunc done_cb;
@@ -283,7 +384,7 @@ job_completed (CkJob *job,
ck_job_get_stdout (job, &output);
g_debug ("Job output: %s", output);
- parameters = parse_output (output);
+ parameters = parse_output (data->leader, output);
g_free (output);
data->done_cb (data->leader,
@@ -447,6 +548,21 @@ ck_session_leader_set_service_name (CkSessionLeader *session_leader,
session_leader->priv->service_name = g_strdup (service_name);
}
+void
+ck_session_leader_set_override_parameters (CkSessionLeader *session_leader,
+ const GPtrArray *parameters)
+{
+ g_return_if_fail (CK_IS_SESSION_LEADER (session_leader));
+
+ if (session_leader->priv->override_parameters != NULL) {
+ g_hash_table_remove_all (session_leader->priv->override_parameters);
+ }
+
+ if (parameters != NULL) {
+ save_parameters (session_leader, parameters);
+ }
+}
+
static void
ck_session_leader_set_property (GObject *object,
guint prop_id,
@@ -512,9 +628,20 @@ ck_session_leader_class_init (CkSessionLeaderClass *klass)
}
static void
+parameter_free (gpointer data)
+{
+ g_boxed_free (CK_TYPE_PARAMETER_STRUCT, data);
+}
+
+static void
ck_session_leader_init (CkSessionLeader *session_leader)
{
session_leader->priv = CK_SESSION_LEADER_GET_PRIVATE (session_leader);
+
+ session_leader->priv->override_parameters = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ (GDestroyNotify)parameter_free);
}
static void
@@ -536,6 +663,8 @@ ck_session_leader_finalize (GObject *object)
g_free (session_leader->priv->service_name);
session_leader->priv->service_name = NULL;
+ g_hash_table_destroy (session_leader->priv->override_parameters);
+
G_OBJECT_CLASS (ck_session_leader_parent_class)->finalize (object);
}
diff --git a/src/ck-session-leader.h b/src/ck-session-leader.h
index 4eb8857..ff17644 100644
--- a/src/ck-session-leader.h
+++ b/src/ck-session-leader.h
@@ -60,36 +60,39 @@ typedef void (* CkSessionLeaderDoneFunc) (CkSessionLeader *session_leader
DBusGMethodInvocation *context,
gpointer data);
-GQuark ck_session_leader_error_quark (void);
-GType ck_session_leader_get_type (void);
-CkSessionLeader * ck_session_leader_new (void);
-
-void ck_session_leader_set_pid (CkSessionLeader *session_leader,
- pid_t pid);
-void ck_session_leader_set_uid (CkSessionLeader *session_leader,
- uid_t uid);
-void ck_session_leader_set_session_id (CkSessionLeader *session_leader,
- const char *session_id);
-void ck_session_leader_set_cookie (CkSessionLeader *session_leader,
- const char *cookie);
-void ck_session_leader_set_service_name (CkSessionLeader *session_leader,
- const char *sender);
-
-const char * ck_session_leader_peek_session_id (CkSessionLeader *session_leader);
-const char * ck_session_leader_peek_cookie (CkSessionLeader *session_leader);
-const char * ck_session_leader_peek_service_name (CkSessionLeader *session_leader);
-uid_t ck_session_leader_get_uid (CkSessionLeader *session_leader);
-pid_t ck_session_leader_get_pid (CkSessionLeader *session_leader);
-
-
-gboolean ck_session_leader_collect_parameters (CkSessionLeader *session_leader,
- DBusGMethodInvocation *context,
- CkSessionLeaderDoneFunc done_cb,
- gpointer data);
-void ck_session_leader_cancel (CkSessionLeader *session_leader);
-
-void ck_session_leader_dump (CkSessionLeader *session_leader,
- GKeyFile *key_file);
+GQuark ck_session_leader_error_quark (void);
+GType ck_session_leader_get_type (void);
+CkSessionLeader * ck_session_leader_new (void);
+
+void ck_session_leader_set_pid (CkSessionLeader *session_leader,
+ pid_t pid);
+void ck_session_leader_set_uid (CkSessionLeader *session_leader,
+ uid_t uid);
+void ck_session_leader_set_session_id (CkSessionLeader *session_leader,
+ const char *session_id);
+void ck_session_leader_set_cookie (CkSessionLeader *session_leader,
+ const char *cookie);
+void ck_session_leader_set_service_name (CkSessionLeader *session_leader,
+ const char *sender);
+
+void ck_session_leader_set_override_parameters (CkSessionLeader *session_leader,
+ const GPtrArray *parameters);
+
+const char * ck_session_leader_peek_session_id (CkSessionLeader *session_leader);
+const char * ck_session_leader_peek_cookie (CkSessionLeader *session_leader);
+const char * ck_session_leader_peek_service_name (CkSessionLeader *session_leader);
+uid_t ck_session_leader_get_uid (CkSessionLeader *session_leader);
+pid_t ck_session_leader_get_pid (CkSessionLeader *session_leader);
+
+
+gboolean ck_session_leader_collect_parameters (CkSessionLeader *session_leader,
+ DBusGMethodInvocation *context,
+ CkSessionLeaderDoneFunc done_cb,
+ gpointer data);
+void ck_session_leader_cancel (CkSessionLeader *session_leader);
+
+void ck_session_leader_dump (CkSessionLeader *session_leader,
+ GKeyFile *key_file);
G_END_DECLS
diff --git a/src/ck-session.c b/src/ck-session.c
index d9e32be..8ba8791 100644
--- a/src/ck-session.c
+++ b/src/ck-session.c
@@ -58,6 +58,7 @@ struct CkSessionPrivate
char *seat_id;
char *session_type;
+ char *login_session_id;
char *display_device;
char *x11_display_device;
char *x11_display;
@@ -98,6 +99,7 @@ enum {
PROP_DISPLAY_DEVICE,
PROP_SESSION_TYPE,
PROP_REMOTE_HOST_NAME,
+ PROP_LOGIN_SESSION_ID,
PROP_IS_LOCAL,
PROP_ACTIVE,
PROP_IDLE_HINT,
@@ -498,6 +500,20 @@ ck_session_get_display_device (CkSession *session,
}
gboolean
+ck_session_get_login_session_id (CkSession *session,
+ char **login_session_id,
+ GError **error)
+{
+ g_return_val_if_fail (CK_IS_SESSION (session), FALSE);
+
+ if (login_session_id != NULL) {
+ *login_session_id = g_strdup (session->priv->login_session_id);
+ }
+
+ return TRUE;
+}
+
+gboolean
ck_session_get_x11_display_device (CkSession *session,
char **x11_display_device,
GError **error)
@@ -672,6 +688,19 @@ ck_session_set_x11_display_device (CkSession *session,
}
gboolean
+ck_session_set_login_session_id (CkSession *session,
+ const char *login_session_id,
+ GError **error)
+{
+ g_return_val_if_fail (CK_IS_SESSION (session), FALSE);
+
+ g_free (session->priv->login_session_id);
+ session->priv->login_session_id = g_strdup (login_session_id);
+
+ return TRUE;
+}
+
+gboolean
ck_session_set_remote_host_name (CkSession *session,
const char *remote_host_name,
GError **error)
@@ -732,6 +761,9 @@ ck_session_set_property (GObject *object,
case PROP_DISPLAY_DEVICE:
ck_session_set_display_device (self, g_value_get_string (value), NULL);
break;
+ case PROP_LOGIN_SESSION_ID:
+ ck_session_set_login_session_id (self, g_value_get_string (value), NULL);
+ break;
case PROP_UNIX_USER:
ck_session_set_unix_user (self, g_value_get_uint (value), NULL);
break;
@@ -785,6 +817,9 @@ ck_session_get_property (GObject *object,
case PROP_DISPLAY_DEVICE:
g_value_set_string (value, self->priv->display_device);
break;
+ case PROP_LOGIN_SESSION_ID:
+ g_value_set_string (value, self->priv->login_session_id);
+ break;
case PROP_UNIX_USER:
g_value_set_uint (value, self->priv->uid);
break;
@@ -975,6 +1010,13 @@ ck_session_class_init (CkSessionClass *klass)
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
+ PROP_LOGIN_SESSION_ID,
+ g_param_spec_string ("login-session-id",
+ "login-session-id",
+ "login session id",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
PROP_X11_DISPLAY,
g_param_spec_string ("x11-display",
"x11-display",
@@ -1242,7 +1284,7 @@ ck_session_run_programs (CkSession *session,
extra_env[n++] = NULL;
ck_run_programs (SYSCONFDIR "/ConsoleKit/run-session.d", action, extra_env);
- ck_run_programs (LIBDIR "/ConsoleKit/run-session.d", action, extra_env);
+ ck_run_programs (PREFIX "/lib/ConsoleKit/run-session.d", action, extra_env);
for (n = 0; extra_env[n] != NULL; n++) {
g_free (extra_env[n]);
@@ -1272,6 +1314,12 @@ ck_session_dump (CkSession *session,
"type",
NONULL_STRING (session->priv->session_type));
}
+ if (session->priv->login_session_id != NULL && strlen (session->priv->login_session_id) > 0) {
+ g_key_file_set_string (key_file,
+ group_name,
+ "login_session_id",
+ NONULL_STRING (session->priv->login_session_id));
+ }
if (session->priv->display_device != NULL && strlen (session->priv->display_device) > 0) {
g_key_file_set_string (key_file,
group_name,
diff --git a/src/ck-session.h b/src/ck-session.h
index 8c5c00e..c9ebd08 100644
--- a/src/ck-session.h
+++ b/src/ck-session.h
@@ -104,6 +104,9 @@ gboolean ck_session_set_x11_display_device (CkSession *se
gboolean ck_session_set_display_device (CkSession *session,
const char *device,
GError **error);
+gboolean ck_session_set_login_session_id (CkSession *session,
+ const char *login_session_id,
+ GError **error);
gboolean ck_session_set_remote_host_name (CkSession *session,
const char *remote_host_name,
GError **error);
@@ -138,6 +141,9 @@ gboolean ck_session_get_x11_display_device (CkSession *se
gboolean ck_session_get_display_device (CkSession *session,
char **display,
GError **error);
+gboolean ck_session_get_login_session_id (CkSession *session,
+ char **login_session_id,
+ GError **error);
gboolean ck_session_get_session_type (CkSession *session,
char **type,
GError **error);
diff --git a/src/ck-session.xml b/src/ck-session.xml
deleted file mode 100644
index 5fc85d0..0000000
--- a/src/ck-session.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="org.freedesktop.ConsoleKit.Session">
- <method name="GetId">
- <arg name="ssid" direction="out" type="o"/>
- </method>
- <method name="GetSeatId">
- <arg name="sid" direction="out" type="o"/>
- </method>
- <method name="GetSessionType">
- <arg name="type" direction="out" type="s"/>
- </method>
- <method name="GetUser">
- <arg name="uid" direction="out" type="i"/>
- </method>
- <method name="GetUnixUser">
- <arg name="uid" direction="out" type="i"/>
- </method>
- <method name="GetX11Display">
- <arg name="display" direction="out" type="s"/>
- </method>
- <method name="GetX11DisplayDevice">
- <arg name="x11_display_device" direction="out" type="s"/>
- </method>
- <method name="GetDisplayDevice">
- <arg name="display_device" direction="out" type="s"/>
- </method>
- <method name="GetRemoteHostName">
- <arg name="remote_host_name" direction="out" type="s"/>
- </method>
- <method name="IsActive">
- <arg name="active" direction="out" type="b"/>
- </method>
- <method name="IsLocal">
- <arg name="local" direction="out" type="b"/>
- </method>
- <method name="GetCreationTime">
- <arg name="iso8601_datetime" type="s" direction="out"/>
- </method>
- <method name="Activate">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- </method>
- <method name="Lock">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- </method>
- <method name="Unlock">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- </method>
- <method name="GetIdleHint">
- <arg name="idle_hint" type="b" direction="out"/>
- </method>
- <method name="GetIdleSinceHint">
- <arg name="iso8601_datetime" type="s" direction="out"/>
- </method>
- <method name="SetIdleHint">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="idle_hint" type="b" direction="in"/>
- </method>
- <signal name="ActiveChanged">
- <arg name="is_active" type="b"/>
- </signal>
- <signal name="IdleHintChanged">
- <arg name="hint" type="b"/>
- </signal>
- <signal name="Lock"/>
- <signal name="Unlock"/>
- <property name="unix-user" type="u" access="readwrite"/>
- <property name="user" type="u" access="readwrite"/>
- <property name="session-type" type="s" access="readwrite"/>
- <property name="remote-host-name" type="s" access="readwrite"/>
- <property name="display-device" type="s" access="readwrite"/>
- <property name="x11-display" type="s" access="readwrite"/>
- <property name="x11-display-device" type="s" access="readwrite"/>
- <property name="active" type="b" access="readwrite"/>
- <property name="is-local" type="b" access="readwrite"/>
- <property name="idle-hint" type="b" access="readwrite"/>
- </interface>
-</node>
diff --git a/src/ck-sysdeps-freebsd.c b/src/ck-sysdeps-freebsd.c
index d7c7c0c..a30c380 100644
--- a/src/ck-sysdeps-freebsd.c
+++ b/src/ck-sysdeps-freebsd.c
@@ -315,6 +315,15 @@ ck_unix_pid_get_uid (pid_t pid)
}
gboolean
+ck_unix_pid_get_login_session_id (pid_t pid,
+ char **idp)
+{
+ g_return_val_if_fail (pid > 1, FALSE);
+
+ return FALSE;
+}
+
+gboolean
ck_get_max_num_consoles (guint *num)
{
int max_consoles;
diff --git a/src/ck-sysdeps-linux.c b/src/ck-sysdeps-linux.c
index 7dc99f7..09db310 100644
--- a/src/ck-sysdeps-linux.c
+++ b/src/ck-sysdeps-linux.c
@@ -618,6 +618,72 @@ ck_unix_pid_get_ppid (pid_t pid)
}
gboolean
+ck_unix_pid_get_login_session_id (pid_t pid,
+ char **idp)
+{
+ gboolean ret;
+ gboolean res;
+ char *path;
+ char *contents;
+ gsize length;
+ GError *error;
+ char *end_of_valid_ulong;
+ gulong ulong_value;
+
+ g_return_val_if_fail (pid > 1, FALSE);
+
+ ret = FALSE;
+ contents = NULL;
+
+ path = g_strdup_printf ("/proc/%u/sessionid", (guint)pid);
+
+ error = NULL;
+ res = g_file_get_contents (path,
+ &contents,
+ &length,
+ &error);
+ if (! res) {
+ g_warning ("Couldn't read %s: %s", path, error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ if (contents[0] == '\0') {
+ g_warning ("Couldn't read %s: empty file", path);
+ goto out;
+ }
+
+ errno = 0;
+ ulong_value = strtoul (contents, &end_of_valid_ulong, 10);
+
+ if (*end_of_valid_ulong != '\0') {
+ goto out;
+ }
+
+ if (errno == ERANGE) {
+ g_warning ("Couldn't read %s: %s", path, g_strerror (errno));
+ goto out;
+ }
+
+ /* Will be G_MAXULONG if it isn't set */
+ if (ulong_value == G_MAXULONG) {
+ goto out;
+ }
+
+ if (idp != NULL) {
+ *idp = g_strdup_printf ("%lu", (unsigned long int)ulong_value);
+ }
+
+ ret = TRUE;
+
+ out:
+ g_free (contents);
+ g_free (path);
+
+ return ret;
+}
+
+gboolean
ck_get_max_num_consoles (guint *num)
{
if (num != NULL) {
diff --git a/src/ck-sysdeps-solaris.c b/src/ck-sysdeps-solaris.c
index 87bf4fd..cd17bf7 100644
--- a/src/ck-sysdeps-solaris.c
+++ b/src/ck-sysdeps-solaris.c
@@ -356,6 +356,15 @@ ck_unix_pid_get_ppid (pid_t pid)
}
gboolean
+ck_unix_pid_get_login_session_id (pid_t pid,
+ char **idp)
+{
+ g_return_val_if_fail (pid > 1, FALSE);
+
+ return FALSE;
+}
+
+gboolean
ck_get_max_num_consoles (guint *num)
{
GError *error;
diff --git a/src/ck-sysdeps.h b/src/ck-sysdeps.h
index f0fceb7..c3f3756 100644
--- a/src/ck-sysdeps.h
+++ b/src/ck-sysdeps.h
@@ -45,6 +45,8 @@ GHashTable *ck_unix_pid_get_env_hash (pid_t pid);
pid_t ck_unix_pid_get_ppid (pid_t pid);
uid_t ck_unix_pid_get_uid (pid_t pid);
+gboolean ck_unix_pid_get_login_session_id (pid_t pid,
+ char **id);
gboolean ck_get_socket_peer_credentials (int socket_fd,
diff --git a/src/ck-vt-monitor.c b/src/ck-vt-monitor.c
index d21026b..17b8299 100644
--- a/src/ck-vt-monitor.c
+++ b/src/ck-vt-monitor.c
@@ -313,7 +313,6 @@ vt_thread_start (ThreadData *data)
{
CkVtMonitor *vt_monitor;
gboolean res;
- int ret;
gint32 num;
vt_monitor = data->vt_monitor;
diff --git a/src/main.c b/src/main.c
index adc0d71..809c6d6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -44,9 +44,6 @@
#define CK_DBUS_NAME "org.freedesktop.ConsoleKit"
-static void bus_proxy_destroyed_cb (DBusGProxy *bus_proxy,
- CkManager *manager);
-
static gboolean
timed_exit_cb (GMainLoop *loop)
{
@@ -138,60 +135,12 @@ get_system_bus (void)
return bus;
}
-static gboolean
-bus_reconnect (CkManager *manager)
-{
- DBusGConnection *bus;
- DBusGProxy *bus_proxy;
- gboolean ret;
-
- ret = TRUE;
-
- bus = get_system_bus ();
- if (bus == NULL) {
- goto out;
- }
-
- bus_proxy = get_bus_proxy (bus);
- if (bus_proxy == NULL) {
- g_warning ("Could not construct bus_proxy object; will retry");
- goto out;
- }
-
- if (! acquire_name_on_proxy (bus_proxy) ) {
- g_warning ("Could not acquire name; will retry");
- goto out;
- }
-
- manager = ck_manager_new ();
- if (manager == NULL) {
- g_warning ("Could not construct manager object");
- exit (1);
- }
-
- g_signal_connect (bus_proxy,
- "destroy",
- G_CALLBACK (bus_proxy_destroyed_cb),
- manager);
-
- g_debug ("Successfully reconnected to D-Bus");
-
- ret = FALSE;
-
- out:
- return ret;
-}
-
static void
bus_proxy_destroyed_cb (DBusGProxy *bus_proxy,
- CkManager *manager)
+ GMainLoop *loop)
{
g_debug ("Disconnected from D-Bus");
-
- g_object_unref (manager);
- manager = NULL;
-
- g_timeout_add (3000, (GSourceFunc)bus_reconnect, manager);
+ g_main_loop_quit (loop);
}
static void
@@ -371,12 +320,12 @@ main (int argc,
goto out;
}
+ loop = g_main_loop_new (NULL, FALSE);
+
g_signal_connect (bus_proxy,
"destroy",
G_CALLBACK (bus_proxy_destroyed_cb),
- manager);
-
- loop = g_main_loop_new (NULL, FALSE);
+ loop);
if (do_timed_exit) {
g_timeout_add (1000 * 30, (GSourceFunc) timed_exit_cb, loop);
@@ -384,7 +333,9 @@ main (int argc,
g_main_loop_run (loop);
- g_object_unref (manager);
+ if (manager != NULL) {
+ g_object_unref (manager);
+ }
g_main_loop_unref (loop);
diff --git a/src/org.freedesktop.ConsoleKit.Manager.xml b/src/org.freedesktop.ConsoleKit.Manager.xml
new file mode 100644
index 0000000..f405c25
--- /dev/null
+++ b/src/org.freedesktop.ConsoleKit.Manager.xml
@@ -0,0 +1,343 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/org/freedesktop/ConsoleKit/Manager"
+ xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"
+>
+
+ <interface name="org.freedesktop.ConsoleKit.Manager">
+ <method name="Restart">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This method initiates a request to restart (ie. reboot) the computer system.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="Stop">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This method initiates a request to stop (ie. shutdown) the computer system.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="OpenSession">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="cookie" direction="out" type="s">
+ <doc:doc>
+ <doc:summary>The secret cookie that is used to identify the new session</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This method requests that a new <doc:ref type="interface" to="Session">Session</doc:ref>
+ be created for the calling process. The properties of this new Session are set automatically
+ from information collected about the calling process.
+ </doc:para>
+ <doc:para>This new session exists until the calling process disconnects from the system bus or
+ calls <doc:ref type="method" to="Manager.CloseSession">CloseSession()</doc:ref>.
+ </doc:para>
+ <doc:para>It is the responsibility of the calling process to set the environment variable
+ XDG_SESSION_COOKIE to the value of the returned cookie. This cookie should only
+ be made available to child processes of the caller so that they may be identified
+ as members of this session.
+ </doc:para>
+ <doc:para>See this simple example:
+ <doc:example language="c" title="simple example"><doc:code>
+ DBusError error;
+ DBusMessage *message;
+ DBusMessage *reply;
+
+ message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit",
+ "/org/freedesktop/ConsoleKit/Manager",
+ "org.freedesktop.ConsoleKit.Manager",
+ "OpenSession");
+ if (message == NULL) {
+ goto out;
+ }
+
+ dbus_error_init (&amp;error);
+ reply = dbus_connection_send_with_reply_and_block (connector->connection,
+ message,
+ -1,
+ &amp;error);
+ if (reply == NULL) {
+ goto out;
+ }
+
+ dbus_error_init (&amp;error);
+ if (! dbus_message_get_args (reply,
+ &amp;error,
+ DBUS_TYPE_STRING, &amp;cookie,
+ DBUS_TYPE_INVALID)) {
+ goto out;
+ }
+
+ </doc:code></doc:example></doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="method" to="Manager.OpenSessionWithParameters">OpenSessionWithParameters()</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="OpenSessionWithParameters">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="parameters" direction="in" type="a(sv)">
+ <doc:doc>
+ <doc:summary>An array of sets of property names and values</doc:summary>
+ </doc:doc>
+ </arg>
+ <arg name="cookie" direction="out" type="s">
+ <doc:doc>
+ <doc:summary>The secret cookie that is used to identify the new session</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This method requests that a new <doc:ref type="interface" to="Session">Session</doc:ref>
+ be created for the calling process. The properties of this new Session are from the
+ parameters provided.
+ </doc:para>
+ <doc:para>This new session exists until the calling process disconnects from the system bus or
+ calls <doc:ref type="method" to="Manager.CloseSession">CloseSession()</doc:ref>.
+ </doc:para>
+ <doc:para>It is the responsibility of the calling process to set the environment variable
+ XDG_SESSION_COOKIE to the value of the returned cookie. This cookie should only
+ be made available to child processes of the caller so that they may be identified
+ as members of this session.
+ </doc:para>
+ <doc:para>See the <doc:ref type="interface" to="Session">Session</doc:ref> properties for a list of valid parameters.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="interface" to="Session">org.freedesktop.ConsoleKit.Session</doc:ref></doc:seealso>
+ <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission>
+ </doc:doc>
+ </method>
+ <method name="CloseSession">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="cookie" direction="in" type="s">
+ <doc:doc>
+ <doc:summary>The secret cookie that is used to identify the session</doc:summary>
+ </doc:doc>
+ </arg>
+ <arg name="result" direction="out" type="b">
+ <doc:doc>
+ <doc:summary>Whether the session was successfully closed</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This method is used to close the session identified by the supplied cookie.
+ </doc:para>
+ <doc:para>The session can only be closed by the same process that opened the session.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="GetSeats">
+ <arg name="seats" direction="out" type="ao">
+ <doc:doc>
+ <doc:summary>an array of Seat IDs</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This gets a list of all the <doc:ref type="interface" to="Seat">Seats</doc:ref>
+ that are currently present on the system.</doc:para>
+ <doc:para>Each Seat ID is an D-Bus object path for the object that implements the
+ <doc:ref type="interface" to="Seat">Seat</doc:ref> interface.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="interface" to="Seat">org.freedesktop.ConsoleKit.Seat</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+
+ <method name="GetSessions">
+ <arg name="sessions" direction="out" type="ao">
+ <doc:doc>
+ <doc:summary>an array of Session IDs</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This gets a list of all the <doc:ref type="interface" to="Sessions">Sessions</doc:ref>
+ that are currently present on the system.</doc:para>
+ <doc:para>Each Session ID is an D-Bus object path for the object that implements the
+ <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="interface" to="Session">org.freedesktop.ConsoleKit.Session</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+
+ <method name="GetSessionForCookie">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="cookie" direction="in" type="s">
+ <doc:doc>
+ <doc:summary>The secret cookie that is used to identify the session</doc:summary>
+ </doc:doc>
+ </arg>
+ <arg name="ssid" direction="out" type="o">
+ <doc:doc>
+ <doc:summary>The object identifier for the current session</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Returns the session ID that is associated with the specified cookie.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+ <method name="GetSessionForUnixProcess">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="pid" direction="in" type="u">
+ <doc:doc>
+ <doc:summary>The POSIX process ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <arg name="ssid" direction="out" type="o">
+ <doc:doc>
+ <doc:summary>The object identifier for the current session</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Attempts to determine the session ID for the specified
+ POSIX process ID (pid).
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+ <method name="GetCurrentSession">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="ssid" direction="out" type="o">
+ <doc:doc>
+ <doc:summary>The object identifier for the current session</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Attempts to determine the session ID that the caller belongs to.
+ </doc:para>
+ <doc:para>See this example of using dbus-send:
+ <doc:example language="shell" title="shell example"><doc:code>
+ dbus-send --system --dest=org.freedesktop.ConsoleKit \
+ --type=method_call --print-reply --reply-timeout=2000 \
+ /org/freedesktop/ConsoleKit/Manager \
+ org.freedesktop.ConsoleKit.Manager.GetCurrentSession
+ </doc:code></doc:example></doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+ <method name="GetSessionsForUnixUser">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="uid" direction="in" type="u">
+ <doc:doc>
+ <doc:summary>POSIX User identification</doc:summary>
+ </doc:doc>
+ </arg>
+ <arg name="sessions" direction="out" type="ao">
+ <doc:doc>
+ <doc:summary>an array of Session IDs</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
+ that are currently open for the specified user.</doc:para>
+ <doc:para>Each Session ID is an D-Bus object path for the object that implements the
+ <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+ <method name="GetSessionsForUser">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="uid" direction="in" type="u">
+ <doc:doc>
+ <doc:summary>User identification</doc:summary>
+ </doc:doc>
+ </arg>
+ <arg name="sessions" direction="out" type="ao">
+ <doc:doc>
+ <doc:summary>an array of Session IDs</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
+ that are currently open for the specified user.</doc:para>
+ <doc:para>Each Session ID is an D-Bus object path for the object that implements the
+ <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
+ </doc:description>
+ <doc:deprecated version="0.1.3" instead="GetSessionsForUnixUser"/>
+ </doc:doc>
+ </method>
+
+ <method name="GetSystemIdleHint">
+ <arg name="idle_hint" type="b" direction="out">
+ <doc:doc>
+ <doc:summary>The value of the system-idle-hint</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Returns TRUE if the <doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref>
+ property of every open session is TRUE or if there are no open sessions.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+ <method name="GetSystemIdleSinceHint">
+ <arg name="iso8601_datetime" type="s" direction="out">
+ <doc:doc>
+ <doc:summary>An ISO 8601 format date-type string</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Returns an ISO 8601 date-time string that corresponds to
+ the time of the last change of the system-idle-hint.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <signal name="SeatAdded">
+ <arg name="sid" type="o">
+ <doc:doc>
+ <doc:summary>The Seat ID for the added seat</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when a Seat has been added to the system.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="SeatRemoved">
+ <arg name="sid" type="o">
+ <doc:doc>
+ <doc:summary>The Seat ID for the removed seat</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when a Seat has been removed from the system.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="SystemIdleHintChanged">
+ <arg name="hint" type="b">
+ <doc:doc>
+ <doc:summary>The value of the system-idle-hint</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when the value of the system-idle-hint has changed.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ </interface>
+</node>
diff --git a/src/org.freedesktop.ConsoleKit.Seat.xml b/src/org.freedesktop.ConsoleKit.Seat.xml
new file mode 100644
index 0000000..0e13a0f
--- /dev/null
+++ b/src/org.freedesktop.ConsoleKit.Seat.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
+
+ <interface name="org.freedesktop.ConsoleKit.Seat">
+ <doc:doc>
+ <doc:description>
+ <doc:para>A seat is a collection of sessions and a set of hardware (usually at
+least a keyboard and mouse). Only one session may be active on a
+seat at a time.</doc:para>
+ </doc:description>
+ </doc:doc>
+
+ <method name="GetId">
+ <arg name="sid" direction="out" type="o">
+ <doc:doc>
+ <doc:summary>Seat ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>Returns the ID for Seat.
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="GetSessions">
+ <arg name="sessions" direction="out" type="ao">
+ <doc:doc>
+ <doc:summary>an array of Session IDs</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
+ that are currently attached to this seat.</doc:para>
+ <doc:para>Each Session ID is an D-Bus object path for the object that implements the
+ <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="GetDevices">
+ <arg name="devices" direction="out" type="a(ss)">
+ <doc:doc>
+ <doc:summary>an array of devices</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This gets a list of all the devices
+ that are currently associated with this seat.</doc:para>
+ <doc:para>Each device is an D-Bus structure that represents
+ the device type and the device id.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="GetActiveSession">
+ <arg name="ssid" direction="out" type="o">
+ <doc:doc>
+ <doc:summary>Session ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Gets the Session ID that is currently active on this Seat.</doc:para>
+ <doc:para>Returns NULL if there is no active session.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="CanActivateSessions">
+ <arg name="can_activate" direction="out" type="b">
+ <doc:doc>
+ <doc:summary>TRUE if seat supports session activation</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>Used to determine whether the seat supports session activation.
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="ActivateSession">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="ssid" direction="in" type="o">
+ <doc:doc>
+ <doc:summary>Session ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Attempt to activate the specified session. In most
+ cases, if successful, this will cause the session to
+ become visible and take control of the hardware that is
+ associated with this seat.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="method" to="Session.Activate">Activate()</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+
+ <signal name="ActiveSessionChanged">
+ <arg name="ssid" type="o">
+ <doc:doc>
+ <doc:summary>Session ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when the active session has changed.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="SessionAdded">
+ <arg name="ssid" type="o">
+ <doc:doc>
+ <doc:summary>Session ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when a session has been added to the seat.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="SessionRemoved">
+ <arg name="ssid" type="o">
+ <doc:doc>
+ <doc:summary>Session ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when a session has been removed from the seat.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="DeviceAdded">
+ <arg name="device" type="(ss)">
+ <doc:doc>
+ <doc:summary>Device structure</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when a device has been associated with the seat.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="DeviceRemoved">
+ <arg name="device" type="(ss)">
+ <doc:doc>
+ <doc:summary>Device structure</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when a device has been dissociated from the seat.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ </interface>
+</node>
diff --git a/src/org.freedesktop.ConsoleKit.Session.xml b/src/org.freedesktop.ConsoleKit.Session.xml
new file mode 100644
index 0000000..b6e1cdb
--- /dev/null
+++ b/src/org.freedesktop.ConsoleKit.Session.xml
@@ -0,0 +1,435 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
+
+ <interface name="org.freedesktop.ConsoleKit.Session">
+ <doc:doc>
+ <doc:description>
+ <doc:para>Session objects represent and store information
+ related to a user session.
+ </doc:para>
+ <doc:para>The properties associated with the Session
+ specifically refer to the properties of the "session leader".
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <method name="GetId">
+ <arg name="ssid" direction="out" type="o">
+ <doc:doc>
+ <doc:summary>Session ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the ID for Session.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+ <method name="GetSeatId">
+ <arg name="sid" direction="out" type="o">
+ <doc:doc>
+ <doc:summary>Seat ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the ID for the Seat the Session is
+ attached to.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="interface" to="Seat">org.freedesktop.ConsoleKit.Seat</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetSessionType">
+ <arg name="type" direction="out" type="s">
+ <doc:doc>
+ <doc:summary>Session type</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Returns the type of the session.</doc:para>
+ <doc:para>Warning: we haven't yet defined the allowed values for this property.
+ It is probably best to avoid this until we do.
+ </doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:session-type">session-type</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetUser">
+ <arg name="uid" direction="out" type="u">
+ <doc:doc>
+ <doc:summary>User ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the user that the session belongs to.</doc:para>
+ </doc:description>
+ <doc:deprecated version="0.1.3" instead="GetUnixUser"/>
+ <doc:seealso><doc:ref type="property" to="Session:user">user</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetUnixUser">
+ <arg name="uid" direction="out" type="u">
+ <doc:doc>
+ <doc:summary>POSIX User ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the POSIX user ID that the session belongs to.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:unix-user">unix-user</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetX11Display">
+ <arg name="display" direction="out" type="s">
+ <doc:doc>
+ <doc:summary>The value of the X11 display</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the value of the X11 DISPLAY for this session
+ if one is present.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:x11-display">x11-display</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetX11DisplayDevice">
+ <arg name="x11_display_device" direction="out" type="s">
+ <doc:doc>
+ <doc:summary>The value of the X11 display device</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the value of the display device (aka TTY) that the
+ X11 display for the session is connected to. If there is no x11-display set then this value
+ is undefined.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:x11-display-device">x11-display-device</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetDisplayDevice">
+ <arg name="display_device" direction="out" type="s">
+ <doc:doc>
+ <doc:summary>The value of the display device</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the value of the display device (aka TTY) that the
+ session is connected to.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:display-device">display-device</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetRemoteHostName">
+ <arg name="remote_host_name" direction="out" type="s">
+ <doc:doc>
+ <doc:summary>The remote host name</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the value of the remote host name for the session.
+ </doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:remote-host-name">remote-host-name</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetLoginSessionId">
+ <arg name="login_session_id" direction="out" type="s">
+ <doc:doc>
+ <doc:summary>The value of the native system login session ID</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns the value of the login session ID that the
+ underlying system uses to enforce session boundaries. If there is no login session ID
+ set then this value is an empty string.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+ <method name="IsActive">
+ <arg name="active" direction="out" type="b">
+ <doc:doc>
+ <doc:summary>TRUE if the session is active, otherwise FALSE</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns whether the session is active on the Seat that
+ it is attached to.</doc:para>
+ <doc:para>If the session is not attached to a seat this value is undefined.
+ </doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:active">active</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="IsLocal">
+ <arg name="local" direction="out" type="b">
+ <doc:doc>
+ <doc:summary>TRUE if the session is local, otherwise FALSE</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description><doc:para>Returns whether the session is local</doc:para>
+ <doc:para>FIXME: we need to come up with a concrete definition for this value.
+ It was originally used as a way to identify XDMCP sessions that originate
+ from a remote system.
+ </doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:is-local">is-local</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetCreationTime">
+ <arg name="iso8601_datetime" type="s" direction="out">
+ <doc:doc>
+ <doc:summary>An ISO 8601 format date-type string</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Returns an ISO 8601 date-time string that corresponds to
+ the time that the session was opened.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <method name="Activate">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Attempt to activate the this session. In most
+ cases, if successful, this will cause the session to
+ become visible and become active on the seat that it
+ is attached to.</doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="method" to="Seat.ActivateSession">Seat.ActivateSession()</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="Lock">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This will cause a <doc:ref type="signal" to="Session::Lock">Lock</doc:ref>
+ signal to be emitted for this session.
+ </doc:para>
+ </doc:description>
+ <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission>
+ <doc:seealso><doc:ref type="signal" to="Session::Lock">Lock signal</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="Unlock">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This will cause an <doc:ref type="signal" to="Session::Unlock">Unlock</doc:ref>
+ signal to be emitted for this session.
+ </doc:para>
+ <doc:para>This can be used by login managers to unlock a session before it is
+ re-activated during fast-user-switching.
+ </doc:para>
+ </doc:description>
+ <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission>
+ <doc:seealso><doc:ref type="signal" to="Session::Unlock">Unlock signal</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+
+ <method name="GetIdleHint">
+ <arg name="idle_hint" type="b" direction="out">
+ <doc:doc>
+ <doc:summary>The value of the idle-hint</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Gets the value of the <doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref>
+ property.
+ </doc:para>
+ </doc:description>
+ <doc:seealso><doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref></doc:seealso>
+ </doc:doc>
+ </method>
+ <method name="GetIdleSinceHint">
+ <arg name="iso8601_datetime" type="s" direction="out">
+ <doc:doc>
+ <doc:summary>An ISO 8601 format date-type string</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Returns an ISO 8601 date-time string that corresponds to
+ the time of the last change of the idle-hint.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+ <method name="SetIdleHint">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="idle_hint" type="b" direction="in">
+ <doc:doc>
+ <doc:summary>boolean value to set the idle-hint to</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>This may be used by the session to indicate that
+ it is idle.
+ </doc:para>
+ <doc:para>Use of this method is restricted to the user
+ that owns the session.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <signal name="ActiveChanged">
+ <arg name="is_active" type="b">
+ <doc:doc>
+ <doc:summary>TRUE if the session is active, otherwise FALSE</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when the active property has changed.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="IdleHintChanged">
+ <arg name="hint" type="b">
+ <doc:doc>
+ <doc:summary>the new value of idle-hint</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when the idle-hint property has changed.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="Lock">
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted in response to a call to the <doc:ref type="method" to="Session.Lock">Lock()</doc:ref> method.</doc:para>
+ <doc:para>It is intended that the screensaver for the session should lock the screen in response to this signal.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="Unlock">
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted in response to a call to the <doc:ref type="method" to="Session.Unlock">Unlock()</doc:ref> method.</doc:para>
+ <doc:para>It is intended that the screensaver for the session should unlock the screen in response to this signal.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+
+ <property name="unix-user" type="u" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>The user assigned to the session.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+ <property name="user" type="u" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>The user assigned to the session.</doc:para>
+ </doc:description>
+ <doc:deprecated version="0.1.3" instead="unix-user"/>
+ </doc:doc>
+ </property>
+ <property name="session-type" type="s" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>The type of the session.</doc:para>
+ <doc:para>Warning: we haven't yet defined the allowed values for this property.
+ It is probably best to avoid this until we do.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+ <property name="remote-host-name" type="s" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>The remote host name for the session.
+ </doc:para>
+ <doc:para>This will be set in situations where the session is
+ opened and controlled from a remote system.
+ </doc:para>
+ <doc:para>For example, this value will be set when the
+ session is created from an SSH or XDMCP connection.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+ <property name="display-device" type="s" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>The display device (aka TTY) that the
+ session is connected to.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+ <property name="x11-display" type="s" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>Value of the X11 DISPLAY for this session
+ if one is present.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+ <property name="x11-display-device" type="s" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The display device (aka TTY) that the X11 display for the
+ session is connected to. If there is no x11-display set then
+ this value is undefined.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+ <property name="active" type="b" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Whether the session is active on the Seat that
+ it is attached to.</doc:para>
+ <doc:para>If the session is not attached to a seat this value is undefined.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+ <property name="is-local" type="b" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Whether the session is local</doc:para>
+ <doc:para>FIXME: we need to come up with a concrete definition for this value.
+ It was originally used as a way to identify XDMCP sessions that originate
+ from a remote system.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+ <property name="idle-hint" type="b" access="readwrite">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ This is a hint used to indicate that the session may be idle.
+ </doc:para>
+ <doc:para>
+ For sessions with a <doc:ref type="property" to="Session:x11-display">x11-display</doc:ref> set (ie. graphical
+ sessions), it is up to each session to delegate the
+ responsibility for updating this value. Typically, the
+ screensaver will set this.
+ </doc:para>
+ <doc:para>However, for non-graphical sessions with a <doc:ref type="property" to="Session:display-device">display-device</doc:ref> set
+ the Session object itself will periodically update this value based
+ on the activity detected on the display-device itself.
+ </doc:para>
+ <doc:para>
+ This should not be considered authoritative.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
+ </interface>
+</node>
diff --git a/src/test-open-session-with-parameters b/src/test-open-session-with-parameters
index ce622ce..1032a30 100755
--- a/src/test-open-session-with-parameters
+++ b/src/test-open-session-with-parameters
@@ -14,15 +14,15 @@ manager_obj = bus.get_object ('org.freedesktop.ConsoleKit', '/org/freedesktop/Co
manager = dbus.Interface (manager_obj, 'org.freedesktop.ConsoleKit.Manager')
-params = dbus.Array ([], signature = "sv")
-params.append (("unix-user", dbus.Variant (730)))
-params.append (("session-type", dbus.Variant ("gnome-session")))
-#params.append (("x11-display", dbus.Variant (":0.0")))
-params.append (("display-device", dbus.Variant ("/dev/tty8")))
-params.append (("is-local", dbus.Variant (True)))
-params.append (("bogus-property", dbus.Variant ("Something bogus")))
-params.append (("cookie", dbus.Variant ("This should be ignored")))
-params.append (("id", dbus.Variant ("This should be ignored too")))
+params = dbus.Array ([], signature = "(sv)")
+params.append (("unix-user", dbus.Int32 (730, variant_level=1)))
+params.append (("session-type", dbus.String ("Unknown", variant_level=1)))
+#params.append (("x11-display", dbus.String (":0.0", variant_level=1)))
+params.append (("display-device", dbus.String ("/dev/tty8", variant_level=1)))
+params.append (("is-local", dbus.Boolean (True, variant_level=1)))
+params.append (("bogus-property", dbus.String ("Something bogus", variant_level=1)))
+params.append (("cookie", dbus.String ("This should be ignored", variant_level=1)))
+params.append (("id", dbus.String ("This should be ignored too", variant_level=1)))
cookie = manager.OpenSessionWithParameters (params)
os.environ['XDG_SESSION_COOKIE'] = cookie
@@ -38,7 +38,7 @@ for sid in seats:
session = dbus.Interface (session_obj, 'org.freedesktop.ConsoleKit.Session')
uid = session.GetUser ()
-# Hmm looks like the proc environment doesn't get updated when
+# The proc environment doesn't get updated when
# os.environ is set. So, we won't use GetCurrentSession.
#current_session = manager.GetCurrentSession ()
current_session = manager.GetSessionForCookie (cookie)