From 98acf5706572c113439d23c61c61ee5635c9e0a5 Mon Sep 17 00:00:00 2001 From: ly1217 Date: Fri, 9 Nov 2018 01:35:07 -0800 Subject: [PATCH] Fix the invalid arguments process of list_dir_with_perm. --- common/rpc-service.c | 10 ++++++++++ server/repo-perm.c | 5 ----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/rpc-service.c b/common/rpc-service.c index bc9c311..bf61640 100644 --- a/common/rpc-service.c +++ b/common/rpc-service.c @@ -4645,11 +4645,21 @@ seafile_list_dir_with_perm (const char *repo_id, return NULL; } + if (!path) { + g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid path"); + return NULL; + } + if (!dir_id || !is_object_id_valid (dir_id)) { g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid dir id"); return NULL; } + if (!user) { + g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid user"); + return NULL; + } + char *rpath = format_dir_path (path); GList *ret = seaf_repo_manager_list_dir_with_perm (seaf->repo_mgr, diff --git a/server/repo-perm.c b/server/repo-perm.c index 72c10b2..83d73ee 100644 --- a/server/repo-perm.c +++ b/server/repo-perm.c @@ -215,11 +215,6 @@ seaf_repo_manager_list_dir_with_perm (SeafRepoManager *mgr, GList *res = NULL; GList *p; - if (!repo_id || !is_uuid_valid(repo_id) || dir_id == NULL || !user) { - g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_DIR_ID, "Bad dir id"); - return NULL; - } - perm = seaf_repo_manager_check_permission (mgr, repo_id, user, error); if (!perm) { if (*error == NULL)