From fac2e9f6f7551bf5bce89605cdb0672871613ca6 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Fri, 26 Oct 2012 16:13:57 +0200 Subject: do not default fullname to gecos when schema = ad https://fedorahosted.org/sssd/ticket/1482 When we add fullname to user_attrs, then sysdb_add_basic_user() will set fullname to gecos when it initially creates the user object in the cache, but it will be overwritten in the same transaction when sysdb_store_user() adds all the user_attrs. --- src/providers/ldap/sdap_async_users.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c index 48d184a86..d706740df 100644 --- a/src/providers/ldap/sdap_async_users.c +++ b/src/providers/ldap/sdap_async_users.c @@ -42,6 +42,7 @@ int sdap_save_user(TALLOC_CTX *memctx, struct ldb_message_element *el; int ret; const char *name = NULL; + const char *fullname = NULL; const char *pwd; const char *gecos; const char *homedir; @@ -83,6 +84,19 @@ int sdap_save_user(TALLOC_CTX *memctx, goto fail; } + if (opts->schema_type == SDAP_SCHEMA_AD) { + ret = sysdb_attrs_get_string(attrs, + opts->user_map[SDAP_AT_USER_FULLNAME].sys_name, &fullname); + if (ret == EOK) { + ret = sysdb_attrs_add_string(user_attrs, SYSDB_FULLNAME, fullname); + if (ret != EOK) { + goto fail; + } + } else if (ret != ENOENT) { + goto fail; + } + } + ret = sysdb_attrs_get_el(attrs, opts->user_map[SDAP_AT_USER_PWD].sys_name, &el); if (ret) goto fail; -- cgit