projects
/
virtual-ldap
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rewrite DN from login@domain.com into uid=login,dc=domain,dc=com
[virtual-ldap]
/
lib
/
LDAP
/
Virtual.pm
diff --git
a/lib/LDAP/Virtual.pm
b/lib/LDAP/Virtual.pm
index
42ee0d1
..
4ee090e
100644
(file)
--- a/
lib/LDAP/Virtual.pm
+++ b/
lib/LDAP/Virtual.pm
@@
-20,6
+20,8
@@
use URI::Escape; # uri_escape
use IO::Socket::INET;
use IO::Select;
use IO::Socket::INET;
use IO::Select;
+use YAML qw/DumpFile/;
+
use Data::Dump qw/dump/;
=head1 NAME
use Data::Dump qw/dump/;
=head1 NAME
@@
-41,11
+43,6
@@
Provide LDAP server functionality somewhat similar to C<slapo-rwm>
=cut
our $pids;
=cut
our $pids;
-our $cache;
-
-sub cache {
- return $cache;
-}
sub run {
my $self = shift;
sub run {
my $self = shift;
@@
-159,6
+156,14
@@
sub bind {
my $bind;
$bind->{dn} = $req->{name} if $req->{name};
my $bind;
$bind->{dn} = $req->{name} if $req->{name};
+
+ if ( $bind->{dn} =~ m{@} ) {
+
+ $bind->{dn} =~ s/[@\.]/,dc=/g;
+ $bind->{dn} =~ s/^/uid=/;
+
+ }
+
$bind->{password} = $req->{authentication}->{simple} if $req->{authentication}->{simple};
warn "# bind ",dump( $bind );
$msg = $self->{upstream}->bind( %$bind );
$bind->{password} = $req->{authentication}->{simple} if $req->{authentication}->{simple};
warn "# bind ",dump( $bind );
$msg = $self->{upstream}->bind( %$bind );
@@
-240,7
+245,9
@@
sub search {
warn "## entries = ",dump( @entries );
warn "## entries = ",dump( @entries );
-# $self->cache->write_cache( \@entries, uri_escape( $filter ));
+ my $path = 'var/' . uri_escape( $filter ) . '.yml';
+ DumpFile( $path, \@entries );
+ warn "# created $path ", -s $path, " bytes";
return RESULT_OK, @entries;
}
return RESULT_OK, @entries;
}