- rel 8
[packages/apache-mod_auth_kerb.git] / mod_auth_kerb-delegation.patch
1
2 https://bugzilla.redhat.com/show_bug.cgi?id=688210
3
4 --- mod_auth_kerb-5.4/src/mod_auth_kerb.c.delegation
5 +++ mod_auth_kerb-5.4/src/mod_auth_kerb.c
6 @@ -209,6 +209,7 @@ typedef struct krb5_conn_data {
7         char *authline;
8         char *user;
9         char *mech;
10 +       char *ccname;
11         int  last_return;
12  } krb5_conn_data;
13  
14 @@ -875,7 +876,7 @@ create_krb5_ccache(krb5_context kcontext
15     int ret;
16     krb5_ccache tmp_ccache = NULL;
17  
18 -   ccname = apr_psprintf(r->pool, "FILE:%s/krb5cc_apache_XXXXXX", P_tmpdir);
19 +   ccname = apr_psprintf(r->connection->pool, "FILE:%s/krb5cc_apache_XXXXXX", P_tmpdir);
20     fd = mkstemp(ccname + strlen("FILE:"));
21     if (fd < 0) {
22        log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
23 @@ -905,7 +906,7 @@ create_krb5_ccache(krb5_context kcontext
24     }
25  
26     apr_table_setn(r->subprocess_env, "KRB5CCNAME", ccname);
27 -   apr_pool_cleanup_register(r->pool, ccname, krb5_cache_cleanup,
28 +   apr_pool_cleanup_register(r->connection->pool, ccname, krb5_cache_cleanup,
29                              apr_pool_cleanup_null);
30  
31     *ccache = tmp_ccache;
32 @@ -1866,10 +1868,15 @@ already_succeeded(request_rec *r, char *
33     if (apr_pool_userdata_get((void**)&conn_data, keyname, r->connection->pool) != 0)
34         return NULL;
35  
36 -   if(conn_data) {
37 -       if(strcmp(conn_data->authline, auth_line) == 0) {
38 -               log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "matched previous auth request");
39 -               return conn_data;
40 +   if(conn_data && conn_data->ccname != NULL) {
41 +       apr_finfo_t finfo;
42 +
43 +       if (apr_stat(&finfo, conn_data->ccname + strlen("FILE:"), 
44 +                    APR_FINFO_NORM, r->pool) == APR_SUCCESS
45 +           && (finfo.valid & APR_FINFO_TYPE)
46 +           && finfo.filetype == APR_REG) {
47 +           log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "matched previous auth request");
48 +           return conn_data;
49         }
50     }
51     return NULL;
52 @@ -2001,6 +2008,8 @@ kerb_authenticate_user(request_rec *r)
53         ret = prevauth->last_return;
54         MK_USER = prevauth->user;
55         MK_AUTH_TYPE = prevauth->mech;
56 +       if (prevauth->ccname)
57 +               apr_table_setn(r->subprocess_env, "KRB5CCNAME", prevauth->ccname);
58     }
59  
60     /*
61 @@ -2011,6 +2020,7 @@ kerb_authenticate_user(request_rec *r)
62         prevauth->user = apr_pstrdup(r->connection->pool, MK_USER);
63         prevauth->authline = apr_pstrdup(r->connection->pool, auth_line);
64         prevauth->mech = apr_pstrdup(r->connection->pool, auth_type);
65 +       prevauth->ccname = apr_pstrdup(r->connection->pool, apr_table_get(r->subprocess_env, "KRB5CCNAME"));
66         prevauth->last_return = ret;
67         snprintf(keyname, sizeof(keyname) - 1,
68             "mod_auth_kerb::connection::%s::%ld", 
This page took 0.062137 seconds and 3 git commands to generate.