Changeset 32f2e60 in mod_gnutls for src


Ignore:
Timestamp:
Dec 9, 2004, 2:52:31 AM (18 years ago)
Author:
Paul Querna <chip@…>
Branches:
asyncio, debian/master, debian/stretch-backports, jessie-backports, main, master, msva, proxy-ticket, upstream
Children:
76bd3bf
Parents:
0314deb
Message:

fixes and stuff that i should of already committed.

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_cache.c

    r0314deb r32f2e60  
    2222 *
    2323 */
     24/*
     25#include "memcache.h"
    2426
    25 #include "libmemcache/memcache.h"
     27int mod_gnutls_cache_init()
     28{
     29  return 0;
     30}
     31static int cache_store((void* baton, gnutls_datum_t key, gnutls_datum_t data)
     32{
     33    mc_set(struct memcache *mc,
     34           key->data, key->size,
     35           data->data, data->size,
     36           3600, 0);
     37  return 0;
     38}
     39
     40static int cache_fetch(void* baton, gnutls_datum_t key)
     41{
     42    mod_gnutls_handle_t *ctxt = baton;
     43  return 0;
     44}
     45
     46static int cache_delete(void* baton, gnutls_datum_t key)
     47{
     48    mod_gnutls_handle_t *ctxt = baton;
     49  return 0;
     50}
     51
     52int mod_gnutls_cache_session_init(mod_gnutls_handle_t *ctxt)
     53{
     54    gnutls_db_set_cache_expiration
     55    gnutls_db_set_retrieve_function(session, cache_fetch);
     56    gnutls_db_set_remove_function(session, cache_delete);
     57    gnutls_db_set_store_function(session, cache_store);
     58    gnutls_db_set_ptr(session, NULL);
     59  return 0;
     60}
     61*/
  • src/gnutls_io.c

    r0314deb r32f2e60  
    333333
    334334
    335 #define GNUTLS_HANDSHAKE_ATTEMPTS 10
    336 
    337335static void gnutls_do_handshake(mod_gnutls_handle_t * ctxt)
    338336{
    339     int i, ret;
     337    int ret;
    340338
    341339    if (ctxt->status != 0)
    342340        return;
    343 #if 0
    344 
    345     for (i = GNUTLS_HANDSHAKE_ATTEMPTS; i > 0; i--) {
    346         ret = gnutls_handshake(ctxt->session);
    347         if (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN) {
    348             continue;
    349         }
    350 
    351         if (ret < 0) {
    352             if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED
    353                 || ret == GNUTLS_E_FATAL_ALERT_RECEIVED) {
    354                 ret = gnutls_alert_get(ctxt->session);
    355                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
    356                              "GnuTLS: Hanshake Alert (%d) '%s'.\n", ret,
    357                              gnutls_alert_get_name(ret));
    358             }
    359 
    360             gnutls_deinit(ctxt->session);
    361             ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
    362                              "GnuTLS: Handshake Failed (%d) '%s'", ret,
    363                              gnutls_strerror(ret));
    364                 ctxt->status = -1;
    365                 return;
    366         }
    367         else {
    368             ctxt->status = 1;
    369             return;             /* all done with the handshake */
    370         }
    371     }
    372     ctxt->status = -1;
    373     return;
    374 #else
    375341        ret = gnutls_handshake(ctxt->session);
    376342        if (ret < 0) {
     
    394360            return;             /* all done with the handshake */
    395361        }
    396 
    397 #endif
    398362}
    399363
     
    466430                                      apr_bucket_brigade * bb)
    467431{
    468     int ret;
     432    apr_size_t ret;
    469433    mod_gnutls_handle_t *ctxt = (mod_gnutls_handle_t *) f->ctx;
    470434    apr_status_t status = APR_SUCCESS;
     
    514478        }
    515479        else {
    516 
    517480            /* filter output */
    518481            const char *data;
     
    547510                }
    548511            }
    549             else if ((apr_size_t) ret != len) {
    550                 //apr_bucket_split(bucket, ret);
    551                 //APR_BUCKET_REMOVE(bucket);
    552                 /* not all of the data was sent. */
    553                 /* mod_ssl basicly errors out here.. this doesn't seem right? */
    554                 ap_log_error(APLOG_MARK, APLOG_INFO, ctxt->output_rc,
    555                              ctxt->c->base_server,
    556                              "GnuTLS: failed to write %" APR_SSIZE_T_FMT
    557                              " of %" APR_SIZE_T_FMT " bytes.",
    558                              len - (apr_size_t) ret, len);
    559                 //continue;
    560                 if (ctxt->output_rc == APR_SUCCESS) {
    561                     ctxt->output_rc = APR_EGENERAL;
    562                 }
     512            else if (ret != len) {
     513                /* Not able to send the entire bucket,
     514                   split it and send it again. */
     515                apr_bucket_split(bucket, ret);
    563516            }
    564517
  • src/mod_gnutls.c

    r0314deb r32f2e60  
    4545
    4646#define DH_BITS 1024
     47#ifdef USE_RSA
    4748#define RSA_BITS 512
    48 
     49#endif
    4950static int mod_gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog,
    5051                                       apr_pool_t * ptemp,
     
    5455    server_rec *s;
    5556    gnutls_dh_params_t dh_params;
     57#ifdef USE_RSA
    5658    gnutls_rsa_params_t rsa_params;
    57 
     59#endif
    5860
    5961    /* TODO: Should we regenerate these after X requests / X time ? */
    6062    gnutls_dh_params_init(&dh_params);
    6163    gnutls_dh_params_generate2(dh_params, DH_BITS);
    62 //    gnutls_rsa_params_init(&rsa_params);
    63 //    gnutls_rsa_params_generate2(rsa_params, RSA_BITS);
    64 
     64#ifdef USE_RSA
     65    gnutls_rsa_params_init(&rsa_params);
     66    gnutls_rsa_params_generate2(rsa_params, RSA_BITS);
     67#endif
    6568    for (s = base_server; s; s = s->next) {
    6669        sc = (mod_gnutls_srvconf_rec *) ap_get_module_config(s->module_config,
     
    7073                                                 sc->key_file,
    7174                                                 GNUTLS_X509_FMT_PEM);
    72 //          gnutls_certificate_set_rsa_export_params(sc->certs, rsa_params);
     75#ifdef USE_RSA
     76          gnutls_certificate_set_rsa_export_params(sc->certs, rsa_params);
     77#endif
    7378          gnutls_certificate_set_dh_params(sc->certs, dh_params);
    7479        }
Note: See TracChangeset for help on using the changeset viewer.