wok annotate busybox/stuff/busybox-1.18.2-ris.u @ rev 8232

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