source4/torture/raw: Fix prototypes for all functions.
[gd/samba-autobuild/.git] / source4 / torture / raw / chkpath.c
1 /* 
2    Unix SMB/CIFS implementation.
3    chkpath individual test suite
4    Copyright (C) Andrew Tridgell 2003
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "includes.h"
21 #include "system/locale.h"
22 #include "libcli/raw/libcliraw.h"
23 #include "libcli/libcli.h"
24 #include "torture/util.h"
25 #include "torture/raw/proto.h"
26
27 #define BASEDIR "\\rawchkpath"
28
29 #define CHECK_STATUS(status, correct, dos_correct) do { \
30         if (!NT_STATUS_EQUAL(status, correct) && !NT_STATUS_EQUAL(status, dos_correct)) { \
31                 printf("(%d) Incorrect status %s - should be %s\n", \
32                        __LINE__, nt_errstr(status), nt_errstr(correct)); \
33                 ret = false; \
34                 goto done; \
35         }} while (0)
36
37
38 static NTSTATUS single_search(struct smbcli_state *cli,
39                               TALLOC_CTX *mem_ctx, const char *pattern)
40 {
41         union smb_search_first io;
42         NTSTATUS status;
43
44         io.t2ffirst.level = RAW_SEARCH_TRANS2;
45         io.t2ffirst.data_level = RAW_SEARCH_DATA_STANDARD;
46         io.t2ffirst.in.search_attrib = 0;
47         io.t2ffirst.in.max_count = 1;
48         io.t2ffirst.in.flags = FLAG_TRANS2_FIND_CLOSE;
49         io.t2ffirst.in.storage_type = 0;
50         io.t2ffirst.in.pattern = pattern;
51
52         status = smb_raw_search_first(cli->tree, mem_ctx,
53                                       &io, NULL, NULL);
54
55         return status;
56 }
57
58 static bool test_path_ex(struct smbcli_state *cli, struct torture_context *tctx,
59                          const char *path, const char *path_expected,
60                          NTSTATUS expected, NTSTATUS dos_expected)
61 {
62         union smb_chkpath io;
63         union smb_fileinfo finfo;
64         NTSTATUS status;
65
66         io.chkpath.in.path = path;
67         status = smb_raw_chkpath(cli->tree, &io);
68         if (!NT_STATUS_EQUAL(status, expected) && !NT_STATUS_EQUAL(status, dos_expected)) {
69                 printf("FAILED %-30s chkpath %s should be %s or %s\n",
70                        path, nt_errstr(status), nt_errstr(expected), nt_errstr(dos_expected));
71                 return false;
72         } else {
73                 printf("%-30s chkpath correct (%s)\n", path, nt_errstr(status));
74         }
75
76         if (NT_STATUS_EQUAL(expected, NT_STATUS_NOT_A_DIRECTORY)) {
77                 expected = NT_STATUS_OK;
78         }
79
80         ZERO_STRUCT(finfo);
81         finfo.generic.level = RAW_FILEINFO_NAME_INFO;
82         finfo.generic.in.file.path = path;
83         status = smb_raw_pathinfo(cli->tree, cli, &finfo);
84         if (!NT_STATUS_EQUAL(status, expected) && !NT_STATUS_EQUAL(status, dos_expected)) {
85                 printf("FAILED: %-30s pathinfo %s should be %s or %s\n",
86                        path, nt_errstr(status), nt_errstr(expected), nt_errstr(dos_expected));
87                 return false;
88         }
89
90         if (!NT_STATUS_IS_OK(status)) {
91                 printf("%-30s chkpath correct (%s)\n", path, nt_errstr(status));
92                 return true;
93         }
94
95         if (path_expected &&
96             (!finfo.name_info.out.fname.s ||
97              strcmp(finfo.name_info.out.fname.s, path_expected) != 0)) {
98                 if (tctx && torture_setting_bool(tctx, "samba4", false)) {
99                         printf("IGNORE: %-30s => %-20s should be %s\n",
100                                 path, finfo.name_info.out.fname.s, path_expected);
101                         return true;
102                 }
103                 printf("FAILED: %-30s => %-20s should be %s\n",
104                         path, finfo.name_info.out.fname.s, path_expected);
105                 return false;
106         }
107         printf("%-30s => %-20s correct\n",
108                 path, finfo.name_info.out.fname.s);
109
110         return true;
111 }
112
113 static bool test_path(struct smbcli_state *cli, const char *path,
114                       NTSTATUS expected, NTSTATUS dos_expected)
115 {
116         return test_path_ex(cli, NULL, path, path, expected, dos_expected);
117 }
118
119 static bool test_chkpath(struct smbcli_state *cli, struct torture_context *tctx)
120 {
121         union smb_chkpath io;
122         NTSTATUS status;
123         bool ret = true;
124         int fnum = -1;
125         int fnum1 = -1;
126
127         io.chkpath.in.path = BASEDIR;
128
129         status = smb_raw_chkpath(cli->tree, &io);
130         CHECK_STATUS(status, NT_STATUS_OK, NT_STATUS_OK);
131
132         ret &= test_path(cli, BASEDIR "\\nodir", NT_STATUS_OBJECT_NAME_NOT_FOUND, NT_STATUS_DOS(ERRDOS,ERRbadpath));
133
134         fnum = create_complex_file(cli, tctx, BASEDIR "\\test.txt..");
135         if (fnum == -1) {
136                 printf("failed to open test.txt - %s\n", smbcli_errstr(cli->tree));
137                 ret = false;
138                 goto done;
139         }
140
141         ret &= test_path(cli, BASEDIR "\\test.txt..", NT_STATUS_NOT_A_DIRECTORY, NT_STATUS_DOS(ERRDOS,ERRbadpath));
142         
143         if (!torture_set_file_attribute(cli->tree, BASEDIR, FILE_ATTRIBUTE_HIDDEN)) {
144                 printf("failed to set basedir hidden\n");
145                 ret = false;
146                 goto done;
147         }
148
149         ret &= test_path_ex(cli, tctx, BASEDIR, BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
150         ret &= test_path_ex(cli, tctx, ((const char *)BASEDIR) + 1, BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
151         ret &= test_path_ex(cli, tctx, ((const char *)BASEDIR"\\\\") + 1, BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
152         ret &= test_path_ex(cli, tctx, ((const char *)BASEDIR"\\foo\\..") + 1, BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
153         ret &= test_path_ex(cli, tctx, ((const char *)BASEDIR"\\f\\o\\o\\..\\..\\..") + 1, BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
154         ret &= test_path_ex(cli, tctx, ((const char *)BASEDIR"\\foo\\\\..\\\\") + 1, BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
155         ret &= test_path_ex(cli, tctx, BASEDIR"\\", BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
156         ret &= test_path_ex(cli, tctx, BASEDIR"\\\\..\\"BASEDIR, BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
157         ret &= test_path_ex(cli, tctx, BASEDIR"\\\\\\", BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
158         ret &= test_path_ex(cli, tctx, "\\\\\\\\"BASEDIR"\\\\\\\\", BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
159         ret &= test_path_ex(cli, tctx, "\\\\\\\\"BASEDIR, BASEDIR, NT_STATUS_OK, NT_STATUS_OK);
160         ret &= test_path_ex(cli, tctx, BASEDIR "\\foo\\..\\test.txt..", BASEDIR "\\test.txt..",
161                             NT_STATUS_NOT_A_DIRECTORY, NT_STATUS_DOS(ERRDOS,ERRbadpath));
162         ret &= test_path_ex(cli, tctx, "", "\\", NT_STATUS_OK, NT_STATUS_OK);
163         ret &= test_path(cli, ".", NT_STATUS_OBJECT_NAME_INVALID, NT_STATUS_DOS(ERRDOS,ERRbadpath));
164         ret &= test_path(cli, ".\\", NT_STATUS_OBJECT_NAME_INVALID, NT_STATUS_DOS(ERRDOS,ERRbadpath));
165         ret &= test_path(cli, "\\\\\\.\\", NT_STATUS_OBJECT_NAME_INVALID, NT_STATUS_DOS(ERRDOS,ERRbadpath));
166         ret &= test_path(cli, ".\\.", NT_STATUS_OBJECT_PATH_NOT_FOUND, NT_STATUS_DOS(ERRDOS,ERRbadpath));
167         ret &= test_path(cli, "." BASEDIR, NT_STATUS_OBJECT_PATH_NOT_FOUND, NT_STATUS_DOS(ERRDOS,ERRbadpath));
168         ret &= test_path(cli, BASEDIR "\\.", NT_STATUS_OBJECT_NAME_INVALID, NT_STATUS_DOS(ERRDOS,ERRbadpath));
169         ret &= test_path(cli, BASEDIR "\\.\\test.txt..", NT_STATUS_OBJECT_PATH_NOT_FOUND, NT_STATUS_DOS(ERRDOS,ERRbadpath));
170         ret &= test_path(cli, ".\\.\\", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
171         ret &= test_path(cli, ".\\.\\.", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
172         ret &= test_path(cli, ".\\.\\.aaaaa", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
173         ret &= test_path(cli, "\\.\\", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
174         ret &= test_path(cli, "\\.\\\\", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
175         ret &= test_path(cli, "\\.\\\\\\\\\\\\", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
176
177         /* Note that the two following paths are identical but
178           give different NT status returns for chkpth and findfirst. */
179
180         printf("Testing findfirst on %s\n", "\\.\\\\\\\\\\\\.");
181         status = single_search(cli, tctx, "\\.\\\\\\\\\\\\.");
182         CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRinvalidname));
183
184         ret &= test_path(cli, "\\.\\\\\\\\\\\\.", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
185
186         /* We expect this open to fail with the same error code as the chkpath below. */
187         printf("Testing Open on %s\n", "\\.\\\\\\\\\\\\.");
188         /* findfirst seems to fail with a different error. */
189         fnum1 = smbcli_nt_create_full(cli->tree, "\\.\\\\\\\\\\\\.",
190                                       0, SEC_RIGHTS_FILE_ALL,
191                                       FILE_ATTRIBUTE_NORMAL,
192                                       NTCREATEX_SHARE_ACCESS_DELETE|
193                                       NTCREATEX_SHARE_ACCESS_READ|
194                                       NTCREATEX_SHARE_ACCESS_WRITE,
195                                       NTCREATEX_DISP_OVERWRITE_IF,
196                                       0, 0);
197         status = smbcli_nt_error(cli->tree);
198         CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
199
200
201         ret &= test_path(cli, "\\.\\\\xxx", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
202         ret &= test_path(cli, "..\\..\\..", NT_STATUS_OBJECT_PATH_SYNTAX_BAD,NT_STATUS_DOS(ERRDOS,ERRinvalidpath));
203         ret &= test_path(cli, "\\..", NT_STATUS_OBJECT_PATH_SYNTAX_BAD,NT_STATUS_DOS(ERRDOS,ERRinvalidpath));
204         ret &= test_path(cli, "\\.\\\\\\\\\\\\xxx", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
205         ret &= test_path(cli, BASEDIR"\\.\\", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
206         ret &= test_path(cli, BASEDIR"\\.\\\\", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
207         ret &= test_path(cli, BASEDIR"\\.\\nt", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
208         ret &= test_path(cli, BASEDIR"\\.\\.\\nt", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
209         ret &= test_path(cli, BASEDIR"\\nt", NT_STATUS_OK, NT_STATUS_OK);
210         ret &= test_path(cli, BASEDIR".\\foo", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
211         ret &= test_path(cli, BASEDIR"xx\\foo", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
212         ret &= test_path(cli, ".\\", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
213         ret &= test_path(cli, ".\\.", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
214         ret &= test_path(cli, ".\\.\\.\\.\\foo\\.\\.\\", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
215         ret &= test_path(cli, BASEDIR".\\.\\.\\.\\foo\\.\\.\\", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
216         ret &= test_path(cli, BASEDIR".\\.\\.\\.\\foo\\..\\.\\", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
217         ret &= test_path(cli, BASEDIR".", NT_STATUS_OBJECT_NAME_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
218         ret &= test_path(cli, "\\", NT_STATUS_OK,NT_STATUS_OK);
219         ret &= test_path(cli, "\\.", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
220         ret &= test_path(cli, "\\..\\", NT_STATUS_OBJECT_PATH_SYNTAX_BAD,NT_STATUS_DOS(ERRDOS,ERRinvalidpath));
221         ret &= test_path(cli, "\\..", NT_STATUS_OBJECT_PATH_SYNTAX_BAD,NT_STATUS_DOS(ERRDOS,ERRinvalidpath));
222         ret &= test_path(cli, BASEDIR "\\.", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
223         ret &= test_path_ex(cli, tctx, BASEDIR "\\..", "\\", NT_STATUS_OK,NT_STATUS_OK);
224         ret &= test_path(cli, BASEDIR "\\nt\\V S\\VB98\\vb600", NT_STATUS_OBJECT_NAME_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
225         ret &= test_path(cli, BASEDIR "\\nt\\V S\\VB98\\vb6.exe", NT_STATUS_NOT_A_DIRECTORY,NT_STATUS_DOS(ERRDOS,ERRbadpath));
226
227         /* We expect this open to fail with the same error code as the chkpath below. */
228         printf("Testing Open on %s\n", BASEDIR".\\.\\.\\.\\foo\\..\\.\\");
229         /* findfirst seems to fail with a different error. */
230         fnum1 = smbcli_nt_create_full(cli->tree, BASEDIR".\\.\\.\\.\\foo\\..\\.\\",
231                                       0, SEC_RIGHTS_FILE_ALL,
232                                       FILE_ATTRIBUTE_NORMAL,
233                                       NTCREATEX_SHARE_ACCESS_DELETE|
234                                       NTCREATEX_SHARE_ACCESS_READ|
235                                       NTCREATEX_SHARE_ACCESS_WRITE,
236                                       NTCREATEX_DISP_OVERWRITE_IF,
237                                       0, 0);
238         status = smbcli_nt_error(cli->tree);
239         CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
240
241         printf("Testing findfirst on %s\n", BASEDIR".\\.\\.\\.\\foo\\..\\.\\");
242         status = single_search(cli, tctx, BASEDIR".\\.\\.\\.\\foo\\..\\.\\");
243         CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
244
245         /* We expect this open to fail with the same error code as the chkpath below. */
246         /* findfirst seems to fail with a different error. */
247         printf("Testing Open on %s\n", BASEDIR "\\nt\\V S\\VB98\\vb6.exe\\3");
248         fnum1 = smbcli_nt_create_full(cli->tree, BASEDIR "\\nt\\V S\\VB98\\vb6.exe\\3",
249                                       0, SEC_RIGHTS_FILE_ALL,
250                                       FILE_ATTRIBUTE_NORMAL,
251                                       NTCREATEX_SHARE_ACCESS_DELETE|
252                                       NTCREATEX_SHARE_ACCESS_READ|
253                                       NTCREATEX_SHARE_ACCESS_WRITE,
254                                       NTCREATEX_DISP_OVERWRITE_IF,
255                                       0, 0);
256         status = smbcli_nt_error(cli->tree);
257         CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
258
259         ret &= test_path(cli, BASEDIR "\\nt\\V S\\VB98\\vb6.exe\\3", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
260         ret &= test_path(cli, BASEDIR "\\nt\\V S\\VB98\\vb6.exe\\3\\foo", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
261         ret &= test_path(cli, BASEDIR "\\nt\\3\\foo", NT_STATUS_OBJECT_PATH_NOT_FOUND,NT_STATUS_DOS(ERRDOS,ERRbadpath));
262         ret &= test_path(cli, BASEDIR "\\nt\\V S\\*\\vb6.exe\\3", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
263         ret &= test_path(cli, BASEDIR "\\nt\\V S\\*\\*\\vb6.exe\\3", NT_STATUS_OBJECT_NAME_INVALID,NT_STATUS_DOS(ERRDOS,ERRbadpath));
264
265 done:
266         smbcli_close(cli->tree, fnum);
267         return ret;
268 }
269
270 static bool test_chkpath_names(struct smbcli_state *cli, struct torture_context *tctx)
271 {
272         union smb_chkpath io;
273         union smb_fileinfo finfo;
274         NTSTATUS status;
275         bool ret = true;
276         uint8_t i;
277
278         /*
279          * we don't test characters >= 0x80 yet,
280          * as somehow our client libraries can't do that
281          */
282         for (i=0x01; i <= 0x7F; i++) {
283                 /*
284                  * it's important that we test the last character
285                  * because of the error code with ':' 0x3A
286                  * and servers without stream support
287                  */
288                 char *path = talloc_asprintf(tctx, "%s\\File0x%02X%c",
289                                              BASEDIR, i, i);
290                 NTSTATUS expected;
291                 NTSTATUS expected_dos1;
292                 NTSTATUS expected_dos2;
293
294                 expected = NT_STATUS_OBJECT_NAME_NOT_FOUND;
295                 expected_dos1 = NT_STATUS_DOS(ERRDOS,ERRbadpath);
296                 expected_dos2 = NT_STATUS_DOS(ERRDOS,ERRbadfile);
297
298                 switch (i) {
299                 case '"':/*0x22*/
300                 case '*':/*0x2A*/
301                 case '/':/*0x2F*/
302                 case ':':/*0x3A*/
303                 case '<':/*0x3C*/
304                 case '>':/*0x3E*/
305                 case '?':/*0x3F*/
306                 case '|':/*0x7C*/
307                         if (i == '/' &&
308                             torture_setting_bool(tctx, "samba3", false)) {
309                                 /* samba 3 handles '/' as '\\' */
310                                 break;
311                         }
312                         expected = NT_STATUS_OBJECT_NAME_INVALID;
313                         expected_dos1 = NT_STATUS_DOS(ERRDOS,ERRbadpath);
314                         expected_dos2 = NT_STATUS_DOS(ERRDOS,ERRinvalidname);
315                         break;
316                 default:
317                         if (i <= 0x1F) {
318                                 expected = NT_STATUS_OBJECT_NAME_INVALID;
319                                 expected_dos1 = NT_STATUS_DOS(ERRDOS,ERRbadpath);
320                                 expected_dos2 = NT_STATUS_DOS(ERRDOS,ERRinvalidname);
321                         }
322                         break;
323                 }
324
325                 printf("Checking File0x%02X%c%s expected[%s|%s|%s]\n",
326                        i, isprint(i)?(char)i:' ',
327                        isprint(i)?"":"(not printable)",
328                        nt_errstr(expected),
329                        nt_errstr(expected_dos1),
330                        nt_errstr(expected_dos2));
331
332                 io.chkpath.in.path = path;
333                 status = smb_raw_chkpath(cli->tree, &io);
334                 CHECK_STATUS(status, expected, expected_dos1);
335
336                 ZERO_STRUCT(finfo);
337                 finfo.generic.level = RAW_FILEINFO_NAME_INFO;
338                 finfo.generic.in.file.path = path;
339                 status = smb_raw_pathinfo(cli->tree, cli, &finfo);
340                 CHECK_STATUS(status, expected, expected_dos2);
341
342                 talloc_free(path);
343         }
344
345 done:
346         return ret;
347 }
348
349 /* 
350    basic testing of chkpath calls 
351 */
352 bool torture_raw_chkpath(struct torture_context *torture, 
353                          struct smbcli_state *cli)
354 {
355         bool ret = true;
356         int fnum;
357
358         if (!torture_setup_dir(cli, BASEDIR)) {
359                 return false;
360         }
361
362         if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt"))) {
363                 printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
364                 return false;
365         }
366
367         if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt\\V S"))) {
368                 printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
369                 return false;
370         }
371
372         if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt\\V S\\VB98"))) {
373                 printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
374                 return false;
375         }
376
377         fnum = create_complex_file(cli, torture, BASEDIR "\\nt\\V S\\VB98\\vb6.exe");
378         if (fnum == -1) {
379                 printf("failed to open \\nt\\V S\\VB98\\vb6.exe - %s\n", smbcli_errstr(cli->tree));
380                 ret = false;
381                 goto done;
382         }
383
384         ret &= test_chkpath(cli, torture);
385         ret &= test_chkpath_names(cli, torture);
386
387  done:
388
389         smb_raw_exit(cli->session);
390         smbcli_deltree(cli->tree, BASEDIR);
391
392         return ret;
393 }