ftp server directory change, was: [En-Nut-Discussion] Nut/OS Preview 4.1.9.7 Available

Ralf Spettel r.spettel at raumcomputer.com
Wed Aug 2 16:17:26 CEST 2006


Hi Harald & Peter

>Probably browsers use
>some optional commands, which are not supported by the
>sample.

>Internet Explorer 6.0.2800.1106 displays the root directory,
>but fails to change into subdirs or downloading files.

Can you add the CDUP (Change Directory Up / cd .. ) command to ftpd.c ?

I added this and the DirectoryChanging works fine with filezilla..

( This will not fix the other problems.. sorry.)

Ralf



after the line
------------------------------------------------------
static prog_char cmd_user_P[] = "USER";
------------------------------------------------------
add
------------------------------------------------------
static prog_char cmd_cdup_P[] = "CDUP";
------------------------------------------------------

after line
------------------------------------------------------
  else if (strcmp_P(cmd, cmd_cdup_P) == 0) {
             rc = NutFtpProcessCdup(session);
         }
------------------------------------------------------
add:
------------------------------------------------------
else if (strcmp_P(cmd, cmd_cdup_P) == 0) {
             rc = NutFtpProcessCdup(session);
         }
------------------------------------------------------

after function
------------------------------------------------------
int NutFtpProcessCwd(FTPSESSION * session, char *path)
{}
------------------------------------------------------
add:
------------------------------------------------------
     int NutFtpProcessCdup(FTPSESSION * session)
         {
                 int str_len;

                 //root directory -> nothing to do
                 if ( (session->ftp_cwd[0] == '/') && 
(strlen(session->ftp_cwd)==1) )
                 {
                 return NutFtpRespondOk(session, 250);
             }


                 char* ftp_cwd_tmp;

                 str_len = (strlen(session->ftp_cwd));

                 if (( ftp_cwd_tmp = malloc(str_len+2+1)) == 0) //path + 
".." + \0
             {
                 return NutFtpRespondBad(session, 550);
             }

                 ftp_cwd_tmp[0] = 0;

             strncpy(ftp_cwd_tmp, session->ftp_cwd, str_len);
             strcat(ftp_cwd_tmp, "..");

             if (session->ftp_cwd) {
         free(session->ftp_cwd);
                 }

                 session->ftp_cwd = ftp_cwd_tmp;

             return NutFtpRespondOk(session, 250);
         }
------------------------------------------------------




>However, all that had been tested with Ethernut 3 using PHAT on
>MMC. I'll check Ethernut 2 now.
>
>Harald
>
>
>
>_______________________________________________
>En-Nut-Discussion mailing list
>En-Nut-Discussion at egnite.de
>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion


Mit freundlichen Grüssen
Ralf Spettel

_________________________________________________
Dipl.Ing. Ralf Spettel
Embedded Systems Engineer
RaumComputer AG
Abt. Hardwareentwicklung
Augartenstrasse 1
76137 Karlsruhe, Germany
T: +49 721 / 989600-84
F: +49 721 / 989600-98
r.spettel at raumcomputer.com
_________________________________________________




More information about the En-Nut-Discussion mailing list