mirror of
https://github.com/systemd/systemd.git
synced 2025-01-25 10:04:04 +03:00
Merge pull request #19722 from poettering/empty-string-loginctl-man
document that "loginctl kill-session" takes an empty string + add the same for per-user stuff
This commit is contained in:
commit
93f235e8d8
@ -113,18 +113,18 @@
|
||||
<varlistentry>
|
||||
<term><command>terminate-session</command> <replaceable>ID</replaceable>…</term>
|
||||
|
||||
<listitem><para>Terminates a session. This kills all processes
|
||||
of the session and deallocates all resources attached to the
|
||||
session. </para></listitem>
|
||||
<listitem><para>Terminates a session. This kills all processes of the session and deallocates all
|
||||
resources attached to the session. If the argument is specified as empty string the session invoking
|
||||
the command is terminated.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command>kill-session</command> <replaceable>ID</replaceable>…</term>
|
||||
|
||||
<listitem><para>Send a signal to one or more processes of the
|
||||
session. Use <option>--kill-who=</option> to select which
|
||||
process to kill. Use <option>--signal=</option> to select the
|
||||
signal to send.</para></listitem>
|
||||
<listitem><para>Send a signal to one or more processes of the session. Use
|
||||
<option>--kill-who=</option> to select which process to kill. Use <option>--signal=</option> to
|
||||
select the signal to send. If the argument is specified as empty string the signal is sent to the
|
||||
session invoking the command.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist></refsect2>
|
||||
|
||||
@ -184,17 +184,17 @@
|
||||
<varlistentry>
|
||||
<term><command>terminate-user</command> <replaceable>USER</replaceable>…</term>
|
||||
|
||||
<listitem><para>Terminates all sessions of a user. This kills
|
||||
all processes of all sessions of the user and deallocates all
|
||||
runtime resources attached to the user.</para></listitem>
|
||||
<listitem><para>Terminates all sessions of a user. This kills all processes of all sessions of the
|
||||
user and deallocates all runtime resources attached to the user. If the argument is specified as
|
||||
empty string the sessions of the user invoking the command are terminated.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command>kill-user</command> <replaceable>USER</replaceable>…</term>
|
||||
|
||||
<listitem><para>Send a signal to all processes of a user. Use
|
||||
<option>--signal=</option> to select the signal to send.
|
||||
</para></listitem>
|
||||
<listitem><para>Send a signal to all processes of a user. Use <option>--signal=</option> to select
|
||||
the signal to send. If the argument is specified as empty string the signal is sent to the sessions
|
||||
of the user invoking the command.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist></refsect2>
|
||||
|
||||
|
@ -1086,9 +1086,15 @@ static int terminate_user(int argc, char *argv[], void *userdata) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
uid_t uid;
|
||||
|
||||
r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
|
||||
if (isempty(argv[i]))
|
||||
uid = getuid();
|
||||
else {
|
||||
const char *u = argv[i];
|
||||
|
||||
r = get_user_creds(&u, &uid, NULL, NULL, NULL, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
|
||||
}
|
||||
|
||||
r = bus_call_method(bus, bus_login_mgr, "TerminateUser", &error, NULL, "u", (uint32_t) uid);
|
||||
if (r < 0)
|
||||
@ -1114,9 +1120,15 @@ static int kill_user(int argc, char *argv[], void *userdata) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
uid_t uid;
|
||||
|
||||
r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
|
||||
if (isempty(argv[i]))
|
||||
uid = getuid();
|
||||
else {
|
||||
const char *u = argv[i];
|
||||
|
||||
r = get_user_creds(&u, &uid, NULL, NULL, NULL, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
|
||||
}
|
||||
|
||||
r = bus_call_method(
|
||||
bus,
|
||||
|
Loading…
x
Reference in New Issue
Block a user