1 diff -Nur mod_fastcgi-2.4.6.orig/mod_fastcgi.c mod_fastcgi-2.4.6.apache22/mod_fastcgi.c
2 --- mod_fastcgi-2.4.6.orig/mod_fastcgi.c 2007-12-28 21:00:46.000000000 -0700
3 +++ mod_fastcgi-2.4.6.apache22/mod_fastcgi.c 2007-12-28 21:00:58.000000000 -0700
15 @@ -2697,10 +2701,15 @@
16 r->status_line = NULL;
20 +static authn_status check_user_authentication(request_rec *r, const char *user, const char *password)
22 +#else /* !APACHE22 */
23 static int check_user_authentication(request_rec *r)
25 - int res, authenticated = 0;
28 + int res, authenticated = 0;
30 const fcgi_dir_config * const dir_config =
31 (const fcgi_dir_config *)ap_get_module_config(r->per_dir_config, &fastcgi_module);
32 @@ -2708,9 +2717,11 @@
33 if (dir_config->authenticator == NULL)
36 - /* Get the user password */
38 + /* Get the user password */
39 if ((res = ap_get_basic_auth_pw(r, &password)) != OK)
41 +#endif /* APACHE22 */
43 res = create_fcgi_request(r, dir_config->authenticator, &fr);
45 @@ -2744,6 +2755,20 @@
46 goto AuthenticationFailed;
51 + return AUTH_GRANTED;
53 +AuthenticationFailed:
54 + /* @@@ Probably should support custom_responses */
55 + ap_note_basic_auth_failure(r);
56 + ap_log_rerror(FCGI_LOG_ERR_NOERRNO, r,
57 + "FastCGI: authentication failed for user \"%s\": %s",
60 + return (res == OK) ? AUTH_DENIED : AUTH_GRANTED;
62 +#else /* !APACHE22 */
69 return (res == OK) ? HTTP_UNAUTHORIZED : res;
70 +#endif /* !APACHE22 */
73 static int check_user_authorization(request_rec *r)
74 @@ -2955,16 +2981,31 @@
79 +static const authn_provider authn_fastcgi_provider =
81 + &check_user_authentication,
84 +#endif /* APACHE22 */
87 static void register_hooks(apr_pool_t * p)
89 /* ap_hook_pre_config(x_pre_config, NULL, NULL, APR_HOOK_MIDDLE); */
90 ap_hook_post_config(init_module, NULL, NULL, APR_HOOK_MIDDLE);
91 ap_hook_child_init(fcgi_child_init, NULL, NULL, APR_HOOK_MIDDLE);
92 ap_hook_handler(content_handler, NULL, NULL, APR_HOOK_MIDDLE);
93 - ap_hook_check_user_id(check_user_authentication, NULL, NULL, APR_HOOK_MIDDLE);
94 ap_hook_access_checker(check_access, NULL, NULL, APR_HOOK_MIDDLE);
95 ap_hook_auth_checker(check_user_authorization, NULL, NULL, APR_HOOK_MIDDLE);
96 ap_hook_fixups(fixups, NULL, NULL, APR_HOOK_MIDDLE);
98 + ap_register_provider(p, AUTHN_PROVIDER_GROUP, "fastcgi", "0",
99 + &authn_fastcgi_provider);
101 + ap_hook_check_user_id(check_user_authentication, NULL, NULL, APR_HOOK_MIDDLE);
106 module AP_MODULE_DECLARE_DATA fastcgi_module =