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:
Luca Boccassi
2021-05-25 23:23:42 +01:00
committed by GitHub
2 changed files with 31 additions and 19 deletions
+18 -6
View File
@@ -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,