Blame SOURCES/0099-providers-ipa-add_v1_user_data-amended.patch

5fca41
From e294f7351b810ea9180b2e9e0cab47beab18ae25 Mon Sep 17 00:00:00 2001
5fca41
From: Alexey Tikhonov <atikhono@redhat.com>
5fca41
Date: Fri, 20 Sep 2019 15:51:38 +0200
5fca41
Subject: [PATCH] providers/ipa/: add_v1_user_data() amended
5fca41
5fca41
Fixes few mistypes and compilation warning:
5fca41
```
5fca41
sssd-2.2.3/src/providers/ipa/ipa_s2n_exop.c:665:20: warning: 'gc' may be used uninitialized in this function [-Wmaybe-uninitialized]
5fca41
     attrs->ngroups = gc;
5fca41
     ~~~~~~~~~~~~~~~^~~~
5fca41
```
5fca41
5fca41
Related to https://pagure.io/SSSD/sssd/issue/4078
5fca41
5fca41
Reviewed-by: Sumit Bose <sbose@redhat.com>
5fca41
(cherry picked from commit 39e16cca441d4a6b3affe8f27372c26ed11ac81f)
5fca41
---
5fca41
 src/providers/ipa/ipa_s2n_exop.c | 14 +++++++++-----
5fca41
 1 file changed, 9 insertions(+), 5 deletions(-)
5fca41
5fca41
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
5fca41
index f1d5768ae..a07f73200 100644
5fca41
--- a/src/providers/ipa/ipa_s2n_exop.c
5fca41
+++ b/src/providers/ipa/ipa_s2n_exop.c
5fca41
@@ -620,7 +620,8 @@ static errno_t add_v1_user_data(struct sss_domain_info *dom,
5fca41
     if (attrs->ngroups > 0) {
5fca41
         attrs->groups = talloc_zero_array(attrs, char *, attrs->ngroups + 1);
5fca41
         if (attrs->groups == NULL) {
5fca41
-            DEBUG(SSSDBG_OP_FAILURE, "talloc_array failed.\n");
5fca41
+            DEBUG(SSSDBG_OP_FAILURE, "talloc_zero_array failed.\n");
5fca41
+            attrs->ngroups = 0;
5fca41
             ret = ENOMEM;
5fca41
             goto done;
5fca41
         }
5fca41
@@ -639,8 +640,10 @@ static errno_t add_v1_user_data(struct sss_domain_info *dom,
5fca41
             if (domain != NULL) {
5fca41
                 obj_domain = find_domain_by_name_ex(parent_domain, domain, true, SSS_GND_ALL_DOMAINS);
5fca41
                 if (obj_domain == NULL) {
5fca41
-                    DEBUG(SSSDBG_OP_FAILURE, "find_domain_by_name failed.\n");
5fca41
-                    return ENOMEM;
5fca41
+                    DEBUG(SSSDBG_OP_FAILURE, "find_domain_by_name_ex failed.\n");
5fca41
+                    attrs->ngroups = gc;
5fca41
+                    ret = ENOMEM;
5fca41
+                    goto done;
5fca41
                 } else if (sss_domain_get_state(obj_domain) == DOM_DISABLED) {
5fca41
                     /* skipping objects from disabled domains */
5fca41
                     DEBUG(SSSDBG_TRACE_ALL,
5fca41
@@ -655,14 +658,15 @@ static errno_t add_v1_user_data(struct sss_domain_info *dom,
5fca41
             attrs->groups[gc] = sss_create_internal_fqname(attrs->groups,
5fca41
                                                            name, obj_domain->name);
5fca41
             if (attrs->groups[gc] == NULL) {
5fca41
-                DEBUG(SSSDBG_OP_FAILURE, "talloc_strdup failed.\n");
5fca41
+                DEBUG(SSSDBG_OP_FAILURE, "sss_create_internal_fqname failed.\n");
5fca41
+                attrs->ngroups = gc;
5fca41
                 ret = ENOMEM;
5fca41
                 goto done;
5fca41
             }
5fca41
             gc++;
5fca41
         }
5fca41
+        attrs->ngroups = gc;
5fca41
     }
5fca41
-    attrs->ngroups = gc;
5fca41
 
5fca41
     tag = ber_peek_tag(ber, &ber_len);
5fca41
     DEBUG(SSSDBG_TRACE_ALL, "BER tag is [%d]\n", (int) tag);
5fca41
-- 
5fca41
2.20.1
5fca41