Netboot Mailing List (by thread)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A patch for "contrib/tftp"




#Include <hallo.h>




As i need "some more" filters (>500), i added a paramter for the
contrib/tftp to accept a whole directory of filter-scripts.


- begin -
diff -Nur etherboot-4.6.1-vanilla/contrib/tftp/tftpd.8 etherboot-4.6.1-patched/contrib/tftp/tftpd.8
--- etherboot-4.6.1-vanilla/contrib/tftp/tftpd.8	Tue Apr 25 12:22:07 2000
+++ etherboot-4.6.1-patched/contrib/tftp/tftpd.8	Mon May 22 23:50:31 2000
@@ -27,7 +27,9 @@
 .SM \-d
 ] [
 .SM \-r
-<filter> ]
+<filter> ] [
+.SM \-w
+<wrapperdir> ]
 .SH DESCRIPTION
 .I Tftpd
 is a server which supports the DARPA Trivial File Transfer
@@ -71,5 +73,10 @@
 a client tries to download this file, the filter will be started and
 its output is send to the client. An arbitrary amount of these
 filters can be specified.
+.TP
+.B \-w
+Pathname of a directory of files that are considered to be filter programs. 
+Whenever a client tries to download one of this files, the filter will be 
+started and its output is send to the client.
 .SH "SEE ALSO"
 tftp(1), inetd(8)
diff -Nur etherboot-4.6.1-vanilla/contrib/tftp/tftpd.c etherboot-4.6.1-patched/contrib/tftp/tftpd.c
--- etherboot-4.6.1-vanilla/contrib/tftp/tftpd.c	Tue Apr 25 12:22:12 2000
+++ etherboot-4.6.1-patched/contrib/tftp/tftpd.c	Mon May 22 23:46:54 2000
@@ -81,6 +81,7 @@
 int	fromlen;
 
 char	*rootdir = NULL;
+char	*wrapperdir = NULL;
 int	debug = 0;
 
 struct filters {
@@ -100,7 +101,7 @@
 
 	openlog(argv[0], LOG_PID, LOG_DAEMON);
 
-	while ((n = getopt(argc, argv, "c:dr:")) >= 0) {
+	while ((n = getopt(argc, argv, "c:dr:w:")) >= 0) {
 		switch (n) {
 		case 'c':
 			if (rootdir)
@@ -119,10 +120,15 @@
 			strcpy(fp->fname, optarg);
 			filters   = fp;
 			break; }
+		case 'w':
+			if (wrapperdir)
+				goto usage;
+			wrapperdir = optarg;
+			break;
 		default:
 		usage:
 			syslog(LOG_ERR, "Usage: %s [-c chroot] "
-			       "[-r readfilter] [-d]\n",
+			       "[-r readfilter] [-d] [-w wrapperdir]\n",
 			       argv[0]);
 			exit(1);
 		}
@@ -430,6 +436,18 @@
 				isfilter = 1;
 				return (0);
 			}
+		}
+		if (strncmp (wrapperdir,filename,strlen(wrapperdir)) == 0) {
+		  if (debug)
+		    syslog(LOG_INFO, "Opening input "
+			   "filter: %s\n", filename);
+		  if ((file = popen(filename, "r")) == NULL) {
+		    syslog(LOG_ERR, "Failed to open input "
+			   "filter\n");
+		    return (EACCESS); }
+		  fd = fileno(file);
+		  isfilter = 1;
+		  return (0);
 		}
 	}
 				       
- end -




Bis denn

-- 
Real Programmers consider "what you see is what you get" to be just as 
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated, 
cryptic, powerful, unforgiving, dangerous.


===========================================================================
This Mail was sent to netboot mailing list by:
Matthias Schniedermeyer <ms@citd.de>
To get help about this list, send a mail with 'help' as the only string in
it's body to majordomo@baghira.han.de. If you have problems with this list,
send a mail to netboot-owner@baghira.han.de.



For requests or suggestions regarding this mailing list archive please write to netboot@gkminix.han.de.