From: Nicolas Morey-Chaisemartin <hidden> Date: 2017-08-08 07:47:27
Changes since v1:
- Add patch fo fix return value of the curl_append_msgs_to_imap
- Patch #2: server_fill_credentials takes a credential struct as a parameter so they can be approved later
- Dropped the s/server/srvc/ cleanup (previous patch #3)
- Patch #4: Only use curl as the default if it's available
Nicolas Morey-Chaisemartin (4):
imap-send: return with error if curl failed
imap-send: add wrapper to get server credentials if needed
imap_send: setup_curl: retreive credentials if not set in config file
imap-send: use curl by default
imap-send.c | 52 ++++++++++++++++++++++++++++++++--------------------
1 file changed, 32 insertions(+), 20 deletions(-)
From: Nicolas Morey-Chaisemartin <hidden> Date: 2017-08-08 07:48:09
curl_append_msgs_to_imap always returned 0, whether curl failed or not.
Return a proper status so git imap-send will exit with an error code
if womething wrong happened.
Signed-off-by: Nicolas Morey-Chaisemartin <redacted>
---
imap-send.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Nicolas Morey-Chaisemartin <hidden> Date: 2017-08-08 07:48:30
Up to this point, the curl mode only supported getting the username
and password from the gitconfig file while the legacy mode could also
fetch them using the credential API.
Signed-off-by: Nicolas Morey-Chaisemartin <redacted>
---
imap-send.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
From: Martin Ågren <hidden> Date: 2017-08-08 10:09:45
On 8 August 2017 at 09:48, Nicolas Morey-Chaisemartin
[off-list ref] wrote:
quoted hunk
Up to this point, the curl mode only supported getting the username
and password from the gitconfig file while the legacy mode could also
fetch them using the credential API.
Signed-off-by: Nicolas Morey-Chaisemartin <redacted>
---
imap-send.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
@@ -1496,6 +1498,10 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server, curl_easy_cleanup(curl); curl_global_cleanup();+ if (res == CURLE_OK && cred.username)+ credential_approve(&cred);
Maybe a similar call to credential_reject(&cred) here? I guess all we'll
know is that some sort of error happened, possibly credentials-related,
possibly not. Just a thought.
From: Nicolas Morey-Chaisemartin <hidden> Date: 2017-08-08 10:34:11
Le 08/08/2017 à 12:09, Martin Ågren a écrit :
On 8 August 2017 at 09:48, Nicolas Morey-Chaisemartin
[off-list ref] wrote:
quoted
Up to this point, the curl mode only supported getting the username
and password from the gitconfig file while the legacy mode could also
fetch them using the credential API.
Signed-off-by: Nicolas Morey-Chaisemartin <redacted>
---
imap-send.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
@@ -1496,6 +1498,10 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server, curl_easy_cleanup(curl); curl_global_cleanup();+ if (res == CURLE_OK && cred.username)+ credential_approve(&cred);
Maybe a similar call to credential_reject(&cred) here? I guess all we'll
know is that some sort of error happened, possibly credentials-related,
possibly not. Just a thought.
Checking the doc, there is actually a CURLE_LOGIN_DENIED return code which means authentication failed.
I'll fix this in v3
Nicolas
From: Nicolas Morey-Chaisemartin <hidden> Date: 2017-08-08 07:58:13
Now that curl is enable by default, use the curl implementation
for imap too.
The goal is to validate feature parity between the legacy and
the curl implementation, deprecate thee legacy implementation
later on and in the long term, hopefully drop it altogether.
Signed-off-by: Nicolas Morey-Chaisemartin <redacted>
---
imap-send.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -35,11 +35,11 @@ typedef void *SSL;#include"http.h"#endif-#if defined(USE_CURL_FOR_IMAP_SEND) && defined(NO_OPENSSL)-/* only available option */+#if defined(USE_CURL_FOR_IMAP_SEND)+/* Always default to curl if it's available. */#define USE_CURL_DEFAULT 1#else-/* strictly opt in */+/* We don't have curl, so continue to use the historical implementation */#define USE_CURL_DEFAULT 0#endif