… | |
… | |
13 | my $buf; |
13 | my $buf; |
14 | my ($a,$b,$c,$d,%l,@l); # for use by shell users |
14 | my ($a,$b,$c,$d,%l,@l); # for use by shell users |
15 | |
15 | |
16 | print $fh "Welcome\n> "; |
16 | print $fh "Welcome\n> "; |
17 | |
17 | |
18 | Event->io (fd => $fh, poll => 'r', cb => sub { |
18 | Event->io (fd => $fh, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { |
19 | if (defined (my $cmd = <$fh>)) { |
19 | if (defined (my $cmd = <$fh>)) { |
20 | my $old_fh = select $fh; |
20 | my $old_fh = select $fh; |
21 | |
21 | |
22 | if ($cmd =~ /^\s*exit\b/i) { |
22 | if ($cmd =~ /^\s*exit\b/i) { |
23 | print "will not exit() server.\n"; |
23 | print "will not exit() server.\n"; |
… | |
… | |
38 | } |
38 | } |
39 | |
39 | |
40 | # now a shell listening on a tcp-port - let the firewall decide access rights |
40 | # now a shell listening on a tcp-port - let the firewall decide access rights |
41 | if ($cf::CFG{perl_shell}) { |
41 | if ($cf::CFG{perl_shell}) { |
42 | if (my $listen = new IO::Socket::INET LocalAddr => $cf::CFG{perl_shell}, Listen => 1, ReuseAddr => 1) { |
42 | if (my $listen = new IO::Socket::INET LocalAddr => $cf::CFG{perl_shell}, Listen => 1, ReuseAddr => 1) { |
43 | Event->io (fd => $listen, poll => 'r', cb => sub { tcp_serve $listen->accept }); |
43 | Event->io (fd => $listen, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { tcp_serve $listen->accept }); |
44 | } |
44 | } |
45 | } |
45 | } |