]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use SMB_VFS_CREATE_FILE() in call_trans2mkdir()
authorRalph Boehme <slow@samba.org>
Wed, 28 Oct 2020 09:35:59 +0000 (10:35 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:31 +0000 (09:08 +0000)
Use SMB_VFS_CREATE_FILE() instead of the create_directory() in order to have a
fsp that we can pass to set_ea().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/trans2.c

index 497ae94b3924d3237f93be6f5f6c4c86eb1f46cf..41ed5e8a0b7b6a7031009c2370c24ddbd8921f68 100644 (file)
@@ -9561,6 +9561,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
                             char **ppdata, int total_data,
                             unsigned int max_data_bytes)
 {
+       struct files_struct *fsp = NULL;
        struct smb_filename *smb_dname = NULL;
        char *params = *pparams;
        char *pdata = *ppdata;
@@ -9661,8 +9662,24 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
         * The System i QNTC IBM SMB client puts bad values here,
         * so ignore them. */
 
-       status = create_directory(conn, req, smb_dname);
-
+       status = SMB_VFS_CREATE_FILE(
+               conn,                                   /* conn */
+               req,                                    /* req */
+               smb_dname,                              /* fname */
+               MAXIMUM_ALLOWED_ACCESS,                 /* access_mask */
+               FILE_SHARE_NONE,                        /* share_access */
+               FILE_CREATE,                            /* create_disposition*/
+               FILE_DIRECTORY_FILE,                    /* create_options */
+               FILE_ATTRIBUTE_DIRECTORY,               /* file_attributes */
+               0,                                      /* oplock_request */
+               NULL,                                   /* lease */
+               0,                                      /* allocation_size */
+               0,                                      /* private_flags */
+               NULL,                                   /* sd */
+               NULL,                                   /* ea_list */
+               &fsp,                                   /* result */
+               NULL,                                   /* pinfo */
+               NULL, NULL);                            /* create context */
        if (!NT_STATUS_IS_OK(status)) {
                reply_nterror(req, status);
                goto out;
@@ -9670,7 +9687,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
 
        /* Try and set any given EA. */
        if (ea_list) {
-               status = set_ea(conn, NULL, smb_dname, ea_list);
+               status = set_ea(conn, fsp, smb_dname, ea_list);
                if (!NT_STATUS_IS_OK(status)) {
                        reply_nterror(req, status);
                        goto out;
@@ -9690,6 +9707,10 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
        send_trans2_replies(conn, req, NT_STATUS_OK, params, 2, *ppdata, 0, max_data_bytes);
 
  out:
+       if (fsp != NULL) {
+               close_file(NULL, fsp, NORMAL_CLOSE);
+               fsp = NULL;
+       }
        TALLOC_FREE(smb_dname);
        return;
 }