diff options
Diffstat (limited to 'source3/libsmb/smb2cli_base.h')
-rw-r--r-- | source3/libsmb/smb2cli_base.h | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/source3/libsmb/smb2cli_base.h b/source3/libsmb/smb2cli_base.h index 105f8ebe1c..efef350f5d 100644 --- a/source3/libsmb/smb2cli_base.h +++ b/source3/libsmb/smb2cli_base.h @@ -20,45 +20,52 @@ #ifndef __SMB2CLI_BASE_H__ #define __SMB2CLI_BASE_H__ -struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct cli_state *cli, - uint16_t cmd, - uint32_t additional_flags, - uint32_t clear_flags, - unsigned int timeout, - uint32_t pid, - uint32_t tid, - uint64_t uid, - const uint8_t *fixed, - uint16_t fixed_len, - const uint8_t *dyn, - uint32_t dyn_len); -NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs, - int num_reqs); +#include "../libcli/smb/smbXcli_base.h" -struct smb2cli_req_expected_response { - NTSTATUS status; - uint16_t body_size; -}; - -struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx, +static inline struct tevent_req *cli_state_smb2cli_req_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli, uint16_t cmd, uint32_t additional_flags, uint32_t clear_flags, - unsigned int timeout, + uint32_t timeout_msec, uint32_t pid, uint32_t tid, uint64_t uid, const uint8_t *fixed, uint16_t fixed_len, const uint8_t *dyn, - uint32_t dyn_len); -NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, - struct iovec **piov, - const struct smb2cli_req_expected_response *expected, - size_t num_expected); + uint32_t dyn_len) +{ + if (cli->smb2.conn == NULL) { + cli->smb2.conn = smbXcli_conn_create(cli, + cli->conn.fd, + cli->conn.remote_name, + SMB_SIGNING_OFF, + 0); /* smb1_capabilities */ + if (cli->smb2.conn == NULL) { + return NULL; + } + } + + return smb2cli_req_send(mem_ctx, ev, + cli->smb2.conn, cmd, + additional_flags, clear_flags, + timeout_msec, + pid, tid, uid, + fixed, fixed_len, + dyn, dyn_len); +} + +#define smb2cli_req_send(mem_ctx, ev, cli, cmd, \ + additional_flags, clear_flags, \ + timeout_msec, \ + pid, tid, uid, \ + fixed, fixed_len, dyn, dyn_len) \ + cli_state_smb2cli_req_send(mem_ctx, ev, cli, cmd, \ + additional_flags, clear_flags, \ + timeout_msec, \ + pid, tid, uid, \ + fixed, fixed_len, dyn, dyn_len) #endif |