FTP server is marginally functional

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4372 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-02-05 19:32:42 +00:00
parent 5c43eed652
commit 5348d75a2d
2 changed files with 11 additions and 6 deletions

View File

@ -130,11 +130,11 @@ static void ftpd_accounts(FTPD_SESSION handle)
{ {
account = &g_ftpdaccounts[i]; 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->flags & FTPD_ACCOUNTFLAG_SYSTEM) != 0 ? "Root" : "User",
(account->user) ? "(none)" : account->user, (!account->user) ? "(none)" : account->user,
(account->password) ? "(none)" : account->password, (!account->password) ? "(none)" : account->password,
(account->home) ? "(none)" : account->home); (!account->home) ? "(none)" : account->home);
ftpd_adduser(handle, account->flags, account->user, ftpd_adduser(handle, account->flags, account->user,
account->password, account->home); account->password, account->home);

View File

@ -700,7 +700,7 @@ static FAR char *ftpd_strtok(bool skipspace, FAR const char *delimiters,
while (*sptr != '\0') while (*sptr != '\0')
{ {
dptr = delimiters; dptr = delimiters;
while (*sptr |= *dptr && *dptr != '\0') while (*sptr != *dptr && *dptr != '\0')
{ {
dptr++; 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)); session = (FAR struct ftpd_session_s *)zalloc(sizeof(struct ftpd_session_s));
if (!session) if (!session)
{ {
ndbg("Failed to allocate session\n");
ret = -ENOMEM; ret = -ENOMEM;
goto errout; goto errout;
} }
@ -4291,6 +4292,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
session->cmd.buffer = (FAR char *)malloc(session->cmd.buflen); session->cmd.buffer = (FAR char *)malloc(session->cmd.buflen);
if (!session->cmd.buffer) if (!session->cmd.buffer)
{ {
ndbg("Failed to allocate command buffer\n");
ret = -ENOMEM; ret = -ENOMEM;
goto errout_with_session; 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); session->data.buffer = (FAR char *)malloc(session->data.buflen);
if (!session->data.buffer) if (!session->data.buffer)
{ {
ndbg("Failed to allocate data buffer\n");
ret = -ENOMEM; ret = -ENOMEM;
goto errout_with_session; goto errout_with_session;
} }
@ -4310,7 +4313,8 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
&session->cmd.addrlen, timeout); &session->cmd.addrlen, timeout);
if (session->cmd.sd < 0) if (session->cmd.sd < 0)
{ {
ret = -errno; ndbg("ftpd_accept() failed: %d\n", session->cmd.sd);
ret = session->cmd.sd;
goto errout_with_session; goto errout_with_session;
} }
@ -4320,6 +4324,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
CONFIG_FTPD_WORKERSTACKSIZE); CONFIG_FTPD_WORKERSTACKSIZE);
if (ret < 0) if (ret < 0)
{ {
ndbg("ftpd_startworker() failed: %d\n", ret);
goto errout_with_session; goto errout_with_session;
} }