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). v10: - Fix comment styles - Fix failing tests v11: - Use lower case letters for the first word of a sendtence in an error message and avoid using full stops at the end of a sentence. v12: - Gracefully exit PLAIN, CRAM-MD5, OAUTHBEARER and XOAUTH2 authentication methods if OpenSSL support is not compiled in, but is requested by the user. - Use backticks for string literals. - Wrap documentation text to 75 columns. - End the last member of enum CAPABILITY with a trailing comma. v13: - Fix logic error which was using || instead of && when checking if the authentication method is neither XOAUTH2 nor OAUTHBEARER. v14: - Specify why we are not using CURLOPT_PASSWORD for OAuth2.0 methods using a comment. - Add a function try_auth_method() to reduce code duplication when trying to authenticate using a specific method. v15: - Simply rearrange the patches to make the cram md5 patches come before adding OAuth2.0 and PLAIN authentication methods. No change has been done to the code itself. v16: - Rearrage some more patches so that the two new features, i.e., --folder and --list come just after the new authentication methods. Then the two patches with minor improvements of displaying the destination mailbox and displaying port alongwith host have been added. The patch fixing other minor mistakes in the logs has been moved to the end. Just like v15, no change has been done to the code itself. v17: - Rebase on top of master where 30325e2 was causing a conflict. (Sorry for the bad range diff, but I think its easy to understand) Aditya Garg (10): imap-send: fix bug causing cfg->folder being set to NULL imap-send: fix memory leak in case auth_cram_md5 fails imap-send: gracefully fail if CRAM-MD5 authentication is requested without OpenSSL imap-send: add support for OAuth2.0 authentication imap-send: add PLAIN authentication method to OpenSSL imap-send: enable specifying the folder using the command line imap-send: add ability to list the available folders imap-send: display port alongwith host when git credential is invoked imap-send: display the destination mailbox when sending a message imap-send: fix minor mistakes in the logs Documentation/config/imap.adoc | 11 +- Documentation/git-imap-send.adoc | 68 ++++- imap-send.c | 412 ++++++++++++++++++++++++++----- 3 files changed, 414 insertions(+), 77 deletions(-) Range-diff against v16: 1: 194d108e15 < -: ---------- builtin/am: fix memory leak in `split_mail_stgit_series` 2: 798369e8ce < -: ---------- t1001: replace 'test -f' with 'test_path_is_file' 3: dce2b90fb1 < -: ---------- oidmap: rename oidmap_free() to oidmap_clear() 4: 9369c83cce < -: ---------- oidmap: add size function 5: f0a73c8578 < -: ---------- raw_object_store: drop extra pointer to replace_map 6: c4b2850438 < -: ---------- reftable/writer: fix memory leak when `padded_write()` fails 7: a795acc6ed < -: ---------- reftable/writer: fix memory leak when `writer_index_hash()` fails 8: 8fdb6df271 < -: ---------- reftable: fix perf regression when reading blocks of unwanted type 9: ce0b8c96b9 < -: ---------- The sixteenth batch 10: 3e3ddf7077 = 1: 4accbe6ecf imap-send: fix bug causing cfg->folder being set to NULL 11: 417b3b8e38 = 2: 1cfd66ccea imap-send: fix memory leak in case auth_cram_md5 fails 12: c4216528e7 = 3: 12ff5135be imap-send: gracefully fail if CRAM-MD5 authentication is requested without OpenSSL 13: b38fca0e6a ! 4: 43b18dbfb0 imap-send: add support for OAuth2.0 authentication @@ imap-send.c: static CURL *setup_curl(struct imap_server_conf *srvc, struct crede strbuf_addstr(&path, srvc->use_ssl ? "imaps://" : "imap://"); strbuf_addstr(&path, srvc->host); @@ imap-send.c: static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred) - curl_easy_setopt(curl, CURLOPT_PORT, srvc->port); + curl_easy_setopt(curl, CURLOPT_PORT, (long)srvc->port); if (srvc->auth_method) { - struct strbuf auth = STRBUF_INIT; 14: 86d3d2c54d = 5: 1ebf9f935f imap-send: add PLAIN authentication method to OpenSSL 15: 7674e749c8 = 6: 0c6283407c imap-send: enable specifying the folder using the command line 16: 90ce3a63f3 ! 7: f59cb1dca1 imap-send: add ability to list the available folders @@ imap-send.c: static CURL *setup_curl(struct imap_server_conf *srvc, struct crede curl_easy_setopt(curl, CURLOPT_URL, path.buf); strbuf_release(&path); @@ imap-send.c: static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred) - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, srvc->ssl_verify); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, srvc->ssl_verify); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)srvc->ssl_verify); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, (long)srvc->ssl_verify); - curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer); - 17: 1bdd054908 = 8: 1247afbe78 imap-send: display port alongwith host when git credential is invoked 18: e381120ab5 = 9: c30ecbf508 imap-send: display the destination mailbox when sending a message 19: 6561d45bee = 10: eaff4db692 imap-send: fix minor mistakes in the logs -- 2.49.0.824.geaff4db692