moved into main for pisi 2.0

This commit is contained in:
2015-07-04 15:12:27 +03:00
parent b88266550d
commit cace6d5ced
8 changed files with 1023 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from pisi.actionsapi import get
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
def setup():
# /var/run => /run
#pisitools.dosed("configure.ac", "^(\s+CONSOLE_KIT_PID_FILE=)\$\{localstatedir\}(\/run\/ConsoleKit\/pid)", r"\1\2")
#pisitools.dosed("src/Makefile.am", "\$\(localstatedir\)(\/run\/ConsoleKit)", r"\1")
#shelltools.system("sed -i -e '/SystemdService/d' data/org.freedesktop.ConsoleKit.service.in")
#autotools.autoreconf("-fi")
autotools.configure("--prefix=/usr \
--sysconfdir=/etc \
--sbindir=/usr/sbin \
--with-rundir=/run \
--libexecdir=/usr/libexec/ConsoleKit \
--localstatedir=/var \
--enable-polkit \
--enable-pam-module \
--enable-udev-acl \
--enable-docbook-docs \
--disable-static \
--with-dbus-services=/usr/share/dbus-1/services \
--with-logrotate-dir=/etc/logrotate.d \
--with-xinitrc-dir=/etc/X11/xinit/xinitrc.d \
--with-pam-module-dir=/lib/security \
--with-systemdsystemunitdir=no \
XMLTO_FLAGS='--skip-validation' \
")
def build():
autotools.make()
def install():
autotools.rawInstall("DESTDIR=%s/" % get.installDIR())
pisitools.removeDir("/run")
pisitools.dodoc("AUTHORS", "README", "COPYING", "HACKING", "NEWS", "TODO")
@@ -0,0 +1,8 @@
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.consolekit.system.stop" ||
action.id == "org.freedesktop.consolekit.system.restart" ||
action.id == "org.freedesktop.consolekit.system.hibernate" ||
action.id == "org.freedesktop.consolekit.system.suspend") {
return polkit.Result.YES;
}
});
@@ -0,0 +1 @@
d /run/ConsoleKit 0755 - - -
@@ -0,0 +1,7 @@
#%PAM-1.0
auth include system-login
account include system-login
session include system-login
password include system-login
session optional pam_ck_connector.so
@@ -0,0 +1,17 @@
#!/bin/sh
TAGDIR=/run/console
[ -n "$CK_SESSION_USER_UID" ] || exit 1
[ "$CK_SESSION_IS_LOCAL" = "true" ] || exit 0
TAGFILE="$TAGDIR/`getent passwd $CK_SESSION_USER_UID | cut -f 1 -d:`"
if [ "$1" = "session_added" ]; then
mkdir -p "$TAGDIR"
echo "$CK_SESSION_ID" >> "$TAGFILE"
fi
if [ "$1" = "session_removed" ] && [ -e "$TAGFILE" ]; then
sed -i "\%^$CK_SESSION_ID\$%d" "$TAGFILE"
[ -s "$TAGFILE" ] || rm -f "$TAGFILE"
fi
@@ -0,0 +1,776 @@
diff -Nuar ConsoleKit2-0.9.3.orig/src/ck-manager.c ConsoleKit2-0.9.3/src/ck-manager.c
--- ConsoleKit2-0.9.3.orig/src/ck-manager.c 2015-06-09 19:04:19.000000000 +0300
+++ ConsoleKit2-0.9.3/src/ck-manager.c 2015-06-14 21:30:51.943744599 +0300
@@ -2851,6 +2851,11 @@
pid_t calling_pid = 0;
char *cookie;
+ if (pid <= 1) {
+ throw_error (context, CK_MANAGER_ERROR_INVALID_INPUT, _("pid must be > 1"));
+ return TRUE;
+ }
+
manager = CK_MANAGER (ckmanager);
sender = g_dbus_method_invocation_get_sender (context);
diff -Nuar ConsoleKit2-0.9.3.orig/src/ck-session.c ConsoleKit2-0.9.3/src/ck-session.c
--- ConsoleKit2-0.9.3.orig/src/ck-session.c 2015-05-18 06:43:04.000000000 +0300
+++ ConsoleKit2-0.9.3/src/ck-session.c 2015-06-14 21:30:55.946744527 +0300
@@ -55,7 +55,6 @@
char *seat_id;
char *login_session_id;
- guint uid;
GTimeVal creation_time;
@@ -331,6 +330,11 @@
g_return_val_if_fail (CK_IS_SESSION (cksession), FALSE);
+ if (console_kit_session_get_idle_hint (cksession) == FALSE) {
+ throw_error (context, CK_SESSION_ERROR_GENERAL, "idle since hint not set");
+ return TRUE;
+ }
+
date_str = g_time_val_to_iso8601 (&session->priv->idle_since_hint);
console_kit_session_complete_get_idle_since_hint (cksession, context, date_str);
@@ -386,7 +390,7 @@
}
/* only restrict this by UID for now */
- if (session->priv->uid != calling_uid) {
+ if (console_kit_session_get_unix_user (cksession) != calling_uid) {
throw_error (context, CK_SESSION_ERROR_INSUFFICIENT_PERMISSION, _("Only session owner may set idle hint state"));
return TRUE;
}
@@ -836,7 +840,11 @@
g_return_val_if_fail (CK_IS_SESSION (cksession), FALSE);
- console_kit_session_complete_get_login_session_id (cksession, context, session->priv->login_session_id);
+ if (session->priv->login_session_id == NULL) {
+ throw_error (context, CK_SESSION_ERROR_FAILED, "no login session id");
+ } else {
+ console_kit_session_complete_get_login_session_id (cksession, context, session->priv->login_session_id);
+ }
return TRUE;
}
@@ -1240,7 +1248,7 @@
extra_env[n++] = g_strdup_printf ("CK_SESSION_TYPE=%s", console_kit_session_get_session_type (cksession));
}
extra_env[n++] = g_strdup_printf ("CK_SESSION_SEAT_ID=%s", session->priv->seat_id);
- extra_env[n++] = g_strdup_printf ("CK_SESSION_USER_UID=%d", session->priv->uid);
+ extra_env[n++] = g_strdup_printf ("CK_SESSION_USER_UID=%d", console_kit_session_get_unix_user (cksession));
if (console_kit_session_get_display_device (cksession) != NULL && strlen (console_kit_session_get_display_device (cksession)) > 0) {
extra_env[n++] = g_strdup_printf ("CK_SESSION_DISPLAY_DEVICE=%s", console_kit_session_get_display_device (cksession));
}
@@ -1279,7 +1287,7 @@
cksession = CONSOLE_KIT_SESSION (session);
group_name = g_strdup_printf ("Session %s", session->priv->id);
- g_key_file_set_integer (key_file, group_name, "uid", session->priv->uid);
+ g_key_file_set_integer (key_file, group_name, "uid", console_kit_session_get_unix_user (cksession));
g_key_file_set_string (key_file,
group_name,
"seat",
diff -Nuar ConsoleKit2-0.9.3.orig/src/test-fus ConsoleKit2-0.9.3/src/test-fus
--- ConsoleKit2-0.9.3.orig/src/test-fus 1970-01-01 02:00:00.000000000 +0200
+++ ConsoleKit2-0.9.3/src/test-fus 2015-06-14 21:31:08.768744297 +0300
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Test fast-user-switch functionality
+#
+
+import os
+import sys
+import gobject
+import dbus
+import dbus.glib
+
+def activate_reply (res):
+ print "session activated"
+
+def activate_error (e):
+ print str (e)
+
+def session_added_cb (ssid):
+ print "Session added: %s" % ssid
+
+def session_removed_cb (ssid):
+ print "Session removed: %s" % ssid
+
+def active_session_changed_cb (ssid):
+ print "Active session changed: %s" % ssid
+
+bus = dbus.SystemBus ()
+
+manager_obj = bus.get_object ('org.freedesktop.ConsoleKit', '/org/freedesktop/ConsoleKit/Manager')
+
+manager = dbus.Interface (manager_obj, 'org.freedesktop.ConsoleKit.Manager')
+
+current_ssid = manager.GetCurrentSession ()
+current_session_obj = bus.get_object ('org.freedesktop.ConsoleKit', current_ssid)
+current_session = dbus.Interface (current_session_obj, 'org.freedesktop.ConsoleKit.Session')
+
+sid = current_session.GetSeatId ()
+if not sid:
+ print "Current session is not attached to a seat, no switching possible"
+ sys.exit ()
+
+seat_obj = bus.get_object ('org.freedesktop.ConsoleKit', sid)
+seat = dbus.Interface (seat_obj, 'org.freedesktop.ConsoleKit.Seat')
+seat.connect_to_signal ('SessionAdded', session_added_cb)
+seat.connect_to_signal ('SessionRemoved', session_removed_cb)
+seat.connect_to_signal ('ActiveSessionChanged', active_session_changed_cb)
+
+can_fus = seat.CanActivateSessions()
+if can_fus:
+ print "The current seat supports session switching"
+else:
+ print "The current seat does not support session switching"
+
+# Show a list of sessions on the current seat
+sessions = seat.GetSessions ()
+for ssid in sessions:
+ session_obj = bus.get_object ('org.freedesktop.ConsoleKit', ssid)
+ session = dbus.Interface (session_obj, 'org.freedesktop.ConsoleKit.Session')
+ uid = session.GetUser ()
+ print "Session %s user=%u" % (ssid, uid)
+
+# then pretend a session-ID is selected:
+ssid = current_ssid
+session_obj = bus.get_object ('org.freedesktop.ConsoleKit', ssid)
+session = dbus.Interface (session_obj, 'org.freedesktop.ConsoleKit.Session')
+session.Activate (reply_handler = activate_reply, error_handler = activate_error)
+
+mainloop = gobject.MainLoop ()
+mainloop.run()
diff -Nuar ConsoleKit2-0.9.3.orig/src/test-manager.c ConsoleKit2-0.9.3/src/test-manager.c
--- ConsoleKit2-0.9.3.orig/src/test-manager.c 2015-06-08 10:14:14.000000000 +0300
+++ ConsoleKit2-0.9.3/src/test-manager.c 2015-06-14 21:31:10.021744275 +0300
@@ -277,7 +277,10 @@
static gboolean
validate_stuff ()
{
- gint fd;
+ gint fd;
+ GVariant *session_var = NULL, *close_var = NULL;
+ gboolean is_session_closed;
+ GError *error = NULL;
print_reply (manager, "CanRestart");
@@ -295,7 +298,7 @@
fd = print_inhibit_reply (manager, "Inhibit");
- print_reply (manager, "OpenSession");
+ session_var = print_method (manager, "OpenSession", g_variant_new ("()"));
print_reply (manager, "GetSeats");
@@ -317,8 +320,29 @@
g_close (fd, NULL);
}
+ /* test closing our session */
+ if (session_var != NULL) {
+ g_print ("calling CloseSession\t");
+ close_var = g_dbus_proxy_call_sync (manager, "CloseSession",
+ session_var,
+ G_DBUS_CALL_FLAGS_NONE, 3000, NULL, &error);
+ if (close_var == NULL) {
+ g_print ("returned NULL\t");
+ if (error)
+ g_print ("error %s", error->message);
+ }
+ }
+
+ g_variant_get (close_var, "(b)", &is_session_closed);
+ g_print ("session closed? %s", is_session_closed ? "Closed" : "Not Closed");
+
g_print ("done printing stuff\n\n");
+ if (session_var)
+ g_variant_unref (session_var);
+ if (close_var)
+ g_variant_unref (close_var);
+
return TRUE;
}
diff -Nuar ConsoleKit2-0.9.3.orig/src/test-method-access-policy ConsoleKit2-0.9.3/src/test-method-access-policy
--- ConsoleKit2-0.9.3.orig/src/test-method-access-policy 1970-01-01 02:00:00.000000000 +0200
+++ ConsoleKit2-0.9.3/src/test-method-access-policy 2015-06-14 21:31:10.021744275 +0300
@@ -0,0 +1,534 @@
+#!/usr/bin/env python
+#
+# Test access to methods
+#
+
+import os
+import sys
+import gobject
+import dbus
+import dbus.glib
+
+bus = dbus.SystemBus ()
+
+privileged = (os.geteuid () == 0)
+if privileged:
+ print "Running privileged as uid=%d pid=%d" % (os.geteuid (), os.getpid ())
+else:
+ print "Running unprivileged as uid=%d pid=%d" % (os.geteuid (), os.getpid ())
+
+print "Testing all public methods to check D-Bus policy"
+
+manager_obj = bus.get_object ('org.freedesktop.ConsoleKit', '/org/freedesktop/ConsoleKit/Manager')
+manager = dbus.Interface (manager_obj, 'org.freedesktop.ConsoleKit.Manager')
+
+print "Testing Manager"
+
+print "Testing Manager.OpenSession:",
+res = "PASS"
+try:
+ cookie = manager.OpenSession ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Manager.CloseSession:",
+res = "PASS"
+try:
+ manager.CloseSession (cookie)
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Manager.OpenSessionWithParameters:",
+res = "PASS"
+try:
+ cookie = manager.OpenSessionWithParameters (dbus.Array([], signature = "sv"))
+ if not privileged:
+ res = "FAIL"
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ if privileged:
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t%s" % res
+
+print "Testing Manager.GetSeats:",
+res = "PASS"
+try:
+ manager.GetSeats ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Manager.GetSessionForCookie:",
+res = "PASS"
+try:
+ manager.GetSessionForCookie (os.environ['XDG_SESSION_COOKIE'])
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Manager.GetSessionForUnixProcess:",
+res = "PASS"
+try:
+ manager.GetSessionForUnixProcess (os.getpid ())
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t%s" % res
+
+print "Testing Manager.GetCurrentSession:",
+res = "PASS"
+try:
+ manager.GetCurrentSession ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Manager.GetSessionsForUnixUser:",
+res = "PASS"
+try:
+ manager.GetSessionsForUnixUser (os.geteuid ())
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t%s" % res
+
+print "Testing Manager.GetSessionsForUser:",
+res = "PASS"
+try:
+ manager.GetSessionsForUser (os.geteuid ())
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Manager.GetSystemIdleHint:",
+res = "PASS"
+try:
+ manager.GetSystemIdleHint ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Manager.GetSystemIdleSinceHint:",
+res = "PASS"
+try:
+ manager.GetSystemIdleSinceHint ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t%s" % res
+
+# Test Seat Interface
+print "Testing Seat"
+
+seat_obj = bus.get_object ('org.freedesktop.ConsoleKit', '/org/freedesktop/ConsoleKit/Seat1')
+seat = dbus.Interface (seat_obj, 'org.freedesktop.ConsoleKit.Seat')
+
+print "Testing Seat.GetId:",
+res = "PASS"
+try:
+ seat.GetId ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t\t%s" % res
+
+print "Testing Seat.GetSessions:",
+res = "PASS"
+try:
+ seat.GetSessions ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Seat.GetDevices:",
+res = "PASS"
+try:
+ seat.GetDevices ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Seat.GetActiveSession:",
+res = "PASS"
+try:
+ seat.GetActiveSession ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Seat.CanActivateSessions:",
+res = "PASS"
+try:
+ seat.CanActivateSessions ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Seat.ActivateSession:",
+res = "PASS"
+try:
+ seat.ActivateSession ('/org/freedesktop/ConsoleKit/SessionN')
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+# Test Session Interface
+print "Testing Session"
+
+# create a new session so we can set props
+cookie = manager.OpenSession ()
+ssid = manager.GetSessionForCookie (cookie)
+if not ssid:
+ print "Could not create a session to test"
+ sys.exit ()
+
+session_obj = bus.get_object ('org.freedesktop.ConsoleKit', ssid)
+session = dbus.Interface (session_obj, 'org.freedesktop.ConsoleKit.Session')
+
+print "Testing Session.GetId:",
+res = "PASS"
+try:
+ session.GetId ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t\t%s" % res
+
+print "Testing Session.GetSeatId:",
+res = "PASS"
+try:
+ session.GetSeatId ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Session.GetLoginSessionId:",
+res = "PASS"
+try:
+ session.GetLoginSessionId ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Session.GetSessionType:",
+res = "PASS"
+try:
+ session.GetSessionType ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Session.GetUser:",
+res = "PASS"
+try:
+ session.GetUser ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Session.GetUnixUser:",
+res = "PASS"
+try:
+ session.GetUnixUser ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Session.GetX11Display:",
+res = "PASS"
+try:
+ session.GetX11Display ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Session.GetX11DisplayDevice:",
+res = "PASS"
+try:
+ session.GetX11DisplayDevice ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Session.GetDisplayDevice:",
+res = "PASS"
+try:
+ session.GetDisplayDevice ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Session.GetRemoteHostName:",
+res = "PASS"
+try:
+ session.GetRemoteHostName ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Session.IsActive:",
+res = "PASS"
+try:
+ session.IsActive ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Session.IsLocal:",
+res = "PASS"
+try:
+ session.IsLocal ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Session.GetCreationTime:",
+res = "PASS"
+try:
+ session.GetCreationTime ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Session.Activate:",
+res = "PASS"
+try:
+ session.Activate ()
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+print "Testing Session.Lock:",
+res = "PASS"
+try:
+ session.Lock ()
+ if not privileged:
+ res = "FAIL"
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ if privileged:
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t\t%s" % res
+
+print "Testing Session.Unlock:",
+res = "PASS"
+try:
+ session.Unlock ()
+ if not privileged:
+ res = "FAIL"
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ if privileged:
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
+
+# Test session properties
+
+session_props = dbus.Interface (session_obj, 'org.freedesktop.DBus.Properties')
+
+print "Testing Properties.Get 'unix-user':",
+res = "PASS"
+try:
+ session_props.Get ('org.freedesktop.ConsoleKit.Session', "unix-user")
+ if not privileged:
+ res = "FAIL"
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ if privileged:
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Properties.Get 'cookie':",
+res = "PASS"
+try:
+ session_props.Get ('org.freedesktop.ConsoleKit.Session', "cookie")
+ if not privileged:
+ res = "FAIL"
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ if privileged:
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t%s" % res
+
+print "Testing Properties.Set:",
+res = "PASS"
+try:
+ session_props.Set ('org.freedesktop.ConsoleKit.Session', "unix-user", 0)
+ if not privileged:
+ res = "FAIL"
+except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name () == "org.freedesktop.DBus.Error.AccessDenied":
+ if privileged:
+ res = "FAIL"
+ elif e.get_dbus_name () == "org.freedesktop.DBus.Error.UnknownMethod":
+ res = "UKNOWN METHOD"
+except:
+ pass
+print "\t\t\t%s" % res
diff -Nuar ConsoleKit2-0.9.3.orig/src/test-session.c ConsoleKit2-0.9.3/src/test-session.c
--- ConsoleKit2-0.9.3.orig/src/test-session.c 2015-05-18 06:43:04.000000000 +0300
+++ ConsoleKit2-0.9.3/src/test-session.c 2015-06-14 21:31:12.560744229 +0300
@@ -176,7 +176,7 @@
open_session (void)
{
GDBusProxy *session;
- GVariant *cookie_var, *session_var, *activate_var;
+ GVariant *cookie_var, *session_var, *activate_var, *close_var;
GError *error = NULL;
const gchar *path = NULL, *cookie = NULL;
@@ -272,6 +272,20 @@
}
if (activate_var)
g_variant_unref (activate_var);
+
+ close_var = g_dbus_proxy_call_sync (manager, "CloseSession", g_variant_new ("(s)", cookie), G_DBUS_CALL_FLAGS_NONE, 3000, NULL, &error);
+ if (session_var == NULL) {
+ g_print ("returned NULL, is the daemon running?\t");
+
+ if (error)
+ g_print ("error %s", error->message);
+
+ g_print ("\n");
+ g_clear_error (&error);
+ return;
+ }
+ if (close_var)
+ g_variant_unref (close_var);
}
int
+154
View File
@@ -0,0 +1,154 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>ConsoleKit2</Name>
<Homepage>http://freedesktop.org/Software/Hal</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>GPLv2</License>
<IsA>library</IsA>
<Summary>A framework for defining and tracking users, login sessions, and seats</Summary>
<Description>ConsoleKit is a system daemon for tracking what users are logged into the system and how they interact with the computer (e.g. which keyboard and mouse they use).</Description>
<Archive sha1sum="290ba7883455bbff4dabe7d7a5d7744ff5ff7682" type="tarbz2">https://github.com/ConsoleKit2/ConsoleKit2/releases/download/0.9.4/ConsoleKit2-0.9.4.tar.bz2</Archive>
<BuildDependencies>
<Dependency>acl-devel</Dependency>
<Dependency>pam-devel</Dependency>
<Dependency>dbus-devel</Dependency>
<Dependency>udev-devel</Dependency>
<Dependency>zlib-devel</Dependency>
<Dependency>glib2-devel</Dependency>
<Dependency>libX11-devel</Dependency>
<Dependency>polkit-devel</Dependency>
<Dependency>dbus-glib-devel</Dependency>
</BuildDependencies>
<!--<Patches>
<Patch level="1">upstream_fix_issue_26.patch</Patch>
</Patches>-->
</Source>
<Package>
<Name>ConsoleKit</Name>
<RuntimeDependencies>
<Dependency>acl</Dependency>
<Dependency>pam</Dependency>
<Dependency>dbus</Dependency>
<Dependency>zlib</Dependency>
<Dependency>glib2</Dependency>
<Dependency>libX11</Dependency>
<Dependency>polkit</Dependency>
<Dependency>libudev</Dependency>
<Dependency>dbus-glib</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="config">/etc</Path>
<Path fileType="config">/usr/lib/tmpfiles.d/ConsoleKit.conf</Path>
<Path fileType="executable">/usr/bin</Path>
<Path fileType="executable">/usr/sbin</Path>
<Path fileType="library">/usr/libexec</Path>
<Path fileType="library">/lib</Path>
<Path fileType="library">/usr/lib</Path>
<Path fileType="data">/usr/share/dbus-1</Path>
<Path fileType="data">/usr/share/polkit-1/actions</Path>
<Path fileType="data">/usr/share/polkit-1/rules.d</Path>
<Path fileType="man">/usr/share/man</Path>
<Path fileType="localedata">/usr/share/locale</Path>
<Path fileType="doc">/usr/share/doc</Path>
<Path fileType="data">/var</Path>
</Files>
<AdditionalFiles>
<AdditionalFile owner="root" permission="0644" target="/usr/lib/tmpfiles.d/ConsoleKit.conf">ConsoleKit.conf</AdditionalFile>
<AdditionalFile permission="0644" target="/usr/share/polkit-1/rules.d/75-consolekit.rules">25-consolekit.rules</AdditionalFile>
<AdditionalFile owner="root" permission="0755" target="/etc/pam.d/consolekit">consolekit.pamd</AdditionalFile>
</AdditionalFiles>
</Package>
<Package>
<Name>ConsoleKit-devel</Name>
<PartOf>system.devel</PartOf>
<Summary>Development files for ConsoleKit</Summary>
<RuntimeDependencies>
<Dependency release="current">ConsoleKit</Dependency>
<Dependency>dbus-devel</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="header">/usr/include</Path>
<Path fileType="data">/usr/lib/pkgconfig</Path>
</Files>
</Package>
<History>
<Update release="10">
<Date>2015-06-16</Date>
<Version>0.9.4</Version>
<Comment>Version bump.</Comment>
<Name>Ertuğrul Erata</Name>
<Email>ertugrulerata@gmail.com</Email>
</Update>
<Update release="9">
<Date>2015-06-15</Date>
<Version>0.9.3</Version>
<Comment>Version bump.</Comment>
<Name>Ertuğrul Erata</Name>
<Email>ertugrulerata@gmail.com</Email>
</Update>
<Update release="8">
<Date>2015-02-05</Date>
<Version>0.9.2</Version>
<Comment>Version bump.</Comment>
<Name>Vedat Demir</Name>
<Email>vedat@pisilinux.org</Email>
</Update>
<Update release="7">
<Date>2014-08-01</Date>
<Version>0.4.6</Version>
<Comment>Rebuild.</Comment>
<Name>Marcin Bojara</Name>
<Email>marcin@pisilinux.org</Email>
</Update>
<Update release="6">
<Date>2014-05-11</Date>
<Version>0.4.6</Version>
<Comment>Release bump.</Comment>
<Name>Marcin Bojara</Name>
<Email>marcin@pisilinux.org</Email>
</Update>
<Update release="5">
<Date>2014-03-06</Date>
<Version>0.4.6</Version>
<Comment>Dep Fix</Comment>
<Name>Varol Maksutoğlu</Name>
<Email>waroi@pisilinux.org</Email>
</Update>
<Update release="4">
<Date>2014-01-09</Date>
<Version>0.4.6</Version>
<Comment>Add gentoo patches and ConsoleKit.conf</Comment>
<Name>Marcin Bojara</Name>
<Email>marcin@pisilinux.org</Email>
</Update>
<Update release="3">
<Date>2013-09-08</Date>
<Version>0.4.6</Version>
<Comment>/var/run => /run</Comment>
<Name>Marcin Bojara</Name>
<Email>marcin@pisilinux.org</Email>
</Update>
<Update release="2">
<Date>2013-03-04</Date>
<Version>0.4.6</Version>
<Comment>Version bump</Comment>
<Name>Yusuf Aydemir</Name>
<Email>yusuf.aydemir@pisilinux.org</Email>
</Update>
<Update release="1">
<Date>2012-08-23</Date>
<Version>0.4.5</Version>
<Comment>First release</Comment>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Update>
</History>
</PISI>
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>ConsoleKit</Name>
<Summary xml:lang="tr">Kullanıcıları, giriş oturumlarını ve koltukları takip etmek ve tanımlamak için bir altyapı</Summary>
<Description xml:lang="tr">ConsoleKit, sisteme giriş yapmış kullanıcıları ve bu kullanıcıların bilgisayar ile nasıl etkileştiğini izleyen bir sistem hizmetidir.</Description>
</Source>
<Package>
<Name>ConsoleKit-devel</Name>
<Summary xml:lang="tr">ConsoleKit için geliştirme dosyaları</Summary>
</Package>
</PISI>