[systemd-commits] 2 commits - TODO man/loginctl.xml src/login

Lennart Poettering lennart at kemper.freedesktop.org
Fri Jan 9 12:32:38 PST 2015


 TODO                 |   13 ++++++++++---
 man/loginctl.xml     |   30 +++++++++++++++++++++---------
 src/login/loginctl.c |   44 +++++++++++++++++++++++++++++++-------------
 3 files changed, 62 insertions(+), 25 deletions(-)

New commits:
commit fa607802f332e06f4044c3eb38dbea41076c803d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jan 9 21:32:29 2015 +0100

    update TODO

diff --git a/TODO b/TODO
index 90c321c..5b742b0 100644
--- a/TODO
+++ b/TODO
@@ -45,13 +45,19 @@ Release 219 preparations:
 
 Features:
 
-* nspawn should lock container images while running off them
+* bus-proxy: reload policy when PID 1 reports a reload
+
+* the dbus1 connection user id is actually the euid, not the uid, and creds should return that
+
+* add minimal NAT logic to networkd and nspawn. The former should be a simple NAT=yes|no|ipv4|ipv6 and expose a network on all other interfaces as NAT. The latter should get a "--port=" switch or so, which forwards one host port onto the container
 
-* when invoking "loginctl session-status" default to callers session
+* introduce systemd-nspawn-ephemeral at .service, and hook it into "machinectl start" with a new --ephemeral switch
+
+* nspawn should lock container images while running off them
 
 * logind,machined: add generic catch-all polkit verbs for most priviliged operations, similar to systemd itself
 
-* "machinectl status" should also show logs of the container in question
+* "machinectl status" should also show internal logs of the container in question
 
 * nspawn: don't change superblock mount options from nspawn for cgroup hierarchies
 
@@ -340,6 +346,7 @@ Features:
   ReadOnlyDirectories=... for whitelisting files for a service.
 
 * sd-bus:
+  - GetAllProperties() on a non-existing object does not result in a failure currently
   - kdbus: process fd=-1 for incoming msgs
   - make dsrt happy, and change userspace header for kdbus to yyyyuta{tv}v
   - port to sd-resolve for connecting to TCP dbus servers

commit 906b76b27be410af25aa7f79b4cfdb35f7f32fc7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jan 9 21:30:39 2015 +0100

    loginctl: make session/user arguments optional for a number commands, and imply calling session/user instead
    
    This turns "lock-session", "activate", "unlock-session",
    "enable-linger", "disable-linger" into commands that take no argument,
    optionally in which case the callers session/user is implied.

diff --git a/man/loginctl.xml b/man/loginctl.xml
index 8056310..5dd64e7 100644
--- a/man/loginctl.xml
+++ b/man/loginctl.xml
@@ -250,22 +250,30 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term><command>activate</command> <replaceable>ID</replaceable></term>
+                                <term><command>activate</command> <optional><replaceable>ID</replaceable></optional></term>
 
                                 <listitem><para>Activate a
                                 session. This brings a session into
                                 the foreground, if another session is
                                 currently in the foreground on the
-                                respective seat.</para></listitem>
+                                respective seat. Takes a session
+                                identifier as argument. If no argument
+                                is specified the session of the caller
+                                is put into
+                                foreground.</para></listitem>
                         </varlistentry>
 
                         <varlistentry>
-                                <term><command>lock-session</command> <replaceable>ID</replaceable>...</term>
-                                <term><command>unlock-session</command> <replaceable>ID</replaceable>...</term>
+                                <term><command>lock-session</command> <optional><replaceable>ID</replaceable>...</optional></term>
+                                <term><command>unlock-session</command> <optional><replaceable>ID</replaceable>...</optional></term>
 
                                 <listitem><para>Activates/deactivates
                                 the screen lock on one or more
-                                sessions, if the session supports it.
+                                sessions, if the session supports
+                                it. Takes one or more session
+                                identifiers as arguments. If no
+                                argument is specified the session of
+                                the caller is locked/unlocked.
                                 </para></listitem>
                         </varlistentry>
 
@@ -353,8 +361,8 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term><command>enable-linger</command> <replaceable>USER</replaceable>...</term>
-                                <term><command>disable-linger</command> <replaceable>USER</replaceable>...</term>
+                                <term><command>enable-linger</command> <optional><replaceable>USER</replaceable>...</optional></term>
+                                <term><command>disable-linger</command> <optional><replaceable>USER</replaceable>...</optional></term>
 
                                 <listitem><para>Enable/disable user
                                 lingering for one or more users. If
@@ -363,7 +371,11 @@
                                 boot and kept around after
                                 logouts. This allows users who are not
                                 logged in to run long-running
-                                services.</para></listitem>
+                                services. Takes one or more user names
+                                or numeric UIDs as argument. If no
+                                argument is specified enables/disables
+                                lingering for the user of the session
+                                of the caller.</para></listitem>
                         </varlistentry>
 
                         <varlistentry>
@@ -413,7 +425,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term><command>show-seat</command> <replaceable>NAME</replaceable>...</term>
+                                <term><command>show-seat</command> <optional><replaceable>NAME</replaceable>...</optional></term>
 
                                 <listitem><para>Show properties of one
                                 or more seats or the manager
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index c62ae32..064411e 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -853,6 +853,15 @@ static int activate(int argc, char *argv[], void *userdata) {
 
         polkit_agent_open_if_enabled();
 
+        if (argc < 2) {
+                /* No argument? Let's convert this into the empty
+                 * session name, which the calls will then resolve to
+                 * the caller's session. */
+
+                argv = STRV_MAKE(argv[0], "");
+                argc = 2;
+        }
+
         for (i = 1; i < argc; i++) {
 
                 r = sd_bus_call_method (
@@ -920,12 +929,21 @@ static int enable_linger(int argc, char *argv[], void *userdata) {
 
         b = streq(argv[0], "enable-linger");
 
+        if (argc < 2) {
+                argv = STRV_MAKE(argv[0], "");
+                argc = 2;
+        }
+
         for (i = 1; i < argc; i++) {
                 uid_t uid;
 
-                r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL);
-                if (r < 0)
-                        return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
+                if (isempty(argv[i]))
+                        uid = UID_INVALID;
+                else {
+                        r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL);
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
+                }
 
                 r = sd_bus_call_method (
                         bus,
@@ -1145,9 +1163,9 @@ static int help(int argc, char *argv[], void *userdata) {
                "  list-sessions            List sessions\n"
                "  session-status [ID...]   Show session status\n"
                "  show-session [ID...]     Show properties of sessions or the manager\n"
-               "  activate ID              Activate a session\n"
-               "  lock-session ID...       Screen lock one or more sessions\n"
-               "  unlock-session ID...     Screen unlock one or more sessions\n"
+               "  activate [ID]            Activate a session\n"
+               "  lock-session [ID...]     Screen lock one or more sessions\n"
+               "  unlock-session [ID...]   Screen unlock one or more sessions\n"
                "  lock-sessions            Screen lock all current sessions\n"
                "  unlock-sessions          Screen unlock all current sessions\n"
                "  terminate-session ID...  Terminate one or more sessions\n"
@@ -1156,8 +1174,8 @@ static int help(int argc, char *argv[], void *userdata) {
                "  list-users               List users\n"
                "  user-status [USER...]    Show user status\n"
                "  show-user [USER...]      Show properties of users or the manager\n"
-               "  enable-linger USER...    Enable linger state of one or more users\n"
-               "  disable-linger USER...   Disable linger state of one or more users\n"
+               "  enable-linger [USER...]  Enable linger state of one or more users\n"
+               "  disable-linger [USER...] Disable linger state of one or more users\n"
                "  terminate-user USER...   Terminate all sessions of one or more users\n"
                "  kill-user USER...        Send signal to processes of a user\n\n"
                "Seat Commands:\n"
@@ -1304,9 +1322,9 @@ static int loginctl_main(int argc, char *argv[], sd_bus *bus) {
                 { "list-sessions",     VERB_ANY, 1,        VERB_DEFAULT, list_sessions     },
                 { "session-status",    VERB_ANY, VERB_ANY, 0,            show_session      },
                 { "show-session",      VERB_ANY, VERB_ANY, 0,            show_session      },
-                { "activate",          2,        2,        0,            activate          },
-                { "lock-session",      2,        VERB_ANY, 0,            activate          },
-                { "unlock-session",    2,        VERB_ANY, 0,            activate          },
+                { "activate",          VERB_ANY, 2,        0,            activate          },
+                { "lock-session",      VERB_ANY, VERB_ANY, 0,            activate          },
+                { "unlock-session",    VERB_ANY, VERB_ANY, 0,            activate          },
                 { "lock-sessions",     VERB_ANY, 1,        0,            lock_sessions     },
                 { "unlock-sessions",   VERB_ANY, 1,        0,            lock_sessions     },
                 { "terminate-session", 2,        VERB_ANY, 0,            activate          },
@@ -1314,8 +1332,8 @@ static int loginctl_main(int argc, char *argv[], sd_bus *bus) {
                 { "list-users",        VERB_ANY, 1,        0,            list_users        },
                 { "user-status",       VERB_ANY, VERB_ANY, 0,            show_user         },
                 { "show-user",         VERB_ANY, VERB_ANY, 0,            show_user         },
-                { "enable-linger",     2,        VERB_ANY, 0,            enable_linger     },
-                { "disable-linger",    2,        VERB_ANY, 0,            enable_linger     },
+                { "enable-linger",     VERB_ANY, VERB_ANY, 0,            enable_linger     },
+                { "disable-linger",    VERB_ANY, VERB_ANY, 0,            enable_linger     },
                 { "terminate-user",    2,        VERB_ANY, 0,            terminate_user    },
                 { "kill-user",         2,        VERB_ANY, 0,            kill_user         },
                 { "list-seats",        VERB_ANY, 1,        0,            list_seats        },



More information about the systemd-commits mailing list