Skip to content

Commit 1fc4999

Browse files
committed
Do not free orig_ccache
It realy is const memory referenced internally by MIT's gssapi. Freeing it will cause a segfault on the next invocation. This memory is kept in thread local storage and freed by gssapi itself as needed. Fixes #11
1 parent 3effbe2 commit 1fc4999

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/mod_auth_gssapi.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int mag_auth(request_rec *req)
185185
gss_name_t server = GSS_C_NO_NAME;
186186
#ifdef HAVE_GSS_KRB5_CCACHE_NAME
187187
const char *user_ccache = NULL;
188-
char *orig_ccache = NULL;
188+
const char *orig_ccache = NULL;
189189
#endif
190190

191191
type = ap_auth_type(req);
@@ -301,8 +301,7 @@ static int mag_auth(request_rec *req)
301301
goto done;
302302
}
303303
user_ccache = apr_psprintf(req->pool, "MEMORY:user_%qu", rndname);
304-
maj = gss_krb5_ccache_name(&min, user_ccache,
305-
(const char **)&orig_ccache);
304+
maj = gss_krb5_ccache_name(&min, user_ccache, &orig_ccache);
306305
if (GSS_ERROR(maj)) {
307306
ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, req,
308307
"In Basic Auth, %s",
@@ -516,8 +515,6 @@ static int mag_auth(request_rec *req)
516515
"failed", maj, min));
517516
}
518517
}
519-
free(orig_ccache);
520-
orig_ccache = NULL;
521518
#endif
522519
gss_delete_sec_context(&min, &user_ctx, &output);
523520
gss_release_cred(&min, &user_cred);

0 commit comments

Comments
 (0)