From 9c386154bb9c0cb5175c8145740d0b43fba26c85 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Sun, 14 Aug 2016 23:22:35 +0200 Subject: [PATCH] XOAUTH2: correctly strip values for evaluated credentials Don't use lambda anymore as default value. Signed-off-by: Nicolas Sebrecht --- offlineimap/repository/IMAP.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 0e1ea6e..f7651f2 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -309,32 +309,40 @@ class IMAPRepository(BaseRepository): refresh_token = self.getconf('oauth2_refresh_token', None) if refresh_token is None: refresh_token = self.localeval.eval( - self.getconf('oauth2_refresh_token_eval', "lambda: None") - ).strip("\n") + self.getconf('oauth2_refresh_token_eval', "None") + ) + if refresh_token is not None: + refresh_token = refresh_token.strip("\n") return refresh_token def getoauth2_access_token(self): access_token = self.getconf('oauth2_access_token', None) if access_token is None: access_token = self.localeval.eval( - self.getconf('oauth2_access_token_eval', "lambda: None") - ).strip("\n") + self.getconf('oauth2_access_token_eval', "None") + ) + if access_token is not None: + access_token = access_token.strip("\n") return access_token def getoauth2_client_id(self): client_id = self.getconf('oauth2_client_id', None) if client_id is None: client_id = self.localeval.eval( - self.getconf('oauth2_client_id_eval', "lambda: None") - ).strip("\n") + self.getconf('oauth2_client_id_eval', "None") + ) + if client_id is not None: + client_id = client_id.strip("\n") return client_id def getoauth2_client_secret(self): client_secret = self.getconf('oauth2_client_secret', None) if client_secret is None: client_secret = self.localeval.eval( - self.getconf('oauth2_client_secret_eval', "lambda: None") - ).strip("\n") + self.getconf('oauth2_client_secret_eval', "None") + ) + if client_secret is not None: + client_secret = client_secret.strip("\n") return client_secret def getpreauthtunnel(self):