/*
Unix SMB/CIFS implementation.
SMB torture tester - scanning functions
Copyright (C) Andrew Tridgell 2001
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 "system/filesys.h"
#include "torture/proto.h"
#include "libsmb/libsmb.h"
extern bool torture_showall;
enum deny_result {A_0=0, A_X=1, A_R=2, A_W=3, A_RW=5};
static const char *denystr(int denymode)
{
struct {
int v;
const char *name;
} deny_modes[] = {
{DENY_DOS, "DENY_DOS"},
{DENY_ALL, "DENY_ALL"},
{DENY_WRITE, "DENY_WRITE"},
{DENY_READ, "DENY_READ"},
{DENY_NONE, "DENY_NONE"},
{DENY_FCB, "DENY_FCB"},
{-1, NULL}};
int i;
for (i=0;deny_modes[i].name;i++) {
if (deny_modes[i].v == denymode) return deny_modes[i].name;
}
return "DENY_XXX";
}
static const char *openstr(int mode)
{
struct {
int v;
const char *name;
} open_modes[] = {
{O_RDWR, "O_RDWR"},
{O_RDONLY, "O_RDONLY"},
{O_WRONLY, "O_WRONLY"},
{-1, NULL}};
int i;
for (i=0;open_modes[i].name;i++) {
if (open_modes[i].v == mode) return open_modes[i].name;
}
return "O_XXX";
}
static const char *resultstr(enum deny_result res)
{
struct {
enum deny_result res;
const char *name;
} results[] = {
{A_X, "X"},
{A_0, "-"},
{A_R, "R"},
{A_W, "W"},
{A_RW,"RW"}};
size_t i;
for (i=0;i