summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-05 19:32:42 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-05 19:32:42 +0000
commitcfae8d45a94832c8eae15ccad2012c37ed2027d7 (patch)
tree7b2f4f57800fb437bb8f6b17f99cb5a76e6aaad9
parentd8a039ee18825d1f29e0c020ae6569453fb7bb4f (diff)
downloadnuttx-cfae8d45a94832c8eae15ccad2012c37ed2027d7.tar.gz
nuttx-cfae8d45a94832c8eae15ccad2012c37ed2027d7.tar.bz2
nuttx-cfae8d45a94832c8eae15ccad2012c37ed2027d7.zip
FTP server is marginally functional
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4372 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xapps/examples/ftpd/ftpd_main.c8
-rwxr-xr-xapps/netutils/ftpd/ftpd.c9
-rw-r--r--nuttx/configs/stm3240g-eval/nsh/defconfig2
3 files changed, 12 insertions, 7 deletions
diff --git a/apps/examples/ftpd/ftpd_main.c b/apps/examples/ftpd/ftpd_main.c
index 1f43e317c..c5c23256d 100755
--- a/apps/examples/ftpd/ftpd_main.c
+++ b/apps/examples/ftpd/ftpd_main.c
@@ -130,11 +130,11 @@ static void ftpd_accounts(FTPD_SESSION handle)
{
account = &g_ftpdaccounts[i];
- printf("%d. %s account: USER=%s PASSWORD=%s HOME=%s\n",
+ printf("%d. %s account: USER=%s PASSWORD=%s HOME=%s\n", i+1,
(account->flags & FTPD_ACCOUNTFLAG_SYSTEM) != 0 ? "Root" : "User",
- (account->user) ? "(none)" : account->user,
- (account->password) ? "(none)" : account->password,
- (account->home) ? "(none)" : account->home);
+ (!account->user) ? "(none)" : account->user,
+ (!account->password) ? "(none)" : account->password,
+ (!account->home) ? "(none)" : account->home);
ftpd_adduser(handle, account->flags, account->user,
account->password, account->home);
diff --git a/apps/netutils/ftpd/ftpd.c b/apps/netutils/ftpd/ftpd.c
index 3dead6cb1..410ea8ef4 100755
--- a/apps/netutils/ftpd/ftpd.c
+++ b/apps/netutils/ftpd/ftpd.c
@@ -700,7 +700,7 @@ static FAR char *ftpd_strtok(bool skipspace, FAR const char *delimiters,
while (*sptr != '\0')
{
dptr = delimiters;
- while (*sptr |= *dptr && *dptr != '\0')
+ while (*sptr != *dptr && *dptr != '\0')
{
dptr++;
}
@@ -4256,6 +4256,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
session = (FAR struct ftpd_session_s *)zalloc(sizeof(struct ftpd_session_s));
if (!session)
{
+ ndbg("Failed to allocate session\n");
ret = -ENOMEM;
goto errout;
}
@@ -4291,6 +4292,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
session->cmd.buffer = (FAR char *)malloc(session->cmd.buflen);
if (!session->cmd.buffer)
{
+ ndbg("Failed to allocate command buffer\n");
ret = -ENOMEM;
goto errout_with_session;
}
@@ -4300,6 +4302,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
session->data.buffer = (FAR char *)malloc(session->data.buflen);
if (!session->data.buffer)
{
+ ndbg("Failed to allocate data buffer\n");
ret = -ENOMEM;
goto errout_with_session;
}
@@ -4310,7 +4313,8 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
&session->cmd.addrlen, timeout);
if (session->cmd.sd < 0)
{
- ret = -errno;
+ ndbg("ftpd_accept() failed: %d\n", session->cmd.sd);
+ ret = session->cmd.sd;
goto errout_with_session;
}
@@ -4320,6 +4324,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
CONFIG_FTPD_WORKERSTACKSIZE);
if (ret < 0)
{
+ ndbg("ftpd_startworker() failed: %d\n", ret);
goto errout_with_session;
}
diff --git a/nuttx/configs/stm3240g-eval/nsh/defconfig b/nuttx/configs/stm3240g-eval/nsh/defconfig
index b63fa3d9e..cd6f09907 100644
--- a/nuttx/configs/stm3240g-eval/nsh/defconfig
+++ b/nuttx/configs/stm3240g-eval/nsh/defconfig
@@ -1,7 +1,7 @@
############################################################################
# configs/stm3240g-eval/nsh/defconfig
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without