Changeset 864
- Timestamp:
- 04/04/09 01:04:55 (8 months ago)
- Location:
- trunk/DJabberd/lib/DJabberd
- Files:
-
- 2 modified
-
SASL/Manager/AuthenSASL.pm (modified) (1 diff)
-
Stanza/SASL.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/DJabberd/lib/DJabberd/SASL/Manager/AuthenSASL.pm
r841 r864 36 36 my $saslmgr = Authen::SASL->new( 37 37 mechanism => $mechanisms, 38 callback => {38 callback => { 39 39 checkpass => sub { 40 40 my $sasl = shift; 41 my ($user, $pass, $realm) = @_; 41 my $args = shift; 42 my $cb = shift; 42 43 43 my $success; 44 my $user = $args->{user}; 45 my $pass = $args->{pass}; 46 44 47 if ($vhost->are_hooks("CheckCleartext")) { 45 $vhost->run_hook_chain(phase => "CheckCleartext", 46 args => [ username => $user, password => $pass ], 47 methods => { 48 accept => sub { $success = 1 }, 49 reject => sub { $success = 0 }, 50 }, 48 $vhost->run_hook_chain( 49 phase => "CheckCleartext", 50 args => [ username => $user, password => $pass ], 51 methods => { 52 accept => sub { $cb->(1) }, 53 reject => sub { $cb->(0) }, 54 }, 51 55 ); 52 56 } 53 return $success;54 57 }, 55 58 getsecret => sub { 56 59 my $sasl = shift; 57 my ($user, $authname) = @_; 58 my $pass; 60 my $args = shift; 61 my $cb = shift; 62 63 my $user = $args->{user}; 59 64 60 65 if ($vhost->are_hooks("GetPassword")) { 61 $vhost->run_hook_chain( phase => "GetPassword",62 args => [ username => $user, ],63 methods => {64 set => sub{65 my (undef, $good_password) = @_;66 $pass = $good_password;67 },66 $vhost->run_hook_chain( 67 phase => "GetPassword", 68 args => [ username => $user, ], 69 methods => { 70 set => sub { 71 my (undef, $good_password) = @_; 72 $cb->($good_password); 68 73 }, 74 }, 69 75 ); 70 76 } 71 return $pass;72 77 }, 73 78 }, -
trunk/DJabberd/lib/DJabberd/Stanza/SASL.pm
r845 r864 59 59 $conn->log->info("Got the response $response"); 60 60 61 my $challenge = $sasl->server_step($response); 62 return $self->send_reply($sasl, $challenge => $conn); 61 $sasl->server_step( 62 $response => sub { $self->send_reply($conn->{sasl}, shift() => $conn) }, 63 ); 63 64 } 64 65 … … 98 99 my $init = $self->first_child; 99 100 if (!$init or $init eq '=') { 100 $init = '' 101 $init = ''; 101 102 } 102 103 else { … … 104 105 } 105 106 106 my $challenge = $sasl_conn->server_start($init); 107 return $self->send_reply($sasl_conn, $challenge => $conn); 107 $sasl_conn->server_start( 108 $init => sub { $self->send_reply($conn->{sasl}, shift() => $conn) }, 109 ); 108 110 } 109 111
