From ec2102d767bd658668d59db0954013c9c20c15dd 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 8974e6a2..e2e7b72d 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; @@ -82,6 +83,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