From a2225fce8c4970b8bc0ec7497c5d0550585ce6eb Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Tue, 9 May 2000 19:29:57 +0000 Subject: [PATCH] rfc1413.c fixes: 1) we were retrieving our local port before APR filled it in; wait a little longer :) (maybe APR needs to be a little smarter about when/if to call getsockname()? it could call it when the info is first needed and not do it at all if never needed) 2) when the server dropped the connection before sending a properly- delimited response, we entered a hard loop; we weren't reacting to EOF/FIN properly git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85170 13f79535-47bb-0310-9956-ffa450edef68 --- server/rfc1413.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/rfc1413.c b/server/rfc1413.c index 8355038c9b..16f7b4db3f 100644 --- a/server/rfc1413.c +++ b/server/rfc1413.c @@ -134,7 +134,6 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip, "bind: rfc1413: Error binding to local port"); return -1; } - ap_get_local_port(&sav_our_port, sock); /* * errors from connect usually imply the remote machine doesn't support @@ -145,6 +144,7 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip, if (ap_connect(sock, NULL) != APR_SUCCESS) return -1; + ap_get_local_port(&sav_our_port, sock); ap_get_remote_port(&sav_rmt_port, sock); /* send the data */ @@ -194,6 +194,10 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip, else if (j > 0) { i+=j; } + else if (status == APR_SUCCESS && j == 0) { + /* Oops... we ran out of data before finding newline */ + return -1; + } } /* RFC1413_USERLEN = 512 */ -- 2.50.1