]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Move cli_smb() to source3/torture
authorVolker Lendecke <vl@samba.org>
Thu, 19 Jun 2025 11:02:17 +0000 (13:02 +0200)
committerAnoop C S <anoopcs@samba.org>
Fri, 20 Jun 2025 10:14:37 +0000 (10:14 +0000)
Only used there

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/libsmb/clientgen.c
source3/libsmb/proto.h
source3/torture/proto.h
source3/torture/torture.c

index d07156d2295ad015bcdb16bee464679f53bc4e78..49cef9f8a49462db4ed4d9f5d1762e738e2dc1d9 100644 (file)
@@ -613,40 +613,3 @@ NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data)
        TALLOC_FREE(frame);
        return status;
 }
-
-NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
-                uint8_t smb_command, uint8_t additional_flags,
-                uint8_t wct, uint16_t *vwv,
-                uint32_t num_bytes, const uint8_t *bytes,
-                struct tevent_req **result_parent,
-                uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
-                uint32_t *pnum_bytes, uint8_t **pbytes)
-{
-        struct tevent_context *ev;
-        struct tevent_req *req = NULL;
-        NTSTATUS status = NT_STATUS_NO_MEMORY;
-
-        if (smbXcli_conn_has_async_calls(cli->conn)) {
-                return NT_STATUS_INVALID_PARAMETER;
-        }
-        ev = samba_tevent_context_init(mem_ctx);
-        if (ev == NULL) {
-                goto fail;
-        }
-        req = cli_smb_send(mem_ctx, ev, cli, smb_command, additional_flags, 0,
-                          wct, vwv, num_bytes, bytes);
-        if (req == NULL) {
-                goto fail;
-        }
-        if (!tevent_req_poll_ntstatus(req, ev, &status)) {
-                goto fail;
-        }
-        status = cli_smb_recv(req, NULL, NULL, min_wct, pwct, pvwv,
-                             pnum_bytes, pbytes);
-fail:
-        TALLOC_FREE(ev);
-       if (NT_STATUS_IS_OK(status) && (result_parent != NULL)) {
-               *result_parent = req;
-       }
-        return status;
-}
index 8d729e89ea279eefa335ef91463455ee16c90517..0163a1f883d465937a6d4741ce312f21ff2aa3ec 100644 (file)
@@ -222,13 +222,6 @@ struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                                 DATA_BLOB data);
 NTSTATUS cli_echo_recv(struct tevent_req *req);
 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
-NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
-                uint8_t smb_command, uint8_t additional_flags,
-                uint8_t wct, uint16_t *vwv,
-                uint32_t num_bytes, const uint8_t *bytes,
-                struct tevent_req **result_parent,
-                uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
-                uint32_t *pnum_bytes, uint8_t **pbytes);
 
 /* The following definitions come from libsmb/clierror.c  */
 
index 72c9ea801331ad6bc6b1a1fa0edbf4892f8d7d31..2e29308e7f8372623abeaa7c7f2871e9497fa525 100644 (file)
@@ -77,6 +77,13 @@ NTSTATUS torture_setup_unix_extensions(struct cli_state *cli);
 void torture_conn_set_sockopt(struct cli_state *cli);
 void torture_deltree(struct cli_state *cli, const char *dname);
 
+NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
+                uint8_t smb_command, uint8_t additional_flags,
+                uint8_t wct, uint16_t *vwv,
+                uint32_t num_bytes, const uint8_t *bytes,
+                struct tevent_req **result_parent,
+                uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
+                uint32_t *pnum_bytes, uint8_t **pbytes);
 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
                      off_t offset, size_t size1, size_t *ptotal);
 
index 22c89ff6f54d7d8d7fee0ff47dc3b8e099f9bcc4..3d592429390a689483707fecf606680d9699428a 100644 (file)
@@ -545,6 +545,43 @@ NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
        return NT_STATUS_OK;
 }
 
+NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
+                uint8_t smb_command, uint8_t additional_flags,
+                uint8_t wct, uint16_t *vwv,
+                uint32_t num_bytes, const uint8_t *bytes,
+                struct tevent_req **result_parent,
+                uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
+                uint32_t *pnum_bytes, uint8_t **pbytes)
+{
+        struct tevent_context *ev;
+        struct tevent_req *req = NULL;
+        NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+        if (smbXcli_conn_has_async_calls(cli->conn)) {
+                return NT_STATUS_INVALID_PARAMETER;
+        }
+        ev = samba_tevent_context_init(mem_ctx);
+        if (ev == NULL) {
+                goto fail;
+        }
+        req = cli_smb_send(mem_ctx, ev, cli, smb_command, additional_flags, 0,
+                          wct, vwv, num_bytes, bytes);
+        if (req == NULL) {
+                goto fail;
+        }
+        if (!tevent_req_poll_ntstatus(req, ev, &status)) {
+                goto fail;
+        }
+        status = cli_smb_recv(req, NULL, NULL, min_wct, pwct, pvwv,
+                             pnum_bytes, pbytes);
+fail:
+        TALLOC_FREE(ev);
+       if (NT_STATUS_IS_OK(status) && (result_parent != NULL)) {
+               *result_parent = req;
+       }
+        return status;
+}
+
 static NTSTATUS torture_delete_fn(struct file_info *finfo,
                                  const char *pattern,
                                  void *state)