summaryrefslogtreecommitdiff
blob: 26b59085dde551caa94359a643cbe7fc3a12fdb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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);