]>
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 | |
2254c02d | 3 | +++ mod_fastcgi-2.4.2/mod_fastcgi.c 2005-12-26 22:34:46.000000000 -0700 |
d58a6c49 | 4 | @@ -82,6 +82,10 @@ |
5 | ||
6 | #include "unixd.h" | |
7 | ||
8 | +#ifdef APACHE22 | |
9 | +#include "mod_auth.h" | |
10 | +#endif | |
11 | + | |
12 | #endif | |
13 | #endif | |
14 | ||
15 | @@ -2657,10 +2661,15 @@ | |
d505af0a | 16 | r->status_line = NULL; |
17 | } | |
18 | ||
19 | +#ifdef APACHE22 | |
20 | +static authn_status check_user_authentication(request_rec *r, const char *user, const char *password) | |
21 | +{ | |
22 | +#else /* !APACHE22 */ | |
23 | static int check_user_authentication(request_rec *r) | |
24 | { | |
25 | - int res, authenticated = 0; | |
26 | const char *password; | |
27 | +#endif | |
28 | + int res, authenticated = 0; | |
29 | fcgi_request *fr; | |
30 | const fcgi_dir_config * const dir_config = | |
31 | (const fcgi_dir_config *)ap_get_module_config(r->per_dir_config, &fastcgi_module); | |
d58a6c49 | 32 | @@ -2668,9 +2677,11 @@ |
d505af0a | 33 | if (dir_config->authenticator == NULL) |
34 | return DECLINED; | |
35 | ||
36 | - /* Get the user password */ | |
37 | +#ifndef APACHE22 | |
38 | + /* Get the user password */ | |
39 | if ((res = ap_get_basic_auth_pw(r, &password)) != OK) | |
40 | return res; | |
41 | +#endif /* APACHE22 */ | |
42 | ||
43 | res = create_fcgi_request(r, dir_config->authenticator, &fr); | |
44 | if (res) | |
d58a6c49 | 45 | @@ -2704,6 +2715,20 @@ |
d505af0a | 46 | goto AuthenticationFailed; |
47 | } | |
48 | ||
49 | +#ifdef APACHE22 | |
50 | + if (authenticated) | |
d58a6c49 | 51 | + return AUTH_GRANTED; |
d505af0a | 52 | + |
53 | +AuthenticationFailed: | |
d505af0a | 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", | |
58 | + r->user, r->uri); | |
59 | + | |
60 | + return (res == OK) ? AUTH_DENIED : AUTH_GRANTED; | |
61 | + | |
62 | +#else /* !APACHE22 */ | |
63 | if (authenticated) | |
64 | return OK; | |
65 | ||
d58a6c49 | 66 | @@ -2722,6 +2747,7 @@ |
d505af0a | 67 | #endif |
68 | ||
69 | return (res == OK) ? HTTP_UNAUTHORIZED : res; | |
70 | +#endif /* !APACHE22 */ | |
71 | } | |
72 | ||
73 | static int check_user_authorization(request_rec *r) | |
2254c02d | 74 | @@ -2913,16 +2939,31 @@ |
d505af0a | 75 | |
76 | #ifdef APACHE2 | |
77 | ||
78 | +#ifdef APACHE22 | |
79 | +static const authn_provider authn_fastcgi_provider = | |
80 | +{ | |
d58a6c49 | 81 | + &check_user_authentication, |
d505af0a | 82 | + NULL, |
83 | +}; | |
84 | +#endif /* APACHE22 */ | |
85 | + | |
86 | + | |
87 | static void register_hooks(apr_pool_t * p) | |
88 | { | |
89 | /* ap_hook_pre_config(x_pre_config, NULL, NULL, APR_HOOK_MIDDLE); */ | |
2254c02d | 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); | |
d505af0a | 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); | |
97 | +#ifdef APACHE22 | |
98 | + ap_register_provider(p, AUTHN_PROVIDER_GROUP, "fastcgi", "0", | |
99 | + &authn_fastcgi_provider); | |
2254c02d | 100 | +#else |
101 | + ap_hook_check_user_id(check_user_authentication, NULL, NULL, APR_HOOK_MIDDLE); | |
102 | +#endif | |
d505af0a | 103 | + |
104 | } | |
105 | ||
106 | module AP_MODULE_DECLARE_DATA fastcgi_module = |