wok diff busybox/stuff/busybox-1.17.0-ris.u @ rev 5773

Up busybox (1.17.0)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jul 06 15:09:01 2010 +0200 (2010-07-06)
parents
children 1ed09465c0ae
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.17.0-ris.u	Tue Jul 06 15:09:01 2010 +0200
     1.3 @@ -0,0 +1,97 @@
     1.4 +--- busybox-1.17.0/networking/Config.src
     1.5 ++++ busybox-1.17.0/networking/Config.src
     1.6 +@@ -841,6 +841,15 @@
     1.7 + comment "Common options for tftp/tftpd"
     1.8 + 	depends on TFTP || TFTPD
     1.9 + 
    1.10 ++config FEATURE_TFTPD_RIS
    1.11 ++	bool "Enable \"RIS\" support"
    1.12 ++	default y
    1.13 ++	depends on TFTPD
    1.14 ++	help
    1.15 ++	  Add support for the Remote Installation Service. This allows
    1.16 ++	  a client to get files starting with \ without respecting case.
    1.17 ++	  Each \ will be replaced by a /.
    1.18 ++
    1.19 + config FEATURE_TFTP_GET
    1.20 + 	bool "Enable 'tftp get' and/or tftpd upload code"
    1.21 + 	default y
    1.22 +
    1.23 +--- busybox-1.17.0/networking/tftp.c
    1.24 ++++ busybox-1.17.0/networking/tftp.c
    1.25 +@@ -656,6 +656,63 @@
    1.26 + #undef remote_file
    1.27 + }
    1.28 + 
    1.29 ++#if ENABLE_FEATURE_TFTPD_RIS
    1.30 ++#include <dirent.h>
    1.31 ++
    1.32 ++int lookup_entry(const char *comp, char *dest);
    1.33 ++void lookup_file(char *filename);
    1.34 ++
    1.35 ++int lookup_entry(const char *comp, char *dest)
    1.36 ++{
    1.37 ++	DIR *dirp;
    1.38 ++	struct dirent *dptr;
    1.39 ++	if (!dest) return 0;
    1.40 ++	dirp = opendir(dest[0] ? dest : ".");
    1.41 ++	while ((dptr = readdir(dirp))) {
    1.42 ++		if (!strcasecmp(dptr->d_name, comp)) {
    1.43 ++			if (dest[0]) strcat(dest, "/");
    1.44 ++			strcat(dest, dptr->d_name);
    1.45 ++			closedir(dirp);
    1.46 ++			return 1;
    1.47 ++		}
    1.48 ++	}
    1.49 ++	closedir(dirp);
    1.50 ++	return 0;
    1.51 ++}
    1.52 ++
    1.53 ++void lookup_file(char *filename)
    1.54 ++{
    1.55 ++	int found = 0;
    1.56 ++	int len = 0;
    1.57 ++	char dest[1024];
    1.58 ++	char comp[1024];
    1.59 ++	char *check = filename;
    1.60 ++	char *seek = NULL;
    1.61 ++
    1.62 ++	dest[0] = 0;
    1.63 ++	check++;
    1.64 ++	while (*check) {
    1.65 ++		seek = strchr(check, '\\');
    1.66 ++		if (!seek) {
    1.67 ++			if ((*check) && (lookup_entry(check, dest)))
    1.68 ++				found = 1;
    1.69 ++			break;
    1.70 ++		}
    1.71 ++		len = seek - check;
    1.72 ++		memcpy(comp, check, len);
    1.73 ++		comp[len]=0;
    1.74 ++		if (!lookup_entry(comp, dest))
    1.75 ++			break;
    1.76 ++		check += len + 1;
    1.77 ++	}
    1.78 ++
    1.79 ++	if (found) {
    1.80 ++		filename[0] = 0;
    1.81 ++		strcat(filename, dest);
    1.82 ++	}
    1.83 ++}
    1.84 ++#endif
    1.85 ++
    1.86 + #if ENABLE_TFTP
    1.87 + 
    1.88 + int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    1.89 +@@ -785,6 +842,11 @@
    1.90 + 		goto err;
    1.91 + 	}
    1.92 + 	local_file = block_buf + 2;
    1.93 ++#if ENABLE_FEATURE_TFTPD_RIS
    1.94 ++	if (local_file[0] == '\\') {
    1.95 ++		lookup_file(local_file);
    1.96 ++	}
    1.97 ++#endif
    1.98 + 	if (local_file[0] == '.' || strstr(local_file, "/.")) {
    1.99 + 		error_msg = "dot in file name";
   1.100 + 		goto err;