aboutsummaryrefslogtreecommitdiffstats
path: root/src/gnutls_io.c
diff options
context:
space:
mode:
authorGravatar Nokis Mavrogiannopoulos 2009-07-20 21:14:37 +0000
committerGravatar Nokis Mavrogiannopoulos 2009-07-20 21:14:37 +0000
commit5740f52c1e62d943eb50b4e1b9ae14f824c2dd39 (patch)
treef2f95e7330d0186fb6f3ccf01e501efd5f476905 /src/gnutls_io.c
parent9af174851071e17e1c4cd6b68284c41243471da4 (diff)
More fixes related to bug #102
Diffstat (limited to 'src/gnutls_io.c')
-rw-r--r--src/gnutls_io.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gnutls_io.c b/src/gnutls_io.c
index a8fd242..e145466 100644
--- a/src/gnutls_io.c
+++ b/src/gnutls_io.c
@@ -379,9 +379,11 @@ tryagain:
379 ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server, 379 ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
380 "GnuTLS: Handshake Failed. Hit Maximum Attempts"); 380 "GnuTLS: Handshake Failed. Hit Maximum Attempts");
381#endif 381#endif
382 gnutls_alert_send(ctxt->session, GNUTLS_AL_FATAL, 382 if (ctxt->session) {
383 gnutls_alert_send(ctxt->session, GNUTLS_AL_FATAL,
383 gnutls_error_to_alert(ret, NULL)); 384 gnutls_error_to_alert(ret, NULL));
384 if (ctxt->session) gnutls_deinit(ctxt->session); 385 gnutls_deinit(ctxt->session);
386 }
385 ctxt->session = NULL; 387 ctxt->session = NULL;
386 return -1; 388 return -1;
387 } 389 }
@@ -411,9 +413,11 @@ tryagain:
411 gnutls_strerror(ret)); 413 gnutls_strerror(ret));
412#endif 414#endif
413 ctxt->status = -1; 415 ctxt->status = -1;
414 gnutls_alert_send(ctxt->session, GNUTLS_AL_FATAL, 416 if (ctxt->session) {
417 gnutls_alert_send(ctxt->session, GNUTLS_AL_FATAL,
415 gnutls_error_to_alert(ret, NULL)); 418 gnutls_error_to_alert(ret, NULL));
416 if (ctxt->session) gnutls_deinit(ctxt->session); 419 gnutls_deinit(ctxt->session);
420 }
417 ctxt->session = NULL; 421 ctxt->session = NULL;
418 return ret; 422 return ret;
419 } 423 }
@@ -559,8 +563,10 @@ apr_status_t mgs_filter_output(ap_filter_t * f,
559 } 563 }
560 564
561 apr_brigade_cleanup(ctxt->output_bb); 565 apr_brigade_cleanup(ctxt->output_bb);
562 if (ctxt->session) gnutls_deinit(ctxt->session); 566 if (APR_BUCKET_IS_EOS(bucket) && ctxt->session) {
563 ctxt->session = NULL; 567 gnutls_deinit(ctxt->session);
568 ctxt->session = NULL;
569 }
564 continue; 570 continue;
565 571
566 } else if (APR_BUCKET_IS_FLUSH(bucket) || APR_BUCKET_IS_EOS(bucket)) { 572 } else if (APR_BUCKET_IS_FLUSH(bucket) || APR_BUCKET_IS_EOS(bucket)) {