1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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
This commit is contained in:
Volker Lendecke 2012-02-20 16:28:14 +01:00
parent b0c21afffe
commit ee2e3d56a2
2 changed files with 28 additions and 0 deletions

View File

@ -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[])

View File

@ -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,