rpms/udev/devel ck-runseat.patch,NONE,1.1 udev.spec,1.293,1.294
Harald Hoyer
harald at fedoraproject.org
Tue Sep 29 13:09:11 UTC 2009
- Previous message (by thread): rpms/sparse/devel .cvsignore, 1.7, 1.8 sources, 1.7, 1.8 sparse.spec, 1.12, 1.13
- Next message (by thread): rpms/python-qpid/F-12 python-qpid.spec,1.31,1.32 sources,1.21,1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: harald
Update of /cvs/pkgs/rpms/udev/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30708
Modified Files:
udev.spec
Added Files:
ck-runseat.patch
Log Message:
* Tue Sep 29 2009 Harald Hoyer <harald at redhat.com> 145-10
- add ConsoleKit patch for ConsoleKit 0.4.1
ck-runseat.patch:
Makefile.am | 4 -
udev-acl.c | 207 +++++++++++++++++++++++++++++++++++++++++++++---------------
2 files changed, 159 insertions(+), 52 deletions(-)
--- NEW FILE ck-runseat.patch ---
--- udev-145/extras/udev-acl/Makefile.am.runseat 2009-06-16 19:47:37.000000000 -0400
+++ udev-145/extras/udev-acl/Makefile.am 2009-09-25 20:21:41.959583372 -0400
@@ -15,5 +15,5 @@ udev_acl_LDADD = \
dist_udevrules_DATA = 70-acl.rules
install-exec-hook:
- mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d
- ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck
+ mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d
+ ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck
--- udev-145/extras/udev-acl/udev-acl.c.runseat 2009-06-16 12:10:58.000000000 -0400
+++ udev-145/extras/udev-acl/udev-acl.c 2009-09-25 20:57:32.502573825 -0400
@@ -1,4 +1,5 @@
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
* Copyright (C) 2009 Kay Sievers <kay.sievers at vrfy.org>
*
* This program is free software; you can redistribute it and/or
@@ -29,6 +30,13 @@
static int debug;
+enum{
+ ACTION_NONE = 0,
+ ACTION_REMOVE,
+ ACTION_ADD,
+ ACTION_CHANGE
+};
+
static int set_facl(const char* filename, uid_t uid, int add)
{
int get;
@@ -152,44 +160,123 @@ static GSList *uids_with_local_active_se
}
/* ConsoleKit calls us with special variables */
-static int consolekit_called(const char *action, uid_t *uid, const char **own_session, int *add)
+static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, const char **remove_session_id, int *action)
{
- int a;
- uid_t u;
+ int a = ACTION_NONE;
+ uid_t u = 0;
+ uid_t u2 = 0;
const char *s;
- const char *session;
-
- if (action == NULL || strcmp(action, "session_active_changed") != 0)
- return -1;
+ const char *s2;
+ const char *old_session = NULL;
- s = getenv("CK_SESSION_IS_LOCAL");
- if (s == NULL)
+ if (ck_action == NULL || strcmp(ck_action, "seat_active_session_changed") != 0)
return -1;
- if (strcmp(s, "true") != 0)
- return 0;
- s = getenv("CK_SESSION_IS_ACTIVE");
- if (s == NULL)
+ /* We can have one of: remove, add, change, no-change */
+ s = getenv("CK_SEAT_OLD_SESSION_ID");
+ s2 = getenv("CK_SEAT_SESSION_ID");
+ if (s == NULL && s2 == NULL) {
return -1;
- if (strcmp(s, "true") == 0)
- a = 1;
- else
- a = 0;
+ } else if (s2 == NULL) {
+ a = ACTION_REMOVE;
+ } else if (s == NULL) {
+ a = ACTION_ADD;
+ } else {
+ a = ACTION_CHANGE;
+ }
- session = getenv("CK_SESSION_ID");
- if (session == NULL)
- return -1;
+ switch (a) {
+ case ACTION_ADD:
+ s = getenv("CK_SEAT_SESSION_USER_UID");
+ if (s == NULL)
+ return -1;
+ u = strtoul(s, NULL, 10);
+ if (u == 0)
+ return 0;
+
+ s = getenv("CK_SEAT_SESSION_IS_LOCAL");
+ if (s == NULL)
+ return -1;
+ if (strcmp(s, "true") != 0)
+ return 0;
+
+ break;
+ case ACTION_REMOVE:
+ s = getenv("CK_SEAT_OLD_SESSION_USER_UID");
+ if (s == NULL)
+ return -1;
+ u = strtoul(s, NULL, 10);
+ if (u == 0)
+ return 0;
+
+ s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL");
+ if (s == NULL)
+ return -1;
+ if (strcmp(s, "true") != 0)
+ return 0;
+
+ old_session = getenv("CK_SEAT_OLD_SESSION_ID");
+ if (old_session == NULL)
+ return -1;
+
+ break;
+ case ACTION_CHANGE:
+ s = getenv("CK_SEAT_OLD_SESSION_USER_UID");
+ if (s == NULL)
+ return -1;
+ u = strtoul(s, NULL, 10);
+ if (u == 0)
+ return 0;
+ s = getenv("CK_SEAT_SESSION_USER_UID");
+ if (s == NULL)
+ return -1;
+ u2 = strtoul(s, NULL, 10);
+ if (u2 == 0)
+ return 0;
+
+ s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL");
+ s2 = getenv("CK_SEAT_SESSION_IS_LOCAL");
+ if (s == NULL || s2 == NULL)
+ return -1;
+ /* don't process non-local session changes */
+ if (strcmp(s, "true") != 0 && strcmp(s2, "true") != 0)
+ return 0;
+
+ if (strcmp(s, "true") == 0 && strcmp(s, "true") == 0) {
+ /* process the change */
+ if (u == u2) {
+ /* special case: we noop if we are
+ * changing between local sessions for
+ * the same uid */
+ a = ACTION_NONE;
+ }
+ old_session = getenv("CK_SEAT_OLD_SESSION_ID");
+ if (old_session == NULL)
+ return -1;
+ } else if (strcmp(s, "true") == 0) {
+ /* only process the removal */
+ a = ACTION_REMOVE;
+ old_session = getenv("CK_SEAT_OLD_SESSION_ID");
+ if (old_session == NULL)
+ return -1;
+ } else if (strcmp(s2, "true") == 0) {
+ /* only process the addition */
+ a = ACTION_ADD;
+ u = u2;
+ }
- s = getenv("CK_SESSION_USER_UID");
- if (s == NULL)
- return -1;
- u = strtoul(s, NULL, 10);
- if (u == 0)
- return 0;
+ break;
+ case ACTION_NONE:
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
- *own_session = session;
+ *remove_session_id = old_session;
*uid = u;
- *add = a;
+ *uid2 = u2;
+ *action = a;
return 0;
}
@@ -223,6 +310,21 @@ static void apply_acl_to_devices(uid_t u
udev_unref(udev);
}
+static void
+remove_uid (uid_t uid, const char *remove_session_id)
+{
+ /*
+ * Remove ACL for given uid from all matching devices
+ * when there is currently no local active session.
+ */
+ GSList *list;
+
+ list = uids_with_local_active_session(remove_session_id);
+ if (!uid_in_list(list, uid))
+ apply_acl_to_devices(uid, 0);
+ g_slist_free(list);
+}
+
int main (int argc, char* argv[])
{
static const struct option options[] = {
@@ -233,10 +335,11 @@ int main (int argc, char* argv[])
{ "help", no_argument, NULL, 'h' },
{}
};
- int add = -1;
+ int action = -1;
const char *device = NULL;
uid_t uid = 0;
- const char* own_session = NULL;
+ uid_t uid2 = 0;
+ const char* remove_session_id = NULL;
int rc = 0;
/* valgrind is more important to us than a slice allocator */
@@ -252,9 +355,9 @@ int main (int argc, char* argv[])
switch (option) {
case 'a':
if (strcmp(optarg, "add") == 0 || strcmp(optarg, "change") == 0)
- add = 1;
+ action = ACTION_ADD;
else if (strcmp(optarg, "remove") == 0)
- add = 0;
+ action = ACTION_REMOVE;
else
goto out;
break;
@@ -274,10 +377,10 @@ int main (int argc, char* argv[])
}
}
- if (add < 0 && device == NULL && uid == 0)
- consolekit_called(argv[optind], &uid, &own_session, &add);
+ if (action < 0 && device == NULL && uid == 0)
+ consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action);
- if (add < 0) {
+ if (action < 0) {
fprintf(stderr, "missing action\n\n");
rc = 2;
goto out;
@@ -290,20 +393,24 @@ int main (int argc, char* argv[])
}
if (uid != 0) {
- if (add) {
+ switch (action) {
+ case ACTION_ADD:
/* Add ACL for given uid to all matching devices. */
apply_acl_to_devices(uid, 1);
- } else {
- /*
- * Remove ACL for given uid from all matching devices
- * when there is currently no local active session.
- */
- GSList *list;
-
- list = uids_with_local_active_session(own_session);
- if (!uid_in_list(list, uid))
- apply_acl_to_devices(uid, 0);
- g_slist_free(list);
+ break;
+ case ACTION_REMOVE:
+ remove_uid(uid, remove_session_id);
+ break;
+ case ACTION_CHANGE:
+ remove_uid(uid, remove_session_id);
+ apply_acl_to_devices(uid2, 1);
+ break;
+ case ACTION_NONE:
+ goto out;
+ break;
+ default:
+ g_assert_not_reached();
+ break;
}
} else if (device != NULL) {
/*
@@ -321,8 +428,8 @@ int main (int argc, char* argv[])
uid_t u;
u = GPOINTER_TO_UINT(l->data);
- if (add || !uid_in_list(list, u))
- set_facl(device, u, add);
+ if (action == ACTION_ADD || !uid_in_list(list, u))
+ set_facl(device, u, action == ACTION_ADD);
}
g_slist_free(list);
} else {
Index: udev.spec
===================================================================
RCS file: /cvs/pkgs/rpms/udev/devel/udev.spec,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -p -r1.293 -r1.294
--- udev.spec 25 Sep 2009 17:05:23 -0000 1.293
+++ udev.spec 29 Sep 2009 13:09:11 -0000 1.294
@@ -5,7 +5,7 @@
Summary: A userspace implementation of devfs
Name: udev
Version: 145
-Release: 9%{?dist}
+Release: 10%{?dist}
License: GPLv2
Group: System Environment/Base
Provides: udev-persistent = %{version}-%{release}
@@ -19,7 +19,7 @@ Patch2: 0002-udevd-add-timestamp-to-debu
Patch3: 0003-fix-wrong-parameter-size-on-ioctl-FIONREAD.patch
Patch4: 0004-fix-single-session-CD-detection.patch
Patch5: 0005-fix-previous-commit-for-CD-detection.patch
-
+Patch6: ck-runseat.patch
Source1: start_udev
Source3: udev-post.init
@@ -106,6 +106,7 @@ glib-based applications using libudev fu
%patch3 -p1
%patch4 -p1
%patch5 -p1
+%patch6 -p1 -b .ck041
%build
# get rid of rpath
@@ -323,7 +324,7 @@ rm -rf $RPM_BUILD_ROOT
%attr(0755,root,root) %{udev_scriptdir}/v4l_id
%attr(0755,root,root) %{udev_scriptdir}/findkeyboards
%attr(0644,root,root) %{udev_scriptdir}/keymaps/*
-%attr(0644,root,root) %{_prefix}/lib/ConsoleKit/run-session.d/udev-acl.ck
+%attr(0644,root,root) %{_prefix}/lib/ConsoleKit/run-seat.d/udev-acl.ck
%files -n libudev
@@ -357,6 +358,9 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0*
%changelog
+* Tue Sep 29 2009 Harald Hoyer <harald at redhat.com> 145-10
+- add ConsoleKit patch for ConsoleKit 0.4.1
+
* Fri Sep 25 2009 harald at redhat.com 145-9
- add patches to fix cdrom_id
- add patch to fix the inotify bug (bug #524752)
- Previous message (by thread): rpms/sparse/devel .cvsignore, 1.7, 1.8 sources, 1.7, 1.8 sparse.spec, 1.12, 1.13
- Next message (by thread): rpms/python-qpid/F-12 python-qpid.spec,1.31,1.32 sources,1.21,1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list