[Date Prev][Date Next] [Chronological] [Thread] [Top]

Search Filter: Builtin Date/Time Functions?



I apologize if this question has already been asked/answered, but I've
searched the list archives and googled without success. The use of date or
time in a search yields more false positives than any human can process. 
 
I'm running Linux 2.4.22, with OpenLDAP v2.1.22. I'm using a
generalizedTimeMatch attribute to specify the account expiration date, with
the general format: 20031129235959-0600 (YYYYMMDDhhmmssz). Using the command
line ldapsearch command, I can use the following to query those accounts
that are still active:
 
ldapsearch "(&(radiusExpiration>=`date +%Y%m%d%H%M%S%z`))"
 
The above works great from the command line. But from the various
applications used (postfix, courier-imap/pop3, maildrop, freeradius), some
have date expansion support, but others don't. As near as I can tell, my
options are to modify the various applications to support date expansion /
variables or to modify OpenLDAP to support what I need. Obviously modifying
OpenLDAP should prove the least amount of work since it's one application
used by many. 
 
My plan is use a predefined string / parameter that would be parsed
internally by the server. An example would be something like:
 
(&(radiusExpiration>=getDate()))
 
When executed by the OpenLDAP server, it would the search parameter / filter
looking for getDate() and replace the value with the current time on the
server in generalizedTimeMatch format. The code change should be relatively
trivial.  But, before I go through the trouble of implementing this, I
wanted to know if something was already implemented that would do what I
need...perhaps some internal server parameter that I can reference...or
perhaps I'm going about this the wrong way...and thereby possibly causing
performance problems, etc.
 
If I need to modify code, I believe the correct file to implement the change
would be servers/slapd/filter.c  Please correct me if I'm wrong.
 
Thanks for any help you can provide.