From c0c65784853e18cd48f506e5afca3abee71fc861 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 4 Dec 2008 22:26:56 +0000 Subject: [PATCH] Fix from Marcus Watts for glob-to-regexp conversion bug. Tweaked test case to exercise the bug. ticket: 5667 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21285 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm5/srv/svr_iters.c | 3 ++- src/tests/dejagnu/krb-standalone/kadmin.exp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/kadm5/srv/svr_iters.c b/src/lib/kadm5/srv/svr_iters.c index d78b9e554..9774d76ea 100644 --- a/src/lib/kadm5/srv/svr_iters.c +++ b/src/lib/kadm5/srv/svr_iters.c @@ -86,7 +86,7 @@ static kadm5_ret_t glob_to_regexp(char *glob, char *realm, char **regexp) /* and trailing null. If glob has no @, also allocate space for */ /* the realm. */ append_realm = (realm != NULL) && (strchr(glob, '@') == NULL); - p = (char *) malloc(strlen(glob)*2+ 3 + (append_realm ? 2 : 0)); + p = (char *) malloc(strlen(glob)*2+ 3 + (append_realm ? 3 : 0)); if (p == NULL) return ENOMEM; *regexp = p; @@ -120,6 +120,7 @@ static kadm5_ret_t glob_to_regexp(char *glob, char *realm, char **regexp) if (append_realm) { *p++ = '@'; + *p++ = '.'; *p++ = '*'; } diff --git a/src/tests/dejagnu/krb-standalone/kadmin.exp b/src/tests/dejagnu/krb-standalone/kadmin.exp index 98214ed52..3ec5103db 100644 --- a/src/tests/dejagnu/krb-standalone/kadmin.exp +++ b/src/tests/dejagnu/krb-standalone/kadmin.exp @@ -383,7 +383,9 @@ proc kadmin_list { } { global KEY global spawn_id - spawn $KADMIN -p krbtest/admin@$REALMNAME -q "get_principals *" + # "*" would match everything + # "*n" should match a few like kadmin/admin but see ticket 5667 + spawn $KADMIN -p krbtest/admin@$REALMNAME -q "get_principals *n" expect_after { "Cannot contact any KDC" { fail "kadmin ldb lost KDC" -- 2.26.2