]> git.pld-linux.org Git - packages/samba.git/blob - samba-force-user.patch
- liburing rebuild
[packages/samba.git] / samba-force-user.patch
1 From abef21596b901c00bf5d9c583ae562678d2cfbc1 Mon Sep 17 00:00:00 2001
2 From: Ralph Boehme <slow@samba.org>
3 Date: Sat, 23 Jan 2021 18:36:23 +0100
4 Subject: [PATCH] smbd: use fsp->conn->session_info for the initial
5  delete-on-close token
6
7 There's a correctly set up session_info at fsp->conn->session_info, we can just
8 use that. It has all the bells and whistles ("force user" and "force group").
9
10 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14617
11 ---
12  source3/smbd/close.c | 25 ++++---------------------
13  1 file changed, 4 insertions(+), 21 deletions(-)
14
15 diff --git a/source3/smbd/close.c b/source3/smbd/close.c
16 index 97d13473082..f05619d1886 100644
17 --- a/source3/smbd/close.c
18 +++ b/source3/smbd/close.c
19 @@ -342,21 +342,13 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
20  
21         if (fsp->fsp_flags.initial_delete_on_close &&
22                         !is_delete_on_close_set(lck, fsp->name_hash)) {
23 -               struct auth_session_info *session_info = NULL;
24 -
25                 /* Initial delete on close was set and no one else
26                  * wrote a real delete on close. */
27  
28 -               status = smbXsrv_session_info_lookup(conn->sconn->client,
29 -                                                    fsp->vuid,
30 -                                                    &session_info);
31 -               if (!NT_STATUS_IS_OK(status)) {
32 -                       return NT_STATUS_INTERNAL_ERROR;
33 -               }
34                 fsp->fsp_flags.delete_on_close = true;
35                 set_delete_on_close_lck(fsp, lck,
36 -                                       session_info->security_token,
37 -                                       session_info->unix_token);
38 +                                       fsp->conn->session_info->security_token,
39 +                                       fsp->conn->session_info->unix_token);
40         }
41  
42         delete_file = is_delete_on_close_set(lck, fsp->name_hash) &&
43 @@ -1175,24 +1167,15 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
44         }
45  
46         if (fsp->fsp_flags.initial_delete_on_close) {
47 -               struct auth_session_info *session_info = NULL;
48 -
49                 /* Initial delete on close was set - for
50                  * directories we don't care if anyone else
51                  * wrote a real delete on close. */
52  
53 -               status = smbXsrv_session_info_lookup(fsp->conn->sconn->client,
54 -                                                    fsp->vuid,
55 -                                                    &session_info);
56 -               if (!NT_STATUS_IS_OK(status)) {
57 -                       return NT_STATUS_INTERNAL_ERROR;
58 -               }
59 -
60                 send_stat_cache_delete_message(fsp->conn->sconn->msg_ctx,
61                                                fsp->fsp_name->base_name);
62                 set_delete_on_close_lck(fsp, lck,
63 -                                       session_info->security_token,
64 -                                       session_info->unix_token);
65 +                                       fsp->conn->session_info->security_token,
66 +                                       fsp->conn->session_info->unix_token);
67                 fsp->fsp_flags.delete_on_close = true;
68         }
69  
70 -- 
71 2.26.2
72
This page took 0.124032 seconds and 3 git commands to generate.