1 Star 0 Fork 0

晓敬/vsftp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
access.c 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
/*
* 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;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/jinger7281/vsftp.git
git@gitee.com:jinger7281/vsftp.git
jinger7281
vsftp
vsftp
master

搜索帮助