/[virtual-ldap]/lib/LDAP/Virtual.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/LDAP/Virtual.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

lib/VLDAP/Server.pm revision 2 by dpavlin, Sat Mar 14 13:45:20 2009 UTC lib/LDAP/Virtual.pm revision 5 by dpavlin, Sat Mar 14 15:43:53 2009 UTC
# Line 1  Line 1 
1  package VLDAP::Server;  package LDAP::Virtual;
2    
3  use strict;  use strict;
4  use warnings;  use warnings;
# Line 24  use Data::Dump qw/dump/; Line 24  use Data::Dump qw/dump/;
24    
25  =head1 NAME  =head1 NAME
26    
27  VLDAP::Server  LDAP::Virtual
28    
29  =cut  =cut
30    
# Line 36  Provide LDAP server functionality somewh Line 36  Provide LDAP server functionality somewh
36    
37  =head2 run  =head2 run
38    
39    my $pid = VLDAP::Server->run({ port => 1389, fork => 0 });    my $pid = LDAP::Virtual->run({ port => 1389, fork => 0 });
40    
41  =cut  =cut
42    
# Line 44  our $pids; Line 44  our $pids;
44  our $cache;  our $cache;
45    
46  sub cache {  sub cache {
47          return $cache if $cache;          return $cache;
         $cache = new A3C::Cache->new({ instance => '', dir => 'ldap' });  
48  }  }
49    
50  sub run {  sub run {
# Line 82  sub run { Line 81  sub run {
81                                  # let's create a new socket                                  # let's create a new socket
82                                  my $psock = $sock->accept;                                  my $psock = $sock->accept;
83                                  $sel->add($psock);                                  $sel->add($psock);
84                                  $Handlers{*$psock} = VLDAP::Server->new($psock);                                  $Handlers{*$psock} = LDAP::Virtual->new($psock);
85                          } else {                          } else {
86                                  my $result = $Handlers{*$fh}->handle;                                  my $result = $Handlers{*$fh}->handle;
87                                  if ($result) {                                  if ($result) {
# Line 98  sub run { Line 97  sub run {
97    
98  =head2 stop  =head2 stop
99    
100    my $stopped_pids = VLDAP::Server->stop;    my $stopped_pids = LDAP::Virtual->stop;
101    
102  =cut  =cut
103    
# Line 158  sub bind { Line 157  sub bind {
157          #$msg = $self->{upstream}->unbind;          #$msg = $self->{upstream}->unbind;
158          #warn "# unbind msg = ",dump( $msg );          #warn "# unbind msg = ",dump( $msg );
159    
160          $msg = $self->{upstream}->bind(          my $bind;
161                  dn => $req->{name},          $bind->{dn} = $req->{name} if $req->{name};
162                  password => $req->{authentication}->{simple}          $bind->{password} = $req->{authentication}->{simple} if $req->{authentication}->{simple};
163          );          warn "# bind ",dump( $bind );
164            $msg = $self->{upstream}->bind( %$bind );
165    
166          #warn "# bind msg = ",dump( $msg );          #warn "# bind msg = ",dump( $msg );
167          if ( $msg->code != LDAP_SUCCESS ) {          if ( $msg->code != LDAP_SUCCESS ) {
# Line 240  sub search { Line 240  sub search {
240    
241          warn "## entries = ",dump( @entries );          warn "## entries = ",dump( @entries );
242    
243          $self->cache->write_cache( \@entries, uri_escape( $filter ));  #       $self->cache->write_cache( \@entries, uri_escape( $filter ));
244    
245          return RESULT_OK, @entries;          return RESULT_OK, @entries;
246  }  }

Legend:
Removed from v.2  
changed lines
  Added in v.5

  ViewVC Help
Powered by ViewVC 1.1.26