From: David Mulder Date: Mon, 12 Sep 2022 23:09:50 +0000 (-0700) Subject: smbd: Implement SMB2_FS_POSIX_INFORMATION_INTERNAL X-Git-Tag: talloc-2.4.0~464 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdb98c8397462805b4cdfaedeee24c5d2b294b86;p=thirdparty%2Fsamba.git smbd: Implement SMB2_FS_POSIX_INFORMATION_INTERNAL Signed-off-by: David Mulder Reviewed-by: Volker Lendecke --- diff --git a/source3/include/trans2.h b/source3/include/trans2.h index dfc59800846..3ed42a3f0b9 100644 --- a/source3/include/trans2.h +++ b/source3/include/trans2.h @@ -412,6 +412,7 @@ Byte offset Type name description #define SMB2_FILE_FULL_EA_INFORMATION (FSCC_FILE_FULL_EA_INFORMATION + SMB2_INFO_SPECIAL) #define SMB2_FILE_ALL_INFORMATION (FSCC_FILE_ALL_INFORMATION + SMB2_INFO_SPECIAL) #define SMB2_FILE_POSIX_INFORMATION_INTERNAL (SMB2_FILE_POSIX_INFORMATION + SMB2_INFO_SPECIAL) +#define SMB2_FS_POSIX_INFORMATION_INTERNAL 1100 /* NT passthrough levels for qfsinfo. */ diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index a58341477c4..e2724dc0e88 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -2184,6 +2184,23 @@ static void samba_extended_info_version(struct smb_extended_info *extended_info) "%s", samba_version_string()); } +static bool fsinfo_unix_valid_level(connection_struct *conn, + uint16_t info_level) +{ + if (conn->sconn->using_smb2 && + lp_smb3_unix_extensions() && + info_level == SMB2_FS_POSIX_INFORMATION_INTERNAL) { + return true; + } +#if defined(SMB1SERVER) + if (lp_smb1_unix_extensions() && + info_level == SMB_QUERY_POSIX_FS_INFO) { + return true; + } +#endif + return false; +} + NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn, connection_struct *conn, TALLOC_CTX *mem_ctx, @@ -2682,11 +2699,12 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned #endif case SMB_QUERY_POSIX_FS_INFO: + case SMB2_FS_POSIX_INFORMATION_INTERNAL: { int rc; struct vfs_statvfs_struct svfs; - if (!lp_smb1_unix_extensions()) { + if (!fsinfo_unix_valid_level(conn, info_level)) { return NT_STATUS_INVALID_LEVEL; }