summaryrefslogtreecommitdiff
path: root/src/providers/ldap/sdap_async_users.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-09-21 10:50:18 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-09-28 09:22:48 -0400
commit033d1e3985288ec827db85882b052104485606ac (patch)
tree007e9ee457afe42904f15d1abd23133fc94bca6c /src/providers/ldap/sdap_async_users.c
parentfd61c807554d5a3ff74f065eb0438fe2524f4ba2 (diff)
downloadsssd-033d1e3985288ec827db85882b052104485606ac.tar.gz
sssd-033d1e3985288ec827db85882b052104485606ac.tar.bz2
sssd-033d1e3985288ec827db85882b052104485606ac.zip
Store name aliases for users, groups
Also checks fake users for aliases when storing a real users so that getgrnam for a RFC2307 group that references a user by his secondary name followed by getpwnam for this user by his primary name works
Diffstat (limited to 'src/providers/ldap/sdap_async_users.c')
-rw-r--r--src/providers/ldap/sdap_async_users.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index 82338dc1..adf3cf4e 100644
--- a/src/providers/ldap/sdap_async_users.c
+++ b/src/providers/ldap/sdap_async_users.c
@@ -56,6 +56,7 @@ int sdap_save_user(TALLOC_CTX *memctx,
char *usn_value = NULL;
size_t c;
char **missing = NULL;
+ const char **aliases = NULL;
TALLOC_CTX *tmpctx = NULL;
DEBUG(9, ("Save user\n"));
@@ -282,6 +283,20 @@ int sdap_save_user(TALLOC_CTX *memctx,
}
}
+ ret = sysdb_attrs_get_aliases(tmpctx, attrs, name, &aliases);
+ if (ret != EOK) {
+ DEBUG(1, ("Failed to get the alias list"));
+ goto fail;
+ }
+
+ for (i = 0; aliases[i]; i++) {
+ ret = sysdb_attrs_add_string(user_attrs, SYSDB_NAME_ALIAS,
+ aliases[i]);
+ if (ret) {
+ goto fail;
+ }
+ }
+
/* Make sure that any attributes we requested from LDAP that we
* did not receive are also removed from the sysdb
*/
@@ -366,6 +381,12 @@ int sdap_save_users(TALLOC_CTX *memctx,
DEBUG(9, ("User %d processed!\n", i));
}
+ ret = sdap_check_aliases(sysdb, users[i], dom,
+ opts, true);
+ if (ret) {
+ DEBUG(2, ("Failed to check aliases for user %d. Ignoring.\n", i));
+ }
+
if (usn_value) {
if (higher_usn) {
if ((strlen(usn_value) > strlen(higher_usn)) ||