summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/async_smb.h7
-rw-r--r--source3/libsmb/async_smb.c79
-rw-r--r--source3/libsmb/clioplock.c79
-rw-r--r--source3/libsmb/proto.h7
4 files changed, 86 insertions, 86 deletions
diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index 49a8b9e322..b8e2a34cbf 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -51,13 +51,6 @@ NTSTATUS cli_smb_recv(struct tevent_req *req,
uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
uint32_t *pnum_bytes, uint8_t **pbytes);
-struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- struct cli_state *cli);
-NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
- uint16_t *pfnum,
- uint8_t *plevel);
-
struct tevent_req *cli_session_request_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
int sock,
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 06b9fff407..f4e2c2f56d 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -1078,85 +1078,6 @@ bool cli_has_async_calls(struct cli_state *cli)
|| (talloc_array_length(cli->conn.pending) != 0));
}
-struct cli_smb_oplock_break_waiter_state {
- uint16_t fnum;
- uint8_t level;
-};
-
-static void cli_smb_oplock_break_waiter_done(struct tevent_req *subreq);
-
-struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- struct cli_state *cli)
-{
- struct tevent_req *req, *subreq;
- struct cli_smb_oplock_break_waiter_state *state;
-
- req = tevent_req_create(mem_ctx, &state,
- struct cli_smb_oplock_break_waiter_state);
- if (req == NULL) {
- return NULL;
- }
-
- /*
- * Create a fake SMB request that we will never send out. This is only
- * used to be set into the pending queue with the right mid.
- */
- subreq = cli_smb_req_create(mem_ctx, ev, cli, 0, 0, 0, NULL, 0, NULL);
- if (tevent_req_nomem(subreq, req)) {
- return tevent_req_post(req, ev);
- }
- cli_smb_req_set_mid(subreq, 0xffff);
-
- if (!cli_smb_req_set_pending(subreq)) {
- tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
- return tevent_req_post(req, ev);
- }
- tevent_req_set_callback(subreq, cli_smb_oplock_break_waiter_done, req);
- return req;
-}
-
-static void cli_smb_oplock_break_waiter_done(struct tevent_req *subreq)
-{
- struct tevent_req *req = tevent_req_callback_data(
- subreq, struct tevent_req);
- struct cli_smb_oplock_break_waiter_state *state = tevent_req_data(
- req, struct cli_smb_oplock_break_waiter_state);
- uint8_t wct;
- uint16_t *vwv;
- uint32_t num_bytes;
- uint8_t *bytes;
- uint8_t *inbuf;
- NTSTATUS status;
-
- status = cli_smb_recv(subreq, state, &inbuf, 8, &wct, &vwv,
- &num_bytes, &bytes);
- TALLOC_FREE(subreq);
- if (!NT_STATUS_IS_OK(status)) {
- tevent_req_nterror(req, status);
- return;
- }
- state->fnum = SVAL(vwv+2, 0);
- state->level = CVAL(vwv+3, 1);
- tevent_req_done(req);
-}
-
-NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
- uint16_t *pfnum,
- uint8_t *plevel)
-{
- struct cli_smb_oplock_break_waiter_state *state = tevent_req_data(
- req, struct cli_smb_oplock_break_waiter_state);
- NTSTATUS status;
-
- if (tevent_req_is_nterror(req, &status)) {
- return status;
- }
- *pfnum = state->fnum;
- *plevel = state->level;
- return NT_STATUS_OK;
-}
-
struct cli_session_request_state {
struct tevent_context *ev;
diff --git a/source3/libsmb/clioplock.c b/source3/libsmb/clioplock.c
index f164ed5221..a708453877 100644
--- a/source3/libsmb/clioplock.c
+++ b/source3/libsmb/clioplock.c
@@ -22,6 +22,85 @@
#include "async_smb.h"
#include "libsmb/libsmb.h"
+struct cli_smb_oplock_break_waiter_state {
+ uint16_t fnum;
+ uint8_t level;
+};
+
+static void cli_smb_oplock_break_waiter_done(struct tevent_req *subreq);
+
+struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli)
+{
+ struct tevent_req *req, *subreq;
+ struct cli_smb_oplock_break_waiter_state *state;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct cli_smb_oplock_break_waiter_state);
+ if (req == NULL) {
+ return NULL;
+ }
+
+ /*
+ * Create a fake SMB request that we will never send out. This is only
+ * used to be set into the pending queue with the right mid.
+ */
+ subreq = cli_smb_req_create(mem_ctx, ev, cli, 0, 0, 0, NULL, 0, NULL);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ cli_smb_req_set_mid(subreq, 0xffff);
+
+ if (!cli_smb_req_set_pending(subreq)) {
+ tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, cli_smb_oplock_break_waiter_done, req);
+ return req;
+}
+
+static void cli_smb_oplock_break_waiter_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct cli_smb_oplock_break_waiter_state *state = tevent_req_data(
+ req, struct cli_smb_oplock_break_waiter_state);
+ uint8_t wct;
+ uint16_t *vwv;
+ uint32_t num_bytes;
+ uint8_t *bytes;
+ uint8_t *inbuf;
+ NTSTATUS status;
+
+ status = cli_smb_recv(subreq, state, &inbuf, 8, &wct, &vwv,
+ &num_bytes, &bytes);
+ TALLOC_FREE(subreq);
+ if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
+ return;
+ }
+ state->fnum = SVAL(vwv+2, 0);
+ state->level = CVAL(vwv+3, 1);
+ tevent_req_done(req);
+}
+
+NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
+ uint16_t *pfnum,
+ uint8_t *plevel)
+{
+ struct cli_smb_oplock_break_waiter_state *state = tevent_req_data(
+ req, struct cli_smb_oplock_break_waiter_state);
+ NTSTATUS status;
+
+ if (tevent_req_is_nterror(req, &status)) {
+ return status;
+ }
+ *pfnum = state->fnum;
+ *plevel = state->level;
+ return NT_STATUS_OK;
+}
+
/****************************************************************************
send an ack for an oplock break request
****************************************************************************/
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 1c7be955c9..f9329241c7 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -693,6 +693,13 @@ NTSTATUS cli_message(struct cli_state *cli, const char *host,
/* The following definitions come from libsmb/clioplock.c */
+struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli);
+NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
+ uint16_t *pfnum,
+ uint8_t *plevel);
+
struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct cli_state *cli,