~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Fix: oauthbearer runtime error

Details
Message ID
<20191013180115.3635-1-frode.aa@gmail.com>
DKIM signature
missing
Download raw message
Patch: +7 -6
Configure an oauthbearer source without a token_endpoint
parameter would panic due to nil pointer dereference

  Example
    source=imaps+oauthbearer://frode.aa%40gmail.com@imap.gmail.com:993
    source-cred-cmd=pass oatuh2 frode.aa@gmail.com

token_endpoint is not required as it will use the provided
password as access_token when it is not set
---
 worker/imap/worker.go | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/worker/imap/worker.go b/worker/imap/worker.go
index cd63c39..4d3e51c 100644
--- a/worker/imap/worker.go
+++ b/worker/imap/worker.go
@@ -85,14 +85,15 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error {
			w.config.scheme = strings.TrimSuffix(w.config.scheme, "+oauthbearer")
			w.config.oauthBearer.Enabled = true
			q := u.Query()

			oauth2 := &oauth2.Config{}
			if q.Get("token_endpoint") != "" {
				w.config.oauthBearer.OAuth2 = &oauth2.Config{
					ClientID:     q.Get("client_id"),
					ClientSecret: q.Get("client_secret"),
					Scopes:       []string{q.Get("scope")},
				}
				w.config.oauthBearer.OAuth2.Endpoint.TokenURL = q.Get("token_endpoint")
				oauth2.ClientID = q.Get("client_id")
				oauth2.ClientSecret = q.Get("client_secret")
				oauth2.Scopes = []string{q.Get("scope")}
				oauth2.Endpoint.TokenURL = q.Get("token_endpoint")
			}
			w.config.oauthBearer.OAuth2 = oauth2
		}

		w.config.addr = u.Host
-- 
2.20.1
Details
Message ID
<BXR1HZVTZ4A7.19J73MZGII85C@homura>
In-Reply-To
<20191013180115.3635-1-frode.aa@gmail.com> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git.sr.ht:~sircmpwn/aerc
   48a88fe..550ef0b  master -> master
Reply to thread Export thread (mbox)