net-smtp 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/net/smtp.rb +18 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 381881c1c73159461e4ad7e484a3a092d5809d9cb8ef8440fb765429b53b409f
|
4
|
+
data.tar.gz: 1b2e706ba5b167822fdd440751446a05c03f0a03d029c5c44a35979f25bf9e37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8255edb1e048be3d7ccff1ca6a3abb39f7691a8d09763ba35f5e13690e61af12e08a44c82142423585b8dcef250b80d23d5c04f1b074be881c33398fcd0fb72d
|
7
|
+
data.tar.gz: 6a3f390d9f4b46209bca54e7c4389a57478160de58185f290dfbb6aca603c48eeea455b3d2331d35f0b476c3522ce1076d2fe5dd67ffa8e73f1f80e5de90c464
|
data/lib/net/smtp.rb
CHANGED
@@ -18,11 +18,13 @@
|
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'net/protocol'
|
21
|
-
require 'digest/md5'
|
22
|
-
require 'timeout'
|
23
21
|
begin
|
24
22
|
require 'openssl'
|
25
23
|
rescue LoadError
|
24
|
+
begin
|
25
|
+
require 'digest/md5'
|
26
|
+
rescue LoadError
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
module Net
|
@@ -184,7 +186,7 @@ module Net
|
|
184
186
|
# user: 'Your Account', secret: 'Your Password', authtype: :cram_md5)
|
185
187
|
#
|
186
188
|
class SMTP < Protocol
|
187
|
-
VERSION = "0.3.
|
189
|
+
VERSION = "0.3.4"
|
188
190
|
|
189
191
|
Revision = %q$Revision$.split[1]
|
190
192
|
|
@@ -626,6 +628,16 @@ module Net
|
|
626
628
|
|
627
629
|
private
|
628
630
|
|
631
|
+
def digest_class
|
632
|
+
@digest_class ||= if defined?(OpenSSL::Digest)
|
633
|
+
OpenSSL::Digest
|
634
|
+
elsif defined?(::Digest)
|
635
|
+
::Digest
|
636
|
+
else
|
637
|
+
raise '"openssl" or "digest" library is required'
|
638
|
+
end
|
639
|
+
end
|
640
|
+
|
629
641
|
def tcp_socket(address, port)
|
630
642
|
begin
|
631
643
|
Socket.tcp address, port, nil, nil, connect_timeout: @open_timeout
|
@@ -888,14 +900,14 @@ module Net
|
|
888
900
|
|
889
901
|
# CRAM-MD5: [RFC2195]
|
890
902
|
def cram_md5_response(secret, challenge)
|
891
|
-
tmp =
|
892
|
-
|
903
|
+
tmp = digest_class::MD5.digest(cram_secret(secret, IMASK) + challenge)
|
904
|
+
digest_class::MD5.hexdigest(cram_secret(secret, OMASK) + tmp)
|
893
905
|
end
|
894
906
|
|
895
907
|
CRAM_BUFSIZE = 64
|
896
908
|
|
897
909
|
def cram_secret(secret, mask)
|
898
|
-
secret =
|
910
|
+
secret = digest_class::MD5.digest(secret) if secret.size > CRAM_BUFSIZE
|
899
911
|
buf = secret.ljust(CRAM_BUFSIZE, "\0")
|
900
912
|
0.upto(buf.size - 1) do |i|
|
901
913
|
buf[i] = (buf[i].ord ^ mask).chr
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-smtp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-protocol
|
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
58
|
requirements: []
|
59
|
-
rubygems_version: 3.
|
59
|
+
rubygems_version: 3.3.27
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: Simple Mail Transfer Protocol client library for Ruby.
|