[systemd-commits] src/login

Lennart Poettering lennart at kemper.freedesktop.org
Wed Aug 13 18:00:32 PDT 2014


 src/login/logind-session.c |    1 +
 src/login/logind-session.h |    1 +
 src/login/logind-user.c    |   21 +++++++++++++++++----
 3 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit e9e74f28d783a052dce7edfa94d7918bb591ba7a
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Aug 14 02:59:02 2014 +0200

    logind: add new session type "web" for PAM web clients, such as cockpit
    
    On request of Stef Walter.

diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index feedc30..9d05faf 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -1159,6 +1159,7 @@ static const char* const session_type_table[_SESSION_TYPE_MAX] = {
         [SESSION_X11] = "x11",
         [SESSION_WAYLAND] = "wayland",
         [SESSION_MIR] = "mir",
+        [SESSION_WEB] = "web",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(session_type, SessionType);
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index cb8514e..9fb0188 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -56,6 +56,7 @@ typedef enum SessionType {
         SESSION_X11,
         SESSION_WAYLAND,
         SESSION_MIR,
+        SESSION_WEB,
         _SESSION_TYPE_MAX,
         _SESSION_TYPE_INVALID = -1
 } SessionType;
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index fdbccb3..d48eca4 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -714,7 +714,7 @@ int user_kill(User *u, int signo) {
 }
 
 void user_elect_display(User *u) {
-        Session *graphical = NULL, *text = NULL, *s;
+        Session *graphical = NULL, *text = NULL, *other = NULL, *s;
 
         assert(u);
 
@@ -732,22 +732,35 @@ void user_elect_display(User *u) {
 
                 if (SESSION_TYPE_IS_GRAPHICAL(s->type))
                         graphical = s;
-                else
+                else if (s->type == SESSION_TTY)
                         text = s;
+                else
+                        other = s;
         }
 
         if (graphical &&
             (!u->display ||
              u->display->class != SESSION_USER ||
              u->display->stopping ||
-             !SESSION_TYPE_IS_GRAPHICAL(u->display->type)))
+             !SESSION_TYPE_IS_GRAPHICAL(u->display->type))) {
                 u->display = graphical;
+                return;
+        }
 
         if (text &&
             (!u->display ||
              u->display->class != SESSION_USER ||
-             u->display->stopping))
+             u->display->stopping ||
+             u->display->type != SESSION_TTY)) {
                 u->display = text;
+                return;
+        }
+
+        if (other &&
+            (!u->display ||
+             u->display->class != SESSION_USER ||
+             u->display->stopping))
+                u->display = other;
 }
 
 static const char* const user_state_table[_USER_STATE_MAX] = {



More information about the systemd-commits mailing list