diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-11-23 17:16:44 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-11-25 11:03:12 -0500 |
commit | d94e3d10282a9a375cae061d6845b73d01a9ffe1 (patch) | |
tree | 32fc6c6ed28eb6d1e6d7c223602ab72985105566 /server/providers/ipa | |
parent | f542305b2212795d82e530fdb9817abcb4002c93 (diff) | |
download | sssd-d94e3d10282a9a375cae061d6845b73d01a9ffe1.tar.gz sssd-d94e3d10282a9a375cae061d6845b73d01a9ffe1.tar.bz2 sssd-d94e3d10282a9a375cae061d6845b73d01a9ffe1.zip |
Fix internal options numbers test
Unfortunately since we changed the defines to an enum the preprocessor test
stopped working.
Turn tests into runtime tests that will abort the process.
Diffstat (limited to 'server/providers/ipa')
-rw-r--r-- | server/providers/ipa/ipa_common.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/server/providers/ipa/ipa_common.c b/server/providers/ipa/ipa_common.c index 98ac0772..740aac8d 100644 --- a/server/providers/ipa/ipa_common.c +++ b/server/providers/ipa/ipa_common.c @@ -212,12 +212,10 @@ done: return ret; } -/* the following preprocessor code is used to keep track of - * the options in the ldap module, so that if they change and ipa - * is not updated correspondingly this will trigger a build error */ -#if SDAP_OPTS_BASIC > 29 -#error There are ldap options not accounted for -#endif +/* the following define is used to keep track of * the options in the ldap + * module, so that if they change and ipa is not updated correspondingly + * this will trigger a runtime abort error */ +#define IPA_OPTS_BASIC_TEST 30 int ipa_get_id_options(struct ipa_options *ipa_opts, struct confdb_ctx *cdb, @@ -232,6 +230,14 @@ int ipa_get_id_options(struct ipa_options *ipa_opts, int ret; int i; + /* self check test, this should never fail, unless someone forgot + * to properly update the code after new ldap options have been added */ + if (SDAP_OPTS_BASIC != IPA_OPTS_BASIC_TEST) { + DEBUG(0, ("Option numbers do not match (%d != %d)\n", + SDAP_OPTS_BASIC, IPA_OPTS_BASIC_TEST)); + abort(); + } + tmpctx = talloc_new(ipa_opts); if (!tmpctx) { return ENOMEM; @@ -382,12 +388,10 @@ done: return ret; } -/* the following preprocessor code is used to keep track of - * the options in the krb5 module, so that if they change and ipa - * is not updated correspondingly this will trigger a build error */ -#if KRB5_OPTS > 6 -#error There are krb5 options not accounted for -#endif +/* the following define is used to keep track of * the options in the krb5 + * module, so that if they change and ipa is not updated correspondingly + * this will trigger a runtime abort error */ +#define IPA_KRB5_OPTS_TEST 8 int ipa_get_auth_options(struct ipa_options *ipa_opts, struct confdb_ctx *cdb, @@ -398,6 +402,14 @@ int ipa_get_auth_options(struct ipa_options *ipa_opts, int ret; int i; + /* self check test, this should never fail, unless someone forgot + * to properly update the code after new ldap options have been added */ + if (KRB5_OPTS != IPA_KRB5_OPTS_TEST) { + DEBUG(0, ("Option numbers do not match (%d != %d)\n", + KRB5_OPTS, IPA_KRB5_OPTS_TEST)); + abort(); + } + ipa_opts->auth = talloc_zero(ipa_opts, struct dp_option); if (ipa_opts->auth == NULL) { ret = ENOMEM; |