strv: make iterator in STRV_FOREACH() declaread in the loop
This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
This commit is contained in:
@@ -212,7 +212,6 @@ int acl_search_groups(const char *path, char ***ret_groups) {
|
||||
int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask) {
|
||||
_cleanup_free_ char **a = NULL, **d = NULL; /* strings are not freed */
|
||||
_cleanup_strv_free_ char **split = NULL;
|
||||
char **entry;
|
||||
int r = -EINVAL;
|
||||
_cleanup_(acl_freep) acl_t a_acl = NULL, d_acl = NULL;
|
||||
|
||||
|
||||
@@ -280,7 +280,6 @@ static int boot_entries_find(
|
||||
size_t *n_entries) {
|
||||
|
||||
_cleanup_strv_free_ char **files = NULL;
|
||||
char **f;
|
||||
int r;
|
||||
|
||||
assert(root);
|
||||
@@ -856,8 +855,6 @@ int boot_entries_augment_from_loader(
|
||||
"auto-reboot-to-firmware-setup", "Reboot Into Firmware Interface",
|
||||
};
|
||||
|
||||
char **i;
|
||||
|
||||
assert(config);
|
||||
|
||||
/* Let's add the entries discovered by the boot loader to the end of our list, unless they are
|
||||
@@ -866,7 +863,6 @@ int boot_entries_augment_from_loader(
|
||||
STRV_FOREACH(i, found_by_loader) {
|
||||
BootEntry *existing;
|
||||
_cleanup_free_ char *c = NULL, *t = NULL, *p = NULL;
|
||||
char **a, **b;
|
||||
|
||||
existing = boot_config_find_entry(config, *i);
|
||||
if (existing) {
|
||||
|
||||
@@ -36,7 +36,6 @@ static int bus_message_append_strv_key_value(
|
||||
sd_bus_message *m,
|
||||
const char **l) {
|
||||
|
||||
const char **k, **v;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
||||
@@ -1675,7 +1675,6 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
|
||||
|
||||
if (streq(field, "RootImageOptions")) {
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
char **first = NULL, **second = NULL;
|
||||
const char *p = eq;
|
||||
|
||||
r = sd_bus_message_open_container(m, SD_BUS_TYPE_STRUCT, "sv");
|
||||
@@ -2024,7 +2023,6 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
||||
char **source, **destination;
|
||||
STRV_FOREACH_PAIR(source, destination, symlinks) {
|
||||
r = sd_bus_message_append(m, "(sst)", *source, *destination, 0);
|
||||
if (r < 0)
|
||||
@@ -2648,7 +2646,6 @@ int bus_append_unit_property_assignment(sd_bus_message *m, UnitType t, const cha
|
||||
}
|
||||
|
||||
int bus_append_unit_property_assignment_many(sd_bus_message *m, UnitType t, char **l) {
|
||||
char **i;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
||||
@@ -490,7 +490,6 @@ int bus_path_decode_unique(const char *path, const char *prefix, char **ret_send
|
||||
|
||||
int bus_track_add_name_many(sd_bus_track *t, char **l) {
|
||||
int r = 0;
|
||||
char **i;
|
||||
|
||||
assert(t);
|
||||
|
||||
@@ -562,7 +561,6 @@ int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *descri
|
||||
|
||||
int bus_reply_pair_array(sd_bus_message *m, char **l) {
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
||||
char **k, **v;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
static int cg_any_controller_used_for_v1(void) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_strv_free_ char **lines = NULL;
|
||||
char **line;
|
||||
int r;
|
||||
|
||||
r = read_full_virtual_file("/proc/cgroups", &buf, NULL);
|
||||
|
||||
@@ -827,7 +827,6 @@ static int condition_test_first_boot(Condition *c, char **env) {
|
||||
|
||||
static int condition_test_environment(Condition *c, char **env) {
|
||||
bool equal;
|
||||
char **i;
|
||||
|
||||
assert(c);
|
||||
assert(c->parameter);
|
||||
|
||||
@@ -486,7 +486,6 @@ static int config_parse_many_files(
|
||||
|
||||
_cleanup_hashmap_free_ Hashmap *stats_by_path = NULL;
|
||||
struct stat st;
|
||||
char **fn;
|
||||
int r;
|
||||
|
||||
if (ret_stats_by_path) {
|
||||
|
||||
@@ -632,7 +632,6 @@ int image_remove(Image *i) {
|
||||
_cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
|
||||
_cleanup_strv_free_ char **settings = NULL;
|
||||
_cleanup_free_ char *roothash = NULL;
|
||||
char **j;
|
||||
int r;
|
||||
|
||||
assert(i);
|
||||
@@ -695,10 +694,9 @@ int image_remove(Image *i) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
STRV_FOREACH(j, settings) {
|
||||
STRV_FOREACH(j, settings)
|
||||
if (unlink(*j) < 0 && errno != ENOENT)
|
||||
log_debug_errno(errno, "Failed to unlink %s, ignoring: %m", *j);
|
||||
}
|
||||
|
||||
if (unlink(roothash) < 0 && errno != ENOENT)
|
||||
log_debug_errno(errno, "Failed to unlink %s, ignoring: %m", roothash);
|
||||
@@ -724,7 +722,6 @@ int image_rename(Image *i, const char *new_name) {
|
||||
_cleanup_free_ char *new_path = NULL, *nn = NULL, *roothash = NULL;
|
||||
_cleanup_strv_free_ char **settings = NULL;
|
||||
unsigned file_attr = 0;
|
||||
char **j;
|
||||
int r;
|
||||
|
||||
assert(i);
|
||||
@@ -845,7 +842,6 @@ int image_clone(Image *i, const char *new_name, bool read_only) {
|
||||
_cleanup_strv_free_ char **settings = NULL;
|
||||
_cleanup_free_ char *roothash = NULL;
|
||||
const char *new_path;
|
||||
char **j;
|
||||
int r;
|
||||
|
||||
assert(i);
|
||||
|
||||
@@ -2208,7 +2208,6 @@ static int validate_signature_userspace(const VeritySettings *verity) {
|
||||
_cleanup_(BIO_freep) BIO *bio = NULL; /* 'bio' must be freed first, 's' second, hence keep this order
|
||||
* of declaration in place, please */
|
||||
const unsigned char *d;
|
||||
char **i;
|
||||
int r;
|
||||
|
||||
assert(verity);
|
||||
|
||||
@@ -232,7 +232,6 @@ int unit_file_find_dropin_paths(
|
||||
|
||||
_cleanup_strv_free_ char **dirs = NULL;
|
||||
const char *n;
|
||||
char **p;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
@@ -91,7 +91,6 @@ static int do_execute(
|
||||
|
||||
_cleanup_hashmap_free_free_ Hashmap *pids = NULL;
|
||||
_cleanup_strv_free_ char **paths = NULL;
|
||||
char **path, **e;
|
||||
int r;
|
||||
bool parallel_execution;
|
||||
|
||||
@@ -254,7 +253,7 @@ int execute_directories(
|
||||
}
|
||||
|
||||
static int gather_environment_generate(int fd, void *arg) {
|
||||
char ***env = arg, **x, **y;
|
||||
char ***env = arg;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
_cleanup_strv_free_ char **new = NULL;
|
||||
int r;
|
||||
@@ -369,7 +368,6 @@ static int gather_environment_consume(int fd, void *arg) {
|
||||
|
||||
int exec_command_flags_from_strv(char **ex_opts, ExecCommandFlags *flags) {
|
||||
ExecCommandFlags ex_flag, ret_flags = 0;
|
||||
char **opt;
|
||||
|
||||
assert(flags);
|
||||
|
||||
|
||||
@@ -1364,7 +1364,6 @@ static char* format_strv_width(char **strv, size_t column_width) {
|
||||
return NULL;
|
||||
|
||||
size_t position = 0;
|
||||
char **p;
|
||||
STRV_FOREACH(p, strv) {
|
||||
size_t our_len = utf8_console_width(*p); /* This returns -1 on invalid utf-8 (which shouldn't happen).
|
||||
* If that happens, we'll just print one item per line. */
|
||||
|
||||
@@ -434,7 +434,7 @@ static int trie_store(struct trie *trie, const char *filename, bool compat) {
|
||||
|
||||
static int insert_data(struct trie *trie, char **match_list, char *line, const char *filename,
|
||||
uint16_t file_priority, uint32_t line_number, bool compat) {
|
||||
char *value, **entry;
|
||||
char *value;
|
||||
|
||||
assert(line[0] == ' ');
|
||||
|
||||
@@ -583,7 +583,6 @@ int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool co
|
||||
_cleanup_free_ char *hwdb_bin = NULL;
|
||||
_cleanup_(trie_freep) struct trie *trie = NULL;
|
||||
_cleanup_strv_free_ char **files = NULL;
|
||||
char **f;
|
||||
uint16_t file_priority = 1;
|
||||
int r = 0, err;
|
||||
|
||||
|
||||
+4
-24
@@ -864,7 +864,6 @@ static int find_symlinks_in_scope(
|
||||
bool same_name_link_runtime = false, same_name_link_config = false;
|
||||
bool enabled_in_runtime = false, enabled_at_all = false;
|
||||
bool ignore_same_name = false;
|
||||
char **p;
|
||||
int r;
|
||||
|
||||
assert(lp);
|
||||
@@ -1421,7 +1420,6 @@ static int unit_file_search(
|
||||
_cleanup_free_ char *template = NULL;
|
||||
bool found_unit = false;
|
||||
int r, result;
|
||||
char **p;
|
||||
|
||||
assert(info);
|
||||
assert(lp);
|
||||
@@ -1810,7 +1808,6 @@ static int install_info_symlink_alias(
|
||||
UnitFileChange **changes,
|
||||
size_t *n_changes) {
|
||||
|
||||
char **s;
|
||||
int r = 0, q;
|
||||
|
||||
assert(i);
|
||||
@@ -1854,7 +1851,6 @@ static int install_info_symlink_wants(
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
UnitNameFlags valid_dst_type = UNIT_NAME_ANY;
|
||||
const char *n;
|
||||
char **s;
|
||||
int r = 0, q;
|
||||
|
||||
assert(i);
|
||||
@@ -2158,7 +2154,6 @@ int unit_file_mask(
|
||||
|
||||
_cleanup_(lookup_paths_free) LookupPaths lp = {};
|
||||
const char *config_path;
|
||||
char **i;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -2207,7 +2202,6 @@ int unit_file_unmask(
|
||||
_cleanup_strv_free_ char **todo = NULL;
|
||||
const char *config_path;
|
||||
size_t n_todo = 0;
|
||||
char **i;
|
||||
int r, q;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -2299,7 +2293,6 @@ int unit_file_link(
|
||||
_cleanup_strv_free_ char **todo = NULL;
|
||||
const char *config_path;
|
||||
size_t n_todo = 0;
|
||||
char **i;
|
||||
int r, q;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -2399,7 +2392,6 @@ int unit_file_revert(
|
||||
_cleanup_(lookup_paths_free) LookupPaths lp = {};
|
||||
_cleanup_strv_free_ char **todo = NULL;
|
||||
size_t n_todo = 0;
|
||||
char **i;
|
||||
int r, q;
|
||||
|
||||
/* Puts a unit file back into vendor state. This means:
|
||||
@@ -2419,7 +2411,6 @@ int unit_file_revert(
|
||||
|
||||
STRV_FOREACH(i, files) {
|
||||
bool has_vendor = false;
|
||||
char **p;
|
||||
|
||||
if (!unit_name_is_valid(*i, UNIT_NAME_ANY))
|
||||
return -EINVAL;
|
||||
@@ -2503,7 +2494,6 @@ int unit_file_revert(
|
||||
STRV_FOREACH(i, todo) {
|
||||
_cleanup_strv_free_ char **fs = NULL;
|
||||
const char *rp;
|
||||
char **j;
|
||||
|
||||
(void) get_files_in_directory(*i, &fs);
|
||||
|
||||
@@ -2556,7 +2546,6 @@ int unit_file_add_dependency(
|
||||
_cleanup_(install_context_done) InstallContext c = {};
|
||||
UnitFileInstallInfo *i, *target_info;
|
||||
const char *config_path;
|
||||
char **f;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -2625,7 +2614,6 @@ int unit_file_enable(
|
||||
_cleanup_(install_context_done) InstallContext c = {};
|
||||
const char *config_path;
|
||||
UnitFileInstallInfo *i;
|
||||
char **f;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -2668,7 +2656,6 @@ int unit_file_disable(
|
||||
_cleanup_(install_context_done) InstallContext c = {};
|
||||
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
|
||||
const char *config_path;
|
||||
char **i;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -2986,7 +2973,6 @@ static int presets_find_config(UnitFileScope scope, const char *root_dir, char *
|
||||
static int read_presets(UnitFileScope scope, const char *root_dir, UnitFilePresets *presets) {
|
||||
_cleanup_(unit_file_presets_freep) UnitFilePresets ps = {};
|
||||
_cleanup_strv_free_ char **files = NULL;
|
||||
char **p;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -3104,7 +3090,6 @@ static int pattern_match_multiple_instances(
|
||||
if (unit_name_is_valid(unit_name, UNIT_NAME_TEMPLATE)) {
|
||||
_cleanup_strv_free_ char **out_strv = NULL;
|
||||
|
||||
char **iter;
|
||||
STRV_FOREACH(iter, rule.instances) {
|
||||
_cleanup_free_ char *name = NULL;
|
||||
|
||||
@@ -3151,11 +3136,10 @@ static int query_presets(const char *name, const UnitFilePresets *presets, char
|
||||
log_debug("Preset files don't specify rule for %s. Enabling.", name);
|
||||
return 1;
|
||||
case PRESET_ENABLE:
|
||||
if (instance_name_list && *instance_name_list) {
|
||||
char **s;
|
||||
if (instance_name_list && *instance_name_list)
|
||||
STRV_FOREACH(s, *instance_name_list)
|
||||
log_debug("Preset files say enable %s.", *s);
|
||||
} else
|
||||
else
|
||||
log_debug("Preset files say enable %s.", name);
|
||||
return 1;
|
||||
case PRESET_DISABLE:
|
||||
@@ -3261,15 +3245,14 @@ static int preset_prepare_one(
|
||||
return r;
|
||||
|
||||
if (r > 0) {
|
||||
if (instance_name_list) {
|
||||
char **s;
|
||||
if (instance_name_list)
|
||||
STRV_FOREACH(s, instance_name_list) {
|
||||
r = install_info_discover_and_check(scope, plus, lp, *s, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS,
|
||||
&i, changes, n_changes);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
} else {
|
||||
else {
|
||||
r = install_info_discover_and_check(scope, plus, lp, name, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS,
|
||||
&i, changes, n_changes);
|
||||
if (r < 0)
|
||||
@@ -3296,7 +3279,6 @@ int unit_file_preset(
|
||||
_cleanup_(lookup_paths_free) LookupPaths lp = {};
|
||||
_cleanup_(unit_file_presets_freep) UnitFilePresets presets = {};
|
||||
const char *config_path;
|
||||
char **i;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -3336,7 +3318,6 @@ int unit_file_preset_all(
|
||||
_cleanup_(lookup_paths_free) LookupPaths lp = {};
|
||||
_cleanup_(unit_file_presets_freep) UnitFilePresets presets = {};
|
||||
const char *config_path = NULL;
|
||||
char **i;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -3408,7 +3389,6 @@ int unit_file_get_list(
|
||||
char **patterns) {
|
||||
|
||||
_cleanup_(lookup_paths_free) LookupPaths lp = {};
|
||||
char **dirname;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
||||
@@ -197,7 +197,6 @@ int test_password_one(const char *hashed_password, const char *password) {
|
||||
}
|
||||
|
||||
int test_password_many(char **hashed_password, const char *password) {
|
||||
char **hpw;
|
||||
int r;
|
||||
|
||||
STRV_FOREACH(hpw, hashed_password) {
|
||||
|
||||
@@ -313,8 +313,6 @@ static int fido2_use_hmac_hash_specific_token(
|
||||
bool retry_with_up = false, retry_with_pin = false;
|
||||
|
||||
if (FLAGS_SET(required, FIDO2ENROLL_PIN)) {
|
||||
char **i;
|
||||
|
||||
/* OK, we need a pin, try with all pins in turn */
|
||||
if (strv_isempty(pins))
|
||||
r = FIDO_ERR_PIN_REQUIRED;
|
||||
@@ -683,7 +681,6 @@ int fido2_generate_hmac_hash(
|
||||
|
||||
for (;;) {
|
||||
_cleanup_(strv_free_erasep) char **pin = NULL;
|
||||
char **i;
|
||||
|
||||
r = ask_password_auto("Please enter security token PIN:", askpw_icon_name, NULL, "fido2-pin", "fido2-pin", USEC_INFINITY, 0, &pin);
|
||||
if (r < 0)
|
||||
|
||||
@@ -247,8 +247,6 @@ static const char *join_with(const char *controller) {
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *const *x, *const *y;
|
||||
|
||||
assert(controller);
|
||||
|
||||
/* This will lookup which controller to mount another controller with. Input is a controller name, and output
|
||||
@@ -436,7 +434,6 @@ static int relabel_cgroup_filesystems(void) {
|
||||
|
||||
static int relabel_extra(void) {
|
||||
_cleanup_strv_free_ char **files = NULL;
|
||||
char **file;
|
||||
int r, c = 0;
|
||||
|
||||
/* Support for relabelling additional files or directories after loading the policy. For this, code in the
|
||||
|
||||
@@ -274,7 +274,6 @@ int bind_remount_recursive_with_mountinfo(
|
||||
* we shall operate on. */
|
||||
if (!path_equal(path, prefix)) {
|
||||
bool deny_listed = false;
|
||||
char **i;
|
||||
|
||||
STRV_FOREACH(i, deny_list) {
|
||||
if (path_equal(*i, prefix))
|
||||
|
||||
@@ -48,7 +48,6 @@ bool net_match_is_empty(const NetMatch *match) {
|
||||
}
|
||||
|
||||
static bool net_condition_test_strv(char * const *patterns, const char *string) {
|
||||
char * const *p;
|
||||
bool match = false, has_positive_rule = false;
|
||||
|
||||
if (strv_isempty(patterns))
|
||||
@@ -79,7 +78,6 @@ static bool net_condition_test_ifname(char * const *patterns, const char *ifname
|
||||
if (net_condition_test_strv(patterns, ifname))
|
||||
return true;
|
||||
|
||||
char * const *p;
|
||||
STRV_FOREACH(p, alternative_names)
|
||||
if (net_condition_test_strv(patterns, *p))
|
||||
return true;
|
||||
@@ -88,8 +86,6 @@ static bool net_condition_test_ifname(char * const *patterns, const char *ifname
|
||||
}
|
||||
|
||||
static int net_condition_test_property(char * const *match_property, sd_device *device) {
|
||||
char * const *p;
|
||||
|
||||
if (strv_isempty(match_property))
|
||||
return true;
|
||||
|
||||
|
||||
@@ -132,7 +132,6 @@ static int nscd_flush_cache_one(const char *database, usec_t end) {
|
||||
int nscd_flush_cache(char **databases) {
|
||||
usec_t end;
|
||||
int r = 0;
|
||||
char **i;
|
||||
|
||||
/* Tries to invalidate the specified database in nscd. We do this carefully, with a 5s timeout, so that we
|
||||
* don't block indefinitely on another service. */
|
||||
|
||||
@@ -276,7 +276,6 @@ int pkcs11_token_login(
|
||||
for (unsigned tries = 0; tries < 3; tries++) {
|
||||
_cleanup_strv_free_erase_ char **passwords = NULL;
|
||||
_cleanup_(erase_and_freep) char *envpin = NULL;
|
||||
char **i;
|
||||
|
||||
r = getenv_steal_erase("PIN", &envpin);
|
||||
if (r < 0)
|
||||
|
||||
@@ -168,7 +168,6 @@ static int cat_file(const char *filename, bool newline) {
|
||||
}
|
||||
|
||||
int cat_files(const char *file, char **dropins, CatFlags flags) {
|
||||
char **path;
|
||||
int r;
|
||||
|
||||
if (file) {
|
||||
@@ -284,10 +283,9 @@ static int guess_type(const char **name, char ***prefixes, bool *is_collection,
|
||||
int conf_files_cat(const char *root, const char *name) {
|
||||
_cleanup_strv_free_ char **dirs = NULL, **files = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
char **prefix, **prefixes = NULL; /* explicit initialization to appease gcc */
|
||||
char **prefixes = NULL; /* explicit initialization to appease gcc */
|
||||
bool is_collection;
|
||||
const char *extension;
|
||||
char **t;
|
||||
int r;
|
||||
|
||||
r = guess_type(&name, &prefixes, &is_collection, &extension);
|
||||
|
||||
@@ -1837,7 +1837,6 @@ int seccomp_restrict_archs(Set *archs) {
|
||||
|
||||
int parse_syscall_archs(char **l, Set **ret_archs) {
|
||||
_cleanup_set_free_ Set *archs = NULL;
|
||||
char **s;
|
||||
int r;
|
||||
|
||||
assert(l);
|
||||
|
||||
@@ -117,7 +117,6 @@ int serialize_dual_timestamp(FILE *f, const char *name, const dual_timestamp *t)
|
||||
|
||||
int serialize_strv(FILE *f, const char *key, char **l) {
|
||||
int ret = 0, r;
|
||||
char **i;
|
||||
|
||||
/* Returns the first error, or positive if anything was serialized, 0 otherwise. */
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ static void load_testdata_env(void) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
_cleanup_free_ char *envpath = NULL;
|
||||
_cleanup_strv_free_ char **pairs = NULL;
|
||||
char **k, **v;
|
||||
|
||||
if (called)
|
||||
return;
|
||||
|
||||
@@ -143,7 +143,6 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
|
||||
break;
|
||||
}
|
||||
bool has_valid_passwords = false;
|
||||
char **p;
|
||||
STRV_FOREACH(p, hr->hashed_password)
|
||||
if (!hashed_password_is_locked_or_invalid(*p)) {
|
||||
has_valid_passwords = true;
|
||||
@@ -240,15 +239,12 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
|
||||
if (hr->preferred_language)
|
||||
printf(" Language: %s\n", hr->preferred_language);
|
||||
|
||||
if (!strv_isempty(hr->environment)) {
|
||||
char **i;
|
||||
|
||||
if (!strv_isempty(hr->environment))
|
||||
STRV_FOREACH(i, hr->environment) {
|
||||
printf(i == hr->environment ?
|
||||
" Environment: %s\n" :
|
||||
" %s\n", *i);
|
||||
}
|
||||
}
|
||||
|
||||
if (hr->locked >= 0)
|
||||
printf(" Locked: %s\n", yes_no(hr->locked));
|
||||
@@ -478,14 +474,11 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
|
||||
if (!strv_isempty(hr->ssh_authorized_keys))
|
||||
printf("SSH Pub. Key: %zu\n", strv_length(hr->ssh_authorized_keys));
|
||||
|
||||
if (!strv_isempty(hr->pkcs11_token_uri)) {
|
||||
char **i;
|
||||
|
||||
if (!strv_isempty(hr->pkcs11_token_uri))
|
||||
STRV_FOREACH(i, hr->pkcs11_token_uri)
|
||||
printf(i == hr->pkcs11_token_uri ?
|
||||
"PKCS11 Token: %s\n" :
|
||||
" %s\n", *i);
|
||||
}
|
||||
|
||||
if (hr->n_fido2_hmac_credential > 0)
|
||||
printf(" FIDO2 Token: %zu\n", hr->n_fido2_hmac_credential);
|
||||
@@ -558,7 +551,6 @@ void group_record_show(GroupRecord *gr, bool show_full_user_info) {
|
||||
}
|
||||
} else {
|
||||
const char *prefix = " Members:";
|
||||
char **i;
|
||||
|
||||
STRV_FOREACH(i, gr->members) {
|
||||
printf("%s %s\n", prefix, *i);
|
||||
@@ -568,7 +560,6 @@ void group_record_show(GroupRecord *gr, bool show_full_user_info) {
|
||||
|
||||
if (!strv_isempty(gr->administrators)) {
|
||||
const char *prefix = " Admins:";
|
||||
char **i;
|
||||
|
||||
STRV_FOREACH(i, gr->administrators) {
|
||||
printf("%s %s\n", prefix, *i);
|
||||
|
||||
Reference in New Issue
Block a user