svn rev #23097: trunk/src/lib/krb5/os/

raeburn@MIT.EDU raeburn at MIT.EDU
Fri Oct 30 19:08:40 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=23097
Commit By: raeburn
Log Message:
Quote realm name in error message.
If realm name is an empty string, just return an error right away.


Changed Files:
U   trunk/src/lib/krb5/os/locate_kdc.c
Modified: trunk/src/lib/krb5/os/locate_kdc.c
===================================================================
--- trunk/src/lib/krb5/os/locate_kdc.c	2009-10-30 21:34:19 UTC (rev 23096)
+++ trunk/src/lib/krb5/os/locate_kdc.c	2009-10-30 23:08:40 UTC (rev 23097)
@@ -808,6 +808,12 @@
 
     *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 @@
 	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;




More information about the cvs-krb5 mailing list