summaryrefslogtreecommitdiff
path: root/src/providers/ad/ad_common.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-05-12 12:29:21 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-06-07 00:14:12 +0200
commit7119f0c483049a8850d3075c0b1062f35200a538 (patch)
tree7be03fca0634dda1406df2b9bde387ca7c89877e /src/providers/ad/ad_common.c
parent7527ec8ab2b79ec576ace2da9e2c158b849adfa6 (diff)
downloadsssd-7119f0c483049a8850d3075c0b1062f35200a538.tar.gz
sssd-7119f0c483049a8850d3075c0b1062f35200a538.tar.bz2
sssd-7119f0c483049a8850d3075c0b1062f35200a538.zip
Do not obfuscate calls with booleans
Instead of using boolean variables to denote whether the call is adding a primary or a secondary server, use a function wrapper that tells what it's doing by its name.
Diffstat (limited to 'src/providers/ad/ad_common.c')
-rw-r--r--src/providers/ad/ad_common.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c
index e3419995..4a6343f7 100644
--- a/src/providers/ad/ad_common.c
+++ b/src/providers/ad/ad_common.c
@@ -141,11 +141,11 @@ static void
ad_resolve_callback(void *private_data, struct fo_server *server);
static errno_t
-ad_servers_init(TALLOC_CTX *mem_ctx,
- struct be_ctx *bectx,
- const char *servers,
- struct ad_options *options,
- bool primary)
+_ad_servers_init(TALLOC_CTX *mem_ctx,
+ struct be_ctx *bectx,
+ const char *servers,
+ struct ad_options *options,
+ bool primary)
{
size_t i;
errno_t ret = 0;
@@ -210,6 +210,20 @@ done:
return ret;
}
+static inline errno_t
+ad_primary_servers_init(TALLOC_CTX *mem_ctx, struct be_ctx *bectx,
+ const char *servers, struct ad_options *options)
+{
+ return _ad_servers_init(mem_ctx, bectx, servers, options, true);
+}
+
+static inline errno_t
+ad_backup_servers_init(TALLOC_CTX *mem_ctx, struct be_ctx *bectx,
+ const char *servers, struct ad_options *options)
+{
+ return _ad_servers_init(mem_ctx, bectx, servers, options, false);
+}
+
static int ad_user_data_cmp(void *ud1, void *ud2)
{
return strcasecmp((char*) ud1, (char*) ud2);
@@ -286,13 +300,13 @@ ad_failover_init(TALLOC_CTX *mem_ctx, struct be_ctx *bectx,
primary_servers = BE_SRV_IDENTIFIER;
}
- ret = ad_servers_init(mem_ctx, bectx, primary_servers, options, true);
+ ret = ad_primary_servers_init(mem_ctx, bectx, primary_servers, options);
if (ret != EOK) {
goto done;
}
if (backup_servers) {
- ret = ad_servers_init(mem_ctx, bectx, backup_servers, options, false);
+ ret = ad_backup_servers_init(mem_ctx, bectx, backup_servers, options);
if (ret != EOK) {
goto done;
}