wok-stable view busybox/stuff/busybox-1.12.0-ris.u @ rev 5052
fix typos: add scanner group
author | Rohit Joshi <jozee@slitaz.org> |
---|---|
date | Sat Mar 06 18:48:28 2010 +0000 (2010-03-06) |
parents | |
children |
line source
1 --- busybox-1.12.0/networking/tftp.c
2 +++ busybox-1.12.0/networking/tftp.c
3 @@ -552,6 +552,63 @@
4 #undef tsize
5 }
7 +#if ENABLE_FEATURE_TFTPD_RIS
8 +#include <dirent.h>
9 +
10 +int lookup_entry(const char *comp, char *dest);
11 +void lookup_file(char *filename);
12 +
13 +int lookup_entry(const char *comp, char *dest)
14 +{
15 + DIR *dirp;
16 + struct dirent *dptr;
17 + if (!dest) return 0;
18 + dirp = opendir(dest[0] ? dest : ".");
19 + while ((dptr = readdir(dirp))) {
20 + if (!strcasecmp(dptr->d_name, comp)) {
21 + if (dest[0]) strcat(dest, "/");
22 + strcat(dest, dptr->d_name);
23 + closedir(dirp);
24 + return 1;
25 + }
26 + }
27 + closedir(dirp);
28 + return 0;
29 +}
30 +
31 +void lookup_file(char *filename)
32 +{
33 + int found = 0;
34 + int len = 0;
35 + char dest[1024];
36 + char comp[1024];
37 + char *check = filename;
38 + char *seek = NULL;
39 +
40 + dest[0] = 0;
41 + check++;
42 + while (*check) {
43 + seek = strchr(check, '\\');
44 + if (!seek) {
45 + if ((*check) && (lookup_entry(check, dest)))
46 + found = 1;
47 + break;
48 + }
49 + len = seek - check;
50 + memcpy(comp, check, len);
51 + comp[len]=0;
52 + if (!lookup_entry(comp, dest))
53 + break;
54 + check += len + 1;
55 + }
56 +
57 + if (found) {
58 + filename[0] = 0;
59 + strcat(filename, dest);
60 + }
61 +}
62 +#endif
63 +
64 #if ENABLE_TFTP
66 int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
67 @@ -680,6 +737,11 @@
68 goto err;
69 }
70 local_file = block_buf + 2;
71 +#if ENABLE_FEATURE_TFTPD_RIS
72 + if (local_file[0] == '\\') {
73 + lookup_file(local_file);
74 + }
75 +#endif
76 if (local_file[0] == '.' || strstr(local_file, "/.")) {
77 error_msg = "dot in file name";
78 goto err;
80 --- busybox-1.12.0/networking/Config.in
81 +++ busybox-1.12.0/networking/Config.in
82 @@ -794,6 +794,15 @@
83 In other words: it should be run from inetd in nowait mode,
84 or from udpsvd. Example: "udpsvd -E 0 69 tftpd DIR"
86 +config FEATURE_TFTPD_RIS
87 + bool "Enable \"RIS\" support"
88 + default y
89 + depends on TFTPD
90 + help
91 + Add support for the Remote Installation Service. This allows
92 + a client to get files starting with \ without respecting case.
93 + Each \ will be replaced by a /.
94 +
95 config FEATURE_TFTP_GET
96 bool "Enable \"get\" command"
97 default y