The branch, master has been updated
via 9060a2fc8f3 lib: Slightly simplify ad_alloc()
via dde0c65cbf7 lib: Simplify ad_alloc()
via 2e24355393d tevent: Fix some whitespace
via a7fcb8e4256 lib: Remove some dead code from ad_init()
via daf06bab1e7 tevent: Fix some whitespace
via 4787d3974e0 libcli: Fix whitespace
via 8927cbb33b3 loadparm: move log message to a higher log level
via 546e5655b68 replace: fix hex_upper -> hexchars_upper
via 8e5fa089b35 vfs: Implement snapper_gmt_fstatat()
via 3e7ebe1d262 vfs: Implement dfq_fstatat()
via 4a241178e45 vfs: Implement catia_fstatat()
via b6d7152f928 vfs: Implement cap_fstatat()
via cd73bae025a vfs: Fix typos.
via 4dd5b7bcb60 vfs: Fix whitespace
via 0afb222b7ee net: Remove a call to SMB_VFS_STAT and dirfsp==NULL in
create_file
via e574cab373c net: Fix a panic in "net vfs getntacl"
via 441a85e033f lib: Pass "dirfsp" to ad_collect_one_stream()
via 49b0982ead9 lib: Use dirfsp/relname in ad_unconvert()
via 8a0f3ae1d1c lib: Add adouble_name()
via 2e0e47d45ce lib: Avoid a VFS_STAT call in "net vfs stream2adouble"
via a605a84cee7 lib: Convert ad_unconvert() to NTSTATUS
via 8f8378b1d49 lib: Convert ad_collect_one_stream() to NTSTATUS
via 3dc25cb244c lib: Convert ad_unconvert_open_ad() to NTSTATUS
via 374a8dd605e lib: Convert ad_unconvert_get_streams() to NTSTATUS
from b6c8d5d8291 smbd: implement modern write time update logic
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9060a2fc8f3c36097b2c6a78d0dab622925501f6
Author: Volker Lendecke <[email protected]>
Date: Tue Feb 25 17:31:16 2025 +0100
lib: Slightly simplify ad_alloc()
Use a struct initialization to avoid talloc_zero()
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
Autobuild-User(master): Volker Lendecke <[email protected]>
Autobuild-Date(master): Thu Mar 27 14:11:11 UTC 2025 on atb-devel-224
commit dde0c65cbf71f7a28c767140c384153f8b25dbcf
Author: Volker Lendecke <[email protected]>
Date: Tue Feb 25 17:27:20 2025 +0100
lib: Simplify ad_alloc()
I don't see how "adsize" can be 0 here.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 2e24355393dff62fbdc7a58e0554830f5a7bd4c9
Author: Volker Lendecke <[email protected]>
Date: Sat Feb 22 08:12:06 2025 +0100
tevent: Fix some whitespace
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit a7fcb8e42563e414b1f7ee9befd805a72dcefb76
Author: Volker Lendecke <[email protected]>
Date: Tue Feb 25 17:35:53 2025 +0100
lib: Remove some dead code from ad_init()
"rc" was never set to anything but 0.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit daf06bab1e77b35cc1f17bdc6b81e80cd0226e40
Author: Volker Lendecke <[email protected]>
Date: Mon Mar 10 20:35:59 2025 +0100
tevent: Fix some whitespace
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 4787d3974e00c045e0c86cd3503c6bfdfbb91299
Author: Volker Lendecke <[email protected]>
Date: Tue Mar 11 08:30:37 2025 +0100
libcli: Fix whitespace
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 8927cbb33b394548db37a2a9498d842a54cb722b
Author: Bjoern Jacke <[email protected]>
Date: Mon Mar 10 10:53:38 2025 +0000
loadparm: move log message to a higher log level
Signed-off-by: Bjoern Jacke <[email protected]>
Reviewed-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 546e5655b683072bfebc12a22177eb7187ec38dc
Author: Bjoern Jacke <[email protected]>
Date: Thu Feb 20 16:14:54 2025 +0000
replace: fix hex_upper -> hexchars_upper
It seems we don't have many systems without a working snprintf anymore...
Signed-off-by: Bjoern Jacke <[email protected]>
Reviewed-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 8e5fa089b35dd544ae9eb7abae124827d96854f0
Author: Volker Lendecke <[email protected]>
Date: Fri Jan 24 16:37:42 2025 +0100
vfs: Implement snapper_gmt_fstatat()
Make snapper_gmt_stat() and snapper_gmt_lstat() use that.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 3e7ebe1d262f7011139688fc0c20ce8ce745745c
Author: Volker Lendecke <[email protected]>
Date: Tue Jan 28 18:38:18 2025 +0100
vfs: Implement dfq_fstatat()
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 4a241178e456e0bd4873e77f109048fb2bba3929
Author: Volker Lendecke <[email protected]>
Date: Tue Jan 28 12:44:05 2025 +0100
vfs: Implement catia_fstatat()
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit b6d7152f92864c2767a5748624d208348dd55c92
Author: Volker Lendecke <[email protected]>
Date: Tue Jan 28 05:58:24 2025 +0100
vfs: Implement cap_fstatat()
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit cd73bae025a5001aca25d07f658d9f8f39883433
Author: Volker Lendecke <[email protected]>
Date: Thu Mar 20 18:42:37 2025 +0100
vfs: Fix typos.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 4dd5b7bcb60724166f6e1da95f6d2bd34f0e4a76
Author: Volker Lendecke <[email protected]>
Date: Thu Mar 20 18:38:54 2025 +0100
vfs: Fix whitespace
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 0afb222b7ee79288d605c7619b6e41da883abff6
Author: Volker Lendecke <[email protected]>
Date: Thu Mar 20 17:59:55 2025 +0100
net: Remove a call to SMB_VFS_STAT and dirfsp==NULL in create_file
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit e574cab373c970d71c894b73e1e7dab040f5e912
Author: Volker Lendecke <[email protected]>
Date: Thu Mar 20 17:57:11 2025 +0100
net: Fix a panic in "net vfs getntacl"
We have to explicitly free smb_fname, because after openat_pathref_fsp
we have a file descriptor around. If we then later talloc_free() the
connection_struct, fd_handle_destructor() panics because talloc_free()
does not free smb_fname before the connection_struct.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 441a85e033f8ec2fba4e92b24485d0416b1ffa9d
Author: Volker Lendecke <[email protected]>
Date: Thu Mar 20 09:47:15 2025 +0100
lib: Pass "dirfsp" to ad_collect_one_stream()
Avoid a call to SMB_VFS_CREATE_FILE with dirfsp==NULL
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 49b0982ead9c3ed981c7b9250bb8bba525995a50
Author: Volker Lendecke <[email protected]>
Date: Thu Mar 20 09:32:39 2025 +0100
lib: Use dirfsp/relname in ad_unconvert()
Replace a call to SMB_VFS_STAT with SMB_VFS_FSTATAT, avoid a call to
SMB_VFS_CREATE_FILE with "dirfsp == NULL".
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 8a0f3ae1d1c03bce4a18615b75ff08ded9d91561
Author: Volker Lendecke <[email protected]>
Date: Thu Mar 20 09:30:39 2025 +0100
lib: Add adouble_name()
Just prepend "._" to a relname.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 2e0e47d45cea89bcc05247f2f4dbe609aef9b0ff
Author: Volker Lendecke <[email protected]>
Date: Wed Mar 19 17:45:59 2025 +0100
lib: Avoid a VFS_STAT call in "net vfs stream2adouble"
Call filename_convert_dirfsp() in ad_unconvert, which takes care of
proper symlink redirects. This will be used more in further patches.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit a605a84cee7ae12cbc4d9fe9d857e4b55c129ac4
Author: Volker Lendecke <[email protected]>
Date: Wed Mar 19 17:29:40 2025 +0100
lib: Convert ad_unconvert() to NTSTATUS
Drop error information later
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 8f8378b1d49bc03d18a3eeb1b4ec48894f6d6ea3
Author: Volker Lendecke <[email protected]>
Date: Wed Mar 19 17:11:49 2025 +0100
lib: Convert ad_collect_one_stream() to NTSTATUS
Drop error information later
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 3dc25cb244c7521d507cca9a86108acca6ba69e2
Author: Volker Lendecke <[email protected]>
Date: Wed Mar 19 17:09:58 2025 +0100
lib: Convert ad_unconvert_open_ad() to NTSTATUS
Drop error information later
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
commit 374a8dd605ea58b469c4b006288a0eab2ff3d995
Author: Volker Lendecke <[email protected]>
Date: Wed Mar 19 15:49:21 2025 +0100
lib: Convert ad_unconvert_get_streams() to NTSTATUS
Drop error information later
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
lib/replace/snprintf.c | 5 +-
lib/tevent/testsuite.c | 2 +-
lib/tevent/tevent_epoll.c | 4 +-
lib/tevent/tevent_standard.c | 2 +-
libcli/smb/smbXcli_base.c | 2 +-
source3/lib/adouble.c | 231 +++++++++++++++++++++++------------------
source3/lib/adouble.h | 12 ++-
source3/modules/vfs_cap.c | 34 ++++++
source3/modules/vfs_catia.c | 36 +++++++
source3/modules/vfs_fake_dfq.c | 19 ++++
source3/modules/vfs_snapper.c | 95 ++++++++---------
source3/modules/vfs_syncops.c | 14 +--
source3/param/loadparm.c | 2 +-
source3/utils/net_vfs.c | 58 +++++------
14 files changed, 311 insertions(+), 205 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/replace/snprintf.c b/lib/replace/snprintf.c
index 63b0882e33f..f8cf38d1ef2 100644
--- a/lib/replace/snprintf.c
+++ b/lib/replace/snprintf.c
@@ -832,8 +832,9 @@ static void fmtint(char *buffer, size_t *currlen, size_t
maxlen,
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
do {
- convert[place++] = (caps ? hex_upper
- : hex_lower)[uvalue % (unsigned)base];
+ convert[place++] =
+ (caps ? hexchars_upper
+ : hexchars_lower)[uvalue % (unsigned)base];
uvalue = (uvalue / (unsigned)base );
} while(uvalue && (place < sizeof(convert)));
if (place == sizeof(convert)) place--;
diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c
index e0881661756..040e003934a 100644
--- a/lib/tevent/testsuite.c
+++ b/lib/tevent/testsuite.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
testing of the events subsystem
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index e56bd026887..233533e4d31 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
main select loop and event handling - epoll implementation
@@ -565,7 +565,7 @@ static void epoll_update_event(struct epoll_event_context
*epoll_ev, struct teve
epoll_mod_event(epoll_ev, primary);
return;
}
- /*
+ /*
* if we want to match the select behavior, we need to remove
the epoll_event
* when the caller isn't interested in events.
*
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
index 749cad0db77..659f11461aa 100644
--- a/lib/tevent/tevent_standard.c
+++ b/lib/tevent/tevent_standard.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
main select loop and event handling
Copyright (C) Stefan Metzmacher 2013
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index f61015f84c1..eecd73d0678 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -485,7 +485,7 @@ bool smbXcli_conn_is_connected(struct smbXcli_conn *conn)
}
ret = samba_socket_poll_or_sock_error(conn->sock_fd);
- if ( ret < 0) {
+ if (ret < 0) {
return false;
}
diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c
index 2e17bec01d3..f8ae89d670c 100644
--- a/source3/lib/adouble.c
+++ b/source3/lib/adouble.c
@@ -1600,26 +1600,27 @@ done:
return ret;
}
-static bool ad_unconvert_open_ad(TALLOC_CTX *mem_ctx,
- struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- struct smb_filename *adpath,
- files_struct **_fsp)
+static NTSTATUS ad_unconvert_open_ad(TALLOC_CTX *mem_ctx,
+ struct vfs_handle_struct *handle,
+ struct smb_filename *smb_fname,
+ struct files_struct *dirfsp,
+ struct smb_filename *adname,
+ files_struct **_fsp)
{
+ struct smb_filename *adpath = NULL;
files_struct *fsp = NULL;
NTSTATUS status;
int ret;
- status = openat_pathref_fsp(handle->conn->cwd_fsp, adpath);
- if (!NT_STATUS_IS_OK(status) &&
- !NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
- return false;
+ adpath = full_path_from_dirfsp_atname(mem_ctx, dirfsp, adname);
+ if (adpath == NULL) {
+ return NT_STATUS_NO_MEMORY;
}
status = SMB_VFS_CREATE_FILE(
handle->conn,
NULL, /* req */
- NULL, /* dirfsp */
+ dirfsp, /* dirfsp */
adpath,
FILE_READ_DATA|FILE_WRITE_DATA,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
@@ -1638,7 +1639,7 @@ static bool ad_unconvert_open_ad(TALLOC_CTX *mem_ctx,
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("SMB_VFS_CREATE_FILE [%s] failed: %s\n",
smb_fname_str_dbg(adpath), nt_errstr(status));
- return false;
+ return status;
}
if (fsp->fsp_name->st.st_ex_uid != smb_fname->st.st_ex_uid ||
@@ -1648,29 +1649,30 @@ static bool ad_unconvert_open_ad(TALLOC_CTX *mem_ctx,
smb_fname->st.st_ex_uid,
smb_fname->st.st_ex_gid);
if (ret != 0) {
+ status = map_nt_error_from_unix(errno);
DBG_ERR("SMB_VFS_FCHOWN [%s] failed: %s\n",
fsp_str_dbg(fsp), nt_errstr(status));
close_file_free(NULL, &fsp, NORMAL_CLOSE);
- return false;
+ return status;
}
}
*_fsp = fsp;
- return true;
+ return status;
}
-static bool ad_unconvert_get_streams(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- TALLOC_CTX *mem_ctx,
- unsigned int *num_streams,
- struct stream_struct **streams)
+static NTSTATUS ad_unconvert_get_streams(struct vfs_handle_struct *handle,
+ struct smb_filename *smb_fname,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *num_streams,
+ struct stream_struct **streams)
{
files_struct *fsp = NULL;
NTSTATUS status;
status = openat_pathref_fsp(handle->conn->cwd_fsp, smb_fname);
if (!NT_STATUS_IS_OK(status)) {
- return false;
+ return status;
}
status = SMB_VFS_CREATE_FILE(
@@ -1697,7 +1699,7 @@ static bool ad_unconvert_get_streams(struct
vfs_handle_struct *handle,
DBG_ERR("Opening [%s] failed: %s\n",
smb_fname_str_dbg(smb_fname),
nt_errstr(status));
- return false;
+ return status;
}
status = vfs_fstreaminfo(fsp,
@@ -1709,7 +1711,7 @@ static bool ad_unconvert_get_streams(struct
vfs_handle_struct *handle,
DBG_ERR("streaminfo on [%s] failed: %s\n",
smb_fname_str_dbg(smb_fname),
nt_errstr(status));
- return false;
+ return status;
}
status = close_file_free(NULL, &fsp, NORMAL_CLOSE);
@@ -1717,10 +1719,10 @@ static bool ad_unconvert_get_streams(struct
vfs_handle_struct *handle,
DBG_ERR("close_file [%s] failed: %s\n",
smb_fname_str_dbg(smb_fname),
nt_errstr(status));
- return false;
+ return status;
}
- return true;
+ return NT_STATUS_OK;
}
struct ad_collect_state {
@@ -1729,12 +1731,13 @@ struct ad_collect_state {
char *rsrc_data_buf;
};
-static bool ad_collect_one_stream(struct vfs_handle_struct *handle,
- struct char_mappings **cmaps,
- struct smb_filename *smb_fname,
- const struct stream_struct *stream,
- struct adouble *ad,
- struct ad_collect_state *state)
+static NTSTATUS ad_collect_one_stream(struct vfs_handle_struct *handle,
+ struct char_mappings **cmaps,
+ struct files_struct *dirfsp,
+ struct smb_filename *smb_fname,
+ const struct stream_struct *stream,
+ struct adouble *ad,
+ struct ad_collect_state *state)
{
struct smb_filename *sname = NULL;
files_struct *fsp = NULL;
@@ -1754,26 +1757,25 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
smb_fname->twrp,
0);
if (sname == NULL) {
- return false;
+ return NT_STATUS_NO_MEMORY;
}
if (is_ntfs_default_stream_smb_fname(sname)) {
TALLOC_FREE(sname);
- return true;
+ return NT_STATUS_OK;
}
DBG_DEBUG("Collecting stream [%s]\n", smb_fname_str_dbg(sname));
status = openat_pathref_fsp(handle->conn->cwd_fsp, sname);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto out;
}
status = SMB_VFS_CREATE_FILE(
handle->conn,
NULL, /* req */
- NULL, /* dirfsp */
+ dirfsp, /* dirfsp */
sname,
FILE_READ_DATA|DELETE_ACCESS,
FILE_SHARE_READ,
@@ -1792,7 +1794,6 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("SMB_VFS_CREATE_FILE [%s] failed\n",
smb_fname_str_dbg(sname));
- ok = false;
goto out;
}
@@ -1803,7 +1804,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
DBG_ERR("Bad size [%zd] on [%s]\n",
(ssize_t)stream->size,
smb_fname_str_dbg(sname));
- ok = false;
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
goto out;
}
@@ -1812,7 +1813,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
DBG_ERR("Bad size [%zd] on [%s]\n",
(ssize_t)stream->size,
smb_fname_str_dbg(sname));
- ok = false;
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
goto out;
}
@@ -1827,17 +1828,17 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
if (!ok) {
DBG_ERR("Deleting [%s] failed\n",
smb_fname_str_dbg(sname));
- ok = false;
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
goto out;
}
- ok = true;
+ status = NT_STATUS_OK;
goto out;
}
if (is_afpresource_stream(stream->name)) {
ad->ad_rsrc_data = talloc_size(ad, stream->size);
if (ad->ad_rsrc_data == NULL) {
- ok = false;
+ status = NT_STATUS_NO_MEMORY;
goto out;
}
@@ -1849,7 +1850,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
DBG_ERR("Bad size [%zd] on [%s]\n",
(ssize_t)stream->size,
smb_fname_str_dbg(sname));
- ok = false;
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
goto out;
}
@@ -1870,11 +1871,11 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
if (!ok) {
DBG_ERR("Deleting [%s] failed\n",
smb_fname_str_dbg(sname));
- ok = false;
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
goto out;
}
}
- ok = true;
+ status = NT_STATUS_OK;
goto out;
}
@@ -1883,7 +1884,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
struct ad_xattr_entry,
ad->adx_header.adx_num_attrs + 1);
if (ad->adx_entries == NULL) {
- ok = false;
+ status = NT_STATUS_NO_MEMORY;
goto out;
}
@@ -1893,7 +1894,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
};
e->adx_name = talloc_strdup(ad, stream->name + 1);
if (e->adx_name == NULL) {
- ok = false;
+ status = NT_STATUS_NO_MEMORY;
goto out;
}
p = strchr(e->adx_name, ':');
@@ -1909,7 +1910,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
vfs_translate_to_unix);
if (rc != 0) {
DBG_ERR("string_replace_allocate failed: %s\n", strerror(rc));
- ok = false;
+ status = map_nt_error_from_unix(rc);
goto out;
}
@@ -1930,7 +1931,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
char,
needed_size);
if (ad->adx_data == NULL) {
- ok = false;
+ status = NT_STATUS_NO_MEMORY;
goto out;
}
}
@@ -1943,7 +1944,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
DBG_ERR("Bad size [%zd] on [%s]\n",
(ssize_t)stream->size,
smb_fname_str_dbg(sname));
- ok = false;
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
goto out;
}
state->adx_data_off += nread;
@@ -1955,7 +1956,7 @@ static bool ad_collect_one_stream(struct
vfs_handle_struct *handle,
if (!ok) {
DBG_ERR("Deleting [%s] failed\n",
smb_fname_str_dbg(sname));
- ok = false;
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
goto out;
}
@@ -1967,27 +1968,29 @@ out:
DBG_ERR("close_file [%s] failed: %s\n",
smb_fname_str_dbg(smb_fname),
nt_errstr(status));
- ok = false;
}
}
- return ok;
+ return status;
}
/**
* Convert filesystem metadata to AppleDouble file
**/
-bool ad_unconvert(TALLOC_CTX *mem_ctx,
- struct vfs_handle_struct *handle,
- const char *catia_mappings,
- struct smb_filename *smb_fname,
- bool *converted)
+NTSTATUS ad_unconvert(TALLOC_CTX *mem_ctx,
+ struct vfs_handle_struct *handle,
+ const char *catia_mappings,
+ struct smb_filename *smb_fname,
+ bool *converted)
{
static struct char_mappings **cmaps = NULL;
TALLOC_CTX *frame = talloc_stackframe();
struct ad_collect_state state;
struct stream_struct *streams = NULL;
- struct smb_filename *adpath = NULL;
+ struct smb_filename *adname = NULL;
+ struct files_struct *dirfsp = NULL;
+ struct smb_filename *fullname = NULL;
+ struct smb_filename *relname = NULL;
struct adouble *ad = NULL;
unsigned int num_streams = 0;
size_t to_convert = 0;
@@ -1996,7 +1999,6 @@ bool ad_unconvert(TALLOC_CTX *mem_ctx,
size_t i;
NTSTATUS status;
int ret;
- bool ok;
*converted = false;
@@ -2006,19 +2008,32 @@ bool ad_unconvert(TALLOC_CTX *mem_ctx,
mappings = str_list_make_v3_const(
frame, catia_mappings, NULL);
if (mappings == NULL) {
- ok = false;
+ status = NT_STATUS_NO_MEMORY;
goto out;
}
cmaps = string_replace_init_map(mem_ctx, mappings);
TALLOC_FREE(mappings);
}
- ok = ad_unconvert_get_streams(handle,
- smb_fname,
- frame,
- &num_streams,
- &streams);
- if (!ok) {
+ status = filename_convert_dirfsp_rel(frame,
+ handle->conn,
+ handle->conn->cwd_fsp,
+ smb_fname->base_name,
+ 0,
+ smb_fname->twrp,
+ &dirfsp,
+ &fullname,
+ &relname);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ if (!VALID_STAT(relname->st)) {
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ status = ad_unconvert_get_streams(
+ handle, fullname, frame, &num_streams, &streams);
+ if (!NT_STATUS_IS_OK(status)) {
goto out;
}
@@ -2033,7 +2048,7 @@ bool ad_unconvert(TALLOC_CTX *mem_ctx,
}
if (to_convert == 0) {
- ok = true;
+ status = NT_STATUS_OK;
goto out;
}
@@ -2041,18 +2056,18 @@ bool ad_unconvert(TALLOC_CTX *mem_ctx,
.adx_data_off = 0,
};
- ret = adouble_path(frame, smb_fname, &adpath);
- if (ret != 0) {
- ok = false;
+ adname = adouble_name(frame, relname);
+ if (adname == NULL) {
+ status = NT_STATUS_NO_MEMORY;
goto out;
}
- ret = SMB_VFS_STAT(handle->conn, adpath);
+ ret = SMB_VFS_FSTATAT(handle->conn, dirfsp, adname, &adname->st, 0);
if (ret == 0) {
state.have_adfile = true;
} else {
if (errno != ENOENT) {
- ok = false;
+ status = map_nt_error_from_unix(errno);
goto out;
}
state.have_adfile = false;
@@ -2064,56 +2079,57 @@ bool ad_unconvert(TALLOC_CTX *mem_ctx,
* from an AppleDouble file. Fine, that means there's nothing to
* convert.
*/
- ok = true;
+ status = NT_STATUS_OK;
goto out;
}
ad = ad_init(frame, ADOUBLE_RSRC);
if (ad == NULL) {
- ok = false;
+ status = NT_STATUS_NO_MEMORY;
goto out;
}
for (i = 0; i < num_streams; i++) {
- ok = ad_collect_one_stream(handle,
--
Samba Shared Repository