summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-04-19 11:41:12 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-07-07 10:28:13 +0200
commit281748ae307a1842d55712335acbe54821793de5 (patch)
tree95ece8e242e50f38268fe8c5aa89a7b4e3cecac0
parent643b48013c1f556530eb2a89a8baf4aa40357278 (diff)
downloadsssd-281748ae307a1842d55712335acbe54821793de5.tar.gz
sssd-281748ae307a1842d55712335acbe54821793de5.tar.xz
sssd-281748ae307a1842d55712335acbe54821793de5.zip
SSS_CACHE: Don't use sss_get_domain_name, but create the internal fqname instead for users and groups
All users and groups are now stored in the cache using the same format, so we can use that one instead of creating a domain-specific name. Reviewed-by: Sumit Bose <sbose@redhat.com>
-rw-r--r--src/tools/sss_cache.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 54161b27c..e44da5d48 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -243,6 +243,7 @@ static void free_input_values(struct input_values *values)
static errno_t update_filter(struct cache_tool_ctx *tctx,
struct sss_domain_info *dinfo,
char *name, bool update, const char *fmt,
+ enum sss_cache_entry entry_type,
bool force_case_sensitivity,
char **_filter)
{
@@ -292,12 +293,16 @@ static errno_t update_filter(struct cache_tool_ctx *tctx,
use_name = parsed_name;
}
- if (parsed_domain) {
- use_name = sss_get_domain_name(tmp_ctx, use_name, dinfo);
- if (!use_name) {
- ret = ENOMEM;
- goto done;
- }
+ switch (entry_type) {
+ case TYPE_USER:
+ case TYPE_GROUP:
+ use_name = sss_create_internal_fqname(tmp_ctx, use_name, dinfo->name);
+ default:
+ break;
+ }
+ if (!use_name) {
+ ret = ENOMEM;
+ goto done;
}
ret = sss_filter_sanitize_for_dom(tmp_ctx, use_name, dinfo,
@@ -346,7 +351,8 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
/* Update user filter */
ret = update_filter(tctx, dinfo, tctx->user_name,
- tctx->update_user_filter, "(%s=%s)", false,
+ tctx->update_user_filter, "(%s=%s)",
+ TYPE_USER, false,
&tctx->user_filter);
if (ret != EOK) {
return ret;
@@ -354,7 +360,8 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
/* Update group filter */
ret = update_filter(tctx, dinfo, tctx->group_name,
- tctx->update_group_filter, "(%s=%s)", false,
+ tctx->update_group_filter, "(%s=%s)",
+ TYPE_GROUP, false,
&tctx->group_filter);
if (ret != EOK) {
return ret;
@@ -362,7 +369,8 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
/* Update netgroup filter */
ret = update_filter(tctx, dinfo, tctx->netgroup_name,
- tctx->update_netgroup_filter, "(%s=%s)", false,
+ tctx->update_netgroup_filter, "(%s=%s)",
+ TYPE_NETGROUP, false,
&tctx->netgroup_filter);
if (ret != EOK) {
return ret;
@@ -370,7 +378,8 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
/* Update service filter */
ret = update_filter(tctx, dinfo, tctx->service_name,
- tctx->update_service_filter, "(%s=%s)", false,
+ tctx->update_service_filter, "(%s=%s)",
+ TYPE_SERVICE, false,
&tctx->service_filter);
if (ret != EOK) {
return ret;
@@ -379,7 +388,8 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
/* Update autofs filter */
ret = update_filter(tctx, dinfo, tctx->autofs_name,
tctx->update_autofs_filter,
- "(&(objectclass="SYSDB_AUTOFS_MAP_OC")(%s=%s))", true,
+ "(&(objectclass="SYSDB_AUTOFS_MAP_OC")(%s=%s))",
+ TYPE_AUTOFSMAP, true,
&tctx->autofs_filter);
if (ret != EOK) {
return ret;
@@ -387,7 +397,8 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
/* Update ssh host filter */
ret = update_filter(tctx, dinfo, tctx->ssh_host_name,
- tctx->update_ssh_host_filter, "(%s=%s)", false,
+ tctx->update_ssh_host_filter, "(%s=%s)",
+ TYPE_SSH_HOST, false,
&tctx->ssh_host_filter);
if (ret != EOK) {
return ret;