]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Do not allow stream socket retries in libkrad
authorNathaniel McCallum <npmccallum@redhat.com>
Fri, 7 Aug 2015 19:35:58 +0000 (15:35 -0400)
committerTom Yu <tlyu@mit.edu>
Wed, 9 Dec 2015 19:54:56 +0000 (14:54 -0500)
Before this patch, libkrad would follow the same exact logic for all
socket types when the retries parameter was non-zero.  This meant that
when connecting with SOCK_STREAM, multiple requests were sent in case
of packet drops, which, of course, cannot happen for SOCK_STREAM.

Instead, just disable retries for SOCK_STREAM sockets.

[ghudson@mit.edu: minor wording edits]

(cherry picked from commit 25e0656fdf9862faf9aa91288023776e9a47caad)

ticket: 8307 (new)
version_fixed: 1.12.5
status: resolved

src/include/krad.h
src/lib/krad/remote.c

index 913464c80425ad39ea0e1e8349c942027b9d71cb..e4edb524caf622e22b497b1d4efcbc650e90ee32 100644 (file)
@@ -251,7 +251,8 @@ krad_client_free(krad_client *client);
  *  - hostname:service
  *
  * The timeout parameter (milliseconds) is the total timeout across all remote
- * hosts (when DNS returns multiple entries) and all retries.
+ * hosts (when DNS returns multiple entries) and all retries.  For stream
+ * sockets, the retries parameter is ignored and no retries are performed.
  *
  * The cb function will be called with the data argument when either a response
  * is received or the request times out on all possible remote hosts.
index bea14299e35ed2f1ced274d3fc63cef184ec8d8a..46bdb8ee088d1fa82650e0253d15ed2d3bd634eb 100644 (file)
@@ -447,6 +447,9 @@ kr_remote_send(krad_remote *rr, krad_code code, krad_attrset *attrs,
     krb5_error_code retval;
     request *r;
 
+    if (rr->info->ai_socktype == SOCK_STREAM)
+        retries = 0;
+
     r = TAILQ_FIRST(&rr->list);
     retval = krad_packet_new_request(rr->kctx, rr->secret, code, attrs,
                                      (krad_packet_iter_cb)iterator, &r, &tmp);