[prev in list] [next in list] [prev in thread] [next in thread] 

List:       incubator-cvs
Subject:    cvs commit: incubator-ftpserver/src/java/org/apache/ftpserver FtpStatus.properties FtpConnection.jav
From:       rana_b () apache ! org
Date:       2003-04-27 16:23:19
[Download RAW message or body]

rana_b      2003/04/27 09:23:16

  Modified:    src/java/org/apache/ftpserver FtpStatus.properties
                        FtpConnection.java
  Log:
  Fixed CWD, CDUP bug
  
  Revision  Changes    Path
  1.2       +34 -22    \
incubator-ftpserver/src/java/org/apache/ftpserver/FtpStatus.properties  
  Index: FtpStatus.properties
  ===================================================================
  RCS file: /home/cvs/incubator-ftpserver/src/java/org/apache/ftpserver/FtpStatus.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FtpStatus.properties	31 Mar 2003 06:50:02 -0000	1.1
  +++ FtpStatus.properties	27 Apr 2003 16:23:16 -0000	1.2
  @@ -3,28 +3,30 @@
   # {CMD}  => FTP command
   # {ARG}  => FTP command argument
   # {n}    => the n-th element of the passed list    
  +
  +# Positive Preliminary Replies
   FtpServer.status.110=Restart marker reply
   FtpServer.status.120=Service ready in {0} minutes
   FtpServer.status.125=Data connection already open; transfer starting
   FtpServer.status.150=File status okay; about to open data connection
  -        
  +
  +
  +# Positive Completion Replies
   FtpServer.status.200=Command {CMD} okay
  -FtpServer.status.200.CWD=Directory changed to {0}
  -FtpServer.status.200.CDUP=Directory changed to {0}
  -        
  +
   FtpServer.status.202=Command {CMD} not implemented, superfluous at this site
  -        
  +
   FtpServer.status.211=System status, or system help reply
   FtpServer.status.211.STAT=FtpServer\nConnected to {0}\nConnected from {1}\nLogged \
                in as {2}\nEnd of status
  -    
  +
   FtpServer.status.212=Directory status
  -        
  +
   FtpServer.status.213=File status
   FtpServer.status.213.SIZE={0}
   FtpServer.status.213.MDTM={0}
  -        
  +
   FtpServer.status.214=The following commands are implemented.\nABOR  APPE  CDUP  \
CWD   DELE  HELP  LIST  MDTM\nMKD   MODE  NLST  NOOP  PASS  PASV  PORT  PWD\nQUIT  \
REST  RETR  RMD   RNFR  RNTO  SITE  SIZE\nSTAT  STOR  STOU  STRU  SYST  TYPE  \
                USER\nEnd of help
  -        
  +
   FtpServer.status.214.ABOR=Syntax: ABOR
   FtpServer.status.214.APPE=Syntax: APPE <sp> <pathname>
   FtpServer.status.214.CDUP=Syntax: CDUP
  @@ -53,45 +55,52 @@
   FtpServer.status.214.SYST=Syntax: SYST
   FtpServer.status.214.TYPE=Syntax: TYPE <sp> <type-code>
   FtpServer.status.214.USER=Syntax: USER <sp> <username>
  -        
  +
   FtpServer.status.214.UNKNOWN=Unknown command {0}
  -        
  -        
  +
   FtpServer.status.215=UNIX Type: FtpServer
   FtpServer.status.220=Service ready for new user
   FtpServer.status.221=Service closing control connection
   FtpServer.status.221.QUIT=Goodbye
   FtpServer.status.225=Can't open data connection
  +FtpServer.status.225.ABOR=ABOR command successful
   FtpServer.status.226=Closing data connection
   FtpServer.status.227.PASV=Entering Passive Mode ({0})
   FtpServer.status.230=User logged in, proceed
  -        
  +
   FtpServer.status.250=Requested file action okay, completed
   FtpServer.status.250.STOU=Requested file action okay, completed. Generated file: \
{0}  +FtpServer.status.250.CWD=Directory changed to {0}
  +FtpServer.status.250.CDUP=Directory changed to {0}
   
   FtpServer.status.257.MKD=\"{0}\" created
   FtpServer.status.257.PWD=\"{0}\" is current directory
   FtpServer.status.257.PWD=\"{0}\" is current directory
   FtpServer.status.257.RMD=\"{0}\" deleted
  -        
  +
  +
  +# Positive Intermediate Replies
   FtpServer.status.331=User name okay, need password for {ARG}
   FtpServer.status.331.ANONYMOUS=Guest login ok, send your complete e-mail address \
                as password
  -        
  +
   FtpServer.status.332=Need account for login
  -        
  +
   FtpServer.status.350=Requested file action pending further information
   FtpServer.status.350.REST=Restarting at {ARG}. Send STORE or RETRIEVE to initiate \
                transfer
  -        
  +
  +
  +# Transient Negative Completion Replies
   FtpServer.status.421=Service not available, closing control connection
   FtpServer.status.425=Can't open data connection
   FtpServer.status.426=Connection closed; transfer aborted
  -FtpServer.status.431.CWD=No such directory
   FtpServer.status.450=Requested file action not taken
   FtpServer.status.451=Requested action aborted. Local error in processing
   FtpServer.status.452=Requested action not taken
  -        
  +
  +
  +# Permanent Negative Completion Replies
   FtpServer.status.500=Syntax error, command {CMD} unrecognized
  -        
  +
   FtpServer.status.501=Syntax error in parameters or arguments
   FtpServer.status.501.REST=\"{ARG}\" is not a valid argument
   FtpServer.status.501.MLST=\"{ARG}\" is not a valid pathname
  @@ -103,12 +112,15 @@
   FtpServer.status.521.MKD=\"{0}\" already exists
   FtpServer.status.530=Access denied
   FtpServer.status.532=Need account for storing files
  -        
  +
   FtpServer.status.550=Requested action not taken
  +FtpServer.status.550.CDUP=No such directory
  +FtpServer.status.550.CWD=No such directory
   FtpServer.status.550.RETR=File {ARG} unavailable
   FtpServer.status.550.APPE=File {ARG} unavailable
  +FtpServer.status.550.DELE=File {ARG} unavailable
   FtpServer.status.550.SIZE=File {ARG} unavailable
   FtpServer.status.550.MDTM=File {ARG} unavailable
  -        
  +
   FtpServer.status.552=Requested file action aborted
   FtpServer.status.553=Requested action not taken
  
  
  
  1.2       +14 -8     \
incubator-ftpserver/src/java/org/apache/ftpserver/FtpConnection.java  
  Index: FtpConnection.java
  ===================================================================
  RCS file: /home/cvs/incubator-ftpserver/src/java/org/apache/ftpserver/FtpConnection.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FtpConnection.java	31 Mar 2003 06:50:02 -0000	1.1
  +++ FtpConnection.java	27 Apr 2003 16:23:16 -0000	1.2
  @@ -163,7 +163,7 @@
   
           // and abort any data connection
           mDataConnection.closeDataSocket();
  -        out.write(mFtpStatus.getResponse(226, request, mUser, null));
  +        out.write(mFtpStatus.getResponse(225, request, mUser, null));
       }
   
   
  @@ -269,11 +269,11 @@
   
           // change directory
           if(mUser.getVirtualDirectory().changeDirectory("..")) {
  -             String args[] = {mUser.getVirtualDirectory().getCurrentDirectory()};
  -            out.write(mFtpStatus.getResponse(200, request, mUser, args));
  +            String args[] = {mUser.getVirtualDirectory().getCurrentDirectory()};
  +            out.write(mFtpStatus.getResponse(250, request, mUser, args));
           }
           else {
  -            out.write(mFtpStatus.getResponse(431, request, mUser, null));
  +            out.write(mFtpStatus.getResponse(550, request, mUser, null));
           }
       }
   
  @@ -300,11 +300,11 @@
   
           // change directory
           if(mUser.getVirtualDirectory().changeDirectory(dirName)) {
  -             String args[] = {mUser.getVirtualDirectory().getCurrentDirectory()};
  -            out.write(mFtpStatus.getResponse(200, request, mUser, args));
  +            String args[] = {mUser.getVirtualDirectory().getCurrentDirectory()};
  +            out.write(mFtpStatus.getResponse(250, request, mUser, args));
           }
           else {
  -            out.write(mFtpStatus.getResponse(431, request, mUser, null));
  +            out.write(mFtpStatus.getResponse(550, request, mUser, null));
           }
       }
   
  @@ -333,6 +333,12 @@
           File requestedFile = new File(physicalName);
           String[] args = {fileName};
   
  +        // check file existance
  +        if( !(requestedFile.exists() && requestedFile.isFile()) ) {
  +            out.write(mFtpStatus.getResponse(550, request, mUser, args));
  +            return;
  +        }
  +        
           // check permission
           if(!mUser.getVirtualDirectory().hasWritePermission(physicalName, true)) {
               out.write(mFtpStatus.getResponse(450, request, mUser, args));
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic