URL: https://github.com/SSSD/sssd/pull/890
Author: alexey-tikhonov
 Title: #890: providers/ipa/: add_v1_user_data() amended
Action: opened

PR body:
"""
Fixes few mistypes and compilation warning:
```
sssd-2.2.3/src/providers/ipa/ipa_s2n_exop.c:665:20: warning: 'gc' may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     attrs->ngroups = gc;
     ~~~~~~~~~~~~~~~^~~~
```
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/890/head:pr890
git checkout pr890
From 360d56c907deae6f9fc52a2973f9cc31c94d3369 Mon Sep 17 00:00:00 2001
From: Alexey Tikhonov <atikh...@redhat.com>
Date: Fri, 20 Sep 2019 15:51:38 +0200
Subject: [PATCH] providers/ipa/: add_v1_user_data() amended

Fixes few mistypes and compilation warning:
```
sssd-2.2.3/src/providers/ipa/ipa_s2n_exop.c:665:20: warning: 'gc' may be used uninitialized in this function [-Wmaybe-uninitialized]
     attrs->ngroups = gc;
     ~~~~~~~~~~~~~~~^~~~
```
---
 src/providers/ipa/ipa_s2n_exop.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index 38eb530e70..c6a4d8d056 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -620,7 +620,8 @@ static errno_t add_v1_user_data(struct sss_domain_info *dom,
     if (attrs->ngroups > 0) {
         attrs->groups = talloc_zero_array(attrs, char *, attrs->ngroups + 1);
         if (attrs->groups == NULL) {
-            DEBUG(SSSDBG_OP_FAILURE, "talloc_array failed.\n");
+            DEBUG(SSSDBG_OP_FAILURE, "talloc_zero_array failed.\n");
+            attrs->ngroups = 0;
             ret = ENOMEM;
             goto done;
         }
@@ -639,8 +640,10 @@ static errno_t add_v1_user_data(struct sss_domain_info *dom,
             if (domain != NULL) {
                 obj_domain = find_domain_by_name_ex(parent_domain, domain, true, SSS_GND_ALL_DOMAINS);
                 if (obj_domain == NULL) {
-                    DEBUG(SSSDBG_OP_FAILURE, "find_domain_by_name failed.\n");
-                    return ENOMEM;
+                    DEBUG(SSSDBG_OP_FAILURE, "find_domain_by_name_ex failed.\n");
+                    attrs->ngroups = gc;
+                    ret = ENOMEM;
+                    goto done;
                 } else if (sss_domain_get_state(obj_domain) == DOM_DISABLED) {
                     /* skipping objects from disabled domains */
                     DEBUG(SSSDBG_TRACE_ALL,
@@ -655,14 +658,15 @@ static errno_t add_v1_user_data(struct sss_domain_info *dom,
             attrs->groups[gc] = sss_create_internal_fqname(attrs->groups,
                                                            name, obj_domain->name);
             if (attrs->groups[gc] == NULL) {
-                DEBUG(SSSDBG_OP_FAILURE, "talloc_strdup failed.\n");
+                DEBUG(SSSDBG_OP_FAILURE, "sss_create_internal_fqname failed.\n");
+                attrs->ngroups = gc;
                 ret = ENOMEM;
                 goto done;
             }
             gc++;
         }
+        attrs->ngroups = gc;
     }
-    attrs->ngroups = gc;
 
     tag = ber_peek_tag(ber, &ber_len);
     DEBUG(SSSDBG_TRACE_ALL, "BER tag is [%d]\n", (int) tag);
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org

Reply via email to