/[A3C]/bin/ldap-server.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /bin/ldap-server.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 222 - (show annotations)
Thu Jun 26 20:46:33 2008 UTC (15 years, 9 months ago) by dpavlin
File MIME type: text/plain
File size: 736 byte(s)
simpliest possible data-dumping only LDAP server
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use IO::Select;
7 use IO::Socket;
8
9 use lib 'lib';
10 use A3C::LDAP::Server;
11
12 my $port = 1389;
13
14 my $sock = IO::Socket::INET->new(
15 Listen => 5,
16 Proto => 'tcp',
17 Reuse => 1,
18 LocalPort => $port,
19 );
20
21 warn "listen on port $port\n";
22
23 my $sel = IO::Select->new($sock);
24 my %Handlers;
25 while (my @ready = $sel->can_read) {
26 foreach my $fh (@ready) {
27 if ($fh == $sock) {
28 # let's create a new socket
29 my $psock = $sock->accept;
30 $sel->add($psock);
31 $Handlers{*$psock} = A3C::LDAP::Server->new($psock);
32 } else {
33 my $result = $Handlers{*$fh}->handle;
34 if ($result) {
35 # we have finished with the socket
36 $sel->remove($fh);
37 $fh->close;
38 delete $Handlers{*$fh};
39 }
40 }
41 }
42 }
43
44 1;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26