dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

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

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