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
);
500 /* ENOENT is the only valid error here. */
501 if ((errno
!= 0) && (errno
!= ENOENT
)) {
503 * ENOTDIR and ELOOP both map to
504 * NT_STATUS_OBJECT_PATH_NOT_FOUND
505 * in the filename walk.
507 if (errno
== ENOTDIR
||
510 NT_STATUS_OBJECT_PATH_NOT_FOUND
;
514 map_nt_error_from_unix(errno
);
520 * Just the last part of the name doesn't exist.
521 * We need to strupper() or strlower() it as
522 * this conversion may be used for file creation
523 * purposes. Fix inspired by
524 * Thomas Neumann <t.neumann@iku-ag.de>.
526 if (!conn
->case_preserve
||
527 (mangle_is_8_3(start
, False
,
529 !conn
->short_case_preserve
)) {
531 lp_defaultcase(SNUM(conn
)));
535 * check on the mangled stack to see if we can
536 * recover the base of the filename.
539 if (mangle_is_mangled(start
, conn
->params
)
540 && mangle_lookup_name_from_8_3(ctx
,
545 size_t start_ofs
= start
- name
;
547 if (*dirpath
!= '\0') {
548 tmp
= talloc_asprintf(ctx
,
551 TALLOC_FREE(unmangled
);
557 DEBUG(0, ("talloc failed\n"));
558 return NT_STATUS_NO_MEMORY
;
562 start
= name
+ start_ofs
;
563 end
= start
+ strlen(start
);
566 DEBUG(5,("New file %s\n",start
));
572 * Restore the rest of the string. If the string was
573 * mangled the size may have changed.
577 size_t start_ofs
= start
- name
;
579 if (*dirpath
!= '\0') {
580 tmp
= talloc_asprintf(ctx
,
585 tmp
= talloc_asprintf(ctx
,
590 DEBUG(0, ("talloc_asprintf failed\n"));
591 return NT_STATUS_NO_MEMORY
;
595 start
= name
+ start_ofs
;
596 end
= start
+ strlen(found_name
);
600 size_t start_ofs
= start
- name
;
602 if (*dirpath
!= '\0') {
603 tmp
= talloc_asprintf(ctx
,
607 tmp
= talloc_strdup(ctx
,
611 DEBUG(0, ("talloc failed\n"));
612 return NT_STATUS_NO_MEMORY
;
616 start
= name
+ start_ofs
;
619 * We just scanned for, and found the end of
620 * the path. We must return a valid stat struct
624 if (posix_pathnames
) {
625 ret
= SMB_VFS_LSTAT(conn
,name
, &st
);
627 ret
= SMB_VFS_STAT(conn
,name
, &st
);
633 SET_STAT_INVALID(st
);
637 TALLOC_FREE(found_name
);
643 * We should never provide different behaviors
644 * depending on DEVELOPER!!!
646 if (VALID_STAT(st
)) {
648 get_file_infos(vfs_file_id_from_sbuf(conn
, &st
),
649 &delete_pending
, NULL
);
650 if (delete_pending
) {
651 result
= NT_STATUS_DELETE_PENDING
;
658 * Add to the dirpath that we have resolved so far.
661 if (*dirpath
!= '\0') {
662 char *tmp
= talloc_asprintf(ctx
,
663 "%s/%s", dirpath
, start
);
665 DEBUG(0, ("talloc_asprintf failed\n"));
666 return NT_STATUS_NO_MEMORY
;
668 TALLOC_FREE(dirpath
);
672 TALLOC_FREE(dirpath
);
673 if (!(dirpath
= talloc_strdup(ctx
,start
))) {
674 DEBUG(0, ("talloc_strdup failed\n"));
675 return NT_STATUS_NO_MEMORY
;
680 * Don't cache a name with mangled or wildcard components
681 * as this can change the size.
684 if(!component_was_mangled
&& !name_has_wildcard
) {
685 stat_cache_add(orig_path
, dirpath
,
686 conn
->case_sensitive
);
690 * Restore the / that we wiped out earlier.
698 * Don't cache a name with mangled or wildcard components
699 * as this can change the size.
702 if(!component_was_mangled
&& !name_has_wildcard
) {
703 stat_cache_add(orig_path
, name
, conn
->case_sensitive
);
707 * The name has been resolved.
710 DEBUG(5,("conversion finished %s -> %s\n",orig_path
, name
));
713 if (stream
!= NULL
) {
716 result
= build_stream_path(ctx
, conn
, orig_path
, name
, stream
,
718 if (!NT_STATUS_IS_OK(result
)) {
722 DEBUG(10, ("build_stream_path returned %s\n", tmp
));
727 *pp_conv_path
= name
;
728 TALLOC_FREE(dirpath
);
731 DEBUG(10, ("dirpath = [%s] start = [%s]\n", dirpath
, start
));
732 if (*dirpath
!= '\0') {
733 *pp_conv_path
= talloc_asprintf(ctx
,
734 "%s/%s", dirpath
, start
);
736 *pp_conv_path
= talloc_strdup(ctx
, start
);
738 if (!*pp_conv_path
) {
739 DEBUG(0, ("talloc_asprintf failed\n"));
740 return NT_STATUS_NO_MEMORY
;
743 TALLOC_FREE(dirpath
);
747 /****************************************************************************
748 Check a filename - possibly calling check_reduced_name.
749 This is called by every routine before it allows an operation on a filename.
750 It does any final confirmation necessary to ensure that the filename is
751 a valid one for the user to access.
752 ****************************************************************************/
754 NTSTATUS
check_name(connection_struct
*conn
, const char *name
)
756 if (IS_VETO_PATH(conn
, name
)) {
757 /* Is it not dot or dot dot. */
758 if (!((name
[0] == '.') && (!name
[1] ||
759 (name
[1] == '.' && !name
[2])))) {
760 DEBUG(5,("check_name: file path name %s vetoed\n",
762 return map_nt_error_from_unix(ENOENT
);
766 if (!lp_widelinks(SNUM(conn
)) || !lp_symlinks(SNUM(conn
))) {
767 NTSTATUS status
= check_reduced_name(conn
,name
);
768 if (!NT_STATUS_IS_OK(status
)) {
769 DEBUG(5,("check_name: name %s failed with %s\n",name
,
778 /****************************************************************************
779 Check if two filenames are equal.
780 This needs to be careful about whether we are case sensitive.
781 ****************************************************************************/
783 static bool fname_equal(const char *name1
, const char *name2
,
786 /* Normal filename handling */
787 if (case_sensitive
) {
788 return(strcmp(name1
,name2
) == 0);
791 return(strequal(name1
,name2
));
794 /****************************************************************************
795 Scan a directory to find a filename, matching without case sensitivity.
796 If the name looks like a mangled name then try via the mangling functions
797 ****************************************************************************/
799 static int get_real_filename_mangled(connection_struct
*conn
, const char *path
,
800 const char *name
, TALLOC_CTX
*mem_ctx
,
804 char *unmangled_name
= NULL
;
806 mangled
= mangle_is_mangled(name
, conn
->params
);
808 /* handle null paths */
809 if ((path
== NULL
) || (*path
== 0)) {
813 /* If we have a case-sensitive filesystem, it doesn't do us any
814 * good to search for a name. If a case variation of the name was
815 * there, then the original stat(2) would have found it.
817 if (!mangled
&& !(conn
->fs_capabilities
& FILE_CASE_SENSITIVE_SEARCH
)) {
823 * The incoming name can be mangled, and if we de-mangle it
824 * here it will not compare correctly against the filename (name2)
825 * read from the directory and then mangled by the name_to_8_3()
826 * call. We need to mangle both names or neither.
829 * Fix for bug found by Dina Fine. If in case sensitive mode then
830 * the mangle cache is no good (3 letter extension could be wrong
831 * case - so don't demangle in this case - leave as mangled and
832 * allow the mangling of the directory entry read (which is done
833 * case insensitively) to match instead. This will lead to more
834 * false positive matches but we fail completely without it. JRA.
837 if (mangled
&& !conn
->case_sensitive
) {
838 mangled
= !mangle_lookup_name_from_8_3(talloc_tos(), name
,
842 /* Name is now unmangled. */
843 name
= unmangled_name
;
846 * If we have mangled names, do not ask the VFS'es
847 * GET_REAL_FILENAME. The Unix file system below does
848 * not know about Samba's style of mangling.
850 * Boolean flags passed down are evil, the alternative
851 * would be to pass a comparison function down into
852 * the loop in get_real_filename_internal(). For now,
853 * do the quick&dirty boolean flag approach.
855 return get_real_filename_internal(conn
, path
, name
,
857 mem_ctx
, found_name
);
861 return SMB_VFS_GET_REAL_FILENAME(conn
, path
, name
, mem_ctx
,
865 static int get_real_filename_internal(connection_struct
*conn
,
866 const char *path
, const char *name
,
868 TALLOC_CTX
*mem_ctx
, char **found_name
)
870 struct smb_Dir
*cur_dir
;
872 char *unmangled_name
= NULL
;
875 /* open the directory */
876 if (!(cur_dir
= OpenDir(talloc_tos(), conn
, path
, NULL
, 0))) {
877 DEBUG(3,("scan dir didn't open dir [%s]\n",path
));
878 TALLOC_FREE(unmangled_name
);
882 /* now scan for matching names */
884 while ((dname
= ReadDirName(cur_dir
, &curpos
))) {
886 /* Is it dot or dot dot. */
887 if (ISDOT(dname
) || ISDOTDOT(dname
)) {
892 * At this point dname is the unmangled name.
893 * name is either mangled or not, depending on the state
894 * of the "mangled" variable. JRA.
898 * Check mangled name against mangled name, or unmangled name
899 * against unmangled name.
902 if ((mangled
&& mangled_equal(name
,dname
,conn
->params
)) ||
903 fname_equal(name
, dname
, conn
->case_sensitive
)) {
904 /* we've found the file, change it's name and return */
905 *found_name
= talloc_strdup(mem_ctx
, dname
);
906 TALLOC_FREE(unmangled_name
);
907 TALLOC_FREE(cur_dir
);
916 TALLOC_FREE(unmangled_name
);
917 TALLOC_FREE(cur_dir
);
924 int get_real_filename(connection_struct
*conn
,
925 const char *path
, const char *name
,
926 TALLOC_CTX
*mem_ctx
, char **found_name
)
929 * This is the default VFS function. If we end up here, we know we
930 * don't have mangled names around.
932 return get_real_filename_internal(conn
, path
, name
, false,
933 mem_ctx
, found_name
);
936 static NTSTATUS
build_stream_path(TALLOC_CTX
*mem_ctx
,
937 connection_struct
*conn
,
938 const char *orig_path
,
939 const char *basepath
,
940 const char *streamname
,
941 SMB_STRUCT_STAT
*pst
,
947 unsigned int i
, num_streams
;
948 struct stream_struct
*streams
= NULL
;
950 result
= talloc_asprintf(mem_ctx
, "%s%s", basepath
, streamname
);
951 if (result
== NULL
) {
952 return NT_STATUS_NO_MEMORY
;
955 if (SMB_VFS_STAT(conn
, result
, &st
) == 0) {
961 if (errno
!= ENOENT
) {
962 status
= map_nt_error_from_unix(errno
);
963 DEBUG(10, ("vfs_stat failed: %s\n", nt_errstr(status
)));
967 status
= SMB_VFS_STREAMINFO(conn
, NULL
, basepath
, mem_ctx
,
968 &num_streams
, &streams
);
970 if (NT_STATUS_EQUAL(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
)) {
971 SET_STAT_INVALID(*pst
);
976 if (!NT_STATUS_IS_OK(status
)) {
977 DEBUG(10, ("vfs_streaminfo failed: %s\n", nt_errstr(status
)));
981 for (i
=0; i
<num_streams
; i
++) {
982 DEBUG(10, ("comparing [%s] and [%s]: ",
983 streamname
, streams
[i
].name
));
984 if (fname_equal(streamname
, streams
[i
].name
,
985 conn
->case_sensitive
)) {
986 DEBUGADD(10, ("equal\n"));
989 DEBUGADD(10, ("not equal\n"));
992 if (i
== num_streams
) {
993 SET_STAT_INVALID(*pst
);
995 TALLOC_FREE(streams
);
1001 result
= talloc_asprintf(mem_ctx
, "%s%s", basepath
, streams
[i
].name
);
1002 if (result
== NULL
) {
1003 status
= NT_STATUS_NO_MEMORY
;
1007 SET_STAT_INVALID(*pst
);
1009 if (SMB_VFS_STAT(conn
, result
, pst
) == 0) {
1010 stat_cache_add(orig_path
, result
, conn
->case_sensitive
);
1014 TALLOC_FREE(streams
);
1015 return NT_STATUS_OK
;
1018 TALLOC_FREE(result
);
1019 TALLOC_FREE(streams
);