chiark / gitweb /
logind: add new session type "web" for PAM web clients, such as cockpit
authorLennart Poettering <lennart@poettering.net>
Thu, 14 Aug 2014 00:59:02 +0000 (02:59 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 Aug 2014 01:00:24 +0000 (03:00 +0200)
On request of Stef Walter.

src/login/logind-session.c
src/login/logind-session.h
src/login/logind-user.c

index feedc30fa6142fa8fefc7b208447ba32ef2aba77..9d05faf47ceab9aa60cb99b84aaa967d867e6333 100644 (file)
@@ -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);
index cb8514e580b9d3e3dd2bc173a69f6b2382d82f06..9fb0188a8478ee16086e2622c61f4a38246b18b2 100644 (file)
@@ -56,6 +56,7 @@ typedef enum SessionType {
         SESSION_X11,
         SESSION_WAYLAND,
         SESSION_MIR,
+        SESSION_WEB,
         _SESSION_TYPE_MAX,
         _SESSION_TYPE_INVALID = -1
 } SessionType;
index fdbccb364c1814f45d07249253c9107b8bbee8c7..d48eca47f034607fcaa5cde8320f53c92daa7cc2 100644 (file)
@@ -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] = {