]>
Commit | Line | Data |
---|---|---|
d505af0a | 1 | diff -ur mod_fastcgi-2.4.2-o/mod_fastcgi.c mod_fastcgi-2.4.2/mod_fastcgi.c |
2 | --- mod_fastcgi-2.4.2-o/mod_fastcgi.c 2005-12-25 02:45:12.000000000 -0700 | |
3 | +++ mod_fastcgi-2.4.2/mod_fastcgi.c 2005-12-25 12:14:31.000000000 -0700 | |
4 | @@ -2657,10 +2657,15 @@ | |
5 | r->status_line = NULL; | |
6 | } | |
7 | ||
8 | +#ifdef APACHE22 | |
9 | +static authn_status check_user_authentication(request_rec *r, const char *user, const char *password) | |
10 | +{ | |
11 | +#else /* !APACHE22 */ | |
12 | static int check_user_authentication(request_rec *r) | |
13 | { | |
14 | - int res, authenticated = 0; | |
15 | const char *password; | |
16 | +#endif | |
17 | + int res, authenticated = 0; | |
18 | fcgi_request *fr; | |
19 | const fcgi_dir_config * const dir_config = | |
20 | (const fcgi_dir_config *)ap_get_module_config(r->per_dir_config, &fastcgi_module); | |
21 | @@ -2668,9 +2673,11 @@ | |
22 | if (dir_config->authenticator == NULL) | |
23 | return DECLINED; | |
24 | ||
25 | - /* Get the user password */ | |
26 | +#ifndef APACHE22 | |
27 | + /* Get the user password */ | |
28 | if ((res = ap_get_basic_auth_pw(r, &password)) != OK) | |
29 | return res; | |
30 | +#endif /* APACHE22 */ | |
31 | ||
32 | res = create_fcgi_request(r, dir_config->authenticator, &fr); | |
33 | if (res) | |
34 | @@ -2704,6 +2711,23 @@ | |
35 | goto AuthenticationFailed; | |
36 | } | |
37 | ||
38 | +#ifdef APACHE22 | |
39 | + if (authenticated) | |
40 | + return OK; | |
41 | + | |
42 | +AuthenticationFailed: | |
43 | + if (!(dir_config->authenticator_options & FCGI_AUTHORITATIVE)) | |
44 | + return AUTH_DENIED; // FIXME -- should be decline? | |
45 | + | |
46 | + /* @@@ Probably should support custom_responses */ | |
47 | + ap_note_basic_auth_failure(r); | |
48 | + ap_log_rerror(FCGI_LOG_ERR_NOERRNO, r, | |
49 | + "FastCGI: authentication failed for user \"%s\": %s", | |
50 | + r->user, r->uri); | |
51 | + | |
52 | + return (res == OK) ? AUTH_DENIED : AUTH_GRANTED; | |
53 | + | |
54 | +#else /* !APACHE22 */ | |
55 | if (authenticated) | |
56 | return OK; | |
57 | ||
58 | @@ -2722,6 +2746,7 @@ | |
59 | #endif | |
60 | ||
61 | return (res == OK) ? HTTP_UNAUTHORIZED : res; | |
62 | +#endif /* !APACHE22 */ | |
63 | } | |
64 | ||
65 | static int check_user_authorization(request_rec *r) | |
66 | @@ -2913,6 +2938,15 @@ | |
67 | ||
68 | #ifdef APACHE2 | |
69 | ||
70 | +#ifdef APACHE22 | |
71 | +static const authn_provider authn_fastcgi_provider = | |
72 | +{ | |
73 | + &check_password, | |
74 | + NULL, | |
75 | +}; | |
76 | +#endif /* APACHE22 */ | |
77 | + | |
78 | + | |
79 | static void register_hooks(apr_pool_t * p) | |
80 | { | |
81 | /* ap_hook_pre_config(x_pre_config, NULL, NULL, APR_HOOK_MIDDLE); */ | |
82 | @@ -2923,6 +2957,11 @@ | |
83 | ap_hook_access_checker(check_access, NULL, NULL, APR_HOOK_MIDDLE); | |
84 | ap_hook_auth_checker(check_user_authorization, NULL, NULL, APR_HOOK_MIDDLE); | |
85 | ap_hook_fixups(fixups, NULL, NULL, APR_HOOK_MIDDLE); | |
86 | +#ifdef APACHE22 | |
87 | + ap_register_provider(p, AUTHN_PROVIDER_GROUP, "fastcgi", "0", | |
88 | + &authn_fastcgi_provider); | |
89 | +#endif /* APACHE22 */ | |
90 | + | |
91 | } | |
92 | ||
93 | module AP_MODULE_DECLARE_DATA fastcgi_module = |