Handle hostnames with upper-case letters
[webmin.git] / vgetty / listen.cgi
1 #!/usr/local/bin/perl
2 # listen.cgi
3 # Convert an RMD file to WAV format
4
5 require './vgetty-lib.pl';
6 &ReadParse();
7 @conf = &get_config();
8 $dir = $in{'mode'} ? &messages_dir(\@conf) : &receive_dir(\@conf);
9 $in{'file'} =~ /\.\./ && &error($text{'listen_efile'});
10 $path = "$dir/$in{'file'}";
11 -r $path || &error($text{'listen_epath'});
12 print "Content-type: audio/wav\n\n";
13 $esc = quotemeta($path);
14 open(OUT, "rmdtopvf $esc 2>/dev/null | pvftowav 2>/dev/null |");
15 while(read(OUT, $buf, 1024)) {
16         print $buf;
17         }
18 close(OUT);
19