+++ /dev/null
-^samba3.smb2.streams.names\(simpleserver\)
-^samba3.smb2.streams.io\(simpleserver\)
-^samba3.smb2.streams.names3\(simpleserver\)
-^samba3.smb2.streams.delete\(simpleserver\)
-^samba3.smb2.streams.zero-byte\(simpleserver\)
-^samba3.smb2.streams.sharemodes\(simpleserver\)
void *private_data)
{
char *dirname;
+ char *rootdir = NULL;
+ char *orig_connectpath = NULL;
struct smb_filename *dir_smb_fname = NULL;
struct smb_Dir *dir_hnd = NULL;
const char *dname = NULL;
return NT_STATUS_NO_MEMORY;
}
+ /*
+ * For OpenDir to succeed if the stream rootdir is outside
+ * the share path, we must temporarily swap out the connect
+ * path for this share. We're dealing with absolute paths
+ * here so we don't care about chdir calls.
+ */
+ rootdir = stream_rootdir(handle, talloc_tos());
+ if (rootdir == NULL) {
+ TALLOC_FREE(dir_smb_fname);
+ TALLOC_FREE(dirname);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ orig_connectpath = handle->conn->connectpath;
+ handle->conn->connectpath = rootdir;
+
dir_hnd = OpenDir(talloc_tos(), handle->conn, dir_smb_fname, NULL, 0);
if (dir_hnd == NULL) {
+ handle->conn->connectpath = orig_connectpath;
+ TALLOC_FREE(rootdir);
TALLOC_FREE(dir_smb_fname);
TALLOC_FREE(dirname);
return map_nt_error_from_unix(errno);
TALLOC_FREE(talloced);
}
+ /* Restore the original connectpath. */
+ handle->conn->connectpath = orig_connectpath;
+ TALLOC_FREE(rootdir);
TALLOC_FREE(dir_smb_fname);
TALLOC_FREE(dir_hnd);