return PAM_USER_UNKNOWN;
}
+ if (!uid_is_valid(ur->uid)) {
+ pam_syslog_errno(handle, LOG_ERR, r, "User record of user '%s' has no UID, refusing: %m", username);
+ return PAM_USER_UNKNOWN;
+ }
+
r = sd_json_variant_format(ur->json, 0, &formatted);
if (r < 0)
return pam_syslog_errno(handle, LOG_ERR, r, "Failed to format user JSON: %m");
* UID is safer. */
if (user_record_is_root(u))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Mapping 'root' user not supported, sorry.");
+
if (user_record_is_nobody(u))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Mapping 'nobody' user not supported, sorry.");
+ if (!uid_is_valid(u->uid))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Cannot bind user with no UID, refusing.");
+
if (u->uid >= uid_shift && u->uid < uid_shift + uid_range)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "UID of user '%s' to map is already in container UID range, refusing.", u->user_name);