]> git.pld-linux.org Git - packages/samba.git/blobdiff - samba-force-user.patch
- rel 2; fixes force user = permissions on delete; https://bugzilla.samba.org/show_bu...
[packages/samba.git] / samba-force-user.patch
diff --git a/samba-force-user.patch b/samba-force-user.patch
new file mode 100644 (file)
index 0000000..bf302d5
--- /dev/null
@@ -0,0 +1,72 @@
+From abef21596b901c00bf5d9c583ae562678d2cfbc1 Mon Sep 17 00:00:00 2001
+From: Ralph Boehme <slow@samba.org>
+Date: Sat, 23 Jan 2021 18:36:23 +0100
+Subject: [PATCH] smbd: use fsp->conn->session_info for the initial
+ delete-on-close token
+
+There's a correctly set up session_info at fsp->conn->session_info, we can just
+use that. It has all the bells and whistles ("force user" and "force group").
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=14617
+---
+ source3/smbd/close.c | 25 ++++---------------------
+ 1 file changed, 4 insertions(+), 21 deletions(-)
+
+diff --git a/source3/smbd/close.c b/source3/smbd/close.c
+index 97d13473082..f05619d1886 100644
+--- a/source3/smbd/close.c
++++ b/source3/smbd/close.c
+@@ -342,21 +342,13 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
+       if (fsp->fsp_flags.initial_delete_on_close &&
+                       !is_delete_on_close_set(lck, fsp->name_hash)) {
+-              struct auth_session_info *session_info = NULL;
+-
+               /* Initial delete on close was set and no one else
+                * wrote a real delete on close. */
+-              status = smbXsrv_session_info_lookup(conn->sconn->client,
+-                                                   fsp->vuid,
+-                                                   &session_info);
+-              if (!NT_STATUS_IS_OK(status)) {
+-                      return NT_STATUS_INTERNAL_ERROR;
+-              }
+               fsp->fsp_flags.delete_on_close = true;
+               set_delete_on_close_lck(fsp, lck,
+-                                      session_info->security_token,
+-                                      session_info->unix_token);
++                                      fsp->conn->session_info->security_token,
++                                      fsp->conn->session_info->unix_token);
+       }
+       delete_file = is_delete_on_close_set(lck, fsp->name_hash) &&
+@@ -1175,24 +1167,15 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
+       }
+       if (fsp->fsp_flags.initial_delete_on_close) {
+-              struct auth_session_info *session_info = NULL;
+-
+               /* Initial delete on close was set - for
+                * directories we don't care if anyone else
+                * wrote a real delete on close. */
+-              status = smbXsrv_session_info_lookup(fsp->conn->sconn->client,
+-                                                   fsp->vuid,
+-                                                   &session_info);
+-              if (!NT_STATUS_IS_OK(status)) {
+-                      return NT_STATUS_INTERNAL_ERROR;
+-              }
+-
+               send_stat_cache_delete_message(fsp->conn->sconn->msg_ctx,
+                                              fsp->fsp_name->base_name);
+               set_delete_on_close_lck(fsp, lck,
+-                                      session_info->security_token,
+-                                      session_info->unix_token);
++                                      fsp->conn->session_info->security_token,
++                                      fsp->conn->session_info->unix_token);
+               fsp->fsp_flags.delete_on_close = true;
+       }
+-- 
+2.26.2
+
This page took 0.032402 seconds and 4 git commands to generate.