Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using fullName where gecos and cn don't exist #8

Closed
jaqx0r opened this issue Mar 14, 2015 · 2 comments
Closed

using fullName where gecos and cn don't exist #8

jaqx0r opened this issue Mar 14, 2015 · 2 comments

Comments

@jaqx0r
Copy link
Contributor

jaqx0r commented Mar 14, 2015

Original issue 7 created by jaqx0r on 2008-04-18T13:35:38.000Z:

Here at Cardiff University we have a Novell e-directory system where
LDAP/posixAccount functionality was added late. This means the directory
structure is a bit idiosynchratic.

Anyway to cut to the chase: account entries lack gecos or cn. To get around
this I edited ldapsource to use fullName if cn or gecos were not found.


diff -uNr nsscache-0.7.3.dist/nss_cache/sources/ldapsource.py
nsscache-0.7.3/nss_cache/sources/ldapsource.py
--- nsscache-0.7.3.dist/nss_cache/sources/ldapsource.py 2008-04-09
05:46:33.000000000 +0100
+++ nsscache-0.7.3/nss_cache/sources/ldapsource.py 2008-04-18
14:32:32.000000000 +0100
@@ -373,7 +373,7 @@
def init(self):
super(PasswdUpdateGetter, self).init()
self.attrs = ['uid', 'uidNumber', 'gidNumber', 'gecos', 'cn',

  •              'homeDirectory', 'loginShell']
    
  •              'homeDirectory', 'loginShell', 'fullName']
    

    self.essential_fields = ['uid', 'uidNumber', 'gidNumber', 'homeDirectory']

    def CreateMap(self):
    @@ -389,7 +389,10 @@
    pw.gecos = obj['gecos'][0]
    elif 'cn' in obj:
    pw.gecos = obj['cn'][0]

  • elif 'fullName' in obj:

  •  pw.gecos = obj['fullName'][0]
    

    else:
    raise ValueError('Neither gecos nor cn found')

    pw.name = obj['uid'][0]


in the short term this works but is a bit inelegant. I guess being able to
add mappings into the config would be nice e.g:

[mappings]
gecos = fullName

and have that config change the way that attributes are looked up

@jaqx0r
Copy link
Contributor Author

jaqx0r commented Mar 14, 2015

Comment #1 originally posted by jaqx0r on 2008-08-11T01:01:26.000Z:

I like the long-term fix, that sounds good.

@jaqx0r
Copy link
Contributor Author

jaqx0r commented Mar 14, 2015

Comment #2 originally posted by jaqx0r on 2013-01-16T10:24:40.000Z:

This issue was closed by revision 025036e49f82.

@jaqx0r jaqx0r closed this as completed Mar 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant