Merge branch 'js/imap-send-curl-compilation-fix'
authorJunio C Hamano <gitster@pobox.com>
Fri, 30 Oct 2015 20:06:58 +0000 (13:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 30 Oct 2015 20:06:58 +0000 (13:06 -0700)
"git imap-send" did not compile well with older version of cURL library.

* js/imap-send-curl-compilation-fix:
imap-send: only use CURLOPT_LOGIN_OPTIONS if it is actually available

1  2 
imap-send.c
diff --combined imap-send.c
index e9faaeaf2ab31413139dad17c6df1032e7e3cffa,8c3fc212bacb4da7c2afea4a2aa47e051a4ef1ca..4d3b7737a99de02c42945951e91b4d7ed865611d
@@@ -889,8 -889,9 +889,8 @@@ static char *cram(const char *challenge
        }
  
        /* response: "<user> <digest in hex>" */
 -      resp_len = strlen(user) + 1 + strlen(hex) + 1;
 -      response = xmalloc(resp_len);
 -      sprintf(response, "%s %s", user, hex);
 +      response = xstrfmt("%s %s", user, hex);
 +      resp_len = strlen(response) + 1;
  
        response_64 = xmalloc(ENCODED_SIZE(resp_len) + 1);
        encoded_len = EVP_EncodeBlock((unsigned char *)response_64,
@@@ -1421,11 -1422,15 +1421,15 @@@ static CURL *setup_curl(struct imap_ser
        curl_easy_setopt(curl, CURLOPT_PORT, server.port);
  
        if (server.auth_method) {
+ #if LIBCURL_VERSION_NUM < 0x072200
+               warning("No LOGIN_OPTIONS support in this cURL version");
+ #else
                struct strbuf auth = STRBUF_INIT;
                strbuf_addstr(&auth, "AUTH=");
                strbuf_addstr(&auth, server.auth_method);
                curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, auth.buf);
                strbuf_release(&auth);
+ #endif
        }
  
        if (!server.use_ssl)