s3:smb2cli: pass more fields to smb2cli_req_create()/smb2cli_req_send()
authorStefan Metzmacher <metze@samba.org>
Fri, 12 Aug 2011 15:26:13 +0000 (17:26 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 12 Aug 2011 17:38:27 +0000 (19:38 +0200)
The caller should take care of the global cli_state values.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 19:38:27 CEST 2011 on sn-devel-104

source3/libsmb/smb2cli_base.c
source3/libsmb/smb2cli_base.h
source3/libsmb/smb2cli_close.c
source3/libsmb/smb2cli_create.c
source3/libsmb/smb2cli_flush.c
source3/libsmb/smb2cli_negprot.c
source3/libsmb/smb2cli_query_directory.c
source3/libsmb/smb2cli_read.c
source3/libsmb/smb2cli_session.c
source3/libsmb/smb2cli_tcon.c
source3/libsmb/smb2cli_write.c

index dd212730bc22ed61b25e71913202ef2d6e444e98..9fc824c6b28e5544800b767c5fd183016e580fd7 100644 (file)
@@ -175,7 +175,11 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
                                      struct tevent_context *ev,
                                      struct cli_state *cli,
                                      uint16_t cmd,
-                                     uint32_t flags,
+                                     uint32_t additional_flags,
+                                     uint32_t clear_flags,
+                                     uint32_t pid,
+                                     uint32_t tid,
+                                     uint64_t uid,
                                      const uint8_t *fixed,
                                      uint16_t fixed_len,
                                      const uint8_t *dyn,
@@ -183,6 +187,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
 {
        struct tevent_req *req;
        struct smb2cli_req_state *state;
+       uint32_t flags = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_req_state);
@@ -198,6 +203,9 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
+       flags |= additional_flags;
+       flags &= ~clear_flags;
+
        state->fixed = fixed;
        state->fixed_len = fixed_len;
        state->dyn = dyn;
@@ -306,7 +314,11 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
                                    struct cli_state *cli,
                                    uint16_t cmd,
-                                   uint32_t flags,
+                                   uint32_t additional_flags,
+                                   uint32_t clear_flags,
+                                   uint32_t pid,
+                                   uint32_t tid,
+                                   uint64_t uid,
                                    const uint8_t *fixed,
                                    uint16_t fixed_len,
                                    const uint8_t *dyn,
@@ -315,7 +327,9 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req;
        NTSTATUS status;
 
-       req = smb2cli_req_create(mem_ctx, ev, cli, cmd, flags,
+       req = smb2cli_req_create(mem_ctx, ev, cli, cmd,
+                                additional_flags, clear_flags,
+                                pid, tid, uid,
                                 fixed, fixed_len, dyn, dyn_len);
        if (req == NULL) {
                return NULL;
index 85cf34715607e3c6b254a2ed3d0e9c923781fad3..348f842d40f54d578f41bce6c00b98ab63c39335 100644 (file)
@@ -24,7 +24,11 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
                                      struct tevent_context *ev,
                                      struct cli_state *cli,
                                      uint16_t cmd,
-                                     uint32_t flags,
+                                     uint32_t additional_flags,
+                                     uint32_t clear_flags,
+                                     uint32_t pid,
+                                     uint32_t tid,
+                                     uint64_t uid,
                                      const uint8_t *fixed,
                                      uint16_t fixed_len,
                                      const uint8_t *dyn,
@@ -35,7 +39,11 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
                                    struct cli_state *cli,
                                    uint16_t cmd,
-                                   uint32_t flags,
+                                   uint32_t additional_flags,
+                                   uint32_t clear_flags,
+                                   uint32_t pid,
+                                   uint32_t tid,
+                                   uint64_t uid,
                                    const uint8_t *fixed,
                                    uint16_t fixed_len,
                                    const uint8_t *dyn,
index fcbf298596568ad7e8f46f21eabca60db2d6e7fb..3c6ad9fb3a106934bb609959098783aa22198b2f 100644 (file)
@@ -53,7 +53,11 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
        SBVAL(fixed, 8, fid_persistent);
        SBVAL(fixed, 16, fid_volatile);
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_CLOSE, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_CLOSE,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 cli->smb2.tid,
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  NULL, 0);
        if (tevent_req_nomem(subreq, req)) {
index 794b1f1bff80437a1161a31397afc0693906b794..ecb220d4ac328c2d3322c729aa7dcb9ddd0ac816 100644 (file)
@@ -127,7 +127,11 @@ struct tevent_req *smb2cli_create_send(
                data_blob_free(&blob);
        }
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_CREATE, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_CREATE,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 cli->smb2.tid,
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
        if (tevent_req_nomem(subreq, req)) {
index b93c7851f1cc7522ba79cf49f275e385b8d150ae..6fe7178d8676ccae4ec80024d44fa5841be3dd70 100644 (file)
@@ -51,7 +51,11 @@ struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
        SBVAL(fixed, 8, fid_persistent);
        SBVAL(fixed, 16, fid_volatile);
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_FLUSH, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_FLUSH,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 cli->smb2.tid,
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  NULL, 0);
        if (tevent_req_nomem(subreq, req)) {
index 305632283fd3f393890b5e5774cd798f673dadde..75532cd47741bfedd825041a31afe1d439441a1e 100644 (file)
@@ -66,7 +66,10 @@ struct tevent_req *smb2cli_negprot_send(TALLOC_CTX *mem_ctx,
        SSVAL(buf, 0, 0x202);   /* SMB2.002 */
        SSVAL(buf, 2, 0x210);   /* SMB2.1 */
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_NEGPROT, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_NEGPROT,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 0, 0, /* tid, uid */
                                  state->fixed, sizeof(state->fixed),
                                  state->dyn, sizeof(state->dyn));
        if (tevent_req_nomem(subreq, req)) {
index f9a1bfe4ee3cc7571eae5bb0ba59313c7d6045f7..3feaa07abb02ec87b0b04302673404e992936a3f 100644 (file)
@@ -75,7 +75,11 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
        SSVAL(fixed, 26, dyn_len);
        SSVAL(fixed, 28, outbuf_len);
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_FIND, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_FIND,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 cli->smb2.tid,
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
        if (tevent_req_nomem(subreq, req)) {
index c348c9937c5bae02aff31e1e9de8ee3e6dc2d541..bcdbd87e6a4b20a661efa258256796919862209e 100644 (file)
@@ -64,7 +64,11 @@ struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
        SBVAL(fixed, 32, minimum_count);
        SBVAL(fixed, 40, remaining_bytes);
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_READ, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_READ,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 cli->smb2.tid,
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  NULL, 0);
        if (tevent_req_nomem(subreq, req)) {
index c7d880e7aa9e36aca692af6dfea00014a10beb7d..7cc184236b6ed7514b82de211a5036525bc9e1ff 100644 (file)
@@ -61,7 +61,10 @@ static struct tevent_req *smb2cli_sesssetup_blob_send(TALLOC_CTX *mem_ctx,
        SSVAL(buf, 14, blob->length);
        SBVAL(buf, 16, 0); /* PreviousSessionId */
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_SESSSETUP, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_SESSSETUP,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 0, 0, /* tid, uid */
                                  state->fixed, sizeof(state->fixed),
                                  blob->data, blob->length);
        if (tevent_req_nomem(subreq, req)) {
@@ -324,7 +327,11 @@ struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
        }
        SSVAL(state->fixed, 0, 4);
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_LOGOFF, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_LOGOFF,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 0, /* tid */
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  NULL, 0);
        if (tevent_req_nomem(subreq, req)) {
index 705f8fc99c7eb78557158a16f01df33d626c62cc..2872c371c05307ac5a145d65bf74e7a006605608 100644 (file)
@@ -70,7 +70,11 @@ struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
        SSVAL(fixed, 4, SMB2_HDR_BODY + 8);
        SSVAL(fixed, 6, dyn_len);
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_TCON, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_TCON,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 0, /* tid */
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
        if (tevent_req_nomem(subreq, req)) {
@@ -166,7 +170,11 @@ struct tevent_req *smb2cli_tdis_send(TALLOC_CTX *mem_ctx,
        }
        SSVAL(state->fixed, 0, 4);
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_TDIS, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_TDIS,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 cli->smb2.tid,
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  NULL, 0);
        if (tevent_req_nomem(subreq, req)) {
index ce672e44e90610e7b7a157a002ea8ca2106da334..98d754a9b0c729cbec0c6ac775573d5944ad4747 100644 (file)
@@ -63,7 +63,11 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
        SIVAL(fixed, 36, remaining_bytes);
        SIVAL(fixed, 44, flags);
 
-       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_WRITE, 0,
+       subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_WRITE,
+                                 0, 0, /* flags */
+                                 cli->smb2.pid,
+                                 cli->smb2.tid,
+                                 cli->smb2.uid,
                                  state->fixed, sizeof(state->fixed),
                                  data, length);
        if (tevent_req_nomem(subreq, req)) {