pull up r19456 from trunk (prereq for r19738)
authorTom Yu <tlyu@mit.edu>
Thu, 13 Sep 2007 23:48:42 +0000 (23:48 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 13 Sep 2007 23:48:42 +0000 (23:48 +0000)
 r19456@cathode-dark-space:  raeburn | 2007-04-13 01:44:38 -0400
 Produce a more informative error message for KDC_UNREACH with KDC not responding.

ticket: 3334

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19933 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/sendto_kdc.c

index 764aafe1846321e6219cbd16fb75db06a7c12a11..7a0c8ccc75e0c8c8e80e8fc002430912db333722 100644 (file)
@@ -383,7 +383,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
@@ -401,7 +402,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;