mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
profile: strictly require profiles to be valid
We must ensure that the profile is valid and contains only items that are profilable - the check is forced for profiles.
This commit is contained in:
parent
24a84549a8
commit
9c12a23a99
@ -1500,7 +1500,21 @@ int load_profile(struct cmd_context *cmd, struct profile *profile) {
|
||||
|
||||
dm_list_move(&cmd->profile_params->profiles, &profile->list);
|
||||
|
||||
(void) _check_profile(cmd, profile);
|
||||
/*
|
||||
* *Profile must be valid* otherwise we'd end up with incorrect config!
|
||||
* If there were config items present that are not supposed to be
|
||||
* customized by a profile, we could end up with non-deterministic
|
||||
* behaviour. Therefore, this check is *strictly forced* even if
|
||||
* config/checks=0. The config/checks=0 will only cause the warning
|
||||
* messages to be suppressed, but the check itself is always done
|
||||
* for profiles!
|
||||
*/
|
||||
if (!_check_profile(cmd, profile)) {
|
||||
log_error("Ignoring invalid configuration profile %s.", profile->name);
|
||||
/* if invalid, cut the whole tree and leave it empty */
|
||||
dm_pool_free(profile->cft->mem, profile->cft->root);
|
||||
profile->cft->root = NULL;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user