--- tftpd/src/srv.c 2014/02/17 14:28:29 1.2 +++ tftpd/src/srv.c 2014/02/18 12:46:39 1.3 @@ -116,13 +116,22 @@ txAck(sched_task_t *task) taskExit(task, NULL); } +static int +getOpts(const char *opts, int rlen) +{ + if (!opts) + return -1; + + return 0; +} + static void * RQ(sched_task_t *task) { rpack_t *pkt = TASK_DATA(task); struct tftp_hdr *tftp = (struct tftp_hdr*) RPACK_BUF(pkt); int len, rlen = TASK_DATLEN(task) - 2; - char *str; + char *str, *opts; u_short code = 0; ETRACE(); @@ -135,7 +144,7 @@ RQ(sched_task_t *task) rlen -= len; strlcpy(cli.file, (char*) tftp->tftp_data, sizeof cli.file); } - len = str_getString((const u_char*) str, rlen, NULL); + len = str_getString((const u_char*) str, rlen, &opts); if (len == -1) goto end; else { @@ -153,6 +162,10 @@ RQ(sched_task_t *task) goto end; } } + + /* tftp extended options */ + if (!RPACK_ISEND(pkt) && !getOpts(opts, rlen)) + cli.opts = 42; /* we have options */ cli.opc = ntohs(tftp->tftp_opc); switch (cli.opc) {