*/
#include "includes.h"
-#include "torture/torture.h"
#include "libcli/raw/ioctl.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/libcli.h"
#include "torture/util.h"
if (!NT_STATUS_EQUAL(status, correct)) { \
printf("(%d) Incorrect status %s - should be %s\n", \
__LINE__, nt_errstr(status), nt_errstr(correct)); \
- ret = False; \
+ ret = false; \
goto done; \
}} while (0)
/* test some ioctls */
-static BOOL test_ioctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_ioctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_ioctl ctl;
int fnum;
NTSTATUS status;
- BOOL ret = True;
+ bool ret = true;
const char *fname = BASEDIR "\\test.dat";
printf("TESTING IOCTL FUNCTIONS\n");
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
printf("Failed to create test.dat - %s\n", smbcli_errstr(cli->tree));
- ret = False;
+ ret = false;
goto done;
}
}
/* test some filesystem control functions */
-static BOOL test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
int fnum;
NTSTATUS status;
- BOOL ret = True;
+ bool ret = true;
const char *fname = BASEDIR "\\test.dat";
union smb_ioctl nt;
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
printf("Failed to create test.dat - %s\n", smbcli_errstr(cli->tree));
- ret = False;
+ ret = false;
+ goto done;
+ }
+
+ printf("Trying FSCTL_FIND_FILES_BY_SID\n");
+ nt.ioctl.level = RAW_IOCTL_NTIOCTL;
+ nt.ntioctl.in.function = FSCTL_FIND_FILES_BY_SID;
+ nt.ntioctl.in.file.fnum = fnum;
+ nt.ntioctl.in.fsctl = true;
+ nt.ntioctl.in.filter = 0;
+ nt.ntioctl.in.max_data = 0;
+ nt.ntioctl.in.blob = data_blob(NULL, 1024);
+ /* definitely not a sid... */
+ generate_random_buffer(nt.ntioctl.in.blob.data,
+ nt.ntioctl.in.blob.length);
+ nt.ntioctl.in.blob.data[1] = 15+1;
+ status = smb_raw_ioctl(cli->tree, mem_ctx, &nt);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER) &&
+ !NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
+ printf("Got unexpected error code: %s\n",
+ nt_errstr(status));
+ ret = false;
goto done;
}
nt.ioctl.level = RAW_IOCTL_NTIOCTL;
nt.ntioctl.in.function = FSCTL_SET_SPARSE;
nt.ntioctl.in.file.fnum = fnum;
- nt.ntioctl.in.fsctl = True;
+ nt.ntioctl.in.fsctl = true;
nt.ntioctl.in.filter = 0;
nt.ntioctl.in.max_data = 0;
nt.ntioctl.in.blob = data_blob(NULL, 0);
nt.ioctl.level = RAW_IOCTL_NTIOCTL;
nt.ntioctl.in.function = FSCTL_REQUEST_BATCH_OPLOCK;
nt.ntioctl.in.file.fnum = fnum;
- nt.ntioctl.in.fsctl = True;
+ nt.ntioctl.in.fsctl = true;
nt.ntioctl.in.filter = 0;
nt.ntioctl.in.max_data = 0;
nt.ntioctl.in.blob = data_blob(NULL, 0);
basic testing of some ioctl calls
*/
bool torture_raw_ioctl(struct torture_context *torture,
- struct smbcli_state *cli)
+ struct smbcli_state *cli)
{
bool ret = true;
if (!torture_setup_dir(cli, BASEDIR)) {
- return False;
+ return false;
}
ret &= test_ioctl(cli, torture);