net-imap 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +8 -1
- data/lib/net/imap/authenticators/xoauth2.rb +1 -1
- data/lib/net/imap/authenticators.rb +30 -10
- data/lib/net/imap/data_encoding.rb +3 -3
- data/lib/net/imap/flags.rb +1 -0
- data/lib/net/imap/sasl/stringprep.rb +6 -2
- data/lib/net/imap.rb +979 -257
- data/net-imap.gemspec +1 -1
- data/rakelib/rfcs.rake +3 -1
- 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: '089cd0567b2a11a7de9343e693481902eca127a4274a6fc3b6cec5e44d2ee333'
|
4
|
+
data.tar.gz: fae6680c26f1279ae1bca5b5561d65eafc06c688c9102be885f49b0520f2a852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dded5abb87e2ea4b9c82b7f50c141acb6d3affe4f93f6dfd26beb6309fdd111c1ab93adc31fefdac4a0fef3cb4e5f6eda29f179c602c2a0fc7cd389ae832861
|
7
|
+
data.tar.gz: fe3b168f4f6a5807d63499e0ae8b0e507ad950e2c22eadcb9dc55e10df79da5618889047ef6fcebf0a3fdce06b3aac78f123340832a93fe02a82326344d4316b
|
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:
|
@@ -3,22 +3,42 @@
|
|
3
3
|
# Registry for SASL authenticators used by Net::IMAP.
|
4
4
|
module Net::IMAP::Authenticators
|
5
5
|
|
6
|
-
# Adds an authenticator for
|
6
|
+
# Adds an authenticator for Net::IMAP#authenticate to use. +mechanism+ is the
|
7
7
|
# {SASL mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
8
|
+
# implemented by +authenticator+ (for instance, <tt>"PLAIN"</tt>).
|
9
|
+
#
|
10
|
+
# The +authenticator+ must respond to +#new+ (or #call), receiving the
|
11
|
+
# authenticator configuration and return a configured authentication session.
|
12
|
+
# The authenticator session must respond to +#process+, receiving the server's
|
13
|
+
# challenge and returning the client's response.
|
13
14
|
#
|
14
|
-
#
|
15
|
-
#
|
15
|
+
# See PlainAuthenticator, XOauth2Authenticator, and DigestMD5Authenticator for
|
16
|
+
# examples.
|
16
17
|
def add_authenticator(auth_type, authenticator)
|
17
18
|
authenticators[auth_type] = authenticator
|
18
19
|
end
|
19
20
|
|
20
|
-
#
|
21
|
-
#
|
21
|
+
# :call-seq:
|
22
|
+
# authenticator(mechanism, ...) -> authenticator
|
23
|
+
# authenticator(mech, *creds, **props) {|prop, auth| val } -> authenticator
|
24
|
+
# authenticator(mechanism, authnid, creds, authzid=nil) -> authenticator
|
25
|
+
# authenticator(mechanism, **properties) -> authenticator
|
26
|
+
# authenticator(mechanism) {|propname, authctx| value } -> authenticator
|
27
|
+
#
|
28
|
+
# Builds a new authentication session context for +mechanism+.
|
29
|
+
#
|
30
|
+
# [Note]
|
31
|
+
# This method is intended for internal use by connection protocol code only.
|
32
|
+
# Protocol client users should see refer to their client's documentation,
|
33
|
+
# e.g. Net::IMAP#authenticate for Net::IMAP.
|
34
|
+
#
|
35
|
+
# The call signatures documented for this method are recommendations for
|
36
|
+
# authenticator implementors. All arguments (other than +mechanism+) are
|
37
|
+
# forwarded to the registered authenticator's +#new+ (or +#call+) method, and
|
38
|
+
# each authenticator must document its own arguments.
|
39
|
+
#
|
40
|
+
# The returned object represents a single authentication exchange and <em>must
|
41
|
+
# not</em> be reused for multiple authentication attempts.
|
22
42
|
def authenticator(mechanism, *authargs, **properties, &callback)
|
23
43
|
authenticator = authenticators.fetch(mechanism.upcase) do
|
24
44
|
raise ArgumentError, 'unknown auth type - "%s"' % mechanism
|
@@ -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
|
data/lib/net/imap/flags.rb
CHANGED
@@ -26,6 +26,9 @@ module Net::IMAP::SASL
|
|
26
26
|
#
|
27
27
|
# Also checks bidirectional characters, when <tt>bidi: true</tt>, which may
|
28
28
|
# raise a BidiStringError.
|
29
|
+
#
|
30
|
+
# +profile+ is an optional string which will be added to any exception that
|
31
|
+
# is raised (it does not affect behavior).
|
29
32
|
def check_prohibited!(string, *tables, bidi: false, profile: nil)
|
30
33
|
tables = TABLE_TITLES.keys.grep(/^C/) if tables.empty?
|
31
34
|
tables |= %w[C.8] if bidi
|
@@ -47,10 +50,11 @@ module Net::IMAP::SASL
|
|
47
50
|
# RandALCat character MUST be the last character of the string.
|
48
51
|
#
|
49
52
|
# This is usually combined with #check_prohibited!, so table "C.8" is only
|
50
|
-
# checked when
|
53
|
+
# checked when <tt>c_8: true</tt>.
|
51
54
|
#
|
52
55
|
# Raises either ProhibitedCodepoint or BidiStringError unless all
|
53
|
-
# requirements are met.
|
56
|
+
# requirements are met. +profile+ is an optional string which will be
|
57
|
+
# added to any exception that is raised (it does not affect behavior).
|
54
58
|
def check_bidi!(string, c_8: false, profile: nil)
|
55
59
|
check_prohibited!(string, "C.8", profile: profile) if c_8
|
56
60
|
if BIDI_FAILS_REQ2.match?(string)
|