From: Volker Lendecke Date: Thu, 15 Dec 2022 18:14:48 +0000 (+0100) Subject: libsmb: Simplify clistr_is_previous_version_path() X-Git-Tag: talloc-2.4.0~213 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89828c64c9a8114bb5f596bc007a7c126e803d80;p=thirdparty%2Fsamba.git libsmb: Simplify clistr_is_previous_version_path() Nobody looks at the out params anymore Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Fri Dec 16 08:42:18 UTC 2022 on sn-devel-184 --- diff --git a/source3/lib/util_path.c b/source3/lib/util_path.c index fc76f6fb0bb..9c9c6eb5807 100644 --- a/source3/lib/util_path.c +++ b/source3/lib/util_path.c @@ -260,10 +260,7 @@ static bool find_snapshot_token( return true; } -bool clistr_is_previous_version_path(const char *path, - const char **startp, - const char **endp, - NTTIME *ptwrp) +bool clistr_is_previous_version_path(const char *path) { const char *start = NULL; const char *next = NULL; @@ -271,20 +268,7 @@ bool clistr_is_previous_version_path(const char *path, bool ok; ok = find_snapshot_token(path, '\\', &start, &next, &twrp); - if (!ok) { - return false; - } - - if (startp != NULL) { - *startp = start; - } - if (endp != NULL) { - *endp = next; - } - if (ptwrp != NULL) { - *ptwrp = twrp; - } - return true; + return ok; } static bool extract_snapshot_token_internal(char *fname, NTTIME *twrp, char sep) diff --git a/source3/lib/util_path.h b/source3/lib/util_path.h index 7dd307f44dc..9dcc1dd23ca 100644 --- a/source3/lib/util_path.h +++ b/source3/lib/util_path.h @@ -46,10 +46,7 @@ char *cache_path(TALLOC_CTX *mem_ctx, const char *name); char *canonicalize_absolute_path(TALLOC_CTX *ctx, const char *abs_path); bool extract_snapshot_token(char *fname, NTTIME *twrp); bool clistr_smb2_extract_snapshot_token(char *fname, NTTIME *twrp); -bool clistr_is_previous_version_path(const char *path, - const char **startp, - const char **endp, - NTTIME *ptwrp); +bool clistr_is_previous_version_path(const char *path); bool subdir_of(const char *parent, size_t parent_len, const char *subdir, diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 91bb1095643..13619c74209 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -79,7 +79,7 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(path, NULL, NULL, NULL) && + if (clistr_is_previous_version_path(path) && !INFO_LEVEL_IS_UNIX(level)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -1332,7 +1332,7 @@ static struct tevent_req *cli_cifs_rename_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname_src, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname_src)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -1558,7 +1558,7 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname_src, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname_src)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -2009,7 +2009,7 @@ struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -2141,7 +2141,7 @@ struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(dname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(dname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -2280,7 +2280,7 @@ struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(dname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(dname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -2549,7 +2549,7 @@ static struct tevent_req *cli_ntcreate1_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -2896,7 +2896,7 @@ struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -3136,7 +3136,7 @@ struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -4363,7 +4363,7 @@ struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -4676,7 +4676,7 @@ struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -4836,7 +4836,7 @@ struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(fname)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -5182,7 +5182,7 @@ struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(path, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(path)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -6574,7 +6574,7 @@ struct tevent_req *cli_qpathinfo_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(fname, NULL, NULL, NULL) && + if (clistr_is_previous_version_path(fname) && !INFO_LEVEL_IS_UNIX(level)) { additional_flags2 = FLAGS2_REPARSE_PATH; } diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index c41ba93cd25..903c5d22777 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -700,7 +700,7 @@ static struct tevent_req *cli_list_trans_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (clistr_is_previous_version_path(state->mask, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(state->mask)) { additional_flags2 = FLAGS2_REPARSE_PATH; } @@ -901,7 +901,7 @@ static void cli_list_trans_done(struct tevent_req *subreq) } param_len = talloc_get_size(state->param); - if (clistr_is_previous_version_path(state->mask, NULL, NULL, NULL)) { + if (clistr_is_previous_version_path(state->mask)) { additional_flags2 = FLAGS2_REPARSE_PATH; }