cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] curl-7.21.5-gssauth-handle-reuse-fix

From: Marcus Sundberg <marcus.sundberg_at_aptilo.com>
Date: Wed, 9 Mar 2011 19:07:28 +0100

Make GSS authentication work when a curl handle is reused for multiple
authenticated requests, by always setting negdata->state in
output_auth_headers().

Signed-off-by: Marcus Sundberg <marcus.sundberg_at_aptilo.com>

---
 lib/http.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/http.c b/lib/http.c
index 807bbeb..419efc1 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -531,6 +531,7 @@ output_auth_headers(struct connectdata *conn,
 #endif
 
 #ifdef USE_HTTP_NEGOTIATE
+  negdata->state = GSS_AUTHNONE;
   if((authstatus->picked == CURLAUTH_GSSNEGOTIATE) &&
      negdata->context && !GSS_ERROR(negdata->status)) {
     auth="GSS-Negotiate";
-- 
1.7.4
--------------000608010009060405010902
Content-Type: text/plain;
 name="curl-log.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="curl-log.txt"
Cloning into myrepo...
* Couldn't find host git.example.com in the .netrc file; using defaults
* About to connect() to git.example.com port 80 (#0)
*   Trying 1.2.3.4... * Connected to git.example.com (1.2.3.4) port 80 (#0)
> GET /git/myrepo.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.3.2
Host: git.example.com
Accept: */*
Pragma: no-cache
< HTTP/1.1 401 Authorization Required
< Date: Wed, 09 Mar 2011 18:02:07 GMT
< Server: Apache/2.2.3 (CentOS)
< WWW-Authenticate: Negotiate
< WWW-Authenticate: Basic realm="Example AD"
< Content-Length: 484
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
< 
* Expire cleared
* Closing connection #0
* Issue another request to this URL: 'http://:@git.example.com/git/myrepo.git/info/refs?service=git-upload-pack'
* Couldn't find host git.example.com in the .netrc file; using defaults
* About to connect() to git.example.com port 80 (#0)
*   Trying 1.2.3.4... * Connected to git.example.com (1.2.3.4) port 80 (#0)
* Server auth using GSS-Negotiate with user ''
> GET /git/myrepo.git/info/refs?service=git-upload-pack HTTP/1.1
Authorization: Negotiate BASE64DATA
User-Agent: git/1.7.3.2
Host: git.example.com
Accept: */*
Pragma: no-cache
< HTTP/1.1 200 OK
< Date: Wed, 09 Mar 2011 18:02:07 GMT
< Server: Apache/2.2.3 (CentOS)
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: application/x-git-upload-pack-advertisement
< 
* Closing connection #0
* Couldn't find host git.example.com in the .netrc file; using defaults
* About to connect() to git.example.com port 80 (#0)
*   Trying 1.2.3.4... * connected
* Connected to git.example.com (1.2.3.4) port 80 (#0)
> POST /git/myrepo.git/git-upload-pack HTTP/1.1
User-Agent: git/1.7.3.2
Host: git.example.com
Accept-Encoding: deflate, gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Encoding: gzip
Content-Length: 3105
Expect: 100-continue
< HTTP/1.1 401 Authorization Required
< Date: Wed, 09 Mar 2011 18:02:07 GMT
< Server: Apache/2.2.3 (CentOS)
* Authentication problem. Ignoring this.
< WWW-Authenticate: Negotiate
< WWW-Authenticate: Basic realm="Example AD"
< Content-Length: 484
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
* The requested URL returned error: 401
* Closing connection #0
error: RPC failed; result=22, HTTP code = 401
fatal: The remote end hung up unexpectedly
--------------000608010009060405010902
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
--------------000608010009060405010902--
Received on 2001-09-17