1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

libsmbclient: Read the file type from the server with posix enabled

This does not really request posix extensions, but it depends on them
being activated because it changes behaviour.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2023-08-23 16:04:00 +02:00 committed by Jeremy Allison
parent feb7803555
commit 6a4413c65c

View File

@ -467,6 +467,7 @@ SMBC_getatr(SMBCCTX * context,
struct timespec w_time_ts = {0}; struct timespec w_time_ts = {0};
time_t write_time = 0; time_t write_time = 0;
SMB_INO_T ino = 0; SMB_INO_T ino = 0;
mode_t mode = S_IFREG;
struct cli_credentials *creds = NULL; struct cli_credentials *creds = NULL;
TALLOC_CTX *frame = talloc_stackframe(); TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status; NTSTATUS status;
@ -517,7 +518,7 @@ SMBC_getatr(SMBCCTX * context,
&size, &size,
&attr, &attr,
&ino, &ino,
NULL); &mode);
if (NT_STATUS_IS_OK(status)) { if (NT_STATUS_IS_OK(status)) {
goto setup_stat; goto setup_stat;
} }
@ -584,6 +585,10 @@ setup_stat:
change_time_ts, change_time_ts,
write_time_ts); write_time_ts);
if ((context->internal->posix_extensions) && (mode != S_IFREG)) {
sb->st_mode = (sb->st_mode & ~S_IFMT) | mode;
}
TALLOC_FREE(frame); TALLOC_FREE(frame);
return NT_STATUS_OK; return NT_STATUS_OK;