This patch series does the following things: Firstly it basically makes the imap-send command usable again since it was broken because of not being able to correctly parse the config file. Further it adds support for OAuth2.0 and PLAIN authentication to git imap-send. Last, it does some minor improvements including adding the ability to specify the folder using the command line and ability to list the available folders by adding a `--list` option. P.S.: I am surprised this thing even exists xD. v2: - Added support for OAuth2.0 with curl. - Fixed the memory leak in case auth_cram_md5 fails. v3: - Improve wording in first patch - Change misleading message if OAuth2.0 is used without OpenSSL v4: - Add PLAIN authentication mechanism for OpenSSL - Improved wording in the first patch a bit more v5: - Add ability to specify destination folder using the command line - Add ability to set a default between curl and openssl using the config v6: - Fix minor mistakes in --folder documentation v7: - Fix spelling and grammar mistakes in logs shown to the user when running imap-send - Display port alongwith host when git credential is invoked and asks for a password - Display the destination mailbox when sending a message v8: - Drop the patch that enabled user to choose between libcurl and openssl using the config - Add ability to list the available folders by adding a `--list` option v9: - Encourage users to use OAuth2.0 for Gmail (similar change done for send-email docs). Aditya Garg (9): imap-send: fix bug causing cfg->folder being set to NULL imap-send: add support for OAuth2.0 authentication imap-send: add PLAIN authentication method to OpenSSL imap-send: fix memory leak in case auth_cram_md5 fails imap-send: enable specifying the folder using the command line imap-send: fix numerous spelling and grammar mistakes in logs imap-send: display port alongwith host when git credential is invoked imap-send: display the destination mailbox when sending a message imap-send: add ability to list the available folders Documentation/config/imap.adoc | 10 +- Documentation/git-imap-send.adoc | 68 ++++- imap-send.c | 417 +++++++++++++++++++++++++++---- 3 files changed, 432 insertions(+), 63 deletions(-) Range-diff against v8: -: ---------- > 1: 3e3ddf7077 imap-send: fix bug causing cfg->folder being set to NULL 1: f0743d46e1 ! 2: c5ee87051f imap-send: add support for OAuth2.0 authentication @@ Documentation/git-imap-send.adoc: Using Gmail's IMAP interface: + port = 993 --------- -+Gmail does not allow using your account password for `git imap-send`. ++Gmail does not allow using your regular password for `git imap-send`. +If you have multi-factor authentication set up on your Gmail account, you can generate +an app-specific password for use with `git imap-send`. +Visit https://security.google.com/settings/security/apppasswords to create it. -+If you do not want to enable multi-factor authentication, you can use OAuth2.0 -+authentication as described below. ++Alternatively, use OAuth2.0 authentication as described below. + [NOTE] You might need to instead use: `folder = "[Google Mail]/Drafts"` if you get an error @@ Documentation/git-imap-send.adoc: that the "Folder doesn't exist". folder will be localized. +If you want to use OAuth2.0 based authentication, you can specify `OAUTHBEARER` -+or `XOAUTH2` mechanism in your config. In such a case you will have to use an -+OAuth2.0 access token in place of your password. ++or `XOAUTH2` mechanism in your config. It is more secure than using app-specific ++passwords, and also does not enforce the need of having multi-factor authentication. ++You will have to use an OAuth2.0 access token in place of your password when using this ++authentication. + +--------- +[imap] 2: b1602644b7 = 3: 17e263ea27 imap-send: add PLAIN authentication method to OpenSSL 3: 49790e60cc = 4: 5c471f640b imap-send: fix memory leak in case auth_cram_md5 fails 4: 2efe897379 = 5: db8ee71785 imap-send: enable specifying the folder using the command line 5: 8f6676a046 = 6: a8fbcdf9d5 imap-send: fix numerous spelling and grammar mistakes in logs 6: 69fdae55cd = 7: a5dad0f2b2 imap-send: display port alongwith host when git credential is invoked 7: 187dbccd03 = 8: d2569a5e36 imap-send: display the destination mailbox when sending a message 8: 03d7d6a772 ! 9: cf844b2632 imap-send: add ability to list the available folders @@ Documentation/git-imap-send.adoc: OPTIONS CONFIGURATION ------------- -@@ Documentation/git-imap-send.adoc: authentication as described below. +@@ Documentation/git-imap-send.adoc: Alternatively, use OAuth2.0 authentication as described below. [NOTE] You might need to instead use: `folder = "[Google Mail]/Drafts"` if you get an error -- 2.49.0.639.ge2dd5d9d81