[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL] tftp: fake support for netascii protocol
From: |
Samuel Thibault |
Subject: |
[Qemu-devel] [PULL] tftp: fake support for netascii protocol |
Date: |
Fri, 18 Nov 2016 18:51:28 +0100 |
From: Vincent Bernat <address@hidden>
Some network equipments are requesting a file using the netascii
protocol and this is not configurable. Currently, qemu's tftpd only
supports the octet protocol. This commit makes it accept the netascii
protocol as well but do not perform the requested transformation (LF ->
CR,LF) as it would be far more complex. The current implementation is
good enough. A user has always the choice to preencode the served file
correctly.
Signed-off-by: Vincent Bernat <address@hidden>
Signed-off-by: Samuel Thibault <address@hidden>
---
slirp/tftp.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/slirp/tftp.c b/slirp/tftp.c
index c185906..ab1c05d 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -326,13 +326,15 @@ static void tftp_handle_rrq(Slirp *slirp, struct
sockaddr_storage *srcsas,
return;
}
- if (strcasecmp(&tp->x.tp_buf[k], "octet") != 0) {
+ if (strcasecmp(&tp->x.tp_buf[k], "octet") == 0) {
+ k += 6;
+ } else if (strcasecmp(&tp->x.tp_buf[k], "netascii") == 0) {
+ k += 9;
+ } else {
tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
return;
}
- k += 6; /* skipping octet */
-
/* do sanity checks on the filename */
if (!strncmp(req_fname, "../", 3) ||
req_fname[strlen(req_fname) - 1] == '/' ||
--
2.10.2
- [Qemu-devel] [PULL] tftp: fake support for netascii protocol, Samuel Thibault, 2016/11/18
- [Qemu-devel] [PULL] tftp: fake support for netascii protocol,
Samuel Thibault <=
- Re: [Qemu-devel] [PULL] tftp: fake support for netascii protocol, no-reply, 2016/11/18
- Re: [Qemu-devel] [PULL] tftp: fake support for netascii protocol, Thomas Huth, 2016/11/19
- Re: [Qemu-devel] [PULL] tftp: fake support for netascii protocol, Vincent Bernat, 2016/11/19
- Re: [Qemu-devel] [PULL] tftp: fake support for netascii protocol, Samuel Thibault, 2016/11/19
- [Qemu-devel] [v2] tftp: fake support for netascii protocol, Vincent Bernat, 2016/11/20
- Re: [Qemu-devel] [v2] tftp: fake support for netascii protocol, no-reply, 2016/11/20
- Re: [Qemu-devel] [v2] tftp: fake support for netascii protocol, no-reply, 2016/11/20
- Re: [Qemu-devel] [v2] tftp: fake support for netascii protocol, Thomas Huth, 2016/11/21
- Re: [Qemu-devel] [v2] tftp: fake support for netascii protocol, Stefan Hajnoczi, 2016/11/21
- Re: [Qemu-devel] [v2] tftp: fake support for netascii protocol, Samuel Thibault, 2016/11/21