summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-03-29 15:13:51 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-03-30 11:46:23 -0400
commit4ba1fa74ea380d738ee6426b7c226e78619a1ad8 (patch)
tree0351bcdf589a578cb3d31cc970306328a2bf7888
parent29a805f0592d56d5b68858e8a30711f88a1ec5be (diff)
downloadsssd_unused-sssd-1.5.1-23.el6.tar.gz
sssd_unused-sssd-1.5.1-23.el6.tar.xz
sssd_unused-sssd-1.5.1-23.el6.zip
Fall back to cn if gecos is not availablesssd-1.5.1-23.el6
We were not fully compliant with section 5.3 of RFC 2307 which states: An account's GECOS field is preferably determined by a value of the gecos attribute. If no gecos attribute exists, the value of the cn attribute MUST be used. (The existence of the gecos attribute allows information embedded in the GECOS field, such as a user's telephone number, to be returned to the client without overloading the cn attribute. It also accommodates directories where the common name does not contain the user's full name.)
-rw-r--r--src/providers/ldap/sdap_async_accounts.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c
index 54416bb1..29a0f9f6 100644
--- a/src/providers/ldap/sdap_async_accounts.c
+++ b/src/providers/ldap/sdap_async_accounts.c
@@ -91,6 +91,15 @@ static int sdap_save_user(TALLOC_CTX *memctx,
if (el->num_values == 0) gecos = NULL;
else gecos = (const char *)el->values[0].data;
+ if (!gecos) {
+ /* Fall back to the user's full name */
+ ret = sysdb_attrs_get_el(
+ attrs,
+ opts->user_map[SDAP_AT_USER_FULLNAME].sys_name, &el);
+ if (ret) goto fail;
+ if (el->num_values > 0) gecos = (const char *)el->values[0].data;
+ }
+
ret = sysdb_attrs_get_el(attrs,
opts->user_map[SDAP_AT_USER_HOME].sys_name, &el);
if (ret) goto fail;