Changeset e8acf05 in mod_gnutls
- Timestamp:
- Jan 20, 2015, 10:45:39 AM (8 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, jessie-backports, main, master, proxy-ticket, upstream
- Children:
- c782c1f
- Parents:
- e4b58b6
- git-author:
- Thomas Klute <thomas2.klute@…> (01/20/15 10:30:36)
- git-committer:
- Thomas Klute <thomas2.klute@…> (01/20/15 10:45:39)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
include/mod_gnutls.h.in
re4b58b6 re8acf05 171 171 /* Connection record */ 172 172 conn_rec* c; 173 /* Is TLS enabled for this connection? */ 174 int enabled; 173 175 /* GnuTLS Session handle */ 174 176 gnutls_session_t session; -
src/gnutls_hooks.c
re4b58b6 re8acf05 682 682 } 683 683 684 static void create_gnutls_handle(conn_rec * c) { 685 mgs_handle_t *ctxt; 686 /* Get mod_gnutls Configuration Record */ 687 mgs_srvconf_rec *sc =(mgs_srvconf_rec *) 688 ap_get_module_config(c->base_server->module_config,&gnutls_module); 689 690 _gnutls_log(debug_log_fp, "%s: %d\n", __func__, __LINE__); 691 ctxt = apr_pcalloc(c->pool, sizeof (*ctxt)); 684 static void create_gnutls_handle(conn_rec * c) 685 { 686 /* Get mod_gnutls server configuration */ 687 mgs_srvconf_rec *sc = (mgs_srvconf_rec *) 688 ap_get_module_config(c->base_server->module_config, &gnutls_module); 689 690 _gnutls_log(debug_log_fp, "%s: %d\n", __func__, __LINE__); 691 692 /* Get connection specific configuration */ 693 mgs_handle_t *ctxt = (mgs_handle_t *) ap_get_module_config(c->conn_config, &gnutls_module); 694 if (ctxt == NULL) 695 { 696 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, "%s: allocating connection memory", __func__); 697 ctxt = apr_pcalloc(c->pool, sizeof (*ctxt)); 698 ap_set_module_config(c->conn_config, &gnutls_module, ctxt); 699 } 700 ctxt->enabled = GNUTLS_ENABLED_TRUE; 692 701 ctxt->c = c; 693 702 ctxt->sc = sc; … … 700 709 ctxt->output_blen = 0; 701 710 ctxt->output_length = 0; 711 702 712 /* Initialize GnuTLS Library */ 703 713 int err = gnutls_init(&ctxt->session, GNUTLS_SERVER); … … 721 731 mgs_cache_session_init(ctxt); 722 732 723 /* Set this config for this connection */724 ap_set_module_config(c->conn_config, &gnutls_module, ctxt);725 733 /* Set pull, push & ptr functions */ 726 734 gnutls_transport_set_pull_function(ctxt->session, … … 736 744 } 737 745 738 int mgs_hook_pre_connection(conn_rec * c, void *csd __attribute__((unused))) { 739 mgs_srvconf_rec *sc; 740 741 _gnutls_log(debug_log_fp, "%s: %d\n", __func__, __LINE__); 742 743 sc = (mgs_srvconf_rec *) ap_get_module_config(c->base_server->module_config, 744 &gnutls_module); 745 746 if (sc && (!sc->enabled || sc->proxy_enabled == GNUTLS_ENABLED_TRUE)) { 746 int mgs_hook_pre_connection(conn_rec * c, void *csd __attribute__((unused))) 747 { 748 _gnutls_log(debug_log_fp, "%s: %d\n", __func__, __LINE__); 749 750 mgs_srvconf_rec *sc = (mgs_srvconf_rec *) 751 ap_get_module_config(c->base_server->module_config, &gnutls_module); 752 mgs_handle_t *ctxt = (mgs_handle_t *) 753 ap_get_module_config(c->conn_config, &gnutls_module); 754 755 if ((sc && (!sc->enabled || sc->proxy_enabled == GNUTLS_ENABLED_TRUE)) 756 || (ctxt && ctxt->enabled == GNUTLS_ENABLED_FALSE)) 757 { 758 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, "%s declined connection", 759 __func__); 747 760 return DECLINED; 748 761 } … … 766 779 apr_table_t *env = r->subprocess_env; 767 780 768 ctxt = 769 ap_get_module_config(r->connection->conn_config, 770 &gnutls_module); 771 772 if (!ctxt || ctxt->session == NULL) { 781 ctxt = ap_get_module_config(r->connection->conn_config, 782 &gnutls_module); 783 784 if (!ctxt || ctxt->enabled != GNUTLS_ENABLED_TRUE || ctxt->session == NULL) 785 { 786 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "request declined in %s", __func__); 773 787 return DECLINED; 774 788 } -
src/mod_gnutls.c
re4b58b6 re8acf05 20 20 #include "mod_gnutls.h" 21 21 22 static void gnutls_hooks(apr_pool_t * p __attribute__((unused))) { 23 22 #ifdef APLOG_USE_MODULE 23 APLOG_USE_MODULE(gnutls); 24 #endif 25 26 static void gnutls_hooks(apr_pool_t * p __attribute__((unused))) 27 { 24 28 /* Try Run Post-Config Hook After mod_proxy */ 25 29 static const char * const aszPre[] = { "mod_proxy.c", NULL }; … … 75 79 } 76 80 77 int ssl_engine_disable(conn_rec *c) { 81 int ssl_engine_disable(conn_rec *c) 82 { 78 83 mgs_srvconf_rec *sc = (mgs_srvconf_rec *) 79 84 ap_get_module_config(c->base_server->module_config, &gnutls_module); 80 85 if(sc->enabled == GNUTLS_ENABLED_FALSE) { 81 86 return 1; 82 87 } 88 89 /* disable TLS for this connection */ 90 mgs_handle_t *ctxt = (mgs_handle_t *) ap_get_module_config(c->conn_config, &gnutls_module); 91 if (ctxt == NULL) 92 { 93 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, "%s: allocating connection memory", __func__); 94 ctxt = apr_pcalloc(c->pool, sizeof (*ctxt)); 95 ap_set_module_config(c->conn_config, &gnutls_module, ctxt); 96 } 97 ctxt->enabled = GNUTLS_ENABLED_FALSE; 98 83 99 if (c->input_filters) 84 100 ap_remove_input_filter(c->input_filters); … … 86 102 ap_remove_output_filter(c->output_filters); 87 103 mgs_cleanup_pre_config(c->pool); 88 sc->enabled = GNUTLS_ENABLED_FALSE;89 104 return 1; 90 105 }
Note: See TracChangeset
for help on using the changeset viewer.