#include <net_config.h>
BOOL ftp_file_access (
U8* fname, /* Requested file name. */
U8 mode, /* Mode of a file access. */
U8 user_id ); /* User identification number. */
Description
The ftp_file_access function checks if a file access is
allowed for a specified user. This allows access protection of
sensitive files. The access to protected files will be blocked for
unprivileged users. Instead of this, the error code "550 Access is
denied" will be returned to the client.
The argument fname points to a buffer containing the file
name of a file, which the user is trying to access. The file name is
a 0-terminated string.
The argument user_id is an user identification number, the
same as it was returned from the ftp_check_account function.
It identifies the user, who is trying to access the specified
file.
The ftp_file_access function is in the FTP_MultiUser.c
module. The prototype is defined in net_config.h.
note
This function is optional. If the FTP file access
restriction is not used, this function is not required.
Return Value
The ftp_file_access function returns __TRUE if access to
file is allowed, and __FALSE if access is forbidden.
BOOL ftp_file_access (U8 *fname, U8 mode, U8 user_id) {
/* This function checks if file access for the user is allowed. */
if (user_id == 3) {
/* The user "Guest" has only read access rights. */
switch (mode) {
case 0:
case 3:
break;
default:
return (__FALSE);
}
return (__TRUE);
}
if (user_id == 2) {
/* The user "Michael" is not allowed to modify/delete "Test.txt" */
if (mode == 1 && strcmp ((char *)fname,"Test.txt") == 0) {
return (__FALSE);
}
}
return (__TRUE);
}
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.