return 0;
}
-struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx,
- connection_struct *conn,
- const struct smb_filename *smb_dname,
- const char *mask,
- uint32_t attr)
+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)
{
struct files_struct *fsp = NULL;
struct smb_Dir *dir_hnd = NULL;
O_RDONLY,
&fsp);
if (!NT_STATUS_IS_OK(status)) {
- /* Ensure we return the actual error from status in errno. */
- errno = map_errno_from_nt_status(status);
- return NULL;
+ return status;
}
status = OpenDir_fsp(mem_ctx, conn, fsp, mask, attr, &dir_hnd);
if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return NULL;
+ return status;
}
/*
* but smb_Dir_OpenDir_destructor() calls the OpenDir_fsp() destructor.
*/
talloc_set_destructor(dir_hnd, smb_Dir_OpenDir_destructor);
- return dir_hnd;
+
+ *_dir_hnd = dir_hnd;
+ return NT_STATUS_OK;
}
+struct smb_Dir *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 = NULL;
+ NTSTATUS status;
+
+ status = OpenDir_ntstatus(
+ mem_ctx, conn, smb_dname, mask, attr, &dir_hnd);
+ if (!NT_STATUS_IS_OK(status)) {
+ /* Ensure we return the actual error from status in errno. */
+ errno = map_errno_from_nt_status(status);
+ return NULL;
+ }
+
+ return dir_hnd;
+}
/*******************************************************************
Open a directory from an fsp.
********************************************************************/
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);
struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx,
connection_struct *conn,
const struct smb_filename *smb_fname,