]> err.no Git - systemd/commitdiff
login: assing /dev/console logins to seat0
authorLennart Poettering <lennart@poettering.net>
Sun, 22 Apr 2012 00:30:13 +0000 (02:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Sun, 22 Apr 2012 00:41:18 +0000 (02:41 +0200)
src/login/logind-dbus.c
src/shared/util.c
src/shared/util.h

index b8143b61797c01b3c6d7c5d8df750ac9d83a1ae1..3fe6c872b7f79d5229f99a7a426bf1976f2aca9e 100644 (file)
@@ -351,16 +351,25 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
                         vtnr = (uint32_t) v;
                 else if (vtnr != (uint32_t) v)
                         return -EINVAL;
+        } else if (tty_is_console(tty)) {
+
+                if (!s)
+                        s = m->vtconsole;
+                else if (s != m->vtconsole)
+                        return -EINVAL;
+
+                if (vtnr != 0)
+                        return -EINVAL;
 
         } else if (!isempty(tty) && s && seat_is_vtconsole(s))
                 return -EINVAL;
 
         if (s) {
                 if (seat_can_multi_session(s)) {
-                        if (vtnr <= 0 || vtnr > 63)
+                        if (vtnr > 63)
                                 return -EINVAL;
                 } else {
-                        if (vtnr > 0)
+                        if (vtnr != 0)
                                 return -EINVAL;
                 }
         }
index 43948ccbd8970c5076d2f00659d26f2d449fa4ce..def576de2130981cbc51ea64b74e2397f996949d 100644 (file)
@@ -4287,6 +4287,15 @@ bool tty_is_vc(const char *tty) {
         return vtnr_from_tty(tty) >= 0;
 }
 
+bool tty_is_console(const char *tty) {
+        assert(tty);
+
+        if (startswith(tty, "/dev/"))
+                tty += 5;
+
+        return streq(tty, "console");
+}
+
 int vtnr_from_tty(const char *tty) {
         int i, r;
 
index 76bc7b3572ee94d2f1a3356d1beacd10ab577a9c..35ba0057d6783bfd80eee30f8d7fea786d60de89 100644 (file)
@@ -415,6 +415,7 @@ char *fstab_node_to_udev_node(const char *p);
 
 bool tty_is_vc(const char *tty);
 bool tty_is_vc_resolve(const char *tty);
+bool tty_is_console(const char *tty);
 int vtnr_from_tty(const char *tty);
 const char *default_term_for_tty(const char *tty);