From a444035d9ede8317d42877afa5e230acb203f6d5 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 14 Jul 2016 12:29:06 +0200 Subject: [PATCH] tls: coherent whitespacing and indentation --- modules/tls/tls_init.c | 61 +++++++++++++++++++++--------------------- modules/tls/tls_mod.c | 22 +++++++-------- 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/modules/tls/tls_init.c b/modules/tls/tls_init.c index 118f0ab98d4..95173295532 100644 --- a/modules/tls/tls_init.c +++ b/modules/tls/tls_init.c @@ -1,4 +1,4 @@ -/* +/* * TLS module * * Copyright (C) 2005,2006 iptelorg GmbH @@ -43,7 +43,7 @@ #include #include #include - + #include "../../dprint.h" #include "../../mem/shm_mem.h" #include "../../tcp_init.h" @@ -160,7 +160,7 @@ inline static int backtrace2str(char* buf, int size) char* next; char* s; char* e; - + p=buf; end=buf+size; bt_size=backtrace(bt, sizeof(bt)/sizeof(bt[0])); bt_strs=backtrace_symbols(bt, bt_size); @@ -203,7 +203,7 @@ static void* ser_malloc(size_t size, const char* file, int line) #ifdef RAND_NULL_MALLOC static ticks_t st=0; - /* start random null returns only after + /* start random null returns only after * NULL_GRACE_PERIOD from first call */ if (st==0) st=get_ticks(); if (((get_ticks()-st)address_str.len, si->address_str.s, si->port_no); + si->address_str.len, si->address_str.s, si->port_no); goto error; } - + si->proto = PROTO_TLS; return 0; - - error: + +error: if (si->socket != -1) { close(si->socket); si->socket = -1; @@ -326,7 +326,7 @@ int tls_h_init_si(struct socket_info *si) /* - * initialize ssl methods + * initialize ssl methods */ static void init_ssl_methods(void) { @@ -389,11 +389,11 @@ static int init_tls_compression(void) STACK_OF(SSL_COMP)* comp_methods; SSL_COMP* zlib_comp; long ssl_version; - + /* disabling compression */ # ifndef SSL_COMP_ZLIB_IDX # define SSL_COMP_ZLIB_IDX 1 /* openssl/ssl/ssl_ciph.c:84 */ -# endif +# endif comp_methods = SSL_COMP_get_compression_methods(); if (comp_methods == 0) { LOG(L_INFO, "tls: init_tls: compression support disabled in the" @@ -419,7 +419,7 @@ static int init_tls_compression(void) DBG("tls: init_tls: found compression method %p id %d\n", zlib_comp, zlib_comp->id); if (zlib_comp->id == SSL_COMP_ZLIB_IDX) { - DBG("tls: init_tls: found zlib compression (%d)\n", + DBG("tls: init_tls: found zlib compression (%d)\n", SSL_COMP_ZLIB_IDX); break /* found */; } else { @@ -438,7 +438,7 @@ static int init_tls_compression(void) "bug workaround (replacing zlib COMP method with " "our own version)\n"); /* hack: make sure that the CRYPTO_EX_INDEX_COMP class is empty - * and it does not contain any free_ex_data from the + * and it does not contain any free_ex_data from the * built-in zlib. This can happen if the current openssl * zlib malloc fix patch is used (CRYPTO_get_ex_new_index() in * COMP_zlib()). Unfortunately the only way @@ -447,7 +447,7 @@ static int init_tls_compression(void) * (only the COMP class is initialized before). */ CRYPTO_cleanup_all_ex_data(); - + if (fixed_c_zlib_init() != 0) { LOG(L_CRIT, "tls: init_tls: BUG: failed to initialize zlib" " compression fix, disabling compression...\n"); @@ -478,10 +478,10 @@ static int init_tls_compression(void) */ int tls_pre_init(void) { - /* - * this has to be called before any function calling CRYPTO_malloc, - * CRYPTO_malloc will set allow_customize in openssl to 0 - */ + /* + * this has to be called before any function calling CRYPTO_malloc, + * CRYPTO_malloc will set allow_customize in openssl to 0 + */ #ifdef TLS_MALLOC_DBG if (!CRYPTO_set_mem_ex_functions(ser_malloc, ser_realloc, ser_free)) { #else @@ -580,7 +580,7 @@ int init_tls_h(void) lib_cflags=SSLeay_version(SSLEAY_CFLAGS); lib_kerberos=0; lib_zlib=0; - if ((lib_cflags==0) || strstr(lib_cflags, "not available")){ + if ((lib_cflags==0) || strstr(lib_cflags, "not available")){ lib_kerberos=-1; lib_zlib=-1; }else{ @@ -589,7 +589,7 @@ int init_tls_h(void) if (strstr(lib_cflags, "-DKRB5_")) lib_kerberos=1; } - LOG(L_INFO, "tls: _init_tls_h: compiled with openssl version " + LOG(L_INFO, "tls: _init_tls_h: compiled with openssl version " "\"%s\" (0x%08lx), kerberos support: %s, compression: %s\n", OPENSSL_VERSION_TEXT, (long)OPENSSL_VERSION_NUMBER, kerberos_support?"on":"off", comp_support?"on":"off"); @@ -627,7 +627,7 @@ int init_tls_h(void) /* if openssl compiled with kerberos support, and openssl < 0.9.8e-dev * or openssl between 0.9.9-dev and 0.9.9-beta1 apply workaround for * openssl bug #1467 */ - if (ssl_version < 0x00908050L || + if (ssl_version < 0x00908050L || (ssl_version >= 0x00909000L && ssl_version < 0x00909001L)){ openssl_kssl_malloc_bug=1; LOG(L_WARN, "tls: init_tls_h: openssl kerberos malloc bug detected, " @@ -655,7 +655,7 @@ int init_tls_h(void) " workaround enabled (on low memory tls operations will fail" " preemptively) with free memory thresholds %d and %d bytes\n", low_mem_threshold1, low_mem_threshold2); - + if (shm_available()==(unsigned long)(-1)){ LOG(L_WARN, "tls: Kamailio is compiled without MALLOC_STATS support:" " the workaround for low mem. openssl bugs will _not_ " @@ -663,8 +663,9 @@ int init_tls_h(void) low_mem_threshold1=0; low_mem_threshold2=0; } - if ((low_mem_threshold1 != cfg_get(tls, tls_cfg, low_mem_threshold1)) || - (low_mem_threshold2 != cfg_get(tls, tls_cfg, low_mem_threshold2))) { + if ((low_mem_threshold1 != cfg_get(tls, tls_cfg, low_mem_threshold1)) + || (low_mem_threshold2 + != cfg_get(tls, tls_cfg, low_mem_threshold2))) { /* ugly hack to set the initial values for the mem tresholds */ if (cfg_register_ctx(&cfg_ctx, 0)) { ERR("failed to register cfg context\n"); @@ -689,7 +690,7 @@ int init_tls_h(void) return -1; } } - + init_ssl_methods(); tls_mod_initialized = 1; return 0; diff --git a/modules/tls/tls_mod.c b/modules/tls/tls_mod.c index c4478b28333..3446c8c0294 100644 --- a/modules/tls/tls_mod.c +++ b/modules/tls/tls_mod.c @@ -1,7 +1,7 @@ /* * TLS module * - * Copyright (C) 2007 iptelorg GmbH + * Copyright (C) 2007 iptelorg GmbH * Copyright (C) Motorola Solutions, Inc. * * Permission to use, copy, modify, and distribute this software for any @@ -84,7 +84,7 @@ MODULE_VERSION str sr_tls_xavp_cfg = {0, 0}; /* - * Default settings when modparams are used + * Default settings when modparams are used */ static tls_domain_t mod_params = { TLS_DOMAIN_DEF | TLS_DOMAIN_SRV, /* Domain Type */ @@ -193,11 +193,11 @@ static param_export_t params[] = { {"session_id", PARAM_STR, &default_tls_cfg.session_id }, {"config", PARAM_STR, &default_tls_cfg.config_file }, {"tls_disable_compression", PARAM_INT, - &default_tls_cfg.disable_compression}, + &default_tls_cfg.disable_compression}, {"ssl_release_buffers", PARAM_INT, &default_tls_cfg.ssl_release_buffers}, {"ssl_freelist_max_len", PARAM_INT, &default_tls_cfg.ssl_freelist_max}, {"ssl_max_send_fragment", PARAM_INT, - &default_tls_cfg.ssl_max_send_fragment}, + &default_tls_cfg.ssl_max_send_fragment}, {"ssl_read_ahead", PARAM_INT, &default_tls_cfg.ssl_read_ahead}, {"send_close_notify", PARAM_INT, &default_tls_cfg.send_close_notify}, {"con_ct_wq_max", PARAM_INT, &default_tls_cfg.con_ct_wq_max}, @@ -253,11 +253,11 @@ static struct tls_hooks tls_h = { static tls_domains_cfg_t* tls_use_modparams(void) { tls_domains_cfg_t* ret; - + ret = tls_new_cfg(); if (!ret) return; - + } #endif @@ -333,8 +333,8 @@ static int mod_init(void) goto error; } - /* if (init_tls() < 0) return -1; */ - + /* if (init_tls() < 0) return -1; */ + tls_domains_cfg_lock = lock_alloc(); if (tls_domains_cfg_lock == 0) { ERR("Unable to create TLS configuration lock\n"); @@ -350,7 +350,7 @@ static int mod_init(void) goto error; } if (cfg_get(tls, tls_cfg, config_file).s) { - *tls_domains_cfg = + *tls_domains_cfg = tls_load_config(&cfg_get(tls, tls_cfg, config_file)); if (!(*tls_domains_cfg)) goto error; } else { @@ -379,7 +379,7 @@ static int mod_child(int rank) { if (tls_disable || (tls_domains_cfg==0)) return 0; - /* fix tls config only from the main proc/PROC_INIT., when we know + /* fix tls config only from the main proc/PROC_INIT., when we know * the exact process number and before any other process starts*/ if (rank == PROC_INIT){ if (cfg_get(tls, tls_cfg, config_file).s){ @@ -399,7 +399,7 @@ static int mod_child(int rank) static void destroy(void) { /* tls is destroyed via the registered destroy_tls_h callback - => nothing to do here */ + * => nothing to do here */ }