/[virtual-ldap]/lib/VLDAP/Server.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/VLDAP/Server.pm

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

revision 1 by dpavlin, Sat Mar 14 13:01:20 2009 UTC revision 2 by dpavlin, Sat Mar 14 13:45:20 2009 UTC
# Line 14  use Net::LDAP::Filter; Line 14  use Net::LDAP::Filter;
14  use base qw(Net::LDAP::Server);  use base qw(Net::LDAP::Server);
15  use fields qw(upstream);  use fields qw(upstream);
16    
17    use Net::LDAP;
18    
19  use URI::Escape;        # uri_escape  use URI::Escape;        # uri_escape
20  use IO::Socket::INET;  use IO::Socket::INET;
21  use IO::Select;  use IO::Select;
# Line 22  use Data::Dump qw/dump/; Line 24  use Data::Dump qw/dump/;
24    
25  =head1 NAME  =head1 NAME
26    
27  A3C::LDAP::Server  VLDAP::Server
28    
29  =cut  =cut
30    
31  =head1 DESCRIPTION  =head1 DESCRIPTION
32    
33  Provide LDAP server functionality for L<A3C> somewhat similar to C<slapo-rwm>  Provide LDAP server functionality somewhat similar to C<slapo-rwm>
34    
35  =head1 METHODS  =head1 METHODS
36    
37  =head2 run  =head2 run
38    
39    my $pid = A3C::LDAP::Server->run({ port => 1389, fork => 0 });    my $pid = VLDAP::Server->run({ port => 1389, fork => 0 });
40    
41  =cut  =cut
42    
# Line 80  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} = A3C::LDAP::Server->new($psock);                                  $Handlers{*$psock} = VLDAP::Server->new($psock);
86                          } else {                          } else {
87                                  my $result = $Handlers{*$fh}->handle;                                  my $result = $Handlers{*$fh}->handle;
88                                  if ($result) {                                  if ($result) {
# Line 96  sub run { Line 98  sub run {
98    
99  =head2 stop  =head2 stop
100    
101    my $stopped_pids = A3C::LDAP::Server->stop;    my $stopped_pids = VLDAP::Server->stop;
102    
103  =cut  =cut
104    
# Line 141  sub bind { Line 143  sub bind {
143                  resultCode => LDAP_STRONG_AUTH_NOT_SUPPORTED,                  resultCode => LDAP_STRONG_AUTH_NOT_SUPPORTED,
144          };          };
145    
146          $self->{upstream} ||= A3C::LDAP->new->ldap or return {          $self->{upstream} ||= Net::LDAP->new( 'ldaps://ldap.ffzg.hr/' ) or return {
147                  matchedDN => '',                  matchedDN => '',
148                  errorMessage => $@,                  errorMessage => $@,
149                  resultCode => LDAP_UNAVAILABLE,                  resultCode => LDAP_UNAVAILABLE,
150          };          };
151    
152  #       warn "## upstream = ",dump( $self->{upstream} );          warn "## upstream = ",dump( $self->{upstream} );
153  #       warn "upstream not Net::LDAP but ",ref($self->{upstream}) unless ref($self->{upstream}) eq 'Net::LDAP';          warn "upstream not Net::LDAP but ",ref($self->{upstream}) unless ref($self->{upstream}) eq 'Net::LDAP';
154    
155          my $msg;          my $msg;
156    
157          # FIXME we would need to unbind because A3C::LDAP binds us automatically, but that doesn't really work          # FIXME we would need to unbind because VLDAP binds us automatically, but that doesn't really work
158          #$msg = $self->{upstream}->unbind;          #$msg = $self->{upstream}->unbind;
159          #warn "# unbind msg = ",dump( $msg );          #warn "# unbind msg = ",dump( $msg );
160    

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

  ViewVC Help
Powered by ViewVC 1.1.26