- Timestamp:
- Apr 4, 2005, 4:28:38 AM (18 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, jessie-backports, main, master, msva, proxy-ticket, upstream
- Children:
- fcb122d
- Parents:
- 7bd1f6a
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
r7bd1f6a r6e0bfd6 10 10 @if test ! -L mod_gnutls.so ; then ln -s .libs/libmod_gnutls.so mod_gnutls.so ; fi 11 11 12 clean: 12 clean: 13 13 rm -f mod_gnutls.so 14 14 rm -f *.o *.lo *.la … … 16 16 17 17 install: make_so 18 @${APXS_BIN} -i -n svn_viewmod_gnutls.so18 @${APXS_BIN} -i -n gnutls mod_gnutls.so 19 19 @echo "" 20 20 @echo "" … … 28 28 @echo "" 29 29 30 activate: make_so31 @${APXS_BIN} -i -a -n svn_view mod_gnutls.so32 @echo ""33 @echo ""34 @echo "***********************************************"35 @echo ""36 @echo " Please read the documentation at "37 @echo " http://www.outoforder.cc/ for "38 @echo " details on configuration of this module "39 @echo ""40 @echo "***********************************************"41 @echo "" -
src/gnutls_cache.c
r7bd1f6a r6e0bfd6 17 17 18 18 #include "mod_gnutls.h" 19 20 #if HAVE_APR_MEMCACHE 21 #include "apr_memcache.h" 22 #endif 23 19 24 #include "ap_mpm.h" 25 26 #define GNUTLS_SESSION_ID_STRING_LEN \ 27 ((GNUTLS_MAX_SESSION_ID + 1) * 2) 28 #define MC_TAG "mod_gnutls:" 29 #define MC_TAG_LEN \ 30 (sizeof(MC_TAG)) 31 #define STR_SESSION_LEN (GNUTLS_SESSION_ID_STRING_LEN + MC_TAG_LEN) 32 33 static char *gnutls_session_id2sz(unsigned char *id, int idlen, 34 char *str, int strsize) 35 { 36 char *cp; 37 int n; 38 39 cp = apr_cpystrn(str, MC_TAG, MC_TAG_LEN); 40 for (n = 0; n < idlen && n < GNUTLS_MAX_SESSION_ID; n++) { 41 apr_snprintf(cp, strsize - (cp-str), "%02X", id[n]); 42 cp += 2; 43 } 44 *cp = '\0'; 45 return str; 46 } 47 48 49 #if HAVE_APR_MEMCACHE 20 50 21 51 /** … … 27 57 static apr_memcache_t* mc; 28 58 29 int m od_gnutls_cache_child_init(apr_pool_t *p, server_rec *s,59 int mc_cache_child_init(apr_pool_t *p, server_rec *s, 30 60 mod_gnutls_srvconf_rec *sc) 31 61 { … … 110 140 } 111 141 112 /* thanks mod_ssl */ 113 #define GNUTLS_SESSION_ID_STRING_LEN \ 114 ((GNUTLS_MAX_SESSION_ID + 1) * 2) 115 #define MC_TAG "mod_gnutls:" 116 #define MC_TAG_LEN \ 117 (sizeof(MC_TAG)) 118 #define STR_SESSION_LEN (GNUTLS_SESSION_ID_STRING_LEN + MC_TAG_LEN) 119 120 121 static char *gnutls_session_id2sz(unsigned char *id, int idlen, 122 char *str, int strsize) 123 { 124 char *cp; 125 int n; 126 127 cp = apr_cpystrn(str, MC_TAG, MC_TAG_LEN); 128 for (n = 0; n < idlen && n < GNUTLS_MAX_SESSION_ID; n++) { 129 apr_snprintf(cp, strsize - (cp-str), "%02X", id[n]); 130 cp += 2; 131 } 132 *cp = '\0'; 133 return str; 134 } 135 136 137 static int cache_store(void* baton, gnutls_datum_t key, gnutls_datum_t data) 142 static int mc_cache_store(void* baton, gnutls_datum_t key, 143 gnutls_datum_t data) 138 144 { 139 145 apr_status_t rv = APR_SUCCESS; … … 162 168 } 163 169 164 static gnutls_datum_t cache_fetch(void* baton, gnutls_datum_t key)170 static gnutls_datum_t mc_cache_fetch(void* baton, gnutls_datum_t key) 165 171 { 166 172 apr_status_t rv = APR_SUCCESS; … … 191 197 } 192 198 193 /* TODO: Eliminate this memcpy. ffs.gnutls-- */199 /* TODO: Eliminate this memcpy. gnutls-- */ 194 200 data.data = gnutls_malloc(value_len); 195 201 if (data.data == NULL) … … 202 208 } 203 209 204 static int cache_delete(void* baton, gnutls_datum_t key)210 static int mc_cache_delete(void* baton, gnutls_datum_t key) 205 211 { 206 212 apr_status_t rv = APR_SUCCESS; … … 226 232 } 227 233 234 #endif /* have_apr_memcache */ 235 236 int mod_gnutls_cache_child_init(apr_pool_t *p, server_rec *s, 237 mod_gnutls_srvconf_rec *sc) 238 { 239 #if HAVE_APR_MEMCACHE 240 return mc_cache_child_init(p, s, sc); 241 #else 242 return 0; 243 #endif 244 } 245 228 246 int mod_gnutls_cache_session_init(mod_gnutls_handle_t *ctxt) 229 247 { 230 gnutls_db_set_retrieve_function(ctxt->session, cache_fetch); 231 gnutls_db_set_remove_function(ctxt->session, cache_delete); 232 gnutls_db_set_store_function(ctxt->session, cache_store); 248 #if HAVE_APR_MEMCACHE 249 gnutls_db_set_retrieve_function(ctxt->session, mc_cache_fetch); 250 gnutls_db_set_remove_function(ctxt->session, mc_cache_delete); 251 gnutls_db_set_store_function(ctxt->session, mc_cache_store); 233 252 gnutls_db_set_ptr(ctxt->session, ctxt); 234 return 0; 235 } 253 #else 254 /* TODO: Alternative Cache Backends */ 255 #endif 256 return 0; 257 } -
src/mod_gnutls.c
r7bd1f6a r6e0bfd6 125 125 } 126 126 127 static const char *mod_gnutls_hook_http_ method(const request_rec * r)127 static const char *mod_gnutls_hook_http_scheme(const request_rec * r) 128 128 { 129 129 mod_gnutls_srvconf_rec *sc = … … 341 341 ap_hook_child_init(mod_gnutls_hook_child_init, NULL, NULL, 342 342 APR_HOOK_MIDDLE); 343 ap_hook_http_ method(mod_gnutls_hook_http_method, NULL, NULL,343 ap_hook_http_scheme(mod_gnutls_hook_http_scheme, NULL, NULL, 344 344 APR_HOOK_MIDDLE); 345 345 ap_hook_default_port(mod_gnutls_hook_default_port, NULL, NULL,
Note: See TracChangeset
for help on using the changeset viewer.