s3:libsmb: pass impersonation_level to cli_smb2_create_fnum_send()
authorStefan Metzmacher <metze@samba.org>
Fri, 7 Dec 2018 15:32:05 +0000 (16:32 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 13 Dec 2018 07:52:24 +0000 (08:52 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Tim Beale <timbeale@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
examples/fuse/clifuse.c
source3/libsmb/cli_smb2_fnum.c
source3/libsmb/cli_smb2_fnum.h
source3/libsmb/clifile.c

index 3c7e4982475f0c60427f724a5177410a76e3a4a1..b724e642d4b46f547380b11b95f17648ff151879 100644 (file)
@@ -151,7 +151,8 @@ static void cli_ll_create(fuse_req_t freq, fuse_ino_t parent, const char *name,
 
        req = cli_smb2_create_fnum_send(
                state, mstate->ev, mstate->cli, state->path,
 
        req = cli_smb2_create_fnum_send(
                state, mstate->ev, mstate->cli, state->path,
-               0, FILE_GENERIC_READ|FILE_GENERIC_WRITE, FILE_ATTRIBUTE_NORMAL,
+               0, SMB2_IMPERSONATION_IMPERSONATION,
+               FILE_GENERIC_READ|FILE_GENERIC_WRITE, FILE_ATTRIBUTE_NORMAL,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_CREATE, FILE_NON_DIRECTORY_FILE);
        if (req == NULL) {
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_CREATE, FILE_NON_DIRECTORY_FILE);
        if (req == NULL) {
@@ -836,7 +837,8 @@ static void cli_ll_open(fuse_req_t freq, fuse_ino_t ino,
 
        req = cli_smb2_create_fnum_send(
                state, mstate->ev, mstate->cli, istate->path,
 
        req = cli_smb2_create_fnum_send(
                state, mstate->ev, mstate->cli, istate->path,
-               0, acc, FILE_ATTRIBUTE_NORMAL,
+               0, SMB2_IMPERSONATION_IMPERSONATION,
+               acc, FILE_ATTRIBUTE_NORMAL,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_OPEN, FILE_NON_DIRECTORY_FILE);
        if (req == NULL) {
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_OPEN, FILE_NON_DIRECTORY_FILE);
        if (req == NULL) {
index 35edec88809692d257f31de5befc1128da2e46bf..aef70f1adc8b9f1d8f117cd9c0caec25fce88df1 100644 (file)
@@ -171,6 +171,7 @@ struct tevent_req *cli_smb2_create_fnum_send(TALLOC_CTX *mem_ctx,
                                             struct cli_state *cli,
                                             const char *fname,
                                             uint32_t create_flags,
                                             struct cli_state *cli,
                                             const char *fname,
                                             uint32_t create_flags,
+                                            uint32_t impersonation_level,
                                             uint32_t desired_access,
                                             uint32_t file_attributes,
                                             uint32_t share_access,
                                             uint32_t desired_access,
                                             uint32_t file_attributes,
                                             uint32_t share_access,
@@ -262,7 +263,7 @@ struct tevent_req *cli_smb2_create_fnum_send(TALLOC_CTX *mem_ctx,
                                     cli->smb2.tcon,
                                     fname,
                                     flags_to_smb2_oplock(create_flags),
                                     cli->smb2.tcon,
                                     fname,
                                     flags_to_smb2_oplock(create_flags),
-                                    SMB2_IMPERSONATION_IMPERSONATION,
+                                    impersonation_level,
                                     desired_access,
                                     file_attributes,
                                     share_access,
                                     desired_access,
                                     file_attributes,
                                     share_access,
@@ -345,6 +346,7 @@ NTSTATUS cli_smb2_create_fnum(struct cli_state *cli,
        TALLOC_CTX *frame = talloc_stackframe();
        struct tevent_context *ev;
        struct tevent_req *req;
        TALLOC_CTX *frame = talloc_stackframe();
        struct tevent_context *ev;
        struct tevent_req *req;
+       uint32_t impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
        NTSTATUS status = NT_STATUS_NO_MEMORY;
 
        if (smbXcli_conn_has_async_calls(cli->conn)) {
        NTSTATUS status = NT_STATUS_NO_MEMORY;
 
        if (smbXcli_conn_has_async_calls(cli->conn)) {
@@ -359,6 +361,7 @@ NTSTATUS cli_smb2_create_fnum(struct cli_state *cli,
                goto fail;
        }
        req = cli_smb2_create_fnum_send(frame, ev, cli, fname, create_flags,
                goto fail;
        }
        req = cli_smb2_create_fnum_send(frame, ev, cli, fname, create_flags,
+                                       impersonation_level,
                                        desired_access, file_attributes,
                                        share_access, create_disposition,
                                        create_options);
                                        desired_access, file_attributes,
                                        share_access, create_disposition,
                                        create_options);
index 4fce5fce1c309564bb56233f19e8af58c0ff3619..2edaae02b1d9cf6e1844adb593ee3eeefd41e3b9 100644 (file)
@@ -30,6 +30,7 @@ struct tevent_req *cli_smb2_create_fnum_send(TALLOC_CTX *mem_ctx,
                                             struct cli_state *cli,
                                             const char *fname,
                                             uint32_t create_flags,
                                             struct cli_state *cli,
                                             const char *fname,
                                             uint32_t create_flags,
+                                            uint32_t impersonation_level,
                                             uint32_t desired_access,
                                             uint32_t file_attributes,
                                             uint32_t share_access,
                                             uint32_t desired_access,
                                             uint32_t file_attributes,
                                             uint32_t share_access,
index b50926307a5049131883591655b846e660f76a2f..dc3751aa821351e0d9d9df8a6af3aa9da9e6ce41 100644 (file)
@@ -2102,6 +2102,7 @@ struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
 {
        struct tevent_req *req, *subreq;
        struct cli_ntcreate_state *state;
 {
        struct tevent_req *req, *subreq;
        struct cli_ntcreate_state *state;
+       uint32_t impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_ntcreate_state);
        if (req == NULL) {
 
        req = tevent_req_create(mem_ctx, &state, struct cli_ntcreate_state);
        if (req == NULL) {
@@ -2116,7 +2117,8 @@ struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
                }
 
                subreq = cli_smb2_create_fnum_send(
                }
 
                subreq = cli_smb2_create_fnum_send(
-                       state, ev, cli, fname, create_flags, desired_access,
+                       state, ev, cli, fname, create_flags,
+                       impersonation_level, desired_access,
                        file_attributes, share_access, create_disposition,
                        create_options);
        } else {
                        file_attributes, share_access, create_disposition,
                        create_options);
        } else {