]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Pass "create_options" to filename_create_ucf_flags()
authorVolker Lendecke <vl@samba.org>
Fri, 2 Feb 2024 20:16:46 +0000 (21:16 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 22 Nov 2024 09:50:37 +0000 (09:50 +0000)
OPEN_REPARSE_POINT will trigger symlinks not being followed but
returned, even if we have "follow symlinks = yes". Prepare for setting
UCF_LCOMP_LNK_OK for this case in a central place.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/filename.c
source3/smbd/proto.h
source3/smbd/smb1_nttrans.c
source3/smbd/smb1_reply.c
source3/smbd/smb2_create.c

index 0c2e365c239dd5cf92dc095bfc5e79d8a9f3cd80..6b31670eff3b865fe8038ab9b2816489d91ba99d 100644 (file)
@@ -57,7 +57,9 @@ uint32_t ucf_flags_from_smb_request(struct smb_request *req)
        return ucf_flags;
 }
 
-uint32_t filename_create_ucf_flags(struct smb_request *req, uint32_t create_disposition)
+uint32_t filename_create_ucf_flags(struct smb_request *req,
+                                  uint32_t create_disposition,
+                                  uint32_t create_options)
 {
        uint32_t ucf_flags = 0;
 
index 4a3d8259160f55ce941d654ee909240bd93be054..fe2ad67a03b07a94d7636ab206282dfefc9f1124 100644 (file)
@@ -288,7 +288,9 @@ NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_throug
 /* The following definitions come from smbd/filename.c  */
 
 uint32_t ucf_flags_from_smb_request(struct smb_request *req);
-uint32_t filename_create_ucf_flags(struct smb_request *req, uint32_t create_disposition);
+uint32_t filename_create_ucf_flags(struct smb_request *req,
+                                  uint32_t create_disposition,
+                                  uint32_t create_options);
 NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname,
                                    uint32_t ucf_flags,
                                    NTTIME twrp);
index 001e3be6df99daaf9e94e09dd4e3fc6edc4efe5a..554059059d4702b99da221754bed168c50046ee4 100644 (file)
@@ -626,7 +626,9 @@ void reply_ntcreate_and_X(struct smb_request *req)
                fname = new_fname;
        }
 
-       ucf_flags = filename_create_ucf_flags(req, create_disposition);
+       ucf_flags = filename_create_ucf_flags(req,
+                                             create_disposition,
+                                             create_options);
        if (ucf_flags & UCF_GMT_PATHNAME) {
                extract_snapshot_token(fname, &twrp);
        }
@@ -1087,7 +1089,9 @@ static void call_nt_transact_create(connection_struct *conn,
                fname = new_fname;
        }
 
-       ucf_flags = filename_create_ucf_flags(req, create_disposition);
+       ucf_flags = filename_create_ucf_flags(req,
+                                             create_disposition,
+                                             create_options);
        if (ucf_flags & UCF_GMT_PATHNAME) {
                extract_snapshot_token(fname, &twrp);
        }
index 3b71f5fb8ba17c28659a899037ea949fbb567a76..4256593897da9d407b515732a2c2edd27b62ce1f 100644 (file)
@@ -1789,7 +1789,9 @@ void reply_open(struct smb_request *req)
                goto out;
        }
 
-       ucf_flags = filename_create_ucf_flags(req, create_disposition);
+       ucf_flags = filename_create_ucf_flags(req,
+                                             create_disposition,
+                                             create_options);
 
        if (ucf_flags & UCF_GMT_PATHNAME) {
                extract_snapshot_token(fname, &twrp);
@@ -1990,7 +1992,9 @@ void reply_open_and_X(struct smb_request *req)
                goto out;
        }
 
-       ucf_flags = filename_create_ucf_flags(req, create_disposition);
+       ucf_flags = filename_create_ucf_flags(req,
+                                             create_disposition,
+                                             create_options);
 
        if (ucf_flags & UCF_GMT_PATHNAME) {
                extract_snapshot_token(fname, &twrp);
@@ -2428,7 +2432,9 @@ void reply_mknew(struct smb_request *req)
                goto out;
        }
 
-       ucf_flags = filename_create_ucf_flags(req, create_disposition);
+       ucf_flags = filename_create_ucf_flags(req,
+                                             create_disposition,
+                                             create_options);
        if (ucf_flags & UCF_GMT_PATHNAME) {
                extract_snapshot_token(fname, &twrp);
        }
@@ -2583,7 +2589,7 @@ void reply_ctemp(struct smb_request *req)
                        goto out;
                }
 
-               ucf_flags = filename_create_ucf_flags(req, FILE_CREATE);
+               ucf_flags = filename_create_ucf_flags(req, FILE_CREATE, 0);
                if (ucf_flags & UCF_GMT_PATHNAME) {
                        extract_snapshot_token(fname, &twrp);
                }
@@ -6179,7 +6185,7 @@ void reply_mkdir(struct smb_request *req)
                goto out;
        }
 
-       ucf_flags = filename_create_ucf_flags(req, FILE_CREATE);
+       ucf_flags = filename_create_ucf_flags(req, FILE_CREATE, 0);
        if (ucf_flags & UCF_GMT_PATHNAME) {
                extract_snapshot_token(directory, &twrp);
        }
index 65744e0bf37fb63236d02fc8f558b0c139febd62..b2a60e2a4b7bd97059491d6adadd6cc6379d4a4d 100644 (file)
@@ -520,7 +520,7 @@ static NTSTATUS smbd_smb2_create_durable_lease_check(struct smb_request *smb1req
                return status;
        }
 
-       ucf_flags = filename_create_ucf_flags(smb1req, FILE_OPEN);
+       ucf_flags = filename_create_ucf_flags(smb1req, FILE_OPEN, 0);
        status = filename_convert_dirfsp(talloc_tos(),
                                         fsp->conn,
                                         filename,
@@ -1063,8 +1063,9 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, state->ev);
        }
 
-       ucf_flags = filename_create_ucf_flags(
-               smb1req, state->in_create_disposition);
+       ucf_flags = filename_create_ucf_flags(smb1req,
+                                             state->in_create_disposition,
+                                             state->in_create_options);
 
        status = filename_convert_dirfsp(
                req,