| 1180 | } |
| 1181 | |
| 1182 | static void note_digest_auth_failure(request_rec *r, |
| 1183 | const digest_config_rec *conf, |
| 1184 | digest_header_rec *resp, int stale) |
| 1185 | { |
| 1186 | const char *qop, *opaque, *opaque_param, *domain, *nonce; |
| 1187 | |
| 1188 | /* Setup qop */ |
| 1189 | if (apr_is_empty_array(conf->qop_list)) { |
| 1190 | qop = ", qop=\"auth\""; |
| 1191 | } |
| 1192 | else if (!ap_cstr_casecmp(*(const char **)(conf->qop_list->elts), "none")) { |
| 1193 | qop = ""; |
| 1194 | } |
| 1195 | else { |
| 1196 | qop = apr_pstrcat(r->pool, ", qop=\"", |
| 1197 | apr_array_pstrcat(r->pool, conf->qop_list, ','), |
| 1198 | "\"", |
| 1199 | NULL); |
| 1200 | } |
| 1201 | |
| 1202 | /* Setup opaque */ |
| 1203 | |
| 1204 | if (resp->opaque == NULL) { |
| 1205 | /* new client */ |
| 1206 | if ((conf->check_nc || conf->nonce_lifetime == 0) |
| 1207 | && (resp->client = gen_client(r)) != NULL) { |
| 1208 | opaque = ltox(r->pool, resp->client->key); |
| 1209 | } |
| 1210 | else { |
| 1211 | opaque = ""; /* opaque not needed */ |
| 1212 | } |
| 1213 | } |
| 1214 | else if (resp->client == NULL) { |
| 1215 | /* client info was gc'd */ |
| 1216 | resp->client = gen_client(r); |
| 1217 | if (resp->client != NULL) { |
| 1218 | opaque = ltox(r->pool, resp->client->key); |
| 1219 | stale = 1; |
| 1220 | client_list->num_renewed++; |
| 1221 | } |
| 1222 | else { |
| 1223 | opaque = ""; /* ??? */ |
| 1224 | } |
| 1225 | } |
| 1226 | else { |
| 1227 | opaque = resp->opaque; |
| 1228 | /* we're generating a new nonce, so reset the nonce-count */ |
| 1229 | resp->client->nonce_count = 0; |
| 1230 | } |
| 1231 | |
| 1232 | if (opaque[0]) { |
| 1233 | opaque_param = apr_pstrcat(r->pool, ", opaque=\"", opaque, "\"", NULL); |
| 1234 | } |
| 1235 | else { |
| 1236 | opaque_param = NULL; |
| 1237 | } |
| 1238 | |
| 1239 | /* Setup nonce */ |
no test coverage detected