-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.)


Fixes https://fedorahosted.org/sssd/ticket/703

- -- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk2SMBgACgkQeiVVYja6o6OzmwCeNqCsQq1AQUQiVR+nVeXJqMGv
3HUAoKClxslcIUvI5aYwPLqApp+UAmlT
=seDS
-----END PGP SIGNATURE-----

From b285d7ff7bb878fc9b609e7474fdbf3c7f470d24 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgall...@redhat.com>
Date: Tue, 29 Mar 2011 15:13:51 -0400
Subject: [PATCH] Fall back to cn if gecos is not available

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.)
---
 src/providers/ldap/sdap_async_accounts.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c
index 54416bb126ef1a306e00190961cac2196b3d4582..8d723b1ca6e01b788dc05ccd97995f784085fa78 100644
--- a/src/providers/ldap/sdap_async_accounts.c
+++ b/src/providers/ldap/sdap_async_accounts.c
@@ -91,6 +91,16 @@ 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 = NULL;
+        else 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;
-- 
1.7.4

Attachment: 0001-Fall-back-to-cn-if-gecos-is-not-available.patch.sig
Description: PGP signature

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to