diff options
author | Damien Miller <djm@mindrot.org> | 2004-07-21 21:53:34 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2004-07-21 21:53:34 +1000 |
commit | 0670c7396fc2435a51064f7bf456822baaaf910e (patch) | |
tree | 9624ae64ac66ca13ebef50c1bf052096f760657a | |
parent | 2d2ed3d63379668c80878b4008de51c00e1d9b86 (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-- | ChangeLog | 7 | ||||
-rw-r--r-- | canohost.c | 10 |
2 files changed, 14 insertions, 3 deletions
@@ -11,6 +11,11 @@ - djm@cvs.openbsd.org 2004/07/21 10:36:23 [gss-serv-krb5.c] fix function declaration + - 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@ - (djm) [auth-pam.c] Portable parts of bz#899: Don't display invalid usernames in setproctitle from peak AT argo.troja.mff.cuni.cz; @@ -1559,4 +1564,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3487 2004/07/21 10:54:47 djm Exp $ +$Id: ChangeLog,v 1.3488 2004/07/21 11:53:34 djm Exp $ @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: canohost.c,v 1.40 2004/06/21 17:36:31 avsm Exp $"); +RCSID("$OpenBSD: canohost.c,v 1.41 2004/07/21 11:51:29 djm Exp $"); #include "packet.h" #include "xmalloc.h" @@ -382,7 +382,13 @@ get_peer_port(int sock) int get_remote_port(void) { - return get_port(0); + static int port = -1; + + /* Cache to avoid getpeername() on a dead connection */ + if (port == -1) + port = get_port(0); + + return port; } int |