mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
s3: libsmbclient: Fix smbc_stat() to return ENOENT on a non-existent file.
Remove knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15195 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org> (backported from commit fd0c01da1c744ae6fd9d8675616d8b6d3531e469) jra@samba.org: Older SMBC_getatr returns bool not NTSTATUS. Autobuild-User(v4-16-test): Jule Anger <janger@samba.org> Autobuild-Date(v4-16-test): Mon Oct 31 15:31:53 UTC 2022 on sn-devel-184
This commit is contained in:
parent
efa48817d3
commit
618395a7ea
@ -1,2 +0,0 @@
|
||||
^samba4.libsmbclient.getatr.NT1.getatr\(nt4_dc_smb1_done\)
|
||||
^samba4.libsmbclient.getatr.SMB3.getatr\(nt4_dc\)
|
@ -463,6 +463,7 @@ SMBC_getatr(SMBCCTX * context,
|
||||
struct timespec access_time_ts = {0};
|
||||
struct timespec write_time_ts = {0};
|
||||
struct timespec change_time_ts = {0};
|
||||
struct timespec w_time_ts = {0};
|
||||
time_t write_time = 0;
|
||||
SMB_INO_T ino = 0;
|
||||
struct cli_credentials *creds = NULL;
|
||||
@ -503,12 +504,13 @@ SMBC_getatr(SMBCCTX * context,
|
||||
&targetcli, &targetpath);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("Couldn't resolve %s\n", path);
|
||||
errno = ENOENT;
|
||||
TALLOC_FREE(frame);
|
||||
errno = cli_status_to_errno(status);
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!srv->no_pathinfo2) {
|
||||
bool not_supported_error = false;
|
||||
status = cli_qpathinfo2(targetcli,
|
||||
targetpath,
|
||||
&create_time_ts,
|
||||
@ -521,11 +523,22 @@ SMBC_getatr(SMBCCTX * context,
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
goto setup_stat;
|
||||
}
|
||||
if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_LEVEL) ||
|
||||
NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
|
||||
not_supported_error = true;
|
||||
}
|
||||
if (!not_supported_error) {
|
||||
/* "Normal error". Just return it to caller. */
|
||||
TALLOC_FREE(frame);
|
||||
errno = cli_status_to_errno(status);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
srv->no_pathinfo2 = True;
|
||||
|
||||
if (!srv->no_pathinfo3) {
|
||||
bool not_supported_error = false;
|
||||
status = cli_qpathinfo3(targetcli,
|
||||
targetpath,
|
||||
&create_time_ts,
|
||||
@ -538,24 +551,32 @@ SMBC_getatr(SMBCCTX * context,
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
goto setup_stat;
|
||||
}
|
||||
if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_LEVEL) ||
|
||||
NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
|
||||
not_supported_error = true;
|
||||
}
|
||||
if (!not_supported_error) {
|
||||
/* "Normal error". Just return it to caller. */
|
||||
TALLOC_FREE(frame);
|
||||
errno = cli_status_to_errno(status);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
srv->no_pathinfo3 = True;
|
||||
|
||||
/* if this is NT then don't bother with the getatr */
|
||||
if (smb1cli_conn_capabilities(targetcli->conn) & CAP_NT_SMBS) {
|
||||
status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
goto all_failed;
|
||||
}
|
||||
|
||||
status = cli_getatr(targetcli, targetpath, &attr, &size, &write_time);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
struct timespec w_time_ts =
|
||||
convert_time_t_to_timespec(write_time);
|
||||
|
||||
access_time_ts = change_time_ts = write_time_ts = w_time_ts;
|
||||
|
||||
goto setup_stat;
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto all_failed;
|
||||
}
|
||||
w_time_ts = convert_time_t_to_timespec(write_time);
|
||||
access_time_ts = change_time_ts = write_time_ts = w_time_ts;
|
||||
|
||||
setup_stat:
|
||||
setup_stat(sb,
|
||||
@ -575,8 +596,8 @@ all_failed:
|
||||
srv->no_pathinfo2 = False;
|
||||
srv->no_pathinfo3 = False;
|
||||
|
||||
errno = EPERM;
|
||||
TALLOC_FREE(frame);
|
||||
errno = cli_status_to_errno(status);
|
||||
return False;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user