.pw_passwd = (char*) "x",
/* We default to the root directory as home */
- .pw_dir = i->home ? i->home : (char*) "/",
+ .pw_dir = i->home ?: (char*) "/",
/* Initialize the shell to nologin, with one exception:
* for root we patch in something special */
ORDERED_HASHMAP_FOREACH(i, todo_uids, iterator) {
struct spwd n = {
.sp_namp = i->name,
- .sp_pwdp = (char*) "!!",
+ .sp_pwdp = (char*) "!!", /* lock this password, and make it invalid */
.sp_lstchg = lstchg,
.sp_min = -1,
.sp_max = -1,
.sp_warn = -1,
.sp_inact = -1,
- .sp_expire = -1,
+ .sp_expire = i->uid == 0 ? -1 : 1, /* lock account as a whole, unless this is root */
.sp_flag = (unsigned long) -1, /* this appears to be what everybody does ... */
};