parent
23386872d1
commit
b5d453effa
@ -317,10 +317,8 @@ struct altsvcinfo *Curl_altsvc_init(void)
|
|||||||
*/
|
*/
|
||||||
CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file)
|
CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file)
|
||||||
{
|
{
|
||||||
CURLcode result;
|
|
||||||
DEBUGASSERT(asi);
|
DEBUGASSERT(asi);
|
||||||
result = altsvc_load(asi, file);
|
return altsvc_load(asi, file);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -3916,8 +3916,7 @@ static CURLcode init_wc_data(struct Curl_easy *data)
|
|||||||
last_slash++;
|
last_slash++;
|
||||||
if(last_slash[0] == '\0') {
|
if(last_slash[0] == '\0') {
|
||||||
wildcard->state = CURLWC_CLEAN;
|
wildcard->state = CURLWC_CLEAN;
|
||||||
result = ftp_parse_url_path(data);
|
return ftp_parse_url_path(data);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
wildcard->pattern = strdup(last_slash);
|
wildcard->pattern = strdup(last_slash);
|
||||||
if(!wildcard->pattern)
|
if(!wildcard->pattern)
|
||||||
@ -3933,8 +3932,7 @@ static CURLcode init_wc_data(struct Curl_easy *data)
|
|||||||
}
|
}
|
||||||
else { /* only list */
|
else { /* only list */
|
||||||
wildcard->state = CURLWC_CLEAN;
|
wildcard->state = CURLWC_CLEAN;
|
||||||
result = ftp_parse_url_path(data);
|
return ftp_parse_url_path(data);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1974,11 +1974,8 @@ static CURLcode set_reader(struct Curl_easy *data, Curl_HttpReq httpreq)
|
|||||||
|
|
||||||
switch(httpreq) {
|
switch(httpreq) {
|
||||||
case HTTPREQ_PUT: /* Let's PUT the data to the server! */
|
case HTTPREQ_PUT: /* Let's PUT the data to the server! */
|
||||||
if(!postsize)
|
return postsize ? Curl_creader_set_fread(data, postsize) :
|
||||||
result = Curl_creader_set_null(data);
|
Curl_creader_set_null(data);
|
||||||
else
|
|
||||||
result = Curl_creader_set_fread(data, postsize);
|
|
||||||
return result;
|
|
||||||
|
|
||||||
#if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
|
#if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
|
||||||
case HTTPREQ_POST_FORM:
|
case HTTPREQ_POST_FORM:
|
||||||
|
|||||||
@ -236,17 +236,13 @@ static CURLcode oldap_map_error(int rc, CURLcode result)
|
|||||||
{
|
{
|
||||||
switch(rc) {
|
switch(rc) {
|
||||||
case LDAP_NO_MEMORY:
|
case LDAP_NO_MEMORY:
|
||||||
result = CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
break;
|
|
||||||
case LDAP_INVALID_CREDENTIALS:
|
case LDAP_INVALID_CREDENTIALS:
|
||||||
result = CURLE_LOGIN_DENIED;
|
return CURLE_LOGIN_DENIED;
|
||||||
break;
|
|
||||||
case LDAP_PROTOCOL_ERROR:
|
case LDAP_PROTOCOL_ERROR:
|
||||||
result = CURLE_UNSUPPORTED_PROTOCOL;
|
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||||
break;
|
|
||||||
case LDAP_INSUFFICIENT_ACCESS:
|
case LDAP_INSUFFICIENT_ACCESS:
|
||||||
result = CURLE_REMOTE_ACCESS_DENIED;
|
return CURLE_REMOTE_ACCESS_DENIED;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -352,7 +348,6 @@ static CURLcode oldap_perform_auth(struct Curl_easy *data, const char *mech,
|
|||||||
{
|
{
|
||||||
struct connectdata *conn = data->conn;
|
struct connectdata *conn = data->conn;
|
||||||
struct ldapconninfo *li = conn->proto.ldapc;
|
struct ldapconninfo *li = conn->proto.ldapc;
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct berval cred;
|
struct berval cred;
|
||||||
struct berval *pcred = &cred;
|
struct berval *pcred = &cred;
|
||||||
int rc;
|
int rc;
|
||||||
@ -363,8 +358,8 @@ static CURLcode oldap_perform_auth(struct Curl_easy *data, const char *mech,
|
|||||||
pcred = NULL;
|
pcred = NULL;
|
||||||
rc = ldap_sasl_bind(li->ld, NULL, mech, pcred, NULL, NULL, &li->msgid);
|
rc = ldap_sasl_bind(li->ld, NULL, mech, pcred, NULL, NULL, &li->msgid);
|
||||||
if(rc != LDAP_SUCCESS)
|
if(rc != LDAP_SUCCESS)
|
||||||
result = oldap_map_error(rc, CURLE_LDAP_CANNOT_BIND);
|
return oldap_map_error(rc, CURLE_LDAP_CANNOT_BIND);
|
||||||
return result;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -375,7 +370,6 @@ static CURLcode oldap_continue_auth(struct Curl_easy *data, const char *mech,
|
|||||||
{
|
{
|
||||||
struct connectdata *conn = data->conn;
|
struct connectdata *conn = data->conn;
|
||||||
struct ldapconninfo *li = conn->proto.ldapc;
|
struct ldapconninfo *li = conn->proto.ldapc;
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct berval cred;
|
struct berval cred;
|
||||||
struct berval *pcred = &cred;
|
struct berval *pcred = &cred;
|
||||||
int rc;
|
int rc;
|
||||||
@ -386,8 +380,8 @@ static CURLcode oldap_continue_auth(struct Curl_easy *data, const char *mech,
|
|||||||
pcred = NULL;
|
pcred = NULL;
|
||||||
rc = ldap_sasl_bind(li->ld, NULL, mech, pcred, NULL, NULL, &li->msgid);
|
rc = ldap_sasl_bind(li->ld, NULL, mech, pcred, NULL, NULL, &li->msgid);
|
||||||
if(rc != LDAP_SUCCESS)
|
if(rc != LDAP_SUCCESS)
|
||||||
result = oldap_map_error(rc, CURLE_LDAP_CANNOT_BIND);
|
return oldap_map_error(rc, CURLE_LDAP_CANNOT_BIND);
|
||||||
return result;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -396,20 +390,18 @@ static CURLcode oldap_continue_auth(struct Curl_easy *data, const char *mech,
|
|||||||
static CURLcode oldap_cancel_auth(struct Curl_easy *data, const char *mech)
|
static CURLcode oldap_cancel_auth(struct Curl_easy *data, const char *mech)
|
||||||
{
|
{
|
||||||
struct ldapconninfo *li = data->conn->proto.ldapc;
|
struct ldapconninfo *li = data->conn->proto.ldapc;
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
int rc = ldap_sasl_bind(li->ld, NULL, LDAP_SASL_NULL, NULL, NULL, NULL,
|
int rc = ldap_sasl_bind(li->ld, NULL, LDAP_SASL_NULL, NULL, NULL, NULL,
|
||||||
&li->msgid);
|
&li->msgid);
|
||||||
|
|
||||||
(void)mech;
|
(void)mech;
|
||||||
if(rc != LDAP_SUCCESS)
|
if(rc != LDAP_SUCCESS)
|
||||||
result = oldap_map_error(rc, CURLE_LDAP_CANNOT_BIND);
|
return oldap_map_error(rc, CURLE_LDAP_CANNOT_BIND);
|
||||||
return result;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Starts LDAP simple bind. */
|
/* Starts LDAP simple bind. */
|
||||||
static CURLcode oldap_perform_bind(struct Curl_easy *data, ldapstate newstate)
|
static CURLcode oldap_perform_bind(struct Curl_easy *data, ldapstate newstate)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct connectdata *conn = data->conn;
|
struct connectdata *conn = data->conn;
|
||||||
struct ldapconninfo *li = conn->proto.ldapc;
|
struct ldapconninfo *li = conn->proto.ldapc;
|
||||||
char *binddn = NULL;
|
char *binddn = NULL;
|
||||||
@ -427,19 +419,17 @@ static CURLcode oldap_perform_bind(struct Curl_easy *data, ldapstate newstate)
|
|||||||
|
|
||||||
rc = ldap_sasl_bind(li->ld, binddn, LDAP_SASL_SIMPLE, &passwd,
|
rc = ldap_sasl_bind(li->ld, binddn, LDAP_SASL_SIMPLE, &passwd,
|
||||||
NULL, NULL, &li->msgid);
|
NULL, NULL, &li->msgid);
|
||||||
if(rc == LDAP_SUCCESS)
|
if(rc != LDAP_SUCCESS)
|
||||||
oldap_state(data, newstate);
|
return oldap_map_error(rc,
|
||||||
else
|
data->state.aptr.user ?
|
||||||
result = oldap_map_error(rc,
|
CURLE_LOGIN_DENIED : CURLE_LDAP_CANNOT_BIND);
|
||||||
data->state.aptr.user ?
|
oldap_state(data, newstate);
|
||||||
CURLE_LOGIN_DENIED : CURLE_LDAP_CANNOT_BIND);
|
return CURLE_OK;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Query the supported SASL authentication mechanisms. */
|
/* Query the supported SASL authentication mechanisms. */
|
||||||
static CURLcode oldap_perform_mechs(struct Curl_easy *data)
|
static CURLcode oldap_perform_mechs(struct Curl_easy *data)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct ldapconninfo *li = data->conn->proto.ldapc;
|
struct ldapconninfo *li = data->conn->proto.ldapc;
|
||||||
int rc;
|
int rc;
|
||||||
static const char * const supportedSASLMechanisms[] = {
|
static const char * const supportedSASLMechanisms[] = {
|
||||||
@ -450,11 +440,10 @@ static CURLcode oldap_perform_mechs(struct Curl_easy *data)
|
|||||||
rc = ldap_search_ext(li->ld, "", LDAP_SCOPE_BASE, "(objectclass=*)",
|
rc = ldap_search_ext(li->ld, "", LDAP_SCOPE_BASE, "(objectclass=*)",
|
||||||
(char **) supportedSASLMechanisms, 0,
|
(char **) supportedSASLMechanisms, 0,
|
||||||
NULL, NULL, NULL, 0, &li->msgid);
|
NULL, NULL, NULL, 0, &li->msgid);
|
||||||
if(rc == LDAP_SUCCESS)
|
if(rc != LDAP_SUCCESS)
|
||||||
oldap_state(data, OLDAP_MECHS);
|
return oldap_map_error(rc, CURLE_LOGIN_DENIED);
|
||||||
else
|
oldap_state(data, OLDAP_MECHS);
|
||||||
result = oldap_map_error(rc, CURLE_LOGIN_DENIED);
|
return CURLE_OK;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Starts SASL bind. */
|
/* Starts SASL bind. */
|
||||||
@ -480,12 +469,11 @@ static bool ssl_installed(struct connectdata *conn)
|
|||||||
|
|
||||||
static CURLcode oldap_ssl_connect(struct Curl_easy *data, ldapstate newstate)
|
static CURLcode oldap_ssl_connect(struct Curl_easy *data, ldapstate newstate)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct connectdata *conn = data->conn;
|
struct connectdata *conn = data->conn;
|
||||||
struct ldapconninfo *li = conn->proto.ldapc;
|
struct ldapconninfo *li = conn->proto.ldapc;
|
||||||
bool ssldone = 0;
|
bool ssldone = 0;
|
||||||
|
CURLcode result =
|
||||||
result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
|
Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
|
||||||
if(!result) {
|
if(!result) {
|
||||||
oldap_state(data, newstate);
|
oldap_state(data, newstate);
|
||||||
|
|
||||||
@ -506,15 +494,13 @@ static CURLcode oldap_ssl_connect(struct Curl_easy *data, ldapstate newstate)
|
|||||||
/* Send the STARTTLS request */
|
/* Send the STARTTLS request */
|
||||||
static CURLcode oldap_perform_starttls(struct Curl_easy *data)
|
static CURLcode oldap_perform_starttls(struct Curl_easy *data)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct ldapconninfo *li = data->conn->proto.ldapc;
|
struct ldapconninfo *li = data->conn->proto.ldapc;
|
||||||
int rc = ldap_start_tls(li->ld, NULL, NULL, &li->msgid);
|
int rc = ldap_start_tls(li->ld, NULL, NULL, &li->msgid);
|
||||||
|
|
||||||
if(rc == LDAP_SUCCESS)
|
if(rc != LDAP_SUCCESS)
|
||||||
oldap_state(data, OLDAP_STARTTLS);
|
return oldap_map_error(rc, CURLE_USE_SSL_FAILED);
|
||||||
else
|
oldap_state(data, OLDAP_STARTTLS);
|
||||||
result = oldap_map_error(rc, CURLE_USE_SSL_FAILED);
|
return CURLE_OK;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
19
lib/setopt.c
19
lib/setopt.c
@ -3205,22 +3205,21 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||||||
plen = strlen(argptr);
|
plen = strlen(argptr);
|
||||||
if(plen > CURL_MAX_INPUT_LENGTH) {
|
if(plen > CURL_MAX_INPUT_LENGTH) {
|
||||||
data->set.tls_ech = CURLECH_DISABLE;
|
data->set.tls_ech = CURLECH_DISABLE;
|
||||||
result = CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
/* set tls_ech flag value, preserving CLA_CFG bit */
|
/* set tls_ech flag value, preserving CLA_CFG bit */
|
||||||
if(plen == 5 && !strcmp(argptr, "false"))
|
if(plen == 5 && !strcmp(argptr, "false"))
|
||||||
data->set.tls_ech = CURLECH_DISABLE
|
data->set.tls_ech = CURLECH_DISABLE |
|
||||||
| (data->set.tls_ech & CURLECH_CLA_CFG);
|
(data->set.tls_ech & CURLECH_CLA_CFG);
|
||||||
else if(plen == 6 && !strcmp(argptr, "grease"))
|
else if(plen == 6 && !strcmp(argptr, "grease"))
|
||||||
data->set.tls_ech = CURLECH_GREASE
|
data->set.tls_ech = CURLECH_GREASE |
|
||||||
| (data->set.tls_ech & CURLECH_CLA_CFG);
|
(data->set.tls_ech & CURLECH_CLA_CFG);
|
||||||
else if(plen == 4 && !strcmp(argptr, "true"))
|
else if(plen == 4 && !strcmp(argptr, "true"))
|
||||||
data->set.tls_ech = CURLECH_ENABLE
|
data->set.tls_ech = CURLECH_ENABLE |
|
||||||
| (data->set.tls_ech & CURLECH_CLA_CFG);
|
(data->set.tls_ech & CURLECH_CLA_CFG);
|
||||||
else if(plen == 4 && !strcmp(argptr, "hard"))
|
else if(plen == 4 && !strcmp(argptr, "hard"))
|
||||||
data->set.tls_ech = CURLECH_HARD
|
data->set.tls_ech = CURLECH_HARD |
|
||||||
| (data->set.tls_ech & CURLECH_CLA_CFG);
|
(data->set.tls_ech & CURLECH_CLA_CFG);
|
||||||
else if(plen > 5 && !strncmp(argptr, "ecl:", 4)) {
|
else if(plen > 5 && !strncmp(argptr, "ecl:", 4)) {
|
||||||
result = Curl_setstropt(&data->set.str[STRING_ECH_CONFIG], argptr + 4);
|
result = Curl_setstropt(&data->set.str[STRING_ECH_CONFIG], argptr + 4);
|
||||||
if(result)
|
if(result)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user