diff options
author | Michal Zidek <mzidek@redhat.com> | 2015-02-10 17:30:00 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-01-13 11:28:45 +0100 |
commit | 23674dfef4225b90d45c27b88fe72dc37b22e32d (patch) | |
tree | f3f2814e564511fef79db03b909cc86d10208999 /src/providers/ldap/sdap_utils.c | |
parent | 867c5d7d51327464a21f48fd6dc2a6f4f107bd36 (diff) | |
download | sssd-23674dfef4225b90d45c27b88fe72dc37b22e32d.tar.gz sssd-23674dfef4225b90d45c27b88fe72dc37b22e32d.tar.xz sssd-23674dfef4225b90d45c27b88fe72dc37b22e32d.zip |
sysdb: Unify name format for groups and users
This is WIP patch to unify format of
usernames and groupnames in sssd internals.
In current form it breaks just about everything.
The sysdb update function is just placeholder
and it's contents are irelevant.
Currently I am working on fqname attribute
removal because it seems to just add confusion.
If you decide to look into the code, please use
sunglasses or other other protective gear and play
some calm music in your backgroun to prevent
eye or brain injury.
Diffstat (limited to 'src/providers/ldap/sdap_utils.c')
-rw-r--r-- | src/providers/ldap/sdap_utils.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/providers/ldap/sdap_utils.c b/src/providers/ldap/sdap_utils.c index 9da46ea70..cf48d2541 100644 --- a/src/providers/ldap/sdap_utils.c +++ b/src/providers/ldap/sdap_utils.c @@ -77,10 +77,11 @@ errno_t sdap_save_all_names(const char *name, struct sysdb_attrs *ldap_attrs, struct sss_domain_info *dom, + bool use_internal_fqname, struct sysdb_attrs *attrs) { const char **aliases = NULL; - const char *domname; + const char *sysdb_alias; errno_t ret; TALLOC_CTX *tmp_ctx; int i; @@ -100,14 +101,20 @@ sdap_save_all_names(const char *name, } for (i = 0; aliases[i]; i++) { - domname = sss_get_domain_name(tmp_ctx, aliases[i], dom); - if (domname == NULL) { + if (use_internal_fqname) { + sysdb_alias = sss_create_internal_fqname(tmp_ctx, aliases[i], + dom->name); + } else { + sysdb_alias = sss_get_domain_name(tmp_ctx, aliases[i], dom); + } + + if (sysdb_alias == NULL) { ret = ENOMEM; goto done; } if (lowercase) { - ret = sysdb_attrs_add_lc_name_alias(attrs, domname); + ret = sysdb_attrs_add_lc_name_alias(attrs, sysdb_alias); if (ret) { DEBUG(SSSDBG_OP_FAILURE, "Failed to add lower-cased version " "of alias [%s] into the " @@ -115,7 +122,7 @@ sdap_save_all_names(const char *name, goto done; } } else { - ret = sysdb_attrs_add_string(attrs, SYSDB_NAME_ALIAS, domname); + ret = sysdb_attrs_add_string(attrs, SYSDB_NAME_ALIAS, sysdb_alias); if (ret) { DEBUG(SSSDBG_OP_FAILURE, "Failed to add alias [%s] into the " "attribute list\n", aliases[i]); |