@@ -1056,7 +1056,8 @@ int http_parser::auth_krb(http_context &ctx, const char *input, size_t isize,
10561056 OM_uint32 status{};
10571057 gss_name_t gss_srv_name{}, gss_username{};
10581058 gss_buffer_desc gss_input_buf{}, gss_user_buf{}, gss_output_token{};
1059- auto cl_0 = HX::make_scope_exit ([&]() {
1059+ auto cl_0 = HX::make_scope_exit ([&]() { ctx.clear_gss (); });
1060+ auto cl_1 = HX::make_scope_exit ([&]() {
10601061 if (gss_output_token.length != 0 )
10611062 gss_release_buffer (&status, &gss_output_token);
10621063 if (gss_user_buf.length != 0 )
@@ -1101,8 +1102,10 @@ int http_parser::auth_krb(http_context &ctx, const char *input, size_t isize,
11011102 else
11021103 output.clear ();
11031104
1104- if (ret == GSS_S_CONTINUE_NEEDED)
1105+ if (ret == GSS_S_CONTINUE_NEEDED) {
1106+ cl_0.release (); /* keep state for next round */
11051107 return -99 ; /* MOAR */
1108+ }
11061109 output.clear ();
11071110 if (ret != GSS_S_COMPLETE) {
11081111 krblog (" Unable to accept security context" , ret, status);
@@ -2309,16 +2312,25 @@ static void http_parser_context_clear(HTTP_CONTEXT *pcontext)
23092312 mod_fastcgi_insert_ctx (pcontext);
23102313}
23112314
2312- http_context::~http_context ()
2315+ void http_context::clear_gss ()
23132316{
2314- auto pcontext = this ;
23152317#ifdef HAVE_GSSAPI
23162318 OM_uint32 st;
2317- if (m_gss_srv_creds != nullptr )
2319+ if (m_gss_srv_creds != nullptr ) {
23182320 gss_release_cred (&st, &m_gss_srv_creds);
2319- if (m_gss_ctx != nullptr )
2321+ m_gss_srv_creds = GSS_C_NO_CREDENTIAL;
2322+ }
2323+ if (m_gss_ctx != nullptr ) {
23202324 gss_delete_sec_context (&st, &m_gss_ctx, GSS_C_NO_BUFFER);
2325+ m_gss_ctx = GSS_C_NO_CONTEXT;
2326+ }
23212327#endif
2328+ }
2329+
2330+ http_context::~http_context ()
2331+ {
2332+ auto pcontext = this ;
2333+ clear_gss ();
23222334 if (hpm_processor_is_in_charge (pcontext))
23232335 hpm_processor_insert_ctx (pcontext);
23242336 else if (mod_fastcgi_is_in_charge (pcontext))
0 commit comments