Changeset 0fcba60 in mod_gnutls


Ignore:
Timestamp:
Dec 17, 2018, 1:05:51 PM (5 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
debian/master, master
Children:
68b5156
Parents:
f674424
git-author:
Fiona Klute <fiona.klute@…> (12/17/18 13:02:43)
git-committer:
Fiona Klute <fiona.klute@…> (12/17/18 13:05:51)
Message:

Move compiled default priorities to gnutls_util.[hc]

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_hooks.c

    rf674424 r0fcba60  
    5858
    5959
    60 /** Default GnuTLS priority string for mod_gnutls */
    61 #define MGS_DEFAULT_PRIORITY "NORMAL"
    62 /** Compiled version of MGS_DEFAULT_PRIORITY (initialized in the
    63  * pre_config hook) */
    64 static gnutls_priority_t default_prio;
    65 
    6660
    6761static int mgs_cert_verify(request_rec * r, mgs_handle_t * ctxt);
     
    8882
    8983    /* Deinit default priority setting */
    90     gnutls_priority_deinit(default_prio);
     84    mgs_default_priority_deinit();
    9185    return APR_SUCCESS;
    9286}
     
    143137
    144138    /* Initialize default priority setting */
    145     ret = gnutls_priority_init(&default_prio, MGS_DEFAULT_PRIORITY, NULL);
     139    ret = mgs_default_priority_init();
    146140    if (ret < 0)
    147141    {
     
    731725                         s->server_hostname, s->addrs->host_port,
    732726                         MGS_DEFAULT_PRIORITY);
    733             sc->priorities = default_prio;
     727            sc->priorities = mgs_get_default_prio();
    734728        }
    735729
     
    11811175
    11821176    /* Set Default Priority */
    1183         err = gnutls_priority_set(ctxt->session, default_prio);
     1177        err = gnutls_priority_set(ctxt->session, mgs_get_default_prio());
    11841178    if (err != GNUTLS_E_SUCCESS)
    11851179        ap_log_cerror(APLOG_MARK, APLOG_ERR, err, c,
     
    22322226                     s->server_hostname, s->addrs->host_port,
    22332227                     MGS_DEFAULT_PRIORITY);
    2234         sc->proxy_priorities = default_prio;
     2228        sc->proxy_priorities = mgs_get_default_prio();
    22352229    }
    22362230    else
  • src/gnutls_util.c

    rf674424 r0fcba60  
    1919#include <apr_strings.h>
    2020#include <gnutls/gnutls.h>
     21
     22
     23
     24/** Compiled version of MGS_DEFAULT_PRIORITY, must be initialized
     25 * using mgs_default_priority_init() in the pre_config hook and
     26 * deinitialized in the matching pool cleanup hook. */
     27static gnutls_priority_t default_prio;
     28
    2129
    2230
     
    153161    return ctxt;
    154162}
     163
     164
     165
     166int mgs_default_priority_init()
     167{
     168    return gnutls_priority_init(&default_prio, MGS_DEFAULT_PRIORITY, NULL);
     169}
     170
     171
     172
     173gnutls_priority_t mgs_get_default_prio()
     174{
     175    return default_prio;
     176}
     177
     178
     179
     180void mgs_default_priority_deinit()
     181{
     182    gnutls_priority_deinit(default_prio);
     183}
  • src/gnutls_util.h

    rf674424 r0fcba60  
    2525#ifndef __MOD_GNUTLS_UTIL_H__
    2626#define __MOD_GNUTLS_UTIL_H__
     27
     28/** Default GnuTLS priority string for mod_gnutls */
     29#define MGS_DEFAULT_PRIORITY "NORMAL"
    2730
    2831/** maximum allowed length of one header line */
     
    7477mgs_handle_t *init_gnutls_ctxt(conn_rec *c);
    7578
     79/**
     80 * Initialize the global default priorities, must be called by the
     81 * pre_config hook
     82 *
     83 * @return `GNUTLS_E_SUCCESS` or a GnuTLS error code
     84 */
     85int mgs_default_priority_init();
     86
     87/**
     88 * Get the global default priorities
     89 */
     90gnutls_priority_t mgs_get_default_prio();
     91
     92/**
     93 * Deinitialize the global default priorities, must be in the cleanup
     94 * hook of the pre_config pool.
     95 */
     96void mgs_default_priority_deinit();
     97
    7698#endif /* __MOD_GNUTLS_UTIL_H__ */
Note: See TracChangeset for help on using the changeset viewer.