/* Supported mechanisms */
const struct {
- const char * name; /* Name */
+ const char *name; /* Name */
size_t len; /* Name length */
unsigned int bit; /* Flag bit */
} mechtable[] = {
return result; \
}
-
/*
* Return 0 on success and then the buffers are filled in fine.
*
*
* Return the SASL mechanism token or 0 if no match.
*/
-unsigned int
-Curl_sasl_decode_mech(const char *ptr, size_t maxlen, size_t *len)
+unsigned int Curl_sasl_decode_mech(const char *ptr, size_t maxlen, size_t *len)
{
unsigned int i;
char c;
!memcmp(ptr, mechtable[i].name, mechtable[i].len)) {
if(len)
*len = mechtable[i].len;
+
if(maxlen == mechtable[i].len)
return mechtable[i].bit;
+
c = ptr[mechtable[i].len];
if(!ISUPPER(c) && !ISDIGIT(c) && c != '-' && c != '_')
return mechtable[i].bit;
{
CURLcode result = CURLE_OK;
unsigned int mechbit;
- size_t llen;
+ size_t mechlen;
if(!len)
return CURLE_URL_MALFORMAT;
if(strnequal(value, "*", len))
sasl->prefmech = SASL_AUTH_ANY;
- else if((mechbit = Curl_sasl_decode_mech(value, len, &llen)) &&
- llen == len)
+ else if((mechbit = Curl_sasl_decode_mech(value, len, &mechlen)) &&
+ mechlen == len)
sasl->prefmech |= mechbit;
else
result = CURLE_URL_MALFORMAT;
}
Curl_safefree(resp);
+
return result;
}
* Continue an SASL authentication.
*/
CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
- int code, saslprogress *progress)
+ int code, saslprogress *progress)
{
CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data;
}
Curl_safefree(resp);
+
state(sasl, conn, newstate);
+
return result;
}
/* Continue an SASL authentication */
CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
- int code, saslprogress *progress);
+ int code, saslprogress *progress);
#endif /* HEADER_CURL_SASL_H */