Quote realm name in error message.
authorKen Raeburn <raeburn@mit.edu>
Fri, 30 Oct 2009 23:08:40 +0000 (23:08 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 30 Oct 2009 23:08:40 +0000 (23:08 +0000)
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

index 0dc385a6c045f698a88e49060690a1a9699b2017..4383fab4b982a63051b3850767ca2f2c01914337 100644 (file)
@@ -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;