3 # See: http://search.cpan.org/dist/Net-Server/
9 use Net::Server::PreFork; # any personality will do
11 @ISA = qw(Net::Server::PreFork);
14 port=>"/tmp/example.sock|unix"
15 #conf_file=>"/etc/example.conf"
19 ### over-ridden subs below
20 # The protocol is the same as back-shell
27 local $SIG{ALRM} = sub { die "Timed Out!\n" };
28 my $timeout = 30; # give the user 30 seconds to type a line
31 my $request = <STDIN>;
33 if ($request eq "SEARCH\n") {
35 while (my $line = <STDIN>) {
38 if ($line =~ /^([^:]+):\s*(.*)$/) { # FIXME: handle base64 encoded
42 #sleep(2); # to test concurrency
43 print "dn: cn=test, dc=example, dc=com\n";
45 print "objectclass: cnobject\n";
49 print "info: answered by process $$\n";
53 print "code: 53\n"; # unwillingToPerform
54 print "info: I don't implement $request";
60 if( $@=~/timed out/i ){
62 print "code: 3\n"; # timeLimitExceeded
63 print "info: Timed out\n";
67 print "code: 1\n"; # operationsError
68 print "info: $@\n"; # FIXME: remove CR/LF