* Get the auth username and password from the main request * notes table, if present. */
| 469 | * notes table, if present. |
| 470 | */ |
| 471 | static void get_notes_auth(request_rec *r, |
| 472 | const char **user, const char **pw, |
| 473 | const char **method, const char **mimetype) |
| 474 | { |
| 475 | const char *authname; |
| 476 | request_rec *m = r; |
| 477 | |
| 478 | /* find the main request */ |
| 479 | while (m->main) { |
| 480 | m = m->main; |
| 481 | } |
| 482 | /* find the first redirect */ |
| 483 | while (m->prev) { |
| 484 | m = m->prev; |
| 485 | } |
| 486 | |
| 487 | /* have we isolated the user and pw before? */ |
| 488 | authname = ap_auth_name(m); |
| 489 | if (user) { |
| 490 | *user = (char *) apr_table_get(m->notes, apr_pstrcat(m->pool, authname, "-user", NULL)); |
| 491 | } |
| 492 | if (pw) { |
| 493 | *pw = (char *) apr_table_get(m->notes, apr_pstrcat(m->pool, authname, "-pw", NULL)); |
| 494 | } |
| 495 | if (method) { |
| 496 | *method = (char *) apr_table_get(m->notes, apr_pstrcat(m->pool, authname, "-method", NULL)); |
| 497 | } |
| 498 | if (mimetype) { |
| 499 | *mimetype = (char *) apr_table_get(m->notes, apr_pstrcat(m->pool, authname, "-mimetype", NULL)); |
| 500 | } |
| 501 | |
| 502 | /* set the user, even though the user is unauthenticated at this point */ |
| 503 | if (user && *user) { |
| 504 | r->user = (char *) *user; |
| 505 | } |
| 506 | |
| 507 | ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, |
| 508 | "from notes: user: %s, pw: %s, method: %s, mimetype: %s", |
| 509 | user ? *user : "<null>", pw ? *pw : "<null>", |
| 510 | method ? *method : "<null>", mimetype ? *mimetype : "<null>"); |
| 511 | |
| 512 | } |
| 513 | |
| 514 | /** |
| 515 | * Set the auth username and password into the session. |
no test coverage detected