Apache 2.2 Basic Auth
最近需要修改一下Apache的BasicAuth模块,顺便简单分析一下。
首先是 mod_authn_file
, 这个模块从文件中读取用户名和密码组合,并逐一check看用户名和密码是否符合。代码在 modules/aaa/mod_authn_file.c
。
static const authn_provider authn_file_provider =
{
&check_password,
&get_realm_hash,
};
//注册一个叫file的AuthProvider,主要是两个函数check_password和get_realm_hash
static void register_hooks(apr_pool_t *p)
{
ap_register_provider(p, AUTHN_PROVIDER_GROUP, "file", "0",
&authn_file_provider);
}