From a3c8390d19593b1e5277d95bfb4ab206d4785150 Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Wed, 12 Feb 2014 10:12:04 -0500 Subject: Make DEBUG macro invocations variadic Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek Reviewed-by: Stephen Gallagher Reviewed-by: Simo Sorce --- src/util/crypto/libcrypto/crypto_obfuscate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/util/crypto/libcrypto/crypto_obfuscate.c') diff --git a/src/util/crypto/libcrypto/crypto_obfuscate.c b/src/util/crypto/libcrypto/crypto_obfuscate.c index e303e8c80..50ea469c8 100644 --- a/src/util/crypto/libcrypto/crypto_obfuscate.c +++ b/src/util/crypto/libcrypto/crypto_obfuscate.c @@ -60,7 +60,7 @@ static struct crypto_mech_data cmdata[] = { static struct crypto_mech_data *get_crypto_mech_data(enum obfmethod meth) { if (meth >= NUM_OBFMETHODS) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Unsupported cipher type\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Unsupported cipher type\n"); return NULL; } return &cmdata[meth]; @@ -122,20 +122,20 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, } if (!EVP_EncryptInit_ex(&ctx, mech_props->cipher(), 0, keybuf, ivbuf)) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failure to initialize cipher contex\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failure to initialize cipher contex\n"); ret = EIO; goto done; } /* sample data we'll encrypt and decrypt */ if (!EVP_EncryptUpdate(&ctx, cryptotext, &ctlen, (const unsigned char*)password, plen)) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot execute the encryption operation\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot execute the encryption operation\n"); ret = EIO; goto done; } if(!EVP_EncryptFinal_ex(&ctx, cryptotext+ctlen, &digestlen)) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot finialize the encryption operation\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot finialize the encryption operation\n"); ret = EIO; goto done; } @@ -160,9 +160,9 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, goto done; } - DEBUG(SSSDBG_TRACE_FUNC, ("Writing method: %d\n", meth)); + DEBUG(SSSDBG_TRACE_FUNC, "Writing method: %d\n", meth); SAFEALIGN_SET_UINT16(&obfbuf[p], meth, &p); - DEBUG(SSSDBG_TRACE_FUNC, ("Writing bufsize: %d\n", result_len)); + DEBUG(SSSDBG_TRACE_FUNC, "Writing bufsize: %d\n", result_len); SAFEALIGN_SET_UINT16(&obfbuf[p], result_len, &p); safealign_memcpy(&obfbuf[p], keybuf, mech_props->keylen, &p); safealign_memcpy(&obfbuf[p], ivbuf, mech_props->bsize, &p); @@ -224,9 +224,9 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, /* unpack obfuscation buffer */ SAFEALIGN_COPY_UINT16_CHECK(&meth, obfbuf+p, obflen, &p); - DEBUG(SSSDBG_TRACE_FUNC, ("Read method: %d\n", meth)); + DEBUG(SSSDBG_TRACE_FUNC, "Read method: %d\n", meth); SAFEALIGN_COPY_UINT16_CHECK(&ctsize, obfbuf+p, obflen, &p); - DEBUG(SSSDBG_TRACE_FUNC, ("Read bufsize: %d\n", ctsize)); + DEBUG(SSSDBG_TRACE_FUNC, "Read bufsize: %d\n", ctsize); mech_props = get_crypto_mech_data(meth); if (mech_props == NULL) { @@ -239,7 +239,7 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, obfbuf + p + mech_props->keylen + mech_props->bsize + ctsize, OBF_BUFFER_SENTINEL_SIZE); if (memcmp(sentinel_check, OBF_BUFFER_SENTINEL, OBF_BUFFER_SENTINEL_SIZE) != 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Obfuscation buffer seems corrupt, aborting\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Obfuscation buffer seems corrupt, aborting\n"); ret = EFAULT; goto done; } -- cgit