Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10458811045881 Implementing FTP User Authentication Anchor10459121045912To control access to µC/FTPs, there is an authentication callback function that you must implement. Anchor10459681045968

When an FTP client tries to access your µC/FTPs server, it sends a user name and a password. Authentication of these user name and password is out of µC/FTPs’ scope. Thus, these user name and password must be validated and some information about the user’s home directory and browsing permission must be returned by your application.

Anchor10459801045980This authentication is implemented in your application using a callback function (see Chapter 4 Chapter 4 for more details): Anchor10459991045999

CPU_BOOLEAN FTPs_AuthUser(FTPs_SESSION_STRUCT *ftp_session);

...

10460881046088If that callback function successfully authenticates a user, it must also return two directories information. The firstthe base path, located at ftp_session->BasePath, represents the highest directory in the file system that the user is allowed to see and access. The other one, the relative path, located at ftp_session->RelPath represents the current relative directory for base path that the user sees and access. Here’s some concrete exemples.

...

1046229Finally, note that if you want to access the various mass storage devices on your filesystem (RAM disk, SD/MMC, IDE, on-board Flash, etc), you need to create as many users having their base path set to these different devices. For instance, “user1” user1could access all the RAM disk by setting its base path to “ramram:0:” and “user2” user2the IDE disk with the “ideide:0:” base path. Switching from on device to another would then be performed by issuing the “USER” and “PASS” USER” and “PASSFTP commands.