From: Volker Lendecke Date: Wed, 4 Jun 2025 06:19:56 +0000 (+0200) Subject: libsmbclient: Request posix file handles on demand X-Git-Tag: tevent-0.17.0~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a62739539a2f2b899788271e4a3074e738206f6;p=thirdparty%2Fsamba.git libsmbclient: Request posix file handles on demand Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index 14a567f67d2..79a00af4546 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -54,6 +54,7 @@ SMBC_open_ctx(SMBCCTX *context, NTSTATUS status = NT_STATUS_OBJECT_PATH_INVALID; struct cli_credentials *creds = NULL; TALLOC_CTX *frame = talloc_stackframe(); + bool smb311_posix_saved; if (!context || !context->internal->initialized) { TALLOC_FREE(frame); @@ -139,6 +140,17 @@ SMBC_open_ctx(SMBCCTX *context, } /*d_printf(">>>open: resolved %s as %s\n", path, targetpath);*/ + /* + * Indicate to cli_smb2_create_fnum_send() that we want file + * handles with posix extensions. + */ + + smb311_posix_saved = targetcli->smb2.client_smb311_posix; + targetcli->smb2.client_smb311_posix = + smbc_getOptionPosixExtensions(context) && + (smbXcli_conn_protocol(targetcli->conn) >= PROTOCOL_SMB3_11) && + smbXcli_conn_have_posix(targetcli->conn); + /* * Random error that the O_PATH if-block will never return */ @@ -177,6 +189,8 @@ SMBC_open_ctx(SMBCCTX *context, &fd); } + targetcli->smb2.client_smb311_posix = smb311_posix_saved; + if (!NT_STATUS_IS_OK(status)) { /* Handle the error ... */