From 9537580ba20cec5180d06c4ab065503fef6a354e Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 23 Aug 2007 23:24:39 +0000 Subject: Allow ftp server alternate replies to contain backslash-escaped control characters. --- tests/FILEFORMAT | 3 ++- tests/ftpserver.pl | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT index b22ee8421..2a3a16eaf 100644 --- a/tests/FILEFORMAT +++ b/tests/FILEFORMAT @@ -90,7 +90,8 @@ Special-commands for the server. For FTP, these are supported: REPLY [command] [return value] [response string] - - Changes how the server responds to the [command] + - Changes how the server responds to the [command]. [response string] is + evaluated as a perl string, so it can contain embedded \r\n, for example. COUNT [command] [num] - Do the REPLY change for [command] only [num] times and then go back to the built-in approach diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 73fabcca4..e32c019bd 100644 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -677,14 +677,13 @@ my %customreply; my %customcount; my %delayreply; sub customize { - undef %customreply; - $nosave = 0; # default is to save as normal $controldelay = 0; # default is no delaying the responses $retrweirdo = 0; $retrnosize = 0; $pasvbadip = 0; $nosave = 0; + %customreply = (); %customcount = (); %delayreply = (); @@ -695,7 +694,7 @@ sub customize { while() { if($_ =~ /REPLY ([A-Z]+) (.*)/) { - $customreply{$1}=$2; + $customreply{$1}=eval "qq{$2}"; logmsg "FTPD: set custom reply for $1\n"; } if($_ =~ /COUNT ([A-Z]+) (.*)/) { -- cgit v1.2.3