smbd: Remove NTCREATEX_FLAG_DELETE_ON_CLOSE
authorVolker Lendecke <vl@samba.org>
Thu, 19 May 2022 18:05:52 +0000 (20:05 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 6 Jun 2022 19:22:28 +0000 (19:22 +0000)
This is only used for print files. Storing it in the fd_handle seems
overkill to me, this can easily be stored directly in the fsp itself,
we have a flag for this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/smb.h
source3/printing/printspoolss.c
source3/smbd/fd_handle.c
source3/smbd/smb1_trans2.c
source3/smbd/smb2_setinfo.c

index 90105e00b14c28c9aa272a9d0d5b631646b2447b..6363bdc0c938f188fd6451d79459d13cba748bed 100644 (file)
@@ -407,9 +407,6 @@ Offset  Data                        length.
 #define NTCREATEX_FLAG_DENY_DOS                        0x0001
 #define NTCREATEX_FLAG_DENY_FCB                        0x0002
 
-/* Private flag for printer support */
-#define NTCREATEX_FLAG_DELETE_ON_CLOSE         0x0008
-
 /* Private flag for streams support */
 #define NTCREATEX_FLAG_STREAM_BASEOPEN         0x0010
 
index f02f584ad484fbf6c26df2983669c89c41cc9c9a..31117a4b74389bcf0034231df722514dbbfa7a7b 100644 (file)
@@ -243,6 +243,7 @@ NTSTATUS print_spool_open(files_struct *fsp,
        fsp->oplock_type = NO_OPLOCK;
        fsp->sent_oplock_break = NO_BREAK_SENT;
        fsp->fsp_flags.is_directory = false;
+       fsp->fsp_flags.delete_on_close = false;
 
        fsp->print_file = pf;
 
@@ -319,8 +320,7 @@ void print_spool_end(files_struct *fsp, enum file_close_type close_type)
        WERROR werr;
        struct dcerpc_binding_handle *b = NULL;
 
-       if (fh_get_private_options(fsp->fh) &
-           NTCREATEX_FLAG_DELETE_ON_CLOSE) {
+       if (fsp->fsp_flags.delete_on_close) {
                int ret;
 
                /*
index e599181fe6b92b79fa4bdf2b40750020c573649d..87472909787d7f9b07580170c3a2cb0e5fe85fd9 100644 (file)
@@ -28,11 +28,7 @@ struct fd_handle {
        /*
         * NT Create options, but we only look at
         * NTCREATEX_FLAG_DENY_DOS and
-        * NTCREATEX_FLAG_DENY_FCB and
-        * NTCREATEX_FLAG_DELETE_ON_CLOSE
-        * for print files *only*, where
-        * DELETE_ON_CLOSE is not stored in the share
-        * mode database.
+        * NTCREATEX_FLAG_DENY_FCB.
         */
        uint32_t private_options;
        uint64_t gen_id;
index ea11788c783393e3d53a87cbd88fd0e07f0123a3..8c3bafa3a00521361b096d94b5413b0c957a95c1 100644 (file)
@@ -2415,12 +2415,8 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                         * Doing a DELETE_ON_CLOSE should cancel a print job.
                         */
                        if ((info_level == SMB_SET_FILE_DISPOSITION_INFO) && CVAL(pdata,0)) {
-                               uint32_t new_private_options =
-                                       fh_get_private_options(fsp->fh);
-                               new_private_options |=
-                                       NTCREATEX_FLAG_DELETE_ON_CLOSE;
-                               fh_set_private_options(fsp->fh,
-                                                      new_private_options);
+
+                               fsp->fsp_flags.delete_on_close = true;
 
                                DEBUG(3,("call_trans2setfilepathinfo: "
                                         "Cancelling print job (%s)\n",
index d3c3ba63d6b6302cc88607abd75aefed25d2e110..04fd9490fe9019d9201800ffb81e9d758a785b0a 100644 (file)
@@ -439,10 +439,7 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
                        if ((file_info_level == SMB_SET_FILE_DISPOSITION_INFO)
                            && in_input_buffer.length >= 1
                            && CVAL(in_input_buffer.data,0)) {
-                               uint32_t new_private_options =
-                                       fh_get_private_options(fsp->fh);
-                               new_private_options |= NTCREATEX_FLAG_DELETE_ON_CLOSE;
-                               fh_set_private_options(fsp->fh, new_private_options);
+                               fsp->fsp_flags.delete_on_close = true;
 
                                DEBUG(3,("smbd_smb2_setinfo_send: "
                                         "Cancelling print job (%s)\n",