dnscrypto-proxy: Support files updated.
[tomato.git] / release / src / router / vsftpd / access.c
blob2abd67f9d92b129f1ea50cc24df4d11c78001e3e
1 /*
2 * Part of Very Secure FTPd
3 * Licence: GPL v2
4 * Author: Chris Evans
5 * access.c
7 * Routines to do very very simple access control based on filenames.
8 */
10 #include "access.h"
11 #include "ls.h"
12 #include "tunables.h"
13 #include "str.h"
15 int
16 vsf_access_check_file(const struct mystr* p_filename_str)
18 static struct mystr s_access_str;
19 unsigned int iters = 0;
21 if (!tunable_deny_file)
23 return 1;
25 if (str_isempty(&s_access_str))
27 str_alloc_text(&s_access_str, tunable_deny_file);
29 if (vsf_filename_passes_filter(p_filename_str, &s_access_str, &iters))
31 return 0;
33 else
35 struct str_locate_result loc_res =
36 str_locate_str(p_filename_str, &s_access_str);
37 if (loc_res.found)
39 return 0;
42 return 1;
45 int
46 vsf_access_check_file_visible(const struct mystr* p_filename_str)
48 static struct mystr s_access_str;
49 unsigned int iters = 0;
51 if (!tunable_hide_file)
53 return 1;
55 if (str_isempty(&s_access_str))
57 str_alloc_text(&s_access_str, tunable_hide_file);
59 if (vsf_filename_passes_filter(p_filename_str, &s_access_str, &iters))
61 return 0;
63 else
65 struct str_locate_result loc_res =
66 str_locate_str(p_filename_str, &s_access_str);
67 if (loc_res.found)
69 return 0;
72 return 1;