From 6f1a60a7206d804eb90107edf73d0109138db90c Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 30 Oct 2009 23:08:40 +0000 Subject: [PATCH] Quote realm name in error message. If realm name is an empty string, just return an error right away. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23097 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/locate_kdc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c index 0dc385a6c..4383fab4b 100644 --- a/src/lib/krb5/os/locate_kdc.c +++ b/src/lib/krb5/os/locate_kdc.c @@ -808,6 +808,12 @@ krb5int_locate_server (krb5_context context, const krb5_data *realm, *addrlist = al; + if (realm == NULL || realm->data == NULL || realm->data[0] == 0) { + krb5_set_error_message(context, KRB5_REALM_CANT_RESOLVE, + "Cannot find KDC for invalid realm name \"\""); + return KRB5_REALM_CANT_RESOLVE; + } + code = module_locate_server(context, realm, &al, svc, socktype, family); Tprintf("module_locate_server returns %d\n", code); if (code == KRB5_PLUGIN_NO_HANDLE) { @@ -847,7 +853,7 @@ krb5int_locate_server (krb5_context context, const krb5_data *realm, if (al.space) free_list (&al); krb5_set_error_message(context, KRB5_REALM_CANT_RESOLVE, - "Cannot resolve network address for KDC in realm %.*s", + "Cannot resolve network address for KDC in realm \"%.*s\"", realm->length, realm->data); return KRB5_REALM_CANT_RESOLVE; -- 2.26.2