diff options
| author | beatrice <beatrice@dangofactory.net> | 2026-11-22 19:25:05 +0900 |
|---|---|---|
| committer | beatrice <beatrice@dangofactory.net> | 2026-11-22 19:25:05 +0900 |
| commit | c7a201b58080c7a0f57b38c59e7865aa42c1d029 (patch) | |
| tree | cde6146e3aada31e68594fd4f034abe90621ce34 /access.c | |
| download | vsftpd-master.tar.gz vsftpd-master.zip | |
Import vsftpd-3.0.5.tar.gzHEADlocal/vsftpdmaster
Diffstat (limited to 'access.c')
| -rw-r--r-- | access.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/access.c b/access.c new file mode 100644 index 0000000..2abd67f --- /dev/null +++ b/access.c @@ -0,0 +1,74 @@ +/* + * Part of Very Secure FTPd + * Licence: GPL v2 + * Author: Chris Evans + * access.c + * + * Routines to do very very simple access control based on filenames. + */ + +#include "access.h" +#include "ls.h" +#include "tunables.h" +#include "str.h" + +int +vsf_access_check_file(const struct mystr* p_filename_str) +{ + static struct mystr s_access_str; + unsigned int iters = 0; + + if (!tunable_deny_file) + { + return 1; + } + if (str_isempty(&s_access_str)) + { + str_alloc_text(&s_access_str, tunable_deny_file); + } + if (vsf_filename_passes_filter(p_filename_str, &s_access_str, &iters)) + { + return 0; + } + else + { + struct str_locate_result loc_res = + str_locate_str(p_filename_str, &s_access_str); + if (loc_res.found) + { + return 0; + } + } + return 1; +} + +int +vsf_access_check_file_visible(const struct mystr* p_filename_str) +{ + static struct mystr s_access_str; + unsigned int iters = 0; + + if (!tunable_hide_file) + { + return 1; + } + if (str_isempty(&s_access_str)) + { + str_alloc_text(&s_access_str, tunable_hide_file); + } + if (vsf_filename_passes_filter(p_filename_str, &s_access_str, &iters)) + { + return 0; + } + else + { + struct str_locate_result loc_res = + str_locate_str(p_filename_str, &s_access_str); + if (loc_res.found) + { + return 0; + } + } + return 1; +} + |
