[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Wed Mar 2 21:59:01 UTC 2022
The branch, master has been updated
via 0c113e652fe s3: smbd: Rename OpenDir_ntstatus() -> OpenDir().
via c0bbf6f4119 s3: smbd: Remove now unused OpenDir().
via b331082b01a s3: torture: In cmd_vfs, Move two more uses of OpenDir() -> OpenDir_nstatus().
via e66be49a52e s3: smbd: In form_junctions(), Move one more use of OpenDir() -> OpenDir_nstatus()
via 2aff668e1c5 s3: smbd: In count_dfs_links(), Move one more use of OpenDir() -> OpenDir_nstatus()
via 535b29afdeb s3: smbd: In rmdir_internals(), Move one more use of OpenDir() -> OpenDir_nstatus()
via 51b7475d394 s3: smbd: In recursive_rmdir(), Move one more use of OpenDir() -> OpenDir_nstatus()
via bc9439a41ee s3: VFS: syncops: Move one more use of OpenDir() -> OpenDir_nstatus().
via a138d0f2d98 s3: VFS: shadow_copy: Move one more use of OpenDir() -> OpenDir_nstatus().
via a1f4d74a1a0 s3: VFS: fruit: Move two more uses of OpenDir() -> OpenDir_nstatus().
via 751237a28c3 s3: VFS: ceph_snapshots: Move two more uses of OpenDir() -> OpenDir_nstatus().
from 791be84c3ee s4:kdc: hdb_samba4_audit() is only called once per request
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0c113e652fea17cbbf7644e469abe0980789cf9c
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:34:48 2022 -0800
s3: smbd: Rename OpenDir_ntstatus() -> OpenDir().
We now have a single OpenDir() function that returns an NTSTATUS.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Wed Mar 2 21:58:32 UTC 2022 on sn-devel-184
commit c0bbf6f41195dd2af08f303ce3feef3becd79af1
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:30:27 2022 -0800
s3: smbd: Remove now unused OpenDir().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit b331082b01a51d57a52b9c2e994724def528c8b4
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:28:19 2022 -0800
s3: torture: In cmd_vfs, Move two more uses of OpenDir() -> OpenDir_nstatus().
Now we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit e66be49a52e19551edea6b336fbbb46f6a97f3c7
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:25:25 2022 -0800
s3: smbd: In form_junctions(), Move one more use of OpenDir() -> OpenDir_nstatus()
Eventually we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 2aff668e1c5f31d950e30d175b9affe36bb4766f
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:24:19 2022 -0800
s3: smbd: In count_dfs_links(), Move one more use of OpenDir() -> OpenDir_nstatus()
Eventually we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 535b29afdebc2bff1a587a1d5966c789fb6aab42
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:22:03 2022 -0800
s3: smbd: In rmdir_internals(), Move one more use of OpenDir() -> OpenDir_nstatus()
Eventually we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 51b7475d394ab04f73bdc054382f0814a41aaa74
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:20:37 2022 -0800
s3: smbd: In recursive_rmdir(), Move one more use of OpenDir() -> OpenDir_nstatus()
Eventually we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit bc9439a41eea66e50ea76275c324596e26999888
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:13:04 2022 -0800
s3: VFS: syncops: Move one more use of OpenDir() -> OpenDir_nstatus().
Eventually we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit a138d0f2d986a8d05ea2e4172871701bdb187770
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:11:04 2022 -0800
s3: VFS: shadow_copy: Move one more use of OpenDir() -> OpenDir_nstatus().
Eventually we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit a1f4d74a1a00aa9d91393b0c6f975ffb3db03d55
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:08:40 2022 -0800
s3: VFS: fruit: Move two more uses of OpenDir() -> OpenDir_nstatus().
Eventually we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 751237a28c3c8feee24818dea0525771e70dd08b
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 13:28:30 2022 -0800
s3: VFS: ceph_snapshots: Move two more uses of OpenDir() -> OpenDir_nstatus().
Eventually we can replace OpenDir() with OpenDir_ntatatus().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_ceph_snapshots.c | 22 ++++++++++++++++------
source3/modules/vfs_fruit.c | 22 ++++++++++++++++++----
source3/modules/vfs_shadow_copy.c | 11 +++++++++--
source3/modules/vfs_streams_depot.c | 2 +-
source3/modules/vfs_syncops.c | 17 ++++++++++-------
source3/smbd/close.c | 27 ++++++++++++++++++++++-----
source3/smbd/dir.c | 33 +++++++--------------------------
source3/smbd/filename.c | 2 +-
source3/smbd/msdfs.c | 20 ++++++++++++++++----
source3/smbd/proto.h | 17 ++++++-----------
source3/torture/cmd_vfs.c | 31 +++++++++++++++++++++----------
11 files changed, 127 insertions(+), 77 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c
index dd7c431dd9e..d533b9479a3 100644
--- a/source3/modules/vfs_ceph_snapshots.c
+++ b/source3/modules/vfs_ceph_snapshots.c
@@ -236,9 +236,14 @@ static int ceph_snap_enum_snapdir(struct vfs_handle_struct *handle,
* via readdir.
*/
- dir_hnd = OpenDir(frame, handle->conn, snaps_dname, NULL, 0);
- if (dir_hnd == NULL) {
- ret = -errno;
+ 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;
}
@@ -559,9 +564,14 @@ static int ceph_snap_gmt_convert_dir(struct vfs_handle_struct *handle,
DBG_DEBUG("enumerating shadow copy dir at %s\n",
snaps_dname->base_name);
- dir_hnd = OpenDir(tmp_ctx, handle->conn, snaps_dname, NULL, 0);
- if (dir_hnd == NULL) {
- ret = -errno;
+ 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;
}
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index e54e0903c40..75ddf3226b7 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -5055,6 +5055,7 @@ static bool fruit_get_num_bands(vfs_handle_struct *handle,
char *talloced = NULL;
long offset = 0;
size_t nbands;
+ NTSTATUS status;
path = talloc_asprintf(talloc_tos(),
"%s/%s/bands",
@@ -5075,9 +5076,15 @@ static bool fruit_get_num_bands(vfs_handle_struct *handle,
return false;
}
- dir_hnd = OpenDir(talloc_tos(), handle->conn, bands_dir, NULL, 0);
- if (dir_hnd == NULL) {
+ 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);
return false;
}
@@ -5198,6 +5205,7 @@ static uint64_t fruit_disk_free(vfs_handle_struct *handle,
uint64_t dfree;
uint64_t dsize;
bool ok;
+ NTSTATUS status;
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct fruit_config_data,
@@ -5213,8 +5221,14 @@ static uint64_t fruit_disk_free(vfs_handle_struct *handle,
_dsize);
}
- dir_hnd = OpenDir(talloc_tos(), handle->conn, smb_fname, NULL, 0);
- if (dir_hnd == NULL) {
+ 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;
}
diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c
index 37c4657e79b..29163b179f7 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -179,6 +179,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
const char *dname = NULL;
char *talloced = NULL;
long offset = 0;
+ NTSTATUS status;
struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(),
fsp->conn->connectpath,
NULL,
@@ -190,10 +191,16 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
return -1;
}
- dir_hnd = OpenDir(talloc_tos(), handle->conn, smb_fname, NULL, 0);
+ status = OpenDir(talloc_tos(),
+ handle->conn,
+ smb_fname,
+ NULL,
+ 0,
+ &dir_hnd);
TALLOC_FREE(smb_fname);
- if (dir_hnd == NULL) {
+ if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("OpenDir() failed for [%s]\n", fsp->conn->connectpath);
+ errno = map_errno_from_nt_status(status);
return -1;
}
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index f1ec5b9748a..3016cfcf19c 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -595,7 +595,7 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
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;
diff --git a/source3/modules/vfs_syncops.c b/source3/modules/vfs_syncops.c
index 679d8b06dcb..14c860127b3 100644
--- a/source3/modules/vfs_syncops.c
+++ b/source3/modules/vfs_syncops.c
@@ -77,13 +77,16 @@ static void syncops_sync_directory(connection_struct *conn,
struct smb_Dir *dir_hnd = NULL;
struct files_struct *dirfsp = NULL;
struct smb_filename smb_dname = { .base_name = dname };
-
- dir_hnd = OpenDir(talloc_tos(),
- conn,
- &smb_dname,
- "*",
- 0);
- if (dir_hnd == NULL) {
+ NTSTATUS status;
+
+ status = OpenDir(talloc_tos(),
+ conn,
+ &smb_dname,
+ "*",
+ 0,
+ &dir_hnd);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
return;
}
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 4ad8e42f319..798a28c324c 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -848,16 +848,23 @@ bool recursive_rmdir(TALLOC_CTX *ctx,
bool ret = True;
long offset = 0;
SMB_STRUCT_STAT st;
- struct smb_Dir *dir_hnd;
+ struct smb_Dir *dir_hnd = NULL;
struct files_struct *dirfsp = NULL;
int retval;
NTSTATUS status;
SMB_ASSERT(!is_ntfs_stream_smb_fname(smb_dname));
- dir_hnd = OpenDir(talloc_tos(), conn, smb_dname, NULL, 0);
- if (dir_hnd == NULL)
+ 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;
+ }
dirfsp = dir_hnd_fetch_fsp(dir_hnd);
@@ -1045,8 +1052,18 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
* files non-visible to the client. If not, fail the delete.
*/
- dir_hnd = OpenDir(talloc_tos(), conn, smb_dname, NULL, 0);
- if (dir_hnd == NULL) {
+ status = OpenDir(talloc_tos(),
+ conn,
+ smb_dname,
+ NULL,
+ 0,
+ &dir_hnd);
+ if (!NT_STATUS_IS_OK(status)) {
+ /*
+ * Note, we deliberately squash the error here
+ * to avoid leaking information about what we
+ * can't delete.
+ */
errno = ENOTEMPTY;
goto err;
}
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index c9cc6b73e58..431d4d72b5d 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1477,12 +1477,12 @@ static int smb_Dir_OpenDir_destructor(struct smb_Dir *dir_hnd)
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;
@@ -1511,25 +1511,6 @@ NTSTATUS OpenDir_ntstatus(TALLOC_CTX *mem_ctx,
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.
********************************************************************/
@@ -1917,7 +1898,7 @@ NTSTATUS can_delete_directory_fsp(files_struct *fsp)
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;
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 123fe951639..84548dce21d 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -1606,7 +1606,7 @@ int get_real_filename_full_scan(connection_struct *conn,
}
/* 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",
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index c003b442baa..86dc3f4dd74 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -1647,8 +1647,14 @@ static size_t count_dfs_links(TALLOC_CTX *ctx,
}
/* Now enumerate all dfs links */
- dir_hnd = OpenDir(frame, conn, smb_fname, NULL, 0);
- if (dir_hnd == NULL) {
+ 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;
}
@@ -1784,8 +1790,14 @@ static int form_junctions(TALLOC_CTX *ctx,
}
/* Now enumerate all dfs links */
- dir_hnd = OpenDir(frame, conn, smb_fname, NULL, 0);
- if (dir_hnd == NULL) {
+ 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;
}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 6ca5e125aaf..63f78024101 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -231,17 +231,12 @@ bool get_dir_entry(TALLOC_CTX *ctx,
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,
- const char *mask,
- uint32_t attr);
+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);
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c
index fd40acc6795..303d80fc766 100644
--- a/source3/torture/cmd_vfs.c
+++ b/source3/torture/cmd_vfs.c
@@ -149,6 +149,7 @@ static NTSTATUS cmd_disk_free(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
struct smb_filename *smb_fname = NULL;
+ NTSTATUS status;
if (argc != 2) {
printf("Usage: opendir <fname>\n");
@@ -165,10 +166,17 @@ static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
return NT_STATUS_NO_MEMORY;
}
- vfs->currentdir = OpenDir(vfs->conn, vfs->conn, smb_fname, NULL, 0);
- if (vfs->currentdir == NULL) {
- printf("opendir error=%d (%s)\n", errno, strerror(errno));
+ 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));
TALLOC_FREE(smb_fname);
+ errno = err;
return NT_STATUS_UNSUCCESSFUL;
}
@@ -2103,15 +2111,18 @@ static NTSTATUS cmd_translate_name(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- vfs->currentdir = OpenDir(talloc_tos(),
- vfs->conn,
- smb_fname,
- NULL,
- 0);
- if (vfs->currentdir == NULL) {
+ 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",
- errno, strerror(errno)));
+ err, strerror(err)));
TALLOC_FREE(smb_fname);
+ errno = err;
return NT_STATUS_UNSUCCESSFUL;
}
vfs->currentdir_offset = 0;
--
Samba Shared Repository
More information about the samba-cvs
mailing list