Changeset 6e0bfd6 in mod_gnutls


Ignore:
Timestamp:
Apr 4, 2005, 4:28:38 AM (15 years ago)
Author:
Paul Querna <chip@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, msva, upstream
Children:
fcb122d
Parents:
7bd1f6a
Message:
  • make memcahe optional
  • update for 2.1.x branch changes.
  • some mucking around with the conf stuff
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • autogen.sh

    r7bd1f6a r6e0bfd6  
    44libtoolize --force --copy
    55#libtoolize14  --force --copy
    6 aclocal -I m4
     6aclocal-1.9 -I m4
    77autoheader
    8 automake --add-missing --copy --foreign
     8automake-1.9 --add-missing --copy --foreign
    99autoconf
    1010rm -rf autom4te.cache
  • configure.ac

    r7bd1f6a r6e0bfd6  
    1 AC_INIT
     1
     2AC_INIT(mod_gnutls, 0.1.0)
    23OOO_CONFIG_NICE(config.nice)
     4AC_PREREQ(2.53)
    35AC_CONFIG_SRCDIR([src/mod_gnutls.c])
     6AC_CONFIG_AUX_DIR(config)
    47AM_MAINTAINER_MODE
    58AC_CANONICAL_TARGET
    6 AM_INIT_AUTOMAKE(mod_gnutls, 0.1.0)
    7 AM_CONFIG_HEADER([include/mod_gnutls_config.h:config.in])
     9AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
     10AM_CONFIG_HEADER(include/mod_gnutls_config.h:config.in)
    811
    912
     
    1114AC_PROG_LD
    1215AC_PROG_INSTALL
    13 AM_PROG_LIBTOOL
    1416
    1517
     
    2022)
    2123
    22 MIN_TLS_VERSION=1.1.0
     24LIBTOOL="`${APR_CONFIG} --apr-libtool`"
     25AC_SUBST(LIBTOOL)
     26
     27MIN_TLS_VERSION=1.2.0
    2328CHECK_LIBGNUTLS($MIN_TLS_VERSION)
    2429
    25 CHECK_APR_MEMCACHE()
     30have_apr_memcache=0
     31CHECK_APR_MEMCACHE([have_apr_memcache=1], [have_apr_memcache=0])
     32AC_SUBST(have_apr_memcache)
    2633
    2734MODULE_CFLAGS="${LIBGNUTLS_CFLAGS} ${APR_MEMCACHE_CFLAGS} ${APXS_CFLAGS} ${AP_INCLUDES} ${APR_INCLUDES} ${APU_INCLUDES}"
     
    3138AC_SUBST(MODULE_LIBS)
    3239
    33 AC_CONFIG_FILES([Makefile src/Makefile])
     40AC_CONFIG_FILES([Makefile src/Makefile include/mod_gnutls.h])
    3441AC_OUTPUT
    3542
  • include/mod_gnutls.h.in

    r7bd1f6a r6e0bfd6  
    3030#define __mod_gnutls_h_inc
    3131
    32 #if HAVE_APR_MEMCACHE
    33 #include "apr_memcache.h"
    34 #endif
     32#define HAVE_APR_MEMCACHE    @have_apr_memcache@
    3533
    3634#include <gcrypt.h>
  • src/Makefile.am

    r7bd1f6a r6e0bfd6  
    1010        @if test ! -L mod_gnutls.so ; then ln -s .libs/libmod_gnutls.so mod_gnutls.so ; fi
    1111
    12 clean:
     12clean: 
    1313        rm -f mod_gnutls.so
    1414        rm -f *.o *.lo *.la
     
    1616
    1717install: make_so
    18         @${APXS_BIN} -i -n svn_view mod_gnutls.so
     18        @${APXS_BIN} -i -n gnutls mod_gnutls.so
    1919        @echo ""
    2020        @echo ""
     
    2828        @echo ""
    2929
    30 activate: make_so
    31         @${APXS_BIN} -i -a -n svn_view mod_gnutls.so
    32         @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  
    1717
    1818#include "mod_gnutls.h"
     19
     20#if HAVE_APR_MEMCACHE
     21#include "apr_memcache.h"
     22#endif
     23
    1924#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
     33static 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
    2050
    2151/**
     
    2757static apr_memcache_t* mc;
    2858
    29 int mod_gnutls_cache_child_init(apr_pool_t *p, server_rec *s,
     59int mc_cache_child_init(apr_pool_t *p, server_rec *s,
    3060                                mod_gnutls_srvconf_rec *sc)
    3161{
     
    110140}
    111141
    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)
     142static int mc_cache_store(void* baton, gnutls_datum_t key,
     143                          gnutls_datum_t data)
    138144{
    139145    apr_status_t rv = APR_SUCCESS;
     
    162168}
    163169
    164 static gnutls_datum_t cache_fetch(void* baton, gnutls_datum_t key)
     170static gnutls_datum_t mc_cache_fetch(void* baton, gnutls_datum_t key)
    165171{
    166172    apr_status_t rv = APR_SUCCESS;
     
    191197    }
    192198
    193     /* TODO: Eliminate this memcpy. ffs. gnutls-- */
     199    /* TODO: Eliminate this memcpy. gnutls-- */
    194200    data.data = gnutls_malloc(value_len);
    195201    if (data.data == NULL)
     
    202208}
    203209
    204 static int cache_delete(void* baton, gnutls_datum_t key)
     210static int mc_cache_delete(void* baton, gnutls_datum_t key)
    205211{
    206212    apr_status_t rv = APR_SUCCESS;
     
    226232}
    227233
     234#endif /* have_apr_memcache */
     235
     236int 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
    228246int mod_gnutls_cache_session_init(mod_gnutls_handle_t *ctxt)
    229247{
    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);
    233252    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  
    125125}
    126126
    127 static const char *mod_gnutls_hook_http_method(const request_rec * r)
     127static const char *mod_gnutls_hook_http_scheme(const request_rec * r)
    128128{
    129129    mod_gnutls_srvconf_rec *sc =
     
    341341    ap_hook_child_init(mod_gnutls_hook_child_init, NULL, NULL,
    342342                        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,
    344344                        APR_HOOK_MIDDLE);
    345345    ap_hook_default_port(mod_gnutls_hook_default_port, NULL, NULL,
Note: See TracChangeset for help on using the changeset viewer.