MCPcopy Create free account
hub / github.com/apache/httpd / get_hash

Function get_hash

modules/aaa/mod_auth_digest.c:1313–1370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1311 */
1312
1313static authn_status get_hash(request_rec *r, const char *user,
1314 digest_config_rec *conf, const char **rethash)
1315{
1316 authn_status auth_result;
1317 char *password;
1318 authn_provider_list *current_provider;
1319
1320 current_provider = conf->providers;
1321 do {
1322 const authn_provider *provider;
1323
1324 /* For now, if a provider isn't set, we'll be nice and use the file
1325 * provider.
1326 */
1327 if (!current_provider) {
1328 provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP,
1329 AUTHN_DEFAULT_PROVIDER,
1330 AUTHN_PROVIDER_VERSION);
1331
1332 if (!provider || !provider->get_realm_hash) {
1333 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01770)
1334 "No Authn provider configured");
1335 auth_result = AUTH_GENERAL_ERROR;
1336 break;
1337 }
1338 apr_table_setn(r->notes, AUTHN_PROVIDER_NAME_NOTE, AUTHN_DEFAULT_PROVIDER);
1339 }
1340 else {
1341 provider = current_provider->provider;
1342 apr_table_setn(r->notes, AUTHN_PROVIDER_NAME_NOTE, current_provider->provider_name);
1343 }
1344
1345
1346 /* We expect the password to be md5 hash of user:realm:password */
1347 auth_result = provider->get_realm_hash(r, user, conf->realm,
1348 &password);
1349
1350 apr_table_unset(r->notes, AUTHN_PROVIDER_NAME_NOTE);
1351
1352 /* Something occurred. Stop checking. */
1353 if (auth_result != AUTH_USER_NOT_FOUND) {
1354 break;
1355 }
1356
1357 /* If we're not really configured for providers, stop now. */
1358 if (!conf->providers) {
1359 break;
1360 }
1361
1362 current_provider = current_provider->next;
1363 } while (current_provider);
1364
1365 if (auth_result == AUTH_USER_FOUND) {
1366 *rethash = password;
1367 }
1368
1369 return auth_result;
1370}

Callers 1

authenticate_digest_userFunction · 0.85

Calls 1

ap_lookup_providerFunction · 0.85

Tested by

no test coverage detected