If krb5_sname_to_principal returns a null realm for the client
authorKen Raeburn <raeburn@mit.edu>
Fri, 30 Oct 2009 23:08:45 +0000 (23:08 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 30 Oct 2009 23:08:45 +0000 (23:08 +0000)
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

index 3f31824b07ffdd8fb9db988e5f4f08f1ea2399bf..808107f797142bfcf5ac4a21930be56c451c6f14 100644 (file)
@@ -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,