[Bug 6228] SMBC_open_ctx failure due to path resolve failure doesn't set errno
[samba.git] / source3 / libsmb / libsmb_dir.c
index 56661af70b02b37493b3f3c96077829c43106218..219bbe64e120bf369174fcfe75ef6e170157de7f 100644 (file)
@@ -770,8 +770,9 @@ SMBC_opendir_ctx(SMBCCTX *context,
                                return NULL;
                        }
 
-                       if (!cli_resolve_path(frame, "", srv->cli, path,
-                                              &targetcli, &targetpath)) {
+                       if (!cli_resolve_path(frame, "", context->internal->auth_info,
+                                               srv->cli, path,
+                                               &targetcli, &targetpath)) {
                                d_printf("Could not resolve %s\n", path);
                                if (dir) {
                                        SAFE_FREE(dir->fname);
@@ -1166,10 +1167,12 @@ SMBC_mkdir_ctx(SMBCCTX *context,
        }
 
        /*d_printf(">>>mkdir: resolving %s\n", path);*/
-       if (!cli_resolve_path(frame, "", srv->cli, path,
-                              &targetcli, &targetpath)) {
+       if (!cli_resolve_path(frame, "", context->internal->auth_info,
+                               srv->cli, path,
+                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
-               TALLOC_FREE(frame);
+                errno = ENOENT;
+                TALLOC_FREE(frame);
                return -1;
        }
        /*d_printf(">>>mkdir: resolved path as %s\n", targetpath);*/
@@ -1272,9 +1275,11 @@ SMBC_rmdir_ctx(SMBCCTX *context,
        }
 
        /*d_printf(">>>rmdir: resolving %s\n", path);*/
-       if (!cli_resolve_path(frame, "", srv->cli, path,
-                              &targetcli, &targetpath)) {
+       if (!cli_resolve_path(frame, "", context->internal->auth_info,
+                               srv->cli, path,
+                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1554,9 +1559,11 @@ SMBC_chmod_ctx(SMBCCTX *context,
        }
        
        /*d_printf(">>>unlink: resolving %s\n", path);*/
-       if (!cli_resolve_path(frame, "", srv->cli, path,
-                              &targetcli, &targetpath)) {
+       if (!cli_resolve_path(frame, "", context->internal->auth_info,
+                               srv->cli, path,
+                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1745,9 +1752,11 @@ SMBC_unlink_ctx(SMBCCTX *context,
        }
 
        /*d_printf(">>>unlink: resolving %s\n", path);*/
-       if (!cli_resolve_path(frame, "", srv->cli, path,
-                              &targetcli, &targetpath)) {
+       if (!cli_resolve_path(frame, "", context->internal->auth_info,
+                               srv->cli, path,
+                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1917,9 +1926,12 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
                                           password1);
 
        /*d_printf(">>>rename: resolving %s\n", path1);*/
-       if (!cli_resolve_path(frame, "", srv->cli, path1,
-                              &targetcli1, &targetpath1)) {
+       if (!cli_resolve_path(frame, "", ocontext->internal->auth_info,
+                               srv->cli,
+                               path1,
+                               &targetcli1, &targetpath1)) {
                d_printf("Could not resolve %s\n", path1);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1932,9 +1944,12 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
        
        /*d_printf(">>>rename: resolved path as %s\n", targetpath1);*/
        /*d_printf(">>>rename: resolving %s\n", path2);*/
-       if (!cli_resolve_path(frame, "", srv->cli, path2,
-                              &targetcli2, &targetpath2)) {
+       if (!cli_resolve_path(frame, "", ncontext->internal->auth_info,
+                               srv->cli, 
+                               path2,
+                               &targetcli2, &targetpath2)) {
                d_printf("Could not resolve %s\n", path2);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }