Changeset 854

Show
Ignore:
Timestamp:
02/11/09 21:57:13 (10 months ago)
Author:
ykerherve
Message:

Made Authen::SASL really optional

Location:
trunk/DJabberd
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/DJabberd/Makefile.PL

    r837 r854  
    1515                  'Log::Log4perl'                => 0, 
    1616                  'Digest::HMAC_SHA1'            => 0, 
    17                   'Authen::SASL'                 => 2.13 
    1817              }, 
    1918              clean      => { FILES => 't/log/*' }, 
  • trunk/DJabberd/t/features-hook.t

    r841 r854  
    55require 'djabberd-test.pl'; 
    66 
     7my $HAS_SASL; 
     8eval "use Authen::SASL 2.13"; 
     9$HAS_SASL = 1 unless $@; 
    710 
    811sub connect_and_get_features{ 
     
    5457  $server->kill;   
    5558 
    56   $server = Test::DJabberd::Server->new(id => 1); 
    57   $server->start( ); # by default we have SASL plugin enabled 
    58   my $client = Test::DJabberd::Client->new(server => $server, name => "client"); 
    59   { 
    60      my $features = connect_and_get_features($client); 
     59  SKIP: { 
     60    skip "These tests require SASL", 8 unless $HAS_SASL; 
     61    $server = Test::DJabberd::Server->new(id => 1); 
     62    $server->start( ); # by default we have SASL plugin enabled 
     63    my $client = Test::DJabberd::Client->new(server => $server, name => "client"); 
     64    { 
     65        my $features = connect_and_get_features($client); 
    6166 
    62      like($features, qr{^<features xmlns='http://etherx.jabber.org/streams'>.*</features>$}); 
    63      like($features, qr{<auth xmlns='http://jabber.org/features/iq-auth'/>}); 
    64      like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>}); 
    65      like($features, qr{<optional/>}, "our test setup makes sasl optional, bc of history of djabberd"); 
    66      for my $mech (qw/PLAIN DIGEST-MD5 LOGIN/) { 
    67          like($features, qr{<mechanism>$mech</mechanism>}, "supports $mech"); 
    68      }  
     67        like($features, qr{^<features xmlns='http://etherx.jabber.org/streams'>.*</features>$}); 
     68        like($features, qr{<auth xmlns='http://jabber.org/features/iq-auth'/>}); 
     69        like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>}); 
     70        like($features, qr{<optional/>}, "our test setup makes sasl optional, bc of history of djabberd"); 
     71        for my $mech (qw/PLAIN DIGEST-MD5 LOGIN/) { 
     72            like($features, qr{<mechanism>$mech</mechanism>}, "supports $mech"); 
     73        }  
    6974 
    70      like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>}); 
    71   } 
    72   $server->kill;   
     75        like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>}); 
     76    } 
     77    $server->kill;   
     78  }; 
    7379} 
    7480 
  • trunk/DJabberd/t/lib/djabberd-test.pl

    r853 r854  
    1111use DJabberd::RosterStorage::InMemoryOnly; 
    1212use DJabberd::Util; 
    13 use DJabberd::SASL::AuthenSASL; 
    1413use IO::Socket::UNIX; 
     14 
     15my $HAS_SASL; 
     16eval "use Authen::SASL 2.13"; 
     17unless ($@) { 
     18    require DJabberd::SASL::AuthenSASL; 
     19    $HAS_SASL = 1; 
     20} 
    1521 
    1622sub once_logged_in { 
     
    250256sub standard_plugins { 
    251257    my $self = shift; 
     258    my @sasl; 
     259    @sasl = ( DJabberd::SASL::AuthenSASL->new( 
     260                mechanisms => "LOGIN PLAIN DIGEST-MD5", 
     261                optional   => "yes", 
     262            )) if $HAS_SASL; 
    252263    return [ 
    253264            DJabberd::Authen::AllowedUsers->new(policy => "deny", 
     
    258269            DJabberd::Delivery::Local->new, 
    259270            DJabberd::Delivery::S2S->new, 
    260             DJabberd::SASL::AuthenSASL->new( 
    261                 mechanisms => "LOGIN PLAIN DIGEST-MD5", 
    262                 optional   => "yes", 
    263             ), 
     271            @sasl 
    264272            ]; 
    265273} 
  • trunk/DJabberd/t/sasl-login.t

    r851 r854  
    22use strict; 
    33use warnings; 
    4 use Test::More tests => 46; 
     4use Test::More; 
    55use lib 't/lib'; 
    66 
    77require 'djabberd-test.pl'; 
    88 
    9 use Authen::SASL 'Perl'; 
     9BEGIN { 
     10    eval "use Authen::SASL 2.13"; 
     11    if ($@) { 
     12        plan skip_all => 'Tests require Authen::SASL 2.13+'; 
     13    } 
     14    else { 
     15        plan tests => 46; 
     16        eval "use Authen::SASL 'Perl';"; 
     17    } 
     18} 
    1019 
    1120my $login_and_be = sub {