net-imap 0.3.4 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of net-imap might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +8 -1
- data/lib/net/imap/authenticators/digest_md5.rb +2 -2
- data/lib/net/imap/authenticators/xoauth2.rb +1 -1
- data/lib/net/imap/data_encoding.rb +3 -3
- data/lib/net/imap/response_parser.rb +23 -3
- data/lib/net/imap.rb +6 -6
- data/net-imap.gemspec +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c0b89eb763616a2d446e7a145245fcc88906162cdb6e41e1f73b89ac54269fb
|
4
|
+
data.tar.gz: aa19c272ab1142f1ebec8d40a7f56eeb348286188c154b9a4cfcd0819a2d4b18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93819c8a2aa93f8e5e5737626981fadef9038e31afdec124f70ff6e29b4c233877031d64f3e19486e2976a713da40bed3e8cdf5d5939e953fa3b9cd864915ede
|
7
|
+
data.tar.gz: f07545087c1d4c1faece211b902096782421fba4f5d81ceab07f8e4c5fed0f2e3918e4c4ba027231ab52038edf4b7dc3a0c4200bf0f1480addfa6042aaf7716e
|
data/.github/workflows/test.yml
CHANGED
@@ -3,11 +3,18 @@ name: ubuntu
|
|
3
3
|
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
|
+
ruby-versions:
|
7
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
|
+
with:
|
9
|
+
engine: cruby
|
10
|
+
min_version: 2.6
|
11
|
+
|
6
12
|
build:
|
13
|
+
needs: ruby-versions
|
7
14
|
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
8
15
|
strategy:
|
9
16
|
matrix:
|
10
|
-
ruby:
|
17
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
11
18
|
os: [ ubuntu-latest, macos-latest ]
|
12
19
|
experimental: [false]
|
13
20
|
include:
|
@@ -15,7 +15,7 @@ class Net::IMAP::DigestMD5Authenticator
|
|
15
15
|
@stage = STAGE_TWO
|
16
16
|
sparams = {}
|
17
17
|
c = StringScanner.new(challenge)
|
18
|
-
while c.scan(/(?:\s*,)?\s*(\w+)=("(?:[^\\"]
|
18
|
+
while c.scan(/(?:\s*,)?\s*(\w+)=("(?:[^\\"]|\\.)*"|[^,]+)\s*/)
|
19
19
|
k, v = c[1], c[2]
|
20
20
|
if v =~ /^"(.*)"$/
|
21
21
|
v = $1
|
@@ -26,7 +26,7 @@ class Net::IMAP::DigestMD5Authenticator
|
|
26
26
|
sparams[k] = v
|
27
27
|
end
|
28
28
|
|
29
|
-
raise Net::IMAP::DataFormatError, "Bad Challenge: '#{challenge}'" unless c.eos?
|
29
|
+
raise Net::IMAP::DataFormatError, "Bad Challenge: '#{challenge}'" unless c.eos? and sparams['qop']
|
30
30
|
raise Net::IMAP::Error, "Server does not support auth (qop = #{sparams['qop'].join(',')})" unless sparams['qop'].include?("auth")
|
31
31
|
|
32
32
|
response = {
|
@@ -54,9 +54,9 @@ module Net
|
|
54
54
|
# Net::IMAP does _not_ automatically encode and decode
|
55
55
|
# mailbox names to and from UTF-7.
|
56
56
|
def self.decode_utf7(s)
|
57
|
-
return s.gsub(/&([
|
58
|
-
if $1
|
59
|
-
(
|
57
|
+
return s.gsub(/&([A-Za-z0-9+,]+)?-/n) {
|
58
|
+
if base64 = $1
|
59
|
+
(base64.tr(",", "/") + "===").unpack1("m").encode(Encoding::UTF_8, Encoding::UTF_16BE)
|
60
60
|
else
|
61
61
|
"&"
|
62
62
|
end
|
@@ -7,6 +7,8 @@ module Net
|
|
7
7
|
|
8
8
|
# Parses an \IMAP server response.
|
9
9
|
class ResponseParser
|
10
|
+
MAX_UID_SET_SIZE = 10_000
|
11
|
+
|
10
12
|
# :call-seq: Net::IMAP::ResponseParser.new -> Net::IMAP::ResponseParser
|
11
13
|
def initialize
|
12
14
|
@str = nil
|
@@ -1379,11 +1381,29 @@ module Net
|
|
1379
1381
|
case token.symbol
|
1380
1382
|
when T_NUMBER then [Integer(token.value)]
|
1381
1383
|
when T_ATOM
|
1382
|
-
token.value
|
1383
|
-
|
1384
|
-
|
1384
|
+
entries = uid_set__ranges(token.value)
|
1385
|
+
if (count = entries.sum(&:count)) > MAX_UID_SET_SIZE
|
1386
|
+
parse_error("uid-set is too large: %d > 10k", count)
|
1387
|
+
end
|
1388
|
+
entries.flat_map(&:to_a)
|
1389
|
+
end
|
1390
|
+
end
|
1391
|
+
|
1392
|
+
# returns an array of ranges
|
1393
|
+
def uid_set__ranges(uidset)
|
1394
|
+
entries = []
|
1395
|
+
uidset.split(",") do |entry|
|
1396
|
+
uids = entry.split(":", 2).map {|uid|
|
1397
|
+
unless uid =~ /\A[1-9][0-9]*\z/
|
1398
|
+
parse_error("invalid uid-set uid: %p", uid)
|
1399
|
+
end
|
1400
|
+
uid = Integer(uid)
|
1401
|
+
NumValidator.ensure_nz_number(uid)
|
1402
|
+
uid
|
1385
1403
|
}
|
1404
|
+
entries << Range.new(*uids.minmax)
|
1386
1405
|
end
|
1406
|
+
entries
|
1387
1407
|
end
|
1388
1408
|
|
1389
1409
|
def nil_atom
|
data/lib/net/imap.rb
CHANGED
@@ -511,10 +511,8 @@ module Net
|
|
511
511
|
#
|
512
512
|
# - #greeting: The server's initial untagged response, which can indicate a
|
513
513
|
# pre-authenticated connection.
|
514
|
-
# - #responses:
|
515
|
-
#
|
516
|
-
# "ALERT", "UIDVALIDITY", "UIDNEXT", "TRYCREATE", etc). Values are arrays
|
517
|
-
# of UntaggedResponse or ResponseCode.
|
514
|
+
# - #responses: A hash with arrays of unhandled <em>non-+nil+</em>
|
515
|
+
# UntaggedResponse and ResponseCode +#data+, keyed by +#name+.
|
518
516
|
# - #add_response_handler: Add a block to be called inside the receiver thread
|
519
517
|
# with every server response.
|
520
518
|
# - #remove_response_handler: Remove a previously added response handler.
|
@@ -701,7 +699,7 @@ module Net
|
|
701
699
|
# * {Character sets}[https://www.iana.org/assignments/character-sets/character-sets.xhtml]
|
702
700
|
#
|
703
701
|
class IMAP < Protocol
|
704
|
-
VERSION = "0.3.
|
702
|
+
VERSION = "0.3.8"
|
705
703
|
|
706
704
|
include MonitorMixin
|
707
705
|
if defined?(OpenSSL::SSL)
|
@@ -712,7 +710,9 @@ module Net
|
|
712
710
|
# Returns the initial greeting the server, an UntaggedResponse.
|
713
711
|
attr_reader :greeting
|
714
712
|
|
715
|
-
# Returns
|
713
|
+
# Returns a hash with arrays of unhandled <em>non-+nil+</em>
|
714
|
+
# UntaggedResponse#data keyed by UntaggedResponse#name, and
|
715
|
+
# ResponseCode#data keyed by ResponseCode#name.
|
716
716
|
#
|
717
717
|
# For example:
|
718
718
|
#
|
data/net-imap.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
# Specify which files should be added to the gem when it is released.
|
26
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
27
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
28
|
-
`git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(bin|test|spec|features)/}) }
|
28
|
+
`git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(bin|test|spec|features|rfcs)/}) }
|
29
29
|
end
|
30
30
|
spec.bindir = "exe"
|
31
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-imap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda
|
8
8
|
- nicholas a. evans
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-02-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: net-protocol
|
@@ -115,7 +114,6 @@ licenses:
|
|
115
114
|
metadata:
|
116
115
|
homepage_uri: https://github.com/ruby/net-imap
|
117
116
|
source_code_uri: https://github.com/ruby/net-imap
|
118
|
-
post_install_message:
|
119
117
|
rdoc_options: []
|
120
118
|
require_paths:
|
121
119
|
- lib
|
@@ -130,8 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
128
|
- !ruby/object:Gem::Version
|
131
129
|
version: '0'
|
132
130
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
134
|
-
signing_key:
|
131
|
+
rubygems_version: 3.6.2
|
135
132
|
specification_version: 4
|
136
133
|
summary: Ruby client api for Internet Message Access Protocol
|
137
134
|
test_files: []
|