2 Unix SMB/CIFS implementation.
3 filename handling routines
4 Copyright (C) Andrew Tridgell 1992-1998
5 Copyright (C) Jeremy Allison 1999-2007
6 Copyright (C) Ying Chen 2000
7 Copyright (C) Volker Lendecke 2007
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * New hash table stat cache code added by Ying Chen.
29 static NTSTATUS
build_stream_path(TALLOC_CTX
*mem_ctx
,
30 connection_struct
*conn
,
31 const char *orig_path
,
33 const char *streamname
,
36 static int get_real_filename_mangled(connection_struct
*conn
, const char *path
,
37 const char *name
, TALLOC_CTX
*mem_ctx
,
39 static int get_real_filename_internal(connection_struct
*conn
,
40 const char *path
, const char *name
,
42 TALLOC_CTX
*mem_ctx
, char **found_name
);
44 /****************************************************************************
45 Mangle the 2nd name and check if it is then equal to the first name.
46 ****************************************************************************/
48 static bool mangled_equal(const char *name1
,
50 const struct share_params
*p
)
54 if (!name_to_8_3(name2
, mname
, False
, p
)) {
57 return strequal(name1
, mname
);
60 /****************************************************************************
61 Cope with the differing wildcard and non-wildcard error cases.
62 ****************************************************************************/
64 static NTSTATUS
determine_path_error(const char *name
,
65 bool allow_wcard_last_component
)
69 if (!allow_wcard_last_component
) {
70 /* Error code within a pathname. */
71 return NT_STATUS_OBJECT_PATH_NOT_FOUND
;
74 /* We're terminating here so we
75 * can be a little slower and get
76 * the error code right. Windows
77 * treats the last part of the pathname
78 * separately I think, so if the last
79 * component is a wildcard then we treat
80 * this ./ as "end of component" */
82 p
= strchr(name
, '/');
84 if (!p
&& (ms_has_wild(name
) || ISDOT(name
))) {
85 /* Error code at the end of a pathname. */
86 return NT_STATUS_OBJECT_NAME_INVALID
;
88 /* Error code within a pathname. */
89 return NT_STATUS_OBJECT_PATH_NOT_FOUND
;
93 /****************************************************************************
94 This routine is called to convert names from the dos namespace to unix
95 namespace. It needs to handle any case conversions, mangling, format
98 We assume that we have already done a chdir() to the right "root" directory
101 The function will return an NTSTATUS error if some part of the name except for
102 the last part cannot be resolved, else NT_STATUS_OK.
104 Note NT_STATUS_OK doesn't mean the name exists or is valid, just that we didn't
105 get any fatal errors that should immediately terminate the calling
106 SMB processing whilst resolving.
108 If the saved_last_component != 0, then the unmodified last component
109 of the pathname is returned there. If saved_last_component == 0 then nothing
112 If last_component_wcard is true then a MS wildcard was detected and
113 should be allowed in the last component of the path only.
115 On exit from unix_convert, if *pst was not null, then the file stat
116 struct will be returned if the file exists and was found, if not this
117 stat struct will be filled with zeros (and this can be detected by checking
118 for nlinks = 0, which can never be true for any file).
119 ****************************************************************************/
121 NTSTATUS
unix_convert(TALLOC_CTX
*ctx
,
122 connection_struct
*conn
,
123 const char *orig_path
,
124 bool allow_wcard_last_component
,
126 char **pp_saved_last_component
,
127 SMB_STRUCT_STAT
*pst
)
131 char *dirpath
= NULL
;
134 bool component_was_mangled
= False
;
135 bool name_has_wildcard
= False
;
136 bool posix_pathnames
= false;
140 SET_STAT_INVALID(*pst
);
141 *pp_conv_path
= NULL
;
142 if(pp_saved_last_component
) {
143 *pp_saved_last_component
= NULL
;
147 /* we don't ever use the filenames on a printer share as a
148 filename - so don't convert them */
149 if (!(*pp_conv_path
= talloc_strdup(ctx
,orig_path
))) {
150 return NT_STATUS_NO_MEMORY
;
155 DEBUG(5, ("unix_convert called on file \"%s\"\n", orig_path
));
158 * Conversion to basic unix format is already done in
159 * check_path_syntax().
163 * Names must be relative to the root of the service - any leading /.
164 * and trailing /'s should have been trimmed by check_path_syntax().
168 SMB_ASSERT(*orig_path
!= '/');
172 * If we trimmed down to a single '\0' character
173 * then we should use the "." directory to avoid
174 * searching the cache, but not if we are in a
176 * As we know this is valid we can return true here.
180 if (!(name
= talloc_strdup(ctx
,"."))) {
181 return NT_STATUS_NO_MEMORY
;
183 if (SMB_VFS_STAT(conn
,name
,&st
) == 0) {
186 return map_nt_error_from_unix(errno
);
188 DEBUG(5,("conversion finished \"\" -> %s\n",name
));
192 if (orig_path
[0] == '.' && (orig_path
[1] == '/' ||
193 orig_path
[1] == '\0')) {
194 /* Start of pathname can't be "." only. */
195 if (orig_path
[1] == '\0' || orig_path
[2] == '\0') {
196 result
= NT_STATUS_OBJECT_NAME_INVALID
;
198 result
=determine_path_error(
199 &orig_path
[2], allow_wcard_last_component
);
204 if (!(name
= talloc_strdup(ctx
, orig_path
))) {
205 DEBUG(0, ("talloc_strdup failed\n"));
206 return NT_STATUS_NO_MEMORY
;
210 * Large directory fix normalization. If we're case sensitive, and
211 * the case preserving parameters are set to "no", normalize the case of
212 * the incoming filename from the client WHETHER IT EXISTS OR NOT !
213 * This is in conflict with the current (3.0.20) man page, but is
214 * what people expect from the "large directory howto". I'll update
215 * the man page. Thanks to jht@samba.org for finding this. JRA.
218 if (conn
->case_sensitive
&& !conn
->case_preserve
&&
219 !conn
->short_case_preserve
) {
220 strnorm(name
, lp_defaultcase(SNUM(conn
)));
224 * Ensure saved_last_component is valid even if file exists.
227 if(pp_saved_last_component
) {
228 end
= strrchr_m(name
, '/');
230 *pp_saved_last_component
= talloc_strdup(ctx
, end
+ 1);
232 *pp_saved_last_component
= talloc_strdup(ctx
,
237 posix_pathnames
= lp_posix_pathnames();
239 if (!posix_pathnames
) {
240 stream
= strchr_m(name
, ':');
242 if (stream
!= NULL
) {
243 char *tmp
= talloc_strdup(ctx
, stream
);
246 return NT_STATUS_NO_MEMORY
;
255 /* If we're providing case insentive semantics or
256 * the underlying filesystem is case insensitive,
257 * then a case-normalized hit in the stat-cache is
258 * authoratitive. JRA.
261 if((!conn
->case_sensitive
|| !(conn
->fs_capabilities
& FILE_CASE_SENSITIVE_SEARCH
)) &&
262 stat_cache_lookup(conn
, &name
, &dirpath
, &start
, &st
)) {
268 * Make sure "dirpath" is an allocated string, we use this for
269 * building the directories with asprintf and free it.
272 if ((dirpath
== NULL
) && (!(dirpath
= talloc_strdup(ctx
,"")))) {
273 DEBUG(0, ("talloc_strdup failed\n"));
275 return NT_STATUS_NO_MEMORY
;
279 * stat the name - if it exists then we are all done!
282 if (posix_pathnames
) {
283 ret
= SMB_VFS_LSTAT(conn
,name
,&st
);
285 ret
= SMB_VFS_STAT(conn
,name
,&st
);
289 /* Ensure we catch all names with in "/."
290 this is disallowed under Windows. */
291 const char *p
= strstr(name
, "/."); /* mb safe. */
294 /* Error code within a pathname. */
295 result
= NT_STATUS_OBJECT_PATH_NOT_FOUND
;
297 } else if (p
[2] == '\0') {
298 /* Error code at the end of a pathname. */
299 result
= NT_STATUS_OBJECT_NAME_INVALID
;
303 stat_cache_add(orig_path
, name
, conn
->case_sensitive
);
304 DEBUG(5,("conversion finished %s -> %s\n",orig_path
, name
));
309 DEBUG(5,("unix_convert begin: name = %s, dirpath = %s, start = %s\n",
310 name
, dirpath
, start
));
313 * A special case - if we don't have any mangling chars and are case
314 * sensitive or the underlying filesystem is case insentive then searching
318 if ((conn
->case_sensitive
|| !(conn
->fs_capabilities
& FILE_CASE_SENSITIVE_SEARCH
)) &&
319 !mangle_is_mangled(name
, conn
->params
)) {
324 * is_mangled() was changed to look at an entire pathname, not
325 * just a component. JRA.
328 if (mangle_is_mangled(start
, conn
->params
)) {
329 component_was_mangled
= True
;
333 * Now we need to recursively match the name against the real
334 * directory structure.
338 * Match each part of the path name separately, trying the names
339 * as is first, then trying to scan the directory for matching names.
342 for (; start
; start
= (end
?end
+1:(char *)NULL
)) {
344 * Pinpoint the end of this section of the filename.
346 /* mb safe. '/' can't be in any encoded char. */
347 end
= strchr(start
, '/');
350 * Chop the name at this point.
356 if (pp_saved_last_component
) {
357 TALLOC_FREE(*pp_saved_last_component
);
358 *pp_saved_last_component
= talloc_strdup(ctx
,
359 end
? end
+ 1 : start
);
360 if (!*pp_saved_last_component
) {
361 DEBUG(0, ("talloc failed\n"));
362 return NT_STATUS_NO_MEMORY
;
366 /* The name cannot have a component of "." */
370 /* Error code at the end of a pathname. */
371 result
= NT_STATUS_OBJECT_NAME_INVALID
;
373 result
= determine_path_error(end
+1,
374 allow_wcard_last_component
);
379 /* The name cannot have a wildcard if it's not
380 the last component. */
382 name_has_wildcard
= ms_has_wild(start
);
384 /* Wildcard not valid anywhere. */
385 if (name_has_wildcard
&& !allow_wcard_last_component
) {
386 result
= NT_STATUS_OBJECT_NAME_INVALID
;
390 /* Wildcards never valid within a pathname. */
391 if (name_has_wildcard
&& end
) {
392 result
= NT_STATUS_OBJECT_NAME_INVALID
;
397 * Check if the name exists up to this point.
400 if (posix_pathnames
) {
401 ret
= SMB_VFS_LSTAT(conn
,name
, &st
);
403 ret
= SMB_VFS_STAT(conn
,name
, &st
);
408 * It exists. it must either be a directory or this must
409 * be the last part of the path for it to be OK.
411 if (end
&& !(st
.st_mode
& S_IFDIR
)) {
413 * An intermediate part of the name isn't
416 DEBUG(5,("Not a dir %s\n",start
));
419 * We need to return the fact that the
420 * intermediate name resolution failed. This
421 * is used to return an error of ERRbadpath
422 * rather than ERRbadfile. Some Windows
423 * applications depend on the difference between
426 result
= NT_STATUS_OBJECT_PATH_NOT_FOUND
;
432 * We just scanned for, and found the end of
433 * the path. We must return the valid stat
441 char *found_name
= NULL
;
443 /* Stat failed - ensure we don't use it. */
444 SET_STAT_INVALID(st
);
447 * Reset errno so we can detect
448 * directory open errors.
453 * Try to find this part of the path in the directory.
456 if (name_has_wildcard
||
457 (get_real_filename_mangled(
458 conn
, dirpath
, start
,
459 talloc_tos(), &found_name
) == -1)) {
464 * An intermediate part of the name
467 DEBUG(5,("Intermediate not found %s\n",
472 * We need to return the fact that the
473 * intermediate name resolution failed.
474 * This is used to return an error of
475 * ERRbadpath rather than ERRbadfile.
476 * Some Windows applications depend on
477 * the difference between these two
482 * ENOENT, ENOTDIR and ELOOP all map
483 * to NT_STATUS_OBJECT_PATH_NOT_FOUND
484 * in the filename walk.
487 if (errno
== ENOENT
||
491 NT_STATUS_OBJECT_PATH_NOT_FOUND
;
495 map_nt_error_from_unix(errno
);
501 * ENOENT/EACCESS are the only valid errors
502 * here. EACCESS needs handling here for
503 * "dropboxes", i.e. directories where users
504 * can only put stuff with permission -wx.
506 if ((errno
!= 0) && (errno
!= ENOENT
)
507 && (errno
!= EACCES
)) {
509 * ENOTDIR and ELOOP both map to
510 * NT_STATUS_OBJECT_PATH_NOT_FOUND
511 * in the filename walk.
513 if (errno
== ENOTDIR
||
516 NT_STATUS_OBJECT_PATH_NOT_FOUND
;
519 map_nt_error_from_unix(errno
);
525 * Just the last part of the name doesn't exist.
526 * We need to strupper() or strlower() it as
527 * this conversion may be used for file creation
528 * purposes. Fix inspired by
529 * Thomas Neumann <t.neumann@iku-ag.de>.
531 if (!conn
->case_preserve
||
532 (mangle_is_8_3(start
, False
,
534 !conn
->short_case_preserve
)) {
536 lp_defaultcase(SNUM(conn
)));
540 * check on the mangled stack to see if we can
541 * recover the base of the filename.
544 if (mangle_is_mangled(start
, conn
->params
)
545 && mangle_lookup_name_from_8_3(ctx
,
550 size_t start_ofs
= start
- name
;
552 if (*dirpath
!= '\0') {
553 tmp
= talloc_asprintf(ctx
,
556 TALLOC_FREE(unmangled
);
562 DEBUG(0, ("talloc failed\n"));
563 return NT_STATUS_NO_MEMORY
;
567 start
= name
+ start_ofs
;
568 end
= start
+ strlen(start
);
571 DEBUG(5,("New file %s\n",start
));
577 * Restore the rest of the string. If the string was
578 * mangled the size may have changed.
582 size_t start_ofs
= start
- name
;
584 if (*dirpath
!= '\0') {
585 tmp
= talloc_asprintf(ctx
,
590 tmp
= talloc_asprintf(ctx
,
595 DEBUG(0, ("talloc_asprintf failed\n"));
596 return NT_STATUS_NO_MEMORY
;
600 start
= name
+ start_ofs
;
601 end
= start
+ strlen(found_name
);
605 size_t start_ofs
= start
- name
;
607 if (*dirpath
!= '\0') {
608 tmp
= talloc_asprintf(ctx
,
612 tmp
= talloc_strdup(ctx
,
616 DEBUG(0, ("talloc failed\n"));
617 return NT_STATUS_NO_MEMORY
;
621 start
= name
+ start_ofs
;
624 * We just scanned for, and found the end of
625 * the path. We must return a valid stat struct
629 if (posix_pathnames
) {
630 ret
= SMB_VFS_LSTAT(conn
,name
, &st
);
632 ret
= SMB_VFS_STAT(conn
,name
, &st
);
638 SET_STAT_INVALID(st
);
642 TALLOC_FREE(found_name
);
648 * We should never provide different behaviors
649 * depending on DEVELOPER!!!
651 if (VALID_STAT(st
)) {
653 get_file_infos(vfs_file_id_from_sbuf(conn
, &st
),
654 &delete_pending
, NULL
);
655 if (delete_pending
) {
656 result
= NT_STATUS_DELETE_PENDING
;
663 * Add to the dirpath that we have resolved so far.
666 if (*dirpath
!= '\0') {
667 char *tmp
= talloc_asprintf(ctx
,
668 "%s/%s", dirpath
, start
);
670 DEBUG(0, ("talloc_asprintf failed\n"));
671 return NT_STATUS_NO_MEMORY
;
673 TALLOC_FREE(dirpath
);
677 TALLOC_FREE(dirpath
);
678 if (!(dirpath
= talloc_strdup(ctx
,start
))) {
679 DEBUG(0, ("talloc_strdup failed\n"));
680 return NT_STATUS_NO_MEMORY
;
685 * Don't cache a name with mangled or wildcard components
686 * as this can change the size.
689 if(!component_was_mangled
&& !name_has_wildcard
) {
690 stat_cache_add(orig_path
, dirpath
,
691 conn
->case_sensitive
);
695 * Restore the / that we wiped out earlier.
703 * Don't cache a name with mangled or wildcard components
704 * as this can change the size.
707 if(!component_was_mangled
&& !name_has_wildcard
) {
708 stat_cache_add(orig_path
, name
, conn
->case_sensitive
);
712 * The name has been resolved.
715 DEBUG(5,("conversion finished %s -> %s\n",orig_path
, name
));
718 if (stream
!= NULL
) {
721 result
= build_stream_path(ctx
, conn
, orig_path
, name
, stream
,
723 if (!NT_STATUS_IS_OK(result
)) {
727 DEBUG(10, ("build_stream_path returned %s\n", tmp
));
732 *pp_conv_path
= name
;
733 TALLOC_FREE(dirpath
);
736 DEBUG(10, ("dirpath = [%s] start = [%s]\n", dirpath
, start
));
737 if (*dirpath
!= '\0') {
738 *pp_conv_path
= talloc_asprintf(ctx
,
739 "%s/%s", dirpath
, start
);
741 *pp_conv_path
= talloc_strdup(ctx
, start
);
743 if (!*pp_conv_path
) {
744 DEBUG(0, ("talloc_asprintf failed\n"));
745 return NT_STATUS_NO_MEMORY
;
748 TALLOC_FREE(dirpath
);
752 /****************************************************************************
753 Check a filename - possibly calling check_reduced_name.
754 This is called by every routine before it allows an operation on a filename.
755 It does any final confirmation necessary to ensure that the filename is
756 a valid one for the user to access.
757 ****************************************************************************/
759 NTSTATUS
check_name(connection_struct
*conn
, const char *name
)
761 if (IS_VETO_PATH(conn
, name
)) {
762 /* Is it not dot or dot dot. */
763 if (!((name
[0] == '.') && (!name
[1] ||
764 (name
[1] == '.' && !name
[2])))) {
765 DEBUG(5,("check_name: file path name %s vetoed\n",
767 return map_nt_error_from_unix(ENOENT
);
771 if (!lp_widelinks(SNUM(conn
)) || !lp_symlinks(SNUM(conn
))) {
772 NTSTATUS status
= check_reduced_name(conn
,name
);
773 if (!NT_STATUS_IS_OK(status
)) {
774 DEBUG(5,("check_name: name %s failed with %s\n",name
,
783 /****************************************************************************
784 Check if two filenames are equal.
785 This needs to be careful about whether we are case sensitive.
786 ****************************************************************************/
788 static bool fname_equal(const char *name1
, const char *name2
,
791 /* Normal filename handling */
792 if (case_sensitive
) {
793 return(strcmp(name1
,name2
) == 0);
796 return(strequal(name1
,name2
));
799 /****************************************************************************
800 Scan a directory to find a filename, matching without case sensitivity.
801 If the name looks like a mangled name then try via the mangling functions
802 ****************************************************************************/
804 static int get_real_filename_mangled(connection_struct
*conn
, const char *path
,
805 const char *name
, TALLOC_CTX
*mem_ctx
,
809 char *unmangled_name
= NULL
;
811 mangled
= mangle_is_mangled(name
, conn
->params
);
813 /* handle null paths */
814 if ((path
== NULL
) || (*path
== 0)) {
818 /* If we have a case-sensitive filesystem, it doesn't do us any
819 * good to search for a name. If a case variation of the name was
820 * there, then the original stat(2) would have found it.
822 if (!mangled
&& !(conn
->fs_capabilities
& FILE_CASE_SENSITIVE_SEARCH
)) {
828 * The incoming name can be mangled, and if we de-mangle it
829 * here it will not compare correctly against the filename (name2)
830 * read from the directory and then mangled by the name_to_8_3()
831 * call. We need to mangle both names or neither.
834 * Fix for bug found by Dina Fine. If in case sensitive mode then
835 * the mangle cache is no good (3 letter extension could be wrong
836 * case - so don't demangle in this case - leave as mangled and
837 * allow the mangling of the directory entry read (which is done
838 * case insensitively) to match instead. This will lead to more
839 * false positive matches but we fail completely without it. JRA.
842 if (mangled
&& !conn
->case_sensitive
) {
843 mangled
= !mangle_lookup_name_from_8_3(talloc_tos(), name
,
847 /* Name is now unmangled. */
848 name
= unmangled_name
;
851 * If we have mangled names, do not ask the VFS'es
852 * GET_REAL_FILENAME. The Unix file system below does
853 * not know about Samba's style of mangling.
855 * Boolean flags passed down are evil, the alternative
856 * would be to pass a comparison function down into
857 * the loop in get_real_filename_internal(). For now,
858 * do the quick&dirty boolean flag approach.
860 return get_real_filename_internal(conn
, path
, name
,
862 mem_ctx
, found_name
);
866 return SMB_VFS_GET_REAL_FILENAME(conn
, path
, name
, mem_ctx
,
870 static int get_real_filename_internal(connection_struct
*conn
,
871 const char *path
, const char *name
,
873 TALLOC_CTX
*mem_ctx
, char **found_name
)
875 struct smb_Dir
*cur_dir
;
877 char *unmangled_name
= NULL
;
880 /* open the directory */
881 if (!(cur_dir
= OpenDir(talloc_tos(), conn
, path
, NULL
, 0))) {
882 DEBUG(3,("scan dir didn't open dir [%s]\n",path
));
883 TALLOC_FREE(unmangled_name
);
887 /* now scan for matching names */
889 while ((dname
= ReadDirName(cur_dir
, &curpos
))) {
891 /* Is it dot or dot dot. */
892 if (ISDOT(dname
) || ISDOTDOT(dname
)) {
897 * At this point dname is the unmangled name.
898 * name is either mangled or not, depending on the state
899 * of the "mangled" variable. JRA.
903 * Check mangled name against mangled name, or unmangled name
904 * against unmangled name.
907 if ((mangled
&& mangled_equal(name
,dname
,conn
->params
)) ||
908 fname_equal(name
, dname
, conn
->case_sensitive
)) {
909 /* we've found the file, change it's name and return */
910 *found_name
= talloc_strdup(mem_ctx
, dname
);
911 TALLOC_FREE(unmangled_name
);
912 TALLOC_FREE(cur_dir
);
921 TALLOC_FREE(unmangled_name
);
922 TALLOC_FREE(cur_dir
);
929 int get_real_filename(connection_struct
*conn
,
930 const char *path
, const char *name
,
931 TALLOC_CTX
*mem_ctx
, char **found_name
)
934 * This is the default VFS function. If we end up here, we know we
935 * don't have mangled names around.
937 return get_real_filename_internal(conn
, path
, name
, false,
938 mem_ctx
, found_name
);
941 static NTSTATUS
build_stream_path(TALLOC_CTX
*mem_ctx
,
942 connection_struct
*conn
,
943 const char *orig_path
,
944 const char *basepath
,
945 const char *streamname
,
946 SMB_STRUCT_STAT
*pst
,
952 unsigned int i
, num_streams
;
953 struct stream_struct
*streams
= NULL
;
955 result
= talloc_asprintf(mem_ctx
, "%s%s", basepath
, streamname
);
956 if (result
== NULL
) {
957 return NT_STATUS_NO_MEMORY
;
960 if (SMB_VFS_STAT(conn
, result
, &st
) == 0) {
966 if (errno
!= ENOENT
) {
967 status
= map_nt_error_from_unix(errno
);
968 DEBUG(10, ("vfs_stat failed: %s\n", nt_errstr(status
)));
972 status
= SMB_VFS_STREAMINFO(conn
, NULL
, basepath
, mem_ctx
,
973 &num_streams
, &streams
);
975 if (NT_STATUS_EQUAL(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
)) {
976 SET_STAT_INVALID(*pst
);
981 if (!NT_STATUS_IS_OK(status
)) {
982 DEBUG(10, ("vfs_streaminfo failed: %s\n", nt_errstr(status
)));
986 for (i
=0; i
<num_streams
; i
++) {
987 DEBUG(10, ("comparing [%s] and [%s]: ",
988 streamname
, streams
[i
].name
));
989 if (fname_equal(streamname
, streams
[i
].name
,
990 conn
->case_sensitive
)) {
991 DEBUGADD(10, ("equal\n"));
994 DEBUGADD(10, ("not equal\n"));
997 if (i
== num_streams
) {
998 SET_STAT_INVALID(*pst
);
1000 TALLOC_FREE(streams
);
1001 return NT_STATUS_OK
;
1004 TALLOC_FREE(result
);
1006 result
= talloc_asprintf(mem_ctx
, "%s%s", basepath
, streams
[i
].name
);
1007 if (result
== NULL
) {
1008 status
= NT_STATUS_NO_MEMORY
;
1012 SET_STAT_INVALID(*pst
);
1014 if (SMB_VFS_STAT(conn
, result
, pst
) == 0) {
1015 stat_cache_add(orig_path
, result
, conn
->case_sensitive
);
1019 TALLOC_FREE(streams
);
1020 return NT_STATUS_OK
;
1023 TALLOC_FREE(result
);
1024 TALLOC_FREE(streams
);