Fix error-handling problem in TFTP server.
diff --git a/src/tftp.c b/src/tftp.c
index bda04f3..d926b6c 100644
--- a/src/tftp.c
+++ b/src/tftp.c
@@ -312,7 +312,10 @@
!(filename = next(&p, end)) ||
!(mode = next(&p, end)) ||
(strcasecmp(mode, "octet") != 0 && strcasecmp(mode, "netascii") != 0))
- len = tftp_err(ERR_ILL, packet, _("unsupported request from %s"), daemon->addrbuff);
+ {
+ len = tftp_err(ERR_ILL, packet, _("unsupported request from %s"), daemon->addrbuff);
+ is_err = 1;
+ }
else
{
if (strcasecmp(mode, "netascii") == 0)
@@ -505,12 +508,12 @@
{
tmp = transfer->next;
+ prettyprint_addr(&transfer->peer, daemon->addrbuff);
+
if (FD_ISSET(transfer->sockfd, rset))
{
/* we overwrote the buffer... */
daemon->srv_save = NULL;
-
- prettyprint_addr(&transfer->peer, daemon->addrbuff);
if ((len = recv(transfer->sockfd, daemon->packet, daemon->packet_buff_sz, 0)) >= (ssize_t)sizeof(struct ack))
{
@@ -533,7 +536,7 @@
err = "";
else
sanitise(err);
-
+
my_syslog(MS_TFTP | LOG_ERR, _("error %d %s received from %s"),
(int)ntohs(mess->block), err,
daemon->addrbuff);