[PATCH v10 0/9] imap-send: make it usable again and add OAuth2.0 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).
v10: - Fix comment styles
     - Fix failing tests

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                      | 421 +++++++++++++++++++++++++++----
 t/t1517-outside-repo.sh          |   2 +-
 4 files changed, 437 insertions(+), 64 deletions(-)

Range-diff against v9:
 -:  ---------- >  1:  3e3ddf7077 imap-send: fix bug causing cfg->folder being set to NULL
 1:  c5ee87051f !  2:  02037873a1 imap-send: add support for OAuth2.0 authentication
    @@ imap-send.c: static char *cram(const char *challenge_64, const char *user, const
     +	int raw_len, b64_len;
     +	char *raw, *b64;
     +
    -+	/* Compose the OAUTHBEARER string
    ++	/*
    ++	 * Compose the OAUTHBEARER string
     +	 *
     +	 * "n,a=" {User} ",^Ahost=" {Host} "^Aport=" {Port} "^Aauth=Bearer " {Access Token} "^A^A
     +	 *
    @@ imap-send.c: static char *cram(const char *challenge_64, const char *user, const
     +	int raw_len, b64_len;
     +	char *raw, *b64;
     +
    -+	/* Compose the XOAUTH2 string
    ++	/*
    ++	 * Compose the XOAUTH2 string
     +	 * "user=" {User} "^Aauth=Bearer " {Access Token} "^A^A"
     +	 * https://developers.google.com/workspace/gmail/imap/xoauth2-protocol#initial_client_response
     +	 */
    @@ imap-send.c: static CURL *setup_curl(struct imap_server_conf *srvc, struct crede
     +		if (!strcmp(srvc->auth_method, "XOAUTH2") ||
     +		    !strcmp(srvc->auth_method, "OAUTHBEARER")) {
     +
    -+			/* While CURLOPT_XOAUTH2_BEARER looks as if it only supports XOAUTH2,
    ++			/*
    ++			 * While CURLOPT_XOAUTH2_BEARER looks as if it only supports XOAUTH2,
     +			 * upon debugging, it has been found that it is capable of detecting
     +			 * the best option out of OAUTHBEARER and XOAUTH2.
     +			 */
 2:  17e263ea27 !  3:  3a0be43838 imap-send: add PLAIN authentication method to OpenSSL
    @@ imap-send.c: static char hexchar(unsigned int b)
     +	int b64_len;
     +	char *raw, *b64;
     +
    -+	/* Compose the PLAIN string
    ++	/*
    ++	 * Compose the PLAIN string
     +	 *
     +	 * The username and password are combined to one string and base64 encoded.
     +	 * "\0user\0pass"
 3:  5c471f640b =  4:  45f5b3f1ff imap-send: fix memory leak in case auth_cram_md5 fails
 4:  db8ee71785 =  5:  8899f686d7 imap-send: enable specifying the folder using the command line
 5:  a8fbcdf9d5 !  6:  991f978c22 imap-send: fix numerous spelling and grammar mistakes in logs
    @@ imap-send.c: int cmd_main(int argc, const char **argv)
      		ret = 1;
      		goto out;
      	}
    +
    + ## t/t1517-outside-repo.sh ##
    +@@ t/t1517-outside-repo.sh: test_expect_success 'imap-send outside repository' '
    + 	test_config_global imap.host imaps://localhost &&
    + 	test_config_global imap.folder Drafts &&
    + 
    +-	echo nothing to send >expect &&
    ++	echo Nothing to send. >expect &&
    + 	test_must_fail git imap-send -v </dev/null 2>actual &&
    + 	test_cmp expect actual &&
    + 
 6:  a5dad0f2b2 =  7:  e436a12198 imap-send: display port alongwith host when git credential is invoked
 7:  d2569a5e36 =  8:  5183253004 imap-send: display the destination mailbox when sending a message
 8:  cf844b2632 =  9:  c33469a5db imap-send: add ability to list the available folders
-- 
2.49.0.638.g67a2d115ec





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux