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

conf: Remove "smb3 unix extensions" parameter

Always offer it, it's a client thing to ask for it or not.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 21 17:43:23 UTC 2023 on atb-devel-224
This commit is contained in:
Volker Lendecke 2023-09-18 16:54:05 -07:00 committed by Jeremy Allison
parent 8b9f464420
commit b3cae8dcf1
7 changed files with 128 additions and 257 deletions

View File

@ -48,6 +48,7 @@ smb.conf changes
Parameter Name Description Default
-------------- ----------- -------
smb3 unix extensions removed always offered
KNOWN ISSUES

View File

@ -1,11 +0,0 @@
<samba:parameter name="smb3 unix extensions"
context="G"
type="boolean"
function="_smb3_unix_extensions"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>Incomplete SMB 3.11 Unix Extensions. This is only available
if Samba is compiled in DEVELOPER mode.</para>
</description>
<value type="default">no</value>
</samba:parameter>

View File

@ -26,18 +26,7 @@ def posix_context(mode):
class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
def enable_smb3unix(self):
with open(self.global_inject, 'w') as f:
f.write("smb3 unix extensions = yes\n")
def disable_smb3unix(self):
with open(self.global_inject, 'w') as f:
f.truncate()
def test_negotiate_context_posix(self):
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"tmp",
@ -46,22 +35,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
posix=True)
self.assertTrue(c.have_posix())
finally:
self.disable_smb3unix()
def test_negotiate_context_noposix(self):
c = libsmb.Conn(
self.server_ip,
"tmp",
self.lp,
self.creds,
posix=True)
self.assertFalse(c.have_posix())
def test_negotiate_context_posix_invalid_length(self):
try:
self.enable_smb3unix()
with self.assertRaises(NTSTATUSError) as cm:
c = libsmb.Conn(
self.server_ip,
@ -73,13 +47,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
e = cm.exception
self.assertEqual(e.args[0], ntstatus.NT_STATUS_INVALID_PARAMETER)
finally:
self.disable_smb3unix()
def test_negotiate_context_posix_invalid_blob(self):
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"tmp",
@ -88,13 +56,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
negotiate_contexts=[(0x100, b'0123456789012345')])
self.assertFalse(c.have_posix())
finally:
self.disable_smb3unix()
def test_posix_create_context(self):
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"tmp",
@ -109,28 +71,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
c.close(fnum)
finally:
self.disable_smb3unix()
def test_posix_create_context_noposix(self):
c = libsmb.Conn(
self.server_ip,
"tmp",
self.lp,
self.creds,
posix=True)
self.assertFalse(c.have_posix())
cc_in=[(libsmb.SMB2_CREATE_TAG_POSIX,b'0000')]
fnum,_,cc_out = c.create_ex("",CreateContexts=cc_in)
self.assertEqual(len(cc_out), 0)
c.close(fnum)
def test_posix_create_invalid_context_length(self):
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"tmp",
@ -147,9 +88,6 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
e = cm.exception
self.assertEqual(e.args[0], ntstatus.NT_STATUS_INVALID_PARAMETER)
finally:
self.disable_smb3unix()
def delete_test_file(self, c, fname, mode=0):
f,_,cc_out = c.create_ex(fname,
DesiredAccess=security.SEC_STD_ALL,
@ -161,8 +99,6 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
def test_posix_query_dir(self):
test_files = []
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"smb3_posix_share",
@ -193,12 +129,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
for fname in test_files:
self.delete_test_file(c, fname)
self.disable_smb3unix()
def test_posix_reserved_char(self):
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"smb3_posix_share",
@ -221,13 +152,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
c.delete_on_close(f, True)
c.close(f)
finally:
self.disable_smb3unix()
def test_posix_delete_on_close(self):
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"smb3_posix_share",
@ -243,13 +168,8 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
c.delete_on_close(f, True)
c.close(f)
finally:
self.disable_smb3unix()
def test_posix_case_sensitive(self):
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"smb3_posix_share",
@ -281,13 +201,9 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
finally:
self.delete_test_file(c, '\\xx')
self.disable_smb3unix()
def test_posix_perm_files(self):
test_files = {}
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"smb3_posix_share",
@ -337,12 +253,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
for fname in test_files.keys():
self.delete_test_file(c, '\\%s' % fname)
self.disable_smb3unix()
def test_share_root_null_sids_fid(self):
try:
self.enable_smb3unix()
c = libsmb.Conn(
self.server_ip,
"smb3_posix_share",
@ -360,5 +271,3 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
'The group sid for .. was not NULL')
self.assertEqual(0, dotdot['ino'], 'The ino for .. was not 0')
self.assertEqual(0, dotdot['dev'], 'The dev for .. was not 0')
finally:
self.disable_smb3unix()

View File

@ -4677,12 +4677,6 @@ void widelinks_warning(int snum)
"These parameters are incompatible. "
"Wide links will be disabled for this share.\n",
lp_const_servicename(snum));
} else if (lp_smb3_unix_extensions()) {
DBG_ERR("Share '%s' has wide links and SMB3 unix "
"extensions enabled. "
"These parameters are incompatible. "
"Wide links will be disabled for this share.\n",
lp_const_servicename(snum));
}
}
}
@ -4690,7 +4684,7 @@ void widelinks_warning(int snum)
bool lp_widelinks(int snum)
{
/* wide links is always incompatible with unix extensions */
if (lp_smb1_unix_extensions() || lp_smb3_unix_extensions()) {
if (lp_smb1_unix_extensions()) {
/*
* Unless we have "allow insecure widelinks"
* turned on.
@ -4830,16 +4824,3 @@ uint32_t lp_get_async_dns_timeout(void)
*/
return MAX(Globals.async_dns_timeout, 1);
}
bool lp_smb3_unix_extensions(void)
{
/*
* FIXME: If this gets always enabled, check source3/selftest/tests.py
* and source3/wscript for HAVE_SMB3_UNIX_EXTENSIONS.
*/
#if defined(DEVELOPER)
return lp__smb3_unix_extensions();
#else
return false;
#endif
}

View File

@ -182,7 +182,6 @@ void widelinks_warning(int snum);
const char *lp_ncalrpc_dir(void);
void _lp_set_server_role(int server_role);
uint32_t lp_get_async_dns_timeout(void);
bool lp_smb3_unix_extensions(void);
/* The following definitions come from param/loadparm_ctx.c */

View File

@ -276,8 +276,8 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
return smbd_smb2_request_error(req, status);
}
if (lp_smb3_unix_extensions()) {
in_posix = smb2_negotiate_context_find(&in_c,
in_posix = smb2_negotiate_context_find(
&in_c,
SMB2_POSIX_EXTENSIONS_AVAILABLE);
if (in_posix != NULL) {
@ -289,12 +289,13 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
* Check it's the right one.
*/
if ((inbuflen % 16) != 0) {
return smbd_smb2_request_error(req,
return smbd_smb2_request_error(
req,
NT_STATUS_INVALID_PARAMETER);
}
SMB_ASSERT(strlen(SMB2_CREATE_TAG_POSIX) == 16);
for (ofs=0; ofs<inbuflen; ofs+=16) {
if (memcmp(inbuf+ofs,
for (ofs = 0; ofs < inbuflen; ofs += 16) {
if (memcmp(inbuf + ofs,
SMB2_CREATE_TAG_POSIX,
16) == 0) {
posix_found = true;
@ -312,7 +313,6 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
}
}
}
}
if ((dialect != SMB2_DIALECT_REVISION_2FF) &&
(protocol >= PROTOCOL_SMB2_10) &&

View File

@ -1712,9 +1712,6 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx,
if (!(conn->sconn->using_smb2)) {
return NT_STATUS_INVALID_LEVEL;
}
if (!lp_smb3_unix_extensions()) {
return NT_STATUS_INVALID_LEVEL;
}
/* Determine the size of the posix info context */
plen = store_smb2_posix_info(conn,
@ -1976,7 +1973,6 @@ 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;
}
@ -3019,8 +3015,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
ok = true;
}
if (lp_smb3_unix_extensions() &&
(fsp != NULL) &&
if ((fsp != NULL) &&
(fsp->posix_flags & FSP_POSIX_FLAGS_OPEN)) {
DBG_DEBUG("SMB2 posix open\n");
ok = true;
@ -3670,9 +3665,6 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
if (!(conn->sconn->using_smb2)) {
return NT_STATUS_INVALID_LEVEL;
}
if (!lp_smb3_unix_extensions()) {
return NT_STATUS_INVALID_LEVEL;
}
if (fsp == NULL) {
return NT_STATUS_INVALID_HANDLE;
}