From 03952c0c83b32604e5bb49a4205d19adb6806f40 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 30 Oct 2009 23:08:45 +0000 Subject: [PATCH] If krb5_sname_to_principal returns a null realm for the client principal name, print an error message. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23098 dc483132-0cff-0310-8789-dd5450dbe970 --- src/clients/kinit/kinit.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index 3f31824b0..808107f79 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -480,6 +480,16 @@ k5_begin(opts, k5) "when creating default server principal name"); return 0; } + if (k5->me->realm.data[0] == 0) { + code = krb5_unparse_name(k5->ctx, k5->me, &k5->name); + if (code == 0) + com_err(progname, KRB5_ERR_HOST_REALM_UNKNOWN, + "(principal %s)", k5->name); + else + com_err(progname, KRB5_ERR_HOST_REALM_UNKNOWN, + "for local services"); + return 0; + } } else { /* Get default principal from cache if one exists */ code = krb5_cc_get_principal(k5->ctx, k5->cc, -- 2.26.2