1 --- mod_auth_kerb-5.0-rc6.orig/src/mod_auth_kerb.c 2004-08-10 14:01:01.000000000 +0200
2 +++ mod_auth_kerb-5.0-rc6/src/mod_auth_kerb.c 2005-02-18 13:54:13.560145408 +0100
4 #define MK_AUTH_TYPE r->ap_auth_type
7 -#define MK_TABLE_GET ap_table_get
8 +#define MK_TABLE_GET apr_table_get
9 #define MK_USER r->connection->user
10 #define MK_AUTH_TYPE r->connection->ap_auth_type
11 #define PROXYREQ_PROXY STD_PROXY
13 #ifdef STANDARD20_MODULE_STUFF
14 #define command(name, func, var, type, usage) \
15 AP_INIT_ ## type (name, func, \
16 - (void*)APR_XtOffsetOf(kerb_auth_config, var), \
17 + (void*)APR_OFFSETOF(kerb_auth_config, var), \
18 OR_AUTHCFG | RSRC_CONF, usage)
20 #define command(name, func, var, type, usage) \
23 kerb_auth_config *rec;
25 - rec = (kerb_auth_config *) ap_pcalloc(p, sizeof(kerb_auth_config));
26 + rec = (kerb_auth_config *) apr_pcalloc(p, sizeof(kerb_auth_config));
27 ((kerb_auth_config *)rec)->krb_verify_kdc = 1;
28 ((kerb_auth_config *)rec)->krb_service_name = "HTTP";
29 ((kerb_auth_config *)rec)->krb_authoritative = 1;
32 krb5_save_realms(cmd_parms *cmd, kerb_auth_config *sec, char *arg)
34 - sec->krb_auth_realms= ap_pstrdup(cmd->pool, arg);
35 + sec->krb_auth_realms= apr_pstrdup(cmd->pool, arg);
40 return HTTP_INTERNAL_SERVER_ERROR;
43 - tkt_file_p = ap_pstrdup(r->pool, tkt_file);
44 + tkt_file_p = apr_pstrdup(r->pool, tkt_file);
45 +#ifndef STANDARD20_MODULE_STUFF
46 ap_register_cleanup(r->pool, tkt_file_p,
47 krb4_cache_cleanup, ap_null_cleanup);
49 + apr_pool_cleanup_register(r->pool,tkt_file_p,krb4_cache_cleanup,apr_pool_cleanup_null);
52 krb_set_tkt_string(tkt_file);
58 - user = ap_pstrdup(r->pool, sent_name);
59 + user = apr_pstrdup(r->pool, sent_name);
61 - user = ap_pstrcat(r->pool, user, ".", sent_instance, NULL);
62 - user = ap_pstrcat(r->pool, user, "@", realm, NULL);
63 + user = apr_pstrcat(r->pool, user, ".", sent_instance, NULL);
64 + user = apr_pstrcat(r->pool, user, "@", realm, NULL);
67 MK_AUTH_TYPE = "Basic";
68 - ap_table_setn(r->subprocess_env, "KRBTKFILE", tkt_file_p);
69 + apr_table_setn(r->subprocess_env, "KRBTKFILE", tkt_file_p);
71 if (!conf->krb_save_credentials)
72 krb4_cache_cleanup(tkt_file);
75 krb5_ccache tmp_ccache = NULL;
77 - ccname = ap_psprintf(r->pool, "FILE:%s/krb5cc_apache_XXXXXX", P_tmpdir);
78 + ccname = apr_psprintf(r->pool, "FILE:%s/krb5cc_apache_XXXXXX", P_tmpdir);
79 fd = mkstemp(ccname + strlen("FILE:"));
81 log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
86 - ap_table_setn(r->subprocess_env, "KRB5CCNAME", ccname);
87 + apr_table_setn(r->subprocess_env, "KRB5CCNAME", ccname);
88 +#ifndef STANDARD20_MODULE_STUFF
89 ap_register_cleanup(r->pool, ccname,
90 krb5_cache_cleanup, ap_null_cleanup);
92 + apr_pool_cleanup_register(r->pool,ccname,krb5_cache_cleanup,apr_pool_cleanup_null);
98 ret = HTTP_UNAUTHORIZED;
101 - MK_USER = ap_pstrdup (r->pool, name);
102 + MK_USER = apr_pstrdup (r->pool, name);
103 MK_AUTH_TYPE = "Basic";
107 gss_buffer_desc status_string;
110 - err_msg = ap_pstrdup(p, prefix);
111 + err_msg = apr_pstrdup(p, prefix);
113 maj_stat = gss_display_status (&min_stat,
117 if (GSS_ERROR(maj_stat))
119 - err_msg = ap_pstrcat(p, err_msg, ": ", (char*) status_string.value, NULL);
120 + err_msg = apr_pstrcat(p, err_msg, ": ", (char*) status_string.value, NULL);
121 gss_release_buffer(&min_stat, &status_string);
123 maj_stat = gss_display_status (&min_stat,
127 if (!GSS_ERROR(maj_stat)) {
128 - err_msg = ap_pstrcat(p, err_msg,
129 + err_msg = apr_pstrcat(p, err_msg,
130 " (", (char*) status_string.value, ")", NULL);
131 gss_release_buffer(&min_stat, &status_string);
133 @@ -1135,15 +1143,15 @@
137 - input_token.length = ap_base64decode_len(auth_param) + 1;
138 - input_token.value = ap_pcalloc(r->connection->pool, input_token.length);
139 + input_token.length = apr_base64_decode_len(auth_param) + 1;
140 + input_token.value = apr_pcalloc(r->connection->pool, input_token.length);
141 if (input_token.value == NULL) {
142 log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
143 - "ap_pcalloc() failed (not enough memory)");
144 + "apr_pcalloc() failed (not enough memory)");
145 ret = HTTP_INTERNAL_SERVER_ERROR;
148 - input_token.length = ap_base64decode(input_token.value, auth_param);
149 + input_token.length = apr_base64_decode(input_token.value, auth_param);
151 accept_sec_token = (cmp_gss_type(&input_token, &spnego_oid) == 0) ?
152 gss_accept_sec_context_spnego : gss_accept_sec_context;
153 @@ -1171,16 +1179,16 @@
157 - len = ap_base64encode_len(output_token.length) + 1;
158 - token = ap_pcalloc(r->connection->pool, len + 1);
159 + len = apr_base64_encode_len(output_token.length) + 1;
160 + token = apr_pcalloc(r->connection->pool, len + 1);
162 log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
163 - "ap_pcalloc() failed (not enough memory)");
164 + "apr_pcalloc() failed (not enough memory)");
165 ret = HTTP_INTERNAL_SERVER_ERROR;
166 gss_release_buffer(&minor_status2, &output_token);
169 - ap_base64encode(token, output_token.value, output_token.length);
170 + apr_base64_encode(token, output_token.value, output_token.length);
172 *negotiate_ret_value = token;
173 log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
174 @@ -1224,7 +1232,7 @@
177 MK_AUTH_TYPE = "Negotiate";
178 - MK_USER = ap_pstrdup(r->pool, output_token.value);
179 + MK_USER = apr_pstrdup(r->pool, output_token.value);
181 if (conf->krb_save_credentials && delegated_cred != GSS_C_NO_CREDENTIAL)
182 store_gss_creds(r, conf, (char *)output_token.value, delegated_cred);
183 @@ -1285,12 +1293,12 @@
185 if (negotiate_ret_value != NULL && conf->krb_method_gssapi) {
186 negoauth_param = (*negotiate_ret_value == '\0') ? "Negotiate" :
187 - ap_pstrcat(r->pool, "Negotiate ", negotiate_ret_value, NULL);
188 - ap_table_add(r->err_headers_out, header_name, negoauth_param);
189 + apr_pstrcat(r->pool, "Negotiate ", negotiate_ret_value, NULL);
190 + apr_table_add(r->err_headers_out, header_name, negoauth_param);
192 if ((use_krb5pwd && conf->krb_method_k5pass) || conf->krb_delegate_basic) {
193 - ap_table_add(r->err_headers_out, header_name,
194 - ap_pstrcat(r->pool, "Basic realm=\"", auth_name, "\"", NULL));
195 + apr_table_add(r->err_headers_out, header_name,
196 + apr_pstrcat(r->pool, "Basic realm=\"", auth_name, "\"", NULL));
200 @@ -1298,8 +1306,8 @@
203 ((use_krb4 && conf->krb_method_k4pass) || conf->krb_delegate_basic))
204 - ap_table_add(r->err_headers_out, header_name,
205 - ap_pstrcat(r->pool, "Basic realm=\"", auth_name, "\"", NULL));
206 + apr_table_add(r->err_headers_out, header_name,
207 + apr_pstrcat(r->pool, "Basic realm=\"", auth_name, "\"", NULL));