return sd_bus_message_close_container(m);
}
-static int create_home_common(sd_json_variant *input) {
+static int create_home_common(sd_json_variant *input, bool show_enforce_password_policy_hint) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(user_record_unrefp) UserRecord *hr = NULL;
_cleanup_hashmap_free_ Hashmap *blobs = NULL;
_cleanup_(erase_and_freep) char *new_password = NULL;
log_error_errno(r, "%s", bus_error_message(&error, r));
- log_info("(Use --enforce-password-policy=no to turn off password quality checks for this account.)");
+ if (show_enforce_password_policy_hint)
+ log_info("(Use --enforce-password-policy=no to turn off password quality checks for this account.)");
r = acquire_new_password(hr->user_name, hr, /* suggest = */ false, &new_password);
if (r < 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "User name required.");
}
- return create_home_common(/* input= */ NULL);
+ return create_home_common(/* input= */ NULL, /* show_enforce_password_policy_hint= */ true);
}
static int remove_home(int argc, char *argv[], void *userdata) {
log_notice("Processing user '%s' from credentials.", e);
- r = create_home_common(identity);
+ r = create_home_common(identity, /* show_enforce_password_policy_hint= */ false);
if (r >= 0)
n_created++;
return log_error_errno(r, "Failed to set shell field: %m");
}
- return create_home_common(/* input= */ NULL);
+ return create_home_common(/* input= */ NULL, /* show_enforce_password_policy_hint= */ false);
}
static int verb_firstboot(int argc, char *argv[], void *userdata) {