summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2001-08-10 15:20:16 +0000
committerEzra Peisach <epeisach@mit.edu>2001-08-10 15:20:16 +0000
commit63e760248419c157f3677582775f498f65bddd3d (patch)
tree1600d79860511e3e81dc1672e8ca514e729d7dcf /src
parent1fe4979be233929d903c79641d83e6ff8ca8e47a (diff)
downloadkrb5-63e760248419c157f3677582775f498f65bddd3d.tar.gz
krb5-63e760248419c157f3677582775f498f65bddd3d.tar.xz
krb5-63e760248419c157f3677582775f498f65bddd3d.zip
* clnt_udp.c (clntudp_call): Do not assume that select will not
change the timeout struct timeval. Under Linux, this reflects the time left available - which might result in 0 in the case of a timeout. When attempting to resend a request, this may results in a timeout of zero - flooding the server with replay requests. * clnt_tcp.c (readtcp): Same. * pmap_rmt.c (clnt_broadcast): Same * svc_tcp.c (readtcp): Same git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13679 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/rpc/ChangeLog12
-rw-r--r--src/lib/rpc/clnt_tcp.c4
-rw-r--r--src/lib/rpc/clnt_udp.c5
-rw-r--r--src/lib/rpc/pmap_rmt.c5
-rw-r--r--src/lib/rpc/svc_tcp.c4
5 files changed, 24 insertions, 6 deletions
diff --git a/src/lib/rpc/ChangeLog b/src/lib/rpc/ChangeLog
index b17eeff87..d48cc888b 100644
--- a/src/lib/rpc/ChangeLog
+++ b/src/lib/rpc/ChangeLog
@@ -1,3 +1,15 @@
+2001-08-10 <epeisach@mit.edu>
+
+ * clnt_udp.c (clntudp_call): Do not assume that select will not
+ change the timeout struct timeval. Under Linux, this reflects the
+ time left available - which might result in 0 in the case of a
+ timeout. When attempting to resend a request, this may results in
+ a timeout of zero - flooding the server with replay requests.
+
+ * clnt_tcp.c (readtcp): Same.
+ * pmap_rmt.c (clnt_broadcast): Same
+ * svc_tcp.c (readtcp): Same
+
2001-07-26 Ezra Peisach <epeisach@home>
* xdr_reference.c (xdr_reference): Remove cast in argument to memset.
diff --git a/src/lib/rpc/clnt_tcp.c b/src/lib/rpc/clnt_tcp.c
index 00e4e51c9..b43775e2b 100644
--- a/src/lib/rpc/clnt_tcp.c
+++ b/src/lib/rpc/clnt_tcp.c
@@ -422,6 +422,7 @@ readtcp(ctptr, buf, len)
register int len;
{
register struct ct_data *ct = (struct ct_data *)(void *)ctptr;
+ struct timeval tout;
#ifdef FD_SETSIZE
fd_set mask;
fd_set readfds;
@@ -440,8 +441,9 @@ readtcp(ctptr, buf, len)
#endif /* def FD_SETSIZE */
while (TRUE) {
readfds = mask;
+ tout = ct->ct_wait;
switch (select(_gssrpc_rpc_dtablesize(), &readfds, (fd_set*)NULL, (fd_set*)NULL,
- &(ct->ct_wait))) {
+ &tout)) {
case 0:
ct->ct_error.re_status = RPC_TIMEDOUT;
return (-1);
diff --git a/src/lib/rpc/clnt_udp.c b/src/lib/rpc/clnt_udp.c
index 12a3aca0c..798622e25 100644
--- a/src/lib/rpc/clnt_udp.c
+++ b/src/lib/rpc/clnt_udp.c
@@ -242,7 +242,7 @@ clntudp_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout)
struct sockaddr_in from;
struct rpc_msg reply_msg;
XDR reply_xdrs;
- struct timeval time_waited;
+ struct timeval time_waited, seltimeout;
bool_t ok;
int nrefreshes = 2; /* number of times to refresh cred */
struct timeval timeout;
@@ -298,8 +298,9 @@ send_again:
#endif /* def FD_SETSIZE */
for (;;) {
readfds = mask;
+ seltimeout = cu->cu_wait;
switch (select(_gssrpc_rpc_dtablesize(), &readfds, (fd_set *)NULL,
- (fd_set *)NULL, &(cu->cu_wait))) {
+ (fd_set *)NULL, &seltimeout)) {
case 0:
time_waited.tv_sec += cu->cu_wait.tv_sec;
diff --git a/src/lib/rpc/pmap_rmt.c b/src/lib/rpc/pmap_rmt.c
index 9d03356da..1d090f732 100644
--- a/src/lib/rpc/pmap_rmt.c
+++ b/src/lib/rpc/pmap_rmt.c
@@ -257,7 +257,7 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
struct rmtcallargs a;
struct rmtcallres r;
struct rpc_msg msg;
- struct timeval t;
+ struct timeval t, t2;
char outbuf[MAX_BROADCAST_SIZE];
#ifndef MAX
#define MAX(A,B) ((A)<(B)?(B):(A))
@@ -342,8 +342,9 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
msg.acpted_rply.ar_results.where = (caddr_t)&r;
msg.acpted_rply.ar_results.proc = xdr_rmtcallres;
readfds = mask;
+ t2 = t;
switch (select(_gssrpc_rpc_dtablesize(), &readfds, (fd_set *)NULL,
- (fd_set *)NULL, &t)) {
+ (fd_set *)NULL, &t2)) {
case 0: /* timed out */
stat = RPC_TIMEDOUT;
diff --git a/src/lib/rpc/svc_tcp.c b/src/lib/rpc/svc_tcp.c
index 771827b22..5c7b0e9e5 100644
--- a/src/lib/rpc/svc_tcp.c
+++ b/src/lib/rpc/svc_tcp.c
@@ -315,6 +315,7 @@ readtcp(xprtptr, buf, len)
{
register SVCXPRT *xprt = (SVCXPRT *)(void *)xprtptr;
register int sock = xprt->xp_sock;
+ struct timeval tout;
#ifdef FD_SETSIZE
fd_set mask;
fd_set readfds;
@@ -327,8 +328,9 @@ readtcp(xprtptr, buf, len)
#endif /* def FD_SETSIZE */
do {
readfds = mask;
+ tout = wait_per_try;
if (select(_gssrpc_rpc_dtablesize(), &readfds, (fd_set*)NULL,
- (fd_set*)NULL, &wait_per_try) <= 0) {
+ (fd_set*)NULL, &tout) <= 0) {
if (errno == EINTR) {
continue;
}