summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap_idmap.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2014-02-12 10:12:04 -0500
committerJakub Hrozek <jhrozek@redhat.com>2014-02-12 22:30:55 +0100
commita3c8390d19593b1e5277d95bfb4ab206d4785150 (patch)
tree2eb4e5432f4f79a75589c03b1513b656879ebf9c /src/providers/ldap/sdap_idmap.c
parentcc026fd9ba386f2197e3217940d597dcad1a26fe (diff)
downloadsssd-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/providers/ldap/sdap_idmap.c')
-rw-r--r--src/providers/ldap/sdap_idmap.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/providers/ldap/sdap_idmap.c b/src/providers/ldap/sdap_idmap.c
index aad8e34aa..382603554 100644
--- a/src/providers/ldap/sdap_idmap.c
+++ b/src/providers/ldap/sdap_idmap.c
@@ -43,22 +43,22 @@ sdap_idmap_get_configured_external_range(struct sdap_idmap_ctx *idmap_ctx,
int_id = dp_opt_get_int(id_ctx->opts->basic, SDAP_MIN_ID);
if (int_id < 0) {
- DEBUG(SSSDBG_CONF_SETTINGS, ("ldap_min_id must be greater than 0.\n"));
+ DEBUG(SSSDBG_CONF_SETTINGS, "ldap_min_id must be greater than 0.\n");
return EINVAL;
}
min = int_id;
int_id = dp_opt_get_int(id_ctx->opts->basic, SDAP_MAX_ID);
if (int_id < 0) {
- DEBUG(SSSDBG_CONF_SETTINGS, ("ldap_max_id must be greater than 0.\n"));
+ DEBUG(SSSDBG_CONF_SETTINGS, "ldap_max_id must be greater than 0.\n");
return EINVAL;
}
max = int_id;
if ((min == 0 && max != 0) || (min != 0 && max == 0)) {
- DEBUG(SSSDBG_CONF_SETTINGS, ("Both ldap_min_id and ldap_max_id " \
+ DEBUG(SSSDBG_CONF_SETTINGS, "Both ldap_min_id and ldap_max_id " \
"either must be 0 (not set) " \
- "or positive integers.\n"));
+ "or positive integers.\n");
return EINVAL;
}
@@ -88,7 +88,7 @@ sdap_idmap_add_configured_external_range(struct sdap_idmap_ctx *idmap_ctx)
ret = sdap_idmap_get_configured_external_range(idmap_ctx, &range);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
- ("sdap_idmap_get_configured_external_range failed.\n"));
+ "sdap_idmap_get_configured_external_range failed.\n");
return ret;
}
@@ -99,8 +99,8 @@ sdap_idmap_add_configured_external_range(struct sdap_idmap_ctx *idmap_ctx)
NULL, 0, true);
if (err != IDMAP_SUCCESS) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Could not add domain [%s] to the map: [%d]\n",
- id_ctx->be->domain->name, err));
+ "Could not add domain [%s] to the map: [%d]\n",
+ id_ctx->be->domain->name, err);
return EIO;
}
@@ -118,7 +118,7 @@ errno_t sdap_idmap_find_new_domain(struct sdap_idmap_ctx *idmap_ctx,
-1);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not add new domain [%s]\n", dom_name));
+ "Could not add new domain [%s]\n", dom_name);
return ret;
}
@@ -170,17 +170,17 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx,
|| (idmap_upper-idmap_lower) < rangesize)
{
DEBUG(SSSDBG_FATAL_FAILURE,
- ("Invalid settings for range selection: "
+ "Invalid settings for range selection: "
"[%"SPRIid"][%"SPRIid"][%"SPRIid"]\n",
- idmap_lower, idmap_upper, rangesize));
+ idmap_lower, idmap_upper, rangesize);
ret = EINVAL;
goto done;
}
if (((idmap_upper - idmap_lower) % rangesize) != 0) {
DEBUG(SSSDBG_CONF_SETTINGS,
- ("Range size does not divide evenly. Uppermost range will "
- "not be used\n"));
+ "Range size does not divide evenly. Uppermost range will "
+ "not be used\n");
}
/* Initialize the map */
@@ -189,8 +189,8 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx,
&idmap_ctx->map);
if (err != IDMAP_SUCCESS) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Could not initialize the ID map: [%s]\n",
- idmap_error_string(err)));
+ "Could not initialize the ID map: [%s]\n",
+ idmap_error_string(err));
if (err == IDMAP_OUT_OF_MEMORY) {
ret = ENOMEM;
} else {
@@ -205,7 +205,7 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx,
err |= sss_idmap_ctx_set_rangesize(idmap_ctx->map, rangesize);
if (err != IDMAP_SUCCESS) {
/* This should never happen */
- DEBUG(SSSDBG_CRIT_FAILURE, ("sss_idmap_ctx corrupted\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "sss_idmap_ctx corrupted\n");
return EIO;
}
@@ -216,7 +216,7 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx,
ret = sdap_idmap_add_configured_external_range(idmap_ctx);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
- ("sdap_idmap_add_configured_external_range failed.\n"));
+ "sdap_idmap_add_configured_external_range failed.\n");
goto done;
}
}
@@ -225,14 +225,14 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx,
ret = sysdb_idmap_get_mappings(tmp_ctx, id_ctx->be->domain, &res);
if (ret != EOK && ret != ENOENT) {
DEBUG(SSSDBG_FATAL_FAILURE,
- ("Could not read ID mappings from the cache: [%s]\n",
- strerror(ret)));
+ "Could not read ID mappings from the cache: [%s]\n",
+ strerror(ret));
goto done;
}
if (ret == EOK && res->count > 0) {
DEBUG(SSSDBG_CONF_SETTINGS,
- ("Initializing [%d] domains for ID-mapping\n", res->count));
+ "Initializing [%d] domains for ID-mapping\n", res->count);
for (i = 0; i < res->count; i++) {
dom_name = ldb_msg_find_attr_as_string(res->msgs[i],
@@ -266,9 +266,9 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx,
sid_str, slice_num);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Could not add domain [%s][%s][%"SPRIid"] "
+ "Could not add domain [%s][%s][%"SPRIid"] "
"to ID map: [%s]\n",
- dom_name, sid_str, slice_num, strerror(ret)));
+ dom_name, sid_str, slice_num, strerror(ret));
goto done;
}
}
@@ -293,18 +293,18 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx,
sid_str, 0);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Could not add domain [%s][%s][%u] to ID map: [%s]\n",
- dom_name, sid_str, 0, strerror(ret)));
+ "Could not add domain [%s][%s][%u] to ID map: [%s]\n",
+ dom_name, sid_str, 0, strerror(ret));
goto done;
}
} else {
if (dp_opt_get_bool(idmap_ctx->id_ctx->opts->basic, SDAP_IDMAP_AUTORID_COMPAT)) {
/* In autorid compatibility mode, we MUST have a slice 0 */
DEBUG(SSSDBG_CRIT_FAILURE,
- ("WARNING: Autorid compatibility mode selected, "
+ "WARNING: Autorid compatibility mode selected, "
"but %s is not set. UID/GID values may differ "
"between clients.\n",
- idmap_ctx->id_ctx->opts->basic[SDAP_IDMAP_DEFAULT_DOMAIN_SID].opt_name));
+ idmap_ctx->id_ctx->opts->basic[SDAP_IDMAP_DEFAULT_DOMAIN_SID].opt_name);
}
/* Otherwise, we'll just fall back to hash values as they are seen */
}
@@ -333,7 +333,7 @@ sdap_idmap_add_domain(struct sdap_idmap_ctx *idmap_ctx,
ret = sss_idmap_ctx_get_upper(idmap_ctx->map, &idmap_upper);
if (ret != IDMAP_SUCCESS) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Failed to get upper bound of available ID range.\n"));
+ "Failed to get upper bound of available ID range.\n");
ret = EIO;
goto done;
}
@@ -343,19 +343,19 @@ sdap_idmap_add_domain(struct sdap_idmap_ctx *idmap_ctx,
ret = sss_idmap_calculate_range(idmap_ctx->map, dom_sid, &slice, &range);
if (ret != IDMAP_SUCCESS) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Failed to calculate range for domain [%s]: [%d]\n", dom_name,
- ret));
+ "Failed to calculate range for domain [%s]: [%d]\n", dom_name,
+ ret);
ret = EIO;
goto done;
}
DEBUG(SSSDBG_TRACE_LIBS,
- ("Adding domain [%s] as slice [%"SPRIid"]\n", dom_sid, slice));
+ "Adding domain [%s] as slice [%"SPRIid"]\n", dom_sid, slice);
if (range.max > idmap_upper) {
/* This should never happen */
DEBUG(SSSDBG_CRIT_FAILURE,
- ("BUG: Range maximum exceeds the global maximum: "
- "%u > %"SPRIid"\n", range.max, idmap_upper));
+ "BUG: Range maximum exceeds the global maximum: "
+ "%u > %"SPRIid"\n", range.max, idmap_upper);
ret = EINVAL;
goto done;
}
@@ -363,7 +363,7 @@ sdap_idmap_add_domain(struct sdap_idmap_ctx *idmap_ctx,
ret = sdap_idmap_get_configured_external_range(idmap_ctx, &range);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
- ("sdap_idmap_get_configured_external_range failed.\n"));
+ "sdap_idmap_get_configured_external_range failed.\n");
return ret;
}
}
@@ -373,8 +373,8 @@ sdap_idmap_add_domain(struct sdap_idmap_ctx *idmap_ctx,
NULL, 0, external_mapping);
if (err != IDMAP_SUCCESS) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Could not add domain [%s] to the map: [%d]\n",
- dom_name, err));
+ "Could not add domain [%s] to the map: [%d]\n",
+ dom_name, err);
ret = EIO;
goto done;
}
@@ -386,7 +386,7 @@ sdap_idmap_add_domain(struct sdap_idmap_ctx *idmap_ctx,
dom_name, dom_sid,
slice);
if (ret != EOK) {
- DEBUG(SSSDBG_OP_FAILURE, ("sysdb_idmap_store_mapping failed.\n"));
+ DEBUG(SSSDBG_OP_FAILURE, "sysdb_idmap_store_mapping failed.\n");
goto done;
}
}
@@ -465,14 +465,14 @@ sdap_idmap_sid_to_unix(struct sdap_idmap_ctx *idmap_ctx,
&dom_sid_str);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not parse domain SID from [%s]\n", sid_str));
+ "Could not parse domain SID from [%s]\n", sid_str);
goto done;
}
ret = idmap_ctx->find_new_domain(idmap_ctx, dom_sid_str, dom_sid_str);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not add new domain for sid [%s]\n", sid_str));
+ "Could not add new domain for sid [%s]\n", sid_str);
goto done;
}
@@ -482,23 +482,23 @@ sdap_idmap_sid_to_unix(struct sdap_idmap_ctx *idmap_ctx,
(uint32_t *)id);
if (err != IDMAP_SUCCESS) {
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not convert objectSID [%s] to a UNIX ID\n",
- sid_str));
+ "Could not convert objectSID [%s] to a UNIX ID\n",
+ sid_str);
ret = EIO;
goto done;
}
break;
case IDMAP_BUILTIN_SID:
DEBUG(SSSDBG_TRACE_FUNC,
- ("Object SID [%s] is a built-in one.\n", sid_str));
+ "Object SID [%s] is a built-in one.\n", sid_str);
/* ENOTSUP indicates built-in SID */
ret = ENOTSUP;
goto done;
break;
default:
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not convert objectSID [%s] to a UNIX ID\n",
- sid_str));
+ "Could not convert objectSID [%s] to a UNIX ID\n",
+ sid_str);
ret = EIO;
goto done;
}
@@ -559,7 +559,7 @@ bool sdap_idmap_domain_has_algorithmic_mapping(struct sdap_idmap_ctx *ctx,
} else {
tmp_ctx = talloc_new(NULL);
if (tmp_ctx == NULL) {
- DEBUG(SSSDBG_OP_FAILURE, ("talloc_new failed.\n"));
+ DEBUG(SSSDBG_OP_FAILURE, "talloc_new failed.\n");
return false;
}
@@ -567,7 +567,7 @@ bool sdap_idmap_domain_has_algorithmic_mapping(struct sdap_idmap_ctx *ctx,
&new_dom_sid);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not parse domain SID from [%s]\n", dom_sid));
+ "Could not parse domain SID from [%s]\n", dom_sid);
talloc_free(tmp_ctx);
return false;
}
@@ -577,7 +577,7 @@ bool sdap_idmap_domain_has_algorithmic_mapping(struct sdap_idmap_ctx *ctx,
talloc_free(tmp_ctx);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not add new domain for sid [%s]\n", dom_sid));
+ "Could not add new domain for sid [%s]\n", dom_sid);
return false;
}