Blob Blame History Raw
From bfbad5b20c8a34b545cea8df6c937125edf0e42c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
Date: Wed, 7 Sep 2016 10:58:25 +0200
Subject: [PATCH 131/135] TOOLS: use internal fqdn for DN
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Use internal fqdn when creating sysdb group dn.

Resolves:
https://fedorahosted.org/sssd/ticket/3178

Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
(cherry picked from commit 5e2142b66589e5e50cb404fc972ed5418bbaa772)
---
 src/tools/sss_sync_ops.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c
index 39ef5bec96bd3942da8a8adfd21c99b03a77e551..a0291baeada49b9f21e040a54e303214d5a46332 100644
--- a/src/tools/sss_sync_ops.c
+++ b/src/tools/sss_sync_ops.c
@@ -137,6 +137,7 @@ static int mod_groups_member(struct sss_domain_info *dom,
     struct ldb_dn *parent_dn;
     int ret;
     int i;
+    char *grp_sysdb_fqname = NULL;
 
     tmpctx = talloc_new(NULL);
     if (!tmpctx) {
@@ -145,13 +146,21 @@ static int mod_groups_member(struct sss_domain_info *dom,
 
 /* FIXME: add transaction around loop */
     for (i = 0; grouplist[i]; i++) {
+        grp_sysdb_fqname = sss_create_internal_fqname(tmpctx, grouplist[i],
+                                                      dom->name);
+        if (grp_sysdb_fqname == NULL) {
+            ret = ENOMEM;
+            goto done;
+        }
 
-        parent_dn = sysdb_group_dn(tmpctx, dom, grouplist[i]);
+        parent_dn = sysdb_group_dn(tmpctx, dom, grp_sysdb_fqname);
         if (!parent_dn) {
             ret = ENOMEM;
             goto done;
         }
 
+        talloc_free(grp_sysdb_fqname);
+
         ret = sysdb_mod_group_member(dom, member_dn, parent_dn, optype);
         if (ret) {
             goto done;
-- 
2.7.4