cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Regression on FTP connections with --anyauth

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 12 Feb 2014 21:15:55 +0100

On Wed, Feb 12, 2014 at 02:38:07PM +0100, Daniel Stenberg wrote:
> Okay, I think this fix is better and narrows the scope a bit for what
> the 'wantNTLM' variable is used for.

> / daniel.haxx.se
> bool canPipeline = IsPipeliningPossible(data, needle);
> - bool wantNTLM = (data->state.authhost.want & CURLAUTH_NTLM) ||
> - (data->state.authhost.want & CURLAUTH_NTLM_WB) ? TRUE : FALSE;
> + bool wantNTLMhttp = ((data->state.authhost.want & CURLAUTH_NTLM) ||
> + (data->state.authhost.want & CURLAUTH_NTLM_WB)) &&
> + (needle->handler->protocol & CURLPROTO_FTP) ? TRUE : FALSE;

I haven't tried the patch, but I don't follow this logic--shouldn't that be
& CURLPROTO_HTTP? The check for FTP is done again below.

And on a side note, is there really some compiler that complains if the
?TRUE:FALSE is omitted? Is seems pretty clunky.

> struct connectbundle *bundle;
>
> *force_reuse = FALSE;
> @@ -3049,16 +3050,15 @@ ConnectionExists(struct SessionHandle *data,
> continue;
> }
>
> - if((needle->handler->protocol & CURLPROTO_FTP) ||
> - ((needle->handler->protocol & CURLPROTO_HTTP) && wantNTLM)) {
> - /* This is FTP or HTTP+NTLM, verify that we're using the same name
> - and password as well */
> - if(!strequal(needle->user, check->user) ||
> - !strequal(needle->passwd, check->passwd)) {
> - /* one of them was different */
> - continue;
> - }
> - credentialsMatch = TRUE;
> + if((needle->handler->protocol & CURLPROTO_FTP) || wantNTLMhttp) {
> + /* This is FTP or HTTP+NTLM, verify that we're using the same name
> + and password as well */
> + if(!strequal(needle->user, check->user) ||
> + !strequal(needle->passwd, check->passwd)) {
> + /* one of them was different */
> + continue;
> + }
> + credentialsMatch = TRUE;
> }
>
> if(!needle->bits.httpproxy || needle->handler->flags&PROTOPT_SSL ||
> @@ -3110,12 +3110,12 @@ ConnectionExists(struct SessionHandle *data,
> }
>
> if(match) {
> - /* If we are looking for an NTLM connection, check if this is already
> - authenticating with the right credentials. If not, keep looking so
> - that we can reuse NTLM connections if possible. (Especially we
> - must not reuse the same connection if partway through
> - a handshake!) */
> - if(wantNTLM) {
> + /* If we are looking for an HTTP+NTLM connection, check if this is
> + already authenticating with the right credentials. If not, keep
> + looking so that we can reuse NTLM connections if
> + possible. (Especially we must not reuse the same connection if
> + partway through a handshake!) */
> + if(wantNTLMhttp) {
> if(credentialsMatch && check->ntlm.state != NTLMSTATE_NONE) {
> chosen = check;
>
> --
> 1.9.0.rc3
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-12