nlopess         Thu Nov 23 17:34:34 2006 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/ftp/tests      .cvsignore 004.phpt 005.phpt 

  Modified files:              
    /php-src/ext/ftp/tests      server.inc 
  Log:
  add two more tests (test bogus parameters and bogus server respsnes)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/server.inc?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/ftp/tests/server.inc
diff -u php-src/ext/ftp/tests/server.inc:1.1.2.1 
php-src/ext/ftp/tests/server.inc:1.1.2.2
--- php-src/ext/ftp/tests/server.inc:1.1.2.1    Sun Nov 19 18:37:28 2006
+++ php-src/ext/ftp/tests/server.inc    Thu Nov 23 17:34:34 2006
@@ -57,6 +57,10 @@
 fputs($s, "220----- PHP FTP server 0.3 -----\r\n220 Service ready\r\n");
 $buf = fread($s, 2048);
 
+
+function user_auth($buf) {
+       global $user, $s, $ssl;
+
 if (!empty($ssl)) {
        if ($buf !== "AUTH TLS\r\n") {
                fputs($s, "500 Syntax error, command unrecognized.\r\n");
@@ -118,12 +122,19 @@
                exit;
        }
 }
+}
+
+user_auth($buf);
 
 $cwd = '/';
+$num_bogus_cmds = 0;
 
 while($buf = fread($s, 4098)) {
 
-       if ($buf === "HELP\r\n") {
+       if (!empty($bogus)) {
+               fputs($s, "502 Command not implemented 
(".$num_bogus_cmds++.").\r\n");
+
+       } else if ($buf === "HELP\r\n") {
                fputs($s, "214-There is help available for the following 
commands:\r\n");
                fputs($s, " USER\r\n");
                fputs($s, " HELP\r\n");
@@ -139,6 +150,9 @@
                change_dir('..');
                fputs($s, "250 CDUP command successful.\r\n");
 
+       } elseif ($buf === "SYST\r\n") {
+               fputs($s, "215 UNIX Type: L8.\r\n");
+
        } elseif ($buf === "QUIT\r\n") {
                break;
 
@@ -146,6 +160,9 @@
                change_dir($m[1]);
                fputs($s, "250 CWD command successful.\r\n");
 
+       } else if(preg_match('/^USER /', $buf)) {
+               user_auth($buf);
+
        } else {
                fputs($s, "500 Syntax error, command unrecognized.\r\n");
                dump_and_exit($buf);

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/.cvsignore?view=markup&rev=1.1
Index: php-src/ext/ftp/tests/.cvsignore
+++ php-src/ext/ftp/tests/.cvsignore

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/004.phpt?view=markup&rev=1.1
Index: php-src/ext/ftp/tests/004.phpt
+++ php-src/ext/ftp/tests/004.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/005.phpt?view=markup&rev=1.1
Index: php-src/ext/ftp/tests/005.phpt
+++ php-src/ext/ftp/tests/005.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to