We now have a single OpenDir() function that returns an NTSTATUS.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Mar 2 21:58:32 UTC 2022 on sn-devel-184
* via readdir.
*/
- status = OpenDir_ntstatus(frame,
- handle->conn,
- snaps_dname,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(frame,
+ handle->conn,
+ snaps_dname,
+ NULL,
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
ret = -map_errno_from_nt_status(status);
goto err_out;
DBG_DEBUG("enumerating shadow copy dir at %s\n",
snaps_dname->base_name);
- status = OpenDir_ntstatus(tmp_ctx,
- handle->conn,
- snaps_dname,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(tmp_ctx,
+ handle->conn,
+ snaps_dname,
+ NULL,
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
ret = -map_errno_from_nt_status(status);
goto err_out;
return false;
}
- status = OpenDir_ntstatus(talloc_tos(),
- handle->conn,
- bands_dir,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(talloc_tos(),
+ handle->conn,
+ bands_dir,
+ NULL,
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(bands_dir);
errno = map_errno_from_nt_status(status);
_dsize);
}
- status = OpenDir_ntstatus(talloc_tos(),
- handle->conn,
- smb_fname,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(talloc_tos(),
+ handle->conn,
+ smb_fname,
+ NULL,
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return UINT64_MAX;
return -1;
}
- status = OpenDir_ntstatus(talloc_tos(),
- handle->conn,
- smb_fname,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(talloc_tos(),
+ handle->conn,
+ smb_fname,
+ NULL,
+ 0,
+ &dir_hnd);
TALLOC_FREE(smb_fname);
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("OpenDir() failed for [%s]\n", fsp->conn->connectpath);
orig_connectpath = handle->conn->connectpath;
handle->conn->connectpath = rootdir;
- status = OpenDir_ntstatus(
+ status = OpenDir(
talloc_tos(), handle->conn, dir_smb_fname, NULL, 0, &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
handle->conn->connectpath = orig_connectpath;
struct smb_filename smb_dname = { .base_name = dname };
NTSTATUS status;
- status = OpenDir_ntstatus(talloc_tos(),
- conn,
- &smb_dname,
- "*",
- 0,
- &dir_hnd);
+ status = OpenDir(talloc_tos(),
+ conn,
+ &smb_dname,
+ "*",
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return;
SMB_ASSERT(!is_ntfs_stream_smb_fname(smb_dname));
- status = OpenDir_ntstatus(talloc_tos(),
- conn,
- smb_dname,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(talloc_tos(),
+ conn,
+ smb_dname,
+ NULL,
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return False;
* files non-visible to the client. If not, fail the delete.
*/
- status = OpenDir_ntstatus(talloc_tos(),
- conn,
- smb_dname,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(talloc_tos(),
+ conn,
+ smb_dname,
+ NULL,
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
/*
* Note, we deliberately squash the error here
return 0;
}
-NTSTATUS OpenDir_ntstatus(TALLOC_CTX *mem_ctx,
- connection_struct *conn,
- const struct smb_filename *smb_dname,
- const char *mask,
- uint32_t attr,
- struct smb_Dir **_dir_hnd)
+NTSTATUS OpenDir(TALLOC_CTX *mem_ctx,
+ connection_struct *conn,
+ const struct smb_filename *smb_dname,
+ const char *mask,
+ uint32_t attr,
+ struct smb_Dir **_dir_hnd)
{
struct files_struct *fsp = NULL;
struct smb_Dir *dir_hnd = NULL;
struct connection_struct *conn = fsp->conn;
struct smb_Dir *dir_hnd = NULL;
- status = OpenDir_ntstatus(
+ status = OpenDir(
talloc_tos(), conn, fsp->fsp_name, NULL, 0, &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
/* open the directory */
- status = OpenDir_ntstatus(
+ status = OpenDir(
talloc_tos(), conn, smb_fname, NULL, 0, &cur_dir);
if (!NT_STATUS_IS_OK(status)) {
DBG_NOTICE("scan dir didn't open dir [%s]: %s\n",
}
/* Now enumerate all dfs links */
- status = OpenDir_ntstatus(frame,
- conn,
- smb_fname,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(frame,
+ conn,
+ smb_fname,
+ NULL,
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
goto out;
}
/* Now enumerate all dfs links */
- status = OpenDir_ntstatus(frame,
- conn,
- smb_fname,
- NULL,
- 0,
- &dir_hnd);
+ status = OpenDir(frame,
+ conn,
+ smb_fname,
+ NULL,
+ 0,
+ &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
goto out;
bool ask_sharemode);
struct smb_Dir;
bool is_visible_fsp(files_struct *fsp);
-NTSTATUS OpenDir_ntstatus(TALLOC_CTX *mem_ctx,
- connection_struct *conn,
- const struct smb_filename *smb_dname,
- const char *mask,
- uint32_t attr,
- struct smb_Dir **_dir_hnd);
+NTSTATUS OpenDir(TALLOC_CTX *mem_ctx,
+ connection_struct *conn,
+ const struct smb_filename *smb_dname,
+ const char *mask,
+ uint32_t attr,
+ struct smb_Dir **_dir_hnd);
const char *ReadDirName(struct smb_Dir *dir_hnd, long *poffset,
SMB_STRUCT_STAT *sbuf, char **talloced);
void RewindDir(struct smb_Dir *dir_hnd, long *poffset);
return NT_STATUS_NO_MEMORY;
}
- status = OpenDir_ntstatus(vfs->conn,
- vfs->conn,
- smb_fname,
- NULL,
- 0,
- &vfs->currentdir);
+ status = OpenDir(vfs->conn,
+ vfs->conn,
+ smb_fname,
+ NULL,
+ 0,
+ &vfs->currentdir);
if (!NT_STATUS_IS_OK(status)) {
int err = map_errno_from_nt_status(status);
printf("opendir error=%d (%s)\n", err, strerror(err));
return NT_STATUS_NO_MEMORY;
}
- status = OpenDir_ntstatus(vfs->conn,
- vfs->conn,
- smb_fname,
- NULL,
- 0,
- &vfs->currentdir);
+ status = OpenDir(vfs->conn,
+ vfs->conn,
+ smb_fname,
+ NULL,
+ 0,
+ &vfs->currentdir);
if (!NT_STATUS_IS_OK(status)) {
int err = map_errno_from_nt_status(status);
DEBUG(0, ("cmd_translate_name: opendir error=%d (%s)\n",