[SCM] Samba Shared Repository - branch master updated

Björn Jacke bjacke at samba.org
Fri Jan 5 01:44:02 UTC 2024


The branch, master has been updated
       via  1047abf3aa3 selftest: let list_servers.NT1 really use NT1 protocol
       via  5c2286ecf5c vfs_worm: add connect function to cache parameters
       via  e84437eae6a set_process_capability: log which capability was set or failed to be set
      from  7e0a18acde8 vfs_ceph: use extra 'ceph_*at()' calls when available

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1047abf3aa352178c433051ede62353283513512
Author: Björn Jacke <bjacke at samba.org>
Date:   Thu Jan 4 12:55:53 2024 +0100

    selftest: let list_servers.NT1 really use NT1 protocol
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Björn Jacke <bjacke at samba.org>
    Autobuild-Date(master): Fri Jan  5 01:43:51 UTC 2024 on atb-devel-224

commit 5c2286ecf5c2ef5557dee4d5ec142a958c99b2ec
Author: Björn Jacke <bjacke at samba.org>
Date:   Sat Dec 30 19:53:36 2023 +0100

    vfs_worm: add connect function to cache parameters
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit e84437eae6a8356248cf7cc558903e86ead0eece
Author: Björn Jacke <bjacke at samba.org>
Date:   Sat Dec 30 18:28:59 2023 +0100

    set_process_capability: log which capability was set or failed to be set
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/system.c       |  5 +++--
 source3/modules/vfs_worm.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 source3/selftest/tests.py  |  2 +-
 3 files changed, 46 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/system.c b/source3/lib/system.c
index bdaa723fd3c..721ffd17f88 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -627,11 +627,12 @@ static bool set_process_capability(enum smbd_capability capability,
 	cap_set_flag(cap, CAP_INHERITABLE, num_cap_vals, cap_vals, CAP_CLEAR);
 
 	if (cap_set_proc(cap) == -1) {
-		DEBUG(0, ("set_process_capability: cap_set_proc failed: %s\n",
-			strerror(errno)));
+		DBG_ERR("adding capability %d: cap_set_proc failed: %s\n",
+			capability, strerror(errno));
 		cap_free(cap);
 		return False;
 	}
+	DBG_INFO("added capability %d\n", capability);
 
 	cap_free(cap);
 	return True;
diff --git a/source3/modules/vfs_worm.c b/source3/modules/vfs_worm.c
index 833a0ac26fe..402705e96e6 100644
--- a/source3/modules/vfs_worm.c
+++ b/source3/modules/vfs_worm.c
@@ -22,6 +22,41 @@
 #include "system/filesys.h"
 #include "libcli/security/security.h"
 
+struct worm_config_data {
+	double grace_period;
+};
+
+static int vfs_worm_connect(struct vfs_handle_struct *handle,
+			    const char *service, const char *user)
+{
+	struct worm_config_data *config = NULL;
+	int ret;
+
+	ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+	if (ret < 0) {
+		return ret;
+	}
+
+	if (IS_IPC(handle->conn) || IS_PRINT(handle->conn)) {
+		return 0;
+	}
+
+	config = talloc_zero(handle->conn, struct worm_config_data);
+	if (config == NULL) {
+		DBG_ERR("talloc_zero() failed\n");
+		errno = ENOMEM;
+		return -1;
+	}
+	config->grace_period = lp_parm_int(SNUM(handle->conn), "worm",
+						"grace_period", 3600);
+
+	SMB_VFS_HANDLE_SET_DATA(handle, config,
+				NULL, struct worm_config_data,
+				return -1);
+	return 0;
+
+}
+
 static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
 				     struct smb_request *req,
 				     struct files_struct *dirfsp,
@@ -48,12 +83,16 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
 		FILE_WRITE_ATTRIBUTES | DELETE_ACCESS |
 		WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS;
 	NTSTATUS status;
+	struct worm_config_data *config = NULL;
+
+	SMB_VFS_HANDLE_GET_DATA(handle, config,
+				struct worm_config_data,
+				return NT_STATUS_INTERNAL_ERROR);
 
 	if (VALID_STAT(smb_fname->st)) {
 		double age;
 		age = timespec_elapsed(&smb_fname->st.st_ex_ctime);
-		if (age > lp_parm_int(SNUM(handle->conn), "worm",
-				      "grace_period", 3600)) {
+		if (age > config->grace_period) {
 			readonly = true;
 		}
 	}
@@ -83,6 +122,7 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
 }
 
 static struct vfs_fn_pointers vfs_worm_fns = {
+	.connect_fn = vfs_worm_connect,
 	.create_file_fn = vfs_worm_create_file,
 };
 
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index bdc49527bde..dfe894872b7 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -826,7 +826,7 @@ for env in ["fileserver"]:
                   '$USERNAME',
                   '$PASSWORD',
                   smbclient3,
-                  "-mSMB3"])
+                  "-mNT1"])
     plantestsuite("samba3.blackbox.test_list_servers.SMB2",
                   env,
                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_list_servers.sh"),


-- 
Samba Shared Repository



More information about the samba-cvs mailing list