X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=tools%2Fiauth-test;h=c3dd1f25e15b7d3fd482c94dcf49b02889b2b2c2;hb=refs%2Fheads%2Fupstream-ssl;hp=2629b5285f470eb1bccad383b02132e426eb63b2;hpb=f1acbdf96cb8c8094df4aaf8011b20c7332ba2d6;p=ircu2.10.12-pk.git diff --git a/tools/iauth-test b/tools/iauth-test index 2629b52..c3dd1f2 100755 --- a/tools/iauth-test +++ b/tools/iauth-test @@ -11,7 +11,6 @@ use strict; use warnings; use vars qw(%pending); -use Carp; # for carp use Config; # for $Config{sig_name} and $Config{sig_num} use FileHandle; # for autoflush method on file handles @@ -27,6 +26,8 @@ use FileHandle; # for autoflush method on file handles # SIGRTMIN + 2 -> Set policy options ('O'). # SIGRTMIN + 3 -> Simulate config change ('a', 'A'). # SIGRTMIN + 4 -> Simulate statistics change ('s', 'S'). +# Note that Perl's value for SIGRTMIN may be different than your OS's. +# The easiest check is by running "perl -V:sig_num -V:sig_name". # In the following discussion, sX means message X from the server, and # iX means message X from iauth. The hard part is the ordering of @@ -143,7 +144,7 @@ BEGIN { } sub send_server_notice () { - reply "> Hello the server!"; + reply "> :Hello the server!"; } my %handlers = ( @@ -154,6 +155,8 @@ my %handlers = ( '127.0.0.2' => { C_reply => 'R account-1' }, '127.0.0.3' => { C_reply => 'k' }, '127.0.0.4' => { C_reply => 'K' }, + '127.0.0.5' => { C_reply => 'D Specials' }, + '127.0.0.6' => { C_reply => 'R account-1 Specials' }, '127.0.0.15' => { }, '127.0.0.16' => { H_reply => 'D' }, '127.0.0.17' => { H_reply => 'R account-2' }, @@ -163,19 +166,22 @@ my %handlers = ( '127.0.0.33' => { T_reply => 'R account-3' }, '127.0.0.34' => { T_reply => 'k' }, '127.0.0.35' => { T_reply => 'K' }, - # 127.0.1.x: io/iU/iu functionality. + # 127.0.1.x: io/iU/iu/iM functionality. '127.0.1.0' => { C_reply => 'o forced', H_reply => 'D' }, '127.0.1.1' => { C_reply => 'U trusted', H_reply => 'D' }, '127.0.1.2' => { C_reply => 'u untrusted', H_reply => 'D' }, + '127.0.1.3' => { C_reply => 'M +i', + H_reply => 'D' }, # 127.0.2.x: iI/iN functionality. '127.0.2.0' => { C_reply => 'N iauth.assigned.host', H_reply => 'D' }, '127.0.2.1' => { C_reply => \&ip_change }, + '127.0.2.2' => { H_reply => \&host_change_and_done }, # 127.0.3.x: iC/sP functionality. - '127.0.3.0' => { C_reply => 'C Please enter the password.', + '127.0.3.0' => { C_reply => 'C :Please enter the password.', P_reply => \&passwd_check }, ); @@ -197,6 +203,16 @@ sub ip_change ($$) { reply 'D', $client; } +# Note to potential debuggers: You will have to change the iauth +# policy before this (or any other H_reply hooks) will have any +# effect. Do this by sending two signals of $SIG{RTMIN+2} to the +# iauth-test process, as noted near the beginning of this script. +sub host_change_and_done ($$) { + my ($client, $extra) = @_; + reply 'N iauth.assigned.host', $client; + reply 'D', $client; +} + sub passwd_check ($$) { my ($client, $extra) = @_; if ($extra eq 'secret') {