dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0093-ifp-extraAttributes-is-UnknownProperty.patch

71e593
From 814889a7f4691a135b617058c3ae876b54d5b226 Mon Sep 17 00:00:00 2001
71e593
From: Tomas Halman <thalman@redhat.com>
71e593
Date: Tue, 18 Dec 2018 16:31:28 +0100
71e593
Subject: [PATCH] ifp: extraAttributes is UnknownProperty
71e593
71e593
Attempting to get extraAttributes via SSSD's ifp fails.
71e593
71e593
Here I uncomment interface function for extraAttributes.
71e593
also right for querying this interface is changed to allow
71e593
this request.
71e593
71e593
Resolves:
71e593
https://pagure.io/SSSD/sssd/issue/3906
71e593
71e593
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
71e593
---
71e593
 src/responder/ifp/ifp_iface/ifp_iface.c |  4 ++--
71e593
 src/responder/ifp/ifpsrv_util.c         |  2 +-
71e593
 src/tests/cmocka/test_ifp.c             | 15 +++++++++------
71e593
 3 files changed, 12 insertions(+), 9 deletions(-)
71e593
71e593
diff --git a/src/responder/ifp/ifp_iface/ifp_iface.c b/src/responder/ifp/ifp_iface/ifp_iface.c
71e593
index 4464b7dd4..fa9f9ba53 100644
71e593
--- a/src/responder/ifp/ifp_iface/ifp_iface.c
71e593
+++ b/src/responder/ifp/ifp_iface/ifp_iface.c
71e593
@@ -173,8 +173,8 @@ ifp_register_sbus_interface(struct sbus_connection *conn,
71e593
             SBUS_SYNC(GETTER, org_freedesktop_sssd_infopipe_Users_User, uniqueID, ifp_users_user_get_unique_id, ctx),
71e593
             SBUS_SYNC(GETTER, org_freedesktop_sssd_infopipe_Users_User, groups, ifp_users_user_get_groups, ctx),
71e593
             SBUS_SYNC(GETTER, org_freedesktop_sssd_infopipe_Users_User, domain, ifp_users_user_get_domain, ctx),
71e593
-            SBUS_SYNC(GETTER, org_freedesktop_sssd_infopipe_Users_User, domainname, ifp_users_user_get_domainname, ctx)
71e593
-//            SBUS_SYNC(GETTER, org_freedesktop_sssd_infopipe_Users_User, extraAttributes, ifp_users_user_get_extra_attributes, ctx)
71e593
+            SBUS_SYNC(GETTER, org_freedesktop_sssd_infopipe_Users_User, domainname, ifp_users_user_get_domainname, ctx),
71e593
+            SBUS_SYNC(GETTER, org_freedesktop_sssd_infopipe_Users_User, extraAttributes, ifp_users_user_get_extra_attributes, ctx)
71e593
         )
71e593
     );
71e593
 
71e593
diff --git a/src/responder/ifp/ifpsrv_util.c b/src/responder/ifp/ifpsrv_util.c
71e593
index 6a625c244..ebc4c2118 100644
71e593
--- a/src/responder/ifp/ifpsrv_util.c
71e593
+++ b/src/responder/ifp/ifpsrv_util.c
71e593
@@ -30,7 +30,7 @@
71e593
                                 SYSDB_GIDNUM, SYSDB_GECOS,  \
71e593
                                 SYSDB_HOMEDIR, SYSDB_SHELL, \
71e593
                                 "groups", "domain", "domainname", \
71e593
-                                NULL}
71e593
+                                "extraAttributes", NULL}
71e593
 
71e593
 errno_t ifp_add_value_to_dict(DBusMessageIter *iter_dict,
71e593
                               const char *key,
71e593
diff --git a/src/tests/cmocka/test_ifp.c b/src/tests/cmocka/test_ifp.c
71e593
index 82ab70d75..fd754e779 100644
71e593
--- a/src/tests/cmocka/test_ifp.c
71e593
+++ b/src/tests/cmocka/test_ifp.c
71e593
@@ -172,7 +172,8 @@ void test_attr_acl(void **state)
71e593
     const char *exp_defaults[] = { SYSDB_NAME, SYSDB_UIDNUM,
71e593
                                    SYSDB_GIDNUM, SYSDB_GECOS,
71e593
                                    SYSDB_HOMEDIR, SYSDB_SHELL,
71e593
-                                   "groups", "domain", "domainname", NULL };
71e593
+                                   "groups", "domain", "domainname",
71e593
+                                   "extraAttributes", NULL };
71e593
     attr_parse_test(exp_defaults, NULL);
71e593
 
71e593
     /* Test adding some attributes to the defaults */
71e593
@@ -180,7 +181,8 @@ void test_attr_acl(void **state)
71e593
                               SYSDB_NAME, SYSDB_UIDNUM,
71e593
                               SYSDB_GIDNUM, SYSDB_GECOS,
71e593
                               SYSDB_HOMEDIR, SYSDB_SHELL,
71e593
-                              "groups", "domain", "domainname", NULL };
71e593
+                              "groups", "domain", "domainname",
71e593
+                              "extraAttributes", NULL };
71e593
     attr_parse_test(exp_add, "+telephoneNumber, +streetAddress");
71e593
 
71e593
     /* Test removing some attributes to the defaults */
71e593
@@ -188,7 +190,7 @@ void test_attr_acl(void **state)
71e593
                              SYSDB_GIDNUM, SYSDB_GECOS,
71e593
                              SYSDB_HOMEDIR, "groups",
71e593
                              "domain", "domainname",
71e593
-                             NULL };
71e593
+                             "extraAttributes", NULL };
71e593
     attr_parse_test(exp_rm, "-"SYSDB_SHELL ",-"SYSDB_UIDNUM);
71e593
 
71e593
     /* Test both add and remove */
71e593
@@ -197,7 +199,7 @@ void test_attr_acl(void **state)
71e593
                                  SYSDB_GIDNUM, SYSDB_GECOS,
71e593
                                  SYSDB_HOMEDIR, "groups",
71e593
                                  "domain", "domainname",
71e593
-                                 NULL };
71e593
+                                 "extraAttributes", NULL };
71e593
     attr_parse_test(exp_add_rm, "+telephoneNumber, -"SYSDB_SHELL);
71e593
 
71e593
     /* Test rm trumps add */
71e593
@@ -205,7 +207,8 @@ void test_attr_acl(void **state)
71e593
                                           SYSDB_GIDNUM, SYSDB_GECOS,
71e593
                                           SYSDB_HOMEDIR, SYSDB_SHELL,
71e593
                                           "groups", "domain",
71e593
-                                          "domainname", NULL };
71e593
+                                          "domainname",
71e593
+                                          "extraAttributes", NULL };
71e593
     attr_parse_test(exp_add_rm_override,
71e593
                     "+telephoneNumber, -telephoneNumber, +telephoneNumber");
71e593
 
71e593
@@ -214,7 +217,7 @@ void test_attr_acl(void **state)
71e593
     attr_parse_test(rm_all,  "-"SYSDB_NAME ", -"SYSDB_UIDNUM
71e593
                              ", -"SYSDB_GIDNUM ", -"SYSDB_GECOS
71e593
                              ", -"SYSDB_HOMEDIR ", -"SYSDB_SHELL", -groups, "
71e593
-                             "-domain, -domainname");
71e593
+                             "-domain, -domainname, -extraAttributes");
71e593
 
71e593
     /* Malformed list */
71e593
     attr_parse_test(NULL,  "missing_plus_or_minus");
71e593
-- 
71e593
2.19.1
71e593