Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Blueprint services customization for masking #2091

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

evgenyz
Copy link
Contributor

@evgenyz evgenyz commented Mar 11, 2024

This will now be properly parsed and organized:

[customizations.services]
masked = ["service"]

@evgenyz evgenyz requested a review from jan-cerny March 11, 2024 13:58
@evgenyz evgenyz added this to the 1.3.10 milestone Mar 11, 2024
Comment on lines 878 to 881
static int _xccdf_policy_rule_generate_blueprint_fix(struct xccdf_policy *policy, struct xccdf_rule *rule, const char *template,
struct oscap_list *generic,
struct oscap_list *services_enable, struct oscap_list *services_disable, struct oscap_list *services_mask,
struct oscap_list *kernel_append)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a structure instead of having too many parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, why not.

Comment on lines 1234 to 1243
struct oscap_iterator *services_mask_it = oscap_iterator_new(services_mask);
while(oscap_iterator_has_more(services_mask_it)) {
char *var_line = (char *) oscap_iterator_next(services_mask_it);
_write_text_to_fd(output_fd, var_line);
if (oscap_iterator_has_more(services_mask_it))
_write_text_to_fd(output_fd, ",");
}
_write_text_to_fd(output_fd, "]\n\n");
oscap_iterator_free(services_mask_it);
oscap_list_free(services_mask, free);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block seems to be a repeating theme. Can we refactor the code to reduce duplication?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, can be done.

[customizations.services]
masked = ["service"]
@jan-cerny jan-cerny merged commit 4495906 into OpenSCAP:maint-1.3 Mar 13, 2024
20 checks passed
@evgenyz evgenyz deleted the add-bp-mask-services branch March 13, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants