Skip to content

Commit

Permalink
Fix from Rob Bloodgood [RT #37145]
Browse files Browse the repository at this point in the history
  • Loading branch information
bingos committed May 27, 2009
1 parent f55c0f8 commit e0f6319
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
POE::Component::Proxy::SOCKS
============================

1.00 Wed May 27 22:17:41 BST 2009
- Pod tidying & Makefile.PL updates
- Fix from Rob Bloodgood [RT #37145]

0.08 Mon May 19 17:35:18 BST 2008
- removed kwalitee test
- added license information
Expand Down
54 changes: 27 additions & 27 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ DESCRIPTION
The poco supports both SOCKS CONNECT and SOCKS BIND commands.

CONSTRUCTOR
spawn
"spawn"
Starts a new SOCKS proxy session and returns an object. If spawned
from within another POE session, the parent session will be
automagically registered and receive a 'socksd_registered' event.
automagically registered and receive a "socksd_registered" event.
See below for details.

Takes several optional parameters:
Expand All @@ -80,116 +80,116 @@ METHODS
These methods are available on the returned POE::Component::Proxy::SOCKS
object:

session_id
"session_id"
Returns the POE session ID of the poco's session.

shutdown
"shutdown"
Terminates the poco, dropping all connections and pending
connections.

send_event
"send_event"
Sends an event through the poco's event handling system.

add_denial
"add_denial"
Takes one mandatory argument. The mandatory argument is a
Net::Netmask object that will be used to check connecting IP
addresses against.

del_denial
"del_denial"
Takes one mandatory argument, a Net::Netmask object to remove from
the current denial list.

denied
"denied"
Takes one argument, an IP address. Returns true or false depending
on whether that IP is denied or not.

add_exemption
"add_exemption"
Takes one mandatory argument, a Net::Netmask object that will be
checked against connecting IP addresses for exemption from denials.

del_exemption
"del_exemption"
Takes one mandatory argument, a Net::Netmask object to remove from
the current exemption list.

exempted
"exempted"
Takes one argument, an IP address. Returns true or false depending
on whether that IP is exempt from denial or not.

INPUT EVENTS
register
"register"
Takes N arguments: a list of event names that your session wants to
listen for, minus the 'socksd_' prefix, ( this is similar to
POE::Component::IRC ).

Registering for 'all' will cause it to send all SOCKSD-related
events to you; this is the easiest way to handle it.

unregister
"unregister"
Takes N arguments: a list of event names which you don't want to
receive. If you've previously done a 'register' for a particular
event which you no longer care about, this event will tell the
SOCKSD to stop sending them to you. (If you haven't, it just ignores
you. No big deal).

shutdown
"shutdown"
Terminates the poco, dropping all connections and pending
connections.

OUTPUT EVENTS
The component generates a number of 'socksd_' prefixed events that are
The component generates a number of "socksd_" prefixed events that are
dispatched to registered sessions.

socksd_registered
"socksd_registered"
This event is sent to a registering session. ARG0 is
POE::Component::Proxy::SOCKS object.

socksd_denied
"socksd_denied"
Generated whenever a client is denied access. ARG0 is the client IP
and ARG1 the client port.

socksd_connection
"socksd_connection"
Generated when client successfully connects. ARG0 is a unique client
ID, ARG1 is the peer address, ARG2 is the peer port, ARG3 is our
socket address and ARG4 is our socket port.

socksd_rejected
"socksd_rejected"
Generated when a SOCKS transaction is rejected. ARG0 is the unique
client ID, ARG1 is the SOCKS result code and ARG2 is a reason for
the rejection.

socksd_listener_failed
"socksd_listener_failed"
Generated if the poco fails to get a listener. ARG0 is the
operation, ARG1 is the errnum and ARG2 is the errstr.

socksd_disconnected
"socksd_disconnected"
Generated whenever a client disconnects. ARG0 is the unique client
ID.

socksd_dns_lookup
"socksd_dns_lookup"
Generated whenever the poco services a successful SOCKS 4a DNS
lookup. ARG0 is the unique client ID. ARG1 is the hostname resolved
and ARG2 is the IP address of that host.

socksd_sock_up
"socksd_sock_up"
Generated when a CONNECT is successful. ARG0 is the unique client
ID, ARG1 is the unqiue link ID, ARG2 is the destination IP and ARG3
the destination port.

socksd_bind_up
"socksd_bind_up"
Generated whenever a BIND is succesful. ARG0 is the unique client
ID, ARG1 is the unique ID for the listener, ARG2 is our socket IP
and ARG3 is our port.

socksd_sock_down
"socksd_sock_down"
Generated whenever a socket to an application server is terminated.
ARG0 is the unique client ID, ARG1 is the unqiue link ID, ARG2 is
the error string.

AUTHOR
Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
Chris "BinGOs" Williams <chris@bingosnet.co.uk>

LICENSE
Copyright "(c)" Chris Williams.
Copyright Chris Williams.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Expand Down
2 changes: 1 addition & 1 deletion lib/POE/Component/Proxy/SOCKS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ sub _sock_up {
$self->{clients}->{ $client_id }->{link_id} = $link_id;
$self->{links}->{ $link_id } = { client => $client_id, wheel => $wheel, sockaddr => $sockaddr, sockport => $sockport };
my $client = $self->{clients}->{ $client_id };
my $response = pack "CCnN", 0, 90, $client->{dstport}, inet_aton( $client->{dstip} );
my $response = pack "CCnN", 0, 90, $client->{dstport}, unpack("N", inet_aton( $client->{dstip}) );
$client->{wheel}->put( $response );
$self->_send_event( 'socksd_sock_up', $client_id, $link_id, $client->{dstip}, $client->{dstport} );
return;
Expand Down

0 comments on commit e0f6319

Please sign in to comment.