*/
#include "libbb.h"
+#if CONFIG_LAST_SYSTEM_ID < CONFIG_FIRST_SYSTEM_ID
+#error Bad LAST_SYSTEM_ID or FIRST_SYSTEM_ID in .config
+#endif
+
/* #define OPT_HOME (1 << 0) */ /* unused */
/* #define OPT_GECOS (1 << 1) */ /* unused */
#define OPT_SHELL (1 << 2)
if (!(option_mask32 & OPT_UID)) {
if (option_mask32 & OPT_SYSTEM_ACCOUNT) {
- p->pw_uid = 100; /* FIRST_SYSTEM_UID */
- max = 999; /* LAST_SYSTEM_UID */
+ p->pw_uid = CONFIG_FIRST_SYSTEM_ID;
+ max = CONFIG_LAST_SYSTEM_ID;
} else {
- p->pw_uid = 1000; /* FIRST_UID */
- max = 64999; /* LAST_UID */
+ p->pw_uid = CONFIG_LAST_SYSTEM_ID + 1;
+ max = 64999;
}
}
/* check for a free uid (and maybe gid) */
free(p);
#if ENABLE_FEATURE_SHADOWPASSWDS
- p = xasprintf("!:%u:0:99999:7:::", (unsigned)(time(NULL) / 86400)); /* sp->sp_lstchg */
+ /* /etc/shadow fields:
+ * 1. username
+ * 2. encrypted password
+ * 3. last password change (unix date (unix time/24*60*60))
+ * 4. minimum days required between password changes
+ * 5. maximum days password is valid
+ * 6. days before password is to expire that user is warned
+ * 7. days after password expires that account is disabled
+ * 8. unix date when login expires (i.e. when it may no longer be used)
+ */
+ /* fields: 2 3 4 5 6 78 */
+ p = xasprintf("!:%u:0:99999:7:::", (unsigned)(time(NULL)) / (24*60*60));
/* ignore errors: if file is missing we suppose admin doesn't want it */
update_passwd(bb_path_shadow_file, pw.pw_name, p, NULL);
if (ENABLE_FEATURE_CLEAN_UP)