mds/net-ftp/atftp/files/atftp-0.7-password.patch
2009-03-19 18:09:00 +00:00

95 lines
3.8 KiB
Diff

diff -Naur atftp-0.7.orig/tftp.c atftp-0.7/tftp.c
--- atftp-0.7.orig/tftp.c 2004-03-15 18:55:56.000000000 -0500
+++ atftp-0.7/tftp.c 2005-08-29 21:40:06.000000000 -0400
@@ -525,6 +525,10 @@
fprintf(stderr, " multicast: enabled\n");
else
fprintf(stderr, " multicast: disabled\n");
+ if (data.tftp_options[OPT_PASSWORD].specified)
+ fprintf(stderr, " password: enabled\n");
+ else
+ fprintf(stderr, " password: disabled\n");
return ERR;
}
/* if disabling an option */
@@ -971,6 +975,7 @@
{ "put", 0, NULL, 'p'},
{ "local-file", 1, NULL, 'l'},
{ "remote-file", 1, NULL, 'r'},
+ { "password", 1, NULL, 'P'},
{ "tftp-timeout", 1, NULL, 'T'},
{ "mode", 1, NULL, 'M'},
{ "option", 1, NULL, 'O'},
@@ -993,7 +998,7 @@
};
/* Support old argument until 0.8 */
- while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm",
+ while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smP:",
options, &option_index)) != EOF)
{
switch (c)
@@ -1028,6 +1033,11 @@
else
action = PUT;
break;
+ case 'P':
+ snprintf(string, sizeof(string), "option password %s", optarg);
+ make_arg(string, &ac, &av);
+ process_cmd(ac, av);
+ break;
case 'l':
interactive = 0;
Strncpy(local_file, optarg, MAXLEN);
@@ -1169,6 +1179,7 @@
" -p, --put : put file\n"
" -l, --local-file <file> : local file name\n"
" -r, --remote-file <file> : remote file name\n"
+ " -P, --password <password>: specify password (Linksys ext.)\n"
" --tftp-timeout <value> : delay before retransmission, client side\n"
#if 0
" t, --timeout <value> : delay before retransmission, "
diff -Naur atftp-0.7.orig/tftp_def.c atftp-0.7/tftp_def.c
--- atftp-0.7.orig/tftp_def.c 2004-02-12 22:16:09.000000000 -0500
+++ atftp-0.7/tftp_def.c 2005-08-29 21:36:57.000000000 -0400
@@ -37,6 +37,7 @@
{ "timeout", "5", 0, 1 }, /* 2348, 2349, 2090. */
{ "blksize", "512", 0, 1 }, /* This is the default option */
{ "multicast", "", 0, 1 }, /* structure */
+ { "password", "", 0, 1}, /* password */
{ "", "", 0, 0}
};
diff -Naur atftp-0.7.orig/tftp_def.h atftp-0.7/tftp_def.h
--- atftp-0.7.orig/tftp_def.h 2004-02-12 22:16:09.000000000 -0500
+++ atftp-0.7/tftp_def.h 2005-08-29 20:16:27.000000000 -0400
@@ -40,6 +40,7 @@
#define OPT_TIMEOUT 3
#define OPT_BLKSIZE 4
#define OPT_MULTICAST 5
+#define OPT_PASSWORD 6
#define OPT_NUMBER 7
#define OPT_SIZE 12
diff -Naur atftp-0.7.orig/tftp_io.c atftp-0.7/tftp_io.c
--- atftp-0.7.orig/tftp_io.c 2004-02-18 20:30:00.000000000 -0500
+++ atftp-0.7/tftp_io.c 2005-08-29 22:05:11.000000000 -0400
@@ -70,10 +70,13 @@
break;
if (tftp_options[i].enabled && tftp_options[i].specified)
{
- Strncpy(data_buffer + buf_index, tftp_options[i].option,
- data_buffer_size - buf_index);
- buf_index += strlen(tftp_options[i].option);
- buf_index++;
+ if (i != OPT_PASSWORD)
+ {
+ Strncpy(data_buffer + buf_index, tftp_options[i].option,
+ data_buffer_size - buf_index);
+ buf_index += strlen(tftp_options[i].option);
+ buf_index++;
+ }
Strncpy(data_buffer + buf_index, tftp_options[i].value,
data_buffer_size - buf_index);
buf_index += strlen(tftp_options[i].value);