static bool
auth_handle_response(struct digest_auth_request *request,
- char *key, char *value, const char **error)
+ char *key, char *value, const char **error_r)
{
struct sasl_server_mech_request *auth_request = &request->auth_request;
unsigned int i;
if (strcmp(key, "username") == 0) {
if (request->username != NULL) {
- *error = "username must not exist more than once";
+ *error_r = "username must not exist more than once";
return FALSE;
}
if (*value == '\0') {
- *error = "empty username";
+ *error_r = "empty username";
return FALSE;
}
if (strcmp(key, "nonce") == 0) {
/* nonce must be same */
if (strcmp(value, request->nonce) != 0) {
- *error = "Invalid nonce";
+ *error_r = "Invalid nonce";
return FALSE;
}
if (strcmp(key, "cnonce") == 0) {
if (request->cnonce != NULL) {
- *error = "cnonce must not exist more than once";
+ *error_r = "cnonce must not exist more than once";
return FALSE;
}
if (*value == '\0') {
- *error = "cnonce can't contain empty value";
+ *error_r = "cnonce can't contain empty value";
return FALSE;
}
unsigned int nc;
if (request->nonce_count != NULL) {
- *error = "nonce-count must not exist more than once";
+ *error_r = "nonce-count must not exist more than once";
return FALSE;
}
if (str_to_uint(value, &nc) < 0) {
- *error = "nonce-count value invalid";
+ *error_r = "nonce-count value invalid";
return FALSE;
}
if (nc != 1) {
- *error = "re-auth not supported currently";
+ *error_r = "re-auth not supported currently";
return FALSE;
}
}
if (i == QOP_COUNT) {
- *error = t_strdup_printf("Unknown QoP value: %s",
- str_sanitize(value, 32));
+ *error_r = t_strdup_printf("Unknown QoP value: %s",
+ str_sanitize(value, 32));
return FALSE;
}
request->qop &= (1 << i);
if (request->qop == 0) {
- *error = "Nonallowed QoP requested";
+ *error_r = "Nonallowed QoP requested";
return FALSE;
}
const char *const *uri = t_strsplit(value, "/");
if (uri[0] == NULL || uri[1] == NULL) {
- *error = "Invalid digest-uri";
+ *error_r = "Invalid digest-uri";
return FALSE;
}
if (strcmp(key, "maxbuf") == 0) {
if (request->maxbuf != 0) {
- *error = "maxbuf must not exist more than once";
+ *error_r = "maxbuf must not exist more than once";
return FALSE;
}
if (str_to_ulong(value, &request->maxbuf) < 0 ||
request->maxbuf == 0) {
- *error = "Invalid maxbuf value";
+ *error_r = "Invalid maxbuf value";
return FALSE;
}
return TRUE;
if (strcmp(key, "charset") == 0) {
if (strcasecmp(value, "utf-8") != 0) {
- *error = "Only utf-8 charset is allowed";
+ *error_r = "Only utf-8 charset is allowed";
return FALSE;
}
if (strcmp(key, "response") == 0) {
if (strlen(value) != 32) {
- *error = "Invalid response value";
+ *error_r = "Invalid response value";
return FALSE;
}
if (strcmp(key, "authzid") == 0) {
if (request->authzid != NULL) {
- *error = "authzid must not exist more than once";
+ *error_r = "authzid must not exist more than once";
return FALSE;
}
if (*value == '\0') {
- *error = "empty authzid";
+ *error_r = "empty authzid";
return FALSE;
}