summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-07-16 05:34:56 +0000
committerGerald Carter <jerry@samba.org>2003-07-16 05:34:56 +0000
commit4a090ba06a54f5da179ac02bb307cc03d08831bf (patch)
treeed652ef36be7f16682c358816334f969a22f1c27 /source3/torture
parent95fe82670032a3a43571b46d7bbf2c26bc8cdcd9 (diff)
downloadsamba-4a090ba06a54f5da179ac02bb307cc03d08831bf.tar.gz
samba-4a090ba06a54f5da179ac02bb307cc03d08831bf.tar.bz2
samba-4a090ba06a54f5da179ac02bb307cc03d08831bf.zip
trying to get HEAD building again. If you want the code
prior to this merge, checkout HEAD_PRE_3_0_0_BETA_3_MERGE (This used to be commit adb98e7b7cd0f025b52c570e4034eebf4047b1ad)
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/cmd_vfs.c201
-rw-r--r--source3/torture/mangle_test.c4
-rw-r--r--source3/torture/masktest.c4
-rw-r--r--source3/torture/nsstest.c49
-rw-r--r--source3/torture/rpctorture.c8
-rw-r--r--source3/torture/smbiconv.c8
-rw-r--r--source3/torture/torture.c5
-rw-r--r--source3/torture/vfstest.c20
-rw-r--r--source3/torture/vfstest.h2
9 files changed, 168 insertions, 133 deletions
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c
index b90c53e9fe..f74fcedcf4 100644
--- a/source3/torture/cmd_vfs.c
+++ b/source3/torture/cmd_vfs.c
@@ -23,37 +23,28 @@
#include "includes.h"
#include "vfstest.h"
-static char *null_string = "";
+static const char *null_string = "";
-static NTSTATUS cmd_load_module(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_load_module(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
- struct smb_vfs_handle_struct *handle;
- char *path = lp_vfs_path(0);
- char name[PATH_MAX];
+ int i;
- if (argc != 2) {
- printf("Usage: load <module path>\n");
+ if (argc < 2) {
+ printf("Usage: load <modules>\n");
return NT_STATUS_OK;
}
- if (path != NULL && *path != '\0') {
- snprintf(name, PATH_MAX, "%s/%s", path, argv[1]);
- } else {
- snprintf(name, PATH_MAX, "%s", argv[1]);
- }
- vfs->conn->vfs_private = NULL;
- handle = (struct smb_vfs_handle_struct *) smb_xmalloc(sizeof(smb_vfs_handle_struct));
- handle->handle = NULL;
- DLIST_ADD(vfs->conn->vfs_private, handle)
- if (!vfs_init_custom(vfs->conn, name)) {
- DEBUG(0, ("load: error=-1 (vfs_init_custom failed for %s)\n", argv[1]));
- return NT_STATUS_UNSUCCESSFUL;
+ for (i=argc-1;i>0;i--) {
+ if (!vfs_init_custom(vfs->conn, argv[i])) {
+ DEBUG(0, ("load: (vfs_init_custom failed for %s)\n", argv[i]));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
}
printf("load: ok\n");
return NT_STATUS_OK;
}
-static NTSTATUS cmd_populate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_populate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
char c;
size_t size;
@@ -73,7 +64,7 @@ static NTSTATUS cmd_populate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
return NT_STATUS_OK;
}
-static NTSTATUS cmd_show_data(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_show_data(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
size_t offset;
size_t len;
@@ -101,19 +92,19 @@ static NTSTATUS cmd_show_data(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
return NT_STATUS_OK;
}
-static NTSTATUS cmd_connect(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_connect(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
- vfs->conn->vfs_ops.connect(vfs->conn, lp_servicename(vfs->conn->service), "vfstest");
+ SMB_VFS_CONNECT(vfs->conn, lp_servicename(vfs->conn->service), "vfstest");
return NT_STATUS_OK;
}
-static NTSTATUS cmd_disconnect(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_disconnect(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
- vfs->conn->vfs_ops.disconnect(vfs->conn);
+ SMB_VFS_DISCONNECT(vfs->conn);
return NT_STATUS_OK;
}
-static NTSTATUS cmd_disk_free(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_disk_free(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
SMB_BIG_UINT diskfree, bsize, dfree, dsize;
if (argc != 2) {
@@ -121,7 +112,7 @@ static NTSTATUS cmd_disk_free(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
return NT_STATUS_OK;
}
- diskfree = vfs->conn->vfs_ops.disk_free(vfs->conn, argv[1], False, &bsize, &dfree, &dsize);
+ diskfree = SMB_VFS_DISK_FREE(vfs->conn, argv[1], False, &bsize, &dfree, &dsize);
printf("disk_free: %lu, bsize = %lu, dfree = %lu, dsize = %lu\n",
(unsigned long)diskfree,
(unsigned long)bsize,
@@ -131,14 +122,14 @@ static NTSTATUS cmd_disk_free(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
}
-static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
if (argc != 2) {
printf("Usage: opendir <fname>\n");
return NT_STATUS_OK;
}
- vfs->currentdir = vfs->conn->vfs_ops.opendir(vfs->conn, argv[1]);
+ vfs->currentdir = SMB_VFS_OPENDIR(vfs->conn, argv[1]);
if (vfs->currentdir == NULL) {
printf("opendir error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
@@ -149,7 +140,7 @@ static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
}
-static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
struct dirent *dent;
@@ -158,7 +149,7 @@ static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
return NT_STATUS_UNSUCCESSFUL;
}
- dent = vfs->conn->vfs_ops.readdir(vfs->conn, vfs->currentdir);
+ dent = SMB_VFS_READDIR(vfs->conn, vfs->currentdir);
if (dent == NULL) {
printf("readdir: NULL\n");
return NT_STATUS_OK;
@@ -169,14 +160,14 @@ static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
}
-static NTSTATUS cmd_mkdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_mkdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
if (argc != 2) {
printf("Usage: mkdir <path>\n");
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.mkdir(vfs->conn, argv[1], 00755) == -1) {
+ if (SMB_VFS_MKDIR(vfs->conn, argv[1], 00755) == -1) {
printf("mkdir error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -186,7 +177,7 @@ static NTSTATUS cmd_mkdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_closedir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_closedir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int ret;
@@ -195,7 +186,7 @@ static NTSTATUS cmd_closedir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
return NT_STATUS_UNSUCCESSFUL;
}
- ret = vfs->conn->vfs_ops.closedir(vfs->conn, vfs->currentdir);
+ ret = SMB_VFS_CLOSEDIR(vfs->conn, vfs->currentdir);
if (ret == -1) {
printf("closedir failure: %s\n", strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
@@ -207,11 +198,11 @@ static NTSTATUS cmd_closedir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
}
-static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int flags, fd;
mode_t mode;
- char *flagstr;
+ const char *flagstr;
mode = 00400;
@@ -287,7 +278,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
}
}
- fd = vfs->conn->vfs_ops.open(vfs->conn, argv[1], flags, mode);
+ fd = SMB_VFS_OPEN(vfs->conn, argv[1], flags, mode);
if (fd == -1) {
printf("open: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
@@ -302,7 +293,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
}
-static NTSTATUS cmd_pathfunc(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_pathfunc(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int ret = -1;
@@ -312,11 +303,11 @@ static NTSTATUS cmd_pathfunc(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
}
if (strcmp("rmdir", argv[0]) == 0 ) {
- ret = vfs->conn->vfs_ops.rmdir(vfs->conn, argv[1]);
+ ret = SMB_VFS_RMDIR(vfs->conn, argv[1]);
} else if (strcmp("unlink", argv[0]) == 0 ) {
- ret = vfs->conn->vfs_ops.unlink(vfs->conn, argv[1]);
+ ret = SMB_VFS_UNLINK(vfs->conn, argv[1]);
} else if (strcmp("chdir", argv[0]) == 0 ) {
- ret = vfs->conn->vfs_ops.chdir(vfs->conn, argv[1]);
+ ret = SMB_VFS_CHDIR(vfs->conn, argv[1]);
} else {
printf("%s: error=%d (invalid function name!)\n", argv[0], errno);
return NT_STATUS_UNSUCCESSFUL;
@@ -332,7 +323,7 @@ static NTSTATUS cmd_pathfunc(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
}
-static NTSTATUS cmd_close(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_close(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int fd, ret;
@@ -347,7 +338,7 @@ static NTSTATUS cmd_close(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- ret = vfs->conn->vfs_ops.close(vfs->files[fd], fd);
+ ret = SMB_VFS_CLOSE(vfs->files[fd], fd);
if (ret == -1 )
printf("close: error=%d (%s)\n", errno, strerror(errno));
else
@@ -360,7 +351,7 @@ static NTSTATUS cmd_close(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_read(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_read(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int fd;
size_t size, rsize;
@@ -380,7 +371,7 @@ static NTSTATUS cmd_read(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
}
vfs->data_size = size;
- rsize = vfs->conn->vfs_ops.read(vfs->files[fd], fd, vfs->data, size);
+ rsize = SMB_VFS_READ(vfs->files[fd], fd, vfs->data, size);
if (rsize == -1) {
printf("read: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
@@ -391,7 +382,7 @@ static NTSTATUS cmd_read(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
}
-static NTSTATUS cmd_write(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_write(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int fd, size, wsize;
@@ -413,7 +404,7 @@ static NTSTATUS cmd_write(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_UNSUCCESSFUL;
}
- wsize = vfs->conn->vfs_ops.write(vfs->files[fd], fd, vfs->data, size);
+ wsize = SMB_VFS_WRITE(vfs->files[fd], fd, vfs->data, size);
if (wsize == -1) {
printf("write: error=%d (%s)\n", errno, strerror(errno));
@@ -425,7 +416,7 @@ static NTSTATUS cmd_write(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int fd, offset, whence;
SMB_OFF_T pos;
@@ -444,7 +435,7 @@ static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
default: whence = SEEK_END;
}
- pos = vfs->conn->vfs_ops.lseek(vfs->files[fd], fd, offset, whence);
+ pos = SMB_VFS_LSEEK(vfs->files[fd], fd, offset, whence);
if (pos == (SMB_OFF_T)-1) {
printf("lseek: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
@@ -455,7 +446,7 @@ static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_rename(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_rename(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int ret;
if (argc != 3) {
@@ -463,7 +454,7 @@ static NTSTATUS cmd_rename(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- ret = vfs->conn->vfs_ops.rename(vfs->conn, argv[1], argv[2]);
+ ret = SMB_VFS_RENAME(vfs->conn, argv[1], argv[2]);
if (ret == -1) {
printf("rename: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
@@ -474,7 +465,7 @@ static NTSTATUS cmd_rename(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_fsync(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_fsync(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int ret, fd;
if (argc != 2) {
@@ -483,7 +474,7 @@ static NTSTATUS cmd_fsync(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
fd = atoi(argv[1]);
- ret = vfs->conn->vfs_ops.fsync(vfs->files[fd], fd);
+ ret = SMB_VFS_FSYNC(vfs->files[fd], fd);
if (ret == -1) {
printf("fsync: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
@@ -494,11 +485,11 @@ static NTSTATUS cmd_fsync(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_stat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_stat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int ret;
- char *user;
- char *group;
+ const char *user;
+ const char *group;
struct passwd *pwd;
struct group *grp;
SMB_STRUCT_STAT st;
@@ -508,17 +499,17 @@ static NTSTATUS cmd_stat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
return NT_STATUS_OK;
}
- ret = vfs->conn->vfs_ops.stat(vfs->conn, argv[1], &st);
+ ret = SMB_VFS_STAT(vfs->conn, argv[1], &st);
if (ret == -1) {
printf("stat: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
pwd = sys_getpwuid(st.st_uid);
- if (pwd != NULL) user = strdup(pwd->pw_name);
+ if (pwd != NULL) user = pwd->pw_name;
else user = null_string;
grp = sys_getgrgid(st.st_gid);
- if (grp != NULL) group = strdup(grp->gr_name);
+ if (grp != NULL) group = grp->gr_name;
else group = null_string;
printf("stat: ok\n");
@@ -541,17 +532,17 @@ static NTSTATUS cmd_stat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
printf(" Access: %s", ctime(&(st.st_atime)));
printf(" Modify: %s", ctime(&(st.st_mtime)));
printf(" Change: %s", ctime(&(st.st_ctime)));
- if (user != null_string) SAFE_FREE(user);
- if (group!= null_string) SAFE_FREE(group);
+ SAFE_FREE(pwd);
+ SAFE_FREE(grp);
return NT_STATUS_OK;
}
-static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int fd;
- char *user;
- char *group;
+ const char *user;
+ const char *group;
struct passwd *pwd;
struct group *grp;
SMB_STRUCT_STAT st;
@@ -572,16 +563,16 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.fstat(vfs->files[fd], fd, &st) == -1) {
+ if (SMB_VFS_FSTAT(vfs->files[fd], fd, &st) == -1) {
printf("fstat: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
pwd = sys_getpwuid(st.st_uid);
- if (pwd != NULL) user = strdup(pwd->pw_name);
+ if (pwd != NULL) user = pwd->pw_name;
else user = null_string;
grp = sys_getgrgid(st.st_gid);
- if (grp != NULL) group = strdup(grp->gr_name);
+ if (grp != NULL) group = grp->gr_name;
else group = null_string;
printf("fstat: ok\n");
@@ -603,16 +594,16 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
printf(" Access: %s", ctime(&(st.st_atime)));
printf(" Modify: %s", ctime(&(st.st_mtime)));
printf(" Change: %s", ctime(&(st.st_ctime)));
- if (user != null_string) SAFE_FREE(user);
- if (group!= null_string) SAFE_FREE(group);
+ SAFE_FREE(pwd);
+ SAFE_FREE(grp);
return NT_STATUS_OK;
}
-static NTSTATUS cmd_lstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_lstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
- char *user;
- char *group;
+ const char *user;
+ const char *group;
struct passwd *pwd;
struct group *grp;
SMB_STRUCT_STAT st;
@@ -622,16 +613,16 @@ static NTSTATUS cmd_lstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.lstat(vfs->conn, argv[1], &st) == -1) {
+ if (SMB_VFS_LSTAT(vfs->conn, argv[1], &st) == -1) {
printf("lstat: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
pwd = sys_getpwuid(st.st_uid);
- if (pwd != NULL) user = strdup(pwd->pw_name);
+ if (pwd != NULL) user = pwd->pw_name;
else user = null_string;
grp = sys_getgrgid(st.st_gid);
- if (grp != NULL) group = strdup(grp->gr_name);
+ if (grp != NULL) group = grp->gr_name;
else group = null_string;
printf("lstat: ok\n");
@@ -653,13 +644,13 @@ static NTSTATUS cmd_lstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
printf(" Access: %s", ctime(&(st.st_atime)));
printf(" Modify: %s", ctime(&(st.st_mtime)));
printf(" Change: %s", ctime(&(st.st_ctime)));
- if (user != null_string) SAFE_FREE(user);
- if (group!= null_string) SAFE_FREE(group);
+ SAFE_FREE(pwd);
+ SAFE_FREE(grp);
return NT_STATUS_OK;
}
-static NTSTATUS cmd_chmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_chmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
mode_t mode;
if (argc != 3) {
@@ -668,7 +659,7 @@ static NTSTATUS cmd_chmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
mode = atoi(argv[2]);
- if (vfs->conn->vfs_ops.chmod(vfs->conn, argv[1], mode) == -1) {
+ if (SMB_VFS_CHMOD(vfs->conn, argv[1], mode) == -1) {
printf("chmod: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -678,7 +669,7 @@ static NTSTATUS cmd_chmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int fd;
mode_t mode;
@@ -698,7 +689,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.fchmod(vfs->files[fd], fd, mode) == -1) {
+ if (SMB_VFS_FCHMOD(vfs->files[fd], fd, mode) == -1) {
printf("fchmod: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -708,7 +699,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_chown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_chown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
uid_t uid;
gid_t gid;
@@ -719,7 +710,7 @@ static NTSTATUS cmd_chown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
uid = atoi(argv[2]);
gid = atoi(argv[3]);
- if (vfs->conn->vfs_ops.chown(vfs->conn, argv[1], uid, gid) == -1) {
+ if (SMB_VFS_CHOWN(vfs->conn, argv[1], uid, gid) == -1) {
printf("chown: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -729,7 +720,7 @@ static NTSTATUS cmd_chown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
uid_t uid;
gid_t gid;
@@ -750,7 +741,7 @@ static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
printf("fchown: error=%d (invalid file descriptor)\n", EBADF);
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.fchown(vfs->files[fd], fd, uid, gid) == -1) {
+ if (SMB_VFS_FCHOWN(vfs->files[fd], fd, uid, gid) == -1) {
printf("fchown error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -760,10 +751,10 @@ static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
-static NTSTATUS cmd_getwd(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_getwd(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
char buf[PATH_MAX];
- if (vfs->conn->vfs_ops.getwd(vfs->conn, buf) == NULL) {
+ if (SMB_VFS_GETWD(vfs->conn, buf) == NULL) {
printf("getwd: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -772,7 +763,7 @@ static NTSTATUS cmd_getwd(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
-static NTSTATUS cmd_utime(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_utime(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
struct utimbuf times;
if (argc != 4) {
@@ -781,7 +772,7 @@ static NTSTATUS cmd_utime(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
times.actime = atoi(argv[2]);
times.modtime = atoi(argv[3]);
- if (vfs->conn->vfs_ops.utime(vfs->conn, argv[1], &times) != 0) {
+ if (SMB_VFS_UTIME(vfs->conn, argv[1], &times) != 0) {
printf("utime: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -790,7 +781,7 @@ static NTSTATUS cmd_utime(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
-static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
int fd;
SMB_OFF_T off;
@@ -810,7 +801,7 @@ static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.ftruncate(vfs->files[fd], fd, off) == -1) {
+ if (SMB_VFS_FTRUNCATE(vfs->files[fd], fd, off) == -1) {
printf("ftruncate: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -819,7 +810,7 @@ static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
return NT_STATUS_OK;
}
-static NTSTATUS cmd_lock(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_lock(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
BOOL ret;
int fd;
@@ -827,7 +818,7 @@ static NTSTATUS cmd_lock(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
long offset;
long count;
int type;
- char *typestr;
+ const char *typestr;
if (argc != 6) {
printf("Usage: lock <fd> <op> <offset> <count> <type>\n");
@@ -893,7 +884,7 @@ static NTSTATUS cmd_lock(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
printf("lock: debug lock(fd=%d, op=%d, offset=%ld, count=%ld, type=%d))\n", fd, op, offset, count, type);
- if ((ret = vfs->conn->vfs_ops.lock(vfs->files[fd], fd, op, offset, count, type)) == False) {
+ if ((ret = SMB_VFS_LOCK(vfs->files[fd], fd, op, offset, count, type)) == False) {
printf("lock: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -902,14 +893,14 @@ static NTSTATUS cmd_lock(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
return NT_STATUS_OK;
}
-static NTSTATUS cmd_symlink(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_symlink(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
if (argc != 3) {
printf("Usage: symlink <path> <link>\n");
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.symlink(vfs->conn, argv[1], argv[2]) == -1) {
+ if (SMB_VFS_SYMLINK(vfs->conn, argv[1], argv[2]) == -1) {
printf("symlink: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -919,7 +910,7 @@ static NTSTATUS cmd_symlink(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
}
-static NTSTATUS cmd_readlink(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_readlink(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
char buffer[PATH_MAX];
int size;
@@ -929,7 +920,7 @@ static NTSTATUS cmd_readlink(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
return NT_STATUS_OK;
}
- if ((size = vfs->conn->vfs_ops.readlink(vfs->conn, argv[1], buffer, PATH_MAX)) == -1) {
+ if ((size = SMB_VFS_READLINK(vfs->conn, argv[1], buffer, PATH_MAX)) == -1) {
printf("readlink: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -940,14 +931,14 @@ static NTSTATUS cmd_readlink(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
}
-static NTSTATUS cmd_link(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_link(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
if (argc != 3) {
printf("Usage: link <path> <link>\n");
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.link(vfs->conn, argv[1], argv[2]) == -1) {
+ if (SMB_VFS_LINK(vfs->conn, argv[1], argv[2]) == -1) {
printf("link: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -956,7 +947,7 @@ static NTSTATUS cmd_link(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
return NT_STATUS_OK;
}
-static NTSTATUS cmd_mknod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_mknod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
mode_t mode;
unsigned int dev_val;
@@ -980,7 +971,7 @@ static NTSTATUS cmd_mknod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
}
dev = (SMB_DEV_T)dev_val;
- if (vfs->conn->vfs_ops.mknod(vfs->conn, argv[1], mode, dev) == -1) {
+ if (SMB_VFS_MKNOD(vfs->conn, argv[1], mode, dev) == -1) {
printf("mknod: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -989,7 +980,7 @@ static NTSTATUS cmd_mknod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
-static NTSTATUS cmd_realpath(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_realpath(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
char respath[PATH_MAX];
@@ -998,7 +989,7 @@ static NTSTATUS cmd_realpath(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
return NT_STATUS_OK;
}
- if (vfs->conn->vfs_ops.realpath(vfs->conn, argv[1], respath) == NULL) {
+ if (SMB_VFS_REALPATH(vfs->conn, argv[1], respath) == NULL) {
printf("realpath: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}
diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c
index e4ccfc1b83..660d4d17af 100644
--- a/source3/torture/mangle_test.c
+++ b/source3/torture/mangle_test.c
@@ -82,7 +82,7 @@ static BOOL test_one(struct cli_state *cli, const char *name)
}
/* see if the short name is already in the tdb */
- data = tdb_fetch_by_string(tdb, shortname);
+ data = tdb_fetch_bystring(tdb, shortname);
if (data.dptr) {
/* maybe its a duplicate long name? */
if (strcasecmp(name, data.dptr) != 0) {
@@ -98,7 +98,7 @@ static BOOL test_one(struct cli_state *cli, const char *name)
/* store it for later */
namedata.dptr = name;
namedata.dsize = strlen(name)+1;
- tdb_store_by_string(tdb, shortname, namedata, TDB_REPLACE);
+ tdb_store_bystring(tdb, shortname, namedata, TDB_REPLACE);
}
return True;
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c
index 06dead3f16..fa901e3d63 100644
--- a/source3/torture/masktest.c
+++ b/source3/torture/masktest.c
@@ -279,9 +279,9 @@ static void get_real_name(struct cli_state *cli,
}
if (f_info) {
fstrcpy(short_name, f_info->short_name);
- strlower(short_name);
+ strlower_m(short_name);
pstrcpy(long_name, f_info->name);
- strlower(long_name);
+ strlower_m(long_name);
}
if (*short_name == 0) {
diff --git a/source3/torture/nsstest.c b/source3/torture/nsstest.c
index a82fa05203..0a08cb6e8f 100644
--- a/source3/torture/nsstest.c
+++ b/source3/torture/nsstest.c
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
nss tester for winbindd
Copyright (C) Andrew Tridgell 2001
+ Copyright (C) Tim Potter 2003
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
@@ -44,6 +45,7 @@ static void *find_fn(const char *name)
res = sys_dlsym(h, s);
if (!res) {
printf("Can't find function %s\n", s);
+ total_errors++;
return NULL;
}
return res;
@@ -65,6 +67,9 @@ static struct passwd *nss_getpwent(void)
static char buf[1000];
NSS_STATUS status;
+ if (!_nss_getpwent_r)
+ return NULL;
+
status = _nss_getpwent_r(&pwd, buf, sizeof(buf), &nss_errno);
if (status == NSS_STATUS_NOTFOUND) {
return NULL;
@@ -83,6 +88,9 @@ static struct passwd *nss_getpwnam(const char *name)
static struct passwd pwd;
static char buf[1000];
NSS_STATUS status;
+
+ if (!_nss_getpwnam_r)
+ return NULL;
status = _nss_getpwnam_r(name, &pwd, buf, sizeof(buf), &nss_errno);
if (status == NSS_STATUS_NOTFOUND) {
@@ -102,6 +110,9 @@ static struct passwd *nss_getpwuid(uid_t uid)
static struct passwd pwd;
static char buf[1000];
NSS_STATUS status;
+
+ if (!_nss_getpwuid_r)
+ return NULL;
status = _nss_getpwuid_r(uid, &pwd, buf, sizeof(buf), &nss_errno);
if (status == NSS_STATUS_NOTFOUND) {
@@ -118,6 +129,10 @@ static void nss_setpwent(void)
{
NSS_STATUS (*_nss_setpwent)(void) = find_fn("setpwent");
NSS_STATUS status;
+
+ if (!_nss_setpwent)
+ return;
+
status = _nss_setpwent();
if (status != NSS_STATUS_SUCCESS) {
report_nss_error("setpwent", status);
@@ -128,6 +143,10 @@ static void nss_endpwent(void)
{
NSS_STATUS (*_nss_endpwent)(void) = find_fn("endpwent");
NSS_STATUS status;
+
+ if (!_nss_endpwent)
+ return;
+
status = _nss_endpwent();
if (status != NSS_STATUS_SUCCESS) {
report_nss_error("endpwent", status);
@@ -144,7 +163,11 @@ static struct group *nss_getgrent(void)
static int buflen = 1024;
NSS_STATUS status;
- if (!buf) buf = malloc(buflen);
+ if (!_nss_getgrent_r)
+ return NULL;
+
+ if (!buf)
+ buf = malloc(buflen);
again:
status = _nss_getgrent_r(&grp, buf, buflen, &nss_errno);
@@ -172,7 +195,11 @@ static struct group *nss_getgrnam(const char *name)
static int buflen = 1000;
NSS_STATUS status;
- if (!buf) buf = malloc(buflen);
+ if (!_nss_getgrnam_r)
+ return NULL;
+
+ if (!buf)
+ buf = malloc(buflen);
again:
status = _nss_getgrnam_r(name, &grp, buf, buflen, &nss_errno);
if (status == NSS_STATUS_TRYAGAIN) {
@@ -199,7 +226,12 @@ static struct group *nss_getgrgid(gid_t gid)
static int buflen = 1000;
NSS_STATUS status;
- if (!buf) buf = malloc(buflen);
+ if (!_nss_getgrgid_r)
+ return NULL;
+
+ if (!buf)
+ buf = malloc(buflen);
+
again:
status = _nss_getgrgid_r(gid, &grp, buf, buflen, &nss_errno);
if (status == NSS_STATUS_TRYAGAIN) {
@@ -221,6 +253,10 @@ static void nss_setgrent(void)
{
NSS_STATUS (*_nss_setgrent)(void) = find_fn("setgrent");
NSS_STATUS status;
+
+ if (!_nss_setgrent)
+ return;
+
status = _nss_setgrent();
if (status != NSS_STATUS_SUCCESS) {
report_nss_error("setgrent", status);
@@ -231,6 +267,10 @@ static void nss_endgrent(void)
{
NSS_STATUS (*_nss_endgrent)(void) = find_fn("endgrent");
NSS_STATUS status;
+
+ if (!_nss_endgrent)
+ return;
+
status = _nss_endgrent();
if (status != NSS_STATUS_SUCCESS) {
report_nss_error("endgrent", status);
@@ -244,7 +284,8 @@ static int nss_initgroups(char *user, gid_t group, gid_t **groups, long int *sta
find_fn("initgroups_dyn");
NSS_STATUS status;
- if (!_nss_initgroups) return NSS_STATUS_UNAVAIL;
+ if (!_nss_initgroups)
+ return NSS_STATUS_UNAVAIL;
status = _nss_initgroups(user, group, start, size, groups, 0, &nss_errno);
if (status != NSS_STATUS_SUCCESS) {
diff --git a/source3/torture/rpctorture.c b/source3/torture/rpctorture.c
index 086f8d5d33..8dfaebd64f 100644
--- a/source3/torture/rpctorture.c
+++ b/source3/torture/rpctorture.c
@@ -363,7 +363,7 @@ enum client_action
case 'S':
{
pstrcpy(cli_info.dest_host,optarg);
- strupper(cli_info.dest_host);
+ strupper_m(cli_info.dest_host);
cli_action = CLIENT_IPC;
break;
}
@@ -486,7 +486,7 @@ enum client_action
exit(1);
}
- strupper(global_myname);
+ strupper_m(global_myname);
fstrcpy(cli_info.myhostname, global_myname);
DEBUG(3,("%s client started (version %s)\n",timestring(False),VERSION));
@@ -495,7 +495,7 @@ enum client_action
{
pstrcpy(smb_cli->domain,lp_workgroup());
}
- strupper(smb_cli->domain);
+ strupper_m(smb_cli->domain);
load_interfaces();
@@ -506,7 +506,7 @@ enum client_action
}
fstrcpy(cli_info.mach_acct, cli_info.myhostname);
- strupper(cli_info.mach_acct);
+ strupper_m(cli_info.mach_acct);
fstrcat(cli_info.mach_acct, "$");
/* set the password cache info */
diff --git a/source3/torture/smbiconv.c b/source3/torture/smbiconv.c
index ce21a09025..3524136fb1 100644
--- a/source3/torture/smbiconv.c
+++ b/source3/torture/smbiconv.c
@@ -198,6 +198,10 @@ int main(int argc, char *argv[])
while(poptGetNextOpt(pc) != -1);
+ /* the following functions are part of the Samba debugging
+ facilities. See lib/debug.c */
+ setup_logging("smbiconv", True);
+
if(preload)smb_load_modules(str_list_make(preload, NULL));
if(output) {
@@ -209,10 +213,6 @@ int main(int argc, char *argv[])
}
}
- /* the following functions are part of the Samba debugging
- facilities. See lib/debug.c */
- setup_logging("smbiconv", True);
-
cd = smb_iconv_open(to, from);
if((int)cd == -1) {
DEBUG(0,("unable to find from or to encoding, exiting...\n"));
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 07d7f1547e..f26ebb49b3 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -866,7 +866,7 @@ static BOOL run_locktest1(int dummy)
lock_timeout = (1 + (random() % 20));
printf("Testing lock timeout with timeout=%u\n", lock_timeout);
t1 = time(NULL);
- if (cli_lock(cli2, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK)) {
+ if (cli_lock(cli2, fnum3, 0, 4, lock_timeout * 500, WRITE_LOCK)) {
printf("lock3 succeeded! This is a locking bug\n");
return False;
} else {
@@ -875,9 +875,10 @@ static BOOL run_locktest1(int dummy)
}
t2 = time(NULL);
- if (t2 - t1 < 5) {
+ if (ABS(t2 - t1) < lock_timeout-1) {
printf("error: This server appears not to support timed lock requests\n");
}
+
printf("server slept for %u seconds for a %u second timeout\n",
(unsigned int)(t2-t1), lock_timeout);
diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c
index 3b28a3c496..88fe348649 100644
--- a/source3/torture/vfstest.c
+++ b/source3/torture/vfstest.c
@@ -106,7 +106,7 @@ static char* next_command(char** cmdstr)
/* Load specified configuration file */
static NTSTATUS cmd_conf(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
- int argc, char **argv)
+ int argc, const char **argv)
{
if (argc != 2) {
printf("Usage: %s <smb.conf>\n", argv[0]);
@@ -181,7 +181,7 @@ static NTSTATUS cmd_help(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
}
/* Change the debug level */
-static NTSTATUS cmd_debuglevel(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_debuglevel(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
if (argc > 2) {
printf("Usage: %s [debuglevel]\n", argv[0]);
@@ -197,7 +197,7 @@ static NTSTATUS cmd_debuglevel(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
return NT_STATUS_OK;
}
-static NTSTATUS cmd_freemem(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_freemem(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
/* Cleanup */
talloc_destroy(mem_ctx);
@@ -207,7 +207,7 @@ static NTSTATUS cmd_freemem(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
return NT_STATUS_OK;
}
-static NTSTATUS cmd_quit(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+static NTSTATUS cmd_quit(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
/* Cleanup */
talloc_destroy(mem_ctx);
@@ -261,7 +261,8 @@ static void add_command_set(struct cmd_set *cmd_set)
static NTSTATUS do_cmd(struct vfs_state *vfs, struct cmd_set *cmd_entry, char *cmd)
{
- char *p = cmd, **argv = NULL;
+ const char *p = cmd;
+ char **argv = NULL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
pstring buf;
TALLOC_CTX *mem_ctx = NULL;
@@ -311,7 +312,7 @@ static NTSTATUS do_cmd(struct vfs_state *vfs, struct cmd_set *cmd_entry, char *c
}
/* Run command */
- result = cmd_entry->fn(vfs, mem_ctx, argc, argv);
+ result = cmd_entry->fn(vfs, mem_ctx, argc, (const char **)argv);
} else {
fprintf (stderr, "Invalid command\n");
@@ -338,7 +339,7 @@ static NTSTATUS process_cmd(struct vfs_state *vfs, char *cmd)
struct cmd_list *temp_list;
BOOL found = False;
pstring buf;
- char *p = cmd;
+ const char *p = cmd;
NTSTATUS result = NT_STATUS_OK;
int len = 0;
@@ -478,7 +479,7 @@ int main(int argc, char *argv[])
struct cmd_set **cmd_set;
static struct vfs_state vfs;
int i;
- static const char *filename = NULL;
+ static char *filename = NULL;
/* make sure the vars that get altered (4th field) are in
a fixed location or certain compilers complain */
@@ -520,9 +521,10 @@ int main(int argc, char *argv[])
}
/* some basic initialization stuff */
+ sec_init();
conn_init();
vfs.conn = conn_new();
- vfs.conn->user = "vfstest";
+ string_set(&vfs.conn->user,"vfstest");
for (i=0; i < 1024; i++)
vfs.files[i] = NULL;
diff --git a/source3/torture/vfstest.h b/source3/torture/vfstest.h
index 5910c5ce37..1e030fad04 100644
--- a/source3/torture/vfstest.h
+++ b/source3/torture/vfstest.h
@@ -39,7 +39,7 @@ struct vfs_state {
struct cmd_set {
const char *name;
NTSTATUS (*fn)(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
- char **argv);
+ const char **argv);
const char *description;
const char *usage;
};