wok annotate busybox/stuff/busybox-1.23-ris.u @ rev 19159
/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
| author | Aleksej Bobylev <al.bobylev@gmail.com> |
|---|---|
| date | Thu May 26 20:16:45 2016 +0300 (2016-05-26) |
| parents | |
| children |
| rev | line source |
|---|---|
| pascal@17518 | 1 Add support for the Windows Remote Installation Service |
| pascal@17518 | 2 --- busybox-1.23.0/networking/Config.src |
| pascal@17518 | 3 +++ busybox-1.23.0/networking/Config.src |
| pascal@17518 | 4 @@ -827,6 +827,15 @@ |
| pascal@17518 | 5 comment "Common options for tftp/tftpd" |
| pascal@17518 | 6 depends on TFTP || TFTPD |
| pascal@17518 | 7 |
| pascal@17518 | 8 +config FEATURE_TFTPD_RIS |
| pascal@17518 | 9 + bool "Enable \"RIS\" support" |
| pascal@17518 | 10 + default y |
| pascal@17518 | 11 + depends on TFTPD |
| pascal@17518 | 12 + help |
| pascal@17518 | 13 + Add support for the Windows Remote Installation Service. This allows |
| pascal@17518 | 14 + a client to get files starting with \ without respecting case. |
| pascal@17518 | 15 + Each \ will be replaced by a /. |
| pascal@17518 | 16 + |
| pascal@17518 | 17 config FEATURE_TFTP_GET |
| pascal@17518 | 18 bool "Enable 'tftp get' and/or tftpd upload code" |
| pascal@17518 | 19 default y |
| pascal@17518 | 20 --- busybox-1.23.0/networking/tftp.c |
| pascal@17518 | 21 +++ busybox-1.23.0/networking/tftp.c |
| pascal@17518 | 22 @@ -673,6 +673,59 @@ |
| pascal@17518 | 23 #undef remote_file |
| pascal@17518 | 24 } |
| pascal@17518 | 25 |
| pascal@17518 | 26 +#if ENABLE_FEATURE_TFTPD_RIS |
| pascal@17518 | 27 +#include <dirent.h> |
| pascal@17518 | 28 + |
| pascal@17518 | 29 +static int lookup_entry(const char *search, char *unixpath); |
| pascal@17518 | 30 +static void unixfilename(char *filename); |
| pascal@17518 | 31 + |
| pascal@17518 | 32 +// lookup search and concat real filename to unixpath |
| pascal@17518 | 33 +static int lookup_entry(const char *search, char *unixpath) |
| pascal@17518 | 34 +{ |
| pascal@17518 | 35 + int status = 0; |
| pascal@17518 | 36 + DIR *dirp = opendir(unixpath[0] ? unixpath : "."); |
| pascal@17518 | 37 + |
| pascal@17518 | 38 + if (dirp != NULL) { |
| pascal@17518 | 39 + struct dirent *entry; |
| pascal@17518 | 40 + |
| pascal@17518 | 41 + while ((entry = readdir(dirp))) { |
| pascal@17518 | 42 + if (!strcasecmp(entry->d_name, search)) { |
| pascal@17518 | 43 + if (unixpath[0]) strcat(unixpath, "/"); |
| pascal@17518 | 44 + strcat(unixpath, entry->d_name); |
| pascal@17518 | 45 + status++; |
| pascal@17518 | 46 + break; |
| pascal@17518 | 47 + } |
| pascal@17518 | 48 + } |
| pascal@17518 | 49 + closedir(dirp); |
| pascal@17518 | 50 + } |
| pascal@17518 | 51 + return status; |
| pascal@17518 | 52 +} |
| pascal@17518 | 53 + |
| pascal@17518 | 54 +// update filename with real file path found |
| pascal@17518 | 55 +static void unixfilename(char *filename) |
| pascal@17518 | 56 +{ |
| pascal@17518 | 57 + char unixpath[PATH_MAX]; |
| pascal@17518 | 58 + char *s = unixpath + 1; |
| pascal@17518 | 59 + char *check = filename + 1; |
| pascal@17518 | 60 + int len; |
| pascal@17518 | 61 + |
| pascal@17518 | 62 + for (unixpath[0] = 0; *check; len++, s += len, check += len) { |
| pascal@17518 | 63 + char *seek = strchr(check, '\\'); |
| pascal@17518 | 64 + |
| pascal@17518 | 65 + if (!seek) { // basename of filename |
| pascal@17518 | 66 + if (lookup_entry(check, unixpath)) |
| pascal@17518 | 67 + strcpy(filename, unixpath); // found |
| pascal@17518 | 68 + break; |
| pascal@17518 | 69 + } |
| pascal@17518 | 70 + len = seek - check; |
| pascal@17518 | 71 + memcpy(s, check, len); |
| pascal@17518 | 72 + s[len] = '\0'; |
| pascal@17518 | 73 + if (!lookup_entry(s, unixpath)) |
| pascal@17518 | 74 + break; // path mismatch |
| pascal@17518 | 75 + } |
| pascal@17518 | 76 +} |
| pascal@17518 | 77 +#endif |
| pascal@17518 | 78 + |
| pascal@17518 | 79 #if ENABLE_TFTP |
| pascal@17518 | 80 |
| pascal@17518 | 81 int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| pascal@17518 | 82 @@ -820,6 +873,10 @@ |
| pascal@17518 | 83 G.block_buf_tail[0] = '\0'; |
| pascal@17518 | 84 |
| pascal@17518 | 85 local_file = G.block_buf + 2; |
| pascal@17518 | 86 +#if ENABLE_FEATURE_TFTPD_RIS |
| pascal@17518 | 87 + if (local_file[0] == '\\') |
| pascal@17518 | 88 + unixfilename(local_file); |
| pascal@17518 | 89 +#endif |
| pascal@17518 | 90 if (local_file[0] == '.' || strstr(local_file, "/.")) { |
| pascal@17518 | 91 error_msg = "dot in file name"; |
| pascal@17518 | 92 goto err; |