Date: Sat, 17 Jun 2000 09:38:00 +1100 From: isv <isv@false.vmts.ru> To: freebsd-questions@FreeBSD.ORG Subject: bug in ftpd. FreeBSD release 4.0 Message-ID: <17401.000617@false.vmts.ru>
next in thread | raw e-mail | index | archive | help
------------6F19C18A19F92502 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello freebsd-questions, FreeBSD ftp daemon have bugs in "selecthost" function, that causes not correct virtual hosting support. I have detected that in FreeBSD release 4.0. 3.x releases have not same bugs. selecthost(su) union sockunion *su; { ... while (hrp != NULL) { for (hi = hrp->hostinfo; hi != NULL; hi = hi->ai_next) { if (memcmp(su, hi->ai_addr, hi->ai_addrlen) == 0) { >>The su union have not compatible format with sockaddr struct. >>Therefore we do not find host which necessary thishost = hrp; break; >> When break cause we break the "FOR" cycle not the "while" >> Actually even if we find necessary hrp structure we do not break >> main "WHILE" cycle ;) } #ifdef INET6 &((struct sockaddr_in *)hi->ai_addr)->sin_addr, sizeof(struct in_addr)) == 0)) { thishost = hrp; break; >> Same problem like described above. } #endif For show that i attach patch. Best regards, isv mailto:isv@false.vmts.ru ------------6F19C18A19F92502 Content-Type: application/octet-stream; name="ftpd.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ftpd.patch" --- ftpd.orig Fri Jun 16 21:04:33 2000 +++ ftpd.c Fri Jun 16 21:04:27 2000 @@ -772,6 +772,7 @@ selecthost(su) union sockunion *su; { + int find=0; struct ftphost *hrp; u_int16_t port; #ifdef INET6 @@ -792,11 +793,12 @@ hrp = thishost = firsthost; /* default */ port = su->su_port; su->su_port = 0; - while (hrp != NULL) { + while (hrp != NULL && !find) { for (hi = hrp->hostinfo; hi != NULL; hi = hi->ai_next) { - if (memcmp(su, hi->ai_addr, hi->ai_addrlen) == 0) { + if (memcmp(&su->su_sin, hi->ai_addr, hi->ai_addrlen) == 0) { thishost = hrp; + find=1; break; } #ifdef INET6 @@ -806,6 +808,7 @@ &((struct sockaddr_in *)hi->ai_addr)->sin_addr, sizeof(struct in_addr)) == 0)) { thishost = hrp; + find=1; break; } #endif ------------6F19C18A19F92502-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17401.000617>