NAME
POE::Component::Server::Ident - A component that provides non-blocking ident services to your sessions.
SYNOPSIS
use POE::Component::Server::Ident;
POE::Component::Server::Ident->spawn ( Alias => 'Ident-Server' );
POE::Session->create (
inline_states => {
identd_request => \&ident_request_handler,
},
);
$kernel->post ( 'Ident-Server' => 'register' );
$kernel->post ( 'Ident-Server' => 'unregister' );
sub ident_request_handler {
my ($kernel,$sender,$peeraddr,$port1,$port2) = @_[KERNEL,SENDER,ARG0,ARG1,ARG2];
$kernel->call ( $sender => ident_server_reply => 'UNIX' => 'lameuser' );
}
DESCRIPTION
POE::Component::Server::Ident is a POE ( Perl Object Environment ) component that provides a non-blocking Identd for other components and POE sessions.
Spawn the component, give it an alias and it will sit there waiting for Ident clients to connect. Register with the component to receive ident events. The component will listen for client connections. A valid ident request made by a client will result in an 'identd_server' event being sent to your session. You may send back 'ident_server_reply' or 'ident_server_error' depending on what the client sent.
The component will automatically respond to the client requests with 'ERROR : HIDDEN-USER' if your sessions do not send a reponse within a 10 second timeout period.
METHODS
- spawn
-
Takes a number of arguments: 'Alias', a kernel alias to address the component with; 'BindAddr', the IP address that the component should bind to, defaults to INADDR_ANY; 'BindPort', the port that the component will bind to, default is 113; 'Multiple', specify whether the component should allow multiple ident queries from clients by setting this to 1, default is 0 which terminates client connections after a response has been sent; 'TimeOut', this is the idle timeout on client connections, default is 60 seconds, excepts values between 60 and 180 seconds.
INPUT
The component accepts the following events:
- register
-
Takes no arguments. This registers your session with the component. The component will then send you 'identd_request' events when clients make valid ident requests. See below.
- unregister
-
Takes no arguments. This unregisters your session with the component.
- ident_server_reply
-
Takes two arguments, the first is the 'opsys' field of the ident response, the second is the 'userid'.
- ident_server_error
-
Takes one argument, the error to return to the client.
OUTPUT
The component will send the following events:
- identd_request
-
Sent by the component to 'registered' sessions when a client makes a valid ident request. ARG0 is the IP address of the client, ARG1 and ARG2 are the ports as specified in the ident request. You can use the 'ident_server_reply' and 'ident_server_error' to respond to the client appropriately. Please note, that you send these responses to $_[SENDER] not the kernel alias of the component.
AUTHOR
Chris Williams, <chris@bingosnet.co.uk>