VirtualBox

Changeset 82842 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jan 23, 2020 10:16:23 AM (5 years ago)
Author:
vboxsync
Message:

IPRT/FTP: Retrieving files in sub directories also works now. bugref:9646

Location:
trunk/src/VBox/Runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/ftp-server.cpp

    r82840 r82842  
    20352035    if (RT_SUCCESS(rc))
    20362036    {
    2037         if (pClient->pDataConn)
     2037        if (RT_SUCCESS(rc))
    20382038        {
    2039             /* Note: Data connection gets created when the PORT command was sent. */
    2040             rc = rtFtpServerDataConnStart(pClient->pDataConn, rtFtpServerDataConnFileWriteThread, cArgs, apcszArgs);
    2041             if (RT_SUCCESS(rc))
    2042                 rc = rtFtpServerSendReplyRc(pClient, RTFTPSERVER_REPLY_FILE_STS_OK_OPENING_DATA_CONN);
     2039            if (pClient->pDataConn == NULL)
     2040            {
     2041                rc = rtFtpServerDataConnCreate(pClient, &pClient->pDataConn);
     2042                if (RT_SUCCESS(rc))
     2043                    rc = rtFtpServerDataConnStart(pClient->pDataConn, rtFtpServerDataConnFileWriteThread, cArgs, apcszArgs);
     2044
     2045                int rc2 = rtFtpServerSendReplyRc(  pClient, RT_SUCCESS(rc)
     2046                                                 ? RTFTPSERVER_REPLY_DATACONN_ALREADY_OPEN
     2047                                                 : RTFTPSERVER_REPLY_CANT_OPEN_DATA_CONN);
     2048                AssertRC(rc2);
     2049            }
     2050            else
     2051            {
     2052                 int rc2 = rtFtpServerSendReplyRc(pClient, RTFTPSERVER_REPLY_DATACONN_ALREADY_OPEN);
     2053                 AssertRC(rc2);
     2054            }
    20432055        }
    20442056        else
    2045             rc = VERR_FTP_DATA_CONN_NOT_FOUND;
     2057        {
     2058            int rc2 = rtFtpServerSendReplyRc(pClient, RTFTPSERVER_REPLY_CONN_REQ_FILE_ACTION_NOT_TAKEN);
     2059            AssertRC(rc2);
     2060        }
    20462061    }
    20472062
  • trunk/src/VBox/Runtime/tools/RTFTPServer.cpp

    r82841 r82842  
    212212    Assert(pData->cbUser == sizeof(FTPSERVERDATA));
    213213
    214     return RTFileOpen(&pThis->hFile, pcszPath, fMode);
     214    char *pszPathAbs = NULL;
     215    if (RTStrAPrintf(&pszPathAbs, "%s/%s", pThis->szPathRootAbs, pcszPath) <= 0)
     216        return VERR_NO_MEMORY;
     217
     218    int rc = RTFileOpen(&pThis->hFile, pszPathAbs, fMode);
     219
     220    RTStrFree(pszPathAbs);
     221
     222    return rc;
    215223}
    216224
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