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

ldapsource.py expects modifyTimestamp instead of modifyTimeStamp #52

Closed
jtpereyda opened this issue Oct 1, 2015 · 4 comments
Closed

Comments

@jtpereyda
Copy link
Contributor

Stack trace; notice 'modifyTimeStamp': ['20150920045950.0Z'] on line 2 and the exception at the bottom: KeyError: 'modifyTimestamp':

DEBUG:LdapSource:searching for base='dc=ad,dc=selinc,dc=com', filter='(&(objectCategory=Person)(uidNumber=*)(gidNumber=*))', scope=2, attrs=['uid', 'shadowLastChange', 'shadowMin', 'shadowMax', 'shadowWarning', 'shadowInactive', 'shadowExpire', 'shadowFlag', 'userPassword', 'modifyTimestamp']
obj:{'uid': ['timti'], 'modifyTimeStamp': ['20150920045950.0Z']}
Traceback (most recent call last):
  File "/usr/local/bin/nsscache", line 33, in <module>
    return_value = nsscache_app.Run(sys.argv[1:], os.environ)
  File "/usr/local/lib/python2.7/dist-packages/nss_cache/app.py", line 240, in Run
    retval = command_callable().Run(conf=conf, args=args)
  File "/usr/local/lib/python2.7/dist-packages/nss_cache/command.py", line 230, in Run
    force_lock=options.force_lock)
  File "/usr/local/lib/python2.7/dist-packages/nss_cache/command.py", line 312, in UpdateMaps
    force_write=force_write)
  File "/usr/local/lib/python2.7/dist-packages/nss_cache/update/updater.py", line 265, in UpdateFromSource
    force_write, location=None)
  File "/usr/local/lib/python2.7/dist-packages/nss_cache/update/map_updater.py", line 75, in UpdateCacheFromSource
    location=location)
  File "/usr/local/lib/python2.7/dist-packages/nss_cache/sources/source.py", line 69, in GetMap
    return self.GetShadowMap(since)
  File "/usr/local/lib/python2.7/dist-packages/nss_cache/sources/ldapsource.py", line 325, in GetShadowMap
    since=since)
  File "/usr/local/lib/python2.7/dist-packages/nss_cache/sources/ldapsource.py", line 507, in GetUpdates
    obj_ts = self.FromLdapToTimestamp(obj['modifyTimestamp'][0])
KeyError: 'modifyTimestamp'

The lookup expects modifyTimestamp, but LDAP gives modifyTimeStamp.

The quick fix is to change the string in ldapsource.py (recommend changing entire file for consistency).

The better fix would be to make comparisons case-insensitive. Hypothetically, an LDAP server could send us modifyTimestamp.

@jtpereyda
Copy link
Contributor Author

It occurred to me that this bug might be a result of my LDAP server being different. The insensitive lookup option is probably much safer.

@jaqx0r
Copy link
Contributor

jaqx0r commented Oct 1, 2015

What server version are you using?

On Fri, 2 Oct 2015, 05:58 Joshua Pereyda notifications@github.com wrote:

It occurred to me that this bug might be a result of my LDAP server being
different. The insensitive lookup option is probably much safer.


Reply to this email directly or view it on GitHub
#52 (comment).

@jtpereyda
Copy link
Contributor Author

Active Directory. My IS department tells me they're Server 2012 and Server 2008 R2.

@jtpereyda
Copy link
Contributor Author

Update: the change-to-modifyTimeStamp does indeed for me, but I think the patch should be more generic.

jaqx0r added a commit that referenced this issue Oct 2, 2015
Issue #52 Fix case-insensitive modifyTimestamp
@jaqx0r jaqx0r closed this as completed Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants