More tftp fixes
This commit is contained in:
parent
4eec2fbeeb
commit
eafbf90d15
1 changed files with 4 additions and 2 deletions
6
tftp.c
6
tftp.c
|
@ -298,7 +298,7 @@ void sock_perror(const char *msg)
|
||||||
|
|
||||||
inline bool tftp_is_valid_filename(const char *filename)
|
inline bool tftp_is_valid_filename(const char *filename)
|
||||||
{
|
{
|
||||||
return strlen(filename) <= 500 && is_netascii(filename);
|
return strlen(filename) <= 255 && is_netascii(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tftp_put(struct nmrpd_args *args)
|
int tftp_put(struct nmrpd_args *args)
|
||||||
|
@ -396,7 +396,9 @@ int tftp_put(struct nmrpd_args *args)
|
||||||
|
|
||||||
if (timeouts || ackblock == block) {
|
if (timeouts || ackblock == block) {
|
||||||
if (!timeouts) {
|
if (!timeouts) {
|
||||||
|
// TODO: set block to 1 if ++block == 0 ?
|
||||||
++block;
|
++block;
|
||||||
|
|
||||||
pkt_mknum(tx, DATA);
|
pkt_mknum(tx, DATA);
|
||||||
pkt_mknum(tx + 2, block);
|
pkt_mknum(tx + 2, block);
|
||||||
len = read(fd, tx + 4, blksize);
|
len = read(fd, tx + 4, blksize);
|
||||||
|
@ -440,7 +442,7 @@ int tftp_put(struct nmrpd_args *args)
|
||||||
} else if (block) {
|
} else if (block) {
|
||||||
fprintf(stderr, "Timeout while waiting for ACK(%d).\n", block);
|
fprintf(stderr, "Timeout while waiting for ACK(%d).\n", block);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Timeout while waiting for initial reply.\n");
|
fprintf(stderr, "Timeout while waiting for ACK(0)/OACK.\n");
|
||||||
}
|
}
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
Loading…
Add table
Reference in a new issue