bin/117452: The fix for PR 103206 is incorrect
Spencer Minear
minear at securecomputing.com
Wed Oct 24 07:20:02 PDT 2007
>Number: 117452
>Category: bin
>Synopsis: The fix for PR 103206 is incorrect
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 24 14:20:02 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator: Spencer Minear
>Release: 6.2
>Organization:
Secure Computing Corporation
>Environment:
FreeBSD freebe1.scur.com 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 root at dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
The change that was made for PR 103206 results in tftp returns an error code even if a send operation succeeds. The txrx_error = 1 that was added at the end of the processing needs to be placed at each point where and abort is detected.
>How-To-Repeat:
Use tftp to download a file and check the error status you will find that it sets the error status to 1 even when the file is successfully downloaded.
Before the fix the following occurs:
echo "get configs/10.69.222.75.cfg" | ./tftp 10.69.222.30
Received 963 bytes in 0.0 seconds
alpha:Admn {14} % echo $?
1
After the fix I've proposed the same command has a 0 exit code.
alpha:Admn {11} % echo "get configs/10.69.222.75.cfg" | tftp 10.69.222.30
Received 963 bytes in 0.0 seconds
alpha:Admn {12} % echo $?
0
>Fix:
% diff -c /usr/src/usr.bin/tftp/tftp.c .
*** /usr/src/usr.bin/tftp/tftp.c Mon Oct 2 13:43:57 2006
--- ./tftp.c Wed Sep 19 10:58:23 2007
***************
*** 143,148 ****
--- 143,149 ----
(struct sockaddr *)&peer, peer.ss_len);
if (n != size + 4) {
warn("sendto");
+ txrx_error = 1;
goto abort;
}
read_ahead(file, convert);
***************
*** 156,161 ****
--- 157,163 ----
alarm(0);
if (n < 0) {
warn("recvfrom");
+ txrx_error = 1;
goto abort;
}
if (!serv.ss_family)
***************
*** 163,168 ****
--- 165,171 ----
else if (!cmpport((struct sockaddr *)&serv,
(struct sockaddr *)&from)) {
warn("server port mismatch");
+ txrx_error = 1;
goto abort;
}
peer = from;
***************
*** 205,211 ****
stopclock();
if (amount > 0)
printstats("Sent", amount);
- txrx_error = 1;
}
/*
--- 208,213 ----
***************
*** 261,266 ****
--- 263,269 ----
peer.ss_len) != size) {
alarm(0);
warn("sendto");
+ txrx_error = 1;
goto abort;
}
write_behind(file, convert);
***************
*** 274,279 ****
--- 277,283 ----
alarm(0);
if (n < 0) {
warn("recvfrom");
+ txrx_error = 1;
goto abort;
}
if (!serv.ss_family)
***************
*** 281,286 ****
--- 285,291 ----
else if (!cmpport((struct sockaddr *)&serv,
(struct sockaddr *)&from)) {
warn("server port mismatch");
+ txrx_error = 1;
goto abort;
}
peer = from;
***************
*** 331,337 ****
stopclock();
if (amount > 0)
printstats("Received", amount);
- txrx_error = 1;
}
static int
--- 336,341 ----
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list