Changeset fd82e59 in mod_gnutls for src/gnutls_hooks.c


Ignore:
Timestamp:
Feb 27, 2014, 2:26:26 AM (6 years ago)
Author:
Daniel Kahn Gillmor <dkg@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
c32240f
Parents:
8a30d35
Message:

use strict compiler arguments by default (-Wall -Werror -Wextra)

Because apache modules make heavy use of generic hooks that have to
have arguments that cover every corner use case, and we don't need all
that data, many mod_gnutls functions have unused parameters, which
have now been explicitly designated as unused.

We also have at least one generic function signature declared for our
interaction with GnuTLS as well, and we aren't using some of those
parameters either.

A useful future review might be to read up on how the unused
parameters are used by other apache modules or users of GnuTLS, to see
if we might gather useful ideas.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_hooks.c

    r8a30d35 rfd82e59  
    4444static int mgs_cert_verify(request_rec * r, mgs_handle_t * ctxt);
    4545/* use side==0 for server and side==1 for client */
    46 static void mgs_add_common_cert_vars(request_rec * r, gnutls_x509_crt_t cert, int side, int export_cert_size);
    47 static void mgs_add_common_pgpcert_vars(request_rec * r, gnutls_openpgp_crt_t cert, int side, int export_cert_size);
     46static void mgs_add_common_cert_vars(request_rec * r, gnutls_x509_crt_t cert, int side, size_t export_cert_size);
     47static void mgs_add_common_pgpcert_vars(request_rec * r, gnutls_openpgp_crt_t cert, int side, size_t export_cert_size);
     48static int mgs_status_hook(request_rec *r, int flags);
     49#ifdef ENABLE_MSVA
    4850static const char* mgs_x509_construct_uid(request_rec * pool, gnutls_x509_crt_t cert);
    49 static int mgs_status_hook(request_rec *r, int flags);
     51#endif
    5052
    5153/* Pool Cleanup Function */
    52 apr_status_t mgs_cleanup_pre_config(void *data) {
     54apr_status_t mgs_cleanup_pre_config(void *data __attribute__((unused))) {
    5355        /* Free all session data */
    5456    gnutls_free(session_ticket_key.data);
     
    8385
    8486/* Pre-Configuration HOOK: Runs First */
    85 int mgs_hook_pre_config(apr_pool_t * pconf, apr_pool_t * plog, apr_pool_t * ptemp) {
     87int mgs_hook_pre_config(apr_pool_t * pconf, apr_pool_t * plog, apr_pool_t * ptemp __attribute__((unused))) {
    8688
    8789/* Maintainer Logging */
     
    169171
    170172static int cert_retrieve_fn(gnutls_session_t session,
    171                                                         const gnutls_datum_t * req_ca_rdn, int nreqs,
    172                                                         const gnutls_pk_algorithm_t * pk_algos, int pk_algos_length,
     173                                                        const gnutls_datum_t * req_ca_rdn __attribute__((unused)), int nreqs __attribute__((unused)),
     174                                                        const gnutls_pk_algorithm_t * pk_algos __attribute__((unused)), int pk_algos_length __attribute__((unused)),
    173175                                                        gnutls_retr2_st *ret) {
    174176
     
    303305}
    304306
    305 int mgs_hook_post_config(apr_pool_t * p, apr_pool_t * plog, apr_pool_t * ptemp, server_rec * base_server) {
     307int mgs_hook_post_config(apr_pool_t * p, apr_pool_t * plog __attribute__((unused)), apr_pool_t * ptemp __attribute__((unused)), server_rec * base_server) {
    306308
    307309    int rv;
     
    589591}
    590592
    591 static int vhost_cb(void *baton, conn_rec * conn, server_rec * s) {
     593static int vhost_cb(void *baton, conn_rec * conn __attribute__((unused)), server_rec * s) {
    592594    mgs_srvconf_rec *tsc;
    593595    vhost_cb_rec *x = baton;
     
    728730}
    729731
    730 int mgs_hook_pre_connection(conn_rec * c, void *csd) {
     732int mgs_hook_pre_connection(conn_rec * c, void *csd __attribute__((unused))) {
    731733    mgs_srvconf_rec *sc;
    732734
     
    900902#define MGS_SIDE(suffix) ((side==0) ? "SSL_SERVER" suffix : "SSL_CLIENT" suffix)
    901903
    902 static void mgs_add_common_cert_vars(request_rec * r, gnutls_x509_crt_t cert, int side, int export_cert_size) {
     904static void mgs_add_common_cert_vars(request_rec * r, gnutls_x509_crt_t cert, int side, size_t export_cert_size) {
    903905    unsigned char sbuf[64]; /* buffer to hold serials */
    904906    char buf[AP_IOBUFSIZE];
     
    10191021 * to use for the PEM-encoded certificate (0 means do not export)
    10201022 */
    1021 static void mgs_add_common_pgpcert_vars(request_rec * r, gnutls_openpgp_crt_t cert, int side, int export_cert_size) {
     1023static void mgs_add_common_pgpcert_vars(request_rec * r, gnutls_openpgp_crt_t cert, int side, size_t export_cert_size) {
    10221024
    10231025        unsigned char sbuf[64]; /* buffer to hold serials */
     
    13351337exit:
    13361338    if (gnutls_certificate_type_get(ctxt->session) == GNUTLS_CRT_X509) {
    1337         int i;
     1339        unsigned int i;
    13381340        for (i = 0; i < ch_size; i++) {
    13391341            gnutls_x509_crt_deinit(cert.x509[i]);
     
    13471349}
    13481350
     1351#ifdef ENABLE_MSVA
     1352/* this section of code is used only when trying to talk to the MSVA */
    13491353static const char* mgs_x509_leaf_oid_from_dn(apr_pool_t *pool, const char* oid, gnutls_x509_crt_t cert) {
    13501354    int rv=GNUTLS_E_SUCCESS, i;
     
    13831387            data = apr_palloc(pool, sz);
    13841388            rv = gnutls_x509_crt_get_subject_alt_name2(cert, i, data, &sz, &thistype, NULL);
    1385             if (rv == target)
     1389            if (rv >=0 && (thistype == target))
    13861390                return data;
    13871391        }
     
    13901394    return NULL;
    13911395}
     1396
    13921397
    13931398/* Create a string representing a candidate User ID from an X.509
     
    15051510    return ret;
    15061511}
    1507 
    1508 static int mgs_status_hook(request_rec *r, int flags)
     1512#endif /* ENABLE_MSVA */
     1513
     1514static int mgs_status_hook(request_rec *r, int flags __attribute__((unused)))
    15091515{
    15101516    mgs_srvconf_rec *sc;
Note: See TracChangeset for help on using the changeset viewer.