summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tftpd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* resend the current block if the other end acks the previous block again.dlg2020-01-091-14/+14
| | | | | | | | | without this we just bump the timeout, which delays resending the block, which means the client gives up before they get the data. this seems to fix "timeouts" ive had a lot recently with uefi pxe stacks, and fetching firmware images on certain switches, all over busy networks.
* snprintf/vsnprintf return < 0 on error, rather than -1.deraadt2019-07-031-3/+3
|
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-5/+5
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* add the STANDARDS sectiondlg2019-03-041-2/+64
| | | | | this lists the current RFCs, the obsoleted or updated RFCs are left commented out.
* This has nothing to do with DARPA.deraadt2019-03-031-4/+3
|
* Handle the transfer size option when faking up /etc/random.seed.naddy2018-01-261-1/+3
| | | | | Without this, clients that queried the size would receive 0 as response. ok jca@
* Add support for client-specific directories (named after the client address)jca2017-11-072-11/+55
| | | | | | | | | tftpd -i will look up the requested path the directory named after the client's IP address. For read requests, if the file is not found, there's a fall back to its root directory. From Jan Klemkow with input and tweaks from at least jmc@, bluhm@, deraadt@, sthen@, semarie@ and myself. ok bluhm@
* Sync the severity of the syslog_* functions shared between identd, slowcgi,florian2017-05-261-5/+5
| | | | | | | | tftp-proxy and tftpd to the severity used in log.c style loggers. This also fixes an issue where syslog_err and syslog_errx logged with different severities. Sure deraadt@
* Different compilers and versions of compilers have different warnings.jsg2017-04-161-2/+2
| | | | | | Remove -Werror to give code a greater chance of building. ok deraadt@ florian@
* Exit early from rdaemon() is the passed fd is invalid.jca2016-09-261-1/+7
| | | | fd == -1 check suggested by deraadt@, ok florian@
* Add format attribute to logger functions.florian2016-09-041-14/+44
| | | | | Add syslog_debug to keep in sync with others. Input & OK benno@
* For consistency, omit the variable name in rdaemon() prototype.jca2016-03-311-2/+2
|
* Go in the background much later, to reduce possible silent failures.jca2016-03-311-5/+37
| | | | | | | | | | rev. 1.34 moved the call to daemon() before the chroot, thus hiding errors if the target directory or _tftpd user don't exist. To go in the background later we need to preopen /dev/null. The code is put in a daemon(3) like function that could be used in other daemons. Lack of error reporting spotted by ajacoutot@, initial diff from dlg@. rdaemon() "concept" discussed with semarie@. ok ajacoutot@ dlg@
* move daemon(3) call before chroot(2) in tftpd.semarie2015-12-141-4/+4
| | | | | | | so daemon(3) will be able to redirect standard input, standard output and standard error to /dev/null. ok jca@
* Remove NULL-checks before free().mmcc2015-12-111-3/+2
|
* Add "dns" to the pledges. Previously these worked because of "inet",deraadt2015-10-181-2/+2
| | | | alas "dns" is now a mandatory statement if you want to do dns!
* pledge "stdio rpath wpath cpath fattr inet" after chroot and suchderaadt2015-10-101-1/+4
| | | | appears to be good enough for the main loop processing.
* do not need ioctl.hderaadt2015-10-061-2/+2
|
* use SOCK_NONBLOCK when making a socket instead of ioctl FIONBIO.dlg2015-08-201-14/+6
| | | | for guenther@
* tweak the /etc/random.seed interception so it provides a FILE* viadlg2015-07-201-24/+20
| | | | | | | | | | | fmemopen for the rest of the code to chew on, rather than having special casing for seed generation in the sending code. this also means our fake random.seed files will get proper netascii encoding by being read via the fgetc api instead of directly from a buffer. ok deraadt@ mcbride@
* Have tftpd provide a block of random data when clients request the filemcbride2015-07-182-13/+42
| | | | | | | | | | /etc/random.seed. This allows netbooted systems to inject entropy early in the kernel start. pxeboot requests it already, so no configuration or change is needed on the client side. ok deraadt@ beck@
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-7/+6
| | | | | | | | | possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
* the easier way to put a buffer on the stack is to put it on the stack,tedu2014-12-171-2/+2
| | | | not with alloca(). found by dickman; ok kettenis
* evbuffer_read and evbuffer_write are wrappers around read and write,dlg2014-11-251-5/+24
| | | | | | | | | | | | | so you have to check their return values in the same way and handle errors the same way. returning 0 from evbuffer_read means the other end of the socket has gone away. we should try again on both evbuffer_read and evbuffer_write if we get EAGAIN or EINTR. ok millert@ bluhm@
* move to stravis so doug@ will stop laughing at my misuse of strnvis.dlg2014-11-191-3/+6
| | | | ok doug@ millert@
* Always call freeaddrinfo after getaddrinfo.tobias2014-08-131-1/+2
| | | | ok dlg@
* use errc instead of juggling errno values in tftpd_listen.dlg2014-08-131-6/+6
|
* setsockopt sets errno on failure, so we can use err instead of errx whendlg2014-08-131-3/+3
| | | | handling the error.
* th_code is in network byte orderdlg2014-04-211-2/+2
|
* unsigned char for ctypederaadt2013-11-261-3/+3
|
* ensure there are prototypesderaadt2013-11-121-2/+6
|
* when handling puts from a client (ie, tftpd is writing a file todlg2013-08-131-1/+3
| | | | | | | | | | | | | | | | | | | disk), we maintain the client state after we've finished writing the file in case the client loses our ack of the last write. unfortunately we didnt close the file we'd just written when we knew it was finished, but only after we clean up the client state after that wait. because we use FILE stuff to write the file out, its likely some io flushed to disk until we finish that wait and close the file as part of cleaning up the client state. if something is coordinating a bunch of uploads and expects the file to be there after the client is happy its there, this can be "not good". this closes the file after we know its finished before proceeding to hang to handle lost acks to the client. found by and ok henning@
* use the standardized names instead of S_IREAD and S_IWRITEderaadt2013-06-011-3/+3
| | | | ok guenther dtucker
* getpwnam doesnt set errno on failure, so use errx, not err, to say itdlg2013-05-071-2/+2
| | | | failed.
* i missed the bit of maxime villards diff that took the client_free out ofdlg2013-03-171-7/+6
| | | | | | oack on error. his fix is better, so this marges all of it in.
* let oack use the full buffer space to build its packet, not just the sizedlg2013-03-151-2/+2
| | | | | | | negotiated for data tranfsers. this lets people negotiate 2 byte transfers with other options too if they want. im looking at you Maxime Villard.
* "correct" the order of calloc arguments.dlg2013-03-151-3/+3
|
* fix up some lwarn()s that should be lwarnx()sdlg2013-03-151-3/+3
|
* fix a huge bug in tftpd.dlg2013-03-151-10/+11
| | | | | | | | | | there was a double free if an option ack failed. if oack fails, the client gets freed, then the oack caller tries to free the options which were just freed. found by Maxime Villard who provided a fix. unfortunately his fix still had a double free but it was pretty close. ok MALLOC_OPTIONS=S
* Define empty CDIAGFLAGS for programs that use Werror.haesbaert2012-09-121-1/+2
| | | | | | Makes "make build" build with WARNINGS=Yes on amd64. ok espie
* zap trailing whitespace; no binary changegsoares2012-07-131-7/+7
| | | | ok dlg
* fix the last outstanding functionality difference i could find betweendlg2012-07-101-2/+64
| | | | | | | | libexec and usr.sbin tftpd. libexec waitied around after finishing a wrq in case our ack for the last write from a client got lost. this does the same dance, or an arguably better version of it compared to libexec tftpd.
* libexec/tftpd handled the case where we'd get an ack for the previousdlg2012-07-101-19/+89
| | | | | | | | | | | | | | | | | | block by flushing the data on the socket and waiting for a retransmit by timeout to occur. my stuff (usr.sbin/tftpd) had XXXs and failure in those places. this diff fixes that. this should address the problems that sthen and jcs have been having (and which i was finally able to reproduce here). it also avoids reusing the clients buffer to both send and recv frames. we recv onto the stack now so retry always sends what we originally built for the peer. tested by and ok jcs@ sthen@
* Add sys/queue.h. ok dlgnicm2012-03-151-1/+2
|
* -pedantic wasnt supposed to be commited.dlg2012-03-081-2/+2
| | | | reported by steve andre
* dont mix code and declarations.dlg2012-03-072-5/+5
|
* tweak the description of -r further;jmc2012-03-041-5/+4
|
* document what tftpd expects when talking to the rewrite socket.dlg2012-03-041-2/+11
| | | | with help from jmc@
* tweaks;jmc2012-03-022-13/+9
|
* CFLAGS+= -Wall -Werror and the resulting cleanupdlg2012-03-022-11/+9
|