Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added need_step support to PLAIN mechanism

  • Loading branch information...
commit aa7ccc1a6f7ea17e81765801a21e0be0b2ed5e56 1 parent 88444a3
@yannk yannk authored gbarr committed
Showing with 15 additions and 3 deletions.
  1. +5 −2 lib/Authen/SASL/Perl/PLAIN.pm
  2. +10 −1 t/plain.t
View
7 lib/Authen/SASL/Perl/PLAIN.pm
@@ -26,7 +26,9 @@ sub mechanism { 'PLAIN' }
sub client_start {
my $self = shift;
- $self->{error} = undef;
+
+ $self->{error} = undef;
+ $self->{need_step} = 0;
my @parts = map {
my $v = $self->_call($_);
@@ -41,7 +43,8 @@ sub server_start {
my $challenge = shift;
$self->{error} = undef;
- return unless defined $challenge;
+ return $self->set_error("No challenge: Credentials don't match")
+ unless defined $challenge;
my %parts;
@parts{@tokens} = split "\0", $challenge, scalar @tokens;
View
11 t/plain.t
@@ -1,6 +1,6 @@
#!perl
-use Test::More tests => 5;
+use Test::More tests => 14;
use Authen::SASL qw(Perl);
@@ -19,9 +19,18 @@ is($sasl->mechanism, 'PLAIN', 'sasl mechanism');
my $conn = $sasl->client_new("ldap","localhost");
is($conn->mechanism, 'PLAIN', 'conn mechanism');
+ok $conn->need_step, "we need to *start* at the minimum";
+ok !$conn->is_success, "no success yet";
+ok !$conn->error, "and no error";
is($conn->client_start, "none\0gbarr\0fred", 'client_start');
+ok !$conn->need_step, "we're done, plain is kinda quick";
+ok $conn->is_success, "success!";
+ok !$conn->error, "and no error";
is($conn->client_step("xyz"), undef, 'client_step');
+ok !$conn->need_step, "we're done already";
+ok $conn->is_success, "sucess already";
+ok !$conn->error, "and no error";
Please sign in to comment.
Something went wrong with that request. Please try again.