wok view busybox/stuff/busybox-1.31-ris.u @ rev 22042

gcc83-lib-base: do NOT provide gcc-lib-base
Currently BOTH gcc-lib-base and gcc83-lib-base are installed on my SliTaz system. So, with the current (and longstanding) tazpkg limitations I can't update just gcc-lib-base: tazpkg always updates gcc83-lib-base for me instead. Now I can't run Firefox, Vivaldi, Chrome, etc. I think because of gcc-lib-base, but I not sure 1bsolutely.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Oct 22 12:55:54 2019 +0300 (2019-10-22)
parents
children
line source
1 Add support for the Windows Remote Installation Service
2 --- busybox-1.31.0/networking/tftp.c
3 +++ busybox-1.31.0/networking/tftp.c
4 @@ -46,6 +46,15 @@
5 //config: In other words: it should be run from inetd in nowait mode,
6 //config: or from udpsvd. Example: "udpsvd -E 0 69 tftpd DIR"
7 //config:
8 +//config:config FEATURE_TFTPD_RIS
9 +//config: bool "Enable \"RIS\" support"
10 +//config: default y
11 +//config: depends on TFTPD
12 +//config: help
13 +//config: Add support for the Windows Remote Installation Service. This allows
14 +//config: a client to get files starting with \ without respecting case.
15 +//config: Each \ will be replaced by a /.
16 +//config:
17 //config:config FEATURE_TFTP_GET
18 //config: bool "Enable 'tftp get' and/or tftpd upload code"
19 //config: default y
20 @@ -747,6 +756,59 @@
21 #undef remote_file
22 }
24 +#if ENABLE_FEATURE_TFTPD_RIS
25 +#include <dirent.h>
26 +
27 +static int lookup_entry(const char *search, char *unixpath);
28 +static void unixfilename(char *filename);
29 +
30 +// lookup search and concat real filename to unixpath
31 +static int lookup_entry(const char *search, char *unixpath)
32 +{
33 + int status = 0;
34 + DIR *dirp = opendir(unixpath[0] ? unixpath : ".");
35 +
36 + if (dirp != NULL) {
37 + struct dirent *entry;
38 +
39 + while ((entry = readdir(dirp))) {
40 + if (!strcasecmp(entry->d_name, search)) {
41 + if (unixpath[0]) strcat(unixpath, "/");
42 + strcat(unixpath, entry->d_name);
43 + status++;
44 + break;
45 + }
46 + }
47 + closedir(dirp);
48 + }
49 + return status;
50 +}
51 +
52 +// update filename with real file path found
53 +static void unixfilename(char *filename)
54 +{
55 + char unixpath[PATH_MAX];
56 + char *s = unixpath + 1;
57 + char *check = filename + 1;
58 + int len;
59 +
60 + for (unixpath[0] = 0; *check; len++, s += len, check += len) {
61 + char *seek = strchr(check, '\\');
62 +
63 + if (!seek) { // basename of filename
64 + if (lookup_entry(check, unixpath))
65 + strcpy(filename, unixpath); // found
66 + break;
67 + }
68 + len = seek - check;
69 + memcpy(s, check, len);
70 + s[len] = '\0';
71 + if (!lookup_entry(s, unixpath))
72 + break; // path mismatch
73 + }
74 +}
75 +#endif
76 +
77 #if ENABLE_TFTP
79 int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
80 @@ -935,6 +997,10 @@
81 G.block_buf_tail[0] = '\0';
83 local_file = G.block_buf + 2;
84 +#if ENABLE_FEATURE_TFTPD_RIS
85 + if (local_file[0] == '\\')
86 + unixfilename(local_file);
87 +#endif
88 if (local_file[0] == '.' || strstr(local_file, "/.")) {
89 error_msg = "dot in file name";
90 goto err;