VirtualBox

Changeset 82733 in vbox


Ignore:
Timestamp:
Jan 14, 2020 12:20:17 PM (5 years ago)
Author:
vboxsync
Message:

IPRT/FTP: Implemented FEAT command for reporting additional server features. Needed for the SIZE command. bugref:9646

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/ftp.h

    r82732 r82733  
    126126    /** Command not implemented, superfluous at this site. */
    127127    RTFTPSERVER_REPLY_ERROR_CMD_NOT_IMPL_SUPERFLUOUS = 202,
     128    /** System status report. */
     129    RTFTPSERVER_REPLY_SYSTEM_STATUS                  = 211,
    128130    /** Service ready for new user. */
    129131    RTFTPSERVER_REPLY_READY_FOR_NEW_USER             = 220,
  • trunk/src/VBox/Runtime/generic/ftp-server.cpp

    r82732 r82733  
    119119    /** Changes the current working directory. */
    120120    RTFTPSERVER_CMD_CWD,
     121    /** Reports features supported by the server. */
     122    RTFTPSERVER_CMD_FEAT,
    121123    /** Lists a directory. */
    122124    RTFTPSERVER_CMD_LIST,
     
    275277static FNRTFTPSERVERCMD rtFtpServerHandleCDUP;
    276278static FNRTFTPSERVERCMD rtFtpServerHandleCWD;
     279static FNRTFTPSERVERCMD rtFtpServerHandleFEAT;
    277280static FNRTFTPSERVERCMD rtFtpServerHandleLIST;
    278281static FNRTFTPSERVERCMD rtFtpServerHandleMODE;
     
    312315    { RTFTPSERVER_CMD_CDUP,     "CDUP",         rtFtpServerHandleCDUP },
    313316    { RTFTPSERVER_CMD_CWD,      "CWD",          rtFtpServerHandleCWD  },
     317    { RTFTPSERVER_CMD_FEAT,     "FEAT",         rtFtpServerHandleFEAT },
    314318    { RTFTPSERVER_CMD_LIST,     "LIST",         rtFtpServerHandleLIST },
    315319    { RTFTPSERVER_CMD_MODE,     "MODE",         rtFtpServerHandleMODE },
     
    329333};
    330334
     335/** Feature string which represents all commands we support in addition to RFC 959.
     336 *  Must match the command table above.
     337 *
     338 *  Don't forget the terminating ";" at each feature. */
     339#define RTFTPSERVER_FEATURES_STRING \
     340    "SIZE;" /* Supports reporting file sizes. */
    331341
    332342/*********************************************************************************************************************************
     
    810820}
    811821
     822static int rtFtpServerHandleFEAT(PRTFTPSERVERCLIENT pClient, uint8_t cArgs, const char * const *apcszArgs)
     823{
     824    RT_NOREF(cArgs, apcszArgs);
     825
     826    int rc = rtFtpServerSendReplyRc(pClient, RTFTPSERVER_REPLY_SYSTEM_STATUS); /* Features begin */
     827    if (RT_SUCCESS(rc))
     828    {
     829        rc = rtFtpServerSendReplyStr(pClient, RTFTPSERVER_FEATURES_STRING);
     830        if (RT_SUCCESS(rc))
     831            rc = rtFtpServerSendReplyRc(pClient, RTFTPSERVER_REPLY_SYSTEM_STATUS); /* Features end */
     832    }
     833
     834    return rc;
     835}
     836
    812837static int rtFtpServerHandleLIST(PRTFTPSERVERCLIENT pClient, uint8_t cArgs, const char * const *apcszArgs)
    813838{
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette