wok annotate busybox/stuff/busybox-1.17.3-ris.u @ rev 6674

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