diff options
author | Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> | 2014-02-12 10:12:04 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-02-12 22:30:55 +0100 |
commit | a3c8390d19593b1e5277d95bfb4ab206d4785150 (patch) | |
tree | 2eb4e5432f4f79a75589c03b1513b656879ebf9c /src/util | |
parent | cc026fd9ba386f2197e3217940d597dcad1a26fe (diff) | |
download | sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.gz sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.xz sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.zip |
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 <jhrozek@redhat.com>
Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/authtok.c | 2 | ||||
-rw-r--r-- | src/util/backup_file.c | 24 | ||||
-rw-r--r-- | src/util/check_and_open.c | 26 | ||||
-rw-r--r-- | src/util/child_common.c | 106 | ||||
-rw-r--r-- | src/util/crypto/libcrypto/crypto_base64.c | 2 | ||||
-rw-r--r-- | src/util/crypto/libcrypto/crypto_obfuscate.c | 18 | ||||
-rw-r--r-- | src/util/crypto/nss/nss_obfuscate.c | 66 | ||||
-rw-r--r-- | src/util/crypto/nss/nss_util.c | 8 | ||||
-rw-r--r-- | src/util/debug.c | 4 | ||||
-rw-r--r-- | src/util/domain_info_utils.c | 84 | ||||
-rw-r--r-- | src/util/find_uid.c | 56 | ||||
-rw-r--r-- | src/util/nscd.c | 18 | ||||
-rw-r--r-- | src/util/server.c | 76 | ||||
-rw-r--r-- | src/util/signal.c | 2 | ||||
-rw-r--r-- | src/util/sss_ini.c | 26 | ||||
-rw-r--r-- | src/util/sss_krb5.c | 110 | ||||
-rw-r--r-- | src/util/sss_krb5.h | 2 | ||||
-rw-r--r-- | src/util/sss_ldap.c | 72 | ||||
-rw-r--r-- | src/util/sss_nss.c | 42 | ||||
-rw-r--r-- | src/util/sss_selinux.c | 26 | ||||
-rw-r--r-- | src/util/sss_ssh.c | 2 | ||||
-rw-r--r-- | src/util/sss_tc_utf8.c | 6 | ||||
-rw-r--r-- | src/util/user_info_msg.c | 4 | ||||
-rw-r--r-- | src/util/usertools.c | 70 | ||||
-rw-r--r-- | src/util/util.c | 28 | ||||
-rw-r--r-- | src/util/util.h | 4 | ||||
-rw-r--r-- | src/util/util_lock.c | 10 | ||||
-rw-r--r-- | src/util/well_known_sids.c | 12 |
28 files changed, 453 insertions, 453 deletions
diff --git a/src/util/authtok.c b/src/util/authtok.c index e9c2881bf..b7bc17ed0 100644 --- a/src/util/authtok.c +++ b/src/util/authtok.c @@ -214,7 +214,7 @@ struct sss_auth_token *sss_authtok_new(TALLOC_CTX *mem_ctx) token = talloc_zero(mem_ctx, struct sss_auth_token); if (token == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_zero failed.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_zero failed.\n"); } return token; diff --git a/src/util/backup_file.c b/src/util/backup_file.c index 316c1cfe8..a164a86cf 100644 --- a/src/util/backup_file.c +++ b/src/util/backup_file.c @@ -40,8 +40,8 @@ int backup_file(const char *src_file, int dbglvl) src_fd = open(src_file, O_RDONLY); if (src_fd < 0) { ret = errno; - DEBUG(dbglvl, ("Error (%d [%s]) opening source file %s\n", - ret, strerror(ret), src_file)); + DEBUG(dbglvl, "Error (%d [%s]) opening source file %s\n", + ret, strerror(ret), src_file); goto done; } @@ -70,14 +70,14 @@ int backup_file(const char *src_file, int dbglvl) if (dst_fd >= 0) break; if (ret != EEXIST) { - DEBUG(dbglvl, ("Error (%d [%s]) opening destination file %s\n", - ret, strerror(ret), dst_file)); + DEBUG(dbglvl, "Error (%d [%s]) opening destination file %s\n", + ret, strerror(ret), dst_file); goto done; } } if (ret != 0) { - DEBUG(dbglvl, ("Error (%d [%s]) opening destination file %s\n", - ret, strerror(ret), dst_file)); + DEBUG(dbglvl, "Error (%d [%s]) opening destination file %s\n", + ret, strerror(ret), dst_file); goto done; } @@ -87,8 +87,8 @@ int backup_file(const char *src_file, int dbglvl) numread = sss_atomic_read_s(src_fd, buf, BUFFER_SIZE); if (numread < 0) { ret = errno; - DEBUG(dbglvl, ("Error (%d [%s]) reading from source %s\n", - ret, strerror(ret), src_file)); + DEBUG(dbglvl, "Error (%d [%s]) reading from source %s\n", + ret, strerror(ret), src_file); goto done; } if (numread == 0) break; @@ -97,14 +97,14 @@ int backup_file(const char *src_file, int dbglvl) written = sss_atomic_write_s(dst_fd, buf, numread); if (written == -1) { ret = errno; - DEBUG(dbglvl, ("Error (%d [%s]) writing to destination %s\n", - ret, strerror(ret), dst_file)); + DEBUG(dbglvl, "Error (%d [%s]) writing to destination %s\n", + ret, strerror(ret), dst_file); goto done; } if (written != numread) { - DEBUG(dbglvl, ("Wrote %zd bytes expected %zd bytes\n", - written, numread)); + DEBUG(dbglvl, "Wrote %zd bytes expected %zd bytes\n", + written, numread); ret = EIO; goto done; } diff --git a/src/util/check_and_open.c b/src/util/check_and_open.c index c62619171..50eee6b2c 100644 --- a/src/util/check_and_open.c +++ b/src/util/check_and_open.c @@ -50,8 +50,8 @@ errno_t check_file(const char *filename, const int uid, const int gid, ret = follow_symlink ? stat(filename, stat_buf) : \ lstat(filename, stat_buf); if (ret == -1) { - DEBUG(SSSDBG_TRACE_FUNC, ("lstat for [%s] failed: [%d][%s].\n", filename, errno, - strerror(errno))); + DEBUG(SSSDBG_TRACE_FUNC, "lstat for [%s] failed: [%d][%s].\n", filename, errno, + strerror(errno)); return errno; } @@ -74,8 +74,8 @@ errno_t check_fd(int fd, const int uid, const int gid, ret = fstat(fd, stat_buf); if (ret == -1) { - DEBUG(1, ("fstat for [%d] failed: [%d][%s].\n", fd, errno, - strerror(errno))); + DEBUG(1, "fstat for [%d] failed: [%d][%s].\n", fd, errno, + strerror(errno)); return errno; } @@ -114,28 +114,28 @@ static errno_t perform_checks(struct stat *stat_buf, type_check = S_ISSOCK(stat_buf->st_mode); break; default: - DEBUG(1, ("Unsupported file type.\n")); + DEBUG(1, "Unsupported file type.\n"); return EINVAL; } if (!type_check) { - DEBUG(1, ("File is not the right type.\n")); + DEBUG(1, "File is not the right type.\n"); return EINVAL; } if (mode >= 0 && (stat_buf->st_mode & ~S_IFMT) != mode) { - DEBUG(1, ("File has the wrong mode [%.7o], expected [%.7o].\n", - (stat_buf->st_mode & ~S_IFMT), mode)); + DEBUG(1, "File has the wrong mode [%.7o], expected [%.7o].\n", + (stat_buf->st_mode & ~S_IFMT), mode); return EINVAL; } if (uid >= 0 && stat_buf->st_uid != uid) { - DEBUG(1, ("File must be owned by uid [%d].\n", uid)); + DEBUG(1, "File must be owned by uid [%d].\n", uid); return EINVAL; } if (gid >= 0 && stat_buf->st_gid != gid) { - DEBUG(1, ("File must be owned by gid [%d].\n", gid)); + DEBUG(1, "File must be owned by gid [%d].\n", gid); return EINVAL; } @@ -151,8 +151,8 @@ errno_t check_and_open_readonly(const char *filename, int *fd, const uid_t uid, *fd = open(filename, O_RDONLY); if (*fd == -1) { - DEBUG(1, ("open [%s] failed: [%d][%s].\n", filename, errno, - strerror(errno))); + DEBUG(1, "open [%s] failed: [%d][%s].\n", filename, errno, + strerror(errno)); return errno; } @@ -160,7 +160,7 @@ errno_t check_and_open_readonly(const char *filename, int *fd, const uid_t uid, if (ret != EOK) { close(*fd); *fd = -1; - DEBUG(1, ("check_fd failed.\n")); + DEBUG(1, "check_fd failed.\n"); return ret; } diff --git a/src/util/child_common.c b/src/util/child_common.c index 55b3672f4..285eadbcf 100644 --- a/src/util/child_common.c +++ b/src/util/child_common.c @@ -56,7 +56,7 @@ errno_t sss_sigchld_init(TALLOC_CTX *mem_ctx, sigchld_ctx = talloc_zero(mem_ctx, struct sss_sigchild_ctx); if (!sigchld_ctx) { - DEBUG(0, ("fatal error initializing sss_sigchild_ctx\n")); + DEBUG(0, "fatal error initializing sss_sigchild_ctx\n"); return ENOMEM; } sigchld_ctx->ev = ev; @@ -64,8 +64,8 @@ errno_t sss_sigchld_init(TALLOC_CTX *mem_ctx, ret = sss_hash_create(sigchld_ctx, 10, &sigchld_ctx->children); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, - ("fatal error initializing children hash table: [%s]\n", - strerror(ret))); + "fatal error initializing children hash table: [%s]\n", + strerror(ret)); talloc_free(sigchld_ctx); return ret; } @@ -95,8 +95,8 @@ static int sss_child_destructor(void *ptr) error = hash_delete(child_ctx->sigchld_ctx->children, &key); if (error != HASH_SUCCESS && error != HASH_ERROR_KEY_NOT_FOUND) { DEBUG(SSSDBG_TRACE_INTERNAL, - ("failed to delete child_ctx from hash table [%d]: %s\n", - error, hash_error_string(error))); + "failed to delete child_ctx from hash table [%d]: %s\n", + error, hash_error_string(error)); } return 0; @@ -165,8 +165,8 @@ static void sss_child_invoke_cb(struct tevent_context *ev, error = hash_delete(child_ctx->sigchld_ctx->children, &key); if (error != HASH_SUCCESS && error != HASH_ERROR_KEY_NOT_FOUND) { DEBUG(SSSDBG_OP_FAILURE, - ("failed to delete child_ctx from hash table [%d]: %s\n", - error, hash_error_string(error))); + "failed to delete child_ctx from hash table [%d]: %s\n", + error, hash_error_string(error)); } if (child_ctx->cb) { @@ -204,7 +204,7 @@ void sss_child_handler(struct tevent_context *ev, if (pid == -1) { DEBUG(SSSDBG_TRACE_INTERNAL, - ("waitpid failed [%d]: %s\n", errno, strerror(errno))); + "waitpid failed [%d]: %s\n", errno, strerror(errno)); return; } else if (pid == 0) continue; @@ -216,14 +216,14 @@ void sss_child_handler(struct tevent_context *ev, imm = tevent_create_immediate(child_ctx); if (imm == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Out of memory invoking SIGCHLD callback\n")); + "Out of memory invoking SIGCHLD callback\n"); return; } invoke_pvt = talloc_zero(child_ctx, struct sss_child_cb_pvt); if (invoke_pvt == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("out of memory invoking SIGCHLD callback\n")); + "out of memory invoking SIGCHLD callback\n"); return; } invoke_pvt->child_ctx = child_ctx; @@ -233,10 +233,10 @@ void sss_child_handler(struct tevent_context *ev, sss_child_invoke_cb, invoke_pvt); } else if (error == HASH_ERROR_KEY_NOT_FOUND) { DEBUG(SSSDBG_TRACE_LIBS, - ("BUG: waitpid() returned [%d] but it was not in the table. " + "BUG: waitpid() returned [%d] but it was not in the table. " "This could be due to a linked library creating processes " "without registering them with the sigchld handler\n", - pid)); + pid); /* We will simply ignore this and return to the loop * This will prevent a zombie, but may cause unexpected * behavior in the code that was trying to handle this @@ -244,8 +244,8 @@ void sss_child_handler(struct tevent_context *ev, */ } else { DEBUG(SSSDBG_OP_FAILURE, - ("SIGCHLD hash table error [%d]: %s\n", - error, hash_error_string(error))); + "SIGCHLD hash table error [%d]: %s\n", + error, hash_error_string(error)); /* This is bad, but we should try to check for other * children anyway, to avoid potential zombies. */ @@ -267,7 +267,7 @@ int child_handler_setup(struct tevent_context *ev, int pid, { struct sss_child_ctx_old *child_ctx; - DEBUG(8, ("Setting up signal handler up for pid [%d]\n", pid)); + DEBUG(8, "Setting up signal handler up for pid [%d]\n", pid); child_ctx = talloc_zero(ev, struct sss_child_ctx_old); if (child_ctx == NULL) { @@ -286,7 +286,7 @@ int child_handler_setup(struct tevent_context *ev, int pid, child_ctx->cb = cb; child_ctx->pvt = pvt; - DEBUG(8, ("Signal handler set up for pid [%d]\n", pid)); + DEBUG(8, "Signal handler set up for pid [%d]\n", pid); if (_child_ctx != NULL) { *_child_ctx = child_ctx; @@ -307,7 +307,7 @@ void child_handler_destroy(struct sss_child_ctx_old *ctx) ret = kill(ctx->pid, SIGKILL); if (ret == -1) { ret = errno; - DEBUG(SSSDBG_MINOR_FAILURE, ("kill failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(SSSDBG_MINOR_FAILURE, "kill failed [%d][%s].\n", ret, strerror(ret)); } } @@ -343,7 +343,7 @@ struct tevent_req *write_pipe_send(TALLOC_CTX *mem_ctx, fde = tevent_add_fd(ev, state, fd, TEVENT_FD_WRITE, write_pipe_handler, req); if (fde == NULL) { - DEBUG(1, ("tevent_add_fd failed.\n")); + DEBUG(1, "tevent_add_fd failed.\n"); goto fail; } @@ -365,8 +365,8 @@ static void write_pipe_handler(struct tevent_context *ev, if (flags & TEVENT_FD_READ) { DEBUG(SSSDBG_CRIT_FAILURE, - ("write_pipe_done called with TEVENT_FD_READ," - " this should not happen.\n")); + "write_pipe_done called with TEVENT_FD_READ," + " this should not happen.\n"); tevent_req_error(req, EINVAL); return; } @@ -376,19 +376,19 @@ static void write_pipe_handler(struct tevent_context *ev, if (state->written == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("write failed [%d][%s].\n", ret, strerror(ret))); + "write failed [%d][%s].\n", ret, strerror(ret)); tevent_req_error(req, ret); return; } if (state->len != state->written) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Wrote %zu bytes, expected %zu\n", - state->written, state->len)); + DEBUG(SSSDBG_CRIT_FAILURE, "Wrote %zu bytes, expected %zu\n", + state->written, state->len); tevent_req_error(req, EIO); return; } - DEBUG(SSSDBG_TRACE_FUNC, ("All data has been sent!\n")); + DEBUG(SSSDBG_TRACE_FUNC, "All data has been sent!\n"); tevent_req_done(req); return; } @@ -427,7 +427,7 @@ struct tevent_req *read_pipe_send(TALLOC_CTX *mem_ctx, fde = tevent_add_fd(ev, state, fd, TEVENT_FD_READ, read_pipe_handler, req); if (fde == NULL) { - DEBUG(1, ("tevent_add_fd failed.\n")); + DEBUG(1, "tevent_add_fd failed.\n"); goto fail; } @@ -450,8 +450,8 @@ static void read_pipe_handler(struct tevent_context *ev, uint8_t buf[CHILD_MSG_CHUNK]; if (flags & TEVENT_FD_WRITE) { - DEBUG(1, ("read_pipe_done called with TEVENT_FD_WRITE," - " this should not happen.\n")); + DEBUG(1, "read_pipe_done called with TEVENT_FD_WRITE," + " this should not happen.\n"); tevent_req_error(req, EINVAL); return; } @@ -462,7 +462,7 @@ static void read_pipe_handler(struct tevent_context *ev, if (size == -1) { err = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("read failed [%d][%s].\n", err, strerror(err))); + "read failed [%d][%s].\n", err, strerror(err)); tevent_req_error(req, err); return; @@ -479,13 +479,13 @@ static void read_pipe_handler(struct tevent_context *ev, return; } else if (size == 0) { - DEBUG(6, ("EOF received, client finished\n")); + DEBUG(6, "EOF received, client finished\n"); tevent_req_done(req); return; } else { DEBUG(SSSDBG_CRIT_FAILURE, - ("unexpected return value of read [%zd].\n", size)); + "unexpected return value of read [%zd].\n", size); tevent_req_error(req, EINVAL); return; } @@ -514,13 +514,13 @@ void fd_nonblocking(int fd) flags = fcntl(fd, F_GETFL, 0); if (flags == -1) { ret = errno; - DEBUG(1, ("F_GETFL failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "F_GETFL failed [%d][%s].\n", ret, strerror(ret)); return; } if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) { ret = errno; - DEBUG(1, ("F_SETFL failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "F_SETFL failed [%d][%s].\n", ret, strerror(ret)); } return; @@ -538,40 +538,40 @@ void child_sig_handler(struct tevent_context *ev, struct tevent_immediate *imm; if (count <= 0) { - DEBUG(0, ("SIGCHLD handler called with invalid child count\n")); + DEBUG(0, "SIGCHLD handler called with invalid child count\n"); return; } child_ctx = talloc_get_type(pvt, struct sss_child_ctx_old); - DEBUG(7, ("Waiting for child [%d].\n", child_ctx->pid)); + DEBUG(7, "Waiting for child [%d].\n", child_ctx->pid); errno = 0; ret = waitpid(child_ctx->pid, &child_ctx->child_status, WNOHANG); if (ret == -1) { err = errno; - DEBUG(1, ("waitpid failed [%d][%s].\n", err, strerror(err))); + DEBUG(1, "waitpid failed [%d][%s].\n", err, strerror(err)); } else if (ret == 0) { - DEBUG(1, ("waitpid did not found a child with changed status.\n")); + DEBUG(1, "waitpid did not found a child with changed status.\n"); } else { if (WIFEXITED(child_ctx->child_status)) { if (WEXITSTATUS(child_ctx->child_status) != 0) { - DEBUG(1, ("child [%d] failed with status [%d].\n", ret, - WEXITSTATUS(child_ctx->child_status))); + DEBUG(1, "child [%d] failed with status [%d].\n", ret, + WEXITSTATUS(child_ctx->child_status)); } else { - DEBUG(4, ("child [%d] finished successfully.\n", ret)); + DEBUG(4, "child [%d] finished successfully.\n", ret); } } else if (WIFSIGNALED(child_ctx->child_status)) { - DEBUG(1, ("child [%d] was terminated by signal [%d].\n", ret, - WTERMSIG(child_ctx->child_status))); + DEBUG(1, "child [%d] was terminated by signal [%d].\n", ret, + WTERMSIG(child_ctx->child_status)); } else { if (WIFSTOPPED(child_ctx->child_status)) { - DEBUG(7, ("child [%d] was stopped by signal [%d].\n", ret, - WSTOPSIG(child_ctx->child_status))); + DEBUG(7, "child [%d] was stopped by signal [%d].\n", ret, + WSTOPSIG(child_ctx->child_status)); } if (WIFCONTINUED(child_ctx->child_status)) { - DEBUG(7, ("child [%d] was resumed by delivery of SIGCONT.\n", - ret)); + DEBUG(7, "child [%d] was resumed by delivery of SIGCONT.\n", + ret); } return; @@ -582,7 +582,7 @@ void child_sig_handler(struct tevent_context *ev, */ imm = tevent_create_immediate(child_ctx); if (imm == NULL) { - DEBUG(0, ("Out of memory invoking sig handler callback\n")); + DEBUG(0, "Out of memory invoking sig handler callback\n"); return; } @@ -633,7 +633,7 @@ static errno_t prepare_child_argv(TALLOC_CTX *mem_ctx, */ argv = talloc_array(mem_ctx, char *, argc); if (argv == NULL) { - DEBUG(1, ("talloc_array failed.\n")); + DEBUG(1, "talloc_array failed.\n"); return ENOMEM; } @@ -701,7 +701,7 @@ errno_t exec_child(TALLOC_CTX *mem_ctx, ret = dup2(pipefd_to_child[0], STDIN_FILENO); if (ret == -1) { err = errno; - DEBUG(1, ("dup2 failed [%d][%s].\n", err, strerror(err))); + DEBUG(1, "dup2 failed [%d][%s].\n", err, strerror(err)); return err; } @@ -709,20 +709,20 @@ errno_t exec_child(TALLOC_CTX *mem_ctx, ret = dup2(pipefd_from_child[1], STDOUT_FILENO); if (ret == -1) { err = errno; - DEBUG(1, ("dup2 failed [%d][%s].\n", err, strerror(err))); + DEBUG(1, "dup2 failed [%d][%s].\n", err, strerror(err)); return err; } ret = prepare_child_argv(mem_ctx, debug_fd, binary, &argv); if (ret != EOK) { - DEBUG(1, ("prepare_child_argv.\n")); + DEBUG(1, "prepare_child_argv.\n"); return ret; } execv(binary, argv); err = errno; - DEBUG(SSSDBG_OP_FAILURE, ("execv failed [%d][%s].\n", err, strerror(err))); + DEBUG(SSSDBG_OP_FAILURE, "execv failed [%d][%s].\n", err, strerror(err)); return err; } @@ -734,14 +734,14 @@ void child_cleanup(int readfd, int writefd) ret = close(readfd); if (ret != EOK) { ret = errno; - DEBUG(1, ("close failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "close failed [%d][%s].\n", ret, strerror(ret)); } } if (writefd != -1) { ret = close(writefd); if (ret != EOK) { ret = errno; - DEBUG(1, ("close failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "close failed [%d][%s].\n", ret, strerror(ret)); } } } diff --git a/src/util/crypto/libcrypto/crypto_base64.c b/src/util/crypto/libcrypto/crypto_base64.c index 15734a00d..11a064827 100644 --- a/src/util/crypto/libcrypto/crypto_base64.c +++ b/src/util/crypto/libcrypto/crypto_base64.c @@ -122,7 +122,7 @@ unsigned char *sss_base64_decode(TALLOC_CTX *mem_ctx, *outsize = size; } else { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot get decoded data\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot get decoded data\n"); } BIO_free_all(b64); BIO_free(bmem_out); 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; } diff --git a/src/util/crypto/nss/nss_obfuscate.c b/src/util/crypto/nss/nss_obfuscate.c index 842b58d1c..ebe87be4c 100644 --- a/src/util/crypto/nss/nss_obfuscate.c +++ b/src/util/crypto/nss/nss_obfuscate.c @@ -77,7 +77,7 @@ static struct crypto_mech_data cmdata[] = { static struct crypto_mech_data *get_crypto_mech_data(enum obfmethod meth) { if (meth >= NUM_OBFMETHODS) { - DEBUG(1, ("Unsupported cipher type\n")); + DEBUG(1, "Unsupported cipher type\n"); return NULL; } return &cmdata[meth]; @@ -97,24 +97,24 @@ static int generate_random_key(TALLOC_CTX *mem_ctx, randkey = PK11_KeyGen(slot, mech_props->cipher, NULL, mech_props->keylen, NULL); if (randkey == NULL) { - DEBUG(1, ("Failure to generate key (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to generate key (err %d)\n", + PR_GetError()); ret = EIO; goto done; } sret = PK11_ExtractKeyValue(randkey); if (sret != SECSuccess) { - DEBUG(1, ("Failure to extract key value (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to extract key value (err %d)\n", + PR_GetError()); ret = EIO; goto done; } randkeydata = PK11_GetKeyData(randkey); if (randkeydata == NULL) { - DEBUG(1, ("Failure to get key data (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to get key data (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -168,8 +168,8 @@ static int nss_ctx_init(TALLOC_CTX *mem_ctx, cctx->slot = PK11_GetBestSlot(mech_props->cipher, NULL); if (cctx->slot == NULL) { - DEBUG(1, ("Unable to find security device (err %d)\n", - PR_GetError())); + DEBUG(1, "Unable to find security device (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -194,8 +194,8 @@ static int nss_encrypt_decrypt_init(struct crypto_mech_data *mech_props, cctx->keyobj = PK11_ImportSymKey(cctx->slot, mech_props->cipher, PK11_OriginUnwrap, op, cctx->key, NULL); if (cctx->keyobj == NULL) { - DEBUG(1, ("Failure to import key into NSS (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to import key into NSS (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -203,8 +203,8 @@ static int nss_encrypt_decrypt_init(struct crypto_mech_data *mech_props, /* turn the raw IV into a initialization vector object */ cctx->sparam = PK11_ParamFromIV(mech_props->cipher, cctx->iv); if (cctx->sparam == NULL) { - DEBUG(1, ("Failure to set up PKCS11 param (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to set up PKCS11 param (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -213,8 +213,8 @@ static int nss_encrypt_decrypt_init(struct crypto_mech_data *mech_props, cctx->ectx = PK11_CreateContextBySymKey(mech_props->cipher, op, cctx->keyobj, cctx->sparam); if (cctx->ectx == NULL) { - DEBUG(1, ("Cannot create cipher context (err %d)\n", - PORT_GetError())); + DEBUG(1, "Cannot create cipher context (err %d)\n", + PORT_GetError()); ret = EIO; goto done; } @@ -265,26 +265,26 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, ret = nss_ctx_init(tmp_ctx, mech_props, &cctx); if (ret) { - DEBUG(1, ("Cannot initialize NSS context\n")); + DEBUG(1, "Cannot initialize NSS context\n"); goto done; } /* generate random encryption and IV key */ ret = generate_random_key(cctx, cctx->slot, mech_props, &cctx->key); if (ret != EOK) { - DEBUG(1, ("Could not generate encryption key\n")); + DEBUG(1, "Could not generate encryption key\n"); goto done; } ret = generate_random_key(cctx, cctx->slot, mech_props, &cctx->iv); if (ret != EOK) { - DEBUG(1, ("Could not generate initialization vector\n")); + DEBUG(1, "Could not generate initialization vector\n"); goto done; } ret = nss_encrypt_decrypt_init(mech_props, true, cctx); if (ret) { - DEBUG(1, ("Cannot initialize NSS context properties\n")); + DEBUG(1, "Cannot initialize NSS context properties\n"); goto done; } @@ -306,8 +306,8 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, sret = PK11_CipherOp(cctx->ectx, cryptotext, &ctlen, ct_maxsize, plaintext, plen); if (sret != SECSuccess) { - DEBUG(1, ("Cannot execute the encryption operation (err %d)\n", - PR_GetError())); + DEBUG(1, "Cannot execute the encryption operation (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -315,8 +315,8 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, sret = PK11_DigestFinal(cctx->ectx, cryptotext+ctlen, &digestlen, ct_maxsize-ctlen); if (sret != SECSuccess) { - DEBUG(1, ("Cannot execute the digest operation (err %d)\n", - PR_GetError())); + DEBUG(1, "Cannot execute the digest operation (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -340,9 +340,9 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, goto done; } - DEBUG(8, ("Writing method: %d\n", meth)); + DEBUG(8, "Writing method: %d\n", meth); SAFEALIGN_SET_UINT16(&obfbuf[p], meth, &p); - DEBUG(8, ("Writing bufsize: %d\n", result_len)); + DEBUG(8, "Writing bufsize: %d\n", result_len); SAFEALIGN_SET_UINT16(&obfbuf[p], result_len, &p); safealign_memcpy(&obfbuf[p], cctx->key->data, mech_props->keylen, &p); safealign_memcpy(&obfbuf[p], cctx->iv->data, mech_props->bsize, &p); @@ -409,9 +409,9 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, /* unpack obfuscation buffer */ SAFEALIGN_COPY_UINT16_CHECK(&meth, obfbuf+p, obflen, &p); - DEBUG(8, ("Read method: %d\n", meth)); + DEBUG(8, "Read method: %d\n", meth); SAFEALIGN_COPY_UINT16_CHECK(&ctsize, obfbuf+p, obflen, &p); - DEBUG(8, ("Read bufsize: %d\n", ctsize)); + DEBUG(8, "Read bufsize: %d\n", ctsize); mech_props = get_crypto_mech_data(meth); if (mech_props == NULL) { @@ -424,7 +424,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(0, ("Obfuscation buffer seems corrupt, aborting\n")); + DEBUG(0, "Obfuscation buffer seems corrupt, aborting\n"); ret = EFAULT; goto done; } @@ -453,7 +453,7 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, ret = nss_ctx_init(tmp_ctx, mech_props, &cctx); if (ret) { - DEBUG(1, ("Cannot initialize NSS context\n")); + DEBUG(1, "Cannot initialize NSS context\n"); goto done; } @@ -481,8 +481,8 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, sret = PK11_CipherOp(cctx->ectx, (unsigned char *) pwdbuf, &plainlen, ctsize, cryptotext, ctsize); if (sret != SECSuccess) { - DEBUG(1, ("Cannot execute the encryption operation (err %d)\n", - PR_GetError())); + DEBUG(1, "Cannot execute the encryption operation (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -490,8 +490,8 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, sret = PK11_DigestFinal(cctx->ectx, (unsigned char *) pwdbuf+plainlen, &digestlen, ctsize - plainlen); if (sret != SECSuccess) { - DEBUG(1, ("Cannot execute the encryption operation (err %d)\n", - PR_GetError())); + DEBUG(1, "Cannot execute the encryption operation (err %d)\n", + PR_GetError()); ret = EIO; goto done; } diff --git a/src/util/crypto/nss/nss_util.c b/src/util/crypto/nss/nss_util.c index 9a272ca92..e93bf206d 100644 --- a/src/util/crypto/nss/nss_util.c +++ b/src/util/crypto/nss/nss_util.c @@ -46,8 +46,8 @@ int nspr_nss_init(void) sret = NSS_NoDB_Init(NULL); if (sret != SECSuccess) { - DEBUG(1, ("Error initializing connection to NSS [%d]\n", - PR_GetError())); + DEBUG(1, "Error initializing connection to NSS [%d]\n", + PR_GetError()); return EIO; } @@ -64,8 +64,8 @@ int nspr_nss_cleanup(void) sret = NSS_Shutdown(); if (sret != SECSuccess) { - DEBUG(1, ("Error shutting down connection to NSS [%d]\n", - PR_GetError())); + DEBUG(1, "Error shutting down connection to NSS [%d]\n", + PR_GetError()); return EIO; } diff --git a/src/util/debug.c b/src/util/debug.c index 4c49dc662..278cd87ce 100644 --- a/src/util/debug.c +++ b/src/util/debug.c @@ -50,7 +50,7 @@ errno_t set_debug_file_from_fd(const int fd) dummy = fdopen(fd, "a"); if (dummy == NULL) { ret = errno; - DEBUG(1, ("fdopen failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "fdopen failed [%d][%s].\n", ret, strerror(ret)); sss_log(SSS_LOG_ERR, "Could not open debug file descriptor [%d]. " "Debug messages will not be written to the file " @@ -323,5 +323,5 @@ int rotate_debug_files(void) void talloc_log_fn(const char *message) { - DEBUG(SSSDBG_FATAL_FAILURE, ("%s", message)); + DEBUG(SSSDBG_FATAL_FAILURE, "%s", message); } diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c index 50b5f06f5..b41864432 100644 --- a/src/util/domain_info_utils.c +++ b/src/util/domain_info_utils.c @@ -68,7 +68,7 @@ bool subdomain_enumerates(struct sss_domain_info *parent, if (parent->sd_enumerate == NULL || parent->sd_enumerate[0] == NULL) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Subdomain_enumerate not set\n")); + "Subdomain_enumerate not set\n"); return false; } @@ -165,15 +165,15 @@ find_subdomain_by_object_name(struct sss_domain_info *domain, tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_new() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n"); return NULL; } ret = sss_parse_name(tmp_ctx, domain->names, object_name, &domainname, &name); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to parse name '%s' [%d]: %s\n", - object_name, ret, sss_strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to parse name '%s' [%d]: %s\n", + object_name, ret, sss_strerror(ret)); goto done; } @@ -201,37 +201,37 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom; DEBUG(SSSDBG_TRACE_FUNC, - ("Creating [%s] as subdomain of [%s]!\n", name, parent->name)); + "Creating [%s] as subdomain of [%s]!\n", name, parent->name); dom = talloc_zero(mem_ctx, struct sss_domain_info); if (dom == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("talloc_zero failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "talloc_zero failed.\n"); return NULL; } dom->parent = parent; dom->name = talloc_strdup(dom, name); if (dom->name == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to copy domain name.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to copy domain name.\n"); goto fail; } dom->provider = talloc_strdup(dom, parent->provider); if (dom->provider == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to copy provider name.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to copy provider name.\n"); goto fail; } dom->conn_name = talloc_strdup(dom, parent->conn_name); if (dom->conn_name == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to copy connection name.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to copy connection name.\n"); goto fail; } if (realm != NULL) { dom->realm = talloc_strdup(dom, realm); if (dom->realm == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to copy realm name.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to copy realm name.\n"); goto fail; } } @@ -239,7 +239,7 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, if (flat_name != NULL) { dom->flat_name = talloc_strdup(dom, flat_name); if (dom->flat_name == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to copy flat name.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to copy flat name.\n"); goto fail; } } @@ -247,7 +247,7 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, if (id != NULL) { dom->domain_id = talloc_strdup(dom, id); if (dom->domain_id == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to copy id.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to copy id.\n"); goto fail; } } @@ -255,7 +255,7 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, if (forest != NULL) { dom->forest = talloc_strdup(dom, forest); if (dom->forest == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to copy forest.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to copy forest.\n"); goto fail; } } @@ -284,7 +284,7 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, dom->default_shell = parent->default_shell; if (parent->sysdb == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Missing sysdb context in parent domain.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Missing sysdb context in parent domain.\n"); goto fail; } dom->sysdb = parent->sysdb; @@ -308,18 +308,18 @@ errno_t sssd_domain_init(TALLOC_CTX *mem_ctx, ret = confdb_get_domain(cdb, domain_name, &dom); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Error retrieving domain configuration.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Error retrieving domain configuration.\n"); return ret; } if (dom->sysdb != NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Sysdb context already initialized.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Sysdb context already initialized.\n"); return EEXIST; } ret = sysdb_domain_init(mem_ctx, dom, db_path, &sysdb); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Error opening cache database.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Error opening cache database.\n"); return ret; } @@ -344,8 +344,8 @@ sss_krb5_touch_config(void) ret = utime(config, NULL); if (ret == -1) { ret = errno; - DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to change mtime of \"%s\" " - "[%d]: %s\n", config, ret, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to change mtime of \"%s\" " + "[%d]: %s\n", config, ret, strerror(ret)); return ret; } @@ -372,7 +372,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) char *uc_parent; if (domain == NULL || domain->name == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("No domain name provided\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "No domain name provided\n"); return EINVAL; } @@ -381,7 +381,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) sanitized_domain = talloc_strdup(tmp_ctx, domain->name); if (sanitized_domain == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_strdup() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup() failed\n"); return ENOMEM; } @@ -401,8 +401,8 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) goto done; } - DEBUG(SSSDBG_FUNC_DATA, ("Mapping file for domain [%s] is [%s]\n", - domain->name, mapping_file)); + DEBUG(SSSDBG_FUNC_DATA, "Mapping file for domain [%s] is [%s]\n", + domain->name, mapping_file); tmp_file = talloc_asprintf(tmp_ctx, "%sXXXXXX", mapping_file); if (tmp_file == NULL) { @@ -414,8 +414,8 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) fd = mkstemp(tmp_file); umask(old_mode); if (fd < 0) { - DEBUG(SSSDBG_OP_FAILURE, ("creating the temp file [%s] for domain-realm " - "mappings failed.", tmp_file)); + DEBUG(SSSDBG_OP_FAILURE, "creating the temp file [%s] for domain-realm " + "mappings failed.", tmp_file); ret = EIO; talloc_zfree(tmp_ctx); goto done; @@ -424,13 +424,13 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) fstream = fdopen(fd, "a"); if (!fstream) { ret = errno; - DEBUG(SSSDBG_OP_FAILURE, ("fdopen failed [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "fdopen failed [%d]: %s\n", + ret, strerror(ret)); ret = close(fd); if (ret != 0) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("fclose failed [%d][%s].\n", ret, strerror(ret))); + "fclose failed [%d][%s].\n", ret, strerror(ret)); /* Nothing to do here, just report the failure */ } ret = EIO; @@ -439,7 +439,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) ret = fprintf(fstream, "[domain_realm]\n"); if (ret < 0) { - DEBUG(SSSDBG_OP_FAILURE, ("fprintf failed\n")); + DEBUG(SSSDBG_OP_FAILURE, "fprintf failed\n"); ret = EIO; goto done; } @@ -450,7 +450,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) ret = fprintf(fstream, ".%s = %s\n%s = %s\n", dom->name, dom->realm, dom->name, dom->realm); if (ret < 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("fprintf failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "fprintf failed\n"); goto done; } } @@ -460,7 +460,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) parent_dom = domain; uc_parent = get_uppercase_realm(tmp_ctx, parent_dom->name); if (uc_parent == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("get_uppercase_realm failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "get_uppercase_realm failed.\n"); ret = ENOMEM; goto done; } @@ -475,7 +475,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) uc_forest = get_uppercase_realm(tmp_ctx, dom->forest); if (uc_forest == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("get_uppercase_realm failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "get_uppercase_realm failed.\n"); ret = ENOMEM; goto done; } @@ -483,7 +483,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) if (!capaths_started) { ret = fprintf(fstream, "[capaths]\n"); if (ret < 0) { - DEBUG(SSSDBG_OP_FAILURE, ("fprintf failed\n")); + DEBUG(SSSDBG_OP_FAILURE, "fprintf failed\n"); ret = EIO; goto done; } @@ -494,7 +494,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) dom->realm, uc_parent, uc_forest, uc_parent, dom->realm, uc_forest); if (ret < 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("fprintf failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "fprintf failed\n"); goto done; } } @@ -505,7 +505,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) if (ret != 0) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("fclose failed [%d][%s].\n", ret, strerror(ret))); + "fclose failed [%d][%s].\n", ret, strerror(ret)); goto done; } @@ -513,7 +513,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) if (ret == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("rename failed [%d][%s].\n", ret, strerror(ret))); + "rename failed [%d][%s].\n", ret, strerror(ret)); goto done; } @@ -523,7 +523,7 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) if (ret == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("fchmod failed [%d][%s].\n", ret, strerror(ret))); + "fchmod failed [%d][%s].\n", ret, strerror(ret)); goto done; } @@ -531,8 +531,8 @@ sss_write_domain_mappings(struct sss_domain_info *domain, bool add_capaths) done: err = sss_krb5_touch_config(); if (err != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to change last modification time " - "of krb5.conf. Created mappings may not be loaded.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to change last modification time " + "of krb5.conf. Created mappings may not be loaded.\n"); /* Ignore */ } @@ -541,7 +541,7 @@ done: if (err != 0) { err = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("fclose failed [%d][%s].\n", err, strerror(err))); + "fclose failed [%d][%s].\n", err, strerror(err)); /* Nothing to do here, just report the failure */ } } @@ -551,8 +551,8 @@ done: if (err < 0) { err = errno; DEBUG(SSSDBG_MINOR_FAILURE, - ("Could not remove file [%s]: [%d]: %s", - tmp_file, err, strerror(err))); + "Could not remove file [%s]: [%d]: %s", + tmp_file, err, strerror(err)); } } talloc_free(tmp_ctx); diff --git a/src/util/find_uid.c b/src/util/find_uid.c index 91ee7f685..919486a9d 100644 --- a/src/util/find_uid.c +++ b/src/util/find_uid.c @@ -74,10 +74,10 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid) ret = snprintf(path, PATHLEN, "/proc/%d/status", pid); if (ret < 0) { - DEBUG(1, ("snprintf failed")); + DEBUG(1, "snprintf failed"); return EINVAL; } else if (ret >= PATHLEN) { - DEBUG(1, ("path too long?!?!\n")); + DEBUG(1, "path too long?!?!\n"); return EINVAL; } @@ -85,11 +85,11 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid) if (fd == -1) { error = errno; if (error == ENOENT) { - DEBUG(7, ("Proc file [%s] is not available anymore, continuing.\n", - path)); + DEBUG(7, "Proc file [%s] is not available anymore, continuing.\n", + path); return EOK; } - DEBUG(1, ("open failed [%d][%s].\n", error, strerror(error))); + DEBUG(1, "open failed [%d][%s].\n", error, strerror(error)); return error; } @@ -97,17 +97,17 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid) if (ret == -1) { error = errno; if (error == ENOENT) { - DEBUG(7, ("Proc file [%s] is not available anymore, continuing.\n", - path)); + DEBUG(7, "Proc file [%s] is not available anymore, continuing.\n", + path); error = EOK; goto fail_fd; } - DEBUG(1, ("fstat failed [%d][%s].\n", error, strerror(error))); + DEBUG(1, "fstat failed [%d][%s].\n", error, strerror(error)); goto fail_fd; } if (!S_ISREG(stat_buf.st_mode)) { - DEBUG(1, ("not a regular file\n")); + DEBUG(1, "not a regular file\n"); error = EINVAL; goto fail_fd; } @@ -117,7 +117,7 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid) if (ret == -1) { error = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("read failed [%d][%s].\n", error, strerror(error))); + "read failed [%d][%s].\n", error, strerror(error)); goto fail_fd; } @@ -127,7 +127,7 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid) ret = close(fd); if (ret == -1) { error = errno; - DEBUG(1, ("close failed [%d][%s].\n", error, strerror(error))); + DEBUG(1, "close failed [%d][%s].\n", error, strerror(error)); } p = strstr(buf, "\nUid:\t"); @@ -135,7 +135,7 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid) p += 6; e = strchr(p,'\t'); if (e == NULL) { - DEBUG(1, ("missing delimiter.\n")); + DEBUG(1, "missing delimiter.\n"); return EINVAL; } else { *e = '\0'; @@ -143,16 +143,16 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid) num = (uint32_t) strtoint32(p, &endptr, 10); error = errno; if (error != 0) { - DEBUG(1, ("strtol failed [%s].\n", strerror(error))); + DEBUG(1, "strtol failed [%s].\n", strerror(error)); return error; } if (*endptr != '\0') { - DEBUG(1, ("uid contains extra characters\n")); + DEBUG(1, "uid contains extra characters\n"); return EINVAL; } } else { - DEBUG(1, ("format error\n")); + DEBUG(1, "format error\n"); return EINVAL; } @@ -180,12 +180,12 @@ static errno_t name_to_pid(const char *name, pid_t *pid) } if (*endptr != '\0') { - DEBUG(1, ("pid string contains extra characters.\n")); + DEBUG(1, "pid string contains extra characters.\n"); return EINVAL; } if (num <= 0 || num >= INT_MAX) { - DEBUG(1, ("pid out of range.\n")); + DEBUG(1, "pid out of range.\n"); return ERANGE; } @@ -214,7 +214,7 @@ static errno_t get_active_uid_linux(hash_table_t *table, uid_t search_uid) proc_dir = opendir("/proc"); if (proc_dir == NULL) { ret = errno; - DEBUG(1, ("Cannot open proc dir.\n")); + DEBUG(1, "Cannot open proc dir.\n"); goto done; }; @@ -223,13 +223,13 @@ static errno_t get_active_uid_linux(hash_table_t *table, uid_t search_uid) if (only_numbers(dirent->d_name) != 0) continue; ret = name_to_pid(dirent->d_name, &pid); if (ret != EOK) { - DEBUG(1, ("name_to_pid failed.\n")); + DEBUG(1, "name_to_pid failed.\n"); goto done; } ret = get_uid_from_pid(pid, &uid); if (ret != EOK) { - DEBUG(1, ("get_uid_from_pid failed.\n")); + DEBUG(1, "get_uid_from_pid failed.\n"); goto done; } @@ -241,7 +241,7 @@ static errno_t get_active_uid_linux(hash_table_t *table, uid_t search_uid) ret = hash_enter(table, &key, &value); if (ret != HASH_SUCCESS) { - DEBUG(1, ("cannot add to table [%s]\n", hash_error_string(ret))); + DEBUG(1, "cannot add to table [%s]\n", hash_error_string(ret)); ret = ENOMEM; goto done; } @@ -257,14 +257,14 @@ static errno_t get_active_uid_linux(hash_table_t *table, uid_t search_uid) } if (errno != 0 && dirent == NULL) { ret = errno; - DEBUG(1, ("readdir failed.\n")); + DEBUG(1, "readdir failed.\n"); goto done; } ret = closedir(proc_dir); proc_dir = NULL; if (ret == -1) { - DEBUG(1, ("closedir failed, watch out.\n")); + DEBUG(1, "closedir failed, watch out.\n"); } if (table != NULL) { @@ -277,7 +277,7 @@ done: if (proc_dir != NULL) { err = closedir(proc_dir); if (err) { - DEBUG(1, ("closedir failed, bad dirp?\n")); + DEBUG(1, "closedir failed, bad dirp?\n"); } } return ret; @@ -292,7 +292,7 @@ errno_t get_uid_table(TALLOC_CTX *mem_ctx, hash_table_t **table) hash_talloc, hash_talloc_free, mem_ctx, NULL, NULL); if (ret != HASH_SUCCESS) { - DEBUG(1, ("hash_create_ex failed [%s]\n", hash_error_string(ret))); + DEBUG(1, "hash_create_ex failed [%s]\n", hash_error_string(ret)); return ENOMEM; } @@ -316,15 +316,15 @@ errno_t check_if_uid_is_active(uid_t uid, bool *result) *result = false; } if (ret < 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("systemd-login gave error %d: %s\n", - -ret, strerror(-ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "systemd-login gave error %d: %s\n", + -ret, strerror(-ret)); } /* fall back to the old method */ #endif ret = get_active_uid_linux(NULL, uid); if (ret != EOK && ret != ENOENT) { - DEBUG(1, ("get_uid_table failed.\n")); + DEBUG(1, "get_uid_table failed.\n"); return ret; } diff --git a/src/util/nscd.c b/src/util/nscd.c index 6c9cc7761..e73c3fa6c 100644 --- a/src/util/nscd.c +++ b/src/util/nscd.c @@ -49,7 +49,7 @@ int flush_nscd_cache(enum nscd_db flush_db) break; default: - DEBUG(1, ("Unknown nscd database\n")); + DEBUG(1, "Unknown nscd database\n"); ret = EINVAL; goto done; } @@ -59,10 +59,10 @@ int flush_nscd_cache(enum nscd_db flush_db) case 0: execl(NSCD_PATH, "nscd", NSCD_RELOAD_ARG, service, NULL); /* if this returns it is an error */ - DEBUG(1, ("execl(3) failed: %d(%s)\n", errno, strerror(errno))); + DEBUG(1, "execl(3) failed: %d(%s)\n", errno, strerror(errno)); exit(errno); case -1: - DEBUG(1, ("fork failed\n")); + DEBUG(1, "fork failed\n"); ret = EFAULT; break; default: @@ -76,11 +76,11 @@ int flush_nscd_cache(enum nscd_db flush_db) if (ret > 0) { /* The flush fails if nscd is not running, so do not care * about the return code */ - DEBUG(8, ("Error flushing cache, is nscd running?\n")); + DEBUG(8, "Error flushing cache, is nscd running?\n"); } } } else { - DEBUG(5, ("Failed to wait for children %d\n", nscd_pid)); + DEBUG(5, "Failed to wait for children %d\n", nscd_pid); ret = EIO; } } @@ -140,8 +140,8 @@ errno_t sss_nscd_parse_conf(const char *conf_path) fp = fopen(conf_path, "r"); if (fp == NULL) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Couldn't open NSCD configuration " - "file [%s]\n", NSCD_CONF_PATH)); + DEBUG(SSSDBG_MINOR_FAILURE, "Couldn't open NSCD configuration " + "file [%s]\n", NSCD_CONF_PATH); return ENOENT; } @@ -196,9 +196,9 @@ errno_t sss_nscd_parse_conf(const char *conf_path) ret = ferror(fp); if (ret) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Reading NSCD configuration file [%s] " + DEBUG(SSSDBG_MINOR_FAILURE, "Reading NSCD configuration file [%s] " "ended with failure [%d]: %s.\n", - NSCD_CONF_PATH, ret, strerror(ret))); + NSCD_CONF_PATH, ret, strerror(ret)); ret = ENOENT; goto done; } diff --git a/src/util/server.c b/src/util/server.c index b2fad1168..24c3548ed 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -57,11 +57,11 @@ static void close_low_fds(void) if (fd < 0) fd = open("/dev/null", O_WRONLY, 0); if (fd < 0) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Can't open /dev/null\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "Can't open /dev/null\n"); return; } if (fd != i) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Didn't get file descriptor %d\n",i)); + DEBUG(SSSDBG_FATAL_FAILURE, "Didn't get file descriptor %d\n",i); return; } } @@ -101,8 +101,8 @@ void become_daemon(bool Fork) error = errno; if (error != EINTR) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Error [%d][%s] while waiting for child\n", - error, strerror(error))); + "Error [%d][%s] while waiting for child\n", + error, strerror(error)); /* Forcibly kill this child */ kill(pid, SIGKILL); ret = 1; @@ -130,8 +130,8 @@ void become_daemon(bool Fork) errno = 0; if(chdir("/") == -1) { ret = errno; - DEBUG(SSSDBG_FATAL_FAILURE, ("Cannot change directory (%d [%s])\n", - ret, strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Cannot change directory (%d [%s])\n", + ret, strerror(ret)); return; } @@ -164,7 +164,7 @@ int pidfile(const char *path, const char *name) ret = errno; if (len == -1) { DEBUG(SSSDBG_CRIT_FAILURE, - ("read failed [%d][%s].\n", ret, strerror(ret))); + "read failed [%d][%s].\n", ret, strerror(ret)); close(fd); talloc_free(file); return EINVAL; @@ -220,14 +220,14 @@ int pidfile(const char *path, const char *name) if (written == -1) { err = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("write failed [%d][%s]\n", err, strerror(err))); + "write failed [%d][%s]\n", err, strerror(err)); close(fd); return err; } if (written != size) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Wrote %zd bytes expected %zu\n", written, size)); + "Wrote %zd bytes expected %zu\n", written, size); close(fd); return EIO; } @@ -242,7 +242,7 @@ void orderly_shutdown(int status) #if HAVE_GETPGRP static int sent_sigterm; if (sent_sigterm == 0 && getpgrp() == getpid()) { - DEBUG(SSSDBG_FATAL_FAILURE, ("SIGTERM: killing children\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "SIGTERM: killing children\n"); sent_sigterm = 1; kill(-getpgrp(), SIGTERM); } @@ -265,7 +265,7 @@ static void default_quit(struct tevent_context *ev, static void sig_segv_abrt(int sig) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Received signal %s, shutting down\n", strsignal(sig))); + "Received signal %s, shutting down\n", strsignal(sig)); orderly_shutdown(1); } #endif /* HAVE_PRCTL */ @@ -320,8 +320,8 @@ static void server_stdin_handler(struct tevent_context *event_ctx, errno = 0; if (sss_atomic_read_s(0, &c, 1) == 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("%s: EOF on stdin - terminating\n", - binary_name)); + DEBUG(SSSDBG_CRIT_FAILURE, "%s: EOF on stdin - terminating\n", + binary_name); #if HAVE_GETPGRP if (getpgrp() == getpid()) { kill(-getpgrp(), SIGTERM); @@ -344,8 +344,8 @@ int die_if_parent_died(void) ret = prctl(PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0); if (ret != 0) { ret = errno; - DEBUG(SSSDBG_OP_FAILURE, ("prctl failed [%d]: %s", - ret, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "prctl failed [%d]: %s", + ret, strerror(ret)); return ret; } #endif @@ -368,12 +368,12 @@ static void te_server_hup(struct tevent_context *ev, struct logrotate_ctx *lctx = talloc_get_type(private_data, struct logrotate_ctx); - DEBUG(SSSDBG_CRIT_FAILURE, ("Received SIGHUP. Rotating logfiles.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Received SIGHUP. Rotating logfiles.\n"); ret = monitor_common_rotate_logs(lctx->confdb, lctx->confdb_path); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Could not reopen log file [%s]\n", - strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Could not reopen log file [%s]\n", + strerror(ret)); } } @@ -404,8 +404,8 @@ int server_setup(const char *name, int flags, * value after reading domain from the configuration */ ret = unsetenv(SSS_DOM_ENV); if (ret != 0) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Unsetting "SSS_DOM_ENV" failed, journald " - "logging mightnot work as expected\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Unsetting "SSS_DOM_ENV" failed, journald " + "logging mightnot work as expected\n"); } setup_signals(); @@ -415,15 +415,15 @@ int server_setup(const char *name, int flags, umask(0177); if (flags & FLAGS_DAEMON) { - DEBUG(SSSDBG_IMPORTANT_INFO, ("Becoming a daemon.\n")); + DEBUG(SSSDBG_IMPORTANT_INFO, "Becoming a daemon.\n"); become_daemon(true); } if (flags & FLAGS_PID_FILE) { ret = pidfile(PID_PATH, name); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Error creating pidfile: %s/%s! " - "(%d [%s])\n", PID_PATH, name, ret, strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Error creating pidfile: %s/%s! " + "(%d [%s])\n", PID_PATH, name, ret, strerror(ret)); return ret; } } @@ -438,7 +438,7 @@ int server_setup(const char *name, int flags, event_ctx = tevent_context_init(talloc_autofree_context()); if (event_ctx == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, - ("The event context initialiaziton failed\n")); + "The event context initialiaziton failed\n"); return 1; } @@ -458,7 +458,7 @@ int server_setup(const char *name, int flags, ctx = talloc(event_ctx, struct main_context); if (ctx == NULL) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Out of memory, aborting!\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory, aborting!\n"); return ENOMEM; } @@ -467,13 +467,13 @@ int server_setup(const char *name, int flags, conf_db = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE); if (conf_db == NULL) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Out of memory, aborting!\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory, aborting!\n"); return ENOMEM; } ret = confdb_init(ctx, &ctx->confdb_ctx, conf_db); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("The confdb initialization failed\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "The confdb initialization failed\n"); return ret; } @@ -484,8 +484,8 @@ int server_setup(const char *name, int flags, SSSDBG_DEFAULT, &debug_level); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Error reading from confdb (%d) " - "[%s]\n", ret, strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) " + "[%s]\n", ret, strerror(ret)); return ret; } @@ -499,8 +499,8 @@ int server_setup(const char *name, int flags, SSSDBG_TIMESTAMP_DEFAULT, &dt); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Error reading from confdb (%d) " - "[%s]\n", ret, strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) " + "[%s]\n", ret, strerror(ret)); return ret; } if (dt) debug_timestamps = 1; @@ -514,8 +514,8 @@ int server_setup(const char *name, int flags, SSSDBG_MICROSECONDS_DEFAULT, &dm); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Error reading from confdb (%d) " - "[%s]\n", ret, strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) " + "[%s]\n", ret, strerror(ret)); return ret; } if (dm) debug_microseconds = 1; @@ -528,8 +528,8 @@ int server_setup(const char *name, int flags, CONFDB_SERVICE_DEBUG_TO_FILES, dl, &dl); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Error reading from confdb (%d) [%s]\n", - ret, strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n", + ret, strerror(ret)); return ret; } if (dl) debug_to_file = 1; @@ -551,15 +551,15 @@ int server_setup(const char *name, int flags, if (debug_to_file) { ret = open_debug_file(); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Error setting up logging (%d) " - "[%s]\n", ret, strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Error setting up logging (%d) " + "[%s]\n", ret, strerror(ret)); return ret; } } sss_log(SSS_LOG_INFO, "Starting up"); - DEBUG(SSSDBG_TRACE_FUNC, ("CONFDB: %s\n", conf_db)); + DEBUG(SSSDBG_TRACE_FUNC, "CONFDB: %s\n", conf_db); if (flags & FLAGS_INTERACTIVE) { /* terminate when stdin goes away */ diff --git a/src/util/signal.c b/src/util/signal.c index efbc918a9..23bdc46b7 100644 --- a/src/util/signal.c +++ b/src/util/signal.c @@ -49,7 +49,7 @@ void BlockSignals(bool block, int signum) /* yikes! This platform can't block signals? */ static int done; if (!done) { - DEBUG(0,("WARNING: No signal blocking available\n")); + DEBUG(0,"WARNING: No signal blocking available\n"); done=1; } #endif diff --git a/src/util/sss_ini.c b/src/util/sss_ini.c index 9f23500ab..ce0d06755 100644 --- a/src/util/sss_ini.c +++ b/src/util/sss_ini.c @@ -193,7 +193,7 @@ void sss_ini_config_print_errors(char **error_list) } while (error_list[count]) { - DEBUG(SSSDBG_CRIT_FAILURE, ("%s\n", error_list[count])); + DEBUG(SSSDBG_CRIT_FAILURE, "%s\n", error_list[count]); count++; } #endif @@ -215,7 +215,7 @@ int sss_ini_get_config(struct sss_ini_initdata *init_data, ret = ini_config_create(&(init_data->sssd_config)); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Failed to create config object. Error %d.\n", ret)); + "Failed to create config object. Error %d.\n", ret); return ret; } @@ -228,12 +228,12 @@ int sss_ini_get_config(struct sss_ini_initdata *init_data, if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Failed to parse configuration. Error %d.\n", ret)); + "Failed to parse configuration. Error %d.\n", ret); if (ini_config_error_count(init_data->sssd_config)) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Errors detected while parsing: %s\n", - ini_config_get_filename(init_data->file))); + "Errors detected while parsing: %s\n", + ini_config_get_filename(init_data->file)); ini_config_get_errors(init_data->sssd_config, &init_data->error_list); @@ -259,8 +259,8 @@ int sss_ini_get_config(struct sss_ini_initdata *init_data, if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Parse error reading configuration file [%s]\n", - config_file)); + "Parse error reading configuration file [%s]\n", + config_file); print_file_parsing_errors(stderr, init_data->error_list); @@ -382,7 +382,7 @@ int sss_confdb_create_ldif(TALLOC_CTX *mem_ctx, for (i = 0; i < section_count; i++) { const char *rdn = NULL; DEBUG(SSSDBG_TRACE_FUNC, - ("Processing config section [%s]\n", sections[i])); + "Processing config section [%s]\n", sections[i]); ret = parse_section(tmp_ctx, sections[i], &sec_dn, &rdn); if (ret != EOK) { goto error; @@ -409,7 +409,7 @@ int sss_confdb_create_ldif(TALLOC_CTX *mem_ctx, for (j = 0; j < attr_count; j++) { DEBUG(SSSDBG_TRACE_FUNC, - ("Processing attribute [%s]\n", attrs[j])); + "Processing attribute [%s]\n", attrs[j]); ret = sss_ini_get_config_obj(sections[i], attrs[j], init_data->sssd_config, INI_GET_FIRST_VALUE, &obj); @@ -419,14 +419,14 @@ int sss_confdb_create_ldif(TALLOC_CTX *mem_ctx, if (ret != EOK) goto error; if (value && value[0] == '\0') { DEBUG(SSSDBG_CRIT_FAILURE, - ("Attribute '%s' has empty value, ignoring\n", - attrs[j])); + "Attribute '%s' has empty value, ignoring\n", + attrs[j]); continue; } ldif_attr = talloc_asprintf(tmp_ctx, "%s: %s\n", attrs[j], value); - DEBUG(SSSDBG_TRACE_ALL, ("%s", ldif_attr)); + DEBUG(SSSDBG_TRACE_ALL, "%s", ldif_attr); attr_len = strlen(ldif_attr); @@ -456,7 +456,7 @@ int sss_confdb_create_ldif(TALLOC_CTX *mem_ctx, dn[dn_size-1] = '\n'; dn[dn_size] = '\0'; - DEBUG(SSSDBG_TRACE_ALL, ("Section dn\n%s", dn)); + DEBUG(SSSDBG_TRACE_ALL, "Section dn\n%s", dn); tmp_ldif = talloc_realloc(mem_ctx, ldif, char, ldif_len+dn_size+1); diff --git a/src/util/sss_krb5.c b/src/util/sss_krb5.c index a9be8242e..e2efbc323 100644 --- a/src/util/sss_krb5.c +++ b/src/util/sss_krb5.c @@ -94,16 +94,16 @@ errno_t select_principal_from_keytab(TALLOC_CTX *mem_ctx, const char *realm_patterns[] = {"%s", "%s", "%s", "%s", "%s", NULL, NULL}; - DEBUG(5, ("trying to select the most appropriate principal from keytab\n")); + DEBUG(5, "trying to select the most appropriate principal from keytab\n"); tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { - DEBUG(1, ("talloc_new failed\n")); + DEBUG(1, "talloc_new failed\n"); return ENOMEM; } kerr = krb5_init_context(&krb_ctx); if (kerr) { - DEBUG(2, ("Failed to init kerberos context\n")); + DEBUG(2, "Failed to init kerberos context\n"); ret = EFAULT; goto done; } @@ -115,9 +115,9 @@ errno_t select_principal_from_keytab(TALLOC_CTX *mem_ctx, } if (kerr) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Failed to read keytab [%s]: %s\n", + "Failed to read keytab [%s]: %s\n", KEYTAB_CLEAN_NAME, - sss_krb5_get_error_message(krb_ctx, kerr))); + sss_krb5_get_error_message(krb_ctx, kerr)); ret = EFAULT; goto done; } @@ -167,7 +167,7 @@ errno_t select_principal_from_keytab(TALLOC_CTX *mem_ctx, if (_principal) { kerr = krb5_unparse_name(krb_ctx, client_princ, &principal_string); if (kerr) { - DEBUG(1, ("krb5_unparse_name failed")); + DEBUG(1, "krb5_unparse_name failed"); ret = EFAULT; goto done; } @@ -175,11 +175,11 @@ errno_t select_principal_from_keytab(TALLOC_CTX *mem_ctx, *_principal = talloc_strdup(mem_ctx, principal_string); free(principal_string); if (!*_principal) { - DEBUG(1, ("talloc_strdup failed")); + DEBUG(1, "talloc_strdup failed"); ret = ENOMEM; goto done; } - DEBUG(5, ("Selected principal: %s\n", *_principal)); + DEBUG(5, "Selected principal: %s\n", *_principal); } if (_primary) { @@ -187,7 +187,7 @@ errno_t select_principal_from_keytab(TALLOC_CTX *mem_ctx, KRB5_PRINCIPAL_UNPARSE_NO_REALM, &principal_string); if (kerr) { - DEBUG(1, ("krb5_unparse_name failed")); + DEBUG(1, "krb5_unparse_name failed"); ret = EFAULT; goto done; } @@ -195,12 +195,12 @@ errno_t select_principal_from_keytab(TALLOC_CTX *mem_ctx, *_primary = talloc_strdup(mem_ctx, principal_string); free(principal_string); if (!*_primary) { - DEBUG(1, ("talloc_strdup failed")); + DEBUG(1, "talloc_strdup failed"); if (_principal) talloc_zfree(*_principal); ret = ENOMEM; goto done; } - DEBUG(5, ("Selected primary: %s\n", *_primary)); + DEBUG(5, "Selected primary: %s\n", *_primary); } if (_realm) { @@ -210,18 +210,18 @@ errno_t select_principal_from_keytab(TALLOC_CTX *mem_ctx, *_realm = talloc_asprintf(mem_ctx, "%.*s", realm_len, realm_name); if (!*_realm) { - DEBUG(1, ("talloc_asprintf failed")); + DEBUG(1, "talloc_asprintf failed"); if (_principal) talloc_zfree(*_principal); if (_primary) talloc_zfree(*_primary); ret = ENOMEM; goto done; } - DEBUG(5, ("Selected realm: %s\n", *_realm)); + DEBUG(5, "Selected realm: %s\n", *_realm); } ret = EOK; } else { - DEBUG(3, ("No suitable principal found in keytab\n")); + DEBUG(3, "No suitable principal found in keytab\n"); ret = ENOENT; } @@ -248,7 +248,7 @@ int sss_krb5_verify_keytab_ex(const char *principal, const char *keytab_name, krberr = krb5_kt_start_seq_get(context, keytab, &cursor); if (krberr) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Cannot read keytab [%s].\n", KEYTAB_CLEAN_NAME)); + "Cannot read keytab [%s].\n", KEYTAB_CLEAN_NAME); sss_log(SSS_LOG_ERR, "Error reading keytab file [%s]: [%d][%s]. " "Unable to create GSSAPI-encrypted LDAP " @@ -264,7 +264,7 @@ int sss_krb5_verify_keytab_ex(const char *principal, const char *keytab_name, krberr = krb5_unparse_name(context, entry.principal, &kt_principal); if (krberr) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Could not parse keytab entry\n")); + "Could not parse keytab entry\n"); sss_log(SSS_LOG_ERR, "Could not parse keytab entry\n"); return EIO; } @@ -278,7 +278,7 @@ int sss_krb5_verify_keytab_ex(const char *principal, const char *keytab_name, /* This should never happen. The API docs for this function * specify only success for this function */ - DEBUG(1,("Could not free keytab entry contents\n")); + DEBUG(1,"Could not free keytab entry contents\n"); /* This is non-fatal, so we'll continue here */ } @@ -289,7 +289,7 @@ int sss_krb5_verify_keytab_ex(const char *principal, const char *keytab_name, krberr = krb5_kt_end_seq_get(context, keytab, &cursor); if (krberr) { - DEBUG(0, ("Could not close keytab.\n")); + DEBUG(0, "Could not close keytab.\n"); sss_log(SSS_LOG_ERR, "Could not close keytab file [%s].", KEYTAB_CLEAN_NAME); return EIO; @@ -297,9 +297,9 @@ int sss_krb5_verify_keytab_ex(const char *principal, const char *keytab_name, if (!found) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Principal [%s] not found in keytab [%s]\n", + "Principal [%s] not found in keytab [%s]\n", principal, - KEYTAB_CLEAN_NAME)); + KEYTAB_CLEAN_NAME); sss_log(SSS_LOG_ERR, "Error processing keytab file [%s]: " "Principal [%s] was not found. " "Unable to create GSSAPI-encrypted LDAP connection.", @@ -347,7 +347,7 @@ static bool match_principal(krb5_context ctx, tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { - DEBUG(1, ("talloc_new failed\n")); + DEBUG(1, "talloc_new failed\n"); return false; } @@ -381,8 +381,8 @@ static bool match_principal(krb5_context ctx, if (!pattern_realm || (realm_len == strlen(pattern_realm) && strncmp(realm_name, pattern_realm, realm_len) == 0)) { - DEBUG(7, ("Principal matched to the sample (%s@%s).\n", pattern_primary, - pattern_realm)); + DEBUG(7, "Principal matched to the sample (%s@%s).\n", pattern_primary, + pattern_realm); ret = true; } @@ -408,11 +408,11 @@ krb5_error_code find_principal_in_keytab(krb5_context ctx, memset(&cursor, 0, sizeof(cursor)); kerr = krb5_kt_start_seq_get(ctx, keytab, &cursor); if (kerr != 0) { - DEBUG(1, ("krb5_kt_start_seq_get failed.\n")); + DEBUG(1, "krb5_kt_start_seq_get failed.\n"); return kerr; } - DEBUG(9, ("Trying to find principal %s@%s in keytab.\n", pattern_primary, pattern_realm)); + DEBUG(9, "Trying to find principal %s@%s in keytab.\n", pattern_primary, pattern_realm); memset(&entry, 0, sizeof(entry)); while ((kt_err = krb5_kt_next_entry(ctx, keytab, &entry, &cursor)) == 0) { principal_found = match_principal(ctx, entry.principal, pattern_primary, pattern_realm); @@ -422,7 +422,7 @@ krb5_error_code find_principal_in_keytab(krb5_context ctx, kerr = sss_krb5_free_keytab_entry_contents(ctx, &entry); if (kerr != 0) { - DEBUG(1, ("Failed to free keytab entry.\n")); + DEBUG(1, "Failed to free keytab entry.\n"); } memset(&entry, 0, sizeof(entry)); } @@ -432,27 +432,27 @@ krb5_error_code find_principal_in_keytab(krb5_context ctx, * overwritten by other keytab calls, creating a leak. */ kerr = krb5_kt_end_seq_get(ctx, keytab, &cursor); if (kerr != 0) { - DEBUG(1, ("krb5_kt_end_seq_get failed.\n")); + DEBUG(1, "krb5_kt_end_seq_get failed.\n"); goto done; } if (!principal_found) { kerr = KRB5_KT_NOTFOUND; DEBUG(SSSDBG_TRACE_FUNC, - ("No principal matching %s@%s found in keytab.\n", - pattern_primary, pattern_realm)); + "No principal matching %s@%s found in keytab.\n", + pattern_primary, pattern_realm); goto done; } /* check if we got any errors from krb5_kt_next_entry */ if (kt_err != 0 && kt_err != KRB5_KT_END) { - DEBUG(1, ("Error while reading keytab.\n")); + DEBUG(1, "Error while reading keytab.\n"); goto done; } kerr = krb5_copy_principal(ctx, entry.principal, princ); if (kerr != 0) { - DEBUG(1, ("krb5_copy_principal failed.\n")); + DEBUG(1, "krb5_copy_principal failed.\n"); goto done; } @@ -461,7 +461,7 @@ krb5_error_code find_principal_in_keytab(krb5_context ctx, done: kerr_d = sss_krb5_free_keytab_entry_contents(ctx, &entry); if (kerr_d != 0) { - DEBUG(1, ("Failed to free keytab entry.\n")); + DEBUG(1, "Failed to free keytab entry.\n"); } return kerr; @@ -555,7 +555,7 @@ krb5_error_code KRB5_CALLCONV sss_krb5_get_init_creds_opt_set_expire_callback( #ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_EXPIRE_CALLBACK return krb5_get_init_creds_opt_set_expire_callback(context, opt, cb, data); #else - DEBUG(5, ("krb5_get_init_creds_opt_set_expire_callback not available.\n")); + DEBUG(5, "krb5_get_init_creds_opt_set_expire_callback not available.\n"); return 0; #endif } @@ -590,7 +590,7 @@ krb5_error_code KRB5_CALLCONV sss_krb5_get_init_creds_opt_set_fast_ccache_name( return krb5_get_init_creds_opt_set_fast_ccache_name(context, opt, fast_ccache_name); #else - DEBUG(5, ("krb5_get_init_creds_opt_set_fast_ccache_name not available.\n")); + DEBUG(5, "krb5_get_init_creds_opt_set_fast_ccache_name not available.\n"); return 0; #endif } @@ -603,7 +603,7 @@ krb5_error_code KRB5_CALLCONV sss_krb5_get_init_creds_opt_set_fast_flags( #ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_FAST_FLAGS return krb5_get_init_creds_opt_set_fast_flags(context, opt, flags); #else - DEBUG(5, ("krb5_get_init_creds_opt_set_fast_flags not available.\n")); + DEBUG(5, "krb5_get_init_creds_opt_set_fast_flags not available.\n"); return 0; #endif } @@ -702,11 +702,11 @@ sss_krb5_parse_name_flags(krb5_context context, const char *name, int flags, return krb5_parse_name_flags(context, name, flags, principal); #else if (flags != 0) { - DEBUG(SSSDBG_MINOR_FAILURE, ("krb5_parse_name_flags not available on " \ + DEBUG(SSSDBG_MINOR_FAILURE, "krb5_parse_name_flags not available on " \ "this plattform, names are parsed " \ "without flags. Some features like " \ "enterprise principals might not work " \ - "as expected.\n")); + "as expected.\n"); } return krb5_parse_name(context, name, principal); @@ -810,7 +810,7 @@ void sss_krb5_get_init_creds_opt_set_canonicalize(krb5_get_init_creds_opt *opts, #if defined(HAVE_KRB5_GET_INIT_CREDS_OPT_SET_CANONICALIZE) && defined(HAVE_KRB5_TICKET_TIMES) krb5_get_init_creds_opt_set_canonicalize(opts, canonicalize); #else - DEBUG(SSSDBG_OP_FAILURE, ("Kerberos principal canonicalization is not available!\n")); + DEBUG(SSSDBG_OP_FAILURE, "Kerberos principal canonicalization is not available!\n"); #endif } @@ -871,7 +871,7 @@ sss_child_krb5_trace_cb(krb5_context context, return; } - DEBUG(SSSDBG_TRACE_ALL, ("%s\n", info->message)); + DEBUG(SSSDBG_TRACE_ALL, "%s\n", info->message); } errno_t @@ -883,7 +883,7 @@ sss_child_set_krb5_tracing(krb5_context ctx) errno_t sss_child_set_krb5_tracing(krb5_context ctx) { - DEBUG(SSSDBG_CONF_SETTINGS, ("krb5 tracing is not available\n")); + DEBUG(SSSDBG_CONF_SETTINGS, "krb5 tracing is not available\n"); return 0; } #endif /* HAVE_KRB5_SET_TRACE_CALLBACK */ @@ -928,19 +928,19 @@ krb5_error_code sss_extract_pac(krb5_context ctx, kerr = krb5_cc_retrieve_cred(ctx, ccache, 0, &mcred, &cred); if (kerr != 0) { - DEBUG(SSSDBG_OP_FAILURE, ("krb5_cc_retrieve_cred failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "krb5_cc_retrieve_cred failed.\n"); goto done; } kerr = krb5_decode_ticket(&cred.ticket, &ticket); if (kerr != 0) { - DEBUG(SSSDBG_OP_FAILURE, ("krb5_decode_ticket failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "krb5_decode_ticket failed.\n"); goto done; } kerr = krb5_server_decrypt_ticket_keytab(ctx, keytab, ticket); if (kerr != 0) { - DEBUG(SSSDBG_OP_FAILURE, ("krb5_server_decrypt_ticket_keytab failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "krb5_server_decrypt_ticket_keytab failed.\n"); goto done; } @@ -948,18 +948,18 @@ krb5_error_code sss_extract_pac(krb5_context ctx, ticket->enc_part2->authorization_data, NULL, KRB5_AUTHDATA_WIN2K_PAC, &pac_authdata); if (kerr != 0) { - DEBUG(SSSDBG_OP_FAILURE, ("krb5_find_authdata failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "krb5_find_authdata failed.\n"); goto done; } if (pac_authdata == NULL || pac_authdata[0] == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("No PAC authdata available.\n")); + DEBUG(SSSDBG_OP_FAILURE, "No PAC authdata available.\n"); kerr = ENOENT; goto done; } if (pac_authdata[1] != NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("More than one PAC autdata found.\n")); + DEBUG(SSSDBG_OP_FAILURE, "More than one PAC autdata found.\n"); kerr = EINVAL; goto done; } @@ -967,7 +967,7 @@ krb5_error_code sss_extract_pac(krb5_context ctx, kerr = krb5_pac_parse(ctx, pac_authdata[0]->contents, pac_authdata[0]->length, &pac); if (kerr != 0) { - DEBUG(SSSDBG_OP_FAILURE, ("krb5_pac_parse failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "krb5_pac_parse failed.\n"); goto done; } @@ -975,20 +975,20 @@ krb5_error_code sss_extract_pac(krb5_context ctx, ticket->enc_part.kvno, ticket->enc_part.enctype, &entry); if (kerr != 0) { - DEBUG(SSSDBG_OP_FAILURE, ("krb5_kt_get_entry failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "krb5_kt_get_entry failed.\n"); goto done; } kerr = krb5_pac_verify(ctx, pac, 0, NULL, &entry.key, NULL); if (kerr != 0) { - DEBUG(SSSDBG_OP_FAILURE, ("krb5_pac_verify failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "krb5_pac_verify failed.\n"); goto done; } ret = unsetenv("_SSS_LOOPS"); if (ret != EOK) { - DEBUG(1, ("Failed to unset _SSS_LOOPS, " - "sss_pac_make_request will most certainly fail.\n")); + DEBUG(1, "Failed to unset _SSS_LOOPS, " + "sss_pac_make_request will most certainly fail.\n"); } *_pac_authdata = pac_authdata; @@ -1025,7 +1025,7 @@ char * sss_get_ccache_name_for_principal(TALLOC_CTX *mem_ctx, char *ret_ccname = NULL; DEBUG(SSSDBG_TRACE_ALL, - ("Location: [%s]\n", location)); + "Location: [%s]\n", location); kerr = krb5_cc_set_default_name(ctx, location); if (kerr != 0) { @@ -1037,7 +1037,7 @@ char * sss_get_ccache_name_for_principal(TALLOC_CTX *mem_ctx, if (kerr != 0) { const char *err_msg = sss_krb5_get_error_message(ctx, kerr); DEBUG(SSSDBG_TRACE_INTERNAL, - ("krb5_cc_cache_match failed: [%d][%s]\n", kerr, err_msg)); + "krb5_cc_cache_match failed: [%d][%s]\n", kerr, err_msg); sss_krb5_free_error_message(ctx, err_msg); return NULL; } @@ -1049,11 +1049,11 @@ char * sss_get_ccache_name_for_principal(TALLOC_CTX *mem_ctx, } DEBUG(SSSDBG_TRACE_ALL, - ("tmp_ccname: [%s]\n", tmp_ccname)); + "tmp_ccname: [%s]\n", tmp_ccname); ret_ccname = talloc_strdup(mem_ctx, tmp_ccname); if (ret_ccname == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("talloc_strdup failed (ENOMEM).\n")); + DEBUG(SSSDBG_OP_FAILURE, "talloc_strdup failed (ENOMEM).\n"); } done: diff --git a/src/util/sss_krb5.h b/src/util/sss_krb5.h index db47e0a6b..8838a9a6c 100644 --- a/src/util/sss_krb5.h +++ b/src/util/sss_krb5.h @@ -56,7 +56,7 @@ void KRB5_CALLCONV sss_krb5_free_error_message(krb5_context, const char *); #define KRB5_DEBUG(level, errctx, krb5_error) do { \ const char *__krb5_error_msg; \ __krb5_error_msg = sss_krb5_get_error_message(errctx, krb5_error); \ - DEBUG(level, ("%d: [%d][%s]\n", __LINE__, krb5_error, __krb5_error_msg)); \ + DEBUG(level, "%d: [%d][%s]\n", __LINE__, krb5_error, __krb5_error_msg); \ sss_log(SSS_LOG_ERR, "%s", __krb5_error_msg); \ sss_krb5_free_error_message(errctx, __krb5_error_msg); \ } while(0) diff --git a/src/util/sss_ldap.c b/src/util/sss_ldap.c index e1a05e8f6..7c13f4371 100644 --- a/src/util/sss_ldap.c +++ b/src/util/sss_ldap.c @@ -129,14 +129,14 @@ static struct tevent_req *sdap_async_sys_connect_send(TALLOC_CTX *mem_ctx, flags = fcntl(fd, F_GETFL, 0); if (flags == -1) { - DEBUG(1, ("fcntl F_GETFL failed.\n")); + DEBUG(1, "fcntl F_GETFL failed.\n"); return NULL; } req = tevent_req_create(mem_ctx, &state, struct sdap_async_sys_connect_state); if (req == NULL) { - DEBUG(1, ("tevent_req_create failed.\n")); + DEBUG(1, "tevent_req_create failed.\n"); return NULL; } @@ -147,7 +147,7 @@ static struct tevent_req *sdap_async_sys_connect_send(TALLOC_CTX *mem_ctx, ret = fcntl(fd, F_SETFL, flags | O_NONBLOCK); if (ret != EOK) { - DEBUG(1, ("fcntl F_SETFL failed.\n")); + DEBUG(1, "fcntl F_SETFL failed.\n"); goto done; } @@ -164,7 +164,7 @@ static struct tevent_req *sdap_async_sys_connect_send(TALLOC_CTX *mem_ctx, TEVENT_FD_READ | TEVENT_FD_WRITE, sdap_async_sys_connect_done, req); if (state->fde == NULL) { - DEBUG(1, ("tevent_add_fd failed.\n")); + DEBUG(1, "tevent_add_fd failed.\n"); ret = ENOMEM; goto done; } @@ -173,13 +173,13 @@ static struct tevent_req *sdap_async_sys_connect_send(TALLOC_CTX *mem_ctx, break; default: - DEBUG(1, ("connect failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "connect failed [%d][%s].\n", ret, strerror(ret)); } done: fret = fcntl(fd, F_SETFL, flags); if (fret != EOK) { - DEBUG(1, ("fcntl F_SETFL failed.\n")); + DEBUG(1, "fcntl F_SETFL failed.\n"); } if (ret == EOK) { @@ -210,14 +210,14 @@ static void sdap_async_sys_connect_done(struct tevent_context *ev, if (ret == EINPROGRESS || ret == EINTR) { return; /* Try again later */ } - DEBUG(1, ("connect failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "connect failed [%d][%s].\n", ret, strerror(ret)); } talloc_zfree(fde); fret = fcntl(state->fd, F_SETFL, state->old_flags); if (fret != EOK) { - DEBUG(1, ("fcntl F_SETFL failed.\n")); + DEBUG(1, "fcntl F_SETFL failed.\n"); } if (ret == EOK) { @@ -245,14 +245,14 @@ static errno_t set_fd_flags_and_opts(int fd) flags = fcntl(fd, F_GETFD, 0); if (flags == -1) { ret = errno; - DEBUG(1, ("fcntl F_GETFD failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "fcntl F_GETFD failed [%d][%s].\n", ret, strerror(ret)); return ret; } flags = fcntl(fd, F_SETFD, flags| FD_CLOEXEC); if (flags == -1) { ret = errno; - DEBUG(1, ("fcntl F_SETFD failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "fcntl F_SETFD failed [%d][%s].\n", ret, strerror(ret)); return ret; } @@ -261,15 +261,15 @@ static errno_t set_fd_flags_and_opts(int fd) ret = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &dummy, sizeof(dummy)); if (ret != 0) { ret = errno; - DEBUG(5, ("setsockopt SO_KEEPALIVE failed.[%d][%s].\n", ret, - strerror(ret))); + DEBUG(5, "setsockopt SO_KEEPALIVE failed.[%d][%s].\n", ret, + strerror(ret)); } ret = setsockopt(fd, SOL_TCP, TCP_NODELAY, &dummy, sizeof(dummy)); if (ret != 0) { ret = errno; - DEBUG(5, ("setsockopt TCP_NODELAY failed.[%d][%s].\n", ret, - strerror(ret))); + DEBUG(5, "setsockopt TCP_NODELAY failed.[%d][%s].\n", ret, + strerror(ret)); } return EOK; @@ -311,7 +311,7 @@ struct tevent_req *sss_ldap_init_send(TALLOC_CTX *mem_ctx, req = tevent_req_create(mem_ctx, &state, struct sss_ldap_init_state); if (req == NULL) { - DEBUG(1, ("tevent_req_create failed.\n")); + DEBUG(1, "tevent_req_create failed.\n"); return NULL; } @@ -325,34 +325,34 @@ struct tevent_req *sss_ldap_init_send(TALLOC_CTX *mem_ctx, state->sd = socket(addr->ss_family, SOCK_STREAM, 0); if (state->sd == -1) { ret = errno; - DEBUG(1, ("socket failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "socket failed [%d][%s].\n", ret, strerror(ret)); goto fail; } ret = set_fd_flags_and_opts(state->sd); if (ret != EOK) { - DEBUG(1, ("set_fd_flags_and_opts failed.\n")); + DEBUG(1, "set_fd_flags_and_opts failed.\n"); goto fail; } - DEBUG(9, ("Using file descriptor [%d] for LDAP connection.\n", state->sd)); + DEBUG(9, "Using file descriptor [%d] for LDAP connection.\n", state->sd); subreq = sdap_async_sys_connect_send(state, ev, state->sd, (struct sockaddr *) addr, addr_len); if (subreq == NULL) { ret = ENOMEM; - DEBUG(1, ("sdap_async_sys_connect_send failed.\n")); + DEBUG(1, "sdap_async_sys_connect_send failed.\n"); goto fail; } - DEBUG(6, ("Setting %d seconds timeout for connecting\n", timeout)); + DEBUG(6, "Setting %d seconds timeout for connecting\n", timeout); tv = tevent_timeval_current_ofs(timeout, 0); state->connect_timeout = tevent_add_timer(ev, subreq, tv, sdap_async_sys_connect_timeout, subreq); if (state->connect_timeout == NULL) { - DEBUG(1, ("tevent_add_timer failed.\n")); + DEBUG(1, "tevent_add_timer failed.\n"); ret = ENOMEM; goto fail; } @@ -366,14 +366,14 @@ fail: } tevent_req_error(req, ret); #else - DEBUG(3, ("ldap_init_fd not available, " - "will use ldap_initialize with uri [%s].\n", uri)); + DEBUG(3, "ldap_init_fd not available, " + "will use ldap_initialize with uri [%s].\n", uri); state->sd = -1; ret = ldap_initialize(&state->ldap, uri); if (ret == LDAP_SUCCESS) { tevent_req_done(req); } else { - DEBUG(1, ("ldap_initialize failed [%s].\n", sss_ldap_err2string(ret))); + DEBUG(1, "ldap_initialize failed [%s].\n", sss_ldap_err2string(ret)); if (ret == LDAP_SERVER_DOWN) { tevent_req_error(req, ETIMEDOUT); } else { @@ -393,7 +393,7 @@ static void sdap_async_sys_connect_timeout(struct tevent_context *ev, { struct tevent_req *connection_request; - DEBUG(4, ("The LDAP connection timed out\n")); + DEBUG(4, "The LDAP connection timed out\n"); connection_request = talloc_get_type(pvt, struct tevent_req); tevent_req_error(connection_request, ETIMEDOUT); @@ -413,7 +413,7 @@ static void sss_ldap_init_sys_connect_done(struct tevent_req *subreq) ret = sdap_async_sys_connect_recv(subreq); talloc_zfree(subreq); if (ret != EOK) { - DEBUG(1, ("sdap_async_sys_connect request failed.\n")); + DEBUG(1, "sdap_async_sys_connect request failed.\n"); goto fail; } /* Initialize LDAP handler */ @@ -421,8 +421,8 @@ static void sss_ldap_init_sys_connect_done(struct tevent_req *subreq) lret = ldap_init_fd(state->sd, LDAP_PROTO_TCP, state->uri, &state->ldap); if (lret != LDAP_SUCCESS) { DEBUG(SSSDBG_CRIT_FAILURE, - ("ldap_init_fd failed: %s. [%d][%s]\n", - sss_ldap_err2string(lret), state->sd, state->uri)); + "ldap_init_fd failed: %s. [%d][%s]\n", + sss_ldap_err2string(lret), state->sd, state->uri); ret = lret == LDAP_SERVER_DOWN ? ETIMEDOUT : EIO; goto fail; } @@ -431,10 +431,10 @@ static void sss_ldap_init_sys_connect_done(struct tevent_req *subreq) lret = ldap_install_tls(state->ldap); if (lret != LDAP_SUCCESS) { if (lret == LDAP_LOCAL_ERROR) { - DEBUG(5, ("TLS/SSL already in place.\n")); + DEBUG(5, "TLS/SSL already in place.\n"); } else { - DEBUG(1, ("ldap_install_tls failed: %s\n", - sss_ldap_err2string(lret))); + DEBUG(1, "ldap_install_tls failed: %s\n", + sss_ldap_err2string(lret)); ret = EIO; goto fail; } @@ -490,13 +490,13 @@ bool sss_ldap_dn_in_search_bases_len(TALLOC_CTX *mem_ctx, int match_len; if (dn == NULL) { - DEBUG(SSSDBG_FUNC_DATA, ("dn is NULL\n")); + DEBUG(SSSDBG_FUNC_DATA, "dn is NULL\n"); ret = false; goto done; } if (search_bases == NULL) { - DEBUG(SSSDBG_FUNC_DATA, ("search_bases is NULL\n")); + DEBUG(SSSDBG_FUNC_DATA, "search_bases is NULL\n"); ret = false; goto done; } @@ -553,7 +553,7 @@ bool sss_ldap_dn_in_search_bases_len(TALLOC_CTX *mem_ctx, /* dn length >= base dn length && base_confirmed == true */ break; default: - DEBUG(SSSDBG_FUNC_DATA, ("Unsupported scope: %d\n", base->scope)); + DEBUG(SSSDBG_FUNC_DATA, "Unsupported scope: %d\n", base->scope); continue; } @@ -572,7 +572,7 @@ bool sss_ldap_dn_in_search_bases_len(TALLOC_CTX *mem_ctx, } else { filter = talloc_strdup_append(filter, base->filter); if (filter == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_strdup_append() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup_append() failed\n"); ret = false; goto done; } @@ -584,7 +584,7 @@ bool sss_ldap_dn_in_search_bases_len(TALLOC_CTX *mem_ctx, *_filter = talloc_asprintf(mem_ctx, "(|%s)", filter); if (*_filter == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("talloc_asprintf_append() failed\n")); + "talloc_asprintf_append() failed\n"); ret = false; goto done; } diff --git a/src/util/sss_nss.c b/src/util/sss_nss.c index 2b7338329..406c95cd0 100644 --- a/src/util/sss_nss.c +++ b/src/util/sss_nss.c @@ -36,7 +36,7 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, const char *orig = NULL; if (template == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Missing template.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Missing template.\n"); return NULL; } @@ -45,13 +45,13 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, copy = talloc_strdup(tmp_ctx, template); if (copy == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_strdup failed.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup failed.\n"); goto done; } result = talloc_strdup(tmp_ctx, ""); if (result == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_strdup failed.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup failed.\n"); goto done; } @@ -60,15 +60,15 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, *n = '\0'; n++; if ( *n == '\0' ) { - DEBUG(SSSDBG_CRIT_FAILURE, ("format error, single %% at the end of " - "the template.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "format error, single %% at the end of " + "the template.\n"); goto done; } switch( *n ) { case 'u': if (username == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot expand user name template " - "because user name is empty.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot expand user name template " + "because user name is empty.\n"); goto done; } result = talloc_asprintf_append(result, "%s%s", p, @@ -77,8 +77,8 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, case 'U': if (uid == 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot expand uid template " - "because uid is invalid.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot expand uid template " + "because uid is invalid.\n"); goto done; } result = talloc_asprintf_append(result, "%s%d", p, @@ -87,9 +87,9 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, case 'd': if (domain == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot expand domain name " + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot expand domain name " "template because domain name " - "is empty.\n")); + "is empty.\n"); goto done; } result = talloc_asprintf_append(result, "%s%s", p, @@ -98,9 +98,9 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, case 'f': if (domain == NULL || username == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot expand fully qualified " + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot expand fully qualified " "name template because domain " - "or user name is empty.\n")); + "or user name is empty.\n"); goto done; } result = talloc_asprintf_append(result, "%s%s@%s", p, @@ -110,8 +110,8 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, case 'o': if (original == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Original home directory for %s is not available, " - "using empty string\n", username)); + "Original home directory for %s is not available, " + "using empty string\n", username); orig = ""; } else { orig = original; @@ -121,9 +121,9 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, case 'F': if (flatname == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot expand domain name " + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot expand domain name " "template because domain flat " - "name is empty.\n")); + "name is empty.\n"); goto done; } result = talloc_asprintf_append(result, "%s%s", p, flatname); @@ -134,13 +134,13 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, break; default: - DEBUG(SSSDBG_CRIT_FAILURE, ("format error, unknown template " - "[%%%c].\n", *n)); + DEBUG(SSSDBG_CRIT_FAILURE, "format error, unknown template " + "[%%%c].\n", *n); goto done; } if (result == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_asprintf_append failed.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf_append failed.\n"); goto done; } @@ -149,7 +149,7 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template, result = talloc_asprintf_append(result, "%s", p); if (result == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_asprintf_append failed.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf_append failed.\n"); goto done; } diff --git a/src/util/sss_selinux.c b/src/util/sss_selinux.c index f97e3f661..165aeca1b 100644 --- a/src/util/sss_selinux.c +++ b/src/util/sss_selinux.c @@ -66,7 +66,7 @@ bool sss_selinux_match(struct sysdb_attrs *usermap, errno_t ret; if (usermap == NULL) { - DEBUG(SSSDBG_MINOR_FAILURE, ("NULL given as usermap! Skipping ...\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "NULL given as usermap! Skipping ...\n"); return false; } @@ -86,14 +86,14 @@ bool sss_selinux_match(struct sysdb_attrs *usermap, if (user) { ret = sysdb_attrs_get_el(user, SYSDB_ORIG_DN, &dn); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("User does not have origDN\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "User does not have origDN\n"); return false; } ret = sysdb_attrs_get_el(user, SYSDB_ORIG_MEMBEROF, &memberof); if (ret != EOK) { DEBUG(SSSDBG_TRACE_ALL, - ("User does not have orig memberof, " - "therefore it can't match to any rule\n")); + "User does not have orig memberof, " + "therefore it can't match to any rule\n"); return false; } @@ -113,7 +113,7 @@ bool sss_selinux_match(struct sysdb_attrs *usermap, if (!matched_category) { if (users_el == NULL) { - DEBUG(SSSDBG_TRACE_ALL, ("No users specified in the rule!\n")); + DEBUG(SSSDBG_TRACE_ALL, "No users specified in the rule!\n"); return false; } else { matched_name = match_entity(users_el, dn); @@ -123,7 +123,7 @@ bool sss_selinux_match(struct sysdb_attrs *usermap, } else if (matched_group) { priority |= SELINUX_PRIORITY_USER_GROUP; } else { - DEBUG(SSSDBG_TRACE_ALL, ("User did not match\n")); + DEBUG(SSSDBG_TRACE_ALL, "User did not match\n"); return false; } } @@ -135,14 +135,14 @@ bool sss_selinux_match(struct sysdb_attrs *usermap, if (host) { ret = sysdb_attrs_get_el(host, SYSDB_ORIG_DN, &dn); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Host does not have origDN\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Host does not have origDN\n"); return false; } ret = sysdb_attrs_get_el(host, SYSDB_ORIG_MEMBEROF, &memberof); if (ret != EOK) { DEBUG(SSSDBG_TRACE_ALL, - ("Host does not have orig memberof, " - "therefore it can't match to any rule\n")); + "Host does not have orig memberof, " + "therefore it can't match to any rule\n"); return false; } @@ -161,7 +161,7 @@ bool sss_selinux_match(struct sysdb_attrs *usermap, } if (!matched_category) { if (hosts_el == NULL) { - DEBUG(SSSDBG_TRACE_ALL, ("No users specified in the rule!\n")); + DEBUG(SSSDBG_TRACE_ALL, "No users specified in the rule!\n"); return false; } else { matched_name = match_entity(hosts_el, dn); @@ -171,7 +171,7 @@ bool sss_selinux_match(struct sysdb_attrs *usermap, } else if (matched_group) { priority |= SELINUX_PRIORITY_HOST_GROUP; } else { - DEBUG(SSSDBG_TRACE_ALL, ("Host did not match\n")); + DEBUG(SSSDBG_TRACE_ALL, "Host did not match\n"); return false; } } @@ -207,7 +207,7 @@ errno_t sss_selinux_extract_user(TALLOC_CTX *mem_ctx, attrs = talloc_array(tmp_ctx, const char *, 3); if (attrs == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_array failed.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_array failed.\n"); ret = ENOMEM; goto done; } @@ -218,7 +218,7 @@ errno_t sss_selinux_extract_user(TALLOC_CTX *mem_ctx, ret = sysdb_search_user_by_name(tmp_ctx, domain, username, attrs, &user_msg); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("sysdb_search_user_by_name failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "sysdb_search_user_by_name failed.\n"); goto done; } diff --git a/src/util/sss_ssh.c b/src/util/sss_ssh.c index e31876272..86903753d 100644 --- a/src/util/sss_ssh.c +++ b/src/util/sss_ssh.c @@ -45,7 +45,7 @@ sss_ssh_make_ent(TALLOC_CTX *mem_ctx, name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL); if (!name) { ret = EINVAL; - DEBUG(SSSDBG_CRIT_FAILURE, ("Host is missing name attribute\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Host is missing name attribute\n"); goto done; } diff --git a/src/util/sss_tc_utf8.c b/src/util/sss_tc_utf8.c index e1426a44f..4b2c49316 100644 --- a/src/util/sss_tc_utf8.c +++ b/src/util/sss_tc_utf8.c @@ -65,7 +65,7 @@ errno_t sss_filter_sanitize_for_dom(TALLOC_CTX *mem_ctx, ret = sss_filter_sanitize(mem_ctx, input, sanitized); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("sss_filter_sanitize failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "sss_filter_sanitize failed.\n"); return ret; } @@ -76,10 +76,10 @@ errno_t sss_filter_sanitize_for_dom(TALLOC_CTX *mem_ctx, } if (*lc_sanitized == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("%s failed.\n", + DEBUG(SSSDBG_OP_FAILURE, "%s failed.\n", dom->case_sensitive ? "talloc_strdup" : - "sss_tc_utf8_str_tolower")); + "sss_tc_utf8_str_tolower"); return ENOMEM; } diff --git a/src/util/user_info_msg.c b/src/util/user_info_msg.c index 25e99d2b1..89d7456e5 100644 --- a/src/util/user_info_msg.c +++ b/src/util/user_info_msg.c @@ -40,7 +40,7 @@ errno_t pack_user_info_chpass_error(TALLOC_CTX *mem_ctx, *resp_len = 2 * sizeof(uint32_t) + err_len; resp = talloc_size(mem_ctx, *resp_len); if (resp == NULL) { - DEBUG(1, ("talloc_size failed.\n")); + DEBUG(1, "talloc_size failed.\n"); return ENOMEM; } @@ -49,7 +49,7 @@ errno_t pack_user_info_chpass_error(TALLOC_CTX *mem_ctx, SAFEALIGN_SET_UINT32(&resp[p], err_len, &p); safealign_memcpy(&resp[p], user_error_message, err_len, &p); if (p != *resp_len) { - DEBUG(0, ("Size mismatch\n")); + DEBUG(0, "Size mismatch\n"); } *_resp = resp; diff --git a/src/util/usertools.c b/src/util/usertools.c index f0d09ffc2..b7f7593e1 100644 --- a/src/util/usertools.c +++ b/src/util/usertools.c @@ -88,9 +88,9 @@ static errno_t get_id_provider_default_re(TALLOC_CTX *mem_ctx, { #ifdef HAVE_LIBPCRE_LESSER_THAN_7 DEBUG(SSSDBG_MINOR_FAILURE, - ("The libpcre version on this system is too old. Only " + "The libpcre version on this system is too old. Only " "the user@DOMAIN name fully qualified name format will " - "be supported\n")); + "be supported\n"); *re_pattern = NULL; return EOK; #else @@ -108,8 +108,8 @@ static errno_t get_id_provider_default_re(TALLOC_CTX *mem_ctx, ret = confdb_get_string(cdb, mem_ctx, conf_path, CONFDB_DOMAIN_ID_PROVIDER, NULL, &id_provider); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to read ID provider " \ - "from conf db.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to read ID provider " \ + "from conf db.\n"); goto done; } @@ -120,7 +120,7 @@ static errno_t get_id_provider_default_re(TALLOC_CTX *mem_ctx, if (strcmp(id_provider, provider_default_re[c].name) == 0) { *re_pattern = talloc_strdup(mem_ctx, provider_default_re[c].re); if (*re_pattern == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("talloc_strdup failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "talloc_strdup failed.\n"); ret = ENOMEM; goto done; } @@ -146,18 +146,18 @@ static errno_t sss_fqnames_init(struct sss_names_ctx *nctx, const char *fq_fmt) return ENOMEM; } - DEBUG(SSSDBG_CONF_SETTINGS, ("Using fq format [%s].\n", nctx->fq_fmt)); + DEBUG(SSSDBG_CONF_SETTINGS, "Using fq format [%s].\n", nctx->fq_fmt); /* Fail if the name specifier is missing, or if the format is * invalid */ fq = sss_tc_fqname2 (nctx, nctx, "unused.example.com", "unused", "the-test-user"); if (fq == NULL) { DEBUG(SSSDBG_OP_FAILURE, - ("The fq format is invalid [%s]", nctx->fq_fmt)); + "The fq format is invalid [%s]", nctx->fq_fmt); return EINVAL; } else if (strstr (fq, "the-test-user") == NULL) { DEBUG(SSSDBG_OP_FAILURE, - ("Username pattern not found in [%s]\n", nctx->fq_fmt)); + "Username pattern not found in [%s]\n", nctx->fq_fmt); return ENOENT; } @@ -184,12 +184,12 @@ int sss_names_init_from_args(TALLOC_CTX *mem_ctx, const char *re_pattern, goto done; } - DEBUG(SSSDBG_CONF_SETTINGS, ("Using re [%s].\n", ctx->re_pattern)); + DEBUG(SSSDBG_CONF_SETTINGS, "Using re [%s].\n", ctx->re_pattern); ret = sss_fqnames_init(ctx, fq_fmt); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Could not check the FQ names format" - "[%d]: %s\n", ret, sss_strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "Could not check the FQ names format" + "[%d]: %s\n", ret, sss_strerror(ret)); goto done; } @@ -197,8 +197,8 @@ int sss_names_init_from_args(TALLOC_CTX *mem_ctx, const char *re_pattern, NAME_DOMAIN_PATTERN_OPTIONS, &errval, &errstr, &errpos, NULL); if (!ctx->re) { - DEBUG(1, ("Invalid Regular Expression pattern at position %d." - " (Error: %d [%s])\n", errpos, errval, errstr)); + DEBUG(1, "Invalid Regular Expression pattern at position %d." + " (Error: %d [%s])\n", errpos, errval, errstr); ret = EFAULT; goto done; } @@ -250,8 +250,8 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb, if (re_pattern == NULL && conf_path != NULL) { ret = get_id_provider_default_re(tmpctx, cdb, conf_path, &re_pattern); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to get provider default regular " \ - "expression for domain [%s].\n", domain)); + DEBUG(SSSDBG_OP_FAILURE, "Failed to get provider default regular " \ + "expression for domain [%s].\n", domain); goto done; } } @@ -265,11 +265,11 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb, } #ifdef HAVE_LIBPCRE_LESSER_THAN_7 } else { - DEBUG(2, ("This binary was build with a version of libpcre that does " - "not support non-unique named subpatterns.\n")); - DEBUG(2, ("Please make sure that your pattern [%s] only contains " + DEBUG(2, "This binary was build with a version of libpcre that does " + "not support non-unique named subpatterns.\n"); + DEBUG(2, "Please make sure that your pattern [%s] only contains " "subpatterns with a unique name and uses " - "the Python syntax (?P<name>).\n", re_pattern)); + "the Python syntax (?P<name>).\n", re_pattern); #endif } @@ -317,12 +317,12 @@ int sss_parse_name(TALLOC_CTX *memctx, if (ret == PCRE_ERROR_NOMATCH) { return EINVAL; } else if (ret < 0) { - DEBUG(SSSDBG_MINOR_FAILURE, ("PCRE Matching error, %d\n", ret)); + DEBUG(SSSDBG_MINOR_FAILURE, "PCRE Matching error, %d\n", ret); return EINVAL; } if (ret == 0) { - DEBUG(1, ("Too many matches, the pattern is invalid.\n")); + DEBUG(1, "Too many matches, the pattern is invalid.\n"); } strnum = ret; @@ -331,7 +331,7 @@ int sss_parse_name(TALLOC_CTX *memctx, result = NULL; ret = pcre_get_named_substring(re, orig, ovec, strnum, "name", &result); if (ret < 0 || !result) { - DEBUG(2, ("Name not found!\n")); + DEBUG(2, "Name not found!\n"); return EINVAL; } *_name = talloc_strdup(memctx, result); @@ -344,7 +344,7 @@ int sss_parse_name(TALLOC_CTX *memctx, ret = pcre_get_named_substring(re, orig, ovec, strnum, "domain", &result); if (ret < 0 || !result) { - DEBUG(4, ("Domain not provided!\n")); + DEBUG(4, "Domain not provided!\n"); *_domain = NULL; } else { /* ignore "" string */ @@ -418,12 +418,12 @@ int sss_parse_name_for_domains(TALLOC_CTX *memctx, } else { match = match_any_domain_or_subdomain_name (dom, dmatch); if (match != NULL) { - DEBUG(SSSDBG_FUNC_DATA, ("name '%s' matched expression for " + DEBUG(SSSDBG_FUNC_DATA, "name '%s' matched expression for " "domain '%s', user is %s\n", - orig, match->name, nmatch)); + orig, match->name, nmatch); rdomain = talloc_strdup(tmp_ctx, match->name); if (rdomain == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("talloc_strdup failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "talloc_strdup failed.\n"); ret = ENOMEM; goto done; } @@ -442,13 +442,13 @@ int sss_parse_name_for_domains(TALLOC_CTX *memctx, if (rdomain == NULL && rname == NULL) { if (candidate_name && !name_mismatch) { - DEBUG(SSSDBG_FUNC_DATA, ("name '%s' matched without domain, " \ - "user is %s\n", orig, nmatch)); + DEBUG(SSSDBG_FUNC_DATA, "name '%s' matched without domain, " \ + "user is %s\n", orig, nmatch); rdomain = NULL; if (default_domain != NULL) { rdomain = talloc_strdup(tmp_ctx, default_domain); if (rdomain == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("talloc_strdup failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "talloc_strdup failed.\n"); ret = ENOMEM; goto done; } @@ -460,16 +460,16 @@ int sss_parse_name_for_domains(TALLOC_CTX *memctx, } } if (match == NULL) { - DEBUG(SSSDBG_FUNC_DATA, ("default domain [%s] is currently " \ + DEBUG(SSSDBG_FUNC_DATA, "default domain [%s] is currently " \ "not know, trying to look it up.\n", - rdomain)); + rdomain); *domain = talloc_steal(memctx, rdomain); ret = EAGAIN; goto done; } } - DEBUG(SSSDBG_FUNC_DATA, ("using default domain [%s]\n", rdomain)); + DEBUG(SSSDBG_FUNC_DATA, "using default domain [%s]\n", rdomain); rname = candidate_name; } else if (candidate_domain) { @@ -481,7 +481,7 @@ int sss_parse_name_for_domains(TALLOC_CTX *memctx, if (rdomain == NULL && rname == NULL) { DEBUG(SSSDBG_TRACE_FUNC, - ("name '%s' did not match any domain's expression\n", orig)); + "name '%s' did not match any domain's expression\n", orig); ret = EINVAL; goto done; } @@ -554,8 +554,8 @@ calc_flat_name(struct sss_domain_info *domain) s = domain->flat_name; if (s == NULL) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Flat name requested but domain has no" - "flat name set, falling back to domain name\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Flat name requested but domain has no" + "flat name set, falling back to domain name\n"); s = domain->name; } diff --git a/src/util/util.c b/src/util/util.c index 5931549f4..f6f8e19c6 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -509,8 +509,8 @@ errno_t sss_hash_create_ex(TALLOC_CTX *mem_ctx, ret = EIO; } - DEBUG(0, ("Could not create hash table: [%d][%s]\n", - hret, hash_error_string(hret))); + DEBUG(0, "Could not create hash table: [%d][%s]\n", + hret, hash_error_string(hret)); talloc_free(internal_ctx); return ret; @@ -624,7 +624,7 @@ errno_t add_string_to_list(TALLOC_CTX *mem_ctx, const char *string, char **new_list = NULL; if (string == NULL || list_p == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Missing string or list.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Missing string or list.\n"); return EINVAL; } @@ -644,13 +644,13 @@ errno_t add_string_to_list(TALLOC_CTX *mem_ctx, const char *string, } if (new_list == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("talloc_array/talloc_realloc failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "talloc_array/talloc_realloc failed.\n"); return ENOMEM; } new_list[c] = talloc_strdup(new_list, string); if (new_list[c] == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("talloc_strdup failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "talloc_strdup failed.\n"); talloc_free(new_list); return ENOMEM; } @@ -748,25 +748,25 @@ bool check_ipv4_addr(struct in_addr *addr, uint8_t flags) if (inet_ntop(AF_INET, addr, straddr, INET_ADDRSTRLEN) == NULL) { DEBUG(SSSDBG_MINOR_FAILURE, - ("inet_ntop failed, won't log IP addresses\n")); + "inet_ntop failed, won't log IP addresses\n"); snprintf(straddr, INET_ADDRSTRLEN, "unknown"); } if ((flags & SSS_NO_MULTICAST) && IN_MULTICAST(ntohl(addr->s_addr))) { - DEBUG(SSSDBG_FUNC_DATA, ("Multicast IPv4 address %s\n", straddr)); + DEBUG(SSSDBG_FUNC_DATA, "Multicast IPv4 address %s\n", straddr); return false; } else if ((flags & SSS_NO_LOOPBACK) && inet_netof(*addr) == IN_LOOPBACKNET) { - DEBUG(SSSDBG_FUNC_DATA, ("Loopback IPv4 address %s\n", straddr)); + DEBUG(SSSDBG_FUNC_DATA, "Loopback IPv4 address %s\n", straddr); return false; } else if ((flags & SSS_NO_LINKLOCAL) && (addr->s_addr & htonl(0xffff0000)) == htonl(0xa9fe0000)) { /* 169.254.0.0/16 */ - DEBUG(SSSDBG_FUNC_DATA, ("Link-local IPv4 address %s\n", straddr)); + DEBUG(SSSDBG_FUNC_DATA, "Link-local IPv4 address %s\n", straddr); return false; } else if ((flags & SSS_NO_BROADCAST) && addr->s_addr == htonl(INADDR_BROADCAST)) { - DEBUG(SSSDBG_FUNC_DATA, ("Broadcast IPv4 address %s\n", straddr)); + DEBUG(SSSDBG_FUNC_DATA, "Broadcast IPv4 address %s\n", straddr); return false; } @@ -779,18 +779,18 @@ bool check_ipv6_addr(struct in6_addr *addr, uint8_t flags) if (inet_ntop(AF_INET6, addr, straddr, INET6_ADDRSTRLEN) == NULL) { DEBUG(SSSDBG_MINOR_FAILURE, - ("inet_ntop failed, won't log IP addresses\n")); + "inet_ntop failed, won't log IP addresses\n"); snprintf(straddr, INET6_ADDRSTRLEN, "unknown"); } if ((flags & SSS_NO_LINKLOCAL) && IN6_IS_ADDR_LINKLOCAL(addr)) { - DEBUG(SSSDBG_FUNC_DATA, ("Link local IPv6 address %s\n", straddr)); + DEBUG(SSSDBG_FUNC_DATA, "Link local IPv6 address %s\n", straddr); return false; } else if ((flags & SSS_NO_LOOPBACK) && IN6_IS_ADDR_LOOPBACK(addr)) { - DEBUG(SSSDBG_FUNC_DATA, ("Loopback IPv6 address %s\n", straddr)); + DEBUG(SSSDBG_FUNC_DATA, "Loopback IPv6 address %s\n", straddr); return false; } else if ((flags & SSS_NO_MULTICAST) && IN6_IS_ADDR_MULTICAST(addr)) { - DEBUG(SSSDBG_FUNC_DATA, ("Multicast IPv6 address %s\n", straddr)); + DEBUG(SSSDBG_FUNC_DATA, "Multicast IPv6 address %s\n", straddr); return false; } diff --git a/src/util/util.h b/src/util/util.h index 9cc53f880..207d603c9 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -126,7 +126,7 @@ errno_t set_debug_file_from_fd(const int fd); newline-terminated message \param ... the debug message format arguments */ -#define DEBUG(level, format, ...) do { \ +#define DEBUGlevel, format, ...) do { \ int __debug_macro_newlevel = debug_get_level(level); \ if (DEBUG_IS_SET(__debug_macro_newlevel)) \ debug_fn(__FUNCTION__, __debug_macro_newlevel, format, ##__VA_ARGS__); \ @@ -173,7 +173,7 @@ errno_t set_debug_file_from_fd(const int fd); #define FLAGS_PID_FILE 0x0004 #ifndef talloc_zfree -#define talloc_zfree(ptr) do { talloc_free(discard_const(ptr)); ptr = NULL; } while(0) +#define talloc_zfree(ptr) do { talloc_free(discard_const(ptr); ptr = NULL; } while(0) #endif #ifndef discard_const_p diff --git a/src/util/util_lock.c b/src/util/util_lock.c index 8db35a8cf..b8e41cc29 100644 --- a/src/util/util_lock.c +++ b/src/util/util_lock.c @@ -51,8 +51,8 @@ errno_t sss_br_lock_file(int fd, size_t start, size_t len, ret = errno; if (ret == EACCES || ret == EAGAIN || ret == EINTR) { DEBUG(SSSDBG_TRACE_FUNC, - ("Failed to lock file. Retries left: %d\n", - retries_left - 1)); + "Failed to lock file. Retries left: %d\n", + retries_left - 1); if ((ret == EACCES || ret == EAGAIN) && (retries_left <= 1)) { /* File is locked by someone else. Return EACCESS @@ -64,13 +64,13 @@ errno_t sss_br_lock_file(int fd, size_t start, size_t len, ret = usleep(wait); if (ret == -1) { DEBUG(SSSDBG_MINOR_FAILURE, - ("usleep() failed -> ignoring\n")); + "usleep() failed -> ignoring\n"); } } } else { /* Error occurred */ DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to lock file.\n")); + "Unable to lock file.\n"); return ret; } } else if (ret == 0) { @@ -79,7 +79,7 @@ errno_t sss_br_lock_file(int fd, size_t start, size_t len, } } if (retries_left == 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to lock file.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to lock file.\n"); return ret; } diff --git a/src/util/well_known_sids.c b/src/util/well_known_sids.c index 8d022bf41..c6dcd2e1a 100644 --- a/src/util/well_known_sids.c +++ b/src/util/well_known_sids.c @@ -257,17 +257,17 @@ errno_t well_known_sid_to_name(const char *sid, const char **dom, } else if (strncmp(sid, BUILTIN_SID_PREFIX, BUILTIN_SID_PREFIX_LEN) == 0) { ret = handle_builtin_sids(sid, dom, name); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("handle_builtin_sids failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "handle_builtin_sids failed.\n"); } } else if (strncmp(sid, NT_SID_PREFIX, NT_SID_PREFIX_LEN) == 0) { ret = handle_nt_sids(sid, dom, name); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("handle_nt_sids failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "handle_nt_sids failed.\n"); } } else if (strncmp(sid, SPECIAL_SID_PREFIX, SPECIAL_SID_PREFIX_LEN) == 0) { ret = handle_special_sids(sid, dom, name); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("handle_special_sids failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "handle_special_sids failed.\n"); } } else { ret = EINVAL; @@ -288,12 +288,12 @@ errno_t name_to_well_known_sid(const char *dom, const char *name, if (strcmp(dom, NT_DOM_NAME) == 0) { ret = handle_nt_names(name, sid); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("handle_nt_name failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "handle_nt_name failed.\n"); } } else if (strcmp(dom, BUILTIN_DOM_NAME) == 0) { ret = handle_builtin_names(name, sid); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("handle_builtin_name failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "handle_builtin_name failed.\n"); } } else if (strcmp(dom, NULL_DOM_NAME) == 0 || strcmp(dom, WORLD_DOM_NAME) == 0 @@ -301,7 +301,7 @@ errno_t name_to_well_known_sid(const char *dom, const char *name, || strcmp(dom, CREATOR_DOM_NAME) == 0) { ret = handle_special_names(dom, name, sid); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("handle_special_name failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, "handle_special_name failed.\n"); } } else { ret = ENOENT; |