CURLHTTP* renamed to CURLAUTH* and NEGOTIATE is now GSSNEGOTIATE as there's

a "plain" Negotiate as well.
This commit is contained in:
Daniel Stenberg 2003-06-12 17:34:27 +00:00
parent e58f30b82a
commit ecf32c964a
5 changed files with 23 additions and 34 deletions

@ -214,11 +214,11 @@ typedef enum {
} curl_proxytype; } curl_proxytype;
typedef enum { typedef enum {
CURLHTTP_BASIC = 0, /* default */ CURLAUTH_BASIC = 0, /* default */
CURLHTTP_DIGEST = 1, /* Digest */ CURLAUTH_DIGEST = 1, /* Digest */
CURLHTTP_NEGOTIATE = 2, /* Negotiate */ CURLAUTH_GSSNEGOTIATE = 2, /* GSS-Negotiate */
CURLHTTP_NTLM = 3, /* NTLM */ CURLAUTH_NTLM = 3, /* NTLM */
CURLHTTP_LAST /* never to be used */ CURLAUTH_LASTKNOWN /* never to be used */
} curl_httpauth; } curl_httpauth;
/* this was the error code 50 in 7.7.3 and a few earlier versions, this /* this was the error code 50 in 7.7.3 and a few earlier versions, this

@ -709,7 +709,7 @@ CURLcode Curl_http(struct connectdata *conn)
if(result) if(result)
return result; return result;
} }
else if(!data->set.httpdigest && /* not if Digest is enabled */ else if((data->set.httpauth == CURLAUTH_BASIC) && /* if Basic is desired */
conn->bits.user_passwd && conn->bits.user_passwd &&
!checkheaders(data, "Authorization:")) { !checkheaders(data, "Authorization:")) {
char *authorization; char *authorization;

@ -727,7 +727,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
else if (Curl_compareheader(k->p, "WWW-Authenticate:", else if (Curl_compareheader(k->p, "WWW-Authenticate:",
"GSS-Negotiate") && "GSS-Negotiate") &&
(401 == k->httpcode) && (401 == k->httpcode) &&
data->set.httpnegotiate) { (data->set.httpauth == CURLAUTH_GSSNEGOTIATE)) {
int neg; int neg;
neg = Curl_input_negotiate(conn, neg = Curl_input_negotiate(conn,
@ -742,8 +742,8 @@ CURLcode Curl_readwrite(struct connectdata *conn,
else if(Curl_compareheader(k->p, else if(Curl_compareheader(k->p,
"WWW-Authenticate:", "NTLM") && "WWW-Authenticate:", "NTLM") &&
(401 == k->httpcode) && (401 == k->httpcode) &&
data->set.httpntlm /* NTLM authentication is (data->set.httpauth == CURLAUTH_NTLM)
activated */) { /* NTLM authentication is activated */) {
CURLntlm ntlm = CURLntlm ntlm =
Curl_input_ntlm(conn, k->p+strlen("WWW-Authenticate:")); Curl_input_ntlm(conn, k->p+strlen("WWW-Authenticate:"));
@ -753,10 +753,11 @@ CURLcode Curl_readwrite(struct connectdata *conn,
infof(data, "Authentication problem. Ignoring this.\n"); infof(data, "Authentication problem. Ignoring this.\n");
} }
#endif #endif
else if(checkprefix("WWW-Authenticate:", k->p) && else if(Curl_compareheader(k->p,
"WWW-Authenticate:", "Digest") &&
(401 == k->httpcode) && (401 == k->httpcode) &&
data->set.httpdigest /* Digest authentication is (data->set.httpauth == CURLAUTH_DIGEST)
activated */) { /* Digest authentication is activated */) {
CURLdigest dig = CURLDIGEST_BAD; CURLdigest dig = CURLDIGEST_BAD;
if(data->state.digest.nonce) if(data->state.digest.nonce)

@ -851,36 +851,24 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
{ {
curl_httpauth auth = va_arg(param, long); curl_httpauth auth = va_arg(param, long);
switch(auth) { switch(auth) {
case CURLHTTP_BASIC: case CURLAUTH_BASIC:
/* default */ case CURLAUTH_DIGEST:
data->set.httpdigest = FALSE; data->set.httpauth = auth;
data->set.httpnegotiate = FALSE;
data->set.httpntlm = FALSE;
break; break;
case CURLHTTP_DIGEST: case CURLAUTH_NTLM:
/* Enable HTTP Digest authentication */
data->set.httpdigest = TRUE;
data->set.httpnegotiate = FALSE;
data->set.httpntlm = FALSE;
break;
case CURLHTTP_NTLM:
/* Enable HTTP NTLM authentication */ /* Enable HTTP NTLM authentication */
#ifdef USE_SSLEAY #ifdef USE_SSLEAY
/* We can only support NTLM if OpenSSL is present, as we need their /* We can only support NTLM if OpenSSL is present, as we need their
crypto package for it */ crypto package for it */
data->set.httpdigest = FALSE; data->set.httpauth = auth;
data->set.httpnegotiate = FALSE;
data->set.httpntlm = TRUE;
break; break;
#else #else
/* fall-through */ /* fall-through */
#endif #endif
case CURLHTTP_NEGOTIATE: case CURLAUTH_GSSNEGOTIATE:
#ifdef GSSAPI #ifdef GSSAPI
/* Enable HTTP Negotaiate authentication */ /* Enable HTTP Negotaiate authentication */
data->set.httpdigest = FALSE; data->set.httpauth = auth;
data->set.httpnegotiate = TRUE;
data->set.httpntlm = FALSE;
break; break;
#else #else
/* fall-through */ /* fall-through */

@ -705,9 +705,9 @@ struct UserDefined {
char *set_proxy; /* proxy to use */ char *set_proxy; /* proxy to use */
long use_port; /* which port to use (when not using default) */ long use_port; /* which port to use (when not using default) */
char *userpwd; /* <user:password>, if used */ char *userpwd; /* <user:password>, if used */
bool httpdigest; /* if HTTP Digest authentication is enabled */
bool httpnegotiate; /* if HTTP Negotiate authentication is enabled */ curl_httpauth httpauth; /* what kind of HTTP authentication to use */
bool httpntlm; /* if HTTP NTLM authentication is enabled */
char *set_range; /* range, if used. See README for detailed specification char *set_range; /* range, if used. See README for detailed specification
on this syntax. */ on this syntax. */
long followlocation; /* as in HTTP Location: */ long followlocation; /* as in HTTP Location: */