svn commit: r337249 - in stable/10/libexec/tftpd: . tests

Alan Somers asomers at FreeBSD.org
Fri Aug 3 14:19:10 UTC 2018


Author: asomers
Date: Fri Aug  3 14:19:09 2018
New Revision: 337249
URL: https://svnweb.freebsd.org/changeset/base/337249

Log:
  MFC r330719:
  
  tftpd: Abort on an WRQ access violation
  
  On a WRQ (write request) tftpd checks whether the client has access
  permission for the file in question.  If not, then the write is prevented.
  However, tftpd doesn't reply with an ERROR packet, nor does it abort.
  Instead, it tries to receive the packet anyway.
  
  The symptom is slightly different depending on the nature of the error.  If
  the target file is nonexistent and tftpd lacks permission to create it, then
  tftpd will willingly receive the file, but not write it anywhere.  If the
  file exists but is not writable, then tftpd will fail to ACK to WRQ.
  
  PR:		225996

Modified:
  stable/10/libexec/tftpd/tests/functional.c
  stable/10/libexec/tftpd/tftpd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/tftpd/tests/functional.c
==============================================================================
--- stable/10/libexec/tftpd/tests/functional.c	Fri Aug  3 14:18:02 2018	(r337248)
+++ stable/10/libexec/tftpd/tests/functional.c	Fri Aug  3 14:19:09 2018	(r337249)
@@ -819,8 +819,6 @@ TFTPD_TC_DEFINE(wrq_eaccess,)
 	close(fd);
 
 	SEND_WRQ("empty.txt", "octet");
-	atf_tc_expect_fail("PR 225996 tftpd doesn't abort on a WRQ access "
-	    "violation");
 	RECV_ERROR(2, "Access violation");
 }
 
@@ -837,8 +835,6 @@ TFTPD_TC_DEFINE(wrq_eaccess_world_readable,)
 	close(fd);
 
 	SEND_WRQ("empty.txt", "octet");
-	atf_tc_expect_fail("PR 225996 tftpd doesn't abort on a WRQ access "
-	    "violation");
 	RECV_ERROR(2, "Access violation");
 }
 
@@ -915,8 +911,6 @@ TFTPD_TC_DEFINE(wrq_netascii,)
 TFTPD_TC_DEFINE(wrq_nonexistent,)
 {
 	SEND_WRQ("nonexistent.txt", "octet");
-	atf_tc_expect_fail("PR 225996 tftpd doesn't abort on a WRQ access "
-	    "violation");
 	RECV_ERROR(1, "File not found");
 }
 

Modified: stable/10/libexec/tftpd/tftpd.c
==============================================================================
--- stable/10/libexec/tftpd/tftpd.c	Fri Aug  3 14:18:02 2018	(r337248)
+++ stable/10/libexec/tftpd/tftpd.c	Fri Aug  3 14:19:09 2018	(r337249)
@@ -543,6 +543,10 @@ tftp_wrq(int peer, char *recvbuffer, ssize_t size)
 			    filename, errtomsg(ecode));
 	}
 
+	if (ecode) {
+		send_error(peer, ecode);
+		exit(1);
+	}
 	tftp_recvfile(peer, mode);
 	exit(0);
 }


More information about the svn-src-all mailing list