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/tools | |
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/tools')
-rw-r--r-- | src/tools/files.c | 112 | ||||
-rw-r--r-- | src/tools/selinux.c | 62 | ||||
-rw-r--r-- | src/tools/sss_cache.c | 60 | ||||
-rw-r--r-- | src/tools/sss_debuglevel.c | 28 | ||||
-rw-r--r-- | src/tools/sss_groupadd.c | 12 | ||||
-rw-r--r-- | src/tools/sss_groupdel.c | 6 | ||||
-rw-r--r-- | src/tools/sss_groupmod.c | 20 | ||||
-rw-r--r-- | src/tools/sss_groupshow.c | 50 | ||||
-rw-r--r-- | src/tools/sss_seed.c | 126 | ||||
-rw-r--r-- | src/tools/sss_sync_ops.c | 36 | ||||
-rw-r--r-- | src/tools/sss_useradd.c | 22 | ||||
-rw-r--r-- | src/tools/sss_userdel.c | 12 | ||||
-rw-r--r-- | src/tools/sss_usermod.c | 18 | ||||
-rw-r--r-- | src/tools/tools_mc_util.c | 52 | ||||
-rw-r--r-- | src/tools/tools_util.c | 112 | ||||
-rw-r--r-- | src/tools/tools_util.h | 2 |
16 files changed, 365 insertions, 365 deletions
diff --git a/src/tools/files.c b/src/tools/files.c index 7fc842281..f1cede0ce 100644 --- a/src/tools/files.c +++ b/src/tools/files.c @@ -174,8 +174,8 @@ static int remove_tree_with_ctx(TALLOC_CTX *mem_ctx, O_RDONLY | O_DIRECTORY | O_NOFOLLOW, &ret); if (dir_fd == -1) { ret = errno; - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot open %s: [%d]: %s\n", - dir_name, ret, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot open %s: [%d]: %s\n", + dir_name, ret, strerror(ret)); return ret; } @@ -183,7 +183,7 @@ static int remove_tree_with_ctx(TALLOC_CTX *mem_ctx, if (rootdir == NULL) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Cannot open directory: [%d][%s]\n", ret, strerror(ret))); + "Cannot open directory: [%d][%s]\n", ret, strerror(ret)); close(dir_fd); goto fail; } @@ -199,7 +199,7 @@ static int remove_tree_with_ctx(TALLOC_CTX *mem_ctx, if (ret != 0) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("stat failed: [%d][%s]\n", ret, strerror(ret))); + "stat failed: [%d][%s]\n", ret, strerror(ret)); goto fail; } @@ -207,8 +207,8 @@ static int remove_tree_with_ctx(TALLOC_CTX *mem_ctx, /* if directory, recursively descend, but check if on the same FS */ if (parent_dev && parent_dev != statres.st_dev) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Directory %s is on different filesystem, " - "will not follow\n", result->d_name)); + "Directory %s is on different filesystem, " + "will not follow\n", result->d_name); ret = EFAULT; goto fail; } @@ -216,8 +216,8 @@ static int remove_tree_with_ctx(TALLOC_CTX *mem_ctx, ret = remove_tree_with_ctx(mem_ctx, dir_fd, result->d_name, statres.st_dev); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Removing subdirectory failed: [%d][%s]\n", - ret, strerror(ret))); + "Removing subdirectory failed: [%d][%s]\n", + ret, strerror(ret)); goto fail; } } else { @@ -225,7 +225,7 @@ static int remove_tree_with_ctx(TALLOC_CTX *mem_ctx, if (ret != 0) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Removing file failed: [%d][%s]\n", ret, strerror(ret))); + "Removing file failed: [%d][%s]\n", ret, strerror(ret)); goto fail; } } @@ -248,7 +248,7 @@ fail: if (rootdir) { /* clean up on abnormal exit but retain return code */ err = closedir(rootdir); if (err) { - DEBUG(SSSDBG_CRIT_FAILURE, ("closedir failed, bad dirp?\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "closedir failed, bad dirp?\n"); } } return ret; @@ -313,7 +313,7 @@ copy_symlink(int src_dir_fd, ret = selinux_file_context(full_path); if (ret != 0) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Failed to set SELinux context for [%s]\n", full_path)); + "Failed to set SELinux context for [%s]\n", full_path); /* Not fatal */ } @@ -323,11 +323,11 @@ copy_symlink(int src_dir_fd, ret = errno; if (ret == EEXIST) { DEBUG(SSSDBG_MINOR_FAILURE, - ("symlink pointing to already exists at '%s'\n", full_path)); + "symlink pointing to already exists at '%s'\n", full_path); return EOK; } - DEBUG(SSSDBG_CRIT_FAILURE, ("symlinkat failed: %s\n", strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "symlinkat failed: %s\n", strerror(ret)); return ret; } @@ -336,15 +336,15 @@ copy_symlink(int src_dir_fd, if (ret == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("fchownat failed: %s\n", strerror(ret))); + "fchownat failed: %s\n", strerror(ret)); return ret; } ret = sss_timeat_set(dst_dir_fd, file_name, statp, AT_SYMLINK_NOFOLLOW); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("utimensat failed [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_MINOR_FAILURE, "utimensat failed [%d]: %s\n", + ret, strerror(ret)); /* Do not fail */ } @@ -371,7 +371,7 @@ copy_file(int ifd, ret = selinux_file_context(full_path); if (ret != 0) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Failed to set SELinux context for [%s]\n", full_path)); + "Failed to set SELinux context for [%s]\n", full_path); /* Not fatal */ } @@ -382,8 +382,8 @@ copy_file(int ifd, if (ofd < 0 && errno != EEXIST) { ret = errno; DEBUG(SSSDBG_OP_FAILURE, - ("Cannot open() destination file '%s': [%d][%s].\n", - full_path, ret, strerror(ret))); + "Cannot open() destination file '%s': [%d][%s].\n", + full_path, ret, strerror(ret)); goto done; } @@ -391,8 +391,8 @@ copy_file(int ifd, if (cnt == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Cannot read() from source file: [%d][%s].\n", - ret, strerror(ret))); + "Cannot read() from source file: [%d][%s].\n", + ret, strerror(ret)); goto done; } @@ -401,14 +401,14 @@ copy_file(int ifd, if (written == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Cannot write() to destination file: [%d][%s].\n", - ret, strerror(ret))); + "Cannot write() to destination file: [%d][%s].\n", + ret, strerror(ret)); goto done; } if (written != cnt) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Wrote %zd bytes, expected %zd\n", written, cnt)); + "Wrote %zd bytes, expected %zd\n", written, cnt); goto done; } } @@ -419,8 +419,8 @@ copy_file(int ifd, if (ret == -1 && errno != EPERM) { ret = errno; DEBUG(SSSDBG_OP_FAILURE, - ("Error changing owner of '%s': %s\n", - full_path, strerror(ret))); + "Error changing owner of '%s': %s\n", + full_path, strerror(ret)); goto done; } @@ -428,15 +428,15 @@ copy_file(int ifd, ret = fchmod(ofd, statp->st_mode); if (ret == -1) { ret = errno; - DEBUG(SSSDBG_OP_FAILURE, ("Error changing owner of '%s': %s\n", - full_path, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "Error changing owner of '%s': %s\n", + full_path, strerror(ret)); goto done; } ret = sss_futime_set(ofd, statp); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("sss_futime_set failed [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_MINOR_FAILURE, "sss_futime_set failed [%d]: %s\n", + ret, strerror(ret)); /* Do not fail */ } @@ -489,16 +489,16 @@ copy_entry(struct copy_ctx *cctx, O_RDONLY | O_NOFOLLOW | O_NONBLOCK, &ret); if (ifd == -1 && ret != ELOOP) { /* openat error */ - DEBUG(SSSDBG_CRIT_FAILURE, ("openat failed on '%s': %s\n", - src_ent_path, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "openat failed on '%s': %s\n", + src_ent_path, strerror(ret)); goto done; } else if (ifd == -1 && ret == ELOOP) { /* Should be a symlink.. */ ret = fstatat(src_dir_fd, ent_name, &st, AT_SYMLINK_NOFOLLOW); if (ret == -1) { ret = errno; - DEBUG(SSSDBG_CRIT_FAILURE, ("fstatat failed on '%s': %s\n", - src_ent_path, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "fstatat failed on '%s': %s\n", + src_ent_path, strerror(ret)); goto done; } @@ -506,8 +506,8 @@ copy_entry(struct copy_ctx *cctx, ret = copy_symlink(src_dir_fd, dest_dir_fd, ent_name, dest_ent_path, &st, cctx->uid, cctx->gid); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Cannot copy '%s' to '%s'\n", - src_ent_path, dest_ent_path)); + DEBUG(SSSDBG_OP_FAILURE, "Cannot copy '%s' to '%s'\n", + src_ent_path, dest_ent_path); } goto done; } @@ -516,7 +516,7 @@ copy_entry(struct copy_ctx *cctx, if (ret != 0) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("couldn't stat '%s': %s", src_ent_path, strerror(ret))); + "couldn't stat '%s': %s", src_ent_path, strerror(ret)); goto done; } @@ -528,8 +528,8 @@ copy_entry(struct copy_ctx *cctx, &st); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Couldn't recursively copy '%s' to '%s': %s\n", - src_ent_path, dest_ent_path, strerror(ret))); + "Couldn't recursively copy '%s' to '%s': %s\n", + src_ent_path, dest_ent_path, strerror(ret)); goto done; } } else if (S_ISREG(st.st_mode)) { @@ -537,14 +537,14 @@ copy_entry(struct copy_ctx *cctx, ret = copy_file(ifd, dest_dir_fd, ent_name, dest_ent_path, &st, cctx->uid, cctx->gid); if (ret) { - DEBUG(SSSDBG_OP_FAILURE, ("Cannot copy '%s' to '%s'\n", - src_ent_path, dest_ent_path)); + DEBUG(SSSDBG_OP_FAILURE, "Cannot copy '%s' to '%s'\n", + src_ent_path, dest_ent_path); goto done; } } else { /* Is a special file */ - DEBUG(SSSDBG_FUNC_DATA, ("'%s' is a special file, skipping.\n", - src_ent_path)); + DEBUG(SSSDBG_FUNC_DATA, "'%s' is a special file, skipping.\n", + src_ent_path); } ret = EOK; @@ -577,7 +577,7 @@ copy_dir(struct copy_ctx *cctx, if (dir == NULL) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Error reading '%s': %s", src_dir_path, strerror(ret))); + "Error reading '%s': %s", src_dir_path, strerror(ret)); goto done; } @@ -590,7 +590,7 @@ copy_dir(struct copy_ctx *cctx, if (ret == -1 && errno != EEXIST) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Error reading '%s': %s", dest_dir_path, strerror(ret))); + "Error reading '%s': %s", dest_dir_path, strerror(ret)); goto done; } @@ -599,7 +599,7 @@ copy_dir(struct copy_ctx *cctx, if (dest_dir_fd == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Error opening '%s': %s", dest_dir_path, strerror(ret))); + "Error opening '%s': %s", dest_dir_path, strerror(ret)); goto done; } @@ -616,8 +616,8 @@ copy_dir(struct copy_ctx *cctx, dest_dir_fd, dest_dir_path, ent->d_name); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Could not copy [%s] to [%s]\n", - src_dir_path, dest_dir_path)); + DEBUG(SSSDBG_OP_FAILURE, "Could not copy [%s] to [%s]\n", + src_dir_path, dest_dir_path); goto done; } } @@ -628,8 +628,8 @@ copy_dir(struct copy_ctx *cctx, if (ret == -1 && errno != EPERM) { ret = errno; DEBUG(SSSDBG_OP_FAILURE, - ("Error changing owner of '%s': %s", - dest_dir_path, strerror(ret))); + "Error changing owner of '%s': %s", + dest_dir_path, strerror(ret)); goto done; } @@ -640,15 +640,15 @@ copy_dir(struct copy_ctx *cctx, if (ret == -1) { ret = errno; DEBUG(SSSDBG_OP_FAILURE, - ("Error setting mode of '%s': %s", - dest_dir_path, strerror(ret))); + "Error setting mode of '%s': %s", + dest_dir_path, strerror(ret)); goto done; } sss_futime_set(dest_dir_fd, src_dir_stat); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("sss_futime_set failed [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_MINOR_FAILURE, "sss_futime_set failed [%d]: %s\n", + ret, strerror(ret)); /* Do not fail */ } @@ -659,7 +659,7 @@ done: if (dret != 0) { dret = errno; DEBUG(SSSDBG_MINOR_FAILURE, - ("Failed to close directory: %s.\n", strerror(dret))); + "Failed to close directory: %s.\n", strerror(dret)); } } @@ -708,7 +708,7 @@ int copy_tree(const char *src_root, const char *dst_root, dst_root, dst_root, mode_root, &s_src); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("copy_dir failed: [%d][%s]\n", ret, strerror(ret))); + "copy_dir failed: [%d][%s]\n", ret, strerror(ret)); goto fail; } diff --git a/src/tools/selinux.c b/src/tools/selinux.c index 4555a486f..c0e89fb59 100644 --- a/src/tools/selinux.c +++ b/src/tools/selinux.c @@ -92,7 +92,7 @@ int reset_selinux_file_context(void) #ifdef HAVE_SEMANAGE /* turn libselinux messages into SSSD DEBUG() calls */ -static void sss_semanage_error_callback(void *varg, +static void sss_semanage_error_callbackvoid *varg, semanage_handle_t *handle, const char *fmt, ...) { @@ -133,7 +133,7 @@ static semanage_handle_t *sss_semanage_init(void) handle = semanage_handle_create(); if (!handle) { - DEBUG(1, ("Cannot create SELinux management handle\n")); + DEBUG(1, ("Cannot create SELinux management handle\n"); return NULL; } @@ -143,25 +143,25 @@ static semanage_handle_t *sss_semanage_init(void) ret = semanage_is_managed(handle); if (ret != 1) { - DEBUG(1, ("SELinux policy not managed\n")); + DEBUG(1, "SELinux policy not managed\n"); goto fail; } ret = semanage_access_check(handle); if (ret < SEMANAGE_CAN_READ) { - DEBUG(1, ("Cannot read SELinux policy store\n")); + DEBUG(1, "Cannot read SELinux policy store\n"); goto fail; } ret = semanage_connect(handle); if (ret != 0) { - DEBUG(1, ("Cannot estabilish SELinux management connection\n")); + DEBUG(1, "Cannot estabilish SELinux management connection\n"); goto fail; } ret = semanage_begin_transaction(handle); if (ret != 0) { - DEBUG(1, ("Cannot begin SELinux transaction\n")); + DEBUG(1, "Cannot begin SELinux transaction\n"); goto fail; } @@ -181,35 +181,35 @@ static int sss_semanage_user_add(semanage_handle_t *handle, ret = semanage_seuser_create(handle, &seuser); if (ret != 0) { - DEBUG(1, ("Cannot create SELinux login mapping for %s\n", login_name)); + DEBUG(1, "Cannot create SELinux login mapping for %s\n", login_name); ret = EIO; goto done; } ret = semanage_seuser_set_name(handle, seuser, login_name); if (ret != 0) { - DEBUG(1, ("Could not set name for %s\n", login_name)); + DEBUG(1, "Could not set name for %s\n", login_name); ret = EIO; goto done; } ret = semanage_seuser_set_mlsrange(handle, seuser, DEFAULT_SERANGE); if (ret != 0) { - DEBUG(1, ("Could not set serange for %s\n", login_name)); + DEBUG(1, "Could not set serange for %s\n", login_name); ret = EIO; goto done; } ret = semanage_seuser_set_sename(handle, seuser, seuser_name); if (ret != 0) { - DEBUG(1, ("Could not set SELinux user for %s\n", login_name)); + DEBUG(1, "Could not set SELinux user for %s\n", login_name); ret = EIO; goto done; } ret = semanage_seuser_modify_local(handle, key, seuser); if (ret != 0) { - DEBUG(1, ("Could not add login mapping for %s\n", login_name)); + DEBUG(1, "Could not add login mapping for %s\n", login_name); ret = EIO; goto done; } @@ -230,28 +230,28 @@ static int sss_semanage_user_mod(semanage_handle_t *handle, semanage_seuser_query(handle, key, &seuser); if (seuser == NULL) { - DEBUG(1, ("Could not query seuser for %s\n", login_name)); + DEBUG(1, "Could not query seuser for %s\n", login_name); ret = EIO; goto done; } ret = semanage_seuser_set_mlsrange(handle, seuser, DEFAULT_SERANGE); if (ret != 0) { - DEBUG(1, ("Could not set serange for %s\n", login_name)); + DEBUG(1, "Could not set serange for %s\n", login_name); ret = EIO; goto done; } ret = semanage_seuser_set_sename(handle, seuser, seuser_name); if (ret != 0) { - DEBUG(1, ("Could not set sename for %s\n", login_name)); + DEBUG(1, "Could not set sename for %s\n", login_name); ret = EIO; goto done; } ret = semanage_seuser_modify_local(handle, key, seuser); if (ret != 0) { - DEBUG(1, (("Could not modify login mapping for %s\n"), login_name)); + DEBUG(1, ("Could not modify login mapping for %s\n"), login_name); ret = EIO; goto done; } @@ -276,21 +276,21 @@ int set_seuser(const char *login_name, const char *seuser_name) handle = sss_semanage_init(); if (!handle) { - DEBUG(1, ("Cannot init SELinux management\n")); + DEBUG(1, "Cannot init SELinux management\n"); ret = EIO; goto done; } ret = semanage_seuser_key_create(handle, login_name, &key); if (ret != 0) { - DEBUG(1, ("Cannot create SELinux user key\n")); + DEBUG(1, "Cannot create SELinux user key\n"); ret = EIO; goto done; } ret = semanage_seuser_exists(handle, key, &seuser_exists); if (ret < 0) { - DEBUG(1, ("Cannot verify the SELinux user\n")); + DEBUG(1, "Cannot verify the SELinux user\n"); ret = EIO; goto done; } @@ -298,14 +298,14 @@ int set_seuser(const char *login_name, const char *seuser_name) if (seuser_exists) { ret = sss_semanage_user_mod(handle, key, login_name, seuser_name); if (ret != 0) { - DEBUG(1, ("Cannot modify SELinux user mapping\n")); + DEBUG(1, "Cannot modify SELinux user mapping\n"); ret = EIO; goto done; } } else { ret = sss_semanage_user_add(handle, key, login_name, seuser_name); if (ret != 0) { - DEBUG(1, ("Cannot add SELinux user mapping\n")); + DEBUG(1, "Cannot add SELinux user mapping\n"); ret = EIO; goto done; } @@ -313,7 +313,7 @@ int set_seuser(const char *login_name, const char *seuser_name) ret = semanage_commit(handle); if (ret < 0) { - DEBUG(1, ("Cannot commit SELinux transaction\n")); + DEBUG(1, "Cannot commit SELinux transaction\n"); ret = EIO; goto done; } @@ -334,56 +334,56 @@ int del_seuser(const char *login_name) handle = sss_semanage_init(); if (!handle) { - DEBUG(1, ("Cannot init SELinux management\n")); + DEBUG(1, "Cannot init SELinux management\n"); ret = EIO; goto done; } ret = semanage_seuser_key_create(handle, login_name, &key); if (ret != 0) { - DEBUG(1, ("Cannot create SELinux user key\n")); + DEBUG(1, "Cannot create SELinux user key\n"); ret = EIO; goto done; } ret = semanage_seuser_exists(handle, key, &exists); if (ret < 0) { - DEBUG(1, ("Cannot verify the SELinux user\n")); + DEBUG(1, "Cannot verify the SELinux user\n"); ret = EIO; goto done; } if (!exists) { - DEBUG(5, ("Login mapping for %s is not defined, OK if default mapping " - "was used\n", login_name)); + DEBUG(5, "Login mapping for %s is not defined, OK if default mapping " + "was used\n", login_name); ret = EOK; /* probably default mapping */ goto done; } ret = semanage_seuser_exists_local(handle, key, &exists); if (ret < 0) { - DEBUG(1, ("Cannot verify the SELinux user\n")); + DEBUG(1, "Cannot verify the SELinux user\n"); ret = EIO; goto done; } if (!exists) { - DEBUG(1, ("Login mapping for %s is defined in policy, " - "cannot be deleted", login_name)); + DEBUG(1, "Login mapping for %s is defined in policy, " + "cannot be deleted", login_name); ret = ENOENT; goto done; } ret = semanage_seuser_del_local(handle, key); if (ret != 0) { - DEBUG(1, ("Could not delete login mapping for %s", login_name)); + DEBUG(1, "Could not delete login mapping for %s", login_name); ret = EIO; goto done; } ret = semanage_commit(handle); if (ret < 0) { - DEBUG(1, ("Cannot commit SELinux transaction\n")); + DEBUG(1, "Cannot commit SELinux transaction\n"); ret = EIO; goto done; } diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index ed02b7b60..77cba4610 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -106,7 +106,7 @@ int main(int argc, const char *argv[]) ret = init_context(argc, argv, &tctx); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Error initializing context for the application\n")); + "Error initializing context for the application\n"); goto done; } @@ -118,7 +118,7 @@ int main(int argc, const char *argv[]) ret = sysdb_update_subdomains(dinfo); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Failed to update subdomains for domain %s.\n", dinfo->name)); + "Failed to update subdomains for domain %s.\n", dinfo->name); } } @@ -126,14 +126,14 @@ int main(int argc, const char *argv[]) /* Update filters for each domain */ ret = update_all_filters(tctx, dinfo); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to update filters.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to update filters.\n"); goto done; } ret = sysdb_transaction_start(sysdb); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not start the transaction!\n")); + "Could not start the transaction!\n"); goto done; } @@ -156,11 +156,11 @@ int main(int argc, const char *argv[]) ret = sysdb_transaction_commit(sysdb); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not commit the transaction!\n")); + "Could not commit the transaction!\n"); ret = sysdb_transaction_cancel(sysdb); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Failed to cancel transaction\n")); + "Failed to cancel transaction\n"); } } } @@ -172,7 +172,7 @@ int main(int argc, const char *argv[]) } else { ret = sss_memcache_clear_all(); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to clear memory cache.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to clear memory cache.\n"); goto done; } } @@ -205,14 +205,14 @@ static errno_t update_filter(struct cache_tool_ctx *tctx, tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory.\n"); return ENOMEM; } ret = sss_parse_name(tmp_ctx, dinfo->names, name, &parsed_domain, &parsed_name); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("sss_parse_name failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "sss_parse_name failed\n"); goto done; } @@ -227,7 +227,7 @@ static errno_t update_filter(struct cache_tool_ctx *tctx, if (!dinfo->case_sensitive && !force_case_sensitivity) { use_name = sss_tc_utf8_str_tolower(tmp_ctx, parsed_name); if (!use_name) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory\n"); ret = ENOMEM; goto done; } @@ -246,7 +246,7 @@ static errno_t update_filter(struct cache_tool_ctx *tctx, ret = sss_filter_sanitize_for_dom(tmp_ctx, use_name, dinfo, &sanitized, &lc_sanitized); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to sanitize the given name.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to sanitize the given name.\n"); goto done; } @@ -262,7 +262,7 @@ static errno_t update_filter(struct cache_tool_ctx *tctx, filter = talloc_strdup(tmp_ctx, sanitized); } if (filter == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory\n"); ret = ENOMEM; goto done; } @@ -375,12 +375,12 @@ static bool invalidate_entries(TALLOC_CTX *ctx, if (ret != EOK) { if (ret == ENOENT) { - DEBUG(SSSDBG_TRACE_FUNC, ("'%s' %s: Not found in domain '%s'\n", - type_string, name ? name : "", dinfo->name)); + DEBUG(SSSDBG_TRACE_FUNC, "'%s' %s: Not found in domain '%s'\n", + type_string, name ? name : "", dinfo->name); } else { DEBUG(SSSDBG_CRIT_FAILURE, - ("Searching for %s in domain %s with filter %s failed\n", - type_string, dinfo->name, filter)); + "Searching for %s in domain %s with filter %s failed\n", + type_string, dinfo->name, filter); } return false; } @@ -390,14 +390,14 @@ static bool invalidate_entries(TALLOC_CTX *ctx, c_name = ldb_msg_find_attr_as_string(msgs[i], SYSDB_NAME, NULL); if (c_name == NULL) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Something bad happened, can't find attribute %s", SYSDB_NAME)); + "Something bad happened, can't find attribute %s", SYSDB_NAME); ERROR("Couldn't invalidate %1$s", type_string); iret = false; } else { ret = invalidate_entry(ctx, dinfo, c_name, entry_type); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Couldn't invalidate %s %s", type_string, c_name)); + "Couldn't invalidate %s %s", type_string, c_name); ERROR("Couldn't invalidate %1$s %2$s", type_string, c_name); iret = false; } @@ -450,14 +450,14 @@ static errno_t invalidate_entry(TALLOC_CTX *ctx, return EINVAL; } if (ret != EOK) { - DEBUG(3, ("Could not set entry attributes\n")); + DEBUG(3, "Could not set entry attributes\n"); } } else { - DEBUG(3, ("Could not add expiration time to attributes\n")); + DEBUG(3, "Could not add expiration time to attributes\n"); } talloc_zfree(sys_attrs); } else { - DEBUG(3, ("Could not create sysdb attributes\n")); + DEBUG(3, "Could not create sysdb attributes\n"); ret = ENOMEM; } return ret; @@ -478,7 +478,7 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain) ret = confdb_init(ctx, &ctx->confdb, confdb_path); talloc_free(confdb_path); if (ret != EOK) { - DEBUG(1, ("Could not initialize connection to the confdb\n")); + DEBUG(1, "Could not initialize connection to the confdb\n"); return ret; } @@ -487,21 +487,21 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain) domain, DB_PATH, &ctx->domains); if (ret != EOK) { SYSDB_VERSION_ERROR(ret); - DEBUG(1, ("Could not initialize connection to the sysdb\n")); + DEBUG(1, "Could not initialize connection to the sysdb\n"); return ret; } } else { ret = confdb_get_domains(ctx->confdb, &ctx->domains); if (ret != EOK) { - DEBUG(1, ("Could not initialize domains\n")); + DEBUG(1, "Could not initialize domains\n"); return ret; } ret = sysdb_init(ctx, ctx->domains, false); SYSDB_VERSION_ERROR(ret); if (ret != EOK) { - DEBUG(1, ("Could not initialize connection to the sysdb\n")); + DEBUG(1, "Could not initialize connection to the sysdb\n"); return ret; } } @@ -509,7 +509,7 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain) for (dinfo = ctx->domains; dinfo; dinfo = get_next_domain(dinfo, false)) { ret = sss_names_init(ctx, ctx->confdb, dinfo->name, &dinfo->names); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("sss_names_init() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "sss_names_init() failed\n"); return ret; } } @@ -566,7 +566,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) ret = set_locale(); if (ret != EOK) { - DEBUG(1, ("set_locale failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); goto fini; } @@ -613,7 +613,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) ctx = talloc_zero(NULL, struct cache_tool_ctx); if (ctx == NULL) { - DEBUG(1, ("Could not allocate memory for tools context\n")); + DEBUG(1, "Could not allocate memory for tools context\n"); ret = ENOMEM; goto fini; } @@ -667,7 +667,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) (user && !ctx->user_name) || (group && !ctx->group_name) || (netgroup && !ctx->netgroup_name) || (map && !ctx->autofs_name) || (service && !ctx->service_name)) { - DEBUG(1, ("Construction of filters failed\n")); + DEBUG(1, "Construction of filters failed\n"); ret = ENOMEM; goto fini; } @@ -682,7 +682,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) ERROR("Could not open available domains\n"); } DEBUG(SSSDBG_OP_FAILURE, - ("Initialization of sysdb connections failed\n")); + "Initialization of sysdb connections failed\n"); goto fini; } diff --git a/src/tools/sss_debuglevel.c b/src/tools/sss_debuglevel.c index de9c8ac65..c38591cfa 100644 --- a/src/tools/sss_debuglevel.c +++ b/src/tools/sss_debuglevel.c @@ -111,7 +111,7 @@ int main(int argc, const char **argv) } if (config_file == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_strdup() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup() failed\n"); ret = ENOMEM; goto fini; } @@ -128,7 +128,7 @@ int main(int argc, const char **argv) ctx = talloc_zero(NULL, struct debuglevel_tool_ctx); if (ctx == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not allocate memory for tools context\n")); + "Could not allocate memory for tools context\n"); ret = ENOMEM; goto fini; } @@ -163,15 +163,15 @@ errno_t set_debug_level(struct debuglevel_tool_ctx *tool_ctx, TALLOC_CTX *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 ENOMEM; } /* convert debug_to_set to string */ values[0] = talloc_asprintf(tmp_ctx, "0x%.4x", debug_to_set); if (values[0] == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Could not allocate memory for " - "debug_to_set to string conversion\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not allocate memory for " + "debug_to_set to string conversion\n"); ret = ENOMEM; goto done; } @@ -193,8 +193,8 @@ errno_t set_debug_level(struct debuglevel_tool_ctx *tool_ctx, errno = 0; if (utime(config_file, NULL) == -1 ) { err = errno; - DEBUG(SSSDBG_MINOR_FAILURE, ("Unable to change mtime of \"%s\": %s\n", - config_file, strerror(err))); + DEBUG(SSSDBG_MINOR_FAILURE, "Unable to change mtime of \"%s\": %s\n", + config_file, strerror(err)); } ret = EOK; @@ -212,14 +212,14 @@ errno_t connect_to_confdb(TALLOC_CTX *ctx, struct confdb_ctx **cdb_ctx) confdb_path = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE); if (confdb_path == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not allocate memory for confdb path\n")); + "Could not allocate memory for confdb path\n"); return ENOMEM; } ret = confdb_init(ctx, cdb_ctx, confdb_path); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not initialize connection to the confdb\n")); + "Could not initialize connection to the confdb\n"); } talloc_free(confdb_path); @@ -249,14 +249,14 @@ errno_t get_confdb_sections(TALLOC_CTX *ctx, struct confdb_ctx *confdb, TALLOC_CTX *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 ENOMEM; } /* get domains */ ret = confdb_get_domains(confdb, &domain_list); if (ret != EOK) - DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to get domain list\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to get domain list\n"); for (domain = domain_list; domain; @@ -269,7 +269,7 @@ errno_t get_confdb_sections(TALLOC_CTX *ctx, struct confdb_ctx *confdb, domain_count + known_services_count + 1); if (sections == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not allocate memory for sections\n")); + "Could not allocate memory for sections\n"); ret = ENOMEM; goto fail; } @@ -277,7 +277,7 @@ errno_t get_confdb_sections(TALLOC_CTX *ctx, struct confdb_ctx *confdb, for (i = 0; i < known_services_count; i++) { sections[i] = talloc_strdup(tmp_ctx, known_services[i]); if (sections[i] == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_strdup() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup() failed\n"); ret = ENOMEM; goto fail; } @@ -289,7 +289,7 @@ errno_t get_confdb_sections(TALLOC_CTX *ctx, struct confdb_ctx *confdb, sections[i] = talloc_asprintf(tmp_ctx, CONFDB_DOMAIN_PATH_TMPL, domain->name); if (sections[i] == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_asprintf() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf() failed\n"); ret = ENOMEM; goto fail; } diff --git a/src/tools/sss_groupadd.c b/src/tools/sss_groupadd.c index 6e600401d..8f5da01c0 100644 --- a/src/tools/sss_groupadd.c +++ b/src/tools/sss_groupadd.c @@ -54,7 +54,7 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, ("set_locale failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -79,7 +79,7 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { - DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -108,7 +108,7 @@ int main(int argc, const char **argv) tctx->error = sysdb_transaction_start(tctx->sysdb); if (tctx->error != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to start transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n"); goto done; } in_transaction = true; @@ -121,7 +121,7 @@ int main(int argc, const char **argv) tctx->error = sysdb_transaction_commit(tctx->sysdb); if (tctx->error != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to commit transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to commit transaction\n"); goto done; } in_transaction = false; @@ -130,7 +130,7 @@ done: if (in_transaction) { sret = sysdb_transaction_cancel(tctx->sysdb); if (sret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to cancel transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to cancel transaction\n"); } } @@ -146,7 +146,7 @@ done: break; default: - DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret))); + DEBUG(1, "sysdb operation failed (%d)[%s]\n", ret, strerror(ret)); ERROR("Transaction error. Could not add group.\n"); break; } diff --git a/src/tools/sss_groupdel.c b/src/tools/sss_groupdel.c index d13309d24..df49a7563 100644 --- a/src/tools/sss_groupdel.c +++ b/src/tools/sss_groupdel.c @@ -49,7 +49,7 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, ("set_locale failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -73,7 +73,7 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { - DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -123,7 +123,7 @@ int main(int argc, const char **argv) done: if (ret) { - DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret))); + DEBUG(1, "sysdb operation failed (%d)[%s]\n", ret, strerror(ret)); switch (ret) { case ENOENT: ERROR("No such group in local domain. " diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c index 39c46d1cb..5ee97dd5e 100644 --- a/src/tools/sss_groupmod.c +++ b/src/tools/sss_groupmod.c @@ -61,7 +61,7 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, ("set_locale failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -106,7 +106,7 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { - DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -137,7 +137,7 @@ int main(int argc, const char **argv) if (addgroups) { ret = parse_groups(tctx, addgroups, &tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse groups to add the group to\n")); + DEBUG(1, "Cannot parse groups to add the group to\n"); ERROR("Internal error while parsing parameters\n"); ret = EXIT_FAILURE; goto fini; @@ -145,7 +145,7 @@ int main(int argc, const char **argv) ret = parse_group_name_domain(tctx, tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse FQDN groups to add the group to\n")); + DEBUG(1, "Cannot parse FQDN groups to add the group to\n"); ERROR("Member groups must be in the same domain as parent group\n"); ret = EXIT_FAILURE; goto fini; @@ -164,7 +164,7 @@ int main(int argc, const char **argv) if (rmgroups) { ret = parse_groups(tctx, rmgroups, &tctx->octx->rmgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse groups to remove the group from\n")); + DEBUG(1, "Cannot parse groups to remove the group from\n"); ERROR("Internal error while parsing parameters\n"); ret = EXIT_FAILURE; goto fini; @@ -172,7 +172,7 @@ int main(int argc, const char **argv) ret = parse_group_name_domain(tctx, tctx->octx->rmgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse FQDN groups to remove the group from\n")); + DEBUG(1, "Cannot parse FQDN groups to remove the group from\n"); ERROR("Member groups must be in the same domain as parent group\n"); ret = EXIT_FAILURE; goto fini; @@ -196,7 +196,7 @@ int main(int argc, const char **argv) tctx->error = sysdb_transaction_start(tctx->sysdb); if (tctx->error != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to start transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n"); goto done; } in_transaction = true; @@ -209,7 +209,7 @@ int main(int argc, const char **argv) tctx->error = sysdb_transaction_commit(tctx->sysdb); if (tctx->error != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to commit transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to commit transaction\n"); goto done; } in_transaction = false; @@ -239,12 +239,12 @@ done: if (in_transaction) { sret = sysdb_transaction_cancel(tctx->sysdb); if (sret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to cancel transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to cancel transaction\n"); } } if (tctx->error) { ret = tctx->error; - DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret))); + DEBUG(1, "sysdb operation failed (%d)[%s]\n", ret, strerror(ret)); switch (ret) { case ENOENT: ERROR("Could not modify group - check if member group names are correct\n"); diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c index 02df6d4b4..8689760d8 100644 --- a/src/tools/sss_groupshow.c +++ b/src/tools/sss_groupshow.c @@ -80,7 +80,7 @@ static int parse_memberofs(struct ldb_context *ldb, if (gi->memberofs[i] == NULL) { return ENOMEM; } - DEBUG(6, ("memberof value: %s\n", gi->memberofs[i])); + DEBUG(6, "memberof value: %s\n", gi->memberofs[i]); } gi->memberofs[el->num_values] = NULL; @@ -140,7 +140,7 @@ static int parse_members(TALLOC_CTX *mem_ctx, ret = ENOMEM; goto fail; } - DEBUG(6, ("User member %s\n", um[um_index])); + DEBUG(6, "User member %s\n", um[um_index]); um_index++; } else if (ldb_dn_compare_base(parent_dn, group_basedn) == 0) { gm[gm_index] = rdn_as_string(mem_ctx, dn); @@ -149,15 +149,15 @@ static int parse_members(TALLOC_CTX *mem_ctx, goto fail; } if (parent_name && strcmp(gm[gm_index], parent_name) == 0) { - DEBUG(6, ("Skipping circular nesting for group %s\n", - gm[gm_index])); + DEBUG(6, "Skipping circular nesting for group %s\n", + gm[gm_index]); continue; } - DEBUG(6, ("Group member %s\n", gm[gm_index])); + DEBUG(6, "Group member %s\n", gm[gm_index]); gm_index++; } else { - DEBUG(2, ("Group member not a user nor group: %s\n", - ldb_dn_get_linearized(dn))); + DEBUG(2, "Group member not a user nor group: %s\n", + ldb_dn_get_linearized(dn)); ret = EIO; goto fail; } @@ -216,7 +216,7 @@ static int process_group(TALLOC_CTX *mem_ctx, struct group_info *gi = NULL; const char **user_members; - DEBUG(6, ("Found entry %s\n", ldb_dn_get_linearized(msg->dn))); + DEBUG(6, "Found entry %s\n", ldb_dn_get_linearized(msg->dn)); gi = talloc_zero(mem_ctx, struct group_info); if (!gi) { @@ -232,7 +232,7 @@ static int process_group(TALLOC_CTX *mem_ctx, gi->gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0); if (gi->gid == 0 || gi->name == NULL) { - DEBUG(3, ("No name or no GID?\n")); + DEBUG(3, "No name or no GID?\n"); ret = EIO; goto done; } @@ -334,7 +334,7 @@ int group_show(TALLOC_CTX *mem_ctx, /* First, search for the root group */ ret = sysdb_search_group_by_name(mem_ctx, domain, name, attrs, &msg); if (ret) { - DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret)); + DEBUG(2, "Search failed: %s (%d)\n", strerror(ret), ret); goto done; } @@ -342,8 +342,8 @@ int group_show(TALLOC_CTX *mem_ctx, msg, domain, NULL, &root, &group_members, &nmembers); if (ret != EOK) { - DEBUG(2, ("Group processing failed: %s (%d)\n", - strerror(ret), ret)); + DEBUG(2, "Group processing failed: %s (%d)\n", + strerror(ret), ret); goto done; } @@ -392,7 +392,7 @@ int group_show(TALLOC_CTX *mem_ctx, group_members, nmembers, &root->group_members); if (ret) { - DEBUG(2, ("Recursive search failed: %s (%d)\n", strerror(ret), ret)); + DEBUG(2, "Recursive search failed: %s (%d)\n", strerror(ret), ret); goto done; } @@ -446,8 +446,8 @@ static int group_show_trim_memberof(TALLOC_CTX *mem_ctx, name = ldb_msg_find_attr_as_string(msgs[0], SYSDB_NAME, NULL); if (!name) { - DEBUG(2, ("Entry %s has no Name Attribute ?!?\n", - ldb_dn_get_linearized(msgs[0]->dn))); + DEBUG(2, "Entry %s has no Name Attribute ?!?\n", + ldb_dn_get_linearized(msgs[0]->dn)); return EFAULT; } @@ -507,7 +507,7 @@ int group_show_recurse(TALLOC_CTX *mem_ctx, ret = sysdb_search_group_by_name(mem_ctx, domain, group_members[i], attrs, &msg); if (ret) { - DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret)); + DEBUG(2, "Search failed: %s (%d)\n", strerror(ret), ret); return EIO; } @@ -515,8 +515,8 @@ int group_show_recurse(TALLOC_CTX *mem_ctx, msg, domain, parent->name, &groups[i], &new_group_members, &new_nmembers); if (ret != EOK) { - DEBUG(2, ("Group processing failed: %s (%d)\n", - strerror(ret), ret)); + DEBUG(2, "Group processing failed: %s (%d)\n", + strerror(ret), ret); return ret; } @@ -527,8 +527,8 @@ int group_show_recurse(TALLOC_CTX *mem_ctx, new_group_members, new_nmembers, &parent->group_members); if (ret != EOK) { - DEBUG(2, ("Recursive search failed: %s (%d)\n", - strerror(ret), ret)); + DEBUG(2, "Recursive search failed: %s (%d)\n", + strerror(ret), ret); return ret; } talloc_zfree(new_group_members); @@ -559,7 +559,7 @@ static int group_show_mpg(TALLOC_CTX *mem_ctx, ret = sysdb_search_user_by_name(info, domain, name, attrs, &msg); if (ret) { - DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret)); + DEBUG(2, "Search failed: %s (%d)\n", strerror(ret), ret); goto fail; } @@ -568,7 +568,7 @@ static int group_show_mpg(TALLOC_CTX *mem_ctx, SYSDB_NAME, NULL)); info->gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_UIDNUM, 0); if (info->gid == 0 || info->name == NULL) { - DEBUG(3, ("No name or no GID?\n")); + DEBUG(3, "No name or no GID?\n"); ret = EIO; goto fail; } @@ -656,7 +656,7 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, ("set_locale failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -688,7 +688,7 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { - DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -716,7 +716,7 @@ int main(int argc, const char **argv) /* Process result */ if (ret) { - DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret))); + DEBUG(1, "sysdb operation failed (%d)[%s]\n", ret, strerror(ret)); switch (ret) { case ENOENT: ERROR("No such group in local domain. " diff --git a/src/tools/sss_seed.c b/src/tools/sss_seed.c index 09af8b9b2..32ab43b9c 100644 --- a/src/tools/sss_seed.c +++ b/src/tools/sss_seed.c @@ -78,8 +78,8 @@ static int seed_prompt(const char *req) len = sss_atomic_write_s(STDOUT_FILENO, &prompt[i++], 1); if (len == -1) { ret = errno; - DEBUG(SSSDBG_CRIT_FAILURE, ("write failed [%d][%s].\n", - ret, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "write failed [%d][%s].\n", + ret, strerror(ret)); goto done; } } @@ -107,8 +107,8 @@ static int seed_str_input(TALLOC_CTX *mem_ctx, while ((bytes_read = sss_atomic_read_s(STDIN_FILENO, buf+len, 1)) != 0) { if (bytes_read == -1) { ret = errno; - DEBUG(SSSDBG_CRIT_FAILURE, ("read failed [%d][%s].\n", - ret, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "read failed [%d][%s].\n", + ret, strerror(ret)); return ret; } if (buf[len] == '\n' || len == BUFSIZE) { @@ -121,7 +121,7 @@ static int seed_str_input(TALLOC_CTX *mem_ctx, *_input = talloc_strdup(mem_ctx, buf); if (*_input == NULL) { ret = ENOMEM; - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to allocate input\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to allocate input\n"); } return ret; @@ -145,8 +145,8 @@ static int seed_id_input(const char *req, while ((bytes_read = sss_atomic_read_s(STDIN_FILENO, buf+len, 1)) != 0) { if (bytes_read == -1) { ret = errno; - DEBUG(SSSDBG_CRIT_FAILURE, ("read failed [%d][%s].\n", - ret, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "read failed [%d][%s].\n", + ret, strerror(ret)); return ret; } if (buf[len] == '\n' || len == BUFSIZE) { @@ -161,18 +161,18 @@ static int seed_id_input(const char *req, *_id_input = (uid_t)strtoll(buf, &endptr, 10); if (errno != 0) { ret = errno; - DEBUG(SSSDBG_OP_FAILURE, ("strtoll failed on [%s]: [%d][%s].\n", - (char *)buf, ret, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "strtoll failed on [%s]: [%d][%s].\n", + (char *)buf, ret, strerror(ret)); return ret; } if (*endptr != '\0') { DEBUG(SSSDBG_MINOR_FAILURE, - ("extra characters [%s] after ID [%"SPRIuid"]\n", - endptr, *_id_input)); + "extra characters [%s] after ID [%"SPRIuid"]\n", + endptr, *_id_input); } } else { ret = EINVAL; - DEBUG(SSSDBG_OP_FAILURE, ("Failed to get %s input.\n", req)); + DEBUG(SSSDBG_OP_FAILURE, "Failed to get %s input.\n", req); } return ret; @@ -187,14 +187,14 @@ static int seed_password_input_prompt(TALLOC_CTX *mem_ctx, char **_password) tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Could not allocate temp context\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not allocate temp context\n"); ret = ENOMEM; goto done; } temp = getpass("Enter temporary password:"); if (temp == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to get prompted password\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to get prompted password\n"); ret = EINVAL; goto done; } @@ -216,14 +216,14 @@ static int seed_password_input_prompt(TALLOC_CTX *mem_ctx, char **_password) temp = getpass("Enter temporary password again:"); if (temp == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to get prompted password\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to get prompted password\n"); ret = EINVAL; goto done; } if (strncmp(temp,password,strlen(password)) != 0) { ERROR("Passwords do not match\n"); - DEBUG(SSSDBG_MINOR_FAILURE, ("Provided passwords do not match\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Provided passwords do not match\n"); ret = EINVAL; goto done; } @@ -250,16 +250,16 @@ static int seed_password_input_file(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Could not allocate temp context\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not allocate temp context\n"); ret = ENOMEM; goto done; } fd = open(filename, O_RDONLY); if (fd == -1) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to open password file " + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to open password file " "[%s] [%d][%s]\n", - filename, errno, strerror(errno))); + filename, errno, strerror(errno)); ret = EINVAL; goto done; } @@ -268,9 +268,9 @@ static int seed_password_input_file(TALLOC_CTX *mem_ctx, len = sss_atomic_read_s(fd, buf, PASS_MAX + 1); if (len == -1) { ret = errno; - DEBUG(SSSDBG_MINOR_FAILURE, ("Failed to read password from file " + DEBUG(SSSDBG_MINOR_FAILURE, "Failed to read password from file " "[%s] [%d][%s]\n", - filename, ret, strerror(ret))); + filename, ret, strerror(ret)); close(fd); goto done; } @@ -341,7 +341,7 @@ static int seed_interactive_input(TALLOC_CTX *mem_ctx, ret = seed_str_input(input_uctx, _("username"), &input_uctx->name); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Username interactive input failed.\n")); + "Username interactive input failed.\n"); goto done; } } else { @@ -355,7 +355,7 @@ static int seed_interactive_input(TALLOC_CTX *mem_ctx, if (uctx->uid == 0) { ret = seed_id_input(_("UID"), &input_uctx->uid); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("UID interactive input failed.\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "UID interactive input failed.\n"); goto done; } } else { @@ -365,7 +365,7 @@ static int seed_interactive_input(TALLOC_CTX *mem_ctx, if (uctx->gid == 0) { ret = seed_id_input(_("GID"), &input_uctx->gid); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("GID interactive input failed.\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "GID interactive input failed.\n"); goto done; } } else { @@ -376,7 +376,7 @@ static int seed_interactive_input(TALLOC_CTX *mem_ctx, ret = seed_str_input(input_uctx, _("user comment (gecos)"), &input_uctx->gecos); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Gecos interactive input failed.\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Gecos interactive input failed.\n"); goto done; } } else { @@ -392,7 +392,7 @@ static int seed_interactive_input(TALLOC_CTX *mem_ctx, &input_uctx->home); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Home directory interactive input fialed.\n")); + "Home directory interactive input fialed.\n"); goto done; } } else { @@ -407,7 +407,7 @@ static int seed_interactive_input(TALLOC_CTX *mem_ctx, ret = seed_str_input(input_uctx, _("user login shell"), &input_uctx->shell); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Shell interactive input failed\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Shell interactive input failed\n"); goto done; } } else { @@ -479,14 +479,14 @@ static int seed_init(TALLOC_CTX *mem_ctx, sctx = talloc_zero(tmp_ctx, struct seed_ctx); if (sctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Could not allocate tools context\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not allocate tools context\n"); ret = ENOMEM; goto fini; } sctx->uctx = talloc_zero(sctx, struct user_ctx); if (sctx->uctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Could not allocate user data context\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not allocate user data context\n"); ret = ENOMEM; goto fini; } @@ -494,8 +494,8 @@ static int seed_init(TALLOC_CTX *mem_ctx, debug_prg_name = argv[0]; ret = set_locale(); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("set_locale failed (%d): %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "set_locale failed (%d): %s\n", + ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EINVAL; goto fini; @@ -513,7 +513,7 @@ static int seed_init(TALLOC_CTX *mem_ctx, while ((ret = poptGetNextOpt(pc)) > 0) { switch (ret) { case 'i': - DEBUG(SSSDBG_TRACE_INTERNAL, ("Interactive mode selected\n")); + DEBUG(SSSDBG_TRACE_INTERNAL, "Interactive mode selected\n"); sctx->interact = true; break; } @@ -625,7 +625,7 @@ static int seed_init_db(TALLOC_CTX *mem_ctx, ret = confdb_init(tmp_ctx, &confdb, confdb_path); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not initialize connection to the confdb\n")); + "Could not initialize connection to the confdb\n"); ERROR("Could not initialize connection to the confdb\n"); goto done; } @@ -634,8 +634,8 @@ static int seed_init_db(TALLOC_CTX *mem_ctx, if (ret != EOK) { SYSDB_VERSION_ERROR(ret); DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not initialize connection to domain '%s' in sysdb.%s\n", - domain_name, ret == ENOENT ? " Domain not found." : "")); + "Could not initialize connection to domain '%s' in sysdb.%s\n", + domain_name, ret == ENOENT ? " Domain not found." : ""); ERROR("Could not initialize connection to domain '%1$s' in sysdb.%2$s\n", domain_name, ret == ENOENT ? " Domain not found." : ""); @@ -678,8 +678,8 @@ static int seed_domain_user_info(const char *name, passwd = getpwnam(fq_name); if (passwd == NULL) { ret = errno; - DEBUG(SSSDBG_MINOR_FAILURE, ("getpwnam failed [%d] [%s]\n", - ret, strerror(ret))); + DEBUG(SSSDBG_MINOR_FAILURE, "getpwnam failed [%d] [%s]\n", + ret, strerror(ret)); goto done; } @@ -687,38 +687,38 @@ static int seed_domain_user_info(const char *name, ret = sysdb_getpwnam(tmp_ctx, domain, name, &res); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Couldn't lookup user (%s) in the cache\n", name)); + "Couldn't lookup user (%s) in the cache\n", name); goto done; } if (res->count == 0) { DEBUG(SSSDBG_TRACE_INTERNAL, - ("User (%s) wasn't found in the cache\n", name)); + "User (%s) wasn't found in the cache\n", name); *is_cached = false; ret = ENOENT; goto done; } else if (res->count > 1) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Multiple user (%s) entries were found in the cache\n", name)); + "Multiple user (%s) entries were found in the cache\n", name); ret = EINVAL; goto done; } else { - DEBUG(SSSDBG_TRACE_INTERNAL, ("User found in cache\n")); + DEBUG(SSSDBG_TRACE_INTERNAL, "User found in cache\n"); *is_cached = true; errno = 0; ret = initgroups(fq_name, passwd->pw_gid); if (ret != EOK) { ret = errno; - DEBUG(SSSDBG_MINOR_FAILURE, ("initgroups failed [%d] [%s]\n", - ret, strerror(ret))); + DEBUG(SSSDBG_MINOR_FAILURE, "initgroups failed [%d] [%s]\n", + ret, strerror(ret)); goto done; } } done: if (ret == ENOMEM) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to allocate user information\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to allocate user information\n"); } talloc_zfree(tmp_ctx); return ret; @@ -732,7 +732,7 @@ static int seed_cache_user(struct seed_ctx *sctx) ret = sysdb_transaction_start(sctx->sysdb); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("sysdb transaction start failure\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "sysdb transaction start failure\n"); goto done; } @@ -745,8 +745,8 @@ static int seed_cache_user(struct seed_ctx *sctx) sctx->uctx->shell, NULL, NULL, 0, 0); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Failed to add user to the cache. (%d)[%s]\n", - ret, strerror(ret))); + "Failed to add user to the cache. (%d)[%s]\n", + ret, strerror(ret)); ERROR("Failed to create user cache entry\n"); goto done; } @@ -755,15 +755,15 @@ static int seed_cache_user(struct seed_ctx *sctx) ret = sysdb_cache_password(sctx->domain, sctx->uctx->name, sctx->uctx->password); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to cache password. (%d)[%s]\n", - ret, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "Failed to cache password. (%d)[%s]\n", + ret, strerror(ret)); ERROR("Failed to cache password\n"); goto done; } ret = sysdb_transaction_commit(sctx->sysdb); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("sysdb transaction commit failure\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "sysdb transaction commit failure\n"); goto done; } @@ -773,7 +773,7 @@ done: if (in_transaction == true) { sret = sysdb_transaction_cancel(sctx->sysdb); if (sret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed to cancel transaction\n")); + DEBUG(SSSDBG_OP_FAILURE, "Failed to cancel transaction\n"); } } @@ -789,8 +789,8 @@ int main(int argc, const char **argv) /* initialize seed context and parse options */ ret = seed_init(sctx, argc, argv, &sctx); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE,("Seed init failed [%d][%s]\n", - ret, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE,"Seed init failed [%d][%s]\n", + ret, strerror(ret)); goto done; } @@ -798,7 +798,7 @@ int main(int argc, const char **argv) ret = seed_init_db(sctx, sctx->uctx->domain_name, &sctx->confdb, &sctx->domain, &sctx->sysdb); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to initialize db and domain\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to initialize db and domain\n"); goto done; } @@ -806,8 +806,8 @@ int main(int argc, const char **argv) ret = seed_domain_user_info(sctx->uctx->name, sctx->uctx->domain_name, sctx->domain, &sctx->user_cached); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Failed lookup of user [%s] in domain [%s]\n", - sctx->uctx->name, sctx->uctx->domain_name)); + DEBUG(SSSDBG_OP_FAILURE, "Failed lookup of user [%s] in domain [%s]\n", + sctx->uctx->name, sctx->uctx->domain_name); } /* interactive mode to fill in user information */ @@ -819,7 +819,7 @@ int main(int argc, const char **argv) } else { ret = seed_interactive_input(sctx, sctx->uctx, &input_uctx); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to get seed input.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to get seed input.\n"); ret = EINVAL; goto done; } @@ -831,7 +831,7 @@ int main(int argc, const char **argv) if (sctx->user_cached == false) { if (sctx->uctx->uid == 0 || sctx->uctx->gid == 0) { /* require username, UID, and GID to continue */ - DEBUG(SSSDBG_MINOR_FAILURE, ("Not enough information provided\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Not enough information provided\n"); ERROR("UID and primary GID not provided.\n"); ret = EINVAL; goto done; @@ -843,13 +843,13 @@ int main(int argc, const char **argv) ret = seed_password_input_file(sctx->uctx, sctx->password_file, &sctx->uctx->password); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Password input failure\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Password input failure\n"); goto done; } } else { ret = seed_password_input_prompt(sctx->uctx, &sctx->uctx->password); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Password input failure\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Password input failure\n"); goto done; } } @@ -857,7 +857,7 @@ int main(int argc, const char **argv) /* Add user info and password to sysdb cache */ ret = seed_cache_user(sctx); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Failed to modify cache.\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Failed to modify cache.\n"); goto done; } else { if (sctx->user_cached == false) { @@ -870,8 +870,8 @@ int main(int argc, const char **argv) done: talloc_zfree(sctx); if (ret != EOK) { - DEBUG(SSSDBG_TRACE_INTERNAL, ("Exit error: [%d] [%s]\n", - ret, strerror(ret))); + DEBUG(SSSDBG_TRACE_INTERNAL, "Exit error: [%d] [%s]\n", + ret, strerror(ret)); ret = EXIT_FAILURE; } else { ret = EXIT_SUCCESS; diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c index 9f6176bce..57334295e 100644 --- a/src/tools/sss_sync_ops.c +++ b/src/tools/sss_sync_ops.c @@ -38,7 +38,7 @@ #define VAR_CHECK(var, val, attr, msg) do { \ if (var != (val)) { \ - DEBUG(1, (msg" attribute: %s", attr)); \ + DEBUG(1, msg" attribute: %s", attr); \ return val; \ } \ } while(0) @@ -364,7 +364,7 @@ int useradd_defaults(TALLOC_CTX *mem_ctx, ret = ENOMEM; goto done; } - DEBUG(7, ("Gecos: %s\n", data->gecos)); + DEBUG(7, "Gecos: %s\n", data->gecos); /* homedir */ if (homedir) { @@ -382,7 +382,7 @@ int useradd_defaults(TALLOC_CTX *mem_ctx, ret = ENOMEM; goto done; } - DEBUG(7, ("Homedir: %s\n", data->home)); + DEBUG(7, "Homedir: %s\n", data->home); /* default shell */ if (!shell) { @@ -399,7 +399,7 @@ int useradd_defaults(TALLOC_CTX *mem_ctx, goto done; } } - DEBUG(7, ("Shell: %s\n", data->shell)); + DEBUG(7, "Shell: %s\n", data->shell); /* create homedir on user creation? */ if (!create_home) { @@ -412,7 +412,7 @@ int useradd_defaults(TALLOC_CTX *mem_ctx, } else { data->create_homedir = (create_home == DO_CREATE_HOME); } - DEBUG(7, ("Auto create homedir: %s\n", data->create_homedir?"True":"False")); + DEBUG(7, "Auto create homedir: %s\n", data->create_homedir?"True":"False"); /* umask to create homedirs */ ret = confdb_get_int(confdb, @@ -421,7 +421,7 @@ int useradd_defaults(TALLOC_CTX *mem_ctx, if (ret != EOK) { goto done; } - DEBUG(7, ("Umask: %o\n", data->umask)); + DEBUG(7, "Umask: %o\n", data->umask); /* a directory to create mail spools in */ ret = confdb_get_string(confdb, mem_ctx, @@ -430,7 +430,7 @@ int useradd_defaults(TALLOC_CTX *mem_ctx, if (ret != EOK) { goto done; } - DEBUG(7, ("Mail dir: %s\n", data->maildir)); + DEBUG(7, "Mail dir: %s\n", data->maildir); /* skeleton dir */ if (!skeldir) { @@ -447,7 +447,7 @@ int useradd_defaults(TALLOC_CTX *mem_ctx, goto done; } } - DEBUG(7, ("Skeleton dir: %s\n", data->skeldir)); + DEBUG(7, "Skeleton dir: %s\n", data->skeldir); ret = EOK; done: @@ -505,13 +505,13 @@ int userdel(TALLOC_CTX *mem_ctx, user_dn = sysdb_user_dn(mem_ctx, data->domain, data->name); if (!user_dn) { - DEBUG(1, ("Could not construct a user DN\n")); + DEBUG(1, "Could not construct a user DN\n"); return ENOMEM; } ret = sysdb_delete_entry(sysdb, user_dn, false); if (ret) { - DEBUG(2, ("Removing user failed: %s (%d)\n", strerror(ret), ret)); + DEBUG(2, "Removing user failed: %s (%d)\n", strerror(ret), ret); } flush_nscd_cache(NSCD_DB_PASSWD); @@ -546,13 +546,13 @@ int groupdel(TALLOC_CTX *mem_ctx, group_dn = sysdb_group_dn(mem_ctx, data->domain, data->name); if (group_dn == NULL) { - DEBUG(1, ("Could not construct a group DN\n")); + DEBUG(1, "Could not construct a group DN\n"); return ENOMEM; } ret = sysdb_delete_entry(sysdb, group_dn, false); if (ret) { - DEBUG(2, ("Removing group failed: %s (%d)\n", strerror(ret), ret)); + DEBUG(2, "Removing group failed: %s (%d)\n", strerror(ret), ret); } flush_nscd_cache(NSCD_DB_GROUP); @@ -578,7 +578,7 @@ int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx, switch (res->count) { case 0: - DEBUG(1, ("No result for sysdb_getpwnam call\n")); + DEBUG(1, "No result for sysdb_getpwnam call\n"); return ENOENT; case 1: @@ -620,15 +620,15 @@ int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx, } else if (strcasecmp(str, "false") == 0) { out->lock = DO_UNLOCK; } else { /* Invalid value */ - DEBUG(2, ("Invalid value for %s attribute: %s\n", - SYSDB_DISABLED, str ? str : "NULL")); + DEBUG(2, "Invalid value for %s attribute: %s\n", + SYSDB_DISABLED, str ? str : "NULL"); return EIO; } } break; default: - DEBUG(1, ("More than one result for sysdb_getpwnam call\n")); + DEBUG(1, "More than one result for sysdb_getpwnam call\n"); return EIO; } @@ -650,7 +650,7 @@ int sysdb_getgrnam_sync(TALLOC_CTX *mem_ctx, switch (res->count) { case 0: - DEBUG(1, ("No result for sysdb_getgrnam call\n")); + DEBUG(1, "No result for sysdb_getgrnam call\n"); return ENOENT; case 1: @@ -664,7 +664,7 @@ int sysdb_getgrnam_sync(TALLOC_CTX *mem_ctx, break; default: - DEBUG(1, ("More than one result for sysdb_getgrnam call\n")); + DEBUG(1, "More than one result for sysdb_getgrnam call\n"); return EIO; } diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c index 395b2651c..764c2a42e 100644 --- a/src/tools/sss_useradd.c +++ b/src/tools/sss_useradd.c @@ -69,7 +69,7 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, ("set_locale failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -114,7 +114,7 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { - DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -135,7 +135,7 @@ int main(int argc, const char **argv) if (groups) { ret = parse_groups(tctx, groups, &tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse groups to add the user to\n")); + DEBUG(1, "Cannot parse groups to add the user to\n"); ERROR("Internal error while parsing parameters\n"); ret = EXIT_FAILURE; goto fini; @@ -143,7 +143,7 @@ int main(int argc, const char **argv) ret = parse_group_name_domain(tctx, tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse FQDN groups to add the user to\n")); + DEBUG(1, "Cannot parse FQDN groups to add the user to\n"); ERROR("Groups must be in the same domain as user\n"); ret = EXIT_FAILURE; goto fini; @@ -181,7 +181,7 @@ int main(int argc, const char **argv) tctx->error = sysdb_transaction_start(tctx->sysdb); if (tctx->error != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to start transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n"); goto done; } in_transaction = true; @@ -194,7 +194,7 @@ int main(int argc, const char **argv) tctx->error = sysdb_transaction_commit(tctx->sysdb); if (tctx->error) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to commit transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to commit transaction\n"); goto done; } in_transaction = false; @@ -244,8 +244,8 @@ int main(int argc, const char **argv) tctx->octx->gid); if (ret != EOK) { ERROR("Cannot create user's mail spool: %1$s\n", strerror(ret)); - DEBUG(1, ("Cannot create user's mail spool: [%d][%s].\n", - ret, strerror(ret))); + DEBUG(1, "Cannot create user's mail spool: [%d][%s].\n", + ret, strerror(ret)); ret = EXIT_FAILURE; goto fini; } @@ -255,7 +255,7 @@ done: if (in_transaction) { sret = sysdb_transaction_cancel(tctx->sysdb); if (sret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to cancel transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to cancel transaction\n"); } } @@ -270,8 +270,8 @@ done: break; default: - DEBUG(1, ("sysdb operation failed (%d)[%s]\n", - tctx->error, strerror(tctx->error))); + DEBUG(1, "sysdb operation failed (%d)[%s]\n", + tctx->error, strerror(tctx->error)); ERROR("Transaction error. Could not add user.\n"); break; } diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c index ad2d5b38a..c695bf837 100644 --- a/src/tools/sss_userdel.c +++ b/src/tools/sss_userdel.c @@ -59,7 +59,7 @@ static int is_logged_in(TALLOC_CTX *mem_ctx, uid_t uid) ret = get_uid_table(mem_ctx, &uid_table); if (ret == ENOSYS) return ret; if (ret != EOK) { - DEBUG(1, ("Cannot initialize hash table.\n")); + DEBUG(1, "Cannot initialize hash table.\n"); return ret; } @@ -98,7 +98,7 @@ static int kick_user(struct tools_ctx *tctx) if (pid == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("fork failed [%d]: %s\n", ret, strerror(ret))); + "fork failed [%d]: %s\n", ret, strerror(ret)); return ret; } @@ -109,7 +109,7 @@ static int kick_user(struct tools_ctx *tctx) } } if (child_pid == -1) { - DEBUG(SSSDBG_CRIT_FAILURE, ("waitpid failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "waitpid failed\n"); return errno; } } @@ -147,7 +147,7 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, ("set_locale failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -191,7 +191,7 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { - DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -315,7 +315,7 @@ int main(int argc, const char **argv) done: if (ret) { - DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret))); + DEBUG(1, "sysdb operation failed (%d)[%s]\n", ret, strerror(ret)); switch (ret) { case ENOENT: ERROR("No such user in local domain. " diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c index e0ae99ea0..f3c2e1d63 100644 --- a/src/tools/sss_usermod.c +++ b/src/tools/sss_usermod.c @@ -70,7 +70,7 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, ("set_locale failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -123,7 +123,7 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { - DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); + DEBUG(1, "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -158,7 +158,7 @@ int main(int argc, const char **argv) if (addgroups) { ret = parse_groups(tctx, addgroups, &tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse groups to add the user to\n")); + DEBUG(1, "Cannot parse groups to add the user to\n"); ERROR("Internal error while parsing parameters\n"); ret = EXIT_FAILURE; goto fini; @@ -166,7 +166,7 @@ int main(int argc, const char **argv) ret = parse_group_name_domain(tctx, tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse FQDN groups to add the user to\n")); + DEBUG(1, "Cannot parse FQDN groups to add the user to\n"); ERROR("Groups must be in the same domain as user\n"); ret = EXIT_FAILURE; goto fini; @@ -185,7 +185,7 @@ int main(int argc, const char **argv) if (rmgroups) { ret = parse_groups(tctx, rmgroups, &tctx->octx->rmgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse groups to remove the user from\n")); + DEBUG(1, "Cannot parse groups to remove the user from\n"); ERROR("Internal error while parsing parameters\n"); ret = EXIT_FAILURE; goto fini; @@ -193,7 +193,7 @@ int main(int argc, const char **argv) ret = parse_group_name_domain(tctx, tctx->octx->rmgroups); if (ret != EOK) { - DEBUG(1, ("Cannot parse FQDN groups to remove the user from\n")); + DEBUG(1, "Cannot parse FQDN groups to remove the user from\n"); ERROR("Groups must be in the same domain as user\n"); ret = EXIT_FAILURE; goto fini; @@ -218,7 +218,7 @@ int main(int argc, const char **argv) tctx->error = sysdb_transaction_start(tctx->sysdb); if (tctx->error != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to start transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n"); goto done; } in_transaction = true; @@ -231,7 +231,7 @@ int main(int argc, const char **argv) tctx->error = sysdb_transaction_commit(tctx->sysdb); if (tctx->error) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to commit transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to commit transaction\n"); goto done; } in_transaction = false; @@ -270,7 +270,7 @@ done: if (in_transaction) { sret = sysdb_transaction_cancel(tctx->sysdb); if (sret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to cancel transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to cancel transaction\n"); } } diff --git a/src/tools/tools_mc_util.c b/src/tools/tools_mc_util.c index 841547147..2d6f3fb40 100644 --- a/src/tools/tools_mc_util.c +++ b/src/tools/tools_mc_util.c @@ -78,12 +78,12 @@ errno_t sss_memcache_invalidate(const char *mc_filename) if (mc_fd == -1) { ret = errno; if (ret == ENOENT) { - DEBUG(SSSDBG_TRACE_FUNC,("Memory cache file %s " - "does not exist.\n", mc_filename)); + DEBUG(SSSDBG_TRACE_FUNC,"Memory cache file %s " + "does not exist.\n", mc_filename); return EOK; } else { - DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to open file %s: %s\n", - mc_filename, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to open file %s: %s\n", + mc_filename, strerror(ret)); return ret; } } @@ -91,17 +91,17 @@ errno_t sss_memcache_invalidate(const char *mc_filename) ret = sss_br_lock_file(mc_fd, 0, 1, retries, t); if (ret == EACCES) { DEBUG(SSSDBG_TRACE_FUNC, - ("File %s already locked by someone else.\n", mc_filename)); + "File %s already locked by someone else.\n", mc_filename); goto done; } else if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to lock file %s.\n", mc_filename)); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to lock file %s.\n", mc_filename); goto done; } /* Mark the mc file as recycled. */ ret = sss_mc_set_recycled(mc_fd); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to mark memory cache file %s " - "as recycled.\n", mc_filename)); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to mark memory cache file %s " + "as recycled.\n", mc_filename); goto done; } @@ -116,9 +116,9 @@ done: pret = unlink(mc_filename); if (pret == -1) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Failed to unlink file %s. " + "Failed to unlink file %s. " "Will be unlinked later by sssd_nss.\n", - mc_filename)); + mc_filename); } } } @@ -160,7 +160,7 @@ errno_t sss_memcache_clear_all(void) ret = clear_fastcache(&sssd_nss_is_off); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to clear caches.\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to clear caches.\n"); return EIO; } if (!sssd_nss_is_off) { @@ -168,23 +168,23 @@ errno_t sss_memcache_clear_all(void) clear_mc_flag = fopen(SSS_NSS_MCACHE_DIR"/"CLEAR_MC_FLAG, "w"); if (clear_mc_flag == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Failed to create clear_mc_flag file. " - "Memory cache will not be cleared.\n")); + "Failed to create clear_mc_flag file. " + "Memory cache will not be cleared.\n"); return EIO; } ret = fclose(clear_mc_flag); if (ret != 0) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to close file descriptor: %s\n", - strerror(ret))); + "Unable to close file descriptor: %s\n", + strerror(ret)); return EIO; } - DEBUG(SSSDBG_TRACE_FUNC, ("Sending SIGHUP to monitor.\n")); + DEBUG(SSSDBG_TRACE_FUNC, "Sending SIGHUP to monitor.\n"); ret = signal_sssd(SIGHUP); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Failed to send SIGHUP to monitor.\n")); + "Failed to send SIGHUP to monitor.\n"); return EIO; } } @@ -217,7 +217,7 @@ static errno_t sss_mc_refresh_ent(const char *name, enum sss_tools_ent ent) } if (cmd == SSS_CLI_NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Unknown object %d to refresh\n", cmd)); + DEBUG(SSSDBG_OP_FAILURE, "Unknown object %d to refresh\n", cmd); return EINVAL; } @@ -261,20 +261,20 @@ errno_t sss_mc_refresh_nested_group(struct tools_ctx *tctx, ret = sss_mc_refresh_group(name); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Cannot refresh group %s from memory cache\n", name)); + "Cannot refresh group %s from memory cache\n", name); /* try to carry on */ } ret = sysdb_search_group_by_name(tctx, tctx->local, name, attrs, &msg); if (ret) { DEBUG(SSSDBG_OP_FAILURE, - ("Search failed: %s (%d)\n", strerror(ret), ret)); + "Search failed: %s (%d)\n", strerror(ret), ret); return ret; } el = ldb_msg_find_element(msg, SYSDB_MEMBEROF); if (!el || el->num_values == 0) { - DEBUG(SSSDBG_TRACE_INTERNAL, ("Group %s has no parents\n", name)); + DEBUG(SSSDBG_TRACE_INTERNAL, "Group %s has no parents\n", name); talloc_free(msg); return EOK; } @@ -285,8 +285,8 @@ errno_t sss_mc_refresh_nested_group(struct tools_ctx *tctx, (const char *) el->values[i].data, &parent_name); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Malformed DN [%s]? Skipping\n", - (const char *) el->values[i].data)); + DEBUG(SSSDBG_MINOR_FAILURE, "Malformed DN [%s]? Skipping\n", + (const char *) el->values[i].data); talloc_free(parent_name); continue; } @@ -295,7 +295,7 @@ errno_t sss_mc_refresh_nested_group(struct tools_ctx *tctx, talloc_free(parent_name); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Cannot refresh group %s from memory cache\n", name)); + "Cannot refresh group %s from memory cache\n", name); /* try to carry on */ } } @@ -317,8 +317,8 @@ errno_t sss_mc_refresh_grouplist(struct tools_ctx *tctx, ret = sss_mc_refresh_nested_group(tctx, groupnames[i]); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Cannot refresh group %s from memory cache\n", - groupnames[i])); + "Cannot refresh group %s from memory cache\n", + groupnames[i]); failed = true; continue; } diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c index d31286dc4..42563dad4 100644 --- a/src/tools/tools_util.c +++ b/src/tools/tools_util.c @@ -49,14 +49,14 @@ static int setup_db(struct tools_ctx *ctx) /* Connect to the conf db */ ret = confdb_init(ctx, &ctx->confdb, confdb_path); if (ret != EOK) { - DEBUG(1, ("Could not initialize connection to the confdb\n")); + DEBUG(1, "Could not initialize connection to the confdb\n"); return ret; } ret = sssd_domain_init(ctx, ctx->confdb, "local", DB_PATH, &ctx->local); if (ret != EOK) { SYSDB_VERSION_ERROR(ret); - DEBUG(1, ("Could not initialize connection to the sysdb\n")); + DEBUG(1, "Could not initialize connection to the sysdb\n"); return ret; } ctx->sysdb = ctx->local->sysdb; @@ -144,8 +144,8 @@ int parse_group_name_domain(struct tools_ctx *tctx, for (i = 0; groups[i]; ++i) { ret = sss_parse_name(tctx, tctx->snctx, groups[i], &domain, &name); if (ret != EOK) { - DEBUG(1, ("Invalid name in group list, skipping: [%s] (%d)\n", - groups[i], ret)); + DEBUG(1, "Invalid name in group list, skipping: [%s] (%d)\n", + groups[i], ret); continue; } @@ -180,23 +180,23 @@ int parse_name_domain(struct tools_ctx *tctx, ret = sss_parse_name(tctx, tctx->snctx, fullname, &domain, &tctx->octx->name); if (ret != EOK) { - DEBUG(0, ("Cannot parse full name\n")); + DEBUG(0, "Cannot parse full name\n"); return ret; } - DEBUG(5, ("Parsed username: %s\n", tctx->octx->name)); + DEBUG(5, "Parsed username: %s\n", tctx->octx->name); if (domain) { - DEBUG(5, ("Parsed domain: %s\n", domain)); + DEBUG(5, "Parsed domain: %s\n", domain); /* only the local domain, whatever named is allowed in tools */ if (strcasecmp(domain, tctx->local->name) != 0) { - DEBUG(1, ("Invalid domain %s specified in FQDN\n", domain)); + DEBUG(1, "Invalid domain %s specified in FQDN\n", domain); return EINVAL; } } else { if (tctx->local->fqnames) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Name '%s' does not seem to be FQDN " - "('%s = TRUE' is set)\n", fullname, CONFDB_DOMAIN_FQ)); + "Name '%s' does not seem to be FQDN " + "('%s = TRUE' is set)\n", fullname, CONFDB_DOMAIN_FQ); ERROR("Name '%1$s' does not seem to be FQDN " "('%2$s = TRUE' is set)\n", fullname, CONFDB_DOMAIN_FQ); return EINVAL; @@ -226,7 +226,7 @@ int check_group_names(struct tools_ctx *tctx, grouplist[i], groupinfo); if (ret) { - DEBUG(6, ("Cannot find group %s, ret: %d\n", grouplist[i], ret)); + DEBUG(6, "Cannot find group %s, ret: %d\n", grouplist[i], ret); break; } } @@ -279,26 +279,26 @@ int init_sss_tools(struct tools_ctx **_tctx) tctx = talloc_zero(NULL, struct tools_ctx); if (tctx == NULL) { - DEBUG(1, ("Could not allocate memory for tools context\n")); + DEBUG(1, "Could not allocate memory for tools context\n"); return ENOMEM; } /* Connect to the database */ ret = setup_db(tctx); if (ret != EOK) { - DEBUG(1, ("Could not set up database\n")); + DEBUG(1, "Could not set up database\n"); goto fini; } ret = sss_names_init(tctx, tctx->confdb, tctx->local->name, &tctx->snctx); if (ret != EOK) { - DEBUG(1, ("Could not set up parsing\n")); + DEBUG(1, "Could not set up parsing\n"); goto fini; } tctx->octx = talloc_zero(tctx, struct ops_ctx); if (!tctx->octx) { - DEBUG(1, ("Could not allocate memory for data context\n")); + DEBUG(1, "Could not allocate memory for data context\n"); ERROR("Out of memory\n"); ret = ENOMEM; goto fini; @@ -327,7 +327,7 @@ static int is_owner(uid_t uid, const char *path) ret = stat(path, &statres); if (ret != 0) { ret = errno; - DEBUG(1, ("Cannot stat %s: [%d][%s]\n", path, ret, strerror(ret))); + DEBUG(1, "Cannot stat %s: [%d][%s]\n", path, ret, strerror(ret)); return ret; } @@ -360,8 +360,8 @@ static int remove_mail_spool(TALLOC_CTX *mem_ctx, break; case -1: DEBUG(SSSDBG_MINOR_FAILURE, - ("%s not owned by %"SPRIuid", not removing\n", - spool_file, uid)); + "%s not owned by %"SPRIuid", not removing\n", + spool_file, uid); ret = EACCES; /* FALLTHROUGH */ default: @@ -372,8 +372,8 @@ static int remove_mail_spool(TALLOC_CTX *mem_ctx, ret = unlink(spool_file); if (ret != 0) { ret = errno; - DEBUG(1, ("Cannot remove() the spool file %s: [%d][%s]\n", - spool_file, ret, strerror(ret))); + DEBUG(1, "Cannot remove() the spool file %s: [%d][%s]\n", + spool_file, ret, strerror(ret)); goto fail; } @@ -392,20 +392,20 @@ int remove_homedir(TALLOC_CTX *mem_ctx, ret = remove_mail_spool(mem_ctx, maildir, username, uid, force); if (ret != EOK) { - DEBUG(1, ("Cannot remove user's mail spool\n")); + DEBUG(1, "Cannot remove user's mail spool\n"); /* Should this be fatal? I don't think so. Maybe convert to ERROR? */ } if (force == false && is_owner(uid, homedir) == -1) { - DEBUG(1, ("Not removing home dir - not owned by user\n")); + DEBUG(1, "Not removing home dir - not owned by user\n"); return EPERM; } /* Remove the tree */ ret = remove_tree(homedir); if (ret != EOK) { - DEBUG(1, ("Cannot remove homedir %s: %d\n", - homedir, ret)); + DEBUG(1, "Cannot remove homedir %s: %d\n", + homedir, ret); return ret; } @@ -436,32 +436,32 @@ int create_mail_spool(TALLOC_CTX *mem_ctx, fd = open(spool_file, O_CREAT | O_WRONLY | O_EXCL, 0); if (fd < 0) { ret = errno; - DEBUG(1, ("Cannot open() the spool file: [%d][%s]\n", - ret, strerror(ret))); + DEBUG(1, "Cannot open() the spool file: [%d][%s]\n", + ret, strerror(ret)); goto fail; } ret = fchmod(fd, 0600); if (ret != 0) { ret = errno; - DEBUG(1, ("Cannot fchmod() the spool file: [%d][%s]\n", - ret, strerror(ret))); + DEBUG(1, "Cannot fchmod() the spool file: [%d][%s]\n", + ret, strerror(ret)); goto fail; } ret = fchown(fd, uid, gid); if (ret != 0) { ret = errno; - DEBUG(1, ("Cannot fchown() the spool file: [%d][%s]\n", - ret, strerror(ret))); + DEBUG(1, "Cannot fchown() the spool file: [%d][%s]\n", + ret, strerror(ret)); goto fail; } ret = fsync(fd); if (ret != 0) { ret = errno; - DEBUG(1, ("Cannot fsync() the spool file: [%d][%s]\n", - ret, strerror(ret))); + DEBUG(1, "Cannot fsync() the spool file: [%d][%s]\n", + ret, strerror(ret)); } fail: @@ -469,8 +469,8 @@ fail: ret = close(fd); if (ret != 0) { ret = errno; - DEBUG(1, ("Cannot close() the spool file: [%d][%s]\n", - ret, strerror(ret))); + DEBUG(1, "Cannot close() the spool file: [%d][%s]\n", + ret, strerror(ret)); } } @@ -491,8 +491,8 @@ int create_homedir(const char *skeldir, ret = copy_tree(skeldir, homedir, 0777 & ~default_umask, uid, gid); if (ret != EOK) { - DEBUG(1, ("Cannot populate user's home directory: [%d][%s].\n", - ret, strerror(ret))); + DEBUG(1, "Cannot populate user's home directory: [%d][%s].\n", + ret, strerror(ret)); goto done; } @@ -534,7 +534,7 @@ int run_userdel_cmd(struct tools_ctx *tctx) if (pid == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("fork failed [%d]: %s\n", ret, strerror(ret))); + "fork failed [%d]: %s\n", ret, strerror(ret)); goto done; } @@ -542,28 +542,28 @@ int run_userdel_cmd(struct tools_ctx *tctx) if (WIFEXITED(status)) { ret = WEXITSTATUS(status); if (ret != 0) { - DEBUG(5, ("command [%s] returned nonzero status %d.\n", - userdel_cmd, ret)); + DEBUG(5, "command [%s] returned nonzero status %d.\n", + userdel_cmd, ret); ret = EOK; /* Ignore return code of the command */ goto done; } } else if (WIFSIGNALED(status)) { - DEBUG(5, ("command [%s] was terminated by signal %d.\n", - userdel_cmd, WTERMSIG(status))); + DEBUG(5, "command [%s] was terminated by signal %d.\n", + userdel_cmd, WTERMSIG(status)); ret = EIO; goto done; } else if (WIFSTOPPED(status)) { - DEBUG(5, ("command [%s] was stopped by signal %d.\n", - userdel_cmd, WSTOPSIG(status))); + DEBUG(5, "command [%s] was stopped by signal %d.\n", + userdel_cmd, WSTOPSIG(status)); continue; } else { - DEBUG(1, ("Unknown status from WAITPID\n")); + DEBUG(1, "Unknown status from WAITPID\n"); ret = EIO; goto done; } } if (child_pid == -1) { - DEBUG(SSSDBG_CRIT_FAILURE, ("waitpid failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "waitpid failed\n"); ret = errno; goto done; } @@ -604,8 +604,8 @@ static errno_t get_sssd_pid(pid_t *out_pid) pid_file = fopen(SSSD_PIDFILE, "r"); if (pid_file == NULL) { ret = errno; - DEBUG(SSSDBG_MINOR_FAILURE, ("Unable to open pid file \"%s\": %s\n", - SSSD_PIDFILE, strerror(ret))); + DEBUG(SSSDBG_MINOR_FAILURE, "Unable to open pid file \"%s\": %s\n", + SSSD_PIDFILE, strerror(ret)); goto done; } @@ -615,17 +615,17 @@ static errno_t get_sssd_pid(pid_t *out_pid) /* eof not reached */ ret = ferror(pid_file); if (ret != 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to read from file \"%s\": %s\n", - SSSD_PIDFILE, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to read from file \"%s\": %s\n", + SSSD_PIDFILE, strerror(ret)); } else { - DEBUG(SSSDBG_CRIT_FAILURE, ("File \"%s\" contains invalid pid.\n", - SSSD_PIDFILE)); + DEBUG(SSSDBG_CRIT_FAILURE, "File \"%s\" contains invalid pid.\n", + SSSD_PIDFILE); } goto done; } if (fsize == 0) { - DEBUG(SSSDBG_CRIT_FAILURE, ("File \"%s\" contains no pid.\n", - SSSD_PIDFILE)); + DEBUG(SSSDBG_CRIT_FAILURE, "File \"%s\" contains no pid.\n", + SSSD_PIDFILE); ret = EINVAL; goto done; } @@ -634,7 +634,7 @@ static errno_t get_sssd_pid(pid_t *out_pid) *out_pid = parse_pid(pid_str); if (*out_pid == 0) { DEBUG(SSSDBG_CRIT_FAILURE, - ("File \"%s\" contains invalid pid.\n", SSSD_PIDFILE)); + "File \"%s\" contains invalid pid.\n", SSSD_PIDFILE); ret = EINVAL; goto done; } @@ -661,8 +661,8 @@ errno_t signal_sssd(int signum) if (kill(pid, signum) != 0) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not send signal %d to process %d: %s\n", - signum, pid, strerror(errno))); + "Could not send signal %d to process %d: %s\n", + signum, pid, strerror(errno)); return ret; } diff --git a/src/tools/tools_util.h b/src/tools/tools_util.h index cc35475de..c0a1fa290 100644 --- a/src/tools/tools_util.h +++ b/src/tools/tools_util.h @@ -39,7 +39,7 @@ #define CHECK_ROOT(val, prg_name) do { \ val = getuid(); \ if (val != 0) { \ - DEBUG(1, ("Running under %d, must be root\n", val)); \ + DEBUG(1, "Running under %d, must be root\n", val); \ ERROR("%1$s must be run as root\n", prg_name); \ val = EXIT_FAILURE; \ goto fini; \ |