Produce a more informative error message for KDC_UNREACH with KDC not responding
authorKen Raeburn <raeburn@mit.edu>
Fri, 13 Apr 2007 05:44:38 +0000 (05:44 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 13 Apr 2007 05:44:38 +0000 (05:44 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19456 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/sendto_kdc.c

index b133ec7d22376a0b4a1a5ed2aeef4d95bf5c8915..e41ab89ba57dc0b07f6c00f0c5f241aed2d857c5 100644 (file)
@@ -397,7 +397,8 @@ krb5_sendto_kdc (krb5_context context, const krb5_data *message,
     if (addrs.naddrs > 0) {
         retval = krb5int_sendto (context, message, &addrs, 0, reply, 0, 0,
                                                                 0, 0, &addr_used);
-        if (retval == 0) {
+       switch (retval) {
+       case 0:
             /*
              * Set use_master to 1 if we ended up talking to a master when
              * we didn't explicitly request to
@@ -415,7 +416,15 @@ krb5_sendto_kdc (krb5_context context, const krb5_data *message,
             }
             krb5int_free_addrlist (&addrs);
             return 0;
-        }
+       default:
+           break;
+           /* Cases here are for constructing useful error messages.  */
+       case KRB5_KDC_UNREACH:
+           krb5_set_error_message(context, retval,
+                                  "Cannot contact any KDC for realm '%.*s'",
+                                  realm->length, realm->data);
+           break;
+       }
         krb5int_free_addrlist (&addrs);
     }
     return retval;