75b0804
Fall back to TCP on kdc-unresolvable/unreachable errors.  We still have
75b0804
to wait for UDP to fail, so this might not be ideal.  RT #5868.
75b0804
Nalin Dahyabhai 6d42ba9
--- krb5/src/lib/krb5/os/changepw.c
Nalin Dahyabhai 6d42ba9
+++ krb5/src/lib/krb5/os/changepw.c
Nalin Dahyabhai 6d42ba9
@@ -270,10 +270,22 @@ change_set_password(krb5_context context
Nalin Dahyabhai 6d42ba9
                          &callback_info, &chpw_rep, ss2sa(&remote_addr),
Nalin Dahyabhai 6d42ba9
                          &addrlen, NULL, NULL, NULL);
Nalin Dahyabhai 6d42ba9
         if (code) {
75b0804
-            /*
75b0804
-             * Here we may want to switch to TCP on some errors.
75b0804
-             * right?
75b0804
-             */
75b0804
+            /* if we're not using a stream socket, and it's an error which
75b0804
+             * might reasonably be specific to a datagram "connection", try
75b0804
+             * again with a stream socket */
Nalin Dahyabhai 6d42ba9
+            if (!use_tcp) {
75b0804
+                switch (code) {
75b0804
+                case KRB5_KDC_UNREACH:
75b0804
+                case KRB5_REALM_CANT_RESOLVE:
75b0804
+                case KRB5KRB_ERR_RESPONSE_TOO_BIG:
75b0804
+                /* should we do this for more result codes than these? */
Nalin Dahyabhai 6d42ba9
+                    k5_free_serverlist (&sl);
Nalin Dahyabhai 6d42ba9
+                    use_tcp = 1;
75b0804
+                    continue;
75b0804
+                default:
75b0804
+                    break;
75b0804
+                }
75b0804
+            }
75b0804
             break;
75b0804
         }
75b0804