diff options
Diffstat (limited to 'crypto/heimdal/lib/krb5/name-45-test.c')
-rw-r--r-- | crypto/heimdal/lib/krb5/name-45-test.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/crypto/heimdal/lib/krb5/name-45-test.c b/crypto/heimdal/lib/krb5/name-45-test.c index f1455cd..0bb05f5 100644 --- a/crypto/heimdal/lib/krb5/name-45-test.c +++ b/crypto/heimdal/lib/krb5/name-45-test.c @@ -31,8 +31,9 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "krb5_locl.h" +#include <err.h> -RCSID("$Id: name-45-test.c,v 1.3.2.1 2003/05/06 16:49:14 joda Exp $"); +RCSID("$Id: name-45-test.c 19763 2007-01-08 13:35:49Z lha $"); enum { MAX_COMPONENTS = 3 }; @@ -58,10 +59,10 @@ static struct testcase { {"krbtgt", "FOO.SE", "FOO.SE", "FOO.SE", 2, {"krbtgt", "FOO.SE"}, NULL, 0, 0}, - {"foo", "bar", "BAZ", "BAZ", 2, - {"foo", "bar"}, NULL, 0, 0}, - {"foo", "bar", "BAZ", "BAZ", 2, - {"foo", "bar"}, + {"foo", "bar2", "BAZ", "BAZ", 2, + {"foo", "bar2"}, NULL, 0, 0}, + {"foo", "bar2", "BAZ", "BAZ", 2, + {"foo", "bar2"}, "[libdefaults]\n" " v4_name_convert = {\n" " host = {\n" @@ -69,8 +70,8 @@ static struct testcase { " }\n" "}\n", HEIM_ERR_V4_PRINC_NO_CONV, 0}, - {"foo", "bar", "BAZ", "BAZ", 2, - {"foo5", "bar.baz"}, + {"foo", "bar2", "BAZ", "BAZ", 2, + {"foo5", "bar2.baz"}, "[realms]\n" " BAZ = {\n" " v4_name_convert = {\n" @@ -79,7 +80,7 @@ static struct testcase { " }\n" " }\n" " v4_instance_convert = {\n" - " bar = bar.baz\n" + " bar2 = bar2.baz\n" " }\n" " }\n", 0, 0}, @@ -152,8 +153,15 @@ main(int argc, char **argv) struct testcase *t; krb5_context context; krb5_error_code ret; + char hostname[1024]; int val = 0; + setprogname(argv[0]); + + gethostname(hostname, sizeof(hostname)); + if (!(strstr(hostname, "kth.se") != NULL || strstr(hostname, "su.se") != NULL)) + return 0; + for (t = tests; t->v4_name; ++t) { krb5_principal princ; int i; @@ -207,12 +215,15 @@ main(int argc, char **argv) t->v4_name, t->v4_inst, t->v4_realm, s); free(s); val = 1; + krb5_free_context(context); continue; } } - if (ret) + if (ret) { + krb5_free_context(context); continue; + } if (strcmp (t->v5_realm, princ->realm) != 0) { printf ("wrong realm (\"%s\" should be \"%s\")" @@ -266,15 +277,18 @@ main(int argc, char **argv) "krb5_524_conv_principal %s " "passed unexpected", printable_princ); val = 1; + krb5_free_context(context); continue; } } if (ret) { krb5_free_principal (context, princ); + krb5_free_context(context); continue; } krb5_free_principal (context, princ); + krb5_free_context(context); } return val; } |