astro-ruby-sasl 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,13 +52,16 @@ module SASL
52
52
  rspauth_expected = response_value(@nonce, @nc, @cnonce, @qop, '')
53
53
  p :rspauth_received=>c['rspauth'], :rspauth_expected=>rspauth_expected
54
54
  if c['rspauth'] == rspauth_expected
55
- @state = :success
56
- ['success', nil]
55
+ ['response', nil]
57
56
  else
57
+ # Bogus server?
58
58
  @state = :failure
59
59
  ['failure', nil]
60
60
  end
61
61
  end
62
+ else
63
+ # No challenge? Might be success or failure
64
+ super
62
65
  end
63
66
  end
64
67
 
@@ -44,7 +44,8 @@ describe SASL::DigestMD5 do
44
44
 
45
45
  sasl.receive('challenge',
46
46
  'rspauth=ea40f60335c427b5527b84dbabcdfffd').should ==
47
- ['success', nil]
47
+ ['response', nil]
48
+ sasl.receive('success', nil).should == nil
48
49
  sasl.success?.should == true
49
50
  end
50
51
 
@@ -69,7 +70,8 @@ describe SASL::DigestMD5 do
69
70
 
70
71
  sasl.receive('challenge',
71
72
  'rspauth=2f0b3d7c3c2e486600ef710726aa2eae').should ==
72
- ['success', nil]
73
+ ['response', nil]
74
+ sasl.receive('success', nil).should == nil
73
75
  sasl.success?.should == true
74
76
  end
75
77
 
@@ -94,4 +96,12 @@ describe SASL::DigestMD5 do
94
96
  response[1].should =~ /response=b0b5d72a400655b8306e434566b10efb"?/ # my own result
95
97
  response[1].should =~ /"?qop=auth"?/
96
98
  end
99
+
100
+ it 'should fail' do
101
+ sasl = SASL::DigestMD5.new('DIGEST-MD5', preferences)
102
+ sasl.start.should == ['auth', nil]
103
+ sasl.receive('failure', 'EPIC FAIL')
104
+ sasl.failure?.should == true
105
+ sasl.success?.should == false
106
+ end
97
107
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astro-ruby-sasl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephan Maka
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-06 00:00:00 -08:00
12
+ date: 2009-02-07 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15