s3: cli_dfs_check_error does not need to depend on cli->inbuf
authorVolker Lendecke <vl@samba.org>
Thu, 11 Nov 2010 13:46:58 +0000 (14:46 +0100)
committerVolker Lendecke <vlendec@samba.org>
Thu, 11 Nov 2010 16:16:24 +0000 (16:16 +0000)
source3/libsmb/clidfs.c

index 26c2a4a6bbca981b3dbfa3f007e8e011eeba7152..97c1e0407cc8a367d14dfcbd9a946c27ee63f10b 100644 (file)
@@ -597,19 +597,20 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx,
  check for dfs referral
 ********************************************************************/
 
-static bool cli_dfs_check_error( struct cli_state *cli, NTSTATUS status )
+static bool cli_dfs_check_error(struct cli_state *cli, NTSTATUS expected,
+                               NTSTATUS status)
 {
-       uint32 flgs2 = SVAL(cli->inbuf,smb_flg2);
-
        /* only deal with DS when we negotiated NT_STATUS codes and UNICODE */
 
-       if (!((flgs2&FLAGS2_32_BIT_ERROR_CODES) &&
-                               (flgs2&FLAGS2_UNICODE_STRINGS)))
+       if (!(cli->capabilities & CAP_UNICODE)) {
                return false;
-
-       if (NT_STATUS_EQUAL(status, NT_STATUS(IVAL(cli->inbuf,smb_rcls))))
+       }
+       if (!(cli->capabilities & CAP_STATUS32)) {
+               return false;
+       }
+       if (NT_STATUS_EQUAL(status, expected)) {
                return true;
-
+       }
        return false;
 }
 
@@ -834,7 +835,8 @@ bool 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)) {
+       if (cli_dfs_check_error(rootcli, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+                               status)) {
                *targetcli = rootcli;
                *pp_targetpath = talloc_strdup(ctx, path);
                if (!*pp_targetpath) {
@@ -845,7 +847,8 @@ bool 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)) {
+       if (!cli_dfs_check_error(rootcli, NT_STATUS_PATH_NOT_COVERED,
+                                status)) {
                return false;
        }