mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
user-util: add UID_NOBODY defines that resolve to (uid_t) 65534
We use it all over the place, let's add a #define for it. Makes things easier greppable, and more explanatory I think.
This commit is contained in:
parent
8343827793
commit
3a664727fa
@ -60,6 +60,9 @@ int take_etc_passwd_lock(const char *root);
|
||||
#define UID_INVALID ((uid_t) -1)
|
||||
#define GID_INVALID ((gid_t) -1)
|
||||
|
||||
#define UID_NOBODY ((uid_t) 65534U)
|
||||
#define GID_NOBODY ((gid_t) 65534U)
|
||||
|
||||
static inline bool uid_is_dynamic(uid_t uid) {
|
||||
return DYNAMIC_UID_MIN <= uid && uid <= DYNAMIC_UID_MAX;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "string-table.h"
|
||||
#include "terminal-util.h"
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
Machine* machine_new(Manager *manager, MachineClass class, const char *name) {
|
||||
@ -656,7 +657,7 @@ int machine_get_uid_shift(Machine *m, uid_t *ret) {
|
||||
if (uid_base != 0)
|
||||
return -ENXIO;
|
||||
/* Insist that at least the nobody user is mapped, everything else is weird, and hence complex, and we don't support it */
|
||||
if (uid_range < (uid_t) 65534U)
|
||||
if (uid_range < UID_NOBODY)
|
||||
return -ENXIO;
|
||||
|
||||
/* If there's more than one line, then we don't support this mapping. */
|
||||
|
@ -480,7 +480,7 @@ enum nss_status _nss_mymachines_getpwnam_r(
|
||||
|
||||
pwd->pw_name = buffer;
|
||||
pwd->pw_uid = mapped;
|
||||
pwd->pw_gid = 65534; /* nobody */
|
||||
pwd->pw_gid = GID_NOBODY;
|
||||
pwd->pw_gecos = buffer;
|
||||
pwd->pw_passwd = (char*) "*"; /* locked */
|
||||
pwd->pw_dir = (char*) "/";
|
||||
@ -557,7 +557,7 @@ enum nss_status _nss_mymachines_getpwuid_r(
|
||||
|
||||
pwd->pw_name = buffer;
|
||||
pwd->pw_uid = uid;
|
||||
pwd->pw_gid = 65534; /* nobody */
|
||||
pwd->pw_gid = GID_NOBODY;
|
||||
pwd->pw_gecos = buffer;
|
||||
pwd->pw_passwd = (char*) "*"; /* locked */
|
||||
pwd->pw_dir = (char*) "/";
|
||||
|
@ -47,8 +47,8 @@ static const struct passwd root_passwd = {
|
||||
static const struct passwd nobody_passwd = {
|
||||
.pw_name = (char*) NOBODY_USER_NAME,
|
||||
.pw_passwd = (char*) "*", /* locked */
|
||||
.pw_uid = 65534,
|
||||
.pw_gid = 65534,
|
||||
.pw_uid = UID_NOBODY,
|
||||
.pw_gid = GID_NOBODY,
|
||||
.pw_gecos = (char*) "User Nobody",
|
||||
.pw_dir = (char*) "/",
|
||||
.pw_shell = (char*) "/sbin/nologin",
|
||||
@ -63,7 +63,7 @@ static const struct group root_group = {
|
||||
|
||||
static const struct group nobody_group = {
|
||||
.gr_name = (char*) NOBODY_GROUP_NAME,
|
||||
.gr_gid = 65534,
|
||||
.gr_gid = GID_NOBODY,
|
||||
.gr_passwd = (char*) "*", /* locked */
|
||||
.gr_mem = (char*[]) { NULL },
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user