[SSSD] [PATCHES] Fixes for sss_cache
Sumit Bose
sbose at redhat.com
Tue Nov 26 10:51:41 UTC 2013
Hi,
Steeve found some issues when testing sss_cache with sub-domain users.
This was originally fixed in https://fedorahosted.org/sssd/ticket/1741
but I guess recent changes have broken it again.
I have tested the patches with users and groups. It would be nice is
someone with a suitable environment can test them for the other object
types as well.
bye,
Sumit
-------------- next part --------------
From ad4fd97a4aa9460f7958d0e49d82c8a899f92a52 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Mon, 25 Nov 2013 17:54:06 +0100
Subject: [PATCH 1/2] sss_cache: initialize names member of sss_domain_info
sss_tc_fqname() called by sss_get_domain_name() requires that the names
member of the sss_domain_info struct is set to work properly. If the
names struct is properly initialized in sss_domain_info the separate one
in the tool context is not needed anymore.
Related to https://fedorahosted.org/sssd/ticket/1741
---
src/tools/sss_cache.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 8a232b7..b4340c5 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -63,7 +63,6 @@ static errno_t search_autofsmaps(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb,
struct cache_tool_ctx {
struct confdb_ctx *confdb;
struct sss_domain_info *domains;
- struct sss_names_ctx *nctx;
char *user_filter;
char *group_filter;
@@ -209,7 +208,7 @@ static errno_t update_filter(struct cache_tool_ctx *tctx,
return ENOMEM;
}
- ret = sss_parse_name(tmp_ctx, tctx->nctx, name,
+ ret = sss_parse_name(tmp_ctx, dinfo->names, name,
&parsed_domain, &parsed_name);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("sss_parse_name failed\n"));
@@ -280,17 +279,6 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
{
errno_t ret;
- if (IS_SUBDOMAIN(dinfo)) {
- ret = sss_names_init(tctx, tctx->confdb, dinfo->parent->name,
- &tctx->nctx);
- } else {
- ret = sss_names_init(tctx, tctx->confdb, dinfo->name, &tctx->nctx);
- }
- if (ret != EOK) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("sss_names_init() failed\n"));
- return ret;
- }
-
/* Update user filter */
ret = update_filter(tctx, dinfo, tctx->user_name,
tctx->update_user_filter, "(%s=%s)", false,
@@ -467,6 +455,7 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain)
{
char *confdb_path;
int ret;
+ struct sss_domain_info *dinfo;
confdb_path = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (confdb_path == NULL) {
@@ -505,6 +494,14 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain)
}
}
+ for (dinfo = ctx->domains; dinfo; dinfo = get_next_domain(dinfo, false)) {
+ ret = sss_names_init(ctx, ctx->confdb, dinfo->name, &dinfo->names);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("sss_names_init() failed\n"));
+ return ret;
+ }
+ }
+
return EOK;
}
--
1.8.3.1
-------------- next part --------------
From e2758703f9e89889b0e563c2d5aa409d6fec3b2b Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Tue, 26 Nov 2013 10:27:50 +0100
Subject: [PATCH 2/2] sss_cache: fix case-sensitivity issue
For case-insensitive domains the lower-case name for case-insensitive
searches is stored in SYSDB_NAME_ALIAS.
Related to https://fedorahosted.org/sssd/ticket/1741
---
src/tools/sss_cache.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index b4340c5..fab28be 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -236,7 +236,9 @@ static errno_t update_filter(struct cache_tool_ctx *tctx,
if (!strcasecmp(dinfo->name, parsed_domain)) {
if (fmt) {
filter = talloc_asprintf(tmp_ctx, fmt,
- SYSDB_NAME, use_name);
+ dinfo->case_sensitive ?
+ SYSDB_NAME : SYSDB_NAME_ALIAS,
+ use_name);
} else {
filter = talloc_strdup(tmp_ctx, use_name);
}
@@ -252,7 +254,10 @@ static errno_t update_filter(struct cache_tool_ctx *tctx,
}
} else {
if (fmt) {
- filter = talloc_asprintf(tmp_ctx, fmt, SYSDB_NAME, name);
+ filter = talloc_asprintf(tmp_ctx, fmt,
+ dinfo->case_sensitive ?
+ SYSDB_NAME : SYSDB_NAME_ALIAS,
+ name);
} else {
filter = talloc_strdup(tmp_ctx, name);
}
--
1.8.3.1
More information about the sssd-devel
mailing list