|
|
956cae |
From e32d3a1074a64a1976047fb9fcd0defac439f97c Mon Sep 17 00:00:00 2001
|
|
|
956cae |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
956cae |
Date: Wed, 19 Apr 2017 17:46:03 +0200
|
|
|
956cae |
Subject: [PATCH 165/165] IFP: Use sized_domain_name to format the groups the
|
|
|
956cae |
user is a member of
|
|
|
956cae |
MIME-Version: 1.0
|
|
|
956cae |
Content-Type: text/plain; charset=UTF-8
|
|
|
956cae |
Content-Transfer-Encoding: 8bit
|
|
|
956cae |
|
|
|
956cae |
Resolves:
|
|
|
956cae |
https://pagure.io/SSSD/sssd/issue/3268
|
|
|
956cae |
|
|
|
956cae |
Uses the common function sized_domain_name() to format a group the user
|
|
|
956cae |
is a member of to the appropriate format.
|
|
|
956cae |
|
|
|
956cae |
To see the code is working correctly, run:
|
|
|
956cae |
dbus-send --system --print-reply --dest=org.freedesktop.sssd.infopipe
|
|
|
956cae |
/org/freedesktop/sssd/infopipe
|
|
|
956cae |
org.freedesktop.sssd.infopipe.GetUserGroups
|
|
|
956cae |
string:trusted_user
|
|
|
956cae |
|
|
|
956cae |
Where trusted_user is a user from a trusted domain that is a member of groups
|
|
|
956cae |
from the joined domain and a trusted domain as well. The groups from the
|
|
|
956cae |
joined domain should not be qualified, the groups from the trusted
|
|
|
956cae |
domain should be qualified.
|
|
|
956cae |
|
|
|
956cae |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
956cae |
(cherry picked from commit c9a73bb6ffa010ef206896a0d1c2801bc056fa45)
|
|
|
956cae |
---
|
|
|
956cae |
src/responder/ifp/ifpsrv_cmd.c | 29 +++++++++++++++--------------
|
|
|
956cae |
1 file changed, 15 insertions(+), 14 deletions(-)
|
|
|
956cae |
|
|
|
956cae |
diff --git a/src/responder/ifp/ifpsrv_cmd.c b/src/responder/ifp/ifpsrv_cmd.c
|
|
|
956cae |
index 97fad47e90c2155fc7243e68a7110ba9fd28aa39..f14a41da096edd2ace40c6faf8fb6f6dc3b503fe 100644
|
|
|
956cae |
--- a/src/responder/ifp/ifpsrv_cmd.c
|
|
|
956cae |
+++ b/src/responder/ifp/ifpsrv_cmd.c
|
|
|
956cae |
@@ -369,10 +369,11 @@ ifp_user_get_groups_reply(struct sss_domain_info *domain,
|
|
|
956cae |
struct ifp_req *ireq,
|
|
|
956cae |
struct ldb_result *res)
|
|
|
956cae |
{
|
|
|
956cae |
- int i, num;
|
|
|
956cae |
+ int i, gri, num;
|
|
|
956cae |
const char *name;
|
|
|
956cae |
const char **groupnames;
|
|
|
956cae |
- char *out_name;
|
|
|
956cae |
+ struct sized_string *group_name;
|
|
|
956cae |
+ errno_t ret;
|
|
|
956cae |
|
|
|
956cae |
/* one less, the first one is the user entry */
|
|
|
956cae |
num = res->count - 1;
|
|
|
956cae |
@@ -381,6 +382,7 @@ ifp_user_get_groups_reply(struct sss_domain_info *domain,
|
|
|
956cae |
return sbus_request_finish(ireq->dbus_req, NULL);
|
|
|
956cae |
}
|
|
|
956cae |
|
|
|
956cae |
+ gri = 0;
|
|
|
956cae |
for (i = 0; i < num; i++) {
|
|
|
956cae |
name = sss_view_ldb_msg_find_attr_as_string(domain,
|
|
|
956cae |
res->msgs[i + 1],
|
|
|
956cae |
@@ -390,22 +392,21 @@ ifp_user_get_groups_reply(struct sss_domain_info *domain,
|
|
|
956cae |
continue;
|
|
|
956cae |
}
|
|
|
956cae |
|
|
|
956cae |
- out_name = sss_output_name(ireq, name, domain->case_preserve,
|
|
|
956cae |
- ireq->ifp_ctx->rctx->override_space);
|
|
|
956cae |
- if (out_name == NULL) {
|
|
|
956cae |
+ ret = sized_domain_name(ireq, ireq->ifp_ctx->rctx, name, &group_name);
|
|
|
956cae |
+ if (ret != EOK) {
|
|
|
956cae |
+ DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
956cae |
+ "Unable to get sized name for %s [%d]: %s\n",
|
|
|
956cae |
+ name, ret, sss_strerror(ret));
|
|
|
956cae |
continue;
|
|
|
956cae |
}
|
|
|
956cae |
|
|
|
956cae |
- if (domain->fqnames) {
|
|
|
956cae |
- groupnames[i] = sss_tc_fqname(groupnames, domain->names,
|
|
|
956cae |
- domain, out_name);
|
|
|
956cae |
- if (out_name == NULL) {
|
|
|
956cae |
- DEBUG(SSSDBG_CRIT_FAILURE, "sss_tc_fqname failed\n");
|
|
|
956cae |
- continue;
|
|
|
956cae |
- }
|
|
|
956cae |
- } else {
|
|
|
956cae |
- groupnames[i] = talloc_steal(groupnames, out_name);
|
|
|
956cae |
+ groupnames[gri] = talloc_strndup(groupnames,
|
|
|
956cae |
+ group_name->str, group_name->len);
|
|
|
956cae |
+ if (groupnames[gri] == NULL) {
|
|
|
956cae |
+ DEBUG(SSSDBG_MINOR_FAILURE, "talloc_strndup failed\n");
|
|
|
956cae |
+ continue;
|
|
|
956cae |
}
|
|
|
956cae |
+ gri++;
|
|
|
956cae |
|
|
|
956cae |
DEBUG(SSSDBG_TRACE_FUNC, "Adding group %s\n", groupnames[i]);
|
|
|
956cae |
}
|
|
|
956cae |
--
|
|
|
956cae |
2.9.3
|
|
|
956cae |
|