|
[ProFTPD-committers] CVS:
proftpd/tests/t/lib/ProFTPD/Tests/Commands MLSD.pm, 1.3, 1.4
From: TJ Saunders <castaglia@us...> - 2009-03-16 16:47
|
Update of /cvsroot/proftp/proftpd/tests/t/lib/ProFTPD/Tests/Commands
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21434/tests/t/lib/ProFTPD/Tests/Commands
Modified Files:
MLSD.pm
Log Message:
The MLSD command, as per RFC, does not support glob characters. However,
this does not mean that we should error out on an MLSD command which does
contain glob characters; there could be a valid directory with such
characters in the path.
Index: MLSD.pm
===================================================================
RCS file: /cvsroot/proftp/proftpd/tests/t/lib/ProFTPD/Tests/Commands/MLSD.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MLSD.pm 2 Mar 2009 23:48:07 -0000 1.3
+++ MLSD.pm 16 Mar 2009 16:47:32 -0000 1.4
@@ -41,7 +41,7 @@
test_class => [qw(forking)],
},
- mlsd_fails_glob => {
+ mlsd_ok_glob => {
order => ++$order,
test_class => [qw(forking)],
},
@@ -759,7 +759,7 @@
unlink($log_file);
}
-sub mlsd_fails_glob {
+sub mlsd_ok_glob {
my $self = shift;
my $tmpdir = $self->{tmpdir};
@@ -778,6 +778,9 @@
my $uid = 500;
my $gid = 500;
+ my $test_dir = File::Spec->rel2abs("$tmpdir/?foo*");
+ mkpath($test_dir);
+
# Make sure that, if we're running as root, that the home directory has
# permissions/privs set for the account we create
if ($< == 0) {
@@ -830,9 +833,10 @@
$client->login($user, $passwd);
- my $conn = $client->mlsd_raw("*.conf");
- if ($conn) {
- die("MLSD succeeded unexpectedly");
+ my $conn = $client->mlsd('?foo*');
+ unless ($conn) {
+ die("MLSD failed unexpectedly: " . $client->response_code() . " " .
+ $client->response_msg());
}
my $resp_code = $client->response_code();
@@ -840,11 +844,11 @@
my $expected;
- $expected = 550;
+ $expected = 226;
$self->assert($expected == $resp_code,
test_msg("Expected $expected, got $resp_code"));
- $expected = "Unable to handle command";
+ $expected = "Transfer complete";
$self->assert($expected eq $resp_msg,
test_msg("Expected '$expected', got '$resp_msg'"));
};
@@ -1094,123 +1098,6 @@
unlink($log_file);
}
-sub mlsd_fails_enoent_glob {
- my $self = shift;
- my $tmpdir = $self->{tmpdir};
-
- my $config_file = "$tmpdir/cmds.conf";
- my $pid_file = File::Spec->rel2abs("$tmpdir/cmds.pid");
- my $scoreboard_file = File::Spec->rel2abs("$tmpdir/cmds.scoreboard");
-
- my $log_file = File::Spec->rel2abs('tests.log');
-
- my $auth_user_file = File::Spec->rel2abs("$tmpdir/cmds.passwd");
- my $auth_group_file = File::Spec->rel2abs("$tmpdir/cmds.group");
-
- my $user = 'proftpd';
- my $passwd = 'test';
- my $home_dir = File::Spec->rel2abs($tmpdir);
- my $uid = 500;
- my $gid = 500;
-
- # Make sure that, if we're running as root, that the home directory has
- # permissions/privs set for the account we create
- if ($< == 0) {
- unless (chmod(0755, $home_dir)) {
- die("Can't set perms on $home_dir to 0755: $!");
- }
-
- unless (chown($uid, $gid, $home_dir)) {
- die("Can't set owner of $home_dir to $uid/$gid: $!");
- }
- }
-
- auth_user_write($auth_user_file, $user, $passwd, $uid, $gid, $home_dir,
- '/bin/bash');
- auth_group_write($auth_group_file, 'ftpd', $gid, $user);
-
- my $config = {
- PidFile => $pid_file,
- ScoreboardFile => $scoreboard_file,
- SystemLog => $log_file,
-
- AuthUserFile => $auth_user_file,
- AuthGroupFile => $auth_group_file,
-
- IfModules => {
- 'mod_delay.c' => {
- DelayEngine => 'off',
- },
- },
- };
-
- my ($port, $config_user, $config_group) = config_write($config_file, $config);
-
- # Open pipes, for use between the parent and child processes. Specifically,
- # the child will indicate when it's done with its test by writing a message
- # to the parent.
- my ($rfh, $wfh);
- unless (pipe($rfh, $wfh)) {
- die("Can't open pipe: $!");
- }
-
- my $ex;
-
- # Fork child
- $self->handle_sigchld();
- defined(my $pid = fork()) or die("Can't fork: $!");
- if ($pid) {
- eval {
- my $client = ProFTPD::TestSuite::FTP->new('127.0.0.1', $port);
-
- $client->login($user, $passwd);
- $client->port();
-
- my $test_glob = '*foo';
-
- my ($resp_code, $resp_msg);
- ($resp_code, $resp_msg) = $client->mlsd($test_glob);
-
- my $expected;
-
- $expected = 226;
- $self->assert($expected == $resp_code,
- test_msg("Expected $expected, got $resp_code"));
-
- $expected = "Transfer complete";
- $self->assert($expected eq $resp_msg,
- test_msg("Expected '$expected', got '$resp_msg'"));
- };
-
- if ($@) {
- $ex = $@;
- }
-
- $wfh->print("done\n");
- $wfh->flush();
-
- } else {
- eval { server_wait($config_file, $rfh) };
- if ($@) {
- warn($@);
- exit 1;
- }
-
- exit 0;
- }
-
- # Stop server
- server_stop($pid_file);
-
- $self->assert_child_ok($pid);
-
- if ($ex) {
- die($ex);
- }
-
- unlink($log_file);
-}
-
sub mlsd_fails_eperm {
my $self = shift;
my $tmpdir = $self->{tmpdir};
|
| Thread | Author | Date |
|---|---|---|
| [ProFTPD-committers] CVS: proftpd/tests/t/lib/ProFTPD/Tests/Commands MLSD.pm, 1.3, 1.4 | TJ Saunders <castaglia@us...> |