Create date from system in ldap module

Bogdan Siara bsiara.cgi at gmail.com
Mon Mar 17 12:28:40 CET 2014


I uuse exec module in ldap filter:
filter = "(&(uid=%{User-Name})(o=COMPANY)(pwdChangedTime>=%{exec:/usr/bin/
data.pl})(!(pwdAccountLockedTime=*)))"

perl script:

#!/usr/bin/perl -w

use strict;
use warnings;
use DateTime;

my $swstecz = 7776000;
my $imtemu = gen_filter($swstecz);
print "$imtemu";

sub gen_filter {
my ($warningtime) = @_;
my $dt = DateTime->now;
$dt->subtract(seconds => $warningtime);
my $filtertime = $dt->strftime('%Y%m%d%H%M%SZ');
return $filtertime;
}

and this work fine. Thanks Alan.

Regards
BS



2014-03-13 21:51 GMT+01:00 Alan DeKok <aland at deployingradius.com>:

> Bogdan Siara wrote:
> \\
> > I would like to add one more parameter to check attribute
> > pwdchangedtime, for example:
> > filter = "(&(uid=%{User-Name})(o=COMPANY)(pwdchangedtime>`date
> > --date="90 day ago" "+%Y%m%d%H%M%S"T`))"
> >
> > How to realize this trick?
>
>   It's just an LDAP query.  See the LDAP documentation for how to write
> LDAP queries.
>
>   Alan DeKok.
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/mailman/private/freeradius-users/attachments/20140317/cf85bec5/attachment.html>


More information about the Freeradius-Users mailing list