]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Simplify cli_resolve_path()
authorVolker Lendecke <vl@samba.org>
Wed, 14 Oct 2020 05:09:13 +0000 (07:09 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 21 Oct 2020 19:04:39 +0000 (19:04 +0000)
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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/clidfs.c

index b4659593fa671e257c038f9e5838e2ef63090279..081de18ac76c8890b962e42899ea3e152df4a232 100644 (file)
@@ -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;
        }