From e45978a72229aff2d2f05bf1c1638542e0a5da9f Mon Sep 17 00:00:00 2001 From: HankDevelop Date: Fri, 23 Oct 2020 16:27:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86group=E9=85=8D=E7=BD=AE=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=94=AF=E6=8C=81token=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common.c | 9 ++++++++- src/mod_fastdfs.conf | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common.c b/src/common.c index f33d3a8..c670cac 100644 --- a/src/common.c +++ b/src/common.c @@ -47,6 +47,7 @@ static char flv_header[] = "FLV\x1\x1\0\0\0\x9\0\0\0\x9"; typedef struct tagGroupStorePaths { char group_name[FDFS_GROUP_NAME_MAX_LEN + 1]; int group_name_len; + bool check_token; int storage_server_port; FDFSStorePaths store_paths; } GroupStorePaths; @@ -112,6 +113,10 @@ static int fdfs_load_groups_store_paths(IniContext *pItemContext) return ENOENT; } + group_store_paths[i].check_token = iniGetBoolValue(section_name, \ + "check_token", \ + pItemContext, false); + group_store_paths[i].storage_server_port = iniGetIntValue( \ section_name, "storage_server_port", pItemContext, \ FDFS_STORAGE_SERVER_DEF_PORT); @@ -791,6 +796,7 @@ int fdfs_http_request_handler(struct fdfs_http_context *pContext) FDFSFileInfo file_info; bool bFileExists; bool bSameGroup; //if in my group + bool checkToken = g_http_params.anti_steal_token; bool bTrunkFile; FDFSTrunkFullInfo trunkInfo; @@ -887,6 +893,7 @@ int fdfs_http_request_handler(struct fdfs_http_context *pContext) the_storage_port = group_store_paths[i]. \ storage_server_port; bSameGroup = true; + checkToken = group_store_paths[i].check_token; pStorePaths = &group_store_paths[i].store_paths; break; } @@ -914,7 +921,7 @@ int fdfs_http_request_handler(struct fdfs_http_context *pContext) return HTTP_BADREQUEST; } - if (g_http_params.anti_steal_token) + if (g_http_params.anti_steal_token && checkToken) { char *token; char *ts; diff --git a/src/mod_fastdfs.conf b/src/mod_fastdfs.conf index 548108d..b971151 100644 --- a/src/mod_fastdfs.conf +++ b/src/mod_fastdfs.conf @@ -117,6 +117,7 @@ group_count = 0 # when support multi-group on this storage server, uncomment following section #[group1] #group_name=group1 +#check_token=false #storage_server_port=23000 #store_path_count=2 #store_path0=/home/yuqing/fastdfs @@ -127,6 +128,7 @@ group_count = 0 # when support multi-group, uncomment following section as neccessary #[group2] #group_name=group2 +#check_token=false #storage_server_port=23000 #store_path_count=1 #store_path0=/home/yuqing/fastdfs