sockit 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 907c5d4706db600ca4dec35e5c2aeb5211763a97
4
- data.tar.gz: 9afa39561d67dd87fcfb2eeeba8fd1115a09502a
3
+ metadata.gz: e1c3573605d7f098845826d1e1be93105351ba8c
4
+ data.tar.gz: a4dfbbe50dc3458b2f82144fae7163fba1b2073e
5
5
  SHA512:
6
- metadata.gz: b7417a68988c366b894954f9878c7fed9f24625589d59b9b1c0ab2e1033d41fd85d495c02316a86b8fe149a95f51b0679e063fca195b9c3bdeb77f9f94dc850e
7
- data.tar.gz: f6916250ecdb190427463a2be6b49c0ac584a3762bae1ba24222ebfaa6a7e171ae1059be8c5230eae8429bcde22b823105ae5ee06f18e2e9a96cc6c9d484ce1b
6
+ metadata.gz: dd52aeffe4d0e8f19050faab68669bb8b7c0309164fe207b984542e21432206b4726f5030f449d52dd13900010a886d0e6dd32bbac76fbfb5cb39469416e796d
7
+ data.tar.gz: f198b98c10ff53ca6c7889f46165af6eb50d428e05a1a432d0d141b01854cbace19beb0bd091d44e78d1aa3446f5a543562b0545a6eb2009cc7fc7d6c8fa3130
@@ -48,9 +48,9 @@ module Sockit
48
48
  end
49
49
 
50
50
  if server_auth_method == 0xFF
51
- raise SockitError, authentication_method(server_auth_method)
51
+ raise SockitError, build_v5_authentication_method_message(server_auth_method)
52
52
  else
53
- log(:green, authentication_method(server_auth_method))
53
+ log(:green, build_v5_authentication_method_message(server_auth_method))
54
54
  end
55
55
 
56
56
  # The subsequent authentication is method-dependent. Username and password authentication (method 0x02) is described in RFC 1929:
@@ -91,9 +91,9 @@ module Sockit
91
91
  status_code = auth_reply[1]
92
92
 
93
93
  if status_code == 0x00
94
- log(:green, authentication_status(status_code))
94
+ log(:green, build_v5_authentication_status_message(status_code))
95
95
  else
96
- raise SockitError, authentication_status(status_code)
96
+ raise SockitError, build_v5_authentication_status_message(status_code)
97
97
  end
98
98
  end
99
99
 
@@ -47,34 +47,44 @@ module Sockit
47
47
  # 0x02: Username/Password[11]
48
48
  # 0x03-0x7F: methods assigned by IANA[12]
49
49
  # 0x80-0xFE: methods reserved for private use
50
- def authentication_method(auth_method)
51
- case auth_method
50
+ def build_v5_authentication_method_message(auth_method)
51
+ message = case auth_method
52
52
  when 0x00 then
53
- "No authentication (Code: 0x%02X)" % auth_method
53
+ "No authentication"
54
54
  when 0x01 then
55
- "GSSAPI authentication (Code: 0x%02X)" % auth_method
55
+ "GSSAPI authentication"
56
56
  when 0x02 then
57
- "Username/Password authentication (Code: 0x%02X)" % auth_method
57
+ "Username/Password authentication"
58
58
  when 0x03..0x7F then
59
- "Authentication method assigned by IANA (Code: 0x%02X)" % auth_method
59
+ "Authentication method assigned by IANA"
60
60
  when 0x80..0xFE then
61
- "Authentication method reserved for private use (Code: 0x%02X)" % auth_method
61
+ "Authentication method reserved for private use"
62
62
  when 0xFF then
63
- "Unsupported authentication (Code: 0x%02X)" % auth_method
63
+ "Unsupported authentication"
64
64
  else
65
- "Unknown authentication (Code: 0x%02X)" % auth_method
65
+ "Unknown authentication"
66
66
  end
67
+
68
+ "%s (Method: 0x%02X)" % [message, auth_method]
69
+
70
+ rescue
71
+ "Authentication Method: #{auth_method.inspect}"
67
72
  end
68
73
 
69
74
  # 0x00 = success
70
75
  # any other value = failure, connection must be closed
71
- def authentication_status(auth_status)
72
- case auth_status
76
+ def build_v5_authentication_status_message(auth_status)
77
+ message = case auth_status
73
78
  when 0x00 then
74
- "Authentication success (Code: 0x%02X)" % auth_status
79
+ "Authentication success"
75
80
  else
76
- "Authentication failure (Code: 0x%02X)" % auth_status
81
+ "Authentication failure"
77
82
  end
83
+
84
+ "%s (Status: 0x%02X)" % [message, auth_status]
85
+
86
+ rescue
87
+ "Authentication Status: #{auth_status.inspect}"
78
88
  end
79
89
 
80
90
  end
@@ -21,7 +21,7 @@
21
21
  module Sockit
22
22
 
23
23
  unless const_defined?(:VERSION)
24
- VERSION = "1.0.5"
24
+ VERSION = "1.0.6"
25
25
  end
26
26
 
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sockit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Patten