wok diff busybox/stuff/busybox-1.12.0-ris.u @ rev 5012

rm rpm in for loop to save RAM (thanks Eric)
author Rohit Joshi <jozee@slitaz.org>
date Sun Feb 28 19:50:05 2010 +0000 (2010-02-28)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.12.0-ris.u	Sun Feb 28 19:50:05 2010 +0000
     1.3 @@ -0,0 +1,97 @@
     1.4 +--- busybox-1.12.0/networking/tftp.c
     1.5 ++++ busybox-1.12.0/networking/tftp.c
     1.6 +@@ -552,6 +552,63 @@
     1.7 + #undef tsize
     1.8 + }
     1.9 + 
    1.10 ++#if ENABLE_FEATURE_TFTPD_RIS
    1.11 ++#include <dirent.h>
    1.12 ++
    1.13 ++int lookup_entry(const char *comp, char *dest);
    1.14 ++void lookup_file(char *filename);
    1.15 ++
    1.16 ++int lookup_entry(const char *comp, char *dest)
    1.17 ++{
    1.18 ++	DIR *dirp;
    1.19 ++	struct dirent *dptr;
    1.20 ++	if (!dest) return 0;
    1.21 ++	dirp = opendir(dest[0] ? dest : ".");
    1.22 ++	while ((dptr = readdir(dirp))) {
    1.23 ++		if (!strcasecmp(dptr->d_name, comp)) {
    1.24 ++			if (dest[0]) strcat(dest, "/");
    1.25 ++			strcat(dest, dptr->d_name);
    1.26 ++			closedir(dirp);
    1.27 ++			return 1;
    1.28 ++		}
    1.29 ++	}
    1.30 ++	closedir(dirp);
    1.31 ++	return 0;
    1.32 ++}
    1.33 ++
    1.34 ++void lookup_file(char *filename)
    1.35 ++{
    1.36 ++	int found = 0;
    1.37 ++	int len = 0;
    1.38 ++	char dest[1024];
    1.39 ++	char comp[1024];
    1.40 ++	char *check = filename;
    1.41 ++	char *seek = NULL;
    1.42 ++
    1.43 ++	dest[0] = 0;
    1.44 ++	check++;
    1.45 ++	while (*check) {
    1.46 ++		seek = strchr(check, '\\');
    1.47 ++		if (!seek) {
    1.48 ++			if ((*check) && (lookup_entry(check, dest)))
    1.49 ++				found = 1;
    1.50 ++			break;
    1.51 ++		}
    1.52 ++		len = seek - check;
    1.53 ++		memcpy(comp, check, len);
    1.54 ++		comp[len]=0;
    1.55 ++		if (!lookup_entry(comp, dest))
    1.56 ++			break;
    1.57 ++		check += len + 1;
    1.58 ++	}
    1.59 ++
    1.60 ++	if (found) {
    1.61 ++		filename[0] = 0;
    1.62 ++		strcat(filename, dest);
    1.63 ++	}
    1.64 ++}
    1.65 ++#endif
    1.66 ++
    1.67 + #if ENABLE_TFTP
    1.68 + 
    1.69 + int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    1.70 +@@ -680,6 +737,11 @@
    1.71 + 		goto err;
    1.72 + 	}
    1.73 + 	local_file = block_buf + 2;
    1.74 ++#if ENABLE_FEATURE_TFTPD_RIS
    1.75 ++	if (local_file[0] == '\\') {
    1.76 ++		lookup_file(local_file);
    1.77 ++	}
    1.78 ++#endif
    1.79 + 	if (local_file[0] == '.' || strstr(local_file, "/.")) {
    1.80 + 		error_msg = "dot in file name";
    1.81 + 		goto err;
    1.82 +
    1.83 +--- busybox-1.12.0/networking/Config.in
    1.84 ++++ busybox-1.12.0/networking/Config.in
    1.85 +@@ -794,6 +794,15 @@
    1.86 + 	  In other words: it should be run from inetd in nowait mode,
    1.87 + 	  or from udpsvd. Example: "udpsvd -E 0 69 tftpd DIR"
    1.88 + 
    1.89 ++config FEATURE_TFTPD_RIS
    1.90 ++	bool "Enable \"RIS\" support"
    1.91 ++	default y
    1.92 ++	depends on TFTPD
    1.93 ++	help
    1.94 ++	  Add support for the Remote Installation Service. This allows
    1.95 ++	  a client to get files starting with \ without respecting case.
    1.96 ++	  Each \ will be replaced by a /.
    1.97 ++
    1.98 + config FEATURE_TFTP_GET
    1.99 + 	bool "Enable \"get\" command"
   1.100 + 	default y