forked from mirrors/tftp-hpa-google
tftpd: try to handle duplicate WRQ packets
Duplicate WRQ packets can really hurt, since they end up accessing the same file. This attempts to lock the file, which should work for the case where a correctly implemented TFTP stack uses the same session ID (port number) for each retry; in any other case they look like multiple sessions to the same file and it is a crapshoot if we end up with the correct one. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
05ffcecaa8
commit
2864d83fea
2 changed files with 43 additions and 11 deletions
|
@ -46,6 +46,7 @@ AC_CHECK_HEADERS(strings.h)
|
|||
AC_CHECK_HEADERS(sysexits.h)
|
||||
AC_CHECK_HEADERS(time.h)
|
||||
AC_CHECK_HEADERS(unistd.h)
|
||||
AC_CHECK_HEADERS(sys/file.h)
|
||||
AC_CHECK_HEADERS(sys/filio.h)
|
||||
AC_CHECK_HEADERS(sys/stat.h)
|
||||
AC_CHECK_HEADERS(sys/time.h)
|
||||
|
@ -140,6 +141,11 @@ PA_HEADER_DEFINES(fcntl.h, int, O_NONBLOCK)
|
|||
PA_HEADER_DEFINES(fcntl.h, int, O_BINARY)
|
||||
PA_HEADER_DEFINES(fcntl.h, int, O_TEXT)
|
||||
|
||||
PA_HEADER_DEFINES(fcntl.h, int, F_SETLK)
|
||||
|
||||
PA_HEADER_DEFINES(sys/file.h, int, LOCK_SH)
|
||||
PA_HEADER_DEFINES(sys/file.h, int, LOCK_EX)
|
||||
|
||||
AH_TEMPLATE([HAVE_SIGSETJMP],
|
||||
[Define if we have sigsetjmp, siglongjmp and sigjmp_buf.])
|
||||
PA_SIGSETJMP([AC_DEFINE(HAVE_SIGSETJMP)])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue