File: README.PCRE

package info (click to toggle)
atftp 0.7.dfsg-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,144 kB
  • ctags: 538
  • sloc: ansic: 6,384; sh: 3,892; makefile: 81
file content (28 lines) | stat: -rw-r--r-- 1,347 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Here is an attempt at using PCRE (Perl Compatible Regular Expressions)
with a TFTP server. The first question on your mind is most likely "Why in
blazes would anyone want to use a regular expression with a TFTP server?"
Imagine you have a network of machines that all download an identical
config file, but each machine requests its file as <serialno>.conf where
<serialno> is the serial number of the machine. This set up is useful when
you wish each machine to have custom configs. When you which to have
identical configurations on each box this is annoying. The solution is to
map all requested files ending in .conf to one master.conf file via a
regex. The exact expression I use is

^\w*\.conf$     master.conf

The left hand side is the expression to match, the right hand side is the
substitution. This is equivalent to perls s/// statement. One or more of these
expressions can be stored in a file (one per line) and feed to atftpd via a
--pcre <filename> switch on the command line. For example,

./atftpd --daemon --pcre ./test/pcre_pattern.txt /tftpboot/

Also included is a test program using the --pcre-test <filename> option. You
can interactively (or via redirection) feed file name to atftpd and look at
the substitution to verify your rules. for example,

./atftpd --pcre-test ./test/pcre_pattern.txt

Jeff.
(jeffm@ghostgun.com)