# primary group.
#
#GRANT_AUX_GROUP_SUBIDS yes
+
+#
+# Prevents an empty password field to be interpreted as "no authentication
+# required".
+# Set to "yes" to prevent for all accounts
+# Set to "superuser" to prevent for UID 0 / root (default)
+# Set to "no" to not prevent for any account (dangerous, historical default)
+
+PREVENT_NO_AUTH superuser
#endif
{"FORCE_SHADOW", NULL},
{"GRANT_AUX_GROUP_SUBIDS", NULL},
+ {"PREVENT_NO_AUTH", NULL},
{NULL, NULL}
};
|| ('*' == user_passwd[0])) {
failed = true;
}
+
+ if (strcmp (user_passwd, "") == 0) {
+ char *prevent_no_auth = getdef_str("PREVENT_NO_AUTH");
+ if(prevent_no_auth == NULL) {
+ prevent_no_auth = "superuser";
+ }
+ if(strcmp(prevent_no_auth, "yes") == 0) {
+ failed = true;
+ } else if( (pwd->pw_uid == 0)
+ && (strcmp(prevent_no_auth, "superuser") == 0)) {
+ failed = true;
+ }
+ }
}
if (strcmp (user_passwd, SHADOW_PASSWD_STRING) == 0) {
return;
}
+ if (strcmp (pw->pw_passwd, "") == 0) {
+ char *prevent_no_auth = getdef_str("PREVENT_NO_AUTH");
+ if(prevent_no_auth == NULL) {
+ prevent_no_auth = "superuser";
+ }
+ if(strcmp(prevent_no_auth, "yes") == 0) {
+ fprintf(stderr, _("Password field is empty, this is forbidden for all accounts.\n"));
+ exit(1);
+ } else if( (pw->pw_uid == 0)
+ && (strcmp(prevent_no_auth, "superuser") == 0)) {
+ fprintf(stderr, _("Password field is empty, this is forbidden for super-user.\n"));
+ exit(1);
+ }
+ }
+
/*
* BSD systems only allow "wheel" to SU to root. USG systems don't,
* so we make this a configurable option.