From: Arran Cudbard-Bell Date: Mon, 15 Jun 2015 00:43:33 +0000 (-0400) Subject: Formatting X-Git-Tag: release_3_0_9~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=709db717c7c9b96800d30d9bb0861a1fe26d1730;p=thirdparty%2Ffreeradius-server.git Formatting --- diff --git a/src/modules/rlm_krb5/krb5.c b/src/modules/rlm_krb5/krb5.c index b70d0d11133..153a10ccb65 100644 --- a/src/modules/rlm_krb5/krb5.c +++ b/src/modules/rlm_krb5/krb5.c @@ -69,18 +69,18 @@ char const *rlm_krb5_error(krb5_context context, krb5_error_code code) msg = krb5_get_error_message(context, code); if (msg) { strlcpy(buffer, msg, KRB5_STRERROR_BUFSIZE); -#ifdef HAVE_KRB5_FREE_ERROR_MESSAGE +# ifdef HAVE_KRB5_FREE_ERROR_MESSAGE krb5_free_error_message(context, msg); -#elif defined(HAVE_KRB5_FREE_ERROR_STRING) +# elif defined(HAVE_KRB5_FREE_ERROR_STRING) { char *free; memcpy(&free, &msg, sizeof(free)); krb5_free_error_string(context, free); } -#else -# error "No way to free error strings, missing krb5_free_error_message() and krb5_free_error_string()" -#endif +# else +# error "No way to free error strings, missing krb5_free_error_message() and krb5_free_error_string()" +# endif } else { strlcpy(buffer, "Unknown error", KRB5_STRERROR_BUFSIZE); } @@ -99,14 +99,10 @@ char const *rlm_krb5_error(krb5_context context, krb5_error_code code) static int _mod_conn_free(rlm_krb5_handle_t *conn) { krb5_free_context(conn->context); - if (conn->keytab) { - krb5_kt_close(conn->context, conn->keytab); - } + if (conn->keytab) krb5_kt_close(conn->context, conn->keytab); #ifdef HEIMDAL_KRB5 - if (conn->ccache) { - krb5_cc_destroy(conn->context, conn->ccache); - } + if (conn->ccache) krb5_cc_destroy(conn->context, conn->ccache); #endif return 0; @@ -158,9 +154,7 @@ void *mod_conn_create(TALLOC_CTX *ctx, void *instance) krb5_verify_opt_set_keytab(&conn->options, conn->keytab); krb5_verify_opt_set_secure(&conn->options, true); - if (inst->service) { - krb5_verify_opt_set_service(&conn->options, inst->service); - } + if (inst->service) krb5_verify_opt_set_service(&conn->options, inst->service); #else krb5_verify_init_creds_opt_set_ap_req_nofail(inst->vic_options, true); #endif diff --git a/src/modules/rlm_krb5/rlm_krb5.c b/src/modules/rlm_krb5/rlm_krb5.c index 02a02a13c2d..1c0b08716b6 100644 --- a/src/modules/rlm_krb5/rlm_krb5.c +++ b/src/modules/rlm_krb5/rlm_krb5.c @@ -44,21 +44,14 @@ static int mod_detach(void *instance) #ifndef HEIMDAL_KRB5 talloc_free(inst->vic_options); - if (inst->gic_options) { - krb5_get_init_creds_opt_free(inst->context, inst->gic_options); - } - - if (inst->server) { - krb5_free_principal(inst->context, inst->server); - } + if (inst->gic_options) krb5_get_init_creds_opt_free(inst->context, inst->gic_options); + if (inst->server) krb5_free_principal(inst->context, inst->server); #endif /* Don't free hostname, it's just a pointer into service_princ */ talloc_free(inst->service); - if (inst->context) { - krb5_free_context(inst->context); - } + if (inst->context) krb5_free_context(inst->context); #ifdef KRB5_IS_THREAD_SAFE fr_connection_pool_free(inst->pool); #endif @@ -109,9 +102,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance) } inst->xlat_name = cf_section_name2(conf); - if (!inst->xlat_name) { - inst->xlat_name = cf_section_name1(conf); - } + if (!inst->xlat_name) inst->xlat_name = cf_section_name1(conf); ret = krb5_init_context(&inst->context); if (ret) { @@ -144,10 +135,8 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance) } #ifdef HEIMDAL_KRB5 - if (inst->hostname) { - DEBUG("rlm_krb5 (%s): Ignoring hostname component of service principal \"%s\", not " - "needed/supported by Heimdal", inst->xlat_name, inst->hostname); - } + if (inst->hostname) DEBUG("rlm_krb5 (%s): Ignoring hostname component of service principal \"%s\", not " + "needed/supported by Heimdal", inst->xlat_name, inst->hostname); #else /* @@ -337,12 +326,12 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(void *instance, REQUEST *re krb5_principal client; -#ifdef KRB5_IS_THREAD_SAFE +# ifdef KRB5_IS_THREAD_SAFE conn = fr_connection_get(inst->pool); if (!conn) return RLM_MODULE_FAIL; -#else +# else conn = inst->conn; -#endif +# endif /* * Zero out local storage @@ -389,9 +378,9 @@ cleanup: krb5_free_principal(conn->context, client); } -#ifdef KRB5_IS_THREAD_SAFE +# ifdef KRB5_IS_THREAD_SAFE fr_connection_release(inst->pool, conn); -#endif +# endif return rcode; } @@ -414,12 +403,12 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(void *instance, REQUEST *re rad_assert(inst->context); -#ifdef KRB5_IS_THREAD_SAFE +# ifdef KRB5_IS_THREAD_SAFE conn = fr_connection_get(inst->pool); if (!conn) return RLM_MODULE_FAIL; -#else +# else conn = inst->conn; -#endif +# endif /* * Zero out local storage @@ -448,19 +437,15 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(void *instance, REQUEST *re RDEBUG("Attempting to authenticate against service principal"); ret = krb5_verify_init_creds(conn->context, &init_creds, inst->server, conn->keytab, NULL, inst->vic_options); - if (ret) { - rcode = krb5_process_error(request, conn, ret); - } + if (ret) rcode = krb5_process_error(request, conn, ret); cleanup: - if (client) { - krb5_free_principal(conn->context, client); - } + if (client) krb5_free_principal(conn->context, client); krb5_free_cred_contents(conn->context, &init_creds); -#ifdef KRB5_IS_THREAD_SAFE +# ifdef KRB5_IS_THREAD_SAFE fr_connection_release(inst->pool, conn); -#endif +# endif return rcode; }