dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From e56e1396bab69d9498f4ec6a36e9e228ded90116 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
Date: Wed, 7 Sep 2016 17:09:53 +0200
Subject: [PATCH 139/140] TOOLS: sss_override without name override
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

sss_override failed to export user/group overrides
if user had no overrides for name.

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

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
(cherry picked from commit 07e7683f5a86991feaa764e2055116554ada1b93)
---
 src/tools/sss_override.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/tools/sss_override.c b/src/tools/sss_override.c
index d41da52e69acdb67b5a6d624254e3b89a8aa27b8..212bf9ab84b20d4777fc2601359fad58596bb7c4 100644
--- a/src/tools/sss_override.c
+++ b/src/tools/sss_override.c
@@ -1159,12 +1159,14 @@ list_user_overrides(TALLOC_CTX *mem_ctx,
         }
 
         fqname = ldb_msg_find_attr_as_string(msgs[i], SYSDB_NAME, NULL);
-        ret = sss_parse_internal_fqname(tmp_ctx, fqname, &name, NULL);
-        if (ret != EOK) {
-            ret = ERR_WRONG_NAME_FORMAT;
-            goto done;
+        if (fqname != NULL) {
+            ret = sss_parse_internal_fqname(tmp_ctx, fqname, &name, NULL);
+            if (ret != EOK) {
+                ret = ERR_WRONG_NAME_FORMAT;
+                goto done;
+            }
+            objs[i].name = talloc_steal(objs, name);
         }
-        objs[i].name = talloc_steal(objs, name);
 
         objs[i].uid = ldb_msg_find_attr_as_uint(msgs[i], SYSDB_UIDNUM, 0);
         objs[i].gid = ldb_msg_find_attr_as_uint(msgs[i], SYSDB_GIDNUM, 0);
@@ -1248,12 +1250,14 @@ list_group_overrides(TALLOC_CTX *mem_ctx,
         talloc_steal(objs, objs[i].orig_name);
 
         fqname = ldb_msg_find_attr_as_string(msgs[i], SYSDB_NAME, NULL);
-        ret = sss_parse_internal_fqname(tmp_ctx, fqname, &name, NULL);
-        if (ret != EOK) {
-            ret = ERR_WRONG_NAME_FORMAT;
-            goto done;
+        if (fqname != NULL) {
+            ret = sss_parse_internal_fqname(tmp_ctx, fqname, &name, NULL);
+            if (ret != EOK) {
+                ret = ERR_WRONG_NAME_FORMAT;
+                goto done;
+            }
+            objs[i].name = talloc_steal(objs, name);
         }
-        objs[i].name = talloc_steal(objs, name);
 
         objs[i].gid = ldb_msg_find_attr_as_uint(msgs[i], SYSDB_GIDNUM, 0);
     }
-- 
2.7.4