[systemd-commits] 2 commits - TODO src/login
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Apr 9 13:20:11 PDT 2013
TODO | 17 ++++++++---------
src/login/logind-dbus.c | 38 ++++++++++++++++++++++++++++++--------
src/login/logind-session.c | 3 ++-
src/login/logind-session.h | 17 +++++++++--------
src/login/pam-module.c | 9 +++++----
5 files changed, 54 insertions(+), 30 deletions(-)
New commits:
commit b8b4d3dddc7611dce3bf28004b0375d661120c62
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Apr 9 22:20:05 2013 +0200
update TODO
diff --git a/TODO b/TODO
index 421f0ea..369fb78 100644
--- a/TODO
+++ b/TODO
@@ -14,18 +14,12 @@ Bugfixes:
* properly handle .mount unit state tracking when two mount points are stacked one on top of another on the exact same mount point.
-* add 'set -e' to scripts in test/
-* make test in test/ work with separate output dir
-
-* suppress log output on shutdown when "quiet" is used
-
-* systemctl delete x.snapshot leaves no trace in logs (at least at default level).
-
Fedora 19:
* fix match logic to add another level of disjunction/conjunction
* make anaconda write timeout=0 for encrypted devices
+ https://bugzilla.redhat.com/show_bug.cgi?id=861123
* external: maybe it is time to patch procps so that "ps" links to
libsystemd-logind to print a pretty service name, seat name, session
@@ -38,8 +32,6 @@ Fedora 19:
* localed:
- localectl: support new converted x11âconsole keymaps
-* logind: Class property should probably know "background" or so as value for cron jobs, and the inhibition checks should filter those out too.
-
* timer logic is confused by units which are skipped due to failing condition
http://lists.freedesktop.org/archives/systemd-devel/2013-February/008816.html
@@ -48,6 +40,13 @@ Fedora 19:
Features:
+* add 'set -e' to scripts in test/
+* make test in test/ work with separate output dir
+
+* suppress log output on shutdown when "quiet" is used
+
+* systemctl delete x.snapshot leaves no trace in logs (at least at default level).
+
* make the coredump collector tool move itself into the user's cgroup
so that the coredump is properly written to the user's own journal
file.
commit e2acb67baaa1d63685dcaf80becf10291f13d086
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Apr 9 22:18:16 2013 +0200
logind: introduce an explicit session class for cronjobs and similar
cronjobs are neither interactive user session, nor lock screens, nor
login screens, hence they should get their own class.
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index aa212d1..230dd2b 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -353,21 +353,28 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
return -EINVAL;
dbus_message_iter_get_basic(&iter, &type);
- t = session_type_from_string(type);
+ if (isempty(type))
+ t = _SESSION_TYPE_INVALID;
+ else {
+ t = session_type_from_string(type);
+ if (t < 0)
+ return -EINVAL;
+ }
- if (t < 0 ||
- !dbus_message_iter_next(&iter) ||
+ if (!dbus_message_iter_next(&iter) ||
dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
return -EINVAL;
dbus_message_iter_get_basic(&iter, &class);
if (isempty(class))
- c = SESSION_USER;
- else
+ c = _SESSION_CLASS_INVALID;
+ else {
c = session_class_from_string(class);
+ if (c < 0)
+ return -EINVAL;
+ }
- if (c < 0 ||
- !dbus_message_iter_next(&iter) ||
+ if (!dbus_message_iter_next(&iter) ||
dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
return -EINVAL;
@@ -441,6 +448,22 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_BOOLEAN)
return -EINVAL;
+ if (t == _SESSION_TYPE_INVALID) {
+ if (!isempty(display))
+ t = SESSION_X11;
+ else if (!isempty(tty))
+ t = SESSION_TTY;
+ else
+ t = SESSION_UNSPECIFIED;
+ }
+
+ if (c == _SESSION_CLASS_INVALID) {
+ if (!isempty(display) || !isempty(tty))
+ c = SESSION_USER;
+ else
+ c = SESSION_BACKGROUND;
+ }
+
dbus_message_iter_get_basic(&iter, &remote);
if (!dbus_message_iter_next(&iter) ||
@@ -993,7 +1016,6 @@ static int have_multiple_sessions(
* count, and non-login sessions do not count either. */
HASHMAP_FOREACH(session, m->sessions, i)
if (session->class == SESSION_USER &&
- (session->type == SESSION_TTY || session->type == SESSION_X11) &&
session->user->uid != uid)
return true;
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 97c24d0..508336d 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -1056,7 +1056,8 @@ DEFINE_STRING_TABLE_LOOKUP(session_type, SessionType);
static const char* const session_class_table[_SESSION_CLASS_MAX] = {
[SESSION_USER] = "user",
[SESSION_GREETER] = "greeter",
- [SESSION_LOCK_SCREEN] = "lock-screen"
+ [SESSION_LOCK_SCREEN] = "lock-screen",
+ [SESSION_BACKGROUND] = "background"
};
DEFINE_STRING_TABLE_LOOKUP(session_class, SessionClass);
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index 7598afa..c8dd181 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -37,22 +37,23 @@ typedef enum SessionState {
_SESSION_STATE_INVALID = -1
} SessionState;
-typedef enum SessionType {
- SESSION_UNSPECIFIED,
- SESSION_TTY,
- SESSION_X11,
- _SESSION_TYPE_MAX,
- _SESSION_TYPE_INVALID = -1
-} SessionType;
-
typedef enum SessionClass {
SESSION_USER,
SESSION_GREETER,
SESSION_LOCK_SCREEN,
+ SESSION_BACKGROUND,
_SESSION_CLASS_MAX,
_SESSION_CLASS_INVALID = -1
} SessionClass;
+typedef enum SessionType {
+ SESSION_UNSPECIFIED,
+ SESSION_TTY,
+ SESSION_X11,
+ _SESSION_TYPE_MAX,
+ _SESSION_TYPE_INVALID = -1
+} SessionType;
+
typedef enum KillWho {
KILL_LEADER,
KILL_ALL,
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index c8f4dae..609317e 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -440,9 +440,10 @@ _public_ PAM_EXTERN int pam_sm_open_session(
seat = strempty(seat);
if (strchr(tty, ':')) {
- /* A tty with a colon is usually an X11 display, place
- * there to show up in utmp. We rearrange things and
- * don't pretend that an X display was a tty */
+ /* A tty with a colon is usually an X11 display,
+ * placed there to show up in utmp. We rearrange
+ * things and don't pretend that an X display was a
+ * tty. */
if (isempty(display))
display = tty;
@@ -482,7 +483,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
if (isempty(class))
class = class_pam;
if (isempty(class))
- class = "user";
+ class = streq(type, "unspecified") ? "background" : "user";
remote = !isempty(remote_host) &&
!streq(remote_host, "localhost") &&
More information about the systemd-commits
mailing list