mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
Convert libcli routines to use cli_tree instead of cli_state. Port
smbtorture to use the new interface. Part 2 will be to eliminate cli_state from smbtorture as this is now the only place where it is used. (This used to be commit db1cc96af62ea42837d60592877fc3f93cef143b)
This commit is contained in:
parent
f0c9a54b30
commit
4639eb5a58
@ -193,8 +193,8 @@ static void send_message(void)
|
||||
int total_len = 0;
|
||||
int grp_id;
|
||||
|
||||
if (!cli_message_start(cli, desthost, username, &grp_id)) {
|
||||
d_printf("message start: %s\n", cli_errstr(cli));
|
||||
if (!cli_message_start(cli->tree, desthost, username, &grp_id)) {
|
||||
d_printf("message start: %s\n", cli_errstr(cli->tree));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -215,8 +215,8 @@ static void send_message(void)
|
||||
msg[l] = c;
|
||||
}
|
||||
|
||||
if (!cli_message_text(cli, msg, l, grp_id)) {
|
||||
d_printf("SMBsendtxt failed (%s)\n",cli_errstr(cli));
|
||||
if (!cli_message_text(cli->tree, msg, l, grp_id)) {
|
||||
d_printf("SMBsendtxt failed (%s)\n",cli_errstr(cli->tree));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -228,8 +228,8 @@ static void send_message(void)
|
||||
else
|
||||
d_printf("sent %d bytes\n",total_len);
|
||||
|
||||
if (!cli_message_end(cli, grp_id)) {
|
||||
d_printf("SMBsendend failed (%s)\n",cli_errstr(cli));
|
||||
if (!cli_message_end(cli->tree, grp_id)) {
|
||||
d_printf("SMBsendend failed (%s)\n",cli_errstr(cli->tree));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -243,8 +243,8 @@ static int do_dskattr(void)
|
||||
{
|
||||
int total, bsize, avail;
|
||||
|
||||
if (!cli_dskattr(cli, &bsize, &total, &avail)) {
|
||||
d_printf("Error in dskattr: %s\n",cli_errstr(cli));
|
||||
if (!cli_dskattr(cli->tree, &bsize, &total, &avail)) {
|
||||
d_printf("Error in dskattr: %s\n",cli_errstr(cli->tree));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -292,8 +292,8 @@ static int do_cd(char *newdir)
|
||||
dos_clean_name(cur_dir);
|
||||
|
||||
if (!strequal(cur_dir,"\\")) {
|
||||
if (!cli_chkpath(cli, dname)) {
|
||||
d_printf("cd %s: %s\n", dname, cli_errstr(cli));
|
||||
if (!cli_chkpath(cli->tree, dname)) {
|
||||
d_printf("cd %s: %s\n", dname, cli_errstr(cli->tree));
|
||||
pstrcpy(cur_dir,saved_dir);
|
||||
}
|
||||
}
|
||||
@ -600,7 +600,7 @@ void do_list(const char *mask,uint16 attribute,void (*fn)(file_info *),BOOL rec,
|
||||
*/
|
||||
pstring head;
|
||||
pstrcpy(head, do_list_queue_head());
|
||||
cli_list(cli, head, attribute, do_list_helper, NULL);
|
||||
cli_list(cli->tree, head, attribute, do_list_helper, NULL);
|
||||
remove_do_list_queue_head();
|
||||
if ((! do_list_queue_empty()) && (fn == display_finfo))
|
||||
{
|
||||
@ -624,9 +624,9 @@ void do_list(const char *mask,uint16 attribute,void (*fn)(file_info *),BOOL rec,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cli_list(cli, mask, attribute, do_list_helper, NULL) == -1)
|
||||
if (cli_list(cli->tree, mask, attribute, do_list_helper, NULL) == -1)
|
||||
{
|
||||
d_printf("%s listing %s\n", cli_errstr(cli), mask);
|
||||
d_printf("%s listing %s\n", cli_errstr(cli->tree), mask);
|
||||
}
|
||||
}
|
||||
|
||||
@ -729,10 +729,10 @@ static int do_get(char *rname, const char *lname, BOOL reget)
|
||||
strlower(lname);
|
||||
}
|
||||
|
||||
fnum = cli_open(cli, rname, O_RDONLY, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, rname, O_RDONLY, DENY_NONE);
|
||||
|
||||
if (fnum == -1) {
|
||||
d_printf("%s opening remote file %s\n",cli_errstr(cli),rname);
|
||||
d_printf("%s opening remote file %s\n",cli_errstr(cli->tree),rname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -759,11 +759,11 @@ static int do_get(char *rname, const char *lname, BOOL reget)
|
||||
}
|
||||
|
||||
|
||||
if (!cli_qfileinfo(cli, fnum,
|
||||
if (!cli_qfileinfo(cli->tree, fnum,
|
||||
&attr, &size, NULL, NULL, NULL, NULL, NULL) &&
|
||||
!cli_getattrE(cli, fnum,
|
||||
!cli_getattrE(cli->tree, fnum,
|
||||
&attr, &size, NULL, NULL, NULL)) {
|
||||
d_printf("getattrib: %s\n",cli_errstr(cli));
|
||||
d_printf("getattrib: %s\n",cli_errstr(cli->tree));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -772,12 +772,12 @@ static int do_get(char *rname, const char *lname, BOOL reget)
|
||||
|
||||
if(!(data = (char *)malloc(read_size))) {
|
||||
d_printf("malloc fail for size %d\n", read_size);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
int n = cli_read(cli, fnum, data, nread + start, read_size);
|
||||
int n = cli_read(cli->tree, fnum, data, nread + start, read_size);
|
||||
|
||||
if (n <= 0) break;
|
||||
|
||||
@ -799,8 +799,8 @@ static int do_get(char *rname, const char *lname, BOOL reget)
|
||||
|
||||
SAFE_FREE(data);
|
||||
|
||||
if (!cli_close(cli, fnum)) {
|
||||
d_printf("Error %s closing remote file\n",cli_errstr(cli));
|
||||
if (!cli_close(cli->tree, fnum)) {
|
||||
d_printf("Error %s closing remote file\n",cli_errstr(cli->tree));
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
@ -809,7 +809,7 @@ static int do_get(char *rname, const char *lname, BOOL reget)
|
||||
}
|
||||
|
||||
if (archive_level >= 2 && (attr & FILE_ATTRIBUTE_ARCHIVE)) {
|
||||
cli_setatr(cli, rname, attr & ~(uint16)FILE_ATTRIBUTE_ARCHIVE, 0);
|
||||
cli_setatr(cli->tree, rname, attr & ~(uint16)FILE_ATTRIBUTE_ARCHIVE, 0);
|
||||
}
|
||||
|
||||
{
|
||||
@ -1013,9 +1013,9 @@ make a directory of name "name"
|
||||
****************************************************************************/
|
||||
static BOOL do_mkdir(char *name)
|
||||
{
|
||||
if (!cli_mkdir(cli, name)) {
|
||||
if (!cli_mkdir(cli->tree, name)) {
|
||||
d_printf("%s making remote directory %s\n",
|
||||
cli_errstr(cli),name);
|
||||
cli_errstr(cli->tree),name);
|
||||
return(False);
|
||||
}
|
||||
|
||||
@ -1028,9 +1028,9 @@ show 8.3 name of a file
|
||||
static BOOL do_altname(char *name)
|
||||
{
|
||||
const char *altname;
|
||||
if (!NT_STATUS_IS_OK(cli_qpathinfo_alt_name(cli, name, &altname))) {
|
||||
if (!NT_STATUS_IS_OK(cli_qpathinfo_alt_name(cli->tree, name, &altname))) {
|
||||
d_printf("%s getting alt name for %s\n",
|
||||
cli_errstr(cli),name);
|
||||
cli_errstr(cli->tree),name);
|
||||
return(False);
|
||||
}
|
||||
d_printf("%s\n", altname);
|
||||
@ -1079,7 +1079,7 @@ static int cmd_mkdir(void)
|
||||
p = strtok(ddir,"/\\");
|
||||
while (p) {
|
||||
pstrcat(ddir2,p);
|
||||
if (!cli_chkpath(cli, ddir2)) {
|
||||
if (!cli_chkpath(cli->tree, ddir2)) {
|
||||
do_mkdir(ddir2);
|
||||
}
|
||||
pstrcat(ddir2,"\\");
|
||||
@ -1133,20 +1133,21 @@ static int do_put(char *rname, char *lname, BOOL reput)
|
||||
GetTimeOfDay(&tp_start);
|
||||
|
||||
if (reput) {
|
||||
fnum = cli_open(cli, rname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, rname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum >= 0) {
|
||||
if (!cli_qfileinfo(cli, fnum, NULL, &start, NULL, NULL, NULL, NULL, NULL) &&
|
||||
!cli_getattrE(cli, fnum, NULL, &start, NULL, NULL, NULL)) {
|
||||
d_printf("getattrib: %s\n",cli_errstr(cli));
|
||||
if (!cli_qfileinfo(cli->tree, fnum, NULL, &start, NULL, NULL, NULL, NULL, NULL) &&
|
||||
!cli_getattrE(cli->tree, fnum, NULL, &start, NULL, NULL, NULL)) {
|
||||
d_printf("getattrib: %s\n",cli_errstr(cli->tree));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fnum = cli_open(cli, rname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, rname, O_RDWR|O_CREAT|O_TRUNC,
|
||||
DENY_NONE);
|
||||
}
|
||||
|
||||
if (fnum == -1) {
|
||||
d_printf("%s opening remote file %s\n",cli_errstr(cli),rname);
|
||||
d_printf("%s opening remote file %s\n",cli_errstr(cli->tree),rname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1195,10 +1196,10 @@ static int do_put(char *rname, char *lname, BOOL reput)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = cli_write(cli, fnum, 0, buf, nread + start, n);
|
||||
ret = cli_write(cli->tree, fnum, 0, buf, nread + start, n);
|
||||
|
||||
if (n != ret) {
|
||||
d_printf("Error writing file: %s\n", cli_errstr(cli));
|
||||
d_printf("Error writing file: %s\n", cli_errstr(cli->tree));
|
||||
rc = 1;
|
||||
break;
|
||||
}
|
||||
@ -1206,8 +1207,8 @@ static int do_put(char *rname, char *lname, BOOL reput)
|
||||
nread += n;
|
||||
}
|
||||
|
||||
if (!cli_close(cli, fnum)) {
|
||||
d_printf("%s closing remote file %s\n",cli_errstr(cli),rname);
|
||||
if (!cli_close(cli->tree, fnum)) {
|
||||
d_printf("%s closing remote file %s\n",cli_errstr(cli->tree),rname);
|
||||
x_fclose(f);
|
||||
SAFE_FREE(buf);
|
||||
return 1;
|
||||
@ -1452,7 +1453,7 @@ static int cmd_mput(void)
|
||||
SAFE_FREE(rname);
|
||||
if(asprintf(&rname, "%s%s", cur_dir, lname) < 0) break;
|
||||
dos_format(rname);
|
||||
if (!cli_chkpath(cli, rname) &&
|
||||
if (!cli_chkpath(cli->tree, rname) &&
|
||||
!do_mkdir(rname)) {
|
||||
DEBUG (0, ("Unable to make dir, skipping..."));
|
||||
/* Skip the directory */
|
||||
@ -1569,8 +1570,8 @@ static void do_del(file_info *finfo)
|
||||
if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY)
|
||||
return;
|
||||
|
||||
if (!cli_unlink(cli, mask)) {
|
||||
d_printf("%s deleting remote file %s\n",cli_errstr(cli),mask);
|
||||
if (!cli_unlink(cli->tree, mask)) {
|
||||
d_printf("%s deleting remote file %s\n",cli_errstr(cli->tree),mask);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1617,10 +1618,10 @@ static int cmd_deltree(void)
|
||||
}
|
||||
pstrcat(dname,buf);
|
||||
|
||||
ret = cli_deltree(cli, dname);
|
||||
ret = cli_deltree(cli->tree, dname);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("Failed to delete tree %s - %s\n", dname, cli_errstr(cli));
|
||||
printf("Failed to delete tree %s - %s\n", dname, cli_errstr(cli->tree));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1759,9 +1760,9 @@ static int cmd_acl(void)
|
||||
}
|
||||
pstrcat(fname,buf);
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDONLY, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDONLY, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
d_printf("%s - %s\n", fname, cli_errstr(cli));
|
||||
d_printf("%s - %s\n", fname, cli_errstr(cli->tree));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1799,7 +1800,7 @@ static int cmd_open(void)
|
||||
}
|
||||
pstrcat(mask,buf);
|
||||
|
||||
cli_open(cli, mask, O_RDWR, DENY_ALL);
|
||||
cli_open(cli->tree, mask, O_RDWR, DENY_ALL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1821,9 +1822,9 @@ static int cmd_rmdir(void)
|
||||
}
|
||||
pstrcat(mask,buf);
|
||||
|
||||
if (!cli_rmdir(cli, mask)) {
|
||||
if (!cli_rmdir(cli->tree, mask)) {
|
||||
d_printf("%s removing remote directory file %s\n",
|
||||
cli_errstr(cli),mask);
|
||||
cli_errstr(cli->tree),mask);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1854,8 +1855,8 @@ static int cmd_link(void)
|
||||
pstrcat(src,buf);
|
||||
pstrcat(dest,buf2);
|
||||
|
||||
if (!cli_unix_hardlink(cli, src, dest)) {
|
||||
d_printf("%s linking files (%s -> %s)\n", cli_errstr(cli), src, dest);
|
||||
if (!cli_unix_hardlink(cli->tree, src, dest)) {
|
||||
d_printf("%s linking files (%s -> %s)\n", cli_errstr(cli->tree), src, dest);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1888,9 +1889,9 @@ static int cmd_symlink(void)
|
||||
pstrcat(src,buf);
|
||||
pstrcat(dest,buf2);
|
||||
|
||||
if (!cli_unix_symlink(cli, src, dest)) {
|
||||
if (!cli_unix_symlink(cli->tree, src, dest)) {
|
||||
d_printf("%s symlinking files (%s -> %s)\n",
|
||||
cli_errstr(cli), src, dest);
|
||||
cli_errstr(cli->tree), src, dest);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1923,9 +1924,9 @@ static int cmd_chmod(void)
|
||||
mode = (mode_t)strtol(buf, NULL, 8);
|
||||
pstrcat(src,buf2);
|
||||
|
||||
if (!cli_unix_chmod(cli, src, mode)) {
|
||||
if (!cli_unix_chmod(cli->tree, src, mode)) {
|
||||
d_printf("%s chmod file %s 0%o\n",
|
||||
cli_errstr(cli), src, (unsigned int)mode);
|
||||
cli_errstr(cli->tree), src, (unsigned int)mode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1961,9 +1962,9 @@ static int cmd_chown(void)
|
||||
gid = (gid_t)atoi(buf2);
|
||||
pstrcat(src,buf3);
|
||||
|
||||
if (!cli_unix_chown(cli, src, uid, gid)) {
|
||||
if (!cli_unix_chown(cli->tree, src, uid, gid)) {
|
||||
d_printf("%s chown file %s uid=%d, gid=%d\n",
|
||||
cli_errstr(cli), src, (int)uid, (int)gid);
|
||||
cli_errstr(cli->tree), src, (int)uid, (int)gid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1990,8 +1991,8 @@ static int cmd_rename(void)
|
||||
pstrcat(src,buf);
|
||||
pstrcat(dest,buf2);
|
||||
|
||||
if (!cli_rename(cli, src, dest)) {
|
||||
d_printf("%s renaming files\n",cli_errstr(cli));
|
||||
if (!cli_rename(cli->tree, src, dest)) {
|
||||
d_printf("%s renaming files\n",cli_errstr(cli->tree));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2474,7 +2475,7 @@ static char **remote_completion(const char *text, int len)
|
||||
} else
|
||||
snprintf(dirmask, sizeof(dirmask), "%s*", cur_dir);
|
||||
|
||||
if (cli_list(cli, dirmask,
|
||||
if (cli_list(cli->tree, dirmask,
|
||||
FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN,
|
||||
completion_remote_filter, &info) < 0)
|
||||
goto cleanup;
|
||||
@ -2623,7 +2624,7 @@ static void readline_callback(void)
|
||||
}
|
||||
|
||||
if (cli->tree) {
|
||||
cli_chkpath(cli, "\\");
|
||||
cli_chkpath(cli->tree, "\\");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2716,7 +2717,7 @@ static struct cli_state *do_connect(const char *server, const char *share)
|
||||
if (!cli_transport_establish(c, &calling, &called)) {
|
||||
char *p;
|
||||
d_printf("session request to %s failed (%s)\n",
|
||||
called.name, cli_errstr(c));
|
||||
called.name, cli_errstr(c->tree));
|
||||
cli_shutdown(c);
|
||||
if ((p=strchr_m(called.name, '.'))) {
|
||||
*p = 0;
|
||||
@ -2749,7 +2750,7 @@ static struct cli_state *do_connect(const char *server, const char *share)
|
||||
/* if a password was not supplied then try again with a null username */
|
||||
if (password[0] || !username[0] || use_kerberos ||
|
||||
!cli_session_setup(c, "", "", lp_workgroup())) {
|
||||
d_printf("session setup failed: %s\n", cli_errstr(c));
|
||||
d_printf("session setup failed: %s\n", cli_errstr(c->tree));
|
||||
cli_shutdown(c);
|
||||
return NULL;
|
||||
}
|
||||
@ -2759,7 +2760,7 @@ static struct cli_state *do_connect(const char *server, const char *share)
|
||||
DEBUG(4,(" session setup ok\n"));
|
||||
|
||||
if (!cli_send_tconX(c, sharename, "?????", password)) {
|
||||
d_printf("tree connect failed: %s\n", cli_errstr(c));
|
||||
d_printf("tree connect failed: %s\n", cli_errstr(c->tree));
|
||||
cli_shutdown(c);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -539,8 +539,8 @@ static BOOL ensurepath(char *fname)
|
||||
{
|
||||
safe_strcat(partpath, p, strlen(fname) + 1);
|
||||
|
||||
if (!cli_chkpath(cli, partpath)) {
|
||||
if (!cli_mkdir(cli, partpath))
|
||||
if (!cli_chkpath(cli->tree, partpath)) {
|
||||
if (!cli_mkdir(cli->tree, partpath))
|
||||
{
|
||||
DEBUG(0, ("Error mkdirhiering\n"));
|
||||
return False;
|
||||
@ -578,7 +578,7 @@ static void do_setrattr(char *name, uint16 attr, int set)
|
||||
{
|
||||
uint16 oldattr;
|
||||
|
||||
if (!cli_getatr(cli, name, &oldattr, NULL, NULL)) return;
|
||||
if (!cli_getatr(cli->tree, name, &oldattr, NULL, NULL)) return;
|
||||
|
||||
if (set == ATTRSET) {
|
||||
attr |= oldattr;
|
||||
@ -586,8 +586,8 @@ static void do_setrattr(char *name, uint16 attr, int set)
|
||||
attr = oldattr & ~attr;
|
||||
}
|
||||
|
||||
if (!cli_setatr(cli, name, attr, 0)) {
|
||||
DEBUG(1,("setatr failed: %s\n", cli_errstr(cli)));
|
||||
if (!cli_setatr(cli->tree, name, attr, 0)) {
|
||||
DEBUG(1,("setatr failed: %s\n", cli_errstr(cli->tree)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -644,13 +644,13 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
|
||||
return;
|
||||
}
|
||||
|
||||
fnum = cli_open(cli, rname, O_RDONLY, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, rname, O_RDONLY, DENY_NONE);
|
||||
|
||||
dos_clean_name(rname);
|
||||
|
||||
if (fnum == -1) {
|
||||
DEBUG(0,("%s opening remote file %s (%s)\n",
|
||||
cli_errstr(cli),rname, cur_dir));
|
||||
cli_errstr(cli->tree),rname, cur_dir));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -663,8 +663,8 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
|
||||
safe_strcpy(finfo.name,rname, strlen(rname));
|
||||
if (!finfo1) {
|
||||
size_t size;
|
||||
if (!cli_getattrE(cli, fnum, &finfo.mode, &size, NULL, &finfo.atime, &finfo.mtime)) {
|
||||
DEBUG(0, ("getattrE: %s\n", cli_errstr(cli)));
|
||||
if (!cli_getattrE(cli->tree, fnum, &finfo.mode, &size, NULL, &finfo.atime, &finfo.mtime)) {
|
||||
DEBUG(0, ("getattrE: %s\n", cli_errstr(cli->tree)));
|
||||
return;
|
||||
}
|
||||
finfo.size = size;
|
||||
@ -702,10 +702,10 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
|
||||
|
||||
DEBUG(3,("nread=%.0f\n",(double)nread));
|
||||
|
||||
datalen = cli_read(cli, fnum, data, nread, read_size);
|
||||
datalen = cli_read(cli->tree, fnum, data, nread, read_size);
|
||||
|
||||
if (datalen == -1) {
|
||||
DEBUG(0,("Error reading file %s : %s\n", rname, cli_errstr(cli)));
|
||||
DEBUG(0,("Error reading file %s : %s\n", rname, cli_errstr(cli->tree)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -750,7 +750,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
|
||||
ntarf++;
|
||||
}
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
if (shallitime)
|
||||
{
|
||||
@ -966,7 +966,7 @@ static int get_file(file_info2 finfo)
|
||||
DEBUG(5, ("get_file: file: %s, size %i\n", finfo.name, (int)finfo.size));
|
||||
|
||||
if (ensurepath(finfo.name) &&
|
||||
(fnum=cli_open(cli, finfo.name, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) == -1) {
|
||||
(fnum=cli_open(cli->tree, finfo.name, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) == -1) {
|
||||
DEBUG(0, ("abandoning restore\n"));
|
||||
return(False);
|
||||
}
|
||||
@ -983,7 +983,7 @@ static int get_file(file_info2 finfo)
|
||||
dsize = MIN(dsize, rsize); /* Should be only what is left */
|
||||
DEBUG(5, ("writing %i bytes, bpos = %i ...\n", dsize, bpos));
|
||||
|
||||
if (cli_write(cli, fnum, 0, buffer_p + bpos, pos, dsize) != dsize) {
|
||||
if (cli_write(cli->tree, fnum, 0, buffer_p + bpos, pos, dsize) != dsize) {
|
||||
DEBUG(0, ("Error writing remote file\n"));
|
||||
return 0;
|
||||
}
|
||||
@ -1036,7 +1036,7 @@ static int get_file(file_info2 finfo)
|
||||
|
||||
/* Now close the file ... */
|
||||
|
||||
if (!cli_close(cli, fnum)) {
|
||||
if (!cli_close(cli->tree, fnum)) {
|
||||
DEBUG(0, ("Error closing remote file\n"));
|
||||
return(False);
|
||||
}
|
||||
@ -1045,7 +1045,7 @@ static int get_file(file_info2 finfo)
|
||||
|
||||
DEBUG(5, ("Updating creation date on %s\n", finfo.name));
|
||||
|
||||
if (!cli_setatr(cli, finfo.name, finfo.mode, finfo.mtime)) {
|
||||
if (!cli_setatr(cli->tree, finfo.name, finfo.mode, finfo.mtime)) {
|
||||
if (tar_real_noisy) {
|
||||
DEBUG(0, ("Could not set time on file: %s\n", finfo.name));
|
||||
/*return(False); */ /* Ignore, as Win95 does not allow changes */
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "includes.h"
|
||||
|
||||
struct delete_state {
|
||||
struct cli_state *cli;
|
||||
struct cli_tree *tree;
|
||||
int total_deleted;
|
||||
BOOL failed;
|
||||
};
|
||||
@ -41,30 +41,30 @@ static void delete_fn(file_info *finfo, const char *name, void *state)
|
||||
asprintf(&s, "%s%s", n, finfo->name);
|
||||
|
||||
if (finfo->mode & FILE_ATTRIBUTE_READONLY) {
|
||||
if (!cli_setatr(dstate->cli, s, 0, 0)) {
|
||||
if (!cli_setatr(dstate->tree, s, 0, 0)) {
|
||||
DEBUG(2,("Failed to remove READONLY on %s - %s\n",
|
||||
s, cli_errstr(dstate->cli)));
|
||||
s, cli_errstr(dstate->tree)));
|
||||
}
|
||||
}
|
||||
|
||||
if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
char *s2;
|
||||
asprintf(&s2, "%s\\*", s);
|
||||
cli_unlink(dstate->cli, s2);
|
||||
cli_list(dstate->cli, s2,
|
||||
cli_unlink(dstate->tree, s2);
|
||||
cli_list(dstate->tree, s2,
|
||||
FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM,
|
||||
delete_fn, state);
|
||||
free(s2);
|
||||
if (!cli_rmdir(dstate->cli, s)) {
|
||||
if (!cli_rmdir(dstate->tree, s)) {
|
||||
DEBUG(2,("Failed to delete %s - %s\n",
|
||||
s, cli_errstr(dstate->cli)));
|
||||
s, cli_errstr(dstate->tree)));
|
||||
dstate->failed = True;
|
||||
}
|
||||
dstate->total_deleted++;
|
||||
} else {
|
||||
if (!cli_unlink(dstate->cli, s)) {
|
||||
if (!cli_unlink(dstate->tree, s)) {
|
||||
DEBUG(2,("Failed to delete %s - %s\n",
|
||||
s, cli_errstr(dstate->cli)));
|
||||
s, cli_errstr(dstate->tree)));
|
||||
dstate->failed = True;
|
||||
}
|
||||
dstate->total_deleted++;
|
||||
@ -77,34 +77,34 @@ static void delete_fn(file_info *finfo, const char *name, void *state)
|
||||
recursively descend a tree deleting all files
|
||||
returns the number of files deleted, or -1 on error
|
||||
*/
|
||||
int cli_deltree(struct cli_state *cli, const char *dname)
|
||||
int cli_deltree(struct cli_tree *tree, const char *dname)
|
||||
{
|
||||
char *mask;
|
||||
struct delete_state dstate;
|
||||
|
||||
dstate.cli = cli;
|
||||
dstate.tree = tree;
|
||||
dstate.total_deleted = 0;
|
||||
dstate.failed = False;
|
||||
|
||||
/* it might be a file */
|
||||
if (cli_unlink(cli, dname)) {
|
||||
if (cli_unlink(tree, dname)) {
|
||||
return 1;
|
||||
}
|
||||
if (NT_STATUS_EQUAL(cli_nt_error(cli), NT_STATUS_OBJECT_NAME_NOT_FOUND) ||
|
||||
NT_STATUS_EQUAL(cli_nt_error(cli), NT_STATUS_OBJECT_PATH_NOT_FOUND) ||
|
||||
NT_STATUS_EQUAL(cli_nt_error(cli), NT_STATUS_NO_SUCH_FILE)) {
|
||||
if (NT_STATUS_EQUAL(cli_nt_error(tree), NT_STATUS_OBJECT_NAME_NOT_FOUND) ||
|
||||
NT_STATUS_EQUAL(cli_nt_error(tree), NT_STATUS_OBJECT_PATH_NOT_FOUND) ||
|
||||
NT_STATUS_EQUAL(cli_nt_error(tree), NT_STATUS_NO_SUCH_FILE)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
asprintf(&mask, "%s\\*", dname);
|
||||
cli_unlink(cli, mask);
|
||||
cli_list(dstate.cli, mask,
|
||||
cli_unlink(dstate.tree, mask);
|
||||
cli_list(dstate.tree, mask,
|
||||
FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM,
|
||||
delete_fn, &dstate);
|
||||
free(mask);
|
||||
if (!cli_rmdir(dstate.cli, dname)) {
|
||||
if (!cli_rmdir(dstate.tree, dname)) {
|
||||
DEBUG(2,("Failed to delete %s - %s\n",
|
||||
dname, cli_errstr(dstate.cli)));
|
||||
dname, cli_errstr(dstate.tree)));
|
||||
return -1;
|
||||
}
|
||||
dstate.total_deleted++;
|
||||
|
@ -26,7 +26,7 @@
|
||||
Hard/Symlink a file (UNIX extensions).
|
||||
****************************************************************************/
|
||||
|
||||
static BOOL cli_link_internal(struct cli_state *cli,
|
||||
static BOOL cli_link_internal(struct cli_tree *tree,
|
||||
const char *fname_src,
|
||||
const char *fname_dst, BOOL hard_link)
|
||||
{
|
||||
@ -43,7 +43,7 @@ static BOOL cli_link_internal(struct cli_state *cli,
|
||||
parms.unix_link.in.link_dest = fname_dst;
|
||||
}
|
||||
|
||||
status = smb_raw_setpathinfo(cli->tree, &parms);
|
||||
status = smb_raw_setpathinfo(tree, &parms);
|
||||
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
@ -79,24 +79,27 @@ static uint32 unix_perms_to_wire(mode_t perms)
|
||||
/****************************************************************************
|
||||
Symlink a file (UNIX extensions).
|
||||
****************************************************************************/
|
||||
BOOL cli_unix_symlink(struct cli_state *cli, const char *fname_src, const char *fname_dst)
|
||||
BOOL cli_unix_symlink(struct cli_tree *tree, const char *fname_src,
|
||||
const char *fname_dst)
|
||||
{
|
||||
return cli_link_internal(cli, fname_src, fname_dst, False);
|
||||
return cli_link_internal(tree, fname_src, fname_dst, False);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Hard a file (UNIX extensions).
|
||||
****************************************************************************/
|
||||
BOOL cli_unix_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst)
|
||||
BOOL cli_unix_hardlink(struct cli_tree *tree, const char *fname_src,
|
||||
const char *fname_dst)
|
||||
{
|
||||
return cli_link_internal(cli, fname_src, fname_dst, True);
|
||||
return cli_link_internal(tree, fname_src, fname_dst, True);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Chmod or chown a file internal (UNIX extensions).
|
||||
****************************************************************************/
|
||||
static BOOL cli_unix_chmod_chown_internal(struct cli_state *cli, const char *fname,
|
||||
static BOOL cli_unix_chmod_chown_internal(struct cli_tree *tree,
|
||||
const char *fname,
|
||||
uint32 mode, uint32 uid, uint32 gid)
|
||||
{
|
||||
union smb_setfileinfo parms;
|
||||
@ -108,7 +111,7 @@ static BOOL cli_unix_chmod_chown_internal(struct cli_state *cli, const char *fna
|
||||
parms.unix_basic.in.gid = gid;
|
||||
parms.unix_basic.in.mode = mode;
|
||||
|
||||
status = smb_raw_setpathinfo(cli->tree, &parms);
|
||||
status = smb_raw_setpathinfo(tree, &parms);
|
||||
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
@ -117,25 +120,30 @@ static BOOL cli_unix_chmod_chown_internal(struct cli_state *cli, const char *fna
|
||||
chmod a file (UNIX extensions).
|
||||
****************************************************************************/
|
||||
|
||||
BOOL cli_unix_chmod(struct cli_state *cli, const char *fname, mode_t mode)
|
||||
BOOL cli_unix_chmod(struct cli_tree *tree, const char *fname, mode_t mode)
|
||||
{
|
||||
return cli_unix_chmod_chown_internal(cli, fname,
|
||||
unix_perms_to_wire(mode), SMB_UID_NO_CHANGE, SMB_GID_NO_CHANGE);
|
||||
return cli_unix_chmod_chown_internal(tree, fname,
|
||||
unix_perms_to_wire(mode),
|
||||
SMB_UID_NO_CHANGE,
|
||||
SMB_GID_NO_CHANGE);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
chown a file (UNIX extensions).
|
||||
****************************************************************************/
|
||||
BOOL cli_unix_chown(struct cli_state *cli, const char *fname, uid_t uid, gid_t gid)
|
||||
BOOL cli_unix_chown(struct cli_tree *tree, const char *fname, uid_t uid,
|
||||
gid_t gid)
|
||||
{
|
||||
return cli_unix_chmod_chown_internal(cli, fname, SMB_MODE_NO_CHANGE, (uint32)uid, (uint32)gid);
|
||||
return cli_unix_chmod_chown_internal(tree, fname, SMB_MODE_NO_CHANGE,
|
||||
(uint32)uid, (uint32)gid);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Rename a file.
|
||||
****************************************************************************/
|
||||
BOOL cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst)
|
||||
BOOL cli_rename(struct cli_tree *tree, const char *fname_src,
|
||||
const char *fname_dst)
|
||||
{
|
||||
union smb_rename parms;
|
||||
|
||||
@ -143,14 +151,14 @@ BOOL cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_
|
||||
parms.rename.in.attrib = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY;
|
||||
parms.rename.in.pattern1 = fname_src;
|
||||
parms.rename.in.pattern2 = fname_dst;
|
||||
return NT_STATUS_IS_OK(smb_raw_rename(cli->tree, &parms));
|
||||
return NT_STATUS_IS_OK(smb_raw_rename(tree, &parms));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Delete a file.
|
||||
****************************************************************************/
|
||||
BOOL cli_unlink(struct cli_state *cli, const char *fname)
|
||||
BOOL cli_unlink(struct cli_tree *tree, const char *fname)
|
||||
{
|
||||
struct smb_unlink parms;
|
||||
|
||||
@ -160,39 +168,39 @@ BOOL cli_unlink(struct cli_state *cli, const char *fname)
|
||||
} else {
|
||||
parms.in.attrib = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY;
|
||||
}
|
||||
return NT_STATUS_IS_OK(smb_raw_unlink(cli->tree, &parms));
|
||||
return NT_STATUS_IS_OK(smb_raw_unlink(tree, &parms));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Create a directory.
|
||||
****************************************************************************/
|
||||
BOOL cli_mkdir(struct cli_state *cli, const char *dname)
|
||||
BOOL cli_mkdir(struct cli_tree *tree, const char *dname)
|
||||
{
|
||||
union smb_mkdir parms;
|
||||
|
||||
parms.mkdir.level = RAW_MKDIR_MKDIR;
|
||||
parms.mkdir.in.path = dname;
|
||||
|
||||
return NT_STATUS_IS_OK(smb_raw_mkdir(cli->tree, &parms));
|
||||
return NT_STATUS_IS_OK(smb_raw_mkdir(tree, &parms));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Remove a directory.
|
||||
****************************************************************************/
|
||||
BOOL cli_rmdir(struct cli_state *cli, const char *dname)
|
||||
BOOL cli_rmdir(struct cli_tree *tree, const char *dname)
|
||||
{
|
||||
struct smb_rmdir parms;
|
||||
|
||||
parms.in.path = dname;
|
||||
return NT_STATUS_IS_OK(smb_raw_rmdir(cli->tree, &parms));
|
||||
return NT_STATUS_IS_OK(smb_raw_rmdir(tree, &parms));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Set or clear the delete on close flag.
|
||||
****************************************************************************/
|
||||
BOOL cli_nt_delete_on_close(struct cli_state *cli, int fnum, BOOL flag)
|
||||
BOOL cli_nt_delete_on_close(struct cli_tree *tree, int fnum, BOOL flag)
|
||||
{
|
||||
union smb_setfileinfo parms;
|
||||
NTSTATUS status;
|
||||
@ -201,7 +209,7 @@ BOOL cli_nt_delete_on_close(struct cli_state *cli, int fnum, BOOL flag)
|
||||
parms.disposition_info.file.fnum = fnum;
|
||||
parms.disposition_info.in.delete_on_close = flag;
|
||||
|
||||
status = smb_raw_setfileinfo(cli->tree, &parms);
|
||||
status = smb_raw_setfileinfo(tree, &parms);
|
||||
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
@ -211,11 +219,11 @@ BOOL cli_nt_delete_on_close(struct cli_state *cli, int fnum, BOOL flag)
|
||||
Create/open a file - exposing the full horror of the NT API :-).
|
||||
Used in CIFS-on-CIFS NTVFS.
|
||||
****************************************************************************/
|
||||
int cli_nt_create_full(struct cli_state *cli, const char *fname,
|
||||
uint32 CreatFlags, uint32 DesiredAccess,
|
||||
uint32 FileAttributes, uint32 ShareAccess,
|
||||
uint32 CreateDisposition, uint32 CreateOptions,
|
||||
uint8 SecurityFlags)
|
||||
int cli_nt_create_full(struct cli_tree *tree, const char *fname,
|
||||
uint32 CreatFlags, uint32 DesiredAccess,
|
||||
uint32 FileAttributes, uint32 ShareAccess,
|
||||
uint32 CreateDisposition, uint32 CreateOptions,
|
||||
uint8 SecurityFlags)
|
||||
{
|
||||
union smb_open open_parms;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
@ -237,7 +245,7 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname,
|
||||
open_parms.ntcreatex.in.security_flags = SecurityFlags;
|
||||
open_parms.ntcreatex.in.fname = fname;
|
||||
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &open_parms);
|
||||
status = smb_raw_open(tree, mem_ctx, &open_parms);
|
||||
talloc_destroy(mem_ctx);
|
||||
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
@ -252,7 +260,8 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname,
|
||||
Open a file (using SMBopenx)
|
||||
WARNING: if you open with O_WRONLY then getattrE won't work!
|
||||
****************************************************************************/
|
||||
int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode)
|
||||
int cli_open(struct cli_tree *tree, const char *fname, int flags,
|
||||
int share_mode)
|
||||
{
|
||||
union smb_open open_parms;
|
||||
unsigned openfn=0;
|
||||
@ -303,7 +312,7 @@ int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode
|
||||
open_parms.openx.in.timeout = 0;
|
||||
open_parms.openx.in.fname = fname;
|
||||
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &open_parms);
|
||||
status = smb_raw_open(tree, mem_ctx, &open_parms);
|
||||
talloc_destroy(mem_ctx);
|
||||
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
@ -317,7 +326,7 @@ int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode
|
||||
/****************************************************************************
|
||||
Close a file.
|
||||
****************************************************************************/
|
||||
BOOL cli_close(struct cli_state *cli, int fnum)
|
||||
BOOL cli_close(struct cli_tree *tree, int fnum)
|
||||
{
|
||||
union smb_close close_parms;
|
||||
NTSTATUS status;
|
||||
@ -325,7 +334,7 @@ BOOL cli_close(struct cli_state *cli, int fnum)
|
||||
close_parms.close.level = RAW_CLOSE_CLOSE;
|
||||
close_parms.close.in.fnum = fnum;
|
||||
close_parms.close.in.write_time = 0;
|
||||
status = smb_raw_close(cli->tree, &close_parms);
|
||||
status = smb_raw_close(tree, &close_parms);
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
|
||||
@ -333,7 +342,7 @@ BOOL cli_close(struct cli_state *cli, int fnum)
|
||||
send a lock with a specified locktype
|
||||
this is used for testing LOCKING_ANDX_CANCEL_LOCK
|
||||
****************************************************************************/
|
||||
NTSTATUS cli_locktype(struct cli_state *cli, int fnum,
|
||||
NTSTATUS cli_locktype(struct cli_tree *tree, int fnum,
|
||||
uint32 offset, uint32 len, int timeout, unsigned char locktype)
|
||||
{
|
||||
union smb_lock parms;
|
||||
@ -346,12 +355,12 @@ NTSTATUS cli_locktype(struct cli_state *cli, int fnum,
|
||||
parms.lockx.in.timeout = timeout;
|
||||
parms.lockx.in.ulock_cnt = 0;
|
||||
parms.lockx.in.lock_cnt = 1;
|
||||
lock[0].pid = cli->session->pid;
|
||||
lock[0].pid = tree->session->pid;
|
||||
lock[0].offset = offset;
|
||||
lock[0].count = len;
|
||||
parms.lockx.in.locks = &lock[0];
|
||||
|
||||
status = smb_raw_lock(cli->tree, &parms);
|
||||
status = smb_raw_lock(tree, &parms);
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -360,7 +369,7 @@ NTSTATUS cli_locktype(struct cli_state *cli, int fnum,
|
||||
/****************************************************************************
|
||||
Lock a file.
|
||||
****************************************************************************/
|
||||
BOOL cli_lock(struct cli_state *cli, int fnum,
|
||||
BOOL cli_lock(struct cli_tree *tree, int fnum,
|
||||
uint32 offset, uint32 len, int timeout, enum brl_type lock_type)
|
||||
{
|
||||
union smb_lock parms;
|
||||
@ -373,12 +382,12 @@ BOOL cli_lock(struct cli_state *cli, int fnum,
|
||||
parms.lockx.in.timeout = timeout;
|
||||
parms.lockx.in.ulock_cnt = 0;
|
||||
parms.lockx.in.lock_cnt = 1;
|
||||
lock[0].pid = cli->session->pid;
|
||||
lock[0].pid = tree->session->pid;
|
||||
lock[0].offset = offset;
|
||||
lock[0].count = len;
|
||||
parms.lockx.in.locks = &lock[0];
|
||||
|
||||
status = smb_raw_lock(cli->tree, &parms);
|
||||
status = smb_raw_lock(tree, &parms);
|
||||
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
@ -387,7 +396,7 @@ BOOL cli_lock(struct cli_state *cli, int fnum,
|
||||
/****************************************************************************
|
||||
Unlock a file.
|
||||
****************************************************************************/
|
||||
BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
|
||||
BOOL cli_unlock(struct cli_tree *tree, int fnum, uint32 offset, uint32 len)
|
||||
{
|
||||
union smb_lock parms;
|
||||
struct smb_lock_entry lock[1];
|
||||
@ -399,12 +408,12 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
|
||||
parms.lockx.in.timeout = 0;
|
||||
parms.lockx.in.ulock_cnt = 1;
|
||||
parms.lockx.in.lock_cnt = 0;
|
||||
lock[0].pid = cli->session->pid;
|
||||
lock[0].pid = tree->session->pid;
|
||||
lock[0].offset = offset;
|
||||
lock[0].count = len;
|
||||
parms.lockx.in.locks = &lock[0];
|
||||
|
||||
status = smb_raw_lock(cli->tree, &parms);
|
||||
status = smb_raw_lock(tree, &parms);
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
|
||||
@ -412,7 +421,7 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
|
||||
/****************************************************************************
|
||||
Lock a file with 64 bit offsets.
|
||||
****************************************************************************/
|
||||
BOOL cli_lock64(struct cli_state *cli, int fnum,
|
||||
BOOL cli_lock64(struct cli_tree *tree, int fnum,
|
||||
SMB_OFF_T offset, SMB_OFF_T len, int timeout, enum brl_type lock_type)
|
||||
{
|
||||
union smb_lock parms;
|
||||
@ -420,8 +429,8 @@ BOOL cli_lock64(struct cli_state *cli, int fnum,
|
||||
struct smb_lock_entry lock[1];
|
||||
NTSTATUS status;
|
||||
|
||||
if (!(cli->transport->negotiate.capabilities & CAP_LARGE_FILES)) {
|
||||
return cli_lock(cli, fnum, offset, len, timeout, lock_type);
|
||||
if (!(tree->session->transport->negotiate.capabilities & CAP_LARGE_FILES)) {
|
||||
return cli_lock(tree, fnum, offset, len, timeout, lock_type);
|
||||
}
|
||||
|
||||
parms.lockx.level = RAW_LOCK_LOCKX;
|
||||
@ -433,12 +442,12 @@ BOOL cli_lock64(struct cli_state *cli, int fnum,
|
||||
parms.lockx.in.timeout = timeout;
|
||||
parms.lockx.in.ulock_cnt = 0;
|
||||
parms.lockx.in.lock_cnt = 1;
|
||||
lock[0].pid = cli->session->pid;
|
||||
lock[0].pid = tree->session->pid;
|
||||
lock[0].offset = offset;
|
||||
lock[0].count = len;
|
||||
parms.lockx.in.locks = &lock[0];
|
||||
|
||||
status = smb_raw_lock(cli->tree, &parms);
|
||||
status = smb_raw_lock(tree, &parms);
|
||||
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
@ -447,14 +456,14 @@ BOOL cli_lock64(struct cli_state *cli, int fnum,
|
||||
/****************************************************************************
|
||||
Unlock a file with 64 bit offsets.
|
||||
****************************************************************************/
|
||||
BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_OFF_T offset, SMB_OFF_T len)
|
||||
BOOL cli_unlock64(struct cli_tree *tree, int fnum, SMB_OFF_T offset, SMB_OFF_T len)
|
||||
{
|
||||
union smb_lock parms;
|
||||
struct smb_lock_entry lock[1];
|
||||
NTSTATUS status;
|
||||
|
||||
if (!(cli->transport->negotiate.capabilities & CAP_LARGE_FILES)) {
|
||||
return cli_unlock(cli, fnum, offset, len);
|
||||
if (!(tree->session->transport->negotiate.capabilities & CAP_LARGE_FILES)) {
|
||||
return cli_unlock(tree, fnum, offset, len);
|
||||
}
|
||||
|
||||
parms.lockx.level = RAW_LOCK_LOCKX;
|
||||
@ -463,12 +472,12 @@ BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_OFF_T offset, SMB_OFF_T l
|
||||
parms.lockx.in.timeout = 0;
|
||||
parms.lockx.in.ulock_cnt = 1;
|
||||
parms.lockx.in.lock_cnt = 0;
|
||||
lock[0].pid = cli->session->pid;
|
||||
lock[0].pid = tree->session->pid;
|
||||
lock[0].offset = offset;
|
||||
lock[0].count = len;
|
||||
parms.lockx.in.locks = &lock[0];
|
||||
|
||||
status = smb_raw_lock(cli->tree, &parms);
|
||||
status = smb_raw_lock(tree, &parms);
|
||||
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
@ -477,9 +486,9 @@ BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_OFF_T offset, SMB_OFF_T l
|
||||
/****************************************************************************
|
||||
Do a SMBgetattrE call.
|
||||
****************************************************************************/
|
||||
BOOL cli_getattrE(struct cli_state *cli, int fd,
|
||||
uint16 *attr, size_t *size,
|
||||
time_t *c_time, time_t *a_time, time_t *m_time)
|
||||
BOOL cli_getattrE(struct cli_tree *tree, int fd,
|
||||
uint16 *attr, size_t *size,
|
||||
time_t *c_time, time_t *a_time, time_t *m_time)
|
||||
{
|
||||
union smb_fileinfo parms;
|
||||
NTSTATUS status;
|
||||
@ -487,7 +496,7 @@ BOOL cli_getattrE(struct cli_state *cli, int fd,
|
||||
parms.getattre.level = RAW_FILEINFO_GETATTRE;
|
||||
parms.getattre.in.fnum = fd;
|
||||
|
||||
status = smb_raw_fileinfo(cli->tree, NULL, &parms);
|
||||
status = smb_raw_fileinfo(tree, NULL, &parms);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status))
|
||||
return False;
|
||||
@ -518,7 +527,7 @@ BOOL cli_getattrE(struct cli_state *cli, int fd,
|
||||
/****************************************************************************
|
||||
Do a SMBgetatr call
|
||||
****************************************************************************/
|
||||
BOOL cli_getatr(struct cli_state *cli, const char *fname,
|
||||
BOOL cli_getatr(struct cli_tree *tree, const char *fname,
|
||||
uint16 *attr, size_t *size, time_t *t)
|
||||
{
|
||||
union smb_fileinfo parms;
|
||||
@ -527,7 +536,7 @@ BOOL cli_getatr(struct cli_state *cli, const char *fname,
|
||||
parms.getattr.level = RAW_FILEINFO_GETATTR;
|
||||
parms.getattr.in.fname = fname;
|
||||
|
||||
status = smb_raw_pathinfo(cli->tree, NULL, &parms);
|
||||
status = smb_raw_pathinfo(tree, NULL, &parms);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return False;
|
||||
@ -552,7 +561,7 @@ BOOL cli_getatr(struct cli_state *cli, const char *fname,
|
||||
/****************************************************************************
|
||||
Do a SMBsetatr call.
|
||||
****************************************************************************/
|
||||
BOOL cli_setatr(struct cli_state *cli, const char *fname, uint16 mode, time_t t)
|
||||
BOOL cli_setatr(struct cli_tree *tree, const char *fname, uint16 mode, time_t t)
|
||||
{
|
||||
union smb_setfileinfo parms;
|
||||
NTSTATUS status;
|
||||
@ -562,7 +571,7 @@ BOOL cli_setatr(struct cli_state *cli, const char *fname, uint16 mode, time_t t)
|
||||
parms.setattr.in.write_time = t;
|
||||
parms.setattr.file.fname = fname;
|
||||
|
||||
status = smb_raw_setpathinfo(cli->tree, &parms);
|
||||
status = smb_raw_setpathinfo(tree, &parms);
|
||||
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
@ -571,7 +580,7 @@ BOOL cli_setatr(struct cli_state *cli, const char *fname, uint16 mode, time_t t)
|
||||
/****************************************************************************
|
||||
Check for existence of a dir.
|
||||
****************************************************************************/
|
||||
BOOL cli_chkpath(struct cli_state *cli, const char *path)
|
||||
BOOL cli_chkpath(struct cli_tree *tree, const char *path)
|
||||
{
|
||||
struct smb_chkpath parms;
|
||||
char *path2;
|
||||
@ -586,7 +595,7 @@ BOOL cli_chkpath(struct cli_state *cli, const char *path)
|
||||
|
||||
parms.in.path = path2;
|
||||
|
||||
status = smb_raw_chkpath(cli->tree, &parms);
|
||||
status = smb_raw_chkpath(tree, &parms);
|
||||
|
||||
free(path2);
|
||||
|
||||
@ -597,7 +606,7 @@ BOOL cli_chkpath(struct cli_state *cli, const char *path)
|
||||
/****************************************************************************
|
||||
Query disk space.
|
||||
****************************************************************************/
|
||||
BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
|
||||
BOOL cli_dskattr(struct cli_tree *tree, int *bsize, int *total, int *avail)
|
||||
{
|
||||
union smb_fsinfo fsinfo_parms;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
@ -606,7 +615,7 @@ BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
|
||||
mem_ctx = talloc_init("cli_dskattr");
|
||||
|
||||
fsinfo_parms.dskattr.level = RAW_QFS_DSKATTR;
|
||||
status = smb_raw_fsinfo(cli->tree, mem_ctx, &fsinfo_parms);
|
||||
status = smb_raw_fsinfo(tree, mem_ctx, &fsinfo_parms);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
*bsize = fsinfo_parms.dskattr.out.block_size;
|
||||
*total = fsinfo_parms.dskattr.out.units_total;
|
||||
@ -622,7 +631,7 @@ BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
|
||||
/****************************************************************************
|
||||
Create and open a temporary file.
|
||||
****************************************************************************/
|
||||
int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path)
|
||||
int cli_ctemp(struct cli_tree *tree, const char *path, char **tmp_path)
|
||||
{
|
||||
union smb_open open_parms;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
@ -635,7 +644,7 @@ int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path)
|
||||
open_parms.ctemp.in.attrib = 0;
|
||||
open_parms.ctemp.in.directory = path;
|
||||
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &open_parms);
|
||||
status = smb_raw_open(tree, mem_ctx, &open_parms);
|
||||
if (tmp_path) {
|
||||
*tmp_path = strdup(open_parms.ctemp.out.name);
|
||||
}
|
||||
|
@ -81,8 +81,9 @@ static BOOL cli_list_new_callback(void *private, union smb_search_data *file)
|
||||
return True;
|
||||
}
|
||||
|
||||
int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute,
|
||||
void (*fn)(file_info *, const char *, void *), void *caller_state)
|
||||
int cli_list_new(struct cli_tree *tree, const char *Mask, uint16 attribute,
|
||||
void (*fn)(file_info *, const char *, void *),
|
||||
void *caller_state)
|
||||
{
|
||||
union smb_search_first first_parms;
|
||||
union smb_search_next next_parms;
|
||||
@ -104,7 +105,7 @@ int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute,
|
||||
|
||||
mask = talloc_strdup(state.mem_ctx, Mask);
|
||||
|
||||
if (cli->transport->negotiate.capabilities & CAP_NT_SMBS) {
|
||||
if (tree->session->transport->negotiate.capabilities & CAP_NT_SMBS) {
|
||||
level = RAW_SEARCH_BOTH_DIRECTORY_INFO;
|
||||
} else {
|
||||
level = RAW_SEARCH_STANDARD;
|
||||
@ -122,7 +123,7 @@ int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute,
|
||||
first_parms.t2ffirst.in.flags = FLAG_TRANS2_FIND_CLOSE_IF_END;
|
||||
first_parms.t2ffirst.in.storage_type = 0;
|
||||
|
||||
status = smb_raw_search_first(cli->tree,
|
||||
status = smb_raw_search_first(tree,
|
||||
state.mem_ctx, &first_parms,
|
||||
(void*)&state, cli_list_new_callback);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
@ -148,7 +149,7 @@ int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute,
|
||||
next_parms.t2fnext.in.resume_key = 0;
|
||||
next_parms.t2fnext.in.flags = FLAG_TRANS2_FIND_CONTINUE | FLAG_TRANS2_FIND_CLOSE_IF_END;
|
||||
|
||||
status = smb_raw_search_next(cli->tree,
|
||||
status = smb_raw_search_next(tree,
|
||||
state.mem_ctx,
|
||||
&next_parms,
|
||||
(void*)&state,
|
||||
@ -223,8 +224,9 @@ static BOOL cli_list_old_callback(void *private, union smb_search_data *file)
|
||||
return True;
|
||||
}
|
||||
|
||||
int cli_list_old(struct cli_state *cli, const char *Mask, uint16 attribute,
|
||||
void (*fn)(file_info *, const char *, void *), void *caller_state)
|
||||
int cli_list_old(struct cli_tree *tree, const char *Mask, uint16 attribute,
|
||||
void (*fn)(file_info *, const char *, void *),
|
||||
void *caller_state)
|
||||
{
|
||||
union smb_search_first first_parms;
|
||||
union smb_search_next next_parms;
|
||||
@ -254,10 +256,11 @@ int cli_list_old(struct cli_state *cli, const char *Mask, uint16 attribute,
|
||||
first_parms.search_first.in.search_attrib = attribute;
|
||||
first_parms.search_first.in.pattern = mask;
|
||||
|
||||
status = smb_raw_search_first(cli->tree, state.mem_ctx,
|
||||
&first_parms,
|
||||
(void*)&state,
|
||||
cli_list_old_callback);
|
||||
status = smb_raw_search_first(tree, state.mem_ctx,
|
||||
&first_parms,
|
||||
(void*)&state,
|
||||
cli_list_old_callback);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_destroy(state.mem_ctx);
|
||||
return -1;
|
||||
@ -274,10 +277,10 @@ int cli_list_old(struct cli_state *cli, const char *Mask, uint16 attribute,
|
||||
next_parms.search_next.in.search_attrib = attribute;
|
||||
next_parms.search_next.in.search_id = state.status;
|
||||
|
||||
status = smb_raw_search_next(cli->tree, state.mem_ctx,
|
||||
&next_parms,
|
||||
(void*)&state,
|
||||
cli_list_old_callback);
|
||||
status = smb_raw_search_next(tree, state.mem_ctx,
|
||||
&next_parms,
|
||||
(void*)&state,
|
||||
cli_list_old_callback);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_destroy(state.mem_ctx);
|
||||
@ -304,10 +307,10 @@ int cli_list_old(struct cli_state *cli, const char *Mask, uint16 attribute,
|
||||
This auto-switches between old and new style.
|
||||
****************************************************************************/
|
||||
|
||||
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
|
||||
int cli_list(struct cli_tree *tree, const char *Mask,uint16 attribute,
|
||||
void (*fn)(file_info *, const char *, void *), void *state)
|
||||
{
|
||||
if (cli->transport->negotiate.protocol <= PROTOCOL_LANMAN1)
|
||||
return cli_list_old(cli, Mask, attribute, fn, state);
|
||||
return cli_list_new(cli, Mask, attribute, fn, state);
|
||||
if (tree->session->transport->negotiate.protocol <= PROTOCOL_LANMAN1)
|
||||
return cli_list_old(tree, Mask, attribute, fn, state);
|
||||
return cli_list_new(tree, Mask, attribute, fn, state);
|
||||
}
|
||||
|
@ -25,17 +25,17 @@
|
||||
/****************************************************************************
|
||||
start a message sequence
|
||||
****************************************************************************/
|
||||
BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
|
||||
int *grp)
|
||||
BOOL cli_message_start(struct cli_tree *tree, char *host, char *username,
|
||||
int *grp)
|
||||
{
|
||||
struct cli_request *req;
|
||||
|
||||
req = cli_request_setup(cli->tree, SMBsendstrt, 0, 0);
|
||||
req = cli_request_setup(tree, SMBsendstrt, 0, 0);
|
||||
cli_req_append_string(req, username, STR_TERMINATE);
|
||||
cli_req_append_string(req, host, STR_TERMINATE);
|
||||
if (!cli_request_send(req) ||
|
||||
!cli_request_receive(req) ||
|
||||
cli_is_error(cli)) {
|
||||
cli_is_error(tree)) {
|
||||
cli_request_destroy(req);
|
||||
return False;
|
||||
}
|
||||
@ -50,18 +50,18 @@ BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
|
||||
/****************************************************************************
|
||||
send a message
|
||||
****************************************************************************/
|
||||
BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp)
|
||||
BOOL cli_message_text(struct cli_tree *tree, char *msg, int len, int grp)
|
||||
{
|
||||
struct cli_request *req;
|
||||
|
||||
req = cli_request_setup(cli->tree, SMBsendtxt, 1, 0);
|
||||
req = cli_request_setup(tree, SMBsendtxt, 1, 0);
|
||||
SSVAL(req->out.vwv, VWV(0), grp);
|
||||
|
||||
cli_req_append_bytes(req, msg, len);
|
||||
|
||||
if (!cli_request_send(req) ||
|
||||
!cli_request_receive(req) ||
|
||||
cli_is_error(cli)) {
|
||||
cli_is_error(tree)) {
|
||||
cli_request_destroy(req);
|
||||
return False;
|
||||
}
|
||||
@ -73,16 +73,16 @@ BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp)
|
||||
/****************************************************************************
|
||||
end a message
|
||||
****************************************************************************/
|
||||
BOOL cli_message_end(struct cli_state *cli, int grp)
|
||||
BOOL cli_message_end(struct cli_tree *tree, int grp)
|
||||
{
|
||||
struct cli_request *req;
|
||||
|
||||
req = cli_request_setup(cli->tree, SMBsendend, 1, 0);
|
||||
req = cli_request_setup(tree, SMBsendend, 1, 0);
|
||||
SSVAL(req->out.vwv, VWV(0), grp);
|
||||
|
||||
if (!cli_request_send(req) ||
|
||||
!cli_request_receive(req) ||
|
||||
cli_is_error(cli)) {
|
||||
cli_is_error(tree)) {
|
||||
cli_request_destroy(req);
|
||||
return False;
|
||||
}
|
||||
|
@ -24,7 +24,8 @@
|
||||
/****************************************************************************
|
||||
Read size bytes at offset offset using SMBreadX.
|
||||
****************************************************************************/
|
||||
ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size)
|
||||
ssize_t cli_read(struct cli_tree *tree, int fnum, char *buf, off_t offset,
|
||||
size_t size)
|
||||
{
|
||||
union smb_read parms;
|
||||
int readsize;
|
||||
@ -41,7 +42,8 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
|
||||
* Set readsize to the maximum size we can handle in one readX,
|
||||
* rounded down to a multiple of 1024.
|
||||
*/
|
||||
readsize = (cli->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32)) & ~1023;
|
||||
readsize = (tree->session->transport->negotiate.max_xmit -
|
||||
(MIN_SMB_SIZE+32)) & ~1023;
|
||||
if (readsize > 0xFFFF) readsize = 0xFFFF;
|
||||
|
||||
while (total < size) {
|
||||
@ -55,7 +57,7 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
|
||||
parms.readx.in.remaining = size - total;
|
||||
parms.readx.out.data = buf + total;
|
||||
|
||||
status = smb_raw_read(cli->tree, &parms);
|
||||
status = smb_raw_read(tree, &parms);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return -1;
|
||||
@ -80,12 +82,12 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
|
||||
0x0004 use raw named pipe protocol
|
||||
0x0008 start of message mode named pipe protocol
|
||||
****************************************************************************/
|
||||
ssize_t cli_write(struct cli_state *cli,
|
||||
ssize_t cli_write(struct cli_tree *tree,
|
||||
int fnum, uint16 write_mode,
|
||||
const char *buf, off_t offset, size_t size)
|
||||
{
|
||||
union smb_write parms;
|
||||
int block = (cli->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32)) & ~1023;
|
||||
int block = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32)) & ~1023;
|
||||
ssize_t total = 0;
|
||||
|
||||
if (size == 0) {
|
||||
@ -109,7 +111,7 @@ ssize_t cli_write(struct cli_state *cli,
|
||||
parms.writex.in.count = block;
|
||||
parms.writex.in.data = buf;
|
||||
|
||||
status = smb_raw_write(cli->tree, &parms);
|
||||
status = smb_raw_write(tree, &parms);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return -1;
|
||||
@ -126,7 +128,7 @@ ssize_t cli_write(struct cli_state *cli,
|
||||
/****************************************************************************
|
||||
write to a file using a SMBwrite and not bypassing 0 byte writes
|
||||
****************************************************************************/
|
||||
ssize_t cli_smbwrite(struct cli_state *cli,
|
||||
ssize_t cli_smbwrite(struct cli_tree *tree,
|
||||
int fnum, char *buf, off_t offset, size_t size1)
|
||||
{
|
||||
union smb_write parms;
|
||||
@ -136,7 +138,7 @@ ssize_t cli_smbwrite(struct cli_state *cli,
|
||||
parms.write.in.remaining = 0;
|
||||
|
||||
do {
|
||||
size_t size = MIN(size1, cli->transport->negotiate.max_xmit - 48);
|
||||
size_t size = MIN(size1, tree->session->transport->negotiate.max_xmit - 48);
|
||||
if (size > 0xFFFF) size = 0xFFFF;
|
||||
|
||||
parms.write.in.fnum = fnum;
|
||||
@ -144,7 +146,7 @@ ssize_t cli_smbwrite(struct cli_state *cli,
|
||||
parms.write.in.count = size;
|
||||
parms.write.in.data = buf + total;
|
||||
|
||||
if (NT_STATUS_IS_ERR(smb_raw_write(cli->tree, &parms)))
|
||||
if (NT_STATUS_IS_ERR(smb_raw_write(tree, &parms)))
|
||||
return -1;
|
||||
|
||||
size = parms.write.out.nwritten;
|
||||
|
@ -24,7 +24,7 @@
|
||||
/****************************************************************************
|
||||
query the security descriptor for a open file
|
||||
****************************************************************************/
|
||||
SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
|
||||
SEC_DESC *cli_query_secdesc(struct cli_tree *tree, int fnum,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
struct smb_nttrans parms;
|
||||
@ -48,7 +48,7 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
|
||||
parms.in.params = param_blob;
|
||||
parms.in.data = data_blob(NULL, 0);
|
||||
|
||||
status = smb_raw_nttrans(cli->tree, mem_ctx, &parms);
|
||||
status = smb_raw_nttrans(tree, mem_ctx, &parms);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(1,("Failed to send NT_TRANSACT_QUERY_SECURITY_DESC\n"));
|
||||
@ -72,7 +72,7 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
|
||||
/****************************************************************************
|
||||
set the security descriptor for a open file
|
||||
****************************************************************************/
|
||||
BOOL cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd)
|
||||
BOOL cli_set_secdesc(struct cli_tree *tree, int fnum, SEC_DESC *sd)
|
||||
{
|
||||
struct smb_nttrans parms;
|
||||
char param[8];
|
||||
@ -106,7 +106,7 @@ BOOL cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd)
|
||||
parms.in.params = param_blob;
|
||||
parms.in.data = data_blob(NULL, 0);
|
||||
|
||||
status = smb_raw_nttrans(cli->tree, mem_ctx, &parms);
|
||||
status = smb_raw_nttrans(tree, mem_ctx, &parms);
|
||||
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
DEBUG(1,("Failed to send NT_TRANSACT_SET_SECURITY_DESC\n"));
|
||||
|
@ -23,7 +23,7 @@
|
||||
/****************************************************************************
|
||||
send a qpathinfo call
|
||||
****************************************************************************/
|
||||
BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
|
||||
BOOL cli_qpathinfo(struct cli_tree *tree, const char *fname,
|
||||
time_t *c_time, time_t *a_time, time_t *m_time,
|
||||
size_t *size, uint16 *mode)
|
||||
{
|
||||
@ -37,7 +37,7 @@ BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
|
||||
parms.standard.level = RAW_FILEINFO_STANDARD;
|
||||
parms.standard.in.fname = fname;
|
||||
|
||||
status = smb_raw_pathinfo(cli->tree, mem_ctx, &parms);
|
||||
status = smb_raw_pathinfo(tree, mem_ctx, &parms);
|
||||
talloc_destroy(mem_ctx);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return False;
|
||||
@ -65,7 +65,7 @@ BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
|
||||
/****************************************************************************
|
||||
send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level
|
||||
****************************************************************************/
|
||||
BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
|
||||
BOOL cli_qpathinfo2(struct cli_tree *tree, const char *fname,
|
||||
time_t *c_time, time_t *a_time, time_t *m_time,
|
||||
time_t *w_time, size_t *size, uint16 *mode,
|
||||
SMB_INO_T *ino)
|
||||
@ -80,7 +80,7 @@ BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
|
||||
parms.all_info.level = RAW_FILEINFO_ALL_INFO;
|
||||
parms.all_info.in.fname = fname;
|
||||
|
||||
status = smb_raw_pathinfo(cli->tree, mem_ctx, &parms);
|
||||
status = smb_raw_pathinfo(tree, mem_ctx, &parms);
|
||||
talloc_destroy(mem_ctx);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return False;
|
||||
@ -112,7 +112,7 @@ BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
|
||||
/****************************************************************************
|
||||
send a qfileinfo QUERY_FILE_NAME_INFO call
|
||||
****************************************************************************/
|
||||
BOOL cli_qfilename(struct cli_state *cli, int fnum,
|
||||
BOOL cli_qfilename(struct cli_tree *tree, int fnum,
|
||||
const char **name)
|
||||
{
|
||||
union smb_fileinfo parms;
|
||||
@ -125,7 +125,7 @@ BOOL cli_qfilename(struct cli_state *cli, int fnum,
|
||||
parms.name_info.level = RAW_FILEINFO_NAME_INFO;
|
||||
parms.name_info.in.fnum = fnum;
|
||||
|
||||
status = smb_raw_fileinfo(cli->tree, mem_ctx, &parms);
|
||||
status = smb_raw_fileinfo(tree, mem_ctx, &parms);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_destroy(mem_ctx);
|
||||
*name = NULL;
|
||||
@ -143,7 +143,7 @@ BOOL cli_qfilename(struct cli_state *cli, int fnum,
|
||||
/****************************************************************************
|
||||
send a qfileinfo call
|
||||
****************************************************************************/
|
||||
BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
|
||||
BOOL cli_qfileinfo(struct cli_tree *tree, int fnum,
|
||||
uint16 *mode, size_t *size,
|
||||
time_t *c_time, time_t *a_time, time_t *m_time,
|
||||
time_t *w_time, SMB_INO_T *ino)
|
||||
@ -158,7 +158,7 @@ BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
|
||||
parms.all_info.level = RAW_FILEINFO_ALL_INFO;
|
||||
parms.all_info.in.fnum = fnum;
|
||||
|
||||
status = smb_raw_fileinfo(cli->tree, mem_ctx, &parms);
|
||||
status = smb_raw_fileinfo(tree, mem_ctx, &parms);
|
||||
talloc_destroy(mem_ctx);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return False;
|
||||
@ -193,7 +193,7 @@ BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
|
||||
/****************************************************************************
|
||||
send a qpathinfo SMB_QUERY_FILE_ALT_NAME_INFO call
|
||||
****************************************************************************/
|
||||
NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname,
|
||||
NTSTATUS cli_qpathinfo_alt_name(struct cli_tree *tree, const char *fname,
|
||||
const char **alt_name)
|
||||
{
|
||||
union smb_fileinfo parms;
|
||||
@ -206,11 +206,11 @@ NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname,
|
||||
mem_ctx = talloc_init("cli_qpathinfo_alt_name");
|
||||
if (!mem_ctx) return NT_STATUS_NO_MEMORY;
|
||||
|
||||
status = smb_raw_pathinfo(cli->tree, mem_ctx, &parms);
|
||||
status = smb_raw_pathinfo(tree, mem_ctx, &parms);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_destroy(mem_ctx);
|
||||
*alt_name = NULL;
|
||||
return cli_nt_error(cli);
|
||||
return cli_nt_error(tree);
|
||||
}
|
||||
|
||||
if (!parms.alt_name_info.out.fname.s) {
|
||||
|
@ -25,14 +25,15 @@
|
||||
/***************************************************************************
|
||||
Return an error message from the last response
|
||||
****************************************************************************/
|
||||
const char *cli_errstr(struct cli_state *cli)
|
||||
const char *cli_errstr(struct cli_tree *tree)
|
||||
{
|
||||
switch (cli->transport->error.etype) {
|
||||
switch (tree->session->transport->error.etype) {
|
||||
case ETYPE_DOS:
|
||||
return dos_errstr(cli->transport->error.e.dos.eclass,
|
||||
cli->transport->error.e.dos.ecode);
|
||||
return dos_errstr(
|
||||
tree->session->transport->error.e.dos.eclass,
|
||||
tree->session->transport->error.e.dos.ecode);
|
||||
case ETYPE_NT:
|
||||
return nt_errstr(cli->transport->error.e.nt_status);
|
||||
return nt_errstr(tree->session->transport->error.e.nt_status);
|
||||
|
||||
case ETYPE_SOCKET:
|
||||
return "socket_error";
|
||||
@ -48,15 +49,16 @@ const char *cli_errstr(struct cli_state *cli)
|
||||
|
||||
|
||||
/* Return the 32-bit NT status code from the last packet */
|
||||
NTSTATUS cli_nt_error(struct cli_state *cli)
|
||||
NTSTATUS cli_nt_error(struct cli_tree *tree)
|
||||
{
|
||||
switch (cli->transport->error.etype) {
|
||||
switch (tree->session->transport->error.etype) {
|
||||
case ETYPE_NT:
|
||||
return cli->transport->error.e.nt_status;
|
||||
return tree->session->transport->error.e.nt_status;
|
||||
|
||||
case ETYPE_DOS:
|
||||
return dos_to_ntstatus(cli->transport->error.e.dos.eclass,
|
||||
cli->transport->error.e.dos.ecode);
|
||||
return dos_to_ntstatus(
|
||||
tree->session->transport->error.e.dos.eclass,
|
||||
tree->session->transport->error.e.dos.ecode);
|
||||
case ETYPE_SOCKET:
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
|
||||
@ -87,13 +89,13 @@ void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode)
|
||||
|
||||
|
||||
/* Return true if the last packet was an error */
|
||||
BOOL cli_is_error(struct cli_state *cli)
|
||||
BOOL cli_is_error(struct cli_tree *tree)
|
||||
{
|
||||
return NT_STATUS_IS_ERR(cli_nt_error(cli));
|
||||
return NT_STATUS_IS_ERR(cli_nt_error(tree));
|
||||
}
|
||||
|
||||
/* Return true if the last error was a DOS error */
|
||||
BOOL cli_is_dos_error(struct cli_state *cli)
|
||||
BOOL cli_is_dos_error(struct cli_tree *tree)
|
||||
{
|
||||
return cli->transport->error.etype == ETYPE_DOS;
|
||||
return tree->session->transport->error.etype == ETYPE_DOS;
|
||||
}
|
||||
|
@ -118,20 +118,20 @@ static void qfileinfo_aliases(struct cli_state *cli)
|
||||
t2.in.params = data_blob(NULL, 4);
|
||||
t2.in.data = data_blob(NULL, 0);
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
fnum = create_complex_file(cli, cli->mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
|
||||
}
|
||||
|
||||
cli_write(cli, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
|
||||
SSVAL(t2.in.params.data, 0, fnum);
|
||||
|
||||
gen_aliases(cli, &t2, 2);
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
}
|
||||
|
||||
|
||||
@ -158,14 +158,14 @@ static void qpathinfo_aliases(struct cli_state *cli)
|
||||
t2.in.params = data_blob_talloc(mem_ctx, NULL, 6);
|
||||
t2.in.data = data_blob(NULL, 0);
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
fnum = create_complex_file(cli, cli->mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
|
||||
}
|
||||
|
||||
cli_write(cli, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
cli_close(cli, fnum);
|
||||
cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
SIVAL(t2.in.params.data, 2, 0);
|
||||
|
||||
@ -174,7 +174,7 @@ static void qpathinfo_aliases(struct cli_state *cli)
|
||||
|
||||
gen_aliases(cli, &t2, 0);
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
talloc_destroy(mem_ctx);
|
||||
}
|
||||
|
||||
@ -202,14 +202,14 @@ static void findfirst_aliases(struct cli_state *cli)
|
||||
t2.in.params = data_blob_talloc(mem_ctx, NULL, 12);
|
||||
t2.in.data = data_blob(NULL, 0);
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
fnum = create_complex_file(cli, cli->mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
|
||||
}
|
||||
|
||||
cli_write(cli, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
cli_close(cli, fnum);
|
||||
cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
SSVAL(t2.in.params.data, 0, 0);
|
||||
SSVAL(t2.in.params.data, 2, 1);
|
||||
@ -222,7 +222,7 @@ static void findfirst_aliases(struct cli_state *cli)
|
||||
|
||||
gen_aliases(cli, &t2, 6);
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
talloc_destroy(mem_ctx);
|
||||
}
|
||||
|
||||
@ -314,21 +314,21 @@ static void setfileinfo_aliases(struct cli_state *cli)
|
||||
t2.in.params = data_blob(NULL, 6);
|
||||
t2.in.data = data_blob(NULL, 0);
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
fnum = create_complex_file(cli, cli->mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
|
||||
}
|
||||
|
||||
cli_write(cli, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
|
||||
SSVAL(t2.in.params.data, 0, fnum);
|
||||
SSVAL(t2.in.params.data, 4, 0);
|
||||
|
||||
gen_set_aliases(cli, &t2, 2);
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
}
|
||||
|
||||
/* look for setpathinfo aliases */
|
||||
@ -354,15 +354,15 @@ static void setpathinfo_aliases(struct cli_state *cli)
|
||||
t2.in.params = data_blob_talloc(mem_ctx, NULL, 4);
|
||||
t2.in.data = data_blob(NULL, 0);
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
fnum = create_complex_file(cli, cli->mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
|
||||
}
|
||||
|
||||
cli_write(cli, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
cli_close(cli, fnum);
|
||||
cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
SSVAL(t2.in.params.data, 2, 0);
|
||||
|
||||
@ -371,8 +371,8 @@ static void setpathinfo_aliases(struct cli_state *cli)
|
||||
|
||||
gen_set_aliases(cli, &t2, 0);
|
||||
|
||||
if (!cli_unlink(cli, fname)) {
|
||||
printf("unlink: %s\n", cli_errstr(cli));
|
||||
if (!cli_unlink(cli->tree, fname)) {
|
||||
printf("unlink: %s\n", cli_errstr(cli->tree));
|
||||
}
|
||||
talloc_destroy(mem_ctx);
|
||||
}
|
||||
|
@ -1420,10 +1420,10 @@ BOOL torture_denytest1(int dummy)
|
||||
printf("Testing deny modes with 1 connection\n");
|
||||
|
||||
for (i=0;i<2;i++) {
|
||||
cli_unlink(cli1, fnames[i]);
|
||||
fnum1 = cli_open(cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
|
||||
cli_write(cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
|
||||
cli_close(cli1, fnum1);
|
||||
cli_unlink(cli1->tree, fnames[i]);
|
||||
fnum1 = cli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
|
||||
cli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
|
||||
cli_close(cli1->tree, fnum1);
|
||||
}
|
||||
|
||||
printf("testing %d entries\n", ARRAY_SIZE(denytable1));
|
||||
@ -1434,10 +1434,10 @@ BOOL torture_denytest1(int dummy)
|
||||
|
||||
progress_bar(i, ARRAY_SIZE(denytable1));
|
||||
|
||||
fnum1 = cli_open(cli1, fname,
|
||||
fnum1 = cli_open(cli1->tree, fname,
|
||||
denytable1[i].mode1,
|
||||
denytable1[i].deny1);
|
||||
fnum2 = cli_open(cli1, fname,
|
||||
fnum2 = cli_open(cli1->tree, fname,
|
||||
denytable1[i].mode2,
|
||||
denytable1[i].deny2);
|
||||
|
||||
@ -1448,10 +1448,10 @@ BOOL torture_denytest1(int dummy)
|
||||
} else {
|
||||
char x = 1;
|
||||
res = A_0;
|
||||
if (cli_read(cli1, fnum2, (void *)&x, 0, 1) == 1) {
|
||||
if (cli_read(cli1->tree, fnum2, (void *)&x, 0, 1) == 1) {
|
||||
res += A_R;
|
||||
}
|
||||
if (cli_write(cli1, fnum2, 0, (void *)&x, 0, 1) == 1) {
|
||||
if (cli_write(cli1->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
|
||||
res += A_W;
|
||||
}
|
||||
}
|
||||
@ -1471,12 +1471,12 @@ BOOL torture_denytest1(int dummy)
|
||||
resultstr(denytable1[i].result));
|
||||
}
|
||||
|
||||
cli_close(cli1, fnum1);
|
||||
cli_close(cli1, fnum2);
|
||||
cli_close(cli1->tree, fnum1);
|
||||
cli_close(cli1->tree, fnum2);
|
||||
}
|
||||
|
||||
for (i=0;i<2;i++) {
|
||||
cli_unlink(cli1, fnames[i]);
|
||||
cli_unlink(cli1->tree, fnames[i]);
|
||||
}
|
||||
|
||||
if (!torture_close_connection(cli1)) {
|
||||
@ -1508,10 +1508,10 @@ BOOL torture_denytest2(int dummy)
|
||||
printf("Testing deny modes with 2 connections\n");
|
||||
|
||||
for (i=0;i<2;i++) {
|
||||
cli_unlink(cli1, fnames[i]);
|
||||
fnum1 = cli_open(cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
|
||||
cli_write(cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
|
||||
cli_close(cli1, fnum1);
|
||||
cli_unlink(cli1->tree, fnames[i]);
|
||||
fnum1 = cli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
|
||||
cli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
|
||||
cli_close(cli1->tree, fnum1);
|
||||
}
|
||||
|
||||
for (i=0; i<ARRAY_SIZE(denytable2); i++) {
|
||||
@ -1520,10 +1520,10 @@ BOOL torture_denytest2(int dummy)
|
||||
|
||||
progress_bar(i, ARRAY_SIZE(denytable1));
|
||||
|
||||
fnum1 = cli_open(cli1, fname,
|
||||
fnum1 = cli_open(cli1->tree, fname,
|
||||
denytable2[i].mode1,
|
||||
denytable2[i].deny1);
|
||||
fnum2 = cli_open(cli2, fname,
|
||||
fnum2 = cli_open(cli2->tree, fname,
|
||||
denytable2[i].mode2,
|
||||
denytable2[i].deny2);
|
||||
|
||||
@ -1534,10 +1534,10 @@ BOOL torture_denytest2(int dummy)
|
||||
} else {
|
||||
char x = 1;
|
||||
res = A_0;
|
||||
if (cli_read(cli2, fnum2, (void *)&x, 0, 1) == 1) {
|
||||
if (cli_read(cli2->tree, fnum2, (void *)&x, 0, 1) == 1) {
|
||||
res += A_R;
|
||||
}
|
||||
if (cli_write(cli2, fnum2, 0, (void *)&x, 0, 1) == 1) {
|
||||
if (cli_write(cli2->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
|
||||
res += A_W;
|
||||
}
|
||||
}
|
||||
@ -1557,12 +1557,12 @@ BOOL torture_denytest2(int dummy)
|
||||
resultstr(denytable2[i].result));
|
||||
}
|
||||
|
||||
cli_close(cli1, fnum1);
|
||||
cli_close(cli2, fnum2);
|
||||
cli_close(cli1->tree, fnum1);
|
||||
cli_close(cli2->tree, fnum2);
|
||||
}
|
||||
|
||||
for (i=0;i<2;i++) {
|
||||
cli_unlink(cli1, fnames[i]);
|
||||
cli_unlink(cli1->tree, fnames[i]);
|
||||
}
|
||||
|
||||
if (!torture_close_connection(cli1)) {
|
||||
|
@ -127,7 +127,7 @@ static BOOL connect_servers_fast(void)
|
||||
for (h=0;h<options.max_open_handles;h++) {
|
||||
if (!open_handles[h].active) continue;
|
||||
for (i=0;i<NSERVERS;i++) {
|
||||
if (!cli_close(servers[i].cli[open_handles[h].instance],
|
||||
if (!cli_close(servers[i].cli[open_handles[h].instance]->tree,
|
||||
open_handles[h].server_fnum[i])) {
|
||||
return False;
|
||||
}
|
||||
@ -234,10 +234,10 @@ static void gen_add_handle(int instance, const char *name, uint16 fnums[NSERVERS
|
||||
/* we have to force close a random handle */
|
||||
h = random() % options.max_open_handles;
|
||||
for (i=0;i<NSERVERS;i++) {
|
||||
if (!cli_close(servers[i].cli[open_handles[h].instance],
|
||||
if (!cli_close(servers[i].cli[open_handles[h].instance]->tree,
|
||||
open_handles[h].server_fnum[i])) {
|
||||
printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n",
|
||||
cli_errstr(servers[i].cli[open_handles[h].instance]));
|
||||
cli_errstr(servers[i].cli[open_handles[h].instance]->tree));
|
||||
}
|
||||
}
|
||||
printf("Recovered handle %d\n", h);
|
||||
@ -1806,14 +1806,14 @@ static void wipe_files(void)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<NSERVERS;i++) {
|
||||
int n = cli_deltree(servers[i].cli[0], "\\gentest");
|
||||
int n = cli_deltree(servers[i].cli[0]->tree, "\\gentest");
|
||||
if (n == -1) {
|
||||
printf("Failed to wipe tree on server %d\n", i);
|
||||
exit(1);
|
||||
}
|
||||
if (!cli_mkdir(servers[i].cli[0], "\\gentest")) {
|
||||
if (!cli_mkdir(servers[i].cli[0]->tree, "\\gentest")) {
|
||||
printf("Failed to create \\gentest - %s\n",
|
||||
cli_errstr(servers[i].cli[0]));
|
||||
cli_errstr(servers[i].cli[0]->tree));
|
||||
exit(1);
|
||||
}
|
||||
if (n > 0) {
|
||||
|
@ -144,7 +144,7 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS
|
||||
if (cli[server][conn]) {
|
||||
for (f=0;f<NFILES;f++) {
|
||||
if (fnum[server][conn][f] != -1) {
|
||||
cli_close(cli[server][conn], fnum[server][conn][f]);
|
||||
cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
|
||||
fnum[server][conn][f] = -1;
|
||||
}
|
||||
}
|
||||
@ -177,10 +177,10 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
|
||||
case OP_LOCK:
|
||||
/* set a lock */
|
||||
for (server=0;server<NSERVERS;server++) {
|
||||
ret[server] = cli_lock64(cli[server][conn],
|
||||
ret[server] = cli_lock64(cli[server][conn]->tree,
|
||||
fnum[server][conn][f],
|
||||
start, len, LOCK_TIMEOUT, op);
|
||||
status[server] = cli_nt_error(cli[server][conn]);
|
||||
status[server] = cli_nt_error(cli[server][conn]->tree);
|
||||
if (!exact_error_codes &&
|
||||
NT_STATUS_EQUAL(status[server],
|
||||
NT_STATUS_FILE_LOCK_CONFLICT)) {
|
||||
@ -200,10 +200,10 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
|
||||
case OP_UNLOCK:
|
||||
/* unset a lock */
|
||||
for (server=0;server<NSERVERS;server++) {
|
||||
ret[server] = cli_unlock64(cli[server][conn],
|
||||
ret[server] = cli_unlock64(cli[server][conn]->tree,
|
||||
fnum[server][conn][f],
|
||||
start, len);
|
||||
status[server] = cli_nt_error(cli[server][conn]);
|
||||
status[server] = cli_nt_error(cli[server][conn]->tree);
|
||||
}
|
||||
if (showall ||
|
||||
(!hide_unlock_fails && !NT_STATUS_EQUAL(status[0],status[1]))) {
|
||||
@ -219,11 +219,11 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
|
||||
case OP_REOPEN:
|
||||
/* reopen the file */
|
||||
for (server=0;server<NSERVERS;server++) {
|
||||
cli_close(cli[server][conn], fnum[server][conn][f]);
|
||||
cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
|
||||
fnum[server][conn][f] = -1;
|
||||
}
|
||||
for (server=0;server<NSERVERS;server++) {
|
||||
fnum[server][conn][f] = cli_open(cli[server][conn], FILENAME,
|
||||
fnum[server][conn][f] = cli_open(cli[server][conn]->tree, FILENAME,
|
||||
O_RDWR|O_CREAT,
|
||||
DENY_NONE);
|
||||
if (fnum[server][conn][f] == -1) {
|
||||
@ -250,12 +250,12 @@ static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
|
||||
for (conn=0;conn<NCONNECTIONS;conn++)
|
||||
for (f=0;f<NFILES;f++) {
|
||||
if (fnum[server][conn][f] != -1) {
|
||||
cli_close(cli[server][conn], fnum[server][conn][f]);
|
||||
cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
|
||||
fnum[server][conn][f] = -1;
|
||||
}
|
||||
}
|
||||
for (server=0;server<NSERVERS;server++) {
|
||||
cli_unlink(cli[server][0], FILENAME);
|
||||
cli_unlink(cli[server][0]->tree, FILENAME);
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
|
||||
for (server=0;server<NSERVERS;server++)
|
||||
for (conn=0;conn<NCONNECTIONS;conn++)
|
||||
for (f=0;f<NFILES;f++) {
|
||||
fnum[server][conn][f] = cli_open(cli[server][conn], FILENAME,
|
||||
fnum[server][conn][f] = cli_open(cli[server][conn]->tree, FILENAME,
|
||||
O_RDWR|O_CREAT,
|
||||
DENY_NONE);
|
||||
if (fnum[server][conn][f] == -1) {
|
||||
|
@ -36,48 +36,48 @@ static BOOL test_one(struct cli_state *cli, const char *name)
|
||||
|
||||
total++;
|
||||
|
||||
fnum = cli_open(cli, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("open of %s failed (%s)\n", name, cli_errstr(cli));
|
||||
printf("open of %s failed (%s)\n", name, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!cli_close(cli, fnum)) {
|
||||
printf("close of %s failed (%s)\n", name, cli_errstr(cli));
|
||||
if (!cli_close(cli->tree, fnum)) {
|
||||
printf("close of %s failed (%s)\n", name, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* get the short name */
|
||||
status = cli_qpathinfo_alt_name(cli, name, &shortname);
|
||||
status = cli_qpathinfo_alt_name(cli->tree, name, &shortname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("query altname of %s failed (%s)\n", name, cli_errstr(cli));
|
||||
printf("query altname of %s failed (%s)\n", name, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
snprintf(name2, sizeof(name2), "\\mangle_test\\%s", shortname);
|
||||
if (!cli_unlink(cli, name2)) {
|
||||
if (!cli_unlink(cli->tree, name2)) {
|
||||
printf("unlink of %s (%s) failed (%s)\n",
|
||||
name2, name, cli_errstr(cli));
|
||||
name2, name, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* recreate by short name */
|
||||
fnum = cli_open(cli, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("open2 of %s failed (%s)\n", name2, cli_errstr(cli));
|
||||
printf("open2 of %s failed (%s)\n", name2, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
if (!cli_close(cli, fnum)) {
|
||||
printf("close of %s failed (%s)\n", name, cli_errstr(cli));
|
||||
if (!cli_close(cli->tree, fnum)) {
|
||||
printf("close of %s failed (%s)\n", name, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* and unlink by long name */
|
||||
if (!cli_unlink(cli, name)) {
|
||||
if (!cli_unlink(cli->tree, name)) {
|
||||
printf("unlink2 of %s (%s) failed (%s)\n",
|
||||
name, name2, cli_errstr(cli));
|
||||
name, name2, cli_errstr(cli->tree));
|
||||
failures++;
|
||||
cli_unlink(cli, name2);
|
||||
cli_unlink(cli->tree, name2);
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -167,10 +167,10 @@ BOOL torture_mangle(int dummy)
|
||||
return False;
|
||||
}
|
||||
|
||||
cli_unlink(cli, "\\mangle_test\\*");
|
||||
cli_rmdir(cli, "\\mangle_test");
|
||||
cli_unlink(cli->tree, "\\mangle_test\\*");
|
||||
cli_rmdir(cli->tree, "\\mangle_test");
|
||||
|
||||
if (!cli_mkdir(cli, "\\mangle_test")) {
|
||||
if (!cli_mkdir(cli->tree, "\\mangle_test")) {
|
||||
printf("ERROR: Failed to make directory\n");
|
||||
return False;
|
||||
}
|
||||
@ -189,8 +189,8 @@ BOOL torture_mangle(int dummy)
|
||||
}
|
||||
}
|
||||
|
||||
cli_unlink(cli, "\\mangle_test\\*");
|
||||
if (!cli_rmdir(cli, "\\mangle_test")) {
|
||||
cli_unlink(cli->tree, "\\mangle_test\\*");
|
||||
if (!cli_rmdir(cli->tree, "\\mangle_test")) {
|
||||
printf("ERROR: Failed to remove directory\n");
|
||||
return False;
|
||||
}
|
||||
|
@ -216,7 +216,8 @@ static void get_real_name(struct cli_state *cli,
|
||||
|
||||
f_info_hit = False;
|
||||
|
||||
cli_list_new(cli, mask, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
|
||||
cli_list_new(cli->tree, mask,
|
||||
FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
|
||||
listfn, NULL);
|
||||
|
||||
if (f_info_hit) {
|
||||
@ -244,18 +245,19 @@ static void testpair(struct cli_state *cli, char *mask, char *file)
|
||||
|
||||
fstrcpy(res1, "---");
|
||||
|
||||
fnum = cli_open(cli, file, O_CREAT|O_TRUNC|O_RDWR, 0);
|
||||
fnum = cli_open(cli->tree, file, O_CREAT|O_TRUNC|O_RDWR, 0);
|
||||
if (fnum == -1) {
|
||||
DEBUG(0,("Can't create %s\n", file));
|
||||
return;
|
||||
}
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
resultp = res1;
|
||||
fstrcpy(short_name, "");
|
||||
get_real_name(cli, long_name, short_name);
|
||||
fstrcpy(res1, "---");
|
||||
cli_list(cli, mask, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
|
||||
cli_list(cli->tree, mask,
|
||||
FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
|
||||
listfn, NULL);
|
||||
|
||||
res2 = reg_test(cli, mask, long_name, short_name);
|
||||
@ -266,7 +268,7 @@ static void testpair(struct cli_state *cli, char *mask, char *file)
|
||||
if (die_on_error) exit(1);
|
||||
}
|
||||
|
||||
cli_unlink(cli, file);
|
||||
cli_unlink(cli->tree, file);
|
||||
|
||||
if (count % 100 == 0) DEBUG(0,("%d\n", count));
|
||||
}
|
||||
@ -279,9 +281,9 @@ static void test_mask(int argc, char *argv[],
|
||||
int mc_len = strlen(maskchars);
|
||||
int fc_len = strlen(filechars);
|
||||
|
||||
cli_mkdir(cli, "\\masktest");
|
||||
cli_mkdir(cli->tree, "\\masktest");
|
||||
|
||||
cli_unlink(cli, "\\masktest\\*");
|
||||
cli_unlink(cli->tree, "\\masktest\\*");
|
||||
|
||||
if (argc >= 2) {
|
||||
while (argc >= 2) {
|
||||
@ -324,7 +326,7 @@ static void test_mask(int argc, char *argv[],
|
||||
}
|
||||
|
||||
finished:
|
||||
cli_rmdir(cli, "\\masktest");
|
||||
cli_rmdir(cli->tree, "\\masktest");
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,7 +118,7 @@ void nb_setup(struct cli_state *cli)
|
||||
|
||||
void nb_unlink(const char *fname)
|
||||
{
|
||||
if (!cli_unlink(c, fname)) {
|
||||
if (!cli_unlink(c->tree, fname)) {
|
||||
#if NBDEBUG
|
||||
printf("(%d) unlink %s failed (%s)\n",
|
||||
line_count, fname, cli_errstr(c));
|
||||
@ -139,7 +139,7 @@ void nb_createx(const char *fname,
|
||||
desired_access = SA_RIGHT_FILE_READ_DATA | SA_RIGHT_FILE_WRITE_DATA;
|
||||
}
|
||||
|
||||
fd = cli_nt_create_full(c, fname, 0,
|
||||
fd = cli_nt_create_full(c->tree, fname, 0,
|
||||
desired_access,
|
||||
0x0,
|
||||
NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE,
|
||||
@ -147,7 +147,7 @@ void nb_createx(const char *fname,
|
||||
create_options, 0);
|
||||
if (fd == -1 && handle != -1) {
|
||||
printf("ERROR: cli_nt_create_full failed for %s - %s\n",
|
||||
fname, cli_errstr(c));
|
||||
fname, cli_errstr(c->tree));
|
||||
exit(1);
|
||||
}
|
||||
if (fd != -1 && handle == -1) {
|
||||
@ -175,7 +175,7 @@ void nb_writex(int handle, int offset, int size, int ret_size)
|
||||
if (buf[0] == 0) memset(buf, 1, sizeof(buf));
|
||||
|
||||
i = find_handle(handle);
|
||||
if (!bypass_io && cli_write(c, ftable[i].fd, 0, buf, offset, size) != ret_size) {
|
||||
if (!bypass_io && cli_write(c->tree, ftable[i].fd, 0, buf, offset, size) != ret_size) {
|
||||
printf("(%d) ERROR: write failed on handle %d, fd %d \
|
||||
errno %d (%s)\n", line_count, handle, ftable[i].fd, errno, strerror(errno));
|
||||
exit(1);
|
||||
@ -189,7 +189,7 @@ void nb_readx(int handle, int offset, int size, int ret_size)
|
||||
int i, ret;
|
||||
|
||||
i = find_handle(handle);
|
||||
if (!bypass_io && (ret=cli_read(c, ftable[i].fd, buf, offset, size)) != ret_size) {
|
||||
if (!bypass_io && (ret=cli_read(c->tree, ftable[i].fd, buf, offset, size)) != ret_size) {
|
||||
printf("(%d) ERROR: read failed on handle %d ofs=%d size=%d res=%d fd %d errno %d (%s)\n",
|
||||
line_count, handle, offset, size, ret, ftable[i].fd, errno, strerror(errno));
|
||||
exit(1);
|
||||
@ -201,7 +201,7 @@ void nb_close(int handle)
|
||||
{
|
||||
int i;
|
||||
i = find_handle(handle);
|
||||
if (!cli_close(c, ftable[i].fd)) {
|
||||
if (!cli_close(c->tree, ftable[i].fd)) {
|
||||
printf("(%d) close failed on handle %d\n", line_count, handle);
|
||||
exit(1);
|
||||
}
|
||||
@ -210,18 +210,18 @@ void nb_close(int handle)
|
||||
|
||||
void nb_rmdir(const char *fname)
|
||||
{
|
||||
if (!cli_rmdir(c, fname)) {
|
||||
if (!cli_rmdir(c->tree, fname)) {
|
||||
printf("ERROR: rmdir %s failed (%s)\n",
|
||||
fname, cli_errstr(c));
|
||||
fname, cli_errstr(c->tree));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void nb_rename(const char *old, const char *new)
|
||||
{
|
||||
if (!cli_rename(c, old, new)) {
|
||||
if (!cli_rename(c->tree, old, new)) {
|
||||
printf("ERROR: rename %s %s failed (%s)\n",
|
||||
old, new, cli_errstr(c));
|
||||
old, new, cli_errstr(c->tree));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -229,21 +229,21 @@ void nb_rename(const char *old, const char *new)
|
||||
|
||||
void nb_qpathinfo(const char *fname)
|
||||
{
|
||||
cli_qpathinfo(c, fname, NULL, NULL, NULL, NULL, NULL);
|
||||
cli_qpathinfo(c->tree, fname, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void nb_qfileinfo(int fnum)
|
||||
{
|
||||
int i;
|
||||
i = find_handle(fnum);
|
||||
cli_qfileinfo(c, ftable[i].fd, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
cli_qfileinfo(c->tree, ftable[i].fd, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void nb_qfsinfo(int level)
|
||||
{
|
||||
int bsize, total, avail;
|
||||
/* this is not the right call - we need cli_qfsinfo() */
|
||||
cli_dskattr(c, &bsize, &total, &avail);
|
||||
cli_dskattr(c->tree, &bsize, &total, &avail);
|
||||
}
|
||||
|
||||
static void find_fn(file_info *finfo, const char *name, void *state)
|
||||
@ -253,7 +253,7 @@ static void find_fn(file_info *finfo, const char *name, void *state)
|
||||
|
||||
void nb_findfirst(const char *mask)
|
||||
{
|
||||
cli_list(c, mask, 0, find_fn, NULL);
|
||||
cli_list(c->tree, mask, 0, find_fn, NULL);
|
||||
}
|
||||
|
||||
void nb_flush(int fnum)
|
||||
@ -269,7 +269,7 @@ void nb_deltree(const char *dname)
|
||||
{
|
||||
int total_deleted;
|
||||
|
||||
total_deleted = cli_deltree(c, dname);
|
||||
total_deleted = cli_deltree(c->tree, dname);
|
||||
|
||||
if (total_deleted == -1) {
|
||||
printf("Failed to cleanup tree %s - exiting\n", dname);
|
||||
@ -282,6 +282,6 @@ void nb_deltree(const char *dname)
|
||||
|
||||
void nb_cleanup(void)
|
||||
{
|
||||
cli_rmdir(c, "clients");
|
||||
cli_rmdir(c->tree, "clients");
|
||||
children[nbio_id].done = 1;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\test.txt");
|
||||
if (fnum == -1) {
|
||||
printf("failed to open test.txt - %s\n", cli_errstr(cli));
|
||||
printf("failed to open test.txt - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -101,7 +101,7 @@ static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -120,12 +120,12 @@ BOOL torture_raw_chkpath(int dummy)
|
||||
|
||||
mem_ctx = talloc_init("torture_raw_chkpath");
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1) {
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1) {
|
||||
printf("Failed to clean " BASEDIR "\n");
|
||||
return False;
|
||||
}
|
||||
if (!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli));
|
||||
if (!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ BOOL torture_raw_chkpath(int dummy)
|
||||
}
|
||||
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
|
||||
torture_close_connection(cli);
|
||||
talloc_destroy(mem_ctx);
|
||||
|
@ -100,7 +100,7 @@ BOOL torture_raw_close(int dummy)
|
||||
}
|
||||
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
REOPEN;
|
||||
|
||||
finfo2.generic.in.fname = fname;
|
||||
@ -137,7 +137,7 @@ BOOL torture_raw_close(int dummy)
|
||||
CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
|
||||
|
||||
printf("testing flush\n");
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
io_flush.in.fnum = fnum;
|
||||
status = smb_raw_flush(cli->tree, &io_flush);
|
||||
@ -162,8 +162,8 @@ BOOL torture_raw_close(int dummy)
|
||||
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
torture_close_connection(cli);
|
||||
talloc_destroy(mem_ctx);
|
||||
return ret;
|
||||
|
@ -59,9 +59,9 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("TESTING SESSION HANDLING\n");
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -167,9 +167,9 @@ static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("TESTING TREE HANDLING\n");
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -269,9 +269,9 @@ static BOOL test_pid(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("TESTING PID HANDLING\n");
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ BOOL torture_raw_context(int dummy)
|
||||
}
|
||||
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
|
||||
torture_close_connection(cli);
|
||||
talloc_destroy(mem_ctx);
|
||||
|
@ -45,7 +45,7 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create test.dat - %s\n", cli_errstr(cli));
|
||||
printf("Failed to create test.dat - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -64,7 +64,7 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create test.dat - %s\n", cli_errstr(cli));
|
||||
printf("Failed to create test.dat - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -114,7 +114,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
#endif
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -133,12 +133,12 @@ BOOL torture_raw_ioctl(int dummy)
|
||||
|
||||
mem_ctx = talloc_init("torture_raw_ioctl");
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1) {
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1) {
|
||||
printf("Failed to clean " BASEDIR "\n");
|
||||
return False;
|
||||
}
|
||||
if (!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli));
|
||||
if (!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ BOOL torture_raw_ioctl(int dummy)
|
||||
}
|
||||
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
|
||||
torture_close_connection(cli);
|
||||
talloc_destroy(mem_ctx);
|
||||
|
@ -50,18 +50,18 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
int fnum;
|
||||
const char *fname = BASEDIR "\\test.txt";
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_LOCK_LOCK\n");
|
||||
io.generic.level = RAW_LOCK_LOCK;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -133,9 +133,9 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -152,18 +152,18 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
int fnum;
|
||||
const char *fname = BASEDIR "\\test.txt";
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_LOCK_LOCKX\n");
|
||||
io.generic.level = RAW_LOCK_LOCKX;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -182,9 +182,9 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -202,9 +202,9 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
const char *fname = BASEDIR "\\test.txt";
|
||||
char c = 1;
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -213,15 +213,15 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
cli->session->pid = 1;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (cli_write(cli, fnum, 0, &c, 0, 1) != 1) {
|
||||
printf("Failed to write 1 byte - %s\n", cli_errstr(cli));
|
||||
if (cli_write(cli->tree, fnum, 0, &c, 0, 1) != 1) {
|
||||
printf("Failed to write 1 byte - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -239,8 +239,8 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_lock(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
if (cli_read(cli, fnum, &c, 0, 1) != 1) {
|
||||
printf("Failed to read 1 byte - %s\n", cli_errstr(cli));
|
||||
if (cli_read(cli->tree, fnum, &c, 0, 1) != 1) {
|
||||
printf("Failed to read 1 byte - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -249,7 +249,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
cli->session->pid = 2;
|
||||
|
||||
if (cli_read(cli, fnum, &c, 0, 1) == 1) {
|
||||
if (cli_read(cli->tree, fnum, &c, 0, 1) == 1) {
|
||||
printf("pid is incorrect handled for read with lock!\n");
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -257,7 +257,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
cli->session->pid = 0x10001;
|
||||
|
||||
if (cli_read(cli, fnum, &c, 0, 1) != 1) {
|
||||
if (cli_read(cli->tree, fnum, &c, 0, 1) != 1) {
|
||||
printf("High pid is used on this server!\n");
|
||||
ret = False;
|
||||
} else {
|
||||
@ -265,9 +265,9 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
}
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
BOOL ret = True;
|
||||
|
||||
/* cleanup */
|
||||
cli_rmdir(cli, path);
|
||||
cli_unlink(cli, path);
|
||||
cli_rmdir(cli->tree, path);
|
||||
cli_unlink(cli->tree, path);
|
||||
|
||||
/*
|
||||
basic mkdir
|
||||
@ -69,7 +69,7 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
printf("testing mkdir collision with file\n");
|
||||
|
||||
/* name collision with a file */
|
||||
cli_close(cli, create_complex_file(cli, mem_ctx, path));
|
||||
cli_close(cli->tree, create_complex_file(cli, mem_ctx, path));
|
||||
status = smb_raw_mkdir(cli->tree, &md);
|
||||
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
|
||||
|
||||
@ -79,7 +79,7 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_rmdir(cli->tree, &rd);
|
||||
CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY);
|
||||
|
||||
cli_unlink(cli, path);
|
||||
cli_unlink(cli->tree, path);
|
||||
|
||||
printf("testing invalid dir\n");
|
||||
|
||||
@ -110,8 +110,8 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
|
||||
done:
|
||||
cli_rmdir(cli, path);
|
||||
cli_unlink(cli, path);
|
||||
cli_rmdir(cli->tree, path);
|
||||
cli_unlink(cli->tree, path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -74,13 +74,13 @@ static BOOL test_mux_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
req = smb_raw_open_send(cli->tree, &io);
|
||||
|
||||
/* and close the file */
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
/* see if the async open succeeded */
|
||||
status = smb_raw_open_recv(req, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
cli_close(cli, io.ntcreatex.out.fnum);
|
||||
cli_close(cli->tree, io.ntcreatex.out.fnum);
|
||||
|
||||
done:
|
||||
return ret;
|
||||
@ -100,9 +100,9 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("testing multiplexed lock/write/close\n");
|
||||
|
||||
fnum = cli_open(cli, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("open failed in mux_write - %s\n", cli_errstr(cli));
|
||||
printf("open failed in mux_write - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -110,8 +110,8 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
cli->session->pid = 1;
|
||||
|
||||
/* lock a range */
|
||||
if (!cli_lock(cli, fnum, 0, 4, 0, WRITE_LOCK)) {
|
||||
printf("lock failed in mux_write - %s\n", cli_errstr(cli));
|
||||
if (!cli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK)) {
|
||||
printf("lock failed in mux_write - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -130,13 +130,13 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
/* unlock the range */
|
||||
cli->session->pid = 1;
|
||||
cli_unlock(cli, fnum, 0, 4);
|
||||
cli_unlock(cli->tree, fnum, 0, 4);
|
||||
|
||||
/* and recv the async write reply */
|
||||
status = smb_raw_write_recv(req, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
done:
|
||||
return ret;
|
||||
@ -157,9 +157,9 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("TESTING MULTIPLEXED LOCK/LOCK/UNLOCK\n");
|
||||
|
||||
fnum = cli_open(cli, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("open failed in mux_write - %s\n", cli_errstr(cli));
|
||||
printf("open failed in mux_write - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -202,7 +202,7 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("reopening with an exit\n");
|
||||
smb_raw_exit(cli->session);
|
||||
fnum = cli_open(cli, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
|
||||
|
||||
printf("Now trying with a cancel\n");
|
||||
|
||||
@ -240,7 +240,7 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = cli_request_simple_recv(req);
|
||||
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
done:
|
||||
return ret;
|
||||
@ -264,14 +264,14 @@ BOOL torture_raw_mux(int dummy)
|
||||
mem_ctx = talloc_init("torture_raw_mux");
|
||||
|
||||
/* cleanup */
|
||||
if (cli_deltree(cli, BASEDIR) == -1) {
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1) {
|
||||
printf("Failed to cleanup " BASEDIR "\n");
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
if (!cli_mkdir(cli, BASEDIR)) {
|
||||
if (!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Failed to create %s\n", BASEDIR);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -291,7 +291,7 @@ BOOL torture_raw_mux(int dummy)
|
||||
|
||||
done:
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
torture_close_connection(cli);
|
||||
talloc_destroy(mem_ctx);
|
||||
return ret;
|
||||
|
@ -68,7 +68,7 @@ BOOL torture_raw_notify(int dummy)
|
||||
mem_ctx = talloc_init("torture_raw_notify");
|
||||
|
||||
/* cleanup */
|
||||
if (cli_deltree(cli, BASEDIR) == -1) {
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1) {
|
||||
printf("Failed to cleanup " BASEDIR "\n");
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -103,7 +103,7 @@ BOOL torture_raw_notify(int dummy)
|
||||
printf("testing notify mkdir\n");
|
||||
|
||||
req = smb_raw_changenotify_send(cli->tree, ¬ify);
|
||||
cli_mkdir(cli, BASEDIR "\\subdir-name");
|
||||
cli_mkdir(cli->tree, BASEDIR "\\subdir-name");
|
||||
|
||||
status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
@ -115,7 +115,7 @@ BOOL torture_raw_notify(int dummy)
|
||||
printf("testing notify rmdir\n");
|
||||
|
||||
req = smb_raw_changenotify_send(cli->tree, ¬ify);
|
||||
cli_rmdir(cli, BASEDIR "\\subdir-name");
|
||||
cli_rmdir(cli->tree, BASEDIR "\\subdir-name");
|
||||
|
||||
status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
@ -127,13 +127,13 @@ BOOL torture_raw_notify(int dummy)
|
||||
|
||||
req = smb_raw_changenotify_send(cli->tree, ¬ify);
|
||||
smb_raw_ntcancel(req);
|
||||
cli_mkdir(cli, BASEDIR "\\subdir-name");
|
||||
cli_mkdir(cli->tree, BASEDIR "\\subdir-name");
|
||||
status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
|
||||
CHECK_STATUS(status, NT_STATUS_CANCELLED);
|
||||
|
||||
done:
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
torture_close_connection(cli);
|
||||
talloc_destroy(mem_ctx);
|
||||
return ret;
|
||||
|
@ -28,11 +28,11 @@ enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR};
|
||||
/*
|
||||
check if a open file can be read/written
|
||||
*/
|
||||
static enum rdwr_mode check_rdwr(struct cli_state *cli, int fnum)
|
||||
static enum rdwr_mode check_rdwr(struct cli_tree *tree, int fnum)
|
||||
{
|
||||
char c = 1;
|
||||
BOOL can_read = (cli_read(cli, fnum, &c, 0, 1) == 1);
|
||||
BOOL can_write = (cli_write(cli, fnum, 0, &c, 0, 1) == 1);
|
||||
BOOL can_read = (cli_read(tree, fnum, &c, 0, 1) == 1);
|
||||
BOOL can_write = (cli_write(tree, fnum, 0, &c, 0, 1) == 1);
|
||||
if ( can_read && can_write) return RDWR_RDWR;
|
||||
if ( can_read && !can_write) return RDWR_RDONLY;
|
||||
if (!can_read && can_write) return RDWR_WRONLY;
|
||||
@ -64,13 +64,13 @@ static const char *rdwr_string(enum rdwr_mode m)
|
||||
#define CREATE_FILE do { \
|
||||
fnum = create_complex_file(cli, mem_ctx, fname); \
|
||||
if (fnum == -1) { \
|
||||
printf("(%d) Failed to create %s - %s\n", __LINE__, fname, cli_errstr(cli)); \
|
||||
printf("(%d) Failed to create %s - %s\n", __LINE__, fname, cli_errstr(cli->tree)); \
|
||||
ret = False; \
|
||||
goto done; \
|
||||
}} while (0)
|
||||
|
||||
#define CHECK_RDWR(fnum, correct) do { \
|
||||
enum rdwr_mode m = check_rdwr(cli, fnum); \
|
||||
enum rdwr_mode m = check_rdwr(cli->tree, fnum); \
|
||||
if (m != correct) { \
|
||||
printf("(%d) Incorrect readwrite mode %s - expected %s\n", \
|
||||
__LINE__, rdwr_string(m), rdwr_string(correct)); \
|
||||
@ -163,9 +163,9 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
|
||||
fnum = io.open.out.fnum;
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
CREATE_FILE;
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
@ -176,8 +176,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
fnum2 = io.open.out.fnum;
|
||||
CHECK_RDWR(fnum2, RDWR_RDWR);
|
||||
cli_close(cli, fnum2);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum2);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
/* check the read/write modes */
|
||||
io.open.level = RAW_OPEN_OPEN;
|
||||
@ -189,21 +189,21 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
fnum = io.open.out.fnum;
|
||||
CHECK_RDWR(fnum, RDWR_RDONLY);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
io.open.in.flags = OPEN_FLAGS_OPEN_WRITE;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
fnum = io.open.out.fnum;
|
||||
CHECK_RDWR(fnum, RDWR_WRONLY);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
io.open.in.flags = OPEN_FLAGS_OPEN_RDWR;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
fnum = io.open.out.fnum;
|
||||
CHECK_RDWR(fnum, RDWR_RDWR);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
/* check the share modes roughly - not a complete matrix */
|
||||
io.open.in.flags = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_WRITE;
|
||||
@ -226,8 +226,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
fnum2 = io.open.out.fnum;
|
||||
CHECK_RDWR(fnum2, RDWR_RDONLY);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli, fnum2);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_close(cli->tree, fnum2);
|
||||
|
||||
|
||||
/* check the returned write time */
|
||||
@ -245,8 +245,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_ALL_INFO(io.open.out.attrib, attrib);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -284,7 +284,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
};
|
||||
|
||||
printf("Checking RAW_OPEN_OPENX\n");
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
io.openx.level = RAW_OPEN_OPENX;
|
||||
io.openx.in.fname = fname;
|
||||
@ -301,11 +301,11 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
if (open_funcs[i].with_file) {
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli));
|
||||
d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
}
|
||||
io.openx.in.open_func = open_funcs[i].open_func;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
@ -316,8 +316,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
ret = False;
|
||||
}
|
||||
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
|
||||
cli_close(cli, io.openx.out.fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, io.openx.out.fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,8 +336,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VAL(io.openx.out.ftype, 0);
|
||||
CHECK_VAL(io.openx.out.devstate, 0);
|
||||
CHECK_VAL(io.openx.out.action, OPENX_ACTION_CREATED);
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* check the fields when the file already existed */
|
||||
fnum2 = create_complex_file(cli, mem_ctx, fname);
|
||||
@ -345,7 +345,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
cli_close(cli, fnum2);
|
||||
cli_close(cli->tree, fnum2);
|
||||
|
||||
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
@ -357,7 +357,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VAL(io.openx.out.action, OPENX_ACTION_EXISTED);
|
||||
CHECK_VAL(io.openx.out.unknown, 0);
|
||||
CHECK_ALL_INFO(io.openx.out.attrib, attrib);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
/* now check the search attrib for hidden files - win2003 ignores this? */
|
||||
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
|
||||
@ -366,15 +366,15 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
io.openx.in.search_attrs = FILE_ATTRIBUTE_HIDDEN;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
cli_close(cli, io.openx.out.fnum);
|
||||
cli_close(cli->tree, io.openx.out.fnum);
|
||||
|
||||
io.openx.in.search_attrs = 0;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
cli_close(cli, io.openx.out.fnum);
|
||||
cli_close(cli->tree, io.openx.out.fnum);
|
||||
|
||||
SET_ATTRIB(FILE_ATTRIBUTE_NORMAL);
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* and check attrib on create */
|
||||
io.openx.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
|
||||
@ -383,8 +383,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, attrib);
|
||||
cli_close(cli, io.openx.out.fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, io.openx.out.fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* check timeout on create - win2003 ignores the timeout! */
|
||||
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
|
||||
@ -404,8 +404,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
__LINE__, (int)end_timer());
|
||||
ret = False;
|
||||
}
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* now this is a really weird one - open for execute implies create?! */
|
||||
io.openx.in.fname = fname;
|
||||
@ -419,7 +419,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
io.openx.in.timeout = 0;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
cli_close(cli, io.openx.out.fnum);
|
||||
cli_close(cli->tree, io.openx.out.fnum);
|
||||
|
||||
/* check the extended return flag */
|
||||
io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO | OPENX_FLAGS_EXTENDED_RETURN;
|
||||
@ -427,11 +427,11 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
CHECK_VAL(io.openx.out.access_mask, STD_RIGHT_ALL_ACCESS);
|
||||
cli_close(cli, io.openx.out.fnum);
|
||||
cli_close(cli->tree, io.openx.out.fnum);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -496,11 +496,11 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
if (open_funcs[i].with_file) {
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli));
|
||||
d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
}
|
||||
io.t2open.in.open_func = open_funcs[i].open_func;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
@ -511,14 +511,14 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
ret = False;
|
||||
}
|
||||
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
|
||||
cli_close(cli, io.t2open.out.fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, io.t2open.out.fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
}
|
||||
}
|
||||
|
||||
/* check the basic return fields */
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
@ -531,7 +531,7 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VAL(io.t2open.out.ftype, 0);
|
||||
CHECK_VAL(io.t2open.out.devstate, 0);
|
||||
CHECK_VAL(io.t2open.out.action, OPENX_ACTION_EXISTED);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
/* now check the search attrib for hidden files - win2003 ignores this? */
|
||||
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
|
||||
@ -539,14 +539,14 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
cli_close(cli, io.t2open.out.fnum);
|
||||
cli_close(cli->tree, io.t2open.out.fnum);
|
||||
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
cli_close(cli, io.t2open.out.fnum);
|
||||
cli_close(cli->tree, io.t2open.out.fnum);
|
||||
|
||||
SET_ATTRIB(FILE_ATTRIBUTE_NORMAL);
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* and check attrib on create */
|
||||
io.t2open.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
|
||||
@ -562,8 +562,8 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -622,13 +622,13 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
/* test the open disposition */
|
||||
for (i=0; i<ARRAY_SIZE(open_funcs); i++) {
|
||||
if (open_funcs[i].with_file) {
|
||||
fnum = cli_open(cli, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli));
|
||||
d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
}
|
||||
io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
@ -639,8 +639,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
ret = False;
|
||||
}
|
||||
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
|
||||
cli_close(cli, io.ntcreatex.out.fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, io.ntcreatex.out.fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,14 +664,14 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
|
||||
|
||||
/* check fields when the file already existed */
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
@ -689,8 +689,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_ALL_INFO(io.ntcreatex.out.size, size);
|
||||
CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
|
||||
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
|
||||
/* create a directory */
|
||||
@ -704,8 +704,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
io.ntcreatex.in.fname = dname;
|
||||
fname = dname;
|
||||
|
||||
cli_rmdir(cli, fname);
|
||||
cli_unlink(cli, fname);
|
||||
cli_rmdir(cli->tree, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
io.ntcreatex.in.access_mask = SEC_RIGHT_MAXIMUM_ALLOWED;
|
||||
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
|
||||
@ -730,12 +730,12 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VAL(io.ntcreatex.out.size, 0);
|
||||
CHECK_VAL(io.ntcreatex.out.alloc_size, 0);
|
||||
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -767,8 +767,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* make sure write_time works */
|
||||
io.mknew.in.write_time = basetime;
|
||||
@ -777,8 +777,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
fnum = io.mknew.out.fnum;
|
||||
CHECK_TIME(basetime, write_time);
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* make sure file_attrs works */
|
||||
io.mknew.in.attrib = FILE_ATTRIBUTE_HIDDEN;
|
||||
@ -788,8 +788,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -821,9 +821,9 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_open(cli->tree, mem_ctx, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
cli_close(cli, io.create.out.fnum);
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, io.create.out.fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* make sure write_time works */
|
||||
io.create.in.write_time = basetime;
|
||||
@ -832,8 +832,8 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
fnum = io.create.out.fnum;
|
||||
CHECK_TIME(basetime, write_time);
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
/* make sure file_attrs works */
|
||||
io.create.in.attrib = FILE_ATTRIBUTE_HIDDEN;
|
||||
@ -843,8 +843,8 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -886,9 +886,9 @@ static BOOL test_ctemp(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_TIME(basetime, write_time);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
if (fname) {
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -908,12 +908,12 @@ BOOL torture_raw_open(int dummy)
|
||||
|
||||
mem_ctx = talloc_init("torture_raw_open");
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1) {
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1) {
|
||||
printf("Failed to clean " BASEDIR "\n");
|
||||
return False;
|
||||
}
|
||||
if (!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli));
|
||||
if (!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -946,7 +946,7 @@ BOOL torture_raw_open(int dummy)
|
||||
}
|
||||
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
|
||||
torture_close_connection(cli);
|
||||
talloc_destroy(mem_ctx);
|
||||
|
@ -98,7 +98,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
uint16 fnum, fnum2;
|
||||
|
||||
/* cleanup */
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
|
||||
|
||||
@ -133,7 +133,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
|
||||
CHECK_VAL(break_info.count, 0);
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
/*
|
||||
with a batch oplock we get a break
|
||||
@ -159,7 +159,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VAL(break_info.count, 1);
|
||||
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
printf("if we close on break then the unlink can succeed\n");
|
||||
ZERO_STRUCT(break_info);
|
||||
@ -184,7 +184,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("a self read should not cause a break\n");
|
||||
ZERO_STRUCT(break_info);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
|
||||
|
||||
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
|
||||
@ -207,7 +207,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("a 2nd open should give a break\n");
|
||||
ZERO_STRUCT(break_info);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
|
||||
|
||||
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
|
||||
@ -230,7 +230,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("a 2nd open should get an oplock when we close instead of ack\n");
|
||||
ZERO_STRUCT(break_info);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
|
||||
|
||||
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
|
||||
@ -257,8 +257,8 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ BOOL torture_raw_qfileinfo(int dummy)
|
||||
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -552,8 +552,8 @@ BOOL torture_raw_qfileinfo(int dummy)
|
||||
NAME_CHECK("ALT_NAME_INFORMATION", alt_name_info, fname, STR_UNICODE);
|
||||
|
||||
/* and make sure we can open by alternate name */
|
||||
cli_close(cli, fnum);
|
||||
fnum = cli_nt_create_full(cli, correct_name, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
|
||||
cli_close(cli->tree, fnum);
|
||||
fnum = cli_nt_create_full(cli->tree, correct_name, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NTCREATEX_SHARE_ACCESS_DELETE|
|
||||
NTCREATEX_SHARE_ACCESS_READ|
|
||||
@ -561,7 +561,7 @@ BOOL torture_raw_qfileinfo(int dummy)
|
||||
NTCREATEX_DISP_OVERWRITE_IF,
|
||||
0, 0);
|
||||
if (fnum == -1) {
|
||||
printf("Unable to open by alt_name - %s\n", cli_errstr(cli));
|
||||
printf("Unable to open by alt_name - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
}
|
||||
|
||||
@ -704,8 +704,8 @@ BOOL torture_raw_qfileinfo(int dummy)
|
||||
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
torture_close_connection(cli);
|
||||
talloc_destroy(mem_ctx);
|
||||
|
@ -90,18 +90,18 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
buf = talloc_zero(mem_ctx, maxsize);
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_READ_READ\n");
|
||||
io.generic.level = RAW_READ_READ;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -129,7 +129,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
|
||||
io.read.in.fnum = fnum;
|
||||
|
||||
cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
|
||||
cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
|
||||
|
||||
printf("Trying small read\n");
|
||||
io.read.in.fnum = fnum;
|
||||
@ -165,7 +165,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.read.out.nread, 0);
|
||||
|
||||
setup_buffer(buf, seed, maxsize);
|
||||
cli_write(cli, fnum, 0, buf, 0, maxsize);
|
||||
cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
|
||||
memset(buf, 0, maxsize);
|
||||
|
||||
printf("Trying large read\n");
|
||||
@ -178,7 +178,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("Trying locked region\n");
|
||||
cli->session->pid++;
|
||||
if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
|
||||
if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
|
||||
printf("Failed to lock file at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -192,9 +192,9 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -216,18 +216,18 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
buf = talloc_zero(mem_ctx, maxsize);
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_READ_LOCKREAD\n");
|
||||
io.generic.level = RAW_READ_LOCKREAD;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -260,7 +260,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
|
||||
io.lockread.in.fnum = fnum;
|
||||
|
||||
cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
|
||||
cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
|
||||
|
||||
printf("Trying small read\n");
|
||||
io.lockread.in.fnum = fnum;
|
||||
@ -270,7 +270,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_read(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
|
||||
|
||||
cli_unlock(cli, fnum, 0, 1);
|
||||
cli_unlock(cli->tree, fnum, 0, 1);
|
||||
|
||||
status = smb_raw_read(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
@ -286,7 +286,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
io.lockread.in.count = strlen(test_data);
|
||||
status = smb_raw_read(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
|
||||
cli_unlock(cli, fnum, 0, strlen(test_data));
|
||||
cli_unlock(cli->tree, fnum, 0, strlen(test_data));
|
||||
status = smb_raw_read(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
@ -305,7 +305,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.lockread.out.nread, 0);
|
||||
|
||||
setup_buffer(buf, seed, maxsize);
|
||||
cli_write(cli, fnum, 0, buf, 0, maxsize);
|
||||
cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
|
||||
memset(buf, 0, maxsize);
|
||||
|
||||
printf("Trying large read\n");
|
||||
@ -313,16 +313,16 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
io.lockread.in.count = ~0;
|
||||
status = smb_raw_read(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
|
||||
cli_unlock(cli, fnum, 1, strlen(test_data));
|
||||
cli_unlock(cli->tree, fnum, 1, strlen(test_data));
|
||||
status = smb_raw_read(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
CHECK_BUFFER(buf, seed, io.lockread.out.nread);
|
||||
cli_unlock(cli, fnum, 0, 0xFFFF);
|
||||
cli_unlock(cli->tree, fnum, 0, 0xFFFF);
|
||||
|
||||
|
||||
printf("Trying locked region\n");
|
||||
cli->session->pid++;
|
||||
if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
|
||||
if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
|
||||
printf("Failed to lock file at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -336,8 +336,8 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -359,17 +359,17 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
buf = talloc_zero(mem_ctx, maxsize);
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_READ_READX\n");
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -404,7 +404,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
|
||||
io.readx.in.fnum = fnum;
|
||||
|
||||
cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
|
||||
cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
|
||||
|
||||
printf("Trying small read\n");
|
||||
io.readx.in.fnum = fnum;
|
||||
@ -449,7 +449,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.readx.out.compaction_mode, 0);
|
||||
|
||||
setup_buffer(buf, seed, maxsize);
|
||||
cli_write(cli, fnum, 0, buf, 0, maxsize);
|
||||
cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
|
||||
memset(buf, 0, maxsize);
|
||||
|
||||
printf("Trying large read\n");
|
||||
@ -489,7 +489,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("Trying locked region\n");
|
||||
cli->session->pid++;
|
||||
if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
|
||||
if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
|
||||
printf("Failed to lock file at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -511,7 +511,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
CHECK_VALUE(io.readx.out.nread, 0);
|
||||
|
||||
if (!cli_lock64(cli, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK)) {
|
||||
if (!cli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK)) {
|
||||
printf("Failed to lock file at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -523,8 +523,8 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
#endif
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -546,17 +546,17 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
buf = talloc_zero(mem_ctx, maxsize);
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_READ_READBRAW\n");
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -588,7 +588,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.readbraw.out.nread, 0);
|
||||
io.readbraw.in.fnum = fnum;
|
||||
|
||||
cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
|
||||
cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
|
||||
|
||||
printf("Trying small read\n");
|
||||
io.readbraw.in.fnum = fnum;
|
||||
@ -626,7 +626,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.readbraw.out.nread, 0);
|
||||
|
||||
setup_buffer(buf, seed, maxsize);
|
||||
cli_write(cli, fnum, 0, buf, 0, maxsize);
|
||||
cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
|
||||
memset(buf, 0, maxsize);
|
||||
|
||||
printf("Trying large read\n");
|
||||
@ -660,7 +660,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("Trying locked region\n");
|
||||
cli->session->pid++;
|
||||
if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
|
||||
if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
|
||||
printf("Failed to lock file at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -696,8 +696,8 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
#endif
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -51,9 +51,9 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("Testing SMBmv\n");
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -118,9 +118,9 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -141,9 +141,9 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("Testing SMBntrename\n");
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
|
||||
|
||||
cli_unlink(cli, fname2);
|
||||
cli_unlink(cli->tree, fname2);
|
||||
|
||||
finfo.generic.in.fname = fname1;
|
||||
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
|
||||
@ -254,7 +254,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
|
||||
|
||||
cli_unlink(cli, fname2);
|
||||
cli_unlink(cli->tree, fname2);
|
||||
|
||||
finfo.generic.in.fname = fname1;
|
||||
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
|
||||
@ -303,15 +303,15 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
#if 0
|
||||
{
|
||||
char buf[16384];
|
||||
fnum = cli_open(cli, fname1, O_RDWR, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname1, O_RDWR, DENY_NONE);
|
||||
memset(buf, 1, sizeof(buf));
|
||||
cli_write(cli, fnum, 0, buf, 0, sizeof(buf));
|
||||
cli_close(cli, fnum);
|
||||
cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
fnum = cli_open(cli, fname2, O_RDWR, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname2, O_RDWR, DENY_NONE);
|
||||
memset(buf, 1, sizeof(buf));
|
||||
cli_write(cli, fnum, 0, buf, 0, sizeof(buf)-1);
|
||||
cli_close(cli, fnum);
|
||||
cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf)-1);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
torture_all_info(cli->tree, fname1);
|
||||
torture_all_info(cli->tree, fname2);
|
||||
@ -353,7 +353,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
done:
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
if (fnum == -1) {
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
|
||||
printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -338,7 +338,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
done:
|
||||
smb_raw_exit(cli->session);
|
||||
cli_unlink(cli, fname);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -550,9 +550,9 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
{"SEARCH", "ID", RAW_SEARCH_SEARCH, CONT_RESUME_KEY}
|
||||
};
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -560,14 +560,14 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
for (i=0;i<num_files;i++) {
|
||||
asprintf(&fname, BASEDIR "\\t%03d-%d.txt", i, i);
|
||||
fnum = cli_open(cli, fname, O_CREAT|O_RDWR, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
free(fname);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
}
|
||||
|
||||
|
||||
@ -627,7 +627,7 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
done:
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -52,15 +52,15 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
const char *fname = BASEDIR "\\test.txt";
|
||||
char c[2];
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to open test.txt - %s\n", cli_errstr(cli));
|
||||
printf("Failed to open test.txt - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -138,8 +138,8 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("trying write to update offset\n");
|
||||
ZERO_STRUCT(c);
|
||||
if (cli_write(cli, fnum, 0, c, 0, 2) != 2) {
|
||||
printf("Write failed - %s\n", cli_errstr(cli));
|
||||
if (cli_write(cli->tree, fnum, 0, c, 0, 2) != 2) {
|
||||
printf("Write failed - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -158,8 +158,8 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
CHECK_VALUE(io.out.offset, 2);
|
||||
|
||||
if (cli_read(cli, fnum, c, 0, 1) != 1) {
|
||||
printf("Read failed - %s\n", cli_errstr(cli));
|
||||
if (cli_read(cli->tree, fnum, c, 0, 1) != 1) {
|
||||
printf("Read failed - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -176,9 +176,9 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.out.offset, 1);
|
||||
|
||||
printf("Testing position information\n");
|
||||
fnum2 = cli_open(cli, fname, O_RDWR, DENY_NONE);
|
||||
fnum2 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
|
||||
if (fnum2 == -1) {
|
||||
printf("2nd open failed - %s\n", cli_errstr(cli));
|
||||
printf("2nd open failed - %s\n", cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -223,7 +223,7 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
done:
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -55,22 +55,22 @@ BOOL torture_raw_sfileinfo(int dummy)
|
||||
|
||||
mem_ctx = talloc_init("torture_sfileinfo");
|
||||
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_mkdir(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
cli_mkdir(cli->tree, BASEDIR);
|
||||
|
||||
#define RECREATE_FILE(fname) do { \
|
||||
if (fnum != -1) cli_close(cli, fnum); \
|
||||
if (fnum != -1) cli_close(cli->tree, fnum); \
|
||||
fnum = create_complex_file(cli, mem_ctx, fname); \
|
||||
if (fnum == -1) { \
|
||||
printf("(%d) ERROR: open of %s failed (%s)\n", \
|
||||
__LINE__, fname, cli_errstr(cli)); \
|
||||
__LINE__, fname, cli_errstr(cli->tree)); \
|
||||
ret = False; \
|
||||
goto done; \
|
||||
}} while (0)
|
||||
|
||||
#define RECREATE_BOTH do { \
|
||||
RECREATE_FILE(path_fname); \
|
||||
cli_close(cli, fnum); \
|
||||
cli_close(cli->tree, fnum); \
|
||||
RECREATE_FILE(fnum_fname); \
|
||||
} while (0)
|
||||
|
||||
@ -408,8 +408,8 @@ BOOL torture_raw_sfileinfo(int dummy)
|
||||
CHECK_VALUE(MODE_INFORMATION, mode_information, mode, 0);
|
||||
#if 1
|
||||
printf("finally the rename_information level\n");
|
||||
cli_close(cli, create_complex_file(cli, mem_ctx, fnum_fname_new));
|
||||
cli_close(cli, create_complex_file(cli, mem_ctx, path_fname_new));
|
||||
cli_close(cli->tree, create_complex_file(cli, mem_ctx, fnum_fname_new));
|
||||
cli_close(cli->tree, create_complex_file(cli, mem_ctx, path_fname_new));
|
||||
|
||||
sfinfo.rename_information.in.overwrite = 0;
|
||||
sfinfo.rename_information.in.root_fid = 0;
|
||||
@ -444,7 +444,7 @@ BOOL torture_raw_sfileinfo(int dummy)
|
||||
printf("Trying rename with dest file open and delete_on_close\n");
|
||||
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_ACCESS_DENIED);
|
||||
|
||||
cli_close(cli, fnum2);
|
||||
cli_close(cli->tree, fnum2);
|
||||
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
|
||||
CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname);
|
||||
|
||||
@ -459,7 +459,7 @@ BOOL torture_raw_sfileinfo(int dummy)
|
||||
sfinfo.rename_information.in.overwrite = 0;
|
||||
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
|
||||
CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname_new);
|
||||
cli_close(cli, fnum2);
|
||||
cli_close(cli->tree, fnum2);
|
||||
|
||||
sfinfo.rename_information.in.new_name = fnum_fname+strlen(BASEDIR)+1;
|
||||
sfinfo.rename_information.in.overwrite = 0;
|
||||
@ -499,12 +499,12 @@ BOOL torture_raw_sfileinfo(int dummy)
|
||||
|
||||
done:
|
||||
smb_raw_exit(cli->session);
|
||||
cli_close(cli, fnum);
|
||||
if (!cli_unlink(cli, fnum_fname)) {
|
||||
printf("Failed to delete %s - %s\n", fnum_fname, cli_errstr(cli));
|
||||
cli_close(cli->tree, fnum);
|
||||
if (!cli_unlink(cli->tree, fnum_fname)) {
|
||||
printf("Failed to delete %s - %s\n", fnum_fname, cli_errstr(cli->tree));
|
||||
}
|
||||
if (!cli_unlink(cli, path_fname)) {
|
||||
printf("Failed to delete %s - %s\n", path_fname, cli_errstr(cli));
|
||||
if (!cli_unlink(cli->tree, path_fname)) {
|
||||
printf("Failed to delete %s - %s\n", path_fname, cli_errstr(cli->tree));
|
||||
}
|
||||
|
||||
torture_close_connection(cli);
|
||||
@ -532,7 +532,7 @@ BOOL torture_raw_sfileinfo_bug(int dummy)
|
||||
mem_ctx = talloc_init("torture_sfileinfo");
|
||||
|
||||
fnum = create_complex_file(cli, mem_ctx, fname);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
|
||||
sfinfo.generic.level = RAW_SFILEINFO_STANDARD;
|
||||
sfinfo.generic.file.fname = fname;
|
||||
|
@ -40,9 +40,9 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
BOOL ret = True;
|
||||
const char *fname = BASEDIR "\\test.txt";
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_unlink(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
|
||||
|
||||
cli_close(cli, cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE));
|
||||
cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
|
||||
|
||||
io.in.pattern = fname;
|
||||
io.in.attrib = 0;
|
||||
@ -60,7 +60,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
|
||||
printf("Trying a hidden file\n");
|
||||
cli_close(cli, cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE));
|
||||
cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
|
||||
torture_set_file_attribute(cli->tree, fname, FILE_ATTRIBUTE_HIDDEN);
|
||||
|
||||
io.in.pattern = fname;
|
||||
@ -101,7 +101,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_FILE_IS_A_DIRECTORY);
|
||||
|
||||
printf("Trying wildcards\n");
|
||||
cli_close(cli, cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE));
|
||||
cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
|
||||
io.in.pattern = BASEDIR "\\t*.t";
|
||||
io.in.attrib = 0;
|
||||
status = smb_raw_unlink(cli->tree, &io);
|
||||
@ -128,7 +128,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
done:
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -103,18 +103,18 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
buf = talloc_zero(mem_ctx, maxsize);
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_WRITE_WRITE\n");
|
||||
io.generic.level = RAW_WRITE_WRITE;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -140,7 +140,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.write.out.nwritten, io.write.in.count);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, 0, 13) != 13) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -159,7 +159,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.write.out.nwritten, 4000);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, 0, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -190,7 +190,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_ALL_INFO(io.write.in.count + (SMB_BIG_UINT)io.write.in.offset, size);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, io.write.in.offset, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, io.write.in.offset, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -198,9 +198,9 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_BUFFER(buf, seed, 4000);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -222,18 +222,18 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
buf = talloc_zero(mem_ctx, maxsize);
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_WRITE_WRITEX\n");
|
||||
io.generic.level = RAW_WRITE_WRITEX;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -260,7 +260,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.writex.out.nwritten, io.writex.in.count);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, 0, 13) != 13) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -279,7 +279,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.writex.out.nwritten, 4000);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, 0, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -312,7 +312,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
printf("Trying locked region\n");
|
||||
cli->session->pid++;
|
||||
if (!cli_lock(cli, fnum, 3, 1, 0, WRITE_LOCK)) {
|
||||
if (!cli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK)) {
|
||||
printf("Failed to lock file at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -340,7 +340,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_ALL_INFO(io.writex.in.count + (SMB_BIG_UINT)io.writex.in.offset, size);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, io.writex.in.offset, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -360,7 +360,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_ALL_INFO(io.writex.in.count + (SMB_BIG_UINT)io.writex.in.offset, size);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, io.writex.in.offset, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -372,9 +372,9 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
setup_buffer(buf, seed, maxsize);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -396,18 +396,18 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
buf = talloc_zero(mem_ctx, maxsize);
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_WRITE_WRITEUNLOCK\n");
|
||||
io.generic.level = RAW_WRITE_WRITEUNLOCK;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -430,7 +430,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
io.writeunlock.in.data = buf;
|
||||
status = smb_raw_write(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
|
||||
if (cli_read(cli, fnum, buf, 0, 13) != 13) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -439,14 +439,14 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(IVAL(buf,0), 0);
|
||||
|
||||
setup_buffer(buf, seed, maxsize);
|
||||
cli_lock(cli, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
|
||||
cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
|
||||
0, WRITE_LOCK);
|
||||
status = smb_raw_write(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
CHECK_VALUE(io.writeunlock.out.nwritten, io.writeunlock.in.count);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, 0, 13) != 13) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -460,7 +460,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
io.writeunlock.in.count = 4000;
|
||||
io.writeunlock.in.offset = 0;
|
||||
io.writeunlock.in.data = buf;
|
||||
cli_lock(cli, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
|
||||
cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
|
||||
0, WRITE_LOCK);
|
||||
status = smb_raw_write(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
@ -470,7 +470,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, 0, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -495,7 +495,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
io.writeunlock.in.count = 4000;
|
||||
io.writeunlock.in.offset = 0xFFFFFFFF - 2000;
|
||||
io.writeunlock.in.data = buf;
|
||||
cli_lock(cli, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
|
||||
cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
|
||||
0, WRITE_LOCK);
|
||||
status = smb_raw_write(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
@ -503,7 +503,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_ALL_INFO(io.writeunlock.in.count + (SMB_BIG_UINT)io.writeunlock.in.offset, size);
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -511,9 +511,9 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_BUFFER(buf, seed, 4000);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -535,18 +535,18 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
|
||||
buf = talloc_zero(mem_ctx, maxsize);
|
||||
|
||||
if (cli_deltree(cli, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
|
||||
if (cli_deltree(cli->tree, BASEDIR) == -1 ||
|
||||
!cli_mkdir(cli->tree, BASEDIR)) {
|
||||
printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("Testing RAW_WRITE_WRITECLOSE\n");
|
||||
io.generic.level = RAW_WRITE_WRITECLOSE;
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
|
||||
printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
|
||||
ret = False;
|
||||
goto done;
|
||||
}
|
||||
@ -577,10 +577,10 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_write(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
|
||||
io.writeclose.in.fnum = fnum;
|
||||
|
||||
if (cli_read(cli, fnum, buf, 0, 13) != 13) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -593,11 +593,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_STATUS(status, NT_STATUS_OK);
|
||||
CHECK_VALUE(io.writeclose.out.nwritten, io.writeclose.in.count);
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
|
||||
io.writeclose.in.fnum = fnum;
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, 0, 13) != 13) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -618,11 +618,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
status = smb_raw_write(cli->tree, &io);
|
||||
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
|
||||
io.writeclose.in.fnum = fnum;
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, 0, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -652,11 +652,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_VALUE(io.writeclose.out.nwritten, 4000);
|
||||
CHECK_ALL_INFO(io.writeclose.in.count + (SMB_BIG_UINT)io.writeclose.in.offset, size);
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
|
||||
io.writeclose.in.fnum = fnum;
|
||||
|
||||
memset(buf, 0, maxsize);
|
||||
if (cli_read(cli, fnum, buf, io.writeclose.in.offset, 4000) != 4000) {
|
||||
if (cli_read(cli->tree, fnum, buf, io.writeclose.in.offset, 4000) != 4000) {
|
||||
printf("read failed at %d\n", __LINE__);
|
||||
ret = False;
|
||||
goto done;
|
||||
@ -664,9 +664,9 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
CHECK_BUFFER(buf, seed, 4000);
|
||||
|
||||
done:
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
smb_raw_exit(cli->session);
|
||||
cli_deltree(cli, BASEDIR);
|
||||
cli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -217,19 +217,19 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
|
||||
|
||||
status = try_trans2_len(cli, "newfile", op, level, param, data, param_len, &data_len,
|
||||
&rparam_len, &rdata_len);
|
||||
cli_unlink(cli, "\\newfile.dat");
|
||||
cli_rmdir(cli, "\\newfile.dat");
|
||||
cli_unlink(cli->tree, "\\newfile.dat");
|
||||
cli_rmdir(cli->tree, "\\newfile.dat");
|
||||
if (NT_STATUS_IS_OK(status)) return True;
|
||||
|
||||
/* try dfs style */
|
||||
cli_mkdir(cli, "\\testdir");
|
||||
cli_mkdir(cli->tree, "\\testdir");
|
||||
param_len = 2;
|
||||
SSVAL(param, 0, level);
|
||||
param_len += push_string(NULL, ¶m[2], "\\testdir", sizeof(pstring)-3, STR_TERMINATE|STR_UNICODE);
|
||||
|
||||
status = try_trans2_len(cli, "dfs", op, level, param, data, param_len, &data_len,
|
||||
&rparam_len, &rdata_len);
|
||||
cli_rmdir(cli, "\\testdir");
|
||||
cli_rmdir(cli->tree, "\\testdir");
|
||||
if (NT_STATUS_IS_OK(status)) return True;
|
||||
|
||||
return False;
|
||||
@ -249,19 +249,19 @@ BOOL torture_trans2_scan(int dummy)
|
||||
return False;
|
||||
}
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
|
||||
if (fnum == -1) {
|
||||
printf("file open failed - %s\n", cli_errstr(cli));
|
||||
printf("file open failed - %s\n", cli_errstr(cli->tree));
|
||||
}
|
||||
dnum = cli_nt_create_full(cli, "\\",
|
||||
dnum = cli_nt_create_full(cli->tree, "\\",
|
||||
0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
|
||||
NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE,
|
||||
NTCREATEX_DISP_OPEN,
|
||||
NTCREATEX_OPTIONS_DIRECTORY, 0);
|
||||
if (dnum == -1) {
|
||||
printf("directory open failed - %s\n", cli_errstr(cli));
|
||||
printf("directory open failed - %s\n", cli_errstr(cli->tree));
|
||||
}
|
||||
qfnum = cli_nt_create_full(cli, "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION",
|
||||
qfnum = cli_nt_create_full(cli->tree, "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION",
|
||||
NTCREATEX_FLAGS_EXTENDED,
|
||||
SEC_RIGHTS_MAXIMUM_ALLOWED,
|
||||
0,
|
||||
@ -269,7 +269,7 @@ BOOL torture_trans2_scan(int dummy)
|
||||
NTCREATEX_DISP_OPEN,
|
||||
0, 0);
|
||||
if (qfnum == -1) {
|
||||
printf("quota open failed - %s\n", cli_errstr(cli));
|
||||
printf("quota open failed - %s\n", cli_errstr(cli->tree));
|
||||
}
|
||||
|
||||
for (op=OP_MIN; op<=OP_MAX; op++) {
|
||||
@ -456,19 +456,19 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
|
||||
|
||||
status = try_nttrans_len(cli, "newfile", op, level, param, data, param_len, &data_len,
|
||||
&rparam_len, &rdata_len);
|
||||
cli_unlink(cli, "\\newfile.dat");
|
||||
cli_rmdir(cli, "\\newfile.dat");
|
||||
cli_unlink(cli->tree, "\\newfile.dat");
|
||||
cli_rmdir(cli->tree, "\\newfile.dat");
|
||||
if (NT_STATUS_IS_OK(status)) return True;
|
||||
|
||||
/* try dfs style */
|
||||
cli_mkdir(cli, "\\testdir");
|
||||
cli_mkdir(cli->tree, "\\testdir");
|
||||
param_len = 2;
|
||||
SSVAL(param, 0, level);
|
||||
param_len += push_string(NULL, ¶m[2], "\\testdir", -1, STR_TERMINATE | STR_UNICODE);
|
||||
|
||||
status = try_nttrans_len(cli, "dfs", op, level, param, data, param_len, &data_len,
|
||||
&rparam_len, &rdata_len);
|
||||
cli_rmdir(cli, "\\testdir");
|
||||
cli_rmdir(cli->tree, "\\testdir");
|
||||
if (NT_STATUS_IS_OK(status)) return True;
|
||||
|
||||
return False;
|
||||
@ -488,9 +488,9 @@ BOOL torture_nttrans_scan(int dummy)
|
||||
return False;
|
||||
}
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC,
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC,
|
||||
DENY_NONE);
|
||||
dnum = cli_open(cli, "\\", O_RDONLY, DENY_NONE);
|
||||
dnum = cli_open(cli->tree, "\\", O_RDONLY, DENY_NONE);
|
||||
|
||||
for (op=OP_MIN; op<=OP_MAX; op++) {
|
||||
printf("Scanning op=%d\n", op);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -83,8 +83,8 @@ int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *
|
||||
time_t t = (time(NULL) & ~1);
|
||||
NTSTATUS status;
|
||||
|
||||
cli_unlink(cli, fname);
|
||||
fnum = cli_nt_create_full(cli, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
|
||||
cli_unlink(cli->tree, fname);
|
||||
fnum = cli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NTCREATEX_SHARE_ACCESS_DELETE|
|
||||
NTCREATEX_SHARE_ACCESS_READ|
|
||||
@ -93,7 +93,7 @@ int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *
|
||||
0, 0);
|
||||
if (fnum == -1) return -1;
|
||||
|
||||
cli_write(cli, fnum, 0, buf, 0, sizeof(buf));
|
||||
cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
|
||||
|
||||
/* setup some EAs */
|
||||
setfile.generic.level = RAW_SFILEINFO_EA_SET;
|
||||
|
@ -41,8 +41,8 @@ BOOL torture_utable(int dummy)
|
||||
|
||||
memset(valid, 0, sizeof(valid));
|
||||
|
||||
cli_mkdir(cli, "\\utable");
|
||||
cli_unlink(cli, "\\utable\\*");
|
||||
cli_mkdir(cli->tree, "\\utable");
|
||||
cli_unlink(cli->tree, "\\utable\\*");
|
||||
|
||||
for (c=1; c < 0x10000; c++) {
|
||||
char *p;
|
||||
@ -56,13 +56,13 @@ BOOL torture_utable(int dummy)
|
||||
p[len] = 0;
|
||||
fstrcat(fname,"_a_long_extension");
|
||||
|
||||
fnum = cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC,
|
||||
fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC,
|
||||
DENY_NONE);
|
||||
if (fnum == -1) continue;
|
||||
|
||||
chars_allowed++;
|
||||
|
||||
cli_qpathinfo_alt_name(cli, fname, &alt_name);
|
||||
cli_qpathinfo_alt_name(cli->tree, fname, &alt_name);
|
||||
|
||||
if (strncmp(alt_name, "X_A_L", 5) != 0) {
|
||||
alt_allowed++;
|
||||
@ -70,8 +70,8 @@ BOOL torture_utable(int dummy)
|
||||
d_printf("fname=[%s] alt_name=[%s]\n", fname, alt_name);
|
||||
}
|
||||
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
cli_close(cli->tree, fnum);
|
||||
cli_unlink(cli->tree, fname);
|
||||
|
||||
if (c % 100 == 0) {
|
||||
printf("%d (%d/%d)\r", c, chars_allowed, alt_allowed);
|
||||
@ -79,7 +79,7 @@ BOOL torture_utable(int dummy)
|
||||
}
|
||||
printf("%d (%d/%d)\n", c, chars_allowed, alt_allowed);
|
||||
|
||||
cli_rmdir(cli, "\\utable");
|
||||
cli_rmdir(cli->tree, "\\utable");
|
||||
|
||||
d_printf("%d chars allowed %d alt chars allowed\n", chars_allowed, alt_allowed);
|
||||
|
||||
@ -132,8 +132,8 @@ BOOL torture_casetable(int dummy)
|
||||
|
||||
memset(equiv, 0, sizeof(equiv));
|
||||
|
||||
cli_deltree(cli, "\\utable");
|
||||
if (!cli_mkdir(cli, "\\utable")) {
|
||||
cli_deltree(cli->tree, "\\utable");
|
||||
if (!cli_mkdir(cli->tree, "\\utable")) {
|
||||
printf("Failed to create utable directory!\n");
|
||||
return False;
|
||||
}
|
||||
@ -146,7 +146,7 @@ BOOL torture_casetable(int dummy)
|
||||
d_printf("%04x (%c)\n", c, isprint(c)?c:'.');
|
||||
|
||||
fname = form_name(c);
|
||||
fnum = cli_nt_create_full(cli, fname, 0,
|
||||
fnum = cli_nt_create_full(cli->tree, fname, 0,
|
||||
#if 0
|
||||
SEC_RIGHT_MAXIMUM_ALLOWED,
|
||||
#else
|
||||
@ -163,7 +163,7 @@ BOOL torture_casetable(int dummy)
|
||||
|
||||
size = 0;
|
||||
|
||||
if (!cli_qfileinfo(cli, fnum, NULL, &size,
|
||||
if (!cli_qfileinfo(cli->tree, fnum, NULL, &size,
|
||||
NULL, NULL, NULL, NULL, NULL)) continue;
|
||||
|
||||
if (size > 0) {
|
||||
@ -173,11 +173,11 @@ BOOL torture_casetable(int dummy)
|
||||
if (size/sizeof(int) >= MAX_EQUIVALENCE) {
|
||||
printf("too many chars match?? size=%d c=0x%04x\n",
|
||||
size, c);
|
||||
cli_close(cli, fnum);
|
||||
cli_close(cli->tree, fnum);
|
||||
return False;
|
||||
}
|
||||
|
||||
cli_read(cli, fnum, (char *)c2, 0, size);
|
||||
cli_read(cli->tree, fnum, (char *)c2, 0, size);
|
||||
printf("%04x: ", c);
|
||||
equiv[c][0] = c;
|
||||
for (i=0; i<size/sizeof(int); i++) {
|
||||
@ -188,12 +188,12 @@ BOOL torture_casetable(int dummy)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
cli_write(cli, fnum, 0, (char *)&c, size, sizeof(c));
|
||||
cli_close(cli, fnum);
|
||||
cli_write(cli->tree, fnum, 0, (char *)&c, size, sizeof(c));
|
||||
cli_close(cli->tree, fnum);
|
||||
}
|
||||
|
||||
cli_unlink(cli, "\\utable\\*");
|
||||
cli_rmdir(cli, "\\utable");
|
||||
cli_unlink(cli->tree, "\\utable\\*");
|
||||
cli_rmdir(cli->tree, "\\utable");
|
||||
|
||||
return True;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user