|
|
b5a845 |
|
|
|
b5a845 |
https://bugzilla.redhat.com/show_bug.cgi?id=688210
|
|
|
b5a845 |
|
|
|
b5a845 |
--- mod_auth_kerb-5.4/src/mod_auth_kerb.c.delegation
|
|
|
b5a845 |
+++ mod_auth_kerb-5.4/src/mod_auth_kerb.c
|
|
|
b5a845 |
@@ -209,6 +209,7 @@ typedef struct krb5_conn_data {
|
|
|
b5a845 |
char *authline;
|
|
|
b5a845 |
char *user;
|
|
|
b5a845 |
char *mech;
|
|
|
b5a845 |
+ char *ccname;
|
|
|
b5a845 |
int last_return;
|
|
|
b5a845 |
} krb5_conn_data;
|
|
|
b5a845 |
|
|
|
b5a845 |
@@ -875,7 +876,7 @@ create_krb5_ccache(krb5_context kcontext
|
|
|
b5a845 |
int ret;
|
|
|
b5a845 |
krb5_ccache tmp_ccache = NULL;
|
|
|
b5a845 |
|
|
|
b5a845 |
- ccname = apr_psprintf(r->pool, "FILE:%s/krb5cc_apache_XXXXXX", P_tmpdir);
|
|
|
b5a845 |
+ ccname = apr_psprintf(r->connection->pool, "FILE:%s/krb5cc_apache_XXXXXX", P_tmpdir);
|
|
|
b5a845 |
fd = mkstemp(ccname + strlen("FILE:"));
|
|
|
b5a845 |
if (fd < 0) {
|
|
|
b5a845 |
log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
|
|
b5a845 |
@@ -905,7 +906,7 @@ create_krb5_ccache(krb5_context kcontext
|
|
|
b5a845 |
}
|
|
|
b5a845 |
|
|
|
b5a845 |
apr_table_setn(r->subprocess_env, "KRB5CCNAME", ccname);
|
|
|
b5a845 |
- apr_pool_cleanup_register(r->pool, ccname, krb5_cache_cleanup,
|
|
|
b5a845 |
+ apr_pool_cleanup_register(r->connection->pool, ccname, krb5_cache_cleanup,
|
|
|
b5a845 |
apr_pool_cleanup_null);
|
|
|
b5a845 |
|
|
|
b5a845 |
*ccache = tmp_ccache;
|
|
|
b5a845 |
@@ -1866,10 +1868,15 @@ already_succeeded(request_rec *r, char *
|
|
|
b5a845 |
if (apr_pool_userdata_get((void**)&conn_data, keyname, r->connection->pool) != 0)
|
|
|
b5a845 |
return NULL;
|
|
|
b5a845 |
|
|
|
b5a845 |
- if(conn_data) {
|
|
|
b5a845 |
- if(strcmp(conn_data->authline, auth_line) == 0) {
|
|
|
b5a845 |
- log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "matched previous auth request");
|
|
|
b5a845 |
- return conn_data;
|
|
|
b5a845 |
+ if(conn_data && conn_data->ccname != NULL) {
|
|
|
b5a845 |
+ apr_finfo_t finfo;
|
|
|
b5a845 |
+
|
|
|
b5a845 |
+ if (apr_stat(&finfo, conn_data->ccname + strlen("FILE:"),
|
|
|
b5a845 |
+ APR_FINFO_NORM, r->pool) == APR_SUCCESS
|
|
|
b5a845 |
+ && (finfo.valid & APR_FINFO_TYPE)
|
|
|
b5a845 |
+ && finfo.filetype == APR_REG) {
|
|
|
b5a845 |
+ log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "matched previous auth request");
|
|
|
b5a845 |
+ return conn_data;
|
|
|
b5a845 |
}
|
|
|
b5a845 |
}
|
|
|
b5a845 |
return NULL;
|
|
|
b5a845 |
@@ -2001,6 +2008,8 @@ kerb_authenticate_user(request_rec *r)
|
|
|
b5a845 |
ret = prevauth->last_return;
|
|
|
b5a845 |
MK_USER = prevauth->user;
|
|
|
b5a845 |
MK_AUTH_TYPE = prevauth->mech;
|
|
|
b5a845 |
+ if (prevauth->ccname)
|
|
|
b5a845 |
+ apr_table_setn(r->subprocess_env, "KRB5CCNAME", prevauth->ccname);
|
|
|
b5a845 |
}
|
|
|
b5a845 |
|
|
|
b5a845 |
/*
|
|
|
b5a845 |
@@ -2011,6 +2020,7 @@ kerb_authenticate_user(request_rec *r)
|
|
|
b5a845 |
prevauth->user = apr_pstrdup(r->connection->pool, MK_USER);
|
|
|
b5a845 |
prevauth->authline = apr_pstrdup(r->connection->pool, auth_line);
|
|
|
b5a845 |
prevauth->mech = apr_pstrdup(r->connection->pool, auth_type);
|
|
|
b5a845 |
+ prevauth->ccname = apr_pstrdup(r->connection->pool, apr_table_get(r->subprocess_env, "KRB5CCNAME"));
|
|
|
b5a845 |
prevauth->last_return = ret;
|
|
|
b5a845 |
snprintf(keyname, sizeof(keyname) - 1,
|
|
|
b5a845 |
"mod_auth_kerb::connection::%s::%ld",
|