summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
W. Trevor King [Sun, 20 Jan 2013 15:48:19 +0000 (10:48 -0500)]
Restructure around an LDAPConnection class
This keeps us organized and simplifies the connection API (using the
'with' statement).
I also simplified the cache structure to keep all cached entries in a
single pickled dict, to avoid calculating safe filenames for each
query. The number of queries you make in 14 days will probably not be
large enough for any fan-out efficiencies to be worth the trouble.
I considered using JSON instead of Pickle, but JSON does not support
raw byte strings (e.g. jpegPhoto), and it's not worth encoding
non-text fields using Base64, etc., when Pickle already works.
It would be nice to automatically detect and drop any non text fields,
but that's probably not worth the trouble either...
W. Trevor King [Sun, 20 Jan 2013 14:33:47 +0000 (09:33 -0500)]
Decode search results to Unicode and print as Unicode
LDAPv3 strings are encoded in UTF-8 [1], so use that encoding to
decode them in format_columns(). Adjust format_entry() and the main
block to handle the Unicode output from format_columns().
[1]: http://tools.ietf.org/html/rfc2251#section-4.1.2
W. Trevor King [Sun, 20 Jan 2013 13:35:03 +0000 (08:35 -0500)]
Bump my copyright to 2013 and add Niels de Vos
W. Trevor King [Sun, 20 Jan 2013 13:34:13 +0000 (08:34 -0500)]
Adapt to Unicode sys.argv
W. Trevor King [Sun, 20 Jan 2013 13:26:54 +0000 (08:26 -0500)]
Convert sys.argv to Unicode (using a configurable encoding)
In Python 3, sys.argv is already Unicode, but there's no clean way to
do this automatically in Python 2 [1]. If your system doesn't use
UTF-8 for it's argv encoding, you should set system.argv-encoding in
your ~/.mutt-ldap.rc. For example, if your system uses UTF-16, try:
[system]
argv-encoding = utf-16
[1]: http://bugs.python.org/issue2128
W. Trevor King [Sun, 20 Jan 2013 13:22:38 +0000 (08:22 -0500)]
search: Move asynchronous result handling inside search()
The result of search() should be an iterable returning entries. If we
want to use the asynchronous connection.search() and
connection.result(), that's fine, but we should handle the result
unpacking inside search().
One benefit to Wade's new generator approach is that we can start
formatting early entries while we wait for later entries to arrive.
W. Trevor King [Sun, 20 Jan 2013 12:03:29 +0000 (07:03 -0500)]
search: `post` and `query` should be Unicode strings
They're being formatted into the Unicode `filterstr`. Being explicit
here should make the transition to Python 3 less annoying.
W. Trevor King [Sun, 20 Jan 2013 17:17:57 +0000 (12:17 -0500)]
Merge remote-tracking branch 'wberrier/master' into master
* wberrier/master:
prevent an error when no search string is given
Return partial results if the search takes a long time
implement caching system for big/slow ldap servers
make search fields configurable
Add support for an optional display column
Fix for python 2.6: add position indexes to format strings
Add query filter section (in order to pare down results)
Return results in a format that mutt expects
fix typo in reference to .rc file
Add Wade Berrier (me) to author/copyright list
Niels de Vos [Thu, 13 Dec 2012 09:35:05 +0000 (10:35 +0100)]
prevent an error when no search string is given
Wade Berrier [Sun, 20 Jan 2013 02:54:43 +0000 (19:54 -0700)]
Return partial results if the search takes a long time
An impartial result is better than no result. Done by requiring search
to have a pre-allocated connection.
Wade Berrier [Wed, 27 Jun 2012 16:10:42 +0000 (10:10 -0600)]
implement caching system for big/slow ldap servers
Wade Berrier [Wed, 27 Jun 2012 07:33:11 +0000 (01:33 -0600)]
make search fields configurable
Wade Berrier [Sun, 20 Jan 2013 01:34:51 +0000 (18:34 -0700)]
Add support for an optional display column
Again, according to http://www.mutt.org/doc/manual/manual-4.html#ss4.5
Wade Berrier [Sun, 20 Jan 2013 01:02:10 +0000 (18:02 -0700)]
Fix for python 2.6: add position indexes to format strings
Turns out that omitting the indexes is only supported in python >= 2.7
It's possible this script would work with python < 2.6 but the old
format strings would be necessary
Wade Berrier [Sat, 19 Jan 2013 21:05:59 +0000 (14:05 -0700)]
Add query filter section (in order to pare down results)
Wade Berrier [Sat, 19 Jan 2013 20:55:41 +0000 (13:55 -0700)]
Return results in a format that mutt expects
According to: http://www.mutt.org/doc/manual/manual-4.html#ss4.5
Wade Berrier [Sat, 19 Jan 2013 20:46:28 +0000 (13:46 -0700)]
fix typo in reference to .rc file
Wade Berrier [Sat, 19 Jan 2013 20:44:07 +0000 (13:44 -0700)]
Add Wade Berrier (me) to author/copyright list
W. Trevor King [Fri, 28 Sep 2012 00:08:16 +0000 (20:08 -0400)]
posts:ldap: update Python scripts to explicitly use Python 2.
python-ldap doesn't have a Python 3 version yet. I made a few other
changes to increase Python 3 compatibility, and added a full copyright
blurb to abook-ldif-cleanup.py.
W. Trevor King [Wed, 15 Aug 2012 14:13:20 +0000 (10:13 -0400)]
Also search on displayName in mutt-ldap.py and ldap-jpeg.py.
Also prefer displayName to cn when formatting names.
W. Trevor King [Mon, 14 May 2012 13:21:57 +0000 (09:21 -0400)]
Add starttls support to mutt-ldap.py and ldap-jpeg.py.
Also remove `rdn` from the searched attributes, because I don't have
such a field in any of my schemas.
W. Trevor King [Fri, 11 May 2012 06:10:12 +0000 (02:10 -0400)]
Add auth.gssapi option to mutt-ldap.py (for use with Kerberos).
W. Trevor King [Tue, 21 Jun 2011 12:26:01 +0000 (08:26 -0400)]
Add GnuTLS and secure LDAP information.
W. Trevor King [Sat, 18 Jun 2011 18:32:05 +0000 (14:32 -0400)]
Add mutt-ldap.py.