* Ensure saved_last_component is valid even if file exists.
*/
+ end = strrchr_m(name, '/');
if(pp_saved_last_component) {
- end = strrchr_m(name, '/');
if (end) {
*pp_saved_last_component = talloc_strdup(ctx, end + 1);
} else {
*pst = st;
goto done;
}
+ } else if (end) {
+ *end = '\0';
+ if (posix_pathnames) {
+ ret = SMB_VFS_LSTAT(conn,name,&st);
+ } else {
+ ret = SMB_VFS_STAT(conn,name,&st);
+ }
+
+ if (ret == 0) {
+ /* Ensure we catch all names with in "/."
+ this is disallowed under Windows. */
+ const char *p = strstr(name, "/."); /* mb safe. */
+ *end = '/';
+ if (p) {
+ if (p[2] == '/') {
+ /* Error code within a pathname. */
+ result = NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ goto fail;
+ } else if (p[2] == '\0') {
+ /* Error code at the end of a pathname. */
+ result = NT_STATUS_OBJECT_NAME_INVALID;
+ goto fail;
+ }
+ }
+ DEBUG(5,("conversion finished %s -> %s\n",orig_path, name));
+ goto done;
+ }
+ *end = '/';
}
DEBUG(5,("unix_convert begin: name = %s, dirpath = %s, start = %s\n",