summaryrefslogtreecommitdiffstats
path: root/source3/torture
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-02-20 16:28:14 +0100
committerVolker Lendecke <vl@samba.org>2012-02-22 17:32:24 +0100
commitee2e3d56a2a633cecf4d1b06badc6fb8fd12580e (patch)
tree4ea5ca00c7b3bc078870b358a67c72b88d1dc644 /source3/torture
parentb0c21afffe36b2239f9e688678b28cb58834fb6e (diff)
downloadsamba-ee2e3d56a2a633cecf4d1b06badc6fb8fd12580e.tar.gz
samba-ee2e3d56a2a633cecf4d1b06badc6fb8fd12580e.tar.xz
samba-ee2e3d56a2a633cecf4d1b06badc6fb8fd12580e.zip
s3-vfstest: Fake smb_requests
Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Wed Feb 22 17:32:28 CET 2012 on sn-devel-104
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/vfstest.c24
-rw-r--r--source3/torture/vfstest.h4
2 files changed, 28 insertions, 0 deletions
diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c
index 6e25b34dee..53b5ee99d9 100644
--- a/source3/torture/vfstest.c
+++ b/source3/torture/vfstest.c
@@ -416,6 +416,30 @@ void exit_server_cleanly(const char *const reason)
exit_server("normal exit");
}
+struct smb_request *vfstest_get_smbreq(TALLOC_CTX *mem_ctx,
+ struct vfs_state *vfs)
+{
+ struct smb_request *result;
+
+ result = talloc_zero(mem_ctx, struct smb_request);
+ if (result == NULL) {
+ return NULL;
+ }
+ result->sconn = vfs->conn->sconn;
+ result->mid = ++vfs->mid;
+
+ result->inbuf = talloc_array(result, uint8_t, smb_size);
+ if (result->inbuf == NULL) {
+ goto fail;
+ }
+ SSVAL(result->inbuf, smb_mid, result->mid);
+ smb_setlen(result->inbuf, smb_size-4);
+ return result;
+fail:
+ TALLOC_FREE(result);
+ return NULL;
+}
+
/* Main function */
int main(int argc, char *argv[])
diff --git a/source3/torture/vfstest.h b/source3/torture/vfstest.h
index 0d71facea9..0c57d5633a 100644
--- a/source3/torture/vfstest.h
+++ b/source3/torture/vfstest.h
@@ -29,12 +29,16 @@ struct func_entry {
struct vfs_state {
struct connection_struct *conn;
+ uint64_t mid;
struct files_struct *files[1024];
DIR *currentdir;
void *data;
size_t data_size;
};
+struct smb_request *vfstest_get_smbreq(TALLOC_CTX *mem_ctx,
+ struct vfs_state *vfs);
+
struct cmd_set {
const char *name;
NTSTATUS (*fn)(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,