From: Volker Lendecke Date: Wed, 14 Oct 2020 05:09:13 +0000 (+0200) Subject: libsmb: Simplify cli_resolve_path() X-Git-Tag: talloc-2.3.2~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d845e90e0e30d6a0fcee320abf2e8dc49951acff;p=thirdparty%2Fsamba.git libsmb: Simplify cli_resolve_path() The additional conditions in cli_dfs_check_error() were covered earlier in cli_resolve_path() via cli_conn_have_dfs(). Without those it's more obvious to directly call NT_STATUS_EQUAL here. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index b4659593fa6..081de18ac76 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -603,27 +603,6 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx, dir); } -/******************************************************************** - check for dfs referral -********************************************************************/ - -static bool cli_dfs_check_error(struct cli_state *cli, NTSTATUS expected, - NTSTATUS status) -{ - /* only deal with DFS when we negotiated NT_STATUS codes and UNICODE */ - - if (!(smbXcli_conn_use_unicode(cli->conn))) { - return false; - } - if (!(smb1cli_conn_capabilities(cli->conn) & CAP_STATUS32)) { - return false; - } - if (NT_STATUS_EQUAL(status, expected)) { - return true; - } - return false; -} - /******************************************************************** Get the dfs referral link. ********************************************************************/ @@ -950,8 +929,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx, /* Special case where client asked for a path that does not exist */ - if (cli_dfs_check_error(rootcli, NT_STATUS_OBJECT_NAME_NOT_FOUND, - status)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { *targetcli = rootcli; *pp_targetpath = talloc_strdup(ctx, path); if (!*pp_targetpath) { @@ -962,8 +940,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx, /* We got an error, check for DFS referral. */ - if (!cli_dfs_check_error(rootcli, NT_STATUS_PATH_NOT_COVERED, - status)) { + if (!NT_STATUS_EQUAL(status, NT_STATUS_PATH_NOT_COVERED)) { return status; }