wok annotate busybox/stuff/busybox-1.18-ris.u @ rev 8319

Removed usbip-module. Not need anymore since with have linux-usbip.
author Christopher Rogers <slaxemulator@gmail.com>
date Tue Feb 01 03:48:00 2011 +0000 (2011-02-01)
parents 0d7cf47babb3
children
rev   line source
pascal@8238 1 Add support for the Windows Remote Installation Service
pascal@8238 2 --- busybox-1.17.1/networking/Config.src
pascal@8238 3 +++ busybox-1.17.1/networking/Config.src
pascal@8238 4 @@ -863,6 +863,15 @@
pascal@8238 5 comment "Common options for tftp/tftpd"
pascal@8238 6 depends on TFTP || TFTPD
pascal@8238 7
pascal@8238 8 +config FEATURE_TFTPD_RIS
pascal@8238 9 + bool "Enable \"RIS\" support"
pascal@8238 10 + default y
pascal@8238 11 + depends on TFTPD
pascal@8238 12 + help
pascal@8238 13 + Add support for the Windows Remote Installation Service. This allows
pascal@8238 14 + a client to get files starting with \ without respecting case.
pascal@8238 15 + Each \ will be replaced by a /.
pascal@8238 16 +
pascal@8238 17 config FEATURE_TFTP_GET
pascal@8238 18 bool "Enable 'tftp get' and/or tftpd upload code"
pascal@8238 19 default y
pascal@8238 20
pascal@8275 21 --- busybox-1.18.2/networking/tftp.c
pascal@8275 22 +++ busybox-1.18.2/networking/tftp.c
pascal@8275 23 @@ -641,6 +641,59 @@
pascal@8238 24 #undef remote_file
pascal@8238 25 }
pascal@8238 26
pascal@8238 27 +#if ENABLE_FEATURE_TFTPD_RIS
pascal@8238 28 +#include <dirent.h>
pascal@8238 29 +
pascal@8238 30 +static int lookup_entry(const char *search, char *unixpath);
pascal@8238 31 +static void unixfilename(char *filename);
pascal@8238 32 +
pascal@8238 33 +// lookup search and concat real filename to unixpath
pascal@8238 34 +static int lookup_entry(const char *search, char *unixpath)
pascal@8238 35 +{
pascal@8238 36 + int status = 0;
pascal@8238 37 + DIR *dirp = opendir(unixpath[0] ? unixpath : ".");
pascal@8238 38 +
pascal@8238 39 + if (dirp != NULL) {
pascal@8238 40 + struct dirent *entry;
pascal@8238 41 +
pascal@8238 42 + while ((entry = readdir(dirp))) {
pascal@8238 43 + if (!strcasecmp(entry->d_name, search)) {
pascal@8238 44 + if (unixpath[0]) strcat(unixpath, "/");
pascal@8238 45 + strcat(unixpath, entry->d_name);
pascal@8238 46 + status++;
pascal@8238 47 + break;
pascal@8238 48 + }
pascal@8238 49 + }
pascal@8238 50 + closedir(dirp);
pascal@8238 51 + }
pascal@8238 52 + return status;
pascal@8238 53 +}
pascal@8238 54 +
pascal@8238 55 +// update filename with real file path found
pascal@8238 56 +static void unixfilename(char *filename)
pascal@8238 57 +{
pascal@8238 58 + char unixpath[PATH_MAX];
pascal@8238 59 + char *s = unixpath + 1;
pascal@8238 60 + char *check = filename + 1;
pascal@8238 61 + int len;
pascal@8238 62 +
pascal@8238 63 + for (unixpath[0] = 0; *check; len++, s += len, check += len) {
pascal@8238 64 + char *seek = strchr(check, '\\');
pascal@8238 65 +
pascal@8238 66 + if (!seek) { // basename of filename
pascal@8238 67 + if (lookup_entry(check, unixpath))
pascal@8238 68 + strcpy(filename, unixpath); // found
pascal@8238 69 + break;
pascal@8238 70 + }
pascal@8238 71 + len = seek - check;
pascal@8238 72 + memcpy(s, check, len);
pascal@8238 73 + s[len] = '\0';
pascal@8238 74 + if (!lookup_entry(s, unixpath))
pascal@8238 75 + break; // path mismatch
pascal@8238 76 + }
pascal@8238 77 +}
pascal@8238 78 +#endif
pascal@8238 79 +
pascal@8238 80 #if ENABLE_TFTP
pascal@8238 81
pascal@8238 82 int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
pascal@8275 83 @@ -770,6 +823,10 @@
pascal@8238 84 goto err;
pascal@8238 85 }
pascal@8238 86 local_file = block_buf + 2;
pascal@8238 87 +#if ENABLE_FEATURE_TFTPD_RIS
pascal@8238 88 + if (local_file[0] == '\\')
pascal@8238 89 + unixfilename(local_file);
pascal@8238 90 +#endif
pascal@8238 91 if (local_file[0] == '.' || strstr(local_file, "/.")) {
pascal@8238 92 error_msg = "dot in file name";
pascal@8238 93 goto err;