diff options
author | Russ Allbery <eagle@eyrie.org> | 2016-04-26 20:39:49 -0700 |
---|---|---|
committer | Russ Allbery <eagle@eyrie.org> | 2016-04-26 20:39:49 -0700 |
commit | b1bfc4a185363bff3b1e7d9755438fb08ab0cdf3 (patch) | |
tree | 7f2cf9d58ac2a3d00f93e5728edd0149a34a2818 /tests | |
parent | cf54488f2b84c3c97881c5e4dbe3122798c592d5 (diff) |
Make ACL tests work on Heimdal
Heimdal's KRB5_WELLKNOWN_NAME and related macros expand to a string literal
in parentheses, which means they can't be concatenated by the preprocessor
when the ACL tests are compiled. Instead, prepare the anonymous principal
name when the tests are run.
Based on a patch by Jeffrey Hutzelman.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/server/acl-t.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/server/acl-t.c b/tests/server/acl-t.c index 9b6f347..c448d78 100644 --- a/tests/server/acl-t.c +++ b/tests/server/acl-t.c @@ -23,6 +23,7 @@ #include <server/internal.h> #include <tests/tap/basic.h> #include <tests/tap/messages.h> +#include <tests/tap/string.h> /* @@ -43,15 +44,23 @@ acl_permit(const struct rule *rule, const char *user) /* * Calls server_config_acl_permit with the anonymous identity and anonymous * set to true. + * + * Heimdal's KRB5_WELLKNOWN_NAME and related constants expand to a literal in + * parentheses, which means they cannot be concatenated by the preprocessor + * and the string cannot be constructed at compile time. */ static bool acl_permit_anonymous(const struct rule *rule) { + static char *pname = NULL; struct client client = { - -1, NULL, NULL, 0, NULL, - (char *) (KRB5_WELLKNOWN_NAME "/" KRB5_ANON_NAME "@" KRB5_ANON_REALM), - true, 0, 0, false, false + -1, NULL, NULL, 0, NULL, NULL, true, 0, 0, false, false }; + + if (pname == NULL) + basprintf(&pname, "%s/%s@%s", KRB5_WELLKNOWN_NAME, KRB5_ANON_NAME, + KRB5_ANON_REALM); + client.user = pname; return server_config_acl_permit(rule, &client); } |