fixed problem with AD entries having unset fields
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package:
|
||||
name: ldapuserdir
|
||||
version: "2.1.2"
|
||||
version: "2.1.3"
|
||||
|
||||
source:
|
||||
path: ../../
|
||||
|
||||
+15
-18
@@ -345,28 +345,25 @@ desired (see self.page_size)."""
|
||||
records : ldap result structure with user records
|
||||
verbose : bool, optional
|
||||
"""
|
||||
fields = ['cn', 'msSFU30UidNumber', 'msSFU30UidNumber',
|
||||
'msSFU30GidNumber', 'displayName',
|
||||
'msSFU30LoginShell', 'msSFU30HomeDirectory']
|
||||
for dn, entry in records:
|
||||
# MUST fields
|
||||
try:
|
||||
print ':'.join([entry['cn'][0], entry['msSFU30UidNumber'][0],
|
||||
'IGNORE',
|
||||
entry['msSFU30GidNumber'][0],
|
||||
entry['displayName'][0],
|
||||
entry['msSFU30HomeDirectory'][0],
|
||||
entry['msSFU30LoginShell'][0],
|
||||
]),
|
||||
except KeyError:
|
||||
print ':'.join([entry['cn'][0],"","",entry['displayName'][0],
|
||||
"",""])
|
||||
|
||||
if verbose:
|
||||
for k in ['description', 'mail', 'mobile']:
|
||||
print '[%s:]' % (k,) ,
|
||||
for k in fields + ['description', 'mail', 'mobile']:
|
||||
if k in entry:
|
||||
print entry[k][0],
|
||||
sys.stdout.write('[%s:]%s:' % (k, entry[k][0]))
|
||||
else:
|
||||
print 'N.A.',
|
||||
print
|
||||
sys.stdout.write('[%s:]N.A.:' % k)
|
||||
sys.stdout.write('\n')
|
||||
else:
|
||||
for k in fields:
|
||||
if k in entry:
|
||||
sys.stdout.write('%s:' % (entry[k][0],))
|
||||
else:
|
||||
sys.stdout.write('N.A.:')
|
||||
sys.stdout.write('\n')
|
||||
|
||||
|
||||
def systemuser2dn(self, uname):
|
||||
"""Converts a user's system username to the dn of the ldap directory
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "2.1.2"
|
||||
__version__ = "2.1.3"
|
||||
|
||||
@@ -15,15 +15,44 @@
|
||||
#+SELECT_TAGS: export
|
||||
|
||||
* Bugs and feature requests
|
||||
** BUG Handling of ldap server returning slices
|
||||
** RESOLVED Error when displayName not set
|
||||
CLOSED: [2016-03-10 Thu 15:44]
|
||||
:LOGBOOK:
|
||||
- State "RESOLVED" from "BUG" [2016-03-10 Thu 15:44]
|
||||
- State "BUG" from [2016-03-09 Wed 14:13]
|
||||
:END:
|
||||
#+BEGIN_EXAMPLE
|
||||
dfeich@dflt1w:~/Documents/merlin-accounting$ ldapuserdir-ctl -n -u '*sz*'
|
||||
monoszlai_b:36001:IGNORE:710:Monoszlai Balazs:/afs/psi.ch/user/m/monoszlai_b:/bin/bash
|
||||
kupiszewski_p:4822:IGNORE:520:Kupiszewski Piotr:/afs/psi.ch/user/k/kupiszewski_p:/bin/bash
|
||||
szijarto_r:3107:IGNORE:420:Szijarto Rita:/afs/psi.ch/user/s/szijarto_r:/bin/tcsh
|
||||
janasz_f:4359:IGNORE:420:Janasz Filip:/afs/psi.ch/user/j/janasz_f:/bin/bash
|
||||
Traceback (most recent call last):
|
||||
File "/opt/anaconda/python2.7/bin/ldapuserdir-ctl", line 4, in <module>
|
||||
__import__('pkg_resources').run_script('ldapuserdir==2.1.2', 'ldapuserdir-ctl')
|
||||
File "/opt/anaconda/python2.7/lib/python2.7/site-packages/setuptools-20.1.1-py2.7.egg/pkg_resources/__init__.py", line 724, in run_script
|
||||
|
||||
File "/opt/anaconda/python2.7/lib/python2.7/site-packages/setuptools-20.1.1-py2.7.egg/pkg_resources/__init__.py", line 1657, in run_script
|
||||
|
||||
File "/opt/anaconda/python2.7/lib/python2.7/site-packages/ldapuserdir-2.1.2-py2.7.egg/EGG-INFO/scripts/ldapuserdir-ctl", line 345, in <module>
|
||||
|
||||
File "build/bdist.linux-x86_64/egg/ldapuserdir/ldapuserdir.py", line 359, in list_users_etcpwd
|
||||
KeyError: 'displayName'
|
||||
|
||||
#+END_EXAMPLE
|
||||
** RESOLVED Handling of ldap server returning slices (paging)
|
||||
CLOSED: [2016-03-03 Thu 15:07]
|
||||
:LOGBOOK:
|
||||
- State "RESOLVED" from "BUG" [2016-03-03 Thu 15:07]
|
||||
- State "BUG" from [2016-02-16 Tue 16:03]
|
||||
:END:
|
||||
- [ ] In the case of big groups, ldap returns the results with the attribute name
|
||||
member being extended for the slice information. Need to implement the client
|
||||
to be able to deal with this.
|
||||
- Dani's docu may help https://intranet.psi.ch/AIT/AdLdapClientConfiguration
|
||||
- Kai Kaminski supplied a fix in #c0fa2b0bbb7bfd58f4f5197936d1ca487fdb8c4d
|
||||
|
||||
|
||||
** WORKAROUND group list returning some elements with dn=None
|
||||
CLOSED: [2016-02-16 Tue 17:27]
|
||||
:LOGBOOK:
|
||||
|
||||
Reference in New Issue
Block a user