net-smtp 0.3.1 → 0.3.3
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 +27 -10
- data/net-smtp.gemspec +0 -2
- metadata +3 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 314f553cc9e988f56b964e62836e95e323974b6a66c26e2f02d1e6a7cc08e886
|
4
|
+
data.tar.gz: 43a203a0622f49e2fb32a6c8bc0f644cb703e3bc3bc1f25aa114434c1a9cc8e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 486381bf1eee2cbd7cb4f12ca0253ee5b06fc2b1a012b3786bda9b30456c338c5de40889e639275cfcf22a83064d7c468aa06c8e21438adb1d1ab2133a3933eb
|
7
|
+
data.tar.gz: 97659f9e6505ea3aa10db92d5a99dc39d01ca55468ca28934b77061ccedd7ce74d8652927304ddf7fe4a21622e3572cca3bb92f19bae3a1b004bc7909783b530
|
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
|
@@ -35,8 +37,13 @@ module Net
|
|
35
37
|
attr_reader :response
|
36
38
|
|
37
39
|
def initialize(response, message: nil)
|
38
|
-
|
39
|
-
|
40
|
+
if response.is_a?(::Net::SMTP::Response)
|
41
|
+
@response = response
|
42
|
+
@message = message
|
43
|
+
else
|
44
|
+
@response = nil
|
45
|
+
@message = message || response
|
46
|
+
end
|
40
47
|
end
|
41
48
|
|
42
49
|
def message
|
@@ -179,7 +186,7 @@ module Net
|
|
179
186
|
# user: 'Your Account', secret: 'Your Password', authtype: :cram_md5)
|
180
187
|
#
|
181
188
|
class SMTP < Protocol
|
182
|
-
VERSION = "0.3.
|
189
|
+
VERSION = "0.3.3"
|
183
190
|
|
184
191
|
Revision = %q$Revision$.split[1]
|
185
192
|
|
@@ -621,6 +628,16 @@ module Net
|
|
621
628
|
|
622
629
|
private
|
623
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
|
+
|
624
641
|
def tcp_socket(address, port)
|
625
642
|
begin
|
626
643
|
Socket.tcp address, port, nil, nil, connect_timeout: @open_timeout
|
@@ -643,7 +660,7 @@ module Net
|
|
643
660
|
do_helo helo_domain
|
644
661
|
if ! tls? and (starttls_always? or (capable_starttls? and starttls_auto?))
|
645
662
|
unless capable_starttls?
|
646
|
-
raise SMTPUnsupportedCommand
|
663
|
+
raise SMTPUnsupportedCommand, "STARTTLS is not supported on this server"
|
647
664
|
end
|
648
665
|
starttls
|
649
666
|
@socket = new_internet_message_io(tlsconnect(s, @ssl_context_starttls))
|
@@ -883,14 +900,14 @@ module Net
|
|
883
900
|
|
884
901
|
# CRAM-MD5: [RFC2195]
|
885
902
|
def cram_md5_response(secret, challenge)
|
886
|
-
tmp =
|
887
|
-
|
903
|
+
tmp = digest_class::MD5.digest(cram_secret(secret, IMASK) + challenge)
|
904
|
+
digest_class::MD5.hexdigest(cram_secret(secret, OMASK) + tmp)
|
888
905
|
end
|
889
906
|
|
890
907
|
CRAM_BUFSIZE = 64
|
891
908
|
|
892
909
|
def cram_secret(secret, mask)
|
893
|
-
secret =
|
910
|
+
secret = digest_class::MD5.digest(secret) if secret.size > CRAM_BUFSIZE
|
894
911
|
buf = secret.ljust(CRAM_BUFSIZE, "\0")
|
895
912
|
0.upto(buf.size - 1) do |i|
|
896
913
|
buf[i] = (buf[i].ord ^ mask).chr
|
@@ -1165,7 +1182,7 @@ module Net
|
|
1165
1182
|
class Address
|
1166
1183
|
# mail address [String]
|
1167
1184
|
attr_reader :address
|
1168
|
-
#
|
1185
|
+
# parameters [Array<String>]
|
1169
1186
|
attr_reader :parameters
|
1170
1187
|
|
1171
1188
|
# :call-seq:
|
data/net-smtp.gemspec
CHANGED
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.3
|
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: 2022-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-protocol
|
@@ -24,34 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: digest
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: timeout
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
27
|
description: Simple Mail Transfer Protocol client library for Ruby.
|
56
28
|
email:
|
57
29
|
- matz@ruby-lang.org
|
@@ -84,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
56
|
- !ruby/object:Gem::Version
|
85
57
|
version: '0'
|
86
58
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
59
|
+
rubygems_version: 3.4.0.dev
|
88
60
|
signing_key:
|
89
61
|
specification_version: 4
|
90
62
|
summary: Simple Mail Transfer Protocol client library for Ruby.
|