core: improve messages about unknown users and groups
$ sudo build/systemd-run --uid=asdf whoami $ journalctl -e (whoami)[1007784]: run-p1007782-i5200512.service: Failed to determine user credentials: No such process (whoami)[1007784]: run-p1007782-i5200512.service: Failed at step USER spawning /usr/sbin/whoami: No such process systemd[1]: run-p1007782-i5200512.service: Main process exited, code=exited, status=217/USER systemd[1]: run-p1007782-i5200512.service: Failed with result 'exit-code'. Now: (whoami)[1013204]: run-p1013202-i5205932.service: Failed to determine credentials for user 'asdf': Unknown user (whoami)[1013204]: run-p1013202-i5205932.service: Failed at step USER spawning /usr/sbin/whoami: Invalid argument systemd[1]: run-p1013202-i5205932.service: Main process exited, code=exited, status=217/USER systemd[1]: run-p1013202-i5205932.service: Failed with result 'exit-code'.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <shadow.h>
|
||||
|
||||
#include "basic-forward.h"
|
||||
#include "errno-util.h"
|
||||
|
||||
/* Users managed by systemd-homed. See https://systemd.io/UIDS-GIDS for details
|
||||
* how this range fits into the rest of the world. */
|
||||
@@ -25,6 +26,13 @@
|
||||
#define STRERROR_USER(errnum) ((errnum) == -ESRCH ? "Unknown user" : (errnum) == -ENOEXEC ? "Not a system user" : STRERROR(errnum))
|
||||
#define STRERROR_GROUP(errnum) ((errnum) == -ESRCH ? "Unknown group" : (errnum) == -ENOEXEC ? "Not a system group" : STRERROR(errnum))
|
||||
|
||||
static inline bool ERRNO_IS_NEG_BAD_ACCOUNT(intmax_t r) {
|
||||
return IN_SET(r,
|
||||
-ESRCH,
|
||||
-ENOEXEC);
|
||||
}
|
||||
_DEFINE_ABS_WRAPPER(BAD_ACCOUNT);
|
||||
|
||||
bool uid_is_valid(uid_t uid) _const_;
|
||||
|
||||
static inline bool gid_is_valid(gid_t gid) {
|
||||
|
||||
Reference in New Issue
Block a user