s3:libsmb: pass impersonation_level to cli_ntcreate_send()
authorStefan Metzmacher <metze@samba.org>
Fri, 7 Dec 2018 15:38:57 +0000 (16:38 +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/winexe/winexe.c
source3/libsmb/clifile.c
source3/libsmb/clisymlink.c
source3/libsmb/proto.h
source3/libsmb/pylibsmb.c
source3/torture/nbench.c
source3/torture/test_chain3.c
source3/torture/test_notify.c
source3/torture/test_notify_online.c
source3/torture/test_oplock_cancel.c
source3/torture/torture.c

index cf667a64ebc93c2abf0a660bf58da031288b1e0b..429ba2f5163e60705d98890c6eb598bcbbb1a44f 100644 (file)
@@ -872,6 +872,7 @@ static struct tevent_req *winexe_out_pipe_send(
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_OPEN,      /* CreateDisposition */
                0,              /* CreateOptions */
+               SMB2_IMPERSONATION_IMPERSONATION,
                0);             /* SecurityFlags */
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -1044,6 +1045,7 @@ static struct tevent_req *winexe_in_pipe_send(
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_OPEN,      /* CreateDisposition */
                0,              /* CreateOptions */
+               SMB2_IMPERSONATION_IMPERSONATION,
                0);             /* SecurityFlags */
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -1462,6 +1464,7 @@ static struct tevent_req *winexe_ctrl_send(
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_OPEN,      /* CreateDisposition */
                0,              /* CreateOptions */
+               SMB2_IMPERSONATION_IMPERSONATION,
                0);             /* SecurityFlags */
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
index 1694af502b9c4e125d5722d5d5b57229ef4eb5ae..6defa38fdee3e9e0949097452638c4f1b9db7c35 100644 (file)
@@ -2099,11 +2099,11 @@ struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
                                     uint32_t share_access,
                                     uint32_t create_disposition,
                                     uint32_t create_options,
+                                    uint32_t impersonation_level,
                                     uint8_t security_flags)
 {
        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) {
@@ -2197,6 +2197,7 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
        TALLOC_CTX *frame = talloc_stackframe();
        struct tevent_context *ev;
        struct tevent_req *req;
+       uint32_t ImpersonationLevel = SMB2_IMPERSONATION_IMPERSONATION;
        NTSTATUS status = NT_STATUS_NO_MEMORY;
 
        if (smbXcli_conn_has_async_calls(cli->conn)) {
@@ -2215,7 +2216,7 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
        req = cli_ntcreate_send(frame, ev, cli, fname, CreatFlags,
                                DesiredAccess, FileAttributes, ShareAccess,
                                CreateDisposition, CreateOptions,
-                               SecurityFlags);
+                               ImpersonationLevel, SecurityFlags);
        if (req == NULL) {
                goto fail;
        }
index 54435e468cd8384acb93145dd7948b274701a7ed..1330752358d0af08c8e038b5568b6afba7001585 100644 (file)
@@ -72,7 +72,8 @@ struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
                FILE_READ_ATTRIBUTES|FILE_WRITE_ATTRIBUTES,
                FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE, FILE_CREATE,
                FILE_OPEN_REPARSE_POINT|FILE_SYNCHRONOUS_IO_NONALERT|
-               FILE_NON_DIRECTORY_FILE, 0);
+               FILE_NON_DIRECTORY_FILE,
+               SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -274,7 +275,8 @@ struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
        subreq = cli_ntcreate_send(
                state, ev, cli, fname, 0, FILE_READ_ATTRIBUTES | FILE_READ_EA,
                0, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
-               FILE_OPEN, FILE_OPEN_REPARSE_POINT, 0);
+               FILE_OPEN, FILE_OPEN_REPARSE_POINT,
+               SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
index 941d154b5b55f5d43348ec89588205065877ead2..bfad4dcc011d24e04bcf9fc8dcd907f8ab7b6991 100644 (file)
@@ -397,6 +397,7 @@ struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
                                     uint32_t ShareAccess,
                                     uint32_t CreateDisposition,
                                     uint32_t CreateOptions,
+                                    uint32_t ImpersonationLevel,
                                     uint8_t SecurityFlags);
 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
                        uint16_t *pfnum,
index b6cff0bf1be81f8c4774a3b7da30d3a1b85d78ea..3f84d34e1fddbc474357244e58f007b5ea304207 100644 (file)
@@ -666,6 +666,7 @@ static PyObject *py_cli_create(struct py_cli_state *self, PyObject *args,
        unsigned ShareAccess = 0;
        unsigned CreateDisposition = FILE_OPEN;
        unsigned CreateOptions = 0;
+       unsigned ImpersonationLevel = SMB2_IMPERSONATION_IMPERSONATION;
        unsigned SecurityFlags = 0;
        uint16_t fnum;
        struct tevent_req *req;
@@ -687,7 +688,7 @@ static PyObject *py_cli_create(struct py_cli_state *self, PyObject *args,
        req = cli_ntcreate_send(NULL, self->ev, self->cli, fname, CreateFlags,
                                DesiredAccess, FileAttributes, ShareAccess,
                                CreateDisposition, CreateOptions,
-                               SecurityFlags);
+                               ImpersonationLevel, SecurityFlags);
        if (!py_tevent_req_wait_exc(self, req)) {
                return NULL;
        }
index 80b5a72054c23f257420bf432c1e462f164c9a57..e9a0b4f2f33f8176dd3c56963ea622876d34f2c3 100644 (file)
@@ -263,7 +263,8 @@ static struct tevent_req *nbench_cmd_send(TALLOC_CTX *mem_ctx,
                        state, ev, nb_state->cli, state->ft->cp.fname, flags,
                        desired_access, 0, share_mode,
                        state->ft->cp.cr_disposition,
-                       state->ft->cp.cr_options, 0);
+                       state->ft->cp.cr_options,
+                       SMB2_IMPERSONATION_IMPERSONATION, 0);
                break;
        }
        case NBENCH_CMD_CLOSE: {
index eff39de8702570770410b1d1ca8df3a568a6d643..d957e5145d40699e79e3c9a74da971d8154cb5e6 100644 (file)
@@ -180,7 +180,8 @@ static struct tevent_req *chain3_send(TALLOC_CTX *mem_ctx,
                GENERIC_READ_ACCESS|GENERIC_WRITE_ACCESS,
                FILE_ATTRIBUTE_NORMAL,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-               FILE_OVERWRITE_IF, 0, 0);
+               FILE_OVERWRITE_IF, 0,
+               SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
index e377875ef85e79662cf4dcdc8c29e09aaa5cbdf0..20b39d1e5db699cda2f251ff50280a05eaa71fcc 100644 (file)
@@ -66,7 +66,8 @@ static struct tevent_req *wait_for_one_notify_send(TALLOC_CTX *mem_ctx,
                state, state->ev, state->cli, path, 0,
                MAXIMUM_ALLOWED_ACCESS,
                0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-               FILE_OPEN, FILE_DIRECTORY_FILE, 0);
+               FILE_OPEN, FILE_DIRECTORY_FILE,
+               SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -318,7 +319,8 @@ static struct tevent_req *notify_bench3_send(
                state, state->ev, state->cli, state->dir, 0,
                MAXIMUM_ALLOWED_ACCESS, 0,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-               FILE_OPEN_IF, FILE_DIRECTORY_FILE, 0);
+               FILE_OPEN_IF, FILE_DIRECTORY_FILE,
+               SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -456,7 +458,8 @@ static void notify_bench3_before_mkdir2(struct tevent_req *subreq)
                MAXIMUM_ALLOWED_ACCESS, 0,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                FILE_CREATE,
-               FILE_DIRECTORY_FILE, 0);
+               FILE_DIRECTORY_FILE,
+               SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
index 7f4f52111cdfa2da932a068c132e42a4280c3878..c8ddf7c0fab9a5a6967048973cee3b6e3ec96ce6 100644 (file)
@@ -61,7 +61,7 @@ static struct tevent_req *notify_online_send(
                state, ev, cli, dname, EXTENDED_RESPONSE_REQUIRED,
                SEC_FILE_READ_DATA, 0,
                FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
-               FILE_OPEN, 0, 0);
+               FILE_OPEN, 0, SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -93,7 +93,8 @@ static void notify_online_opened_dir(struct tevent_req *subreq)
                state, state->ev, state->cli, state->fname, 0,
                GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-               FILE_OPEN, FILE_NON_DIRECTORY_FILE, 0);
+               FILE_OPEN, FILE_NON_DIRECTORY_FILE,
+               SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
index d856650fa23e0808459d4933e16778109bb1bafb..b003876f59281ebf7f909a4bd7123368462a2c78 100644 (file)
@@ -48,7 +48,7 @@ static struct tevent_req *create_cancel_send(
        subreq = cli_ntcreate_send(
                mem_ctx, ev, cli, fname, 0, FILE_GENERIC_READ,
                FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE,
-               FILE_OPEN_IF, 0, 0);
+               FILE_OPEN_IF, 0, SMB2_IMPERSONATION_IMPERSONATION, 0);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
index 4f810e5e16c42486891dbe4d5fa08abf2b35f120..1849a8da0f87ef12b398ae44442cc2553634bb44 100644 (file)
@@ -8249,7 +8249,8 @@ static struct tevent_req *torture_createdel_send(TALLOC_CTX *mem_ctx,
                FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
                FILE_ATTRIBUTE_NORMAL,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-               FILE_OPEN_IF, FILE_DELETE_ON_CLOSE, 0);
+               FILE_OPEN_IF, FILE_DELETE_ON_CLOSE,
+               SMB2_IMPERSONATION_IMPERSONATION, 0);
 
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);