URL:
https://github.com/SSSD/sssd/pull/495
Title: #495: DESKPROFILE: Add checks for user and host category
fidencio commented:
"""
Here are the changes introduced in the last patch:
```
[ffidenci@pessoa x86_64]$ git diff
diff --git a/src/providers/ipa/ipa_deskprofile_rules_util.c
b/src/providers/ipa/ipa_deskprofile_rules_util.c
index ffcb5c846..01b7d0527 100644
--- a/src/providers/ipa/ipa_deskprofile_rules_util.c
+++ b/src/providers/ipa/ipa_deskprofile_rules_util.c
@@ -779,7 +779,22 @@ ipa_deskprofile_rules_save_rule_to_disk(
if (usercat != NULL && strcasecmp(usercat, "all") == 0) {
user_prio = talloc_strdup(tmp_ctx, rule_prio);
+ if (user_prio == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to allocate the user priority "
+ "when user category is \"all\"\n");
+ ret = ENOMEM;
+ goto done;
+ }
+
group_prio = talloc_strdup(tmp_ctx, rule_prio);
+ if (group_prio == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to allocate the group priority "
+ "when user category is \"all\"\n");
+ ret = ENOMEM;
+ goto done;
+ }
} else {
ret = ipa_deskprofile_rule_check_memberuser(tmp_ctx, domain, rule,
rule_name, rule_prio,
@@ -795,7 +810,22 @@ ipa_deskprofile_rules_save_rule_to_disk(
if (hostcat != NULL && strcasecmp(hostcat, "all") == 0) {
host_prio = talloc_strdup(tmp_ctx, rule_prio);
+ if (host_prio == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to allocate the host priority "
+ "when host category is \"all\"\n");
+ ret = ENOMEM;
+ goto done;
+ }
+
hostgroup_prio = talloc_strdup(tmp_ctx, rule_prio);
+ if (hostgroup_prio == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to allocate the hostgroup priority "
+ "when host category is \"all\"\n");
+ ret = ENOMEM;
+ goto done;
+ }
} else {
ret = ipa_deskprofile_rule_check_memberhost(tmp_ctx, domain, rule,
rule_name, rule_prio,
```
"""
See the full comment at
https://github.com/SSSD/sssd/pull/495#issuecomment-363092251