2011-06-01 21:15:14 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* apps/netutils/ftpc/ftpc_transfer.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
2012-09-13 18:58:49 +02:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
2011-06-01 21:15:14 +02:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
2011-06-02 01:09:29 +02:00
|
|
|
#include <signal.h>
|
2011-06-05 18:46:27 +02:00
|
|
|
#include <poll.h>
|
2011-06-01 21:15:14 +02:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2011-06-02 01:09:29 +02:00
|
|
|
#include <apps/ftpc.h>
|
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
#include "ftpc_internal.h"
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftp_pasvmode
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Enter passive mode.
|
|
|
|
*
|
|
|
|
* In active mode FTP the client connects from a random port (N>1023) to the
|
|
|
|
* FTP server's command port, port 21. Then, the client starts listening to
|
|
|
|
* port N+1 and sends the FTP command PORT N+1 to the FTP server. The server
|
|
|
|
* will then connect back to the client's specified data port from its local
|
|
|
|
* data port, which is port 20. In passive mode FTP the client initiates
|
2014-04-14 00:24:28 +02:00
|
|
|
* both connections to the server, solving the problem of firewalls filtering
|
2011-06-01 21:15:14 +02:00
|
|
|
* the incoming data port connection to the client from the server. When
|
|
|
|
* opening an FTP connection, the client opens two random ports locally
|
|
|
|
* (N>1023 and N+1). The first port contacts the server on port 21, but
|
|
|
|
* instead of then issuing a PORT command and allowing the server to connect
|
|
|
|
* back to its data port, the client will issue the PASV command. The result
|
|
|
|
* of this is that the server then opens a random unprivileged port (P >
|
|
|
|
* 1023) and sends the PORT P command back to the client. The client then
|
2014-04-14 00:24:28 +02:00
|
|
|
* initiates the connection from port N+1 to port P on the server to transfer
|
2011-06-01 21:15:14 +02:00
|
|
|
* data.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static int ftp_pasvmode(struct ftpc_session_s *session,
|
|
|
|
uint8_t addrport[6])
|
|
|
|
{
|
|
|
|
int tmpap[6];
|
|
|
|
char *ptr;
|
|
|
|
int nscan;
|
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Does this host support the PASV command */
|
|
|
|
|
|
|
|
if (!FTPC_HAS_PASV(session))
|
|
|
|
{
|
|
|
|
ndbg("Host doesn't support passive mode\n");
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
2011-06-02 03:14:12 +02:00
|
|
|
/* Request passive mode. The server normally accepts PASV with code 227.
|
|
|
|
* Its response is a single line showing the IP address of the server and
|
|
|
|
* the TCP port number where the server is accepting connections.
|
|
|
|
*/
|
2011-06-01 21:15:14 +02:00
|
|
|
|
|
|
|
ret = ftpc_cmd(session, "PASV");
|
|
|
|
if (ret < 0 || !ftpc_connected(session))
|
|
|
|
{
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Skip over any leading stuff before address begins */
|
|
|
|
|
|
|
|
ptr = session->reply + 4;
|
|
|
|
while (!isdigit((int)*ptr))
|
|
|
|
{
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The response is then 6 integer values: four representing the
|
|
|
|
* IP address and two representing the port number.
|
|
|
|
*/
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
nscan = sscanf(ptr, "%d,%d,%d,%d,%d,%d",
|
|
|
|
&tmpap[0], &tmpap[1], &tmpap[2],
|
|
|
|
&tmpap[3], &tmpap[4], &tmpap[5]);
|
|
|
|
if (nscan != 6)
|
|
|
|
{
|
|
|
|
ndbg("Error parsing PASV reply: '%s'\n", session->reply);
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Then copy the sscanf'ed values as bytes */
|
|
|
|
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
addrport[i] = (uint8_t)(tmpap[i] & 0xff);
|
|
|
|
}
|
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
2011-06-03 22:27:30 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftpc_abspath
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Get the absolute path to a file, handling tilde expansion.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static FAR char *ftpc_abspath(FAR struct ftpc_session_s *session,
|
|
|
|
FAR const char *relpath, FAR const char *homedir,
|
|
|
|
FAR const char *curdir)
|
|
|
|
{
|
|
|
|
FAR char *ptr = NULL;
|
|
|
|
|
|
|
|
/* If no relative path was provide, then use the current working directory */
|
|
|
|
|
|
|
|
if (!relpath)
|
|
|
|
{
|
|
|
|
return strdup(curdir);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle tilde expansion */
|
|
|
|
|
|
|
|
if (relpath[0] == '~')
|
|
|
|
{
|
|
|
|
/* Is the relative path only '~' */
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-03 22:27:30 +02:00
|
|
|
if (relpath[1] == '\0')
|
|
|
|
{
|
|
|
|
return strdup(homedir);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No... then a '/' better follow the tilde */
|
|
|
|
|
|
|
|
else if (relpath[1] == '/')
|
|
|
|
{
|
2014-11-25 22:26:30 +01:00
|
|
|
(void)asprintf(&ptr, "%s%s", homedir, &relpath[1]);
|
2011-06-03 22:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Hmmm... this pretty much guaranteed to fail */
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ptr = strdup(relpath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No tilde expansion. Check for a path relative to the current
|
|
|
|
* directory.
|
|
|
|
*/
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-03 22:27:30 +02:00
|
|
|
else if (strncmp(relpath, "./", 2) == 0)
|
|
|
|
{
|
2014-11-25 22:26:30 +01:00
|
|
|
(void)asprintf(&ptr, "%s%s", curdir, relpath+1);
|
2011-06-03 22:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for an absolute path */
|
|
|
|
|
|
|
|
else if (relpath[0] == '/' && relpath[1] == ':' && relpath[2] == '\\')
|
|
|
|
{
|
|
|
|
ptr = strdup(relpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Assume it a relative path */
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
2014-11-25 22:26:30 +01:00
|
|
|
(void)asprintf(&ptr, "%s/%s", curdir, relpath);
|
2011-06-03 22:27:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftpc_xfrinit
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Perform common transfer setup logic.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int ftpc_xfrinit(FAR struct ftpc_session_s *session)
|
|
|
|
{
|
|
|
|
struct sockaddr_in addr;
|
|
|
|
uint8_t addrport[6];
|
|
|
|
uint8_t *paddr;
|
|
|
|
uint8_t *pport;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* We must be connected to initiate a transfer */
|
|
|
|
|
|
|
|
if (!ftpc_connected(session))
|
|
|
|
{
|
2011-06-03 22:27:30 +02:00
|
|
|
ndbg("Not connected\n");
|
2011-06-01 21:15:14 +02:00
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the data channel */
|
|
|
|
|
|
|
|
ret = ftpc_sockinit(&session->data);
|
|
|
|
if (ret != OK)
|
|
|
|
{
|
|
|
|
ndbg("ftpc_sockinit() failed: %d\n", errno);
|
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Duplicate the address and connection information of the command channel */
|
|
|
|
|
|
|
|
ftpc_sockcopy(&session->data, &session->cmd);
|
|
|
|
|
|
|
|
/* Should we enter passive mode? */
|
|
|
|
|
|
|
|
if (FTPC_IS_PASSIVE(session))
|
|
|
|
{
|
|
|
|
/* Yes.. going passive. */
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
ret = ftp_pasvmode(session, addrport);
|
|
|
|
if (ret != OK)
|
|
|
|
{
|
2011-06-03 22:27:30 +02:00
|
|
|
ndbg("ftp_pasvmode() failed: %d\n", errno);
|
2011-06-01 21:15:14 +02:00
|
|
|
goto errout_with_data;
|
|
|
|
}
|
|
|
|
|
2011-06-04 00:53:36 +02:00
|
|
|
/* Configure the data socket */
|
2011-06-01 21:15:14 +02:00
|
|
|
|
2011-06-04 00:53:36 +02:00
|
|
|
ftpc_sockgetsockname(&session->cmd, &addr);
|
2011-06-05 18:13:50 +02:00
|
|
|
memcpy(&addr.sin_addr, addrport, 4);
|
|
|
|
memcpy(&addr.sin_port, addrport+4, 2);
|
2011-06-01 21:15:14 +02:00
|
|
|
|
2011-06-04 00:53:36 +02:00
|
|
|
/* Connect the data socket */
|
2011-06-01 21:15:14 +02:00
|
|
|
|
2011-06-04 00:53:36 +02:00
|
|
|
ret = ftpc_sockconnect(&session->data, &addr);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
ndbg("ftpc_sockconnect() failed: %d\n", errno);
|
|
|
|
goto errout_with_data;
|
|
|
|
}
|
2011-06-01 21:15:14 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Wait for the connection to be established */
|
|
|
|
|
|
|
|
ftpc_socklisten(&session->data);
|
|
|
|
|
|
|
|
/* Then send our local data channel address to the server */
|
|
|
|
|
|
|
|
paddr = (uint8_t *)&session->data.laddr.sin_addr;
|
|
|
|
pport = (uint8_t *)&session->data.laddr.sin_port;
|
|
|
|
|
|
|
|
ret = ftpc_cmd(session, "PORT %d,%d,%d,%d,%d,%d",
|
|
|
|
paddr[0], paddr[1], paddr[2],
|
|
|
|
paddr[3], pport[0], pport[1]);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
ndbg("ftpc_cmd() failed: %d\n", errno);
|
|
|
|
goto errout_with_data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return OK;
|
|
|
|
|
2015-10-03 19:03:42 +02:00
|
|
|
errout_with_data:
|
2011-06-01 21:15:14 +02:00
|
|
|
ftpc_sockclose(&session->data);
|
2015-10-03 19:03:42 +02:00
|
|
|
errout:
|
2011-06-01 21:15:14 +02:00
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftpc_xfrreset
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Reset transfer variables
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void ftpc_xfrreset(struct ftpc_session_s *session)
|
|
|
|
{
|
|
|
|
session->size = 0;
|
|
|
|
session->flags &= ~FTPC_XFER_FLAGS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftpc_xfrmode
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Select ASCII or Binary transfer mode
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int ftpc_xfrmode(struct ftpc_session_s *session, uint8_t xfrmode)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2011-06-02 03:14:12 +02:00
|
|
|
/* Check if we have already selected the requested mode */
|
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
DEBUGASSERT(xfrmode != FTPC_XFRMODE_UNKNOWN);
|
|
|
|
if (session->xfrmode != xfrmode)
|
2011-06-02 03:14:12 +02:00
|
|
|
{
|
|
|
|
/* Send the TYPE request to control the binary flag. Parameters for the
|
|
|
|
* TYPE request include:
|
|
|
|
*
|
|
|
|
* A: Turn the binary flag off.
|
|
|
|
* A N: Turn the binary flag off.
|
|
|
|
* I: Turn the binary flag on.
|
|
|
|
* L 8: Turn the binary flag on.
|
|
|
|
*
|
|
|
|
* The server accepts the TYPE request with code 200.
|
|
|
|
*/
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-02 03:14:12 +02:00
|
|
|
ret = ftpc_cmd(session, "TYPE %c", xfrmode == FTPC_XFRMODE_ASCII ? 'A' : 'I');
|
2015-09-08 18:21:56 +02:00
|
|
|
UNUSED(ret);
|
2011-06-02 03:14:12 +02:00
|
|
|
session->xfrmode = xfrmode;
|
|
|
|
}
|
2015-09-08 18:21:56 +02:00
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftpc_xfrabort
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Abort a transfer in progress
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int ftpc_xfrabort(FAR struct ftpc_session_s *session, FAR FILE *stream)
|
|
|
|
{
|
|
|
|
FAR struct pollfd fds;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Make sure that we are still connected */
|
|
|
|
|
|
|
|
if (!ftpc_connected(session))
|
|
|
|
{
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if there is data waiting to be read from the cmd channel */
|
|
|
|
|
|
|
|
fds.fd = session->cmd.sd;
|
|
|
|
fds.events = POLLIN;
|
|
|
|
ret = poll(&fds, 1, 0);
|
|
|
|
if (ret > 0)
|
|
|
|
{
|
|
|
|
/* Read data from command channel */
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
nvdbg("Flush cmd channel data\n");
|
2011-06-13 17:43:56 +02:00
|
|
|
while (stream && fread(session->buffer, 1, CONFIG_FTP_BUFSIZE, stream) > 0);
|
2011-06-01 21:15:14 +02:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FTPC_SET_INTERRUPT(session);
|
|
|
|
|
|
|
|
/* Send the Telnet interrupt sequence to abort the transfer:
|
|
|
|
* <IAC IP><IAC DM>ABORT<CR><LF>
|
|
|
|
*/
|
|
|
|
|
2011-06-03 22:27:30 +02:00
|
|
|
nvdbg("Telnet ABORt sequence\n");
|
2011-06-01 21:15:14 +02:00
|
|
|
ftpc_sockprintf(&session->cmd, "%c%c", TELNET_IAC, TELNET_IP); /* Interrupt process */
|
|
|
|
ftpc_sockprintf(&session->cmd, "%c%c", TELNET_IAC, TELNET_DM); /* Telnet synch signal */
|
|
|
|
ftpc_sockprintf(&session->cmd, "ABOR\r\n"); /* Abort */
|
|
|
|
ftpc_sockflush(&session->cmd);
|
|
|
|
|
|
|
|
/* Read remaining bytes from connection */
|
|
|
|
|
2011-06-13 17:43:56 +02:00
|
|
|
while (stream && fread(session->buffer, 1, CONFIG_FTP_BUFSIZE, stream) > 0);
|
2011-06-01 21:15:14 +02:00
|
|
|
|
|
|
|
/* Get the ABORt reply */
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
fptc_getreply(session);
|
|
|
|
|
|
|
|
/* Expected replys are: "226 Closing data connection" or
|
|
|
|
* "426 Connection closed; transfer aborted"
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (session->code != 226 && session->code != 426)
|
|
|
|
{
|
|
|
|
nvdbg("Expected 226 or 426 reply\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Get the next reply */
|
|
|
|
|
|
|
|
fptc_getreply(session);
|
|
|
|
|
|
|
|
/* Expected replys are: or "225 Data connection open; no transfer in progress"
|
|
|
|
* "226 Closing data connection"
|
|
|
|
*/
|
2014-04-14 00:24:28 +02:00
|
|
|
|
2011-06-01 21:15:14 +02:00
|
|
|
if (session->code != 226 && session->code != 225)
|
|
|
|
{
|
|
|
|
nvdbg("Expected 225 or 226 reply\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
2011-06-02 01:09:29 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftpc_timeout
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* A timeout occurred -- either on a specific command or while waiting
|
|
|
|
* for a reply.
|
|
|
|
*
|
|
|
|
* NOTE:
|
|
|
|
* This function executes in the context of a timer interrupt handler.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2011-06-01 21:15:14 +02:00
|
|
|
|
2011-06-02 01:09:29 +02:00
|
|
|
void ftpc_timeout(int argc, uint32_t arg1, ...)
|
|
|
|
{
|
|
|
|
FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)arg1;
|
2011-06-01 21:15:14 +02:00
|
|
|
|
2011-06-02 01:09:29 +02:00
|
|
|
nlldbg("Timeout!\n");
|
|
|
|
DEBUGASSERT(argc == 1 && session);
|
|
|
|
kill(session->pid, CONFIG_FTP_SIGNAL);
|
|
|
|
}
|
2011-06-03 22:27:30 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftpc_absrpath
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Get the absolute path to a remote file, handling tilde expansion.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR char *ftpc_absrpath(FAR struct ftpc_session_s *session,
|
|
|
|
FAR const char *relpath)
|
|
|
|
{
|
|
|
|
FAR char *absrpath = ftpc_abspath(session, relpath,
|
|
|
|
session->homerdir, session->currdir);
|
|
|
|
nvdbg("%s -> %s\n", relpath, absrpath);
|
|
|
|
return absrpath;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ftpc_abslpath
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Get the absolute path to a local file, handling tilde expansion.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR char *ftpc_abslpath(FAR struct ftpc_session_s *session,
|
|
|
|
FAR const char *relpath)
|
|
|
|
{
|
|
|
|
FAR char *abslpath = ftpc_abspath(session, relpath,
|
|
|
|
session->homeldir, session->curldir);
|
|
|
|
nvdbg("%s -> %s\n", relpath, abslpath);
|
|
|
|
return abslpath;
|
|
|
|
}
|
|
|
|
|
|
|
|
|