/*
Unix SMB/CIFS implementation.
test suite for SMB2 write operations
Copyright (C) Andrew Tridgell 2006
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include "includes.h"
#include "librpc/gen_ndr/security.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
#include "torture/torture.h"
#include "torture/smb2/proto.h"
#define FNAME "testmaxwrite.dat"
/*
test writing
*/
static NTSTATUS torture_smb2_write(struct torture_context *tctx,
struct smb2_tree *tree,
struct smb2_handle handle)
{
struct smb2_write w;
struct smb2_read r;
NTSTATUS status;
int i, len;
int max = 80000000;
int min = 1;
while (max > min) {
TALLOC_CTX *tmp_ctx = talloc_new(tctx);
len = 1+(min+max)/2;
ZERO_STRUCT(w);
w.in.file.handle = handle;
w.in.offset = 0;
w.in.data = data_blob_talloc(tmp_ctx, NULL, len);
for (i=0;i