summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2004-07-21 21:53:34 +1000
committerDamien Miller <djm@mindrot.org>2004-07-21 21:53:34 +1000
commit0670c7396fc2435a51064f7bf456822baaaf910e (patch)
tree9624ae64ac66ca13ebef50c1bf052096f760657a
parent2d2ed3d63379668c80878b4008de51c00e1d9b86 (diff)
- djm@cvs.openbsd.org 2004/07/21 11:51:29
[canohost.c] bz#902: cache remote port so we don't fatal() in auth_log when remote connection goes away quickly. from peak AT argo.troja.mff.cuni.cz; ok markus@
-rw-r--r--ChangeLog7
-rw-r--r--canohost.c10
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c5c561561..4b7097c4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,11 @@
11 - djm@cvs.openbsd.org 2004/07/21 10:36:23 11 - djm@cvs.openbsd.org 2004/07/21 10:36:23
12 [gss-serv-krb5.c] 12 [gss-serv-krb5.c]
13 fix function declaration 13 fix function declaration
14 - djm@cvs.openbsd.org 2004/07/21 11:51:29
15 [canohost.c]
16 bz#902: cache remote port so we don't fatal() in auth_log when remote
17 connection goes away quickly. from peak AT argo.troja.mff.cuni.cz;
18 ok markus@
14 - (djm) [auth-pam.c] Portable parts of bz#899: Don't display invalid 19 - (djm) [auth-pam.c] Portable parts of bz#899: Don't display invalid
15 usernames in setproctitle from peak AT argo.troja.mff.cuni.cz; 20 usernames in setproctitle from peak AT argo.troja.mff.cuni.cz;
16 21
@@ -1559,4 +1564,4 @@
1559 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1564 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1560 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1565 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1561 1566
1562$Id: ChangeLog,v 1.3487 2004/07/21 10:54:47 djm Exp $ 1567$Id: ChangeLog,v 1.3488 2004/07/21 11:53:34 djm Exp $
diff --git a/canohost.c b/canohost.c
index 057f061b6..8ad684d6c 100644
--- a/canohost.c
+++ b/canohost.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: canohost.c,v 1.40 2004/06/21 17:36:31 avsm Exp $"); 15RCSID("$OpenBSD: canohost.c,v 1.41 2004/07/21 11:51:29 djm Exp $");
16 16
17#include "packet.h" 17#include "packet.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -382,7 +382,13 @@ get_peer_port(int sock)
382int 382int
383get_remote_port(void) 383get_remote_port(void)
384{ 384{
385 return get_port(0); 385 static int port = -1;
386
387 /* Cache to avoid getpeername() on a dead connection */
388 if (port == -1)
389 port = get_port(0);
390
391 return port;
386} 392}
387 393
388int 394int