From ca2add8c96822cccc91d5008ab975c54e7244533 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 4 Mar 2025 17:33:44 +0100 Subject: [PATCH] s3:smbd: disable "vfs mkdir use tmp name = auto" on OpenBSD This is the simplest way to avoid a regression. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15801 Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Ralph Boehme Signed-off-by: Stefan Metzmacher Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Wed Mar 5 12:37:40 UTC 2025 on atb-devel-224 (cherry picked from commit a3f129f66346dcec41a01caf8060fe1a9da484ac) Autobuild-User(v4-22-test): Jule Anger Autobuild-Date(v4-22-test): Wed Mar 5 15:13:18 UTC 2025 on atb-devel-224 --- docs-xml/smbdotconf/vfs/vfsmkdirusetmpname.xml | 2 ++ source3/smbd/open.c | 13 +++++++++++++ source3/wscript | 3 +++ 3 files changed, 18 insertions(+) diff --git a/docs-xml/smbdotconf/vfs/vfsmkdirusetmpname.xml b/docs-xml/smbdotconf/vfs/vfsmkdirusetmpname.xml index 92a39f8f541..a0d733c47f8 100644 --- a/docs-xml/smbdotconf/vfs/vfsmkdirusetmpname.xml +++ b/docs-xml/smbdotconf/vfs/vfsmkdirusetmpname.xml @@ -31,6 +31,8 @@ , or . + Note on OpenBSD Auto (the default) is mapped to no, + see https://bugzilla.samba.org/show_bug.cgi?id=15801. diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 3982c39ed47..771734f6203 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -4564,6 +4564,19 @@ static NTSTATUS mkdir_internal(connection_struct *conn, need_tmpname = true; } +#ifdef OPENBSD + /* + * OpenBSD requires to have write permissions + * on both source and destimation of renameat(), + * see https://bugzilla.samba.org/show_bug.cgi?id=15801 + * + * For now just disable the new code by default. + */ + if (vfs_use_tmp == Auto) { + vfs_use_tmp = false; + } +#endif + if (vfs_use_tmp != Auto) { need_tmpname = vfs_use_tmp; } diff --git a/source3/wscript b/source3/wscript index 26327cba32f..64ce229d030 100644 --- a/source3/wscript +++ b/source3/wscript @@ -457,6 +457,9 @@ vsyslog conf.DEFINE('HAVE_FREEBSD_SUNACL_H', '1') conf.CHECK_FUNCS_IN(['acl'], 'sunacl') conf.DEFINE('STAT_ST_BLOCKSIZE', '512') + elif (host_os.rfind('openbsd') > -1): + conf.DEFINE('OPENBSD', 1) + conf.DEFINE('STAT_ST_BLOCKSIZE', '512') elif (host_os.rfind('irix') > -1): conf.DEFINE('IRIX', 1) conf.DEFINE('STAT_ST_BLOCKSIZE', '512') -- 2.47.2