/[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 4 by dpavlin, Sat Mar 14 14:47:54 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 82  sub run { Line 82  sub run {
82                                  # let's create a new socket                                  # let's create a new socket
83                                  my $psock = $sock->accept;                                  my $psock = $sock->accept;
84                                  $sel->add($psock);                                  $sel->add($psock);
85                                  $Handlers{*$psock} = VLDAP::Server->new($psock);                                  $Handlers{*$psock} = LDAP::Virtual->new($psock);
86                          } else {                          } else {
87                                  my $result = $Handlers{*$fh}->handle;                                  my $result = $Handlers{*$fh}->handle;
88                                  if ($result) {                                  if ($result) {
# Line 98  sub run { Line 98  sub run {
98    
99  =head2 stop  =head2 stop
100    
101    my $stopped_pids = VLDAP::Server->stop;    my $stopped_pids = LDAP::Virtual->stop;
102    
103  =cut  =cut
104    
# Line 158  sub bind { Line 158  sub bind {
158          #$msg = $self->{upstream}->unbind;          #$msg = $self->{upstream}->unbind;
159          #warn "# unbind msg = ",dump( $msg );          #warn "# unbind msg = ",dump( $msg );
160    
161          $msg = $self->{upstream}->bind(          my $bind;
162                  dn => $req->{name},          $bind->{dn} = $req->{name} if $req->{name};
163                  password => $req->{authentication}->{simple}          $bind->{password} = $req->{authentication}->{simple} if $req->{authentication}->{simple};
164          );          warn "# bind ",dump( $bind );
165            $msg = $self->{upstream}->bind( %$bind );
166    
167          #warn "# bind msg = ",dump( $msg );          #warn "# bind msg = ",dump( $msg );
168          if ( $msg->code != LDAP_SUCCESS ) {          if ( $msg->code != LDAP_SUCCESS ) {

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

  ViewVC Help
Powered by ViewVC 1.1.26