diff options
author | Tim Potter <tpot@samba.org> | 2004-02-08 00:51:07 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2004-02-08 00:51:07 +0000 |
commit | 4639eb5a58f8c0906afdc8e8f8f67f82e9547f75 (patch) | |
tree | 2115d25166961cea7d49836d53a05e98c796ff8a /source4 | |
parent | f0c9a54b30cfa627b4ddcbc24fe943b21472df34 (diff) | |
download | samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.tar.gz samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.tar.bz2 samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.zip |
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)
Diffstat (limited to 'source4')
39 files changed, 1383 insertions, 1364 deletions
diff --git a/source4/client/client.c b/source4/client/client.c index 4fbafa9439..ce754498f8 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -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; } diff --git a/source4/client/clitar.c b/source4/client/clitar.c index 8ab54a40c2..2f423ede7d 100644 --- a/source4/client/clitar.c +++ b/source4/client/clitar.c @@ -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 */ diff --git a/source4/libcli/clideltree.c b/source4/libcli/clideltree.c index 8769b8dfa7..d28950f136 100644 --- a/source4/libcli/clideltree.c +++ b/source4/libcli/clideltree.c @@ -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++; diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c index 27ead40740..6606455e49 100644 --- a/source4/libcli/clifile.c +++ b/source4/libcli/clifile.c @@ -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); } diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 425a6002cc..ee0357579c 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -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); } diff --git a/source4/libcli/climessage.c b/source4/libcli/climessage.c index ad5d41545b..6470f4c154 100644 --- a/source4/libcli/climessage.c +++ b/source4/libcli/climessage.c @@ -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; } diff --git a/source4/libcli/clireadwrite.c b/source4/libcli/clireadwrite.c index 1e6c0fc064..7b47281e2c 100644 --- a/source4/libcli/clireadwrite.c +++ b/source4/libcli/clireadwrite.c @@ -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; diff --git a/source4/libcli/clisecdesc.c b/source4/libcli/clisecdesc.c index 66272251ec..7f3ec0f6bf 100644 --- a/source4/libcli/clisecdesc.c +++ b/source4/libcli/clisecdesc.c @@ -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")); diff --git a/source4/libcli/clitrans2.c b/source4/libcli/clitrans2.c index 0ceac925f7..c8f7db5a9d 100644 --- a/source4/libcli/clitrans2.c +++ b/source4/libcli/clitrans2.c @@ -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) { diff --git a/source4/libcli/util/clierror.c b/source4/libcli/util/clierror.c index 4fa1daa3be..97436d2106 100644 --- a/source4/libcli/util/clierror.c +++ b/source4/libcli/util/clierror.c @@ -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; } diff --git a/source4/torture/aliases.c b/source4/torture/aliases.c index feb940eb42..9c8c366fd1 100644 --- a/source4/torture/aliases.c +++ b/source4/torture/aliases.c @@ -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); } diff --git a/source4/torture/denytest.c b/source4/torture/denytest.c index ea4b7e5735..0e4f5251da 100644 --- a/source4/torture/denytest.c +++ b/source4/torture/denytest.c @@ -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)) { diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index b327bfad51..484ee9aee9 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -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) { diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index cd66bab58e..fcb229df08 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -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) { diff --git a/source4/torture/mangle_test.c b/source4/torture/mangle_test.c index de0a7f6a14..f0aaee18ec 100644 --- a/source4/torture/mangle_test.c +++ b/source4/torture/mangle_test.c @@ -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; } diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index 7906684169..6a511d8b49 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -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"); } diff --git a/source4/torture/nbio.c b/source4/torture/nbio.c index e2986cf14e..49688d6354 100644 --- a/source4/torture/nbio.c +++ b/source4/torture/nbio.c @@ -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; } diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c index 3364c39a73..6e128a01a4 100644 --- a/source4/torture/raw/chkpath.c +++ b/source4/torture/raw/chkpath.c @@ -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); diff --git a/source4/torture/raw/close.c b/source4/torture/raw/close.c index 40bb57f303..909c8f6c95 100644 --- a/source4/torture/raw/close.c +++ b/source4/torture/raw/close.c @@ -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; diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index c19fea458d..4fc9b3788e 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -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); diff --git a/source4/torture/raw/ioctl.c b/source4/torture/raw/ioctl.c index 5bc2a67903..a7787b6d28 100644 --- a/source4/torture/raw/ioctl.c +++ b/source4/torture/raw/ioctl.c @@ -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); diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index 56dc1ec163..e36f9edddf 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -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; } diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c index 52120f0542..b614800106 100644 --- a/source4/torture/raw/mkdir.c +++ b/source4/torture/raw/mkdir.c @@ -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; } diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c index 05c5e3de09..70e6c09d9e 100644 --- a/source4/torture/raw/mux.c +++ b/source4/torture/raw/mux.c @@ -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; diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index a123dc6702..b94474aa43 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -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; diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index 3e28322f37..567940b2e8 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -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); diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 888fcbdc13..dc8c883f76 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -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; } diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c index 881916c2f7..15e358673d 100644 --- a/source4/torture/raw/qfileinfo.c +++ b/source4/torture/raw/qfileinfo.c @@ -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); diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index e0432651dc..0836b4d021 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -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; } diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c index b997c2f310..d2f922cdfd 100644 --- a/source4/torture/raw/rename.c +++ b/source4/torture/raw/rename.c @@ -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; } diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index 301a9f0077..164c9bb4d8 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -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; } diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c index 85ca9f2869..fa95156969 100644 --- a/source4/torture/raw/seek.c +++ b/source4/torture/raw/seek.c @@ -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; } diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c index 9da75596c5..f82a63180a 100644 --- a/source4/torture/raw/setfileinfo.c +++ b/source4/torture/raw/setfileinfo.c @@ -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; diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index 889e25777c..741f8c61f7 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -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; } diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c index 644a5579c8..3b356f1095 100644 --- a/source4/torture/raw/write.c +++ b/source4/torture/raw/write.c @@ -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; } diff --git a/source4/torture/scanner.c b/source4/torture/scanner.c index 955ae7a274..7368528200 100644 --- a/source4/torture/scanner.c +++ b/source4/torture/scanner.c @@ -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); diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 46bb99d2ea..393ac9c56b 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -121,7 +121,7 @@ BOOL torture_close_connection(struct cli_state *c) DEBUG(9,("torture_close_connection: cli_state@%p\n", c)); if (!c) return True; if (!cli_tdis(c)) { - printf("tdis failed (%s)\n", cli_errstr(c)); + printf("tdis failed (%s)\n", cli_errstr(c->tree)); ret = False; } DEBUG(9,("torture_close_connection: call cli_shutdown\n")); @@ -165,7 +165,7 @@ NTSTATUS torture_rpc_close(struct dcerpc_pipe *p) static BOOL check_error(int line, struct cli_state *c, uint8 eclass, uint32 ecode, NTSTATUS nterr) { - if (cli_is_dos_error(c)) { + if (cli_is_dos_error(c->tree)) { uint8 class; uint32 num; @@ -186,7 +186,7 @@ static BOOL check_error(int line, struct cli_state *c, /* Check NT error */ - status = cli_nt_error(c); + status = cli_nt_error(c->tree); if (NT_STATUS_V(nterr) != NT_STATUS_V(status)) { printf("unexpected error code %s\n", nt_errstr(status)); @@ -201,7 +201,7 @@ static BOOL check_error(int line, struct cli_state *c, static BOOL wait_lock(struct cli_state *c, int fnum, uint32 offset, uint32 len) { - while (!cli_lock(c, fnum, offset, len, -1, WRITE_LOCK)) { + while (!cli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK)) { if (!check_error(__LINE__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False; } return True; @@ -219,12 +219,12 @@ static BOOL rw_torture(struct cli_state *c) char buf[1024]; BOOL correct = True; - fnum2 = cli_open(c, lockfname, O_RDWR | O_CREAT | O_EXCL, + fnum2 = cli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, DENY_NONE); if (fnum2 == -1) - fnum2 = cli_open(c, lockfname, O_RDWR, DENY_NONE); + fnum2 = cli_open(c->tree, lockfname, O_RDWR, DENY_NONE); if (fnum2 == -1) { - printf("open of %s failed (%s)\n", lockfname, cli_errstr(c)); + printf("open of %s failed (%s)\n", lockfname, cli_errstr(c->tree)); return False; } @@ -240,31 +240,31 @@ static BOOL rw_torture(struct cli_state *c) return False; } - fnum = cli_open(c, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL); + fnum = cli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL); if (fnum == -1) { - printf("open failed (%s)\n", cli_errstr(c)); + printf("open failed (%s)\n", cli_errstr(c->tree)); correct = False; break; } - if (cli_write(c, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) { - printf("write failed (%s)\n", cli_errstr(c)); + if (cli_write(c->tree, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) { + printf("write failed (%s)\n", cli_errstr(c->tree)); correct = False; } for (j=0;j<50;j++) { - if (cli_write(c, fnum, 0, (char *)buf, + if (cli_write(c->tree, fnum, 0, (char *)buf, sizeof(pid)+(j*sizeof(buf)), sizeof(buf)) != sizeof(buf)) { - printf("write failed (%s)\n", cli_errstr(c)); + printf("write failed (%s)\n", cli_errstr(c->tree)); correct = False; } } pid2 = 0; - if (cli_read(c, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) { - printf("read failed (%s)\n", cli_errstr(c)); + if (cli_read(c->tree, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) { + printf("read failed (%s)\n", cli_errstr(c->tree)); correct = False; } @@ -273,25 +273,25 @@ static BOOL rw_torture(struct cli_state *c) correct = False; } - if (!cli_close(c, fnum)) { - printf("close failed (%s)\n", cli_errstr(c)); + if (!cli_close(c->tree, fnum)) { + printf("close failed (%s)\n", cli_errstr(c->tree)); correct = False; } - if (!cli_unlink(c, fname)) { - printf("unlink failed (%s)\n", cli_errstr(c)); + if (!cli_unlink(c->tree, fname)) { + printf("unlink failed (%s)\n", cli_errstr(c->tree)); correct = False; } - if (!cli_unlock(c, fnum2, n*sizeof(int), sizeof(int))) { - printf("unlock failed (%s)\n", cli_errstr(c)); + if (!cli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int))) { + printf("unlock failed (%s)\n", cli_errstr(c->tree)); correct = False; } free(fname); } - cli_close(c, fnum2); - cli_unlink(c, lockfname); + cli_close(c->tree, fnum2); + cli_unlink(c->tree, lockfname); printf("%d\n", i); @@ -333,11 +333,11 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname) if (procnum == 0) { - fnum = cli_open(c, lockfname, O_RDWR | O_CREAT | O_EXCL, - DENY_NONE); + fnum = cli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, + DENY_NONE); if (fnum == -1) { printf("first open read/write of %s failed (%s)\n", - lockfname, cli_errstr(c)); + lockfname, cli_errstr(c->tree)); return False; } } @@ -345,13 +345,13 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname) { for (i = 0; i < 500 && fnum == -1; i++) { - fnum = cli_open(c, lockfname, O_RDONLY, - DENY_NONE); + fnum = cli_open(c->tree, lockfname, O_RDONLY, + DENY_NONE); msleep(10); } if (fnum == -1) { printf("second open read-only of %s failed (%s)\n", - lockfname, cli_errstr(c)); + lockfname, cli_errstr(c->tree)); return False; } } @@ -374,20 +374,20 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname) sent = sizeof(buf) - count; } - if (cli_write(c, fnum, 0, buf+count, count, (size_t)sent) != sent) { - printf("write failed (%s)\n", cli_errstr(c)); + if (cli_write(c->tree, fnum, 0, buf+count, count, (size_t)sent) != sent) { + printf("write failed (%s)\n", cli_errstr(c->tree)); correct = False; } } else { - sent = cli_read(c, fnum, buf_rd+count, count, - sizeof(buf)-count); + sent = cli_read(c->tree, fnum, buf_rd+count, count, + sizeof(buf)-count); if (sent < 0) { printf("read failed offset:%d size:%d (%s)\n", count, sizeof(buf)-count, - cli_errstr(c)); + cli_errstr(c->tree)); correct = False; sent = 0; } @@ -406,8 +406,8 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname) } - if (!cli_close(c, fnum)) { - printf("close failed (%s)\n", cli_errstr(c)); + if (!cli_close(c->tree, fnum)) { + printf("close failed (%s)\n", cli_errstr(c->tree)); correct = False; } @@ -425,23 +425,23 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2) BOOL correct = True; ssize_t bytes_read, bytes_written; - if (cli_deltree(c1, lockfname) == -1) { - printf("unlink failed (%s)\n", cli_errstr(c1)); + if (cli_deltree(c1->tree, lockfname) == -1) { + printf("unlink failed (%s)\n", cli_errstr(c1->tree)); } - fnum1 = cli_open(c1, lockfname, O_RDWR | O_CREAT | O_EXCL, + fnum1 = cli_open(c1->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, DENY_NONE); if (fnum1 == -1) { printf("first open read/write of %s failed (%s)\n", - lockfname, cli_errstr(c1)); + lockfname, cli_errstr(c1->tree)); return False; } - fnum2 = cli_open(c2, lockfname, O_RDONLY, + fnum2 = cli_open(c2->tree, lockfname, O_RDONLY, DENY_NONE); if (fnum2 == -1) { printf("second open read-only of %s failed (%s)\n", - lockfname, cli_errstr(c2)); - cli_close(c1, fnum1); + lockfname, cli_errstr(c2->tree)); + cli_close(c1->tree, fnum1); return False; } @@ -456,15 +456,15 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2) generate_random_buffer(buf, buf_size, False); - if ((bytes_written = cli_write(c1, fnum1, 0, buf, 0, buf_size)) != buf_size) { - printf("write failed (%s)\n", cli_errstr(c1)); + if ((bytes_written = cli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) { + printf("write failed (%s)\n", cli_errstr(c1->tree)); printf("wrote %d, expected %d\n", bytes_written, buf_size); correct = False; break; } - if ((bytes_read = cli_read(c2, fnum2, buf_rd, 0, buf_size)) != buf_size) { - printf("read failed (%s)\n", cli_errstr(c2)); + if ((bytes_read = cli_read(c2->tree, fnum2, buf_rd, 0, buf_size)) != buf_size) { + printf("read failed (%s)\n", cli_errstr(c2->tree)); printf("read %d, expected %d\n", bytes_read, buf_size); correct = False; break; @@ -478,17 +478,17 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2) } } - if (!cli_close(c2, fnum2)) { - printf("close failed (%s)\n", cli_errstr(c2)); + if (!cli_close(c2->tree, fnum2)) { + printf("close failed (%s)\n", cli_errstr(c2->tree)); correct = False; } - if (!cli_close(c1, fnum1)) { - printf("close failed (%s)\n", cli_errstr(c1)); + if (!cli_close(c1->tree, fnum1)) { + printf("close failed (%s)\n", cli_errstr(c1->tree)); correct = False; } - if (!cli_unlink(c1, lockfname)) { - printf("unlink failed (%s)\n", cli_errstr(c1)); + if (!cli_unlink(c1->tree, lockfname)) { + printf("unlink failed (%s)\n", cli_errstr(c1->tree)); correct = False; } @@ -685,31 +685,31 @@ static BOOL run_locktest1(int dummy) printf("starting locktest1\n"); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - fnum2 = cli_open(cli1, fname, O_RDWR, DENY_NONE); + fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE); if (fnum2 == -1) { - printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - fnum3 = cli_open(cli2, fname, O_RDWR, DENY_NONE); + fnum3 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE); if (fnum3 == -1) { - printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli2)); + printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); return False; } - if (!cli_lock(cli1, fnum1, 0, 4, 0, WRITE_LOCK)) { - printf("lock1 failed (%s)\n", cli_errstr(cli1)); + if (!cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) { + printf("lock1 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - if (cli_lock(cli2, fnum3, 0, 4, 0, WRITE_LOCK)) { + if (cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)) { printf("lock2 succeeded! This is a locking bug\n"); return False; } else { @@ -721,7 +721,7 @@ static BOOL run_locktest1(int dummy) lock_timeout = (6 + (random() % 20)); printf("Testing lock timeout with timeout=%u\n", lock_timeout); t1 = time(NULL); - if (cli_lock(cli2, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK)) { + if (cli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK)) { printf("lock3 succeeded! This is a locking bug\n"); return False; } else { @@ -736,12 +736,12 @@ static BOOL run_locktest1(int dummy) printf("server slept for %u seconds for a %u second timeout\n", (unsigned int)(t2-t1), lock_timeout); - if (!cli_close(cli1, fnum2)) { - printf("close1 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum2)) { + printf("close1 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - if (cli_lock(cli2, fnum3, 0, 4, 0, WRITE_LOCK)) { + if (cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)) { printf("lock4 succeeded! This is a locking bug\n"); return False; } else { @@ -749,18 +749,18 @@ static BOOL run_locktest1(int dummy) NT_STATUS_FILE_LOCK_CONFLICT)) return False; } - if (!cli_close(cli1, fnum1)) { - printf("close2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close2 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli2, fnum3)) { - printf("close3 failed (%s)\n", cli_errstr(cli2)); + if (!cli_close(cli2->tree, fnum3)) { + printf("close3 failed (%s)\n", cli_errstr(cli2->tree)); return False; } - if (!cli_unlink(cli1, fname)) { - printf("unlink failed (%s)\n", cli_errstr(cli1)); + if (!cli_unlink(cli1->tree, fname)) { + printf("unlink failed (%s)\n", cli_errstr(cli1->tree)); return False; } @@ -801,13 +801,13 @@ static BOOL run_tcon_test(int dummy) printf("starting tcontest\n"); - if (cli_deltree(cli, fname) == -1) { - printf("unlink of %s failed (%s)\n", fname, cli_errstr(cli)); + if (cli_deltree(cli->tree, fname) == -1) { + printf("unlink of %s failed (%s)\n", fname, cli_errstr(cli->tree)); } - fnum1 = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum1 = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree)); return False; } @@ -815,8 +815,8 @@ static BOOL run_tcon_test(int dummy) vuid1 = cli->session->vuid; memset(&buf, 0, 4); /* init buf so valgrind won't complain */ - if (cli_write(cli, fnum1, 0, buf, 130, 4) != 4) { - printf("initial write failed (%s)\n", cli_errstr(cli)); + if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) != 4) { + printf("initial write failed (%s)\n", cli_errstr(cli->tree)); return False; } @@ -824,7 +824,7 @@ static BOOL run_tcon_test(int dummy) if (!cli_send_tconX(cli, share, "?????", password)) { printf("%s refused 2nd tree connect (%s)\n", host, - cli_errstr(cli)); + cli_errstr(cli->tree)); cli_shutdown(cli); return False; } @@ -836,47 +836,47 @@ static BOOL run_tcon_test(int dummy) /* try a write with the wrong tid */ cli->tree->tid = cnum2; - if (cli_write(cli, fnum1, 0, buf, 130, 4) == 4) { + if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { printf("* server allows write with wrong TID\n"); ret = False; } else { - printf("server fails write with wrong TID : %s\n", cli_errstr(cli)); + printf("server fails write with wrong TID : %s\n", cli_errstr(cli->tree)); } /* try a write with an invalid tid */ cli->tree->tid = cnum3; - if (cli_write(cli, fnum1, 0, buf, 130, 4) == 4) { + if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { printf("* server allows write with invalid TID\n"); ret = False; } else { - printf("server fails write with invalid TID : %s\n", cli_errstr(cli)); + printf("server fails write with invalid TID : %s\n", cli_errstr(cli->tree)); } /* try a write with an invalid vuid */ cli->session->vuid = vuid2; cli->tree->tid = cnum1; - if (cli_write(cli, fnum1, 0, buf, 130, 4) == 4) { + if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { printf("* server allows write with invalid VUID\n"); ret = False; } else { - printf("server fails write with invalid VUID : %s\n", cli_errstr(cli)); + printf("server fails write with invalid VUID : %s\n", cli_errstr(cli->tree)); } cli->session->vuid = vuid1; cli->tree->tid = cnum1; - if (!cli_close(cli, fnum1)) { - printf("close failed (%s)\n", cli_errstr(cli)); + if (!cli_close(cli->tree, fnum1)) { + printf("close failed (%s)\n", cli_errstr(cli->tree)); return False; } cli->tree->tid = cnum2; if (!cli_tdis(cli)) { - printf("secondary tdis failed (%s)\n", cli_errstr(cli)); + printf("secondary tdis failed (%s)\n", cli_errstr(cli->tree)); return False; } @@ -922,7 +922,7 @@ static BOOL tcon_devtest(struct cli_state *cli, myshare, devtype); ret = False; } else { - if (NT_STATUS_EQUAL(cli_nt_error(cli), + if (NT_STATUS_EQUAL(cli_nt_error(cli->tree), expected_error)) { ret = True; } else { @@ -1023,40 +1023,40 @@ static BOOL run_locktest2(int dummy) printf("starting locktest2\n"); - cli_unlink(cli, fname); + cli_unlink(cli->tree, fname); printf("Testing pid context\n"); cli->session->pid = 1; - fnum1 = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum1 = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree)); return False; } - fnum2 = cli_open(cli, fname, O_RDWR, DENY_NONE); + fnum2 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE); if (fnum2 == -1) { - printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli)); + printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli->tree)); return False; } cli->session->pid = 2; - fnum3 = cli_open(cli, fname, O_RDWR, DENY_NONE); + fnum3 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE); if (fnum3 == -1) { - printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli)); + printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli->tree)); return False; } cli->session->pid = 1; - if (!cli_lock(cli, fnum1, 0, 4, 0, WRITE_LOCK)) { - printf("lock1 failed (%s)\n", cli_errstr(cli)); + if (!cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK)) { + printf("lock1 failed (%s)\n", cli_errstr(cli->tree)); return False; } - if (cli_lock(cli, fnum1, 0, 4, 0, WRITE_LOCK)) { + if (cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK)) { printf("WRITE lock1 succeeded! This is a locking bug\n"); correct = False; } else { @@ -1064,7 +1064,7 @@ static BOOL run_locktest2(int dummy) NT_STATUS_LOCK_NOT_GRANTED)) return False; } - if (cli_lock(cli, fnum2, 0, 4, 0, WRITE_LOCK)) { + if (cli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK)) { printf("WRITE lock2 succeeded! This is a locking bug\n"); correct = False; } else { @@ -1072,7 +1072,7 @@ static BOOL run_locktest2(int dummy) NT_STATUS_LOCK_NOT_GRANTED)) return False; } - if (cli_lock(cli, fnum2, 0, 4, 0, READ_LOCK)) { + if (cli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK)) { printf("READ lock2 succeeded! This is a locking bug\n"); correct = False; } else { @@ -1080,18 +1080,18 @@ static BOOL run_locktest2(int dummy) NT_STATUS_FILE_LOCK_CONFLICT)) return False; } - if (!cli_lock(cli, fnum1, 100, 4, 0, WRITE_LOCK)) { - printf("lock at 100 failed (%s)\n", cli_errstr(cli)); + if (!cli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK)) { + printf("lock at 100 failed (%s)\n", cli_errstr(cli->tree)); } cli->session->pid = 2; - if (cli_unlock(cli, fnum1, 100, 4)) { + if (cli_unlock(cli->tree, fnum1, 100, 4)) { printf("unlock at 100 succeeded! This is a locking bug\n"); correct = False; } - if (cli_unlock(cli, fnum1, 0, 4)) { + if (cli_unlock(cli->tree, fnum1, 0, 4)) { printf("unlock1 succeeded! This is a locking bug\n"); correct = False; } else { @@ -1100,7 +1100,7 @@ static BOOL run_locktest2(int dummy) NT_STATUS_RANGE_NOT_LOCKED)) return False; } - if (cli_unlock(cli, fnum1, 0, 8)) { + if (cli_unlock(cli->tree, fnum1, 0, 8)) { printf("unlock2 succeeded! This is a locking bug\n"); correct = False; } else { @@ -1109,7 +1109,7 @@ static BOOL run_locktest2(int dummy) NT_STATUS_RANGE_NOT_LOCKED)) return False; } - if (cli_lock(cli, fnum3, 0, 4, 0, WRITE_LOCK)) { + if (cli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK)) { printf("lock3 succeeded! This is a locking bug\n"); correct = False; } else { @@ -1118,18 +1118,18 @@ static BOOL run_locktest2(int dummy) cli->session->pid = 1; - if (!cli_close(cli, fnum1)) { - printf("close1 failed (%s)\n", cli_errstr(cli)); + if (!cli_close(cli->tree, fnum1)) { + printf("close1 failed (%s)\n", cli_errstr(cli->tree)); return False; } - if (!cli_close(cli, fnum2)) { - printf("close2 failed (%s)\n", cli_errstr(cli)); + if (!cli_close(cli->tree, fnum2)) { + printf("close2 failed (%s)\n", cli_errstr(cli->tree)); return False; } - if (!cli_close(cli, fnum3)) { - printf("close3 failed (%s)\n", cli_errstr(cli)); + if (!cli_close(cli->tree, fnum3)) { + printf("close3 failed (%s)\n", cli_errstr(cli->tree)); return False; } @@ -1166,16 +1166,16 @@ static BOOL run_locktest3(int dummy) printf("Testing 32 bit offset ranges\n"); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - fnum2 = cli_open(cli2, fname, O_RDWR, DENY_NONE); + fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE); if (fnum2 == -1) { - printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); return False; } @@ -1183,17 +1183,17 @@ static BOOL run_locktest3(int dummy) for (offset=i=0;i<torture_numops;i++) { NEXT_OFFSET; - if (!cli_lock(cli1, fnum1, offset-1, 1, 0, WRITE_LOCK)) { + if (!cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK)) { printf("lock1 %d failed (%s)\n", i, - cli_errstr(cli1)); + cli_errstr(cli1->tree)); return False; } - if (!cli_lock(cli2, fnum2, offset-2, 1, 0, WRITE_LOCK)) { + if (!cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK)) { printf("lock2 %d failed (%s)\n", i, - cli_errstr(cli1)); + cli_errstr(cli1->tree)); return False; } } @@ -1203,22 +1203,22 @@ static BOOL run_locktest3(int dummy) for (offset=i=0;i<torture_numops;i++) { NEXT_OFFSET; - if (cli_lock(cli1, fnum1, offset-2, 1, 0, WRITE_LOCK)) { + if (cli_lock(cli1->tree, fnum1, offset-2, 1, 0, WRITE_LOCK)) { printf("error: lock1 %d succeeded!\n", i); return False; } - if (cli_lock(cli2, fnum2, offset-1, 1, 0, WRITE_LOCK)) { + if (cli_lock(cli2->tree, fnum2, offset-1, 1, 0, WRITE_LOCK)) { printf("error: lock2 %d succeeded!\n", i); return False; } - if (cli_lock(cli1, fnum1, offset-1, 1, 0, WRITE_LOCK)) { + if (cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK)) { printf("error: lock3 %d succeeded!\n", i); return False; } - if (cli_lock(cli2, fnum2, offset-2, 1, 0, WRITE_LOCK)) { + if (cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK)) { printf("error: lock4 %d succeeded!\n", i); return False; } @@ -1229,33 +1229,33 @@ static BOOL run_locktest3(int dummy) for (offset=i=0;i<torture_numops;i++) { NEXT_OFFSET; - if (!cli_unlock(cli1, fnum1, offset-1, 1)) { + if (!cli_unlock(cli1->tree, fnum1, offset-1, 1)) { printf("unlock1 %d failed (%s)\n", i, - cli_errstr(cli1)); + cli_errstr(cli1->tree)); return False; } - if (!cli_unlock(cli2, fnum2, offset-2, 1)) { + if (!cli_unlock(cli2->tree, fnum2, offset-2, 1)) { printf("unlock2 %d failed (%s)\n", i, - cli_errstr(cli1)); + cli_errstr(cli1->tree)); return False; } } - if (!cli_close(cli1, fnum1)) { - printf("close1 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close1 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli2, fnum2)) { - printf("close2 failed (%s)\n", cli_errstr(cli2)); + if (!cli_close(cli2->tree, fnum2)) { + printf("close2 failed (%s)\n", cli_errstr(cli2->tree)); return False; } - if (!cli_unlink(cli1, fname)) { - printf("unlink failed (%s)\n", cli_errstr(cli1)); + if (!cli_unlink(cli1->tree, fname)) { + printf("unlink failed (%s)\n", cli_errstr(cli1->tree)); return False; } @@ -1294,149 +1294,149 @@ static BOOL run_locktest4(int dummy) printf("starting locktest4\n"); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); - fnum2 = cli_open(cli2, fname, O_RDWR, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE); memset(buf, 0, sizeof(buf)); - if (cli_write(cli1, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) { + if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) { printf("Failed to create file\n"); correct = False; goto fail; } - ret = cli_lock(cli1, fnum1, 0, 4, 0, WRITE_LOCK) && - cli_lock(cli1, fnum1, 2, 4, 0, WRITE_LOCK); + ret = cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK) && + cli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK); EXPECTED(ret, False); printf("the same process %s set overlapping write locks\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 10, 4, 0, READ_LOCK) && - cli_lock(cli1, fnum1, 12, 4, 0, READ_LOCK); + ret = cli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK) && + cli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK); EXPECTED(ret, True); printf("the same process %s set overlapping read locks\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 20, 4, 0, WRITE_LOCK) && - cli_lock(cli2, fnum2, 22, 4, 0, WRITE_LOCK); + ret = cli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK) && + cli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK); EXPECTED(ret, False); printf("a different connection %s set overlapping write locks\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 30, 4, 0, READ_LOCK) && - cli_lock(cli2, fnum2, 32, 4, 0, READ_LOCK); + ret = cli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK) && + cli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK); EXPECTED(ret, True); printf("a different connection %s set overlapping read locks\n", ret?"can":"cannot"); - ret = (cli1->session->pid = 1, cli_lock(cli1, fnum1, 40, 4, 0, WRITE_LOCK)) && - (cli1->session->pid = 2, cli_lock(cli1, fnum1, 42, 4, 0, WRITE_LOCK)); + ret = (cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK)) && + (cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK)); EXPECTED(ret, False); printf("a different pid %s set overlapping write locks\n", ret?"can":"cannot"); - ret = (cli1->session->pid = 1, cli_lock(cli1, fnum1, 50, 4, 0, READ_LOCK)) && - (cli1->session->pid = 2, cli_lock(cli1, fnum1, 52, 4, 0, READ_LOCK)); + ret = (cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK)) && + (cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK)); EXPECTED(ret, True); printf("a different pid %s set overlapping read locks\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 60, 4, 0, READ_LOCK) && - cli_lock(cli1, fnum1, 60, 4, 0, READ_LOCK); + ret = cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK) && + cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK); EXPECTED(ret, True); printf("the same process %s set the same read lock twice\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 70, 4, 0, WRITE_LOCK) && - cli_lock(cli1, fnum1, 70, 4, 0, WRITE_LOCK); + ret = cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK) && + cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK); EXPECTED(ret, False); printf("the same process %s set the same write lock twice\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 80, 4, 0, READ_LOCK) && - cli_lock(cli1, fnum1, 80, 4, 0, WRITE_LOCK); + ret = cli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK) && + cli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK); EXPECTED(ret, False); printf("the same process %s overlay a read lock with a write lock\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 90, 4, 0, WRITE_LOCK) && - cli_lock(cli1, fnum1, 90, 4, 0, READ_LOCK); + ret = cli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK) && + cli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK); EXPECTED(ret, True); printf("the same process %s overlay a write lock with a read lock\n", ret?"can":"cannot"); - ret = (cli1->session->pid = 1, cli_lock(cli1, fnum1, 100, 4, 0, WRITE_LOCK)) && - (cli1->session->pid = 2, cli_lock(cli1, fnum1, 100, 4, 0, READ_LOCK)); + ret = (cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK)) && + (cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK)); EXPECTED(ret, False); printf("a different pid %s overlay a write lock with a read lock\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 110, 4, 0, READ_LOCK) && - cli_lock(cli1, fnum1, 112, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 110, 6); + ret = cli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK) && + cli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK) && + cli_unlock(cli1->tree, fnum1, 110, 6); EXPECTED(ret, False); printf("the same process %s coalesce read locks\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 120, 4, 0, WRITE_LOCK) && - (cli_read(cli2, fnum2, buf, 120, 4) == 4); + ret = cli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK) && + (cli_read(cli2->tree, fnum2, buf, 120, 4) == 4); EXPECTED(ret, False); printf("this server %s strict write locking\n", ret?"doesn't do":"does"); - ret = cli_lock(cli1, fnum1, 130, 4, 0, READ_LOCK) && - (cli_write(cli2, fnum2, 0, buf, 130, 4) == 4); + ret = cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK) && + (cli_write(cli2->tree, fnum2, 0, buf, 130, 4) == 4); EXPECTED(ret, False); printf("this server %s strict read locking\n", ret?"doesn't do":"does"); - ret = cli_lock(cli1, fnum1, 140, 4, 0, READ_LOCK) && - cli_lock(cli1, fnum1, 140, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 140, 4) && - cli_unlock(cli1, fnum1, 140, 4); + ret = cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK) && + cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK) && + cli_unlock(cli1->tree, fnum1, 140, 4) && + cli_unlock(cli1->tree, fnum1, 140, 4); EXPECTED(ret, True); printf("this server %s do recursive read locking\n", ret?"does":"doesn't"); - ret = cli_lock(cli1, fnum1, 150, 4, 0, WRITE_LOCK) && - cli_lock(cli1, fnum1, 150, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 150, 4) && - (cli_read(cli2, fnum2, buf, 150, 4) == 4) && - !(cli_write(cli2, fnum2, 0, buf, 150, 4) == 4) && - cli_unlock(cli1, fnum1, 150, 4); + ret = cli_lock(cli1->tree, fnum1, 150, 4, 0, WRITE_LOCK) && + cli_lock(cli1->tree, fnum1, 150, 4, 0, READ_LOCK) && + cli_unlock(cli1->tree, fnum1, 150, 4) && + (cli_read(cli2->tree, fnum2, buf, 150, 4) == 4) && + !(cli_write(cli2->tree, fnum2, 0, buf, 150, 4) == 4) && + cli_unlock(cli1->tree, fnum1, 150, 4); EXPECTED(ret, True); printf("this server %s do recursive lock overlays\n", ret?"does":"doesn't"); - ret = cli_lock(cli1, fnum1, 160, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 160, 4) && - (cli_write(cli2, fnum2, 0, buf, 160, 4) == 4) && - (cli_read(cli2, fnum2, buf, 160, 4) == 4); + ret = cli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK) && + cli_unlock(cli1->tree, fnum1, 160, 4) && + (cli_write(cli2->tree, fnum2, 0, buf, 160, 4) == 4) && + (cli_read(cli2->tree, fnum2, buf, 160, 4) == 4); EXPECTED(ret, True); printf("the same process %s remove a read lock using write locking\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 170, 4, 0, WRITE_LOCK) && - cli_unlock(cli1, fnum1, 170, 4) && - (cli_write(cli2, fnum2, 0, buf, 170, 4) == 4) && - (cli_read(cli2, fnum2, buf, 170, 4) == 4); + ret = cli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK) && + cli_unlock(cli1->tree, fnum1, 170, 4) && + (cli_write(cli2->tree, fnum2, 0, buf, 170, 4) == 4) && + (cli_read(cli2->tree, fnum2, buf, 170, 4) == 4); EXPECTED(ret, True); printf("the same process %s remove a write lock using read locking\n", ret?"can":"cannot"); - ret = cli_lock(cli1, fnum1, 190, 4, 0, WRITE_LOCK) && - cli_lock(cli1, fnum1, 190, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 190, 4) && - !(cli_write(cli2, fnum2, 0, buf, 190, 4) == 4) && - (cli_read(cli2, fnum2, buf, 190, 4) == 4); + ret = cli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK) && + cli_lock(cli1->tree, fnum1, 190, 4, 0, READ_LOCK) && + cli_unlock(cli1->tree, fnum1, 190, 4) && + !(cli_write(cli2->tree, fnum2, 0, buf, 190, 4) == 4) && + (cli_read(cli2->tree, fnum2, buf, 190, 4) == 4); EXPECTED(ret, True); printf("the same process %s remove the first lock first\n", ret?"does":"doesn't"); - cli_close(cli1, fnum1); - cli_close(cli2, fnum2); - fnum1 = cli_open(cli1, fname, O_RDWR, DENY_NONE); - f = cli_open(cli1, fname, O_RDWR, DENY_NONE); - ret = cli_lock(cli1, fnum1, 0, 8, 0, READ_LOCK) && - cli_lock(cli1, f, 0, 1, 0, READ_LOCK) && - cli_close(cli1, fnum1) && - ((fnum1 = cli_open(cli1, fname, O_RDWR, DENY_NONE)) != -1) && - cli_lock(cli1, fnum1, 7, 1, 0, WRITE_LOCK); - cli_close(cli1, f); - cli_close(cli1, fnum1); + cli_close(cli1->tree, fnum1); + cli_close(cli2->tree, fnum2); + fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE); + f = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE); + ret = cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK) && + cli_lock(cli1->tree, f, 0, 1, 0, READ_LOCK) && + cli_close(cli1->tree, fnum1) && + ((fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE)) != -1) && + cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK); + cli_close(cli1->tree, f); + cli_close(cli1->tree, fnum1); EXPECTED(ret, True); printf("the server %s have the NT byte range lock bug\n", !ret?"does":"doesn't"); fail: - cli_close(cli1, fnum1); - cli_close(cli2, fnum2); - cli_unlink(cli1, fname); + cli_close(cli1->tree, fnum1); + cli_close(cli2->tree, fnum2); + cli_unlink(cli1->tree, fname); torture_close_connection(cli1); torture_close_connection(cli2); @@ -1462,56 +1462,56 @@ static BOOL run_locktest5(int dummy) printf("starting locktest5\n"); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); - fnum2 = cli_open(cli2, fname, O_RDWR, DENY_NONE); - fnum3 = cli_open(cli1, fname, O_RDWR, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE); + fnum3 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE); memset(buf, 0, sizeof(buf)); - if (cli_write(cli1, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) { + if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) { printf("Failed to create file\n"); correct = False; goto fail; } /* Check for NT bug... */ - ret = cli_lock(cli1, fnum1, 0, 8, 0, READ_LOCK) && - cli_lock(cli1, fnum3, 0, 1, 0, READ_LOCK); - cli_close(cli1, fnum1); - fnum1 = cli_open(cli1, fname, O_RDWR, DENY_NONE); - ret = cli_lock(cli1, fnum1, 7, 1, 0, WRITE_LOCK); + ret = cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK) && + cli_lock(cli1->tree, fnum3, 0, 1, 0, READ_LOCK); + cli_close(cli1->tree, fnum1); + fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE); + ret = cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK); EXPECTED(ret, True); printf("this server %s the NT locking bug\n", ret ? "doesn't have" : "has"); - cli_close(cli1, fnum1); - fnum1 = cli_open(cli1, fname, O_RDWR, DENY_NONE); - cli_unlock(cli1, fnum3, 0, 1); + cli_close(cli1->tree, fnum1); + fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE); + cli_unlock(cli1->tree, fnum3, 0, 1); - ret = cli_lock(cli1, fnum1, 0, 4, 0, WRITE_LOCK) && - cli_lock(cli1, fnum1, 1, 1, 0, READ_LOCK); + ret = cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK) && + cli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK); EXPECTED(ret, True); printf("the same process %s overlay a write with a read lock\n", ret?"can":"cannot"); - ret = cli_lock(cli2, fnum2, 0, 4, 0, READ_LOCK); + ret = cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK); EXPECTED(ret, False); printf("a different processs %s get a read lock on the first process lock stack\n", ret?"can":"cannot"); /* Unlock the process 2 lock. */ - cli_unlock(cli2, fnum2, 0, 4); + cli_unlock(cli2->tree, fnum2, 0, 4); - ret = cli_lock(cli1, fnum3, 0, 4, 0, READ_LOCK); + ret = cli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK); EXPECTED(ret, False); printf("the same processs on a different fnum %s get a read lock\n", ret?"can":"cannot"); /* Unlock the process 1 fnum3 lock. */ - cli_unlock(cli1, fnum3, 0, 4); + cli_unlock(cli1->tree, fnum3, 0, 4); /* Stack 2 more locks here. */ - ret = cli_lock(cli1, fnum1, 0, 4, 0, READ_LOCK) && - cli_lock(cli1, fnum1, 0, 4, 0, READ_LOCK); + ret = cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK) && + cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK); EXPECTED(ret, True); printf("the same process %s stack read locks\n", ret?"can":"cannot"); @@ -1519,40 +1519,40 @@ static BOOL run_locktest5(int dummy) /* Unlock the first process lock, then check this was the WRITE lock that was removed. */ - ret = cli_unlock(cli1, fnum1, 0, 4) && - cli_lock(cli2, fnum2, 0, 4, 0, READ_LOCK); + ret = cli_unlock(cli1->tree, fnum1, 0, 4) && + cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK); EXPECTED(ret, True); printf("the first unlock removes the %s lock\n", ret?"WRITE":"READ"); /* Unlock the process 2 lock. */ - cli_unlock(cli2, fnum2, 0, 4); + cli_unlock(cli2->tree, fnum2, 0, 4); /* We should have 3 stacked locks here. Ensure we need to do 3 unlocks. */ - ret = cli_unlock(cli1, fnum1, 1, 1) && - cli_unlock(cli1, fnum1, 0, 4) && - cli_unlock(cli1, fnum1, 0, 4); + ret = cli_unlock(cli1->tree, fnum1, 1, 1) && + cli_unlock(cli1->tree, fnum1, 0, 4) && + cli_unlock(cli1->tree, fnum1, 0, 4); EXPECTED(ret, True); printf("the same process %s unlock the stack of 4 locks\n", ret?"can":"cannot"); /* Ensure the next unlock fails. */ - ret = cli_unlock(cli1, fnum1, 0, 4); + ret = cli_unlock(cli1->tree, fnum1, 0, 4); EXPECTED(ret, False); printf("the same process %s count the lock stack\n", !ret?"can":"cannot"); /* Ensure connection 2 can get a write lock. */ - ret = cli_lock(cli2, fnum2, 0, 4, 0, WRITE_LOCK); + ret = cli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK); EXPECTED(ret, True); printf("a different processs %s get a write lock on the unlocked stack\n", ret?"can":"cannot"); fail: - cli_close(cli1, fnum1); - cli_close(cli2, fnum2); - cli_unlink(cli1, fname); + cli_close(cli1->tree, fnum1); + cli_close(cli2->tree, fnum2); + cli_unlink(cli1->tree, fname); if (!torture_close_connection(cli1)) { correct = False; } @@ -1585,19 +1585,19 @@ static BOOL run_locktest6(int dummy) for (i=0;i<1;i++) { printf("Testing %s\n", fname[i]); - cli_unlink(cli, fname[i]); + cli_unlink(cli->tree, fname[i]); - fnum = cli_open(cli, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE); - status = cli_locktype(cli, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE); - cli_close(cli, fnum); + fnum = cli_open(cli->tree, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + status = cli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE); + cli_close(cli->tree, fnum); printf("CHANGE_LOCKTYPE gave %s\n", nt_errstr(status)); - fnum = cli_open(cli, fname[i], O_RDWR, DENY_NONE); - status = cli_locktype(cli, fnum, 0, 8, 0, LOCKING_ANDX_CANCEL_LOCK); - cli_close(cli, fnum); + fnum = cli_open(cli->tree, fname[i], O_RDWR, DENY_NONE); + status = cli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CANCEL_LOCK); + cli_close(cli->tree, fnum); printf("CANCEL_LOCK gave %s\n", nt_errstr(status)); - cli_unlink(cli, fname[i]); + cli_unlink(cli->tree, fname[i]); } torture_close_connection(cli); @@ -1620,36 +1620,36 @@ static BOOL run_locktest7(int dummy) printf("starting locktest7\n"); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); memset(buf, 0, sizeof(buf)); - if (cli_write(cli1, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) { + if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) { printf("Failed to create file\n"); goto fail; } cli1->session->pid = 1; - if (!cli_lock(cli1, fnum1, 130, 4, 0, READ_LOCK)) { - printf("Unable to apply read lock on range 130:4, error was %s\n", cli_errstr(cli1)); + if (!cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) { + printf("Unable to apply read lock on range 130:4, error was %s\n", cli_errstr(cli1->tree)); goto fail; } else { printf("pid1 successfully locked range 130:4 for READ\n"); } - if (cli_read(cli1, fnum1, buf, 130, 4) != 4) { - printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1)); + if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) { + printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree)); goto fail; } else { printf("pid1 successfully read the range 130:4\n"); } - if (cli_write(cli1, fnum1, 0, buf, 130, 4) != 4) { - printf("pid1 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1)); - if (NT_STATUS_V(cli_nt_error(cli1)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) { + if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) { + printf("pid1 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree)); + if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) { printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n"); goto fail; } @@ -1660,15 +1660,15 @@ static BOOL run_locktest7(int dummy) cli1->session->pid = 2; - if (cli_read(cli1, fnum1, buf, 130, 4) != 4) { - printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1)); + if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) { + printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree)); } else { printf("pid2 successfully read the range 130:4\n"); } - if (cli_write(cli1, fnum1, 0, buf, 130, 4) != 4) { - printf("pid2 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1)); - if (NT_STATUS_V(cli_nt_error(cli1)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) { + if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) { + printf("pid2 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree)); + if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) { printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n"); goto fail; } @@ -1678,24 +1678,24 @@ static BOOL run_locktest7(int dummy) } cli1->session->pid = 1; - cli_unlock(cli1, fnum1, 130, 4); + cli_unlock(cli1->tree, fnum1, 130, 4); - if (!cli_lock(cli1, fnum1, 130, 4, 0, WRITE_LOCK)) { - printf("Unable to apply write lock on range 130:4, error was %s\n", cli_errstr(cli1)); + if (!cli_lock(cli1->tree, fnum1, 130, 4, 0, WRITE_LOCK)) { + printf("Unable to apply write lock on range 130:4, error was %s\n", cli_errstr(cli1->tree)); goto fail; } else { printf("pid1 successfully locked range 130:4 for WRITE\n"); } - if (cli_read(cli1, fnum1, buf, 130, 4) != 4) { - printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1)); + if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) { + printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree)); goto fail; } else { printf("pid1 successfully read the range 130:4\n"); } - if (cli_write(cli1, fnum1, 0, buf, 130, 4) != 4) { - printf("pid1 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1)); + if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) { + printf("pid1 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree)); goto fail; } else { printf("pid1 successfully wrote to the range 130:4\n"); @@ -1703,9 +1703,9 @@ static BOOL run_locktest7(int dummy) cli1->session->pid = 2; - if (cli_read(cli1, fnum1, buf, 130, 4) != 4) { - printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1)); - if (NT_STATUS_V(cli_nt_error(cli1)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) { + if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) { + printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree)); + if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) { printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n"); goto fail; } @@ -1714,9 +1714,9 @@ static BOOL run_locktest7(int dummy) goto fail; } - if (cli_write(cli1, fnum1, 0, buf, 130, 4) != 4) { - printf("pid2 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1)); - if (NT_STATUS_V(cli_nt_error(cli1)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) { + if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) { + printf("pid2 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree)); + if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) { printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n"); goto fail; } @@ -1725,12 +1725,12 @@ static BOOL run_locktest7(int dummy) goto fail; } - cli_unlock(cli1, fnum1, 130, 0); + cli_unlock(cli1->tree, fnum1, 130, 0); correct = True; fail: - cli_close(cli1, fnum1); - cli_unlink(cli1, fname); + cli_close(cli1->tree, fnum1); + cli_unlink(cli1->tree, fname); torture_close_connection(cli1); printf("finished locktest7\n"); @@ -1754,20 +1754,20 @@ static BOOL run_fdpasstest(int dummy) printf("starting fdpasstest\n"); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); printf("Opening a file on connection 1\n"); - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } printf("writing to file on connection 1\n"); - if (cli_write(cli1, fnum1, 0, "hello world\n", 0, 13) != 13) { - printf("write failed (%s)\n", cli_errstr(cli1)); + if (cli_write(cli1->tree, fnum1, 0, "hello world\n", 0, 13) != 13) { + printf("write failed (%s)\n", cli_errstr(cli1->tree)); return False; } @@ -1778,14 +1778,14 @@ static BOOL run_fdpasstest(int dummy) printf("reading from file on connection 2\n"); - if (cli_read(cli2, fnum1, buf, 0, 13) == 13) { + if (cli_read(cli2->tree, fnum1, buf, 0, 13) == 13) { printf("read succeeded! nasty security hole [%s]\n", buf); return False; } - cli_close(cli1, fnum1); - cli_unlink(cli1, fname); + cli_close(cli1->tree, fnum1); + cli_unlink(cli1->tree, fname); cli2->tree->tid = oldtid; @@ -1815,21 +1815,21 @@ static BOOL run_unlinktest(int dummy) printf("starting unlink test\n"); - cli_unlink(cli, fname); + cli_unlink(cli->tree, fname); cli->session->pid = 1; printf("Opening a file\n"); - fnum = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree)); return False; } printf("Unlinking a open file\n"); - if (cli_unlink(cli, fname)) { + if (cli_unlink(cli->tree, fname)) { printf("error: server allowed unlink on an open file\n"); correct = False; } else { @@ -1837,8 +1837,8 @@ static BOOL run_unlinktest(int dummy) NT_STATUS_SHARING_VIOLATION); } - cli_close(cli, fnum); - cli_unlink(cli, fname); + cli_close(cli->tree, fnum); + cli_unlink(cli->tree, fname); if (!torture_close_connection(cli)) { correct = False; @@ -1873,11 +1873,11 @@ static BOOL run_maxfidtest(int dummy) for (i=0; i<0x11000; i++) { asprintf(&fname, template, i,(int)getpid()); - if ((fnums[i] = cli_open(cli, fname, + if ((fnums[i] = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) == -1) { printf("open of %s failed (%s)\n", - fname, cli_errstr(cli)); + fname, cli_errstr(cli->tree)); printf("maximum fnum is %d\n", i); break; } @@ -1890,12 +1890,12 @@ static BOOL run_maxfidtest(int dummy) printf("cleaning up\n"); for (;i>=0;i--) { asprintf(&fname, template, i,(int)getpid()); - if (!cli_close(cli, fnums[i])) { - printf("Close of fnum %d failed - %s\n", fnums[i], cli_errstr(cli)); + if (!cli_close(cli->tree, fnums[i])) { + printf("Close of fnum %d failed - %s\n", fnums[i], cli_errstr(cli->tree)); } - if (!cli_unlink(cli, fname)) { + if (!cli_unlink(cli->tree, fname)) { printf("unlink of %s failed (%s)\n", - fname, cli_errstr(cli)); + fname, cli_errstr(cli->tree)); correct = False; } free(fname); @@ -1957,13 +1957,13 @@ static BOOL run_attrtest(int dummy) return False; } - cli_unlink(cli, fname); - fnum = cli_open(cli, fname, + cli_unlink(cli->tree, fname); + fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); - cli_close(cli, fnum); + cli_close(cli->tree, fnum); - if (!cli_getatr(cli, fname, NULL, NULL, &t)) { - printf("getatr failed (%s)\n", cli_errstr(cli)); + if (!cli_getatr(cli->tree, fname, NULL, NULL, &t)) { + printf("getatr failed (%s)\n", cli_errstr(cli->tree)); correct = False; } @@ -1980,13 +1980,13 @@ static BOOL run_attrtest(int dummy) printf("Setting file time to %s", ctime(&t2)); - if (!cli_setatr(cli, fname, 0, t2)) { - printf("setatr failed (%s)\n", cli_errstr(cli)); + if (!cli_setatr(cli->tree, fname, 0, t2)) { + printf("setatr failed (%s)\n", cli_errstr(cli->tree)); correct = True; } - if (!cli_getatr(cli, fname, NULL, NULL, &t)) { - printf("getatr failed (%s)\n", cli_errstr(cli)); + if (!cli_getatr(cli->tree, fname, NULL, NULL, &t)) { + printf("getatr failed (%s)\n", cli_errstr(cli->tree)); correct = True; } @@ -1999,7 +1999,7 @@ static BOOL run_attrtest(int dummy) correct = True; } - cli_unlink(cli, fname); + cli_unlink(cli->tree, fname); if (!torture_close_connection(cli)) { correct = False; @@ -2032,22 +2032,22 @@ static BOOL run_trans2test(int dummy) return False; } - cli_unlink(cli, fname); + cli_unlink(cli->tree, fname); printf("Testing qfileinfo\n"); - fnum = cli_open(cli, fname, + fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); - if (!cli_qfileinfo(cli, fnum, NULL, &size, &c_time, &a_time, &m_time, + if (!cli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time, NULL, NULL)) { - printf("ERROR: qfileinfo failed (%s)\n", cli_errstr(cli)); + printf("ERROR: qfileinfo failed (%s)\n", cli_errstr(cli->tree)); correct = False; } printf("Testing NAME_INFO\n"); - if (!cli_qfilename(cli, fnum, &pname)) { - printf("ERROR: qfilename failed (%s)\n", cli_errstr(cli)); + if (!cli_qfilename(cli->tree, fnum, &pname)) { + printf("ERROR: qfilename failed (%s)\n", cli_errstr(cli->tree)); correct = False; } @@ -2057,21 +2057,21 @@ static BOOL run_trans2test(int dummy) correct = False; } - cli_close(cli, fnum); - cli_unlink(cli, fname); + cli_close(cli->tree, fnum); + cli_unlink(cli->tree, fname); - fnum = cli_open(cli, fname, + fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); if (fnum == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree)); return False; } - cli_close(cli, fnum); + cli_close(cli->tree, fnum); printf("Checking for sticky create times\n"); - if (!cli_qpathinfo(cli, fname, &c_time, &a_time, &m_time, &size, NULL)) { - printf("ERROR: qpathinfo failed (%s)\n", cli_errstr(cli)); + if (!cli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL)) { + printf("ERROR: qpathinfo failed (%s)\n", cli_errstr(cli->tree)); correct = False; } else { if (c_time != m_time) { @@ -2092,13 +2092,13 @@ static BOOL run_trans2test(int dummy) } - cli_unlink(cli, fname); - fnum = cli_open(cli, fname, + cli_unlink(cli->tree, fname); + fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); - cli_close(cli, fnum); - if (!cli_qpathinfo2(cli, fname, &c_time, &a_time, &m_time, + cli_close(cli->tree, fnum); + if (!cli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL)) { - printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli)); + printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree)); correct = False; } else { if (w_time < 60*60*24*2) { @@ -2108,29 +2108,29 @@ static BOOL run_trans2test(int dummy) } } - cli_unlink(cli, fname); + cli_unlink(cli->tree, fname); /* check if the server updates the directory modification time when creating a new file */ - if (!cli_mkdir(cli, dname)) { - printf("ERROR: mkdir failed (%s)\n", cli_errstr(cli)); + if (!cli_mkdir(cli->tree, dname)) { + printf("ERROR: mkdir failed (%s)\n", cli_errstr(cli->tree)); correct = False; } sleep(3); - if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &m_time, + if (!cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL)) { - printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli)); + printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree)); correct = False; } - fnum = cli_open(cli, fname2, + fnum = cli_open(cli->tree, fname2, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); - cli_write(cli, fnum, 0, (char *)&fnum, 0, sizeof(fnum)); - cli_close(cli, fnum); - if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &m_time2, + cli_write(cli->tree, fnum, 0, (char *)&fnum, 0, sizeof(fnum)); + cli_close(cli->tree, fnum); + if (!cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL)) { - printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli)); + printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree)); correct = False; } else { if (m_time2 == m_time) { @@ -2138,8 +2138,8 @@ static BOOL run_trans2test(int dummy) correct = False; } } - cli_unlink(cli, fname2); - cli_rmdir(cli, dname); + cli_unlink(cli->tree, fname2); + cli_rmdir(cli->tree, dname); if (!torture_close_connection(cli)) { correct = False; @@ -2170,26 +2170,26 @@ static BOOL run_deletetest(int dummy) /* Test 1 - this should delete the file on close. */ - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF, NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0); if (fnum1 == -1) { - printf("[1] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[1] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_close(cli1, fnum1)) { - printf("[1] close failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[1] close failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } - fnum1 = cli_open(cli1, fname, O_RDWR, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE); if (fnum1 != -1) { printf("[1] open of %s succeeded (should fail)\n", fname); correct = False; @@ -2200,52 +2200,52 @@ static BOOL run_deletetest(int dummy) /* Test 2 - this should delete the file on close. */ - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("[2] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[2] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_nt_delete_on_close(cli1, fnum1, True)) { - printf("[2] setting delete_on_close failed (%s)\n", cli_errstr(cli1)); + if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) { + printf("[2] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_close(cli1, fnum1)) { - printf("[2] close failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[2] close failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } - fnum1 = cli_open(cli1, fname, O_RDONLY, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE); if (fnum1 != -1) { printf("[2] open of %s succeeded should have been deleted on close !\n", fname); - if (!cli_close(cli1, fnum1)) { - printf("[2] close failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[2] close failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); } else printf("second delete on close test succeeded.\n"); /* Test 3 - ... */ - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("[3] open - 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[3] open - 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } @@ -2253,7 +2253,7 @@ static BOOL run_deletetest(int dummy) /* This should fail with a sharing violation - open for delete is only compatible with SHARE_DELETE. */ - fnum2 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OPEN, 0, 0); @@ -2265,52 +2265,52 @@ static BOOL run_deletetest(int dummy) /* This should succeed. */ - fnum2 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN, 0, 0); if (fnum2 == -1) { - printf("[3] open - 2 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[3] open - 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_nt_delete_on_close(cli1, fnum1, True)) { - printf("[3] setting delete_on_close failed (%s)\n", cli_errstr(cli1)); + if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) { + printf("[3] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_close(cli1, fnum1)) { - printf("[3] close 1 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[3] close 1 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_close(cli1, fnum2)) { - printf("[3] close 2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum2)) { + printf("[3] close 2 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } /* This should fail - file should no longer be there. */ - fnum1 = cli_open(cli1, fname, O_RDONLY, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE); if (fnum1 != -1) { printf("[3] open of %s succeeded should have been deleted on close !\n", fname); - if (!cli_close(cli1, fnum1)) { - printf("[3] close failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[3] close failed (%s)\n", cli_errstr(cli1->tree)); } - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); correct = False; goto fail; } else printf("third delete on close test succeeded.\n"); /* Test 4 ... */ - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA | SA_RIGHT_FILE_WRITE_DATA | STD_RIGHT_DELETE_ACCESS, @@ -2319,38 +2319,38 @@ static BOOL run_deletetest(int dummy) NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("[4] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[4] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } /* This should succeed. */ - fnum2 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_READ, + fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE | NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN, 0, 0); if (fnum2 == -1) { - printf("[4] open - 2 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[4] open - 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_close(cli1, fnum2)) { - printf("[4] close - 1 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum2)) { + printf("[4] close - 1 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_nt_delete_on_close(cli1, fnum1, True)) { - printf("[4] setting delete_on_close failed (%s)\n", cli_errstr(cli1)); + if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) { + printf("[4] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } /* This should fail - no more opens once delete on close set. */ - fnum2 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_READ, + fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN, 0, 0); if (fnum2 != -1) { @@ -2360,33 +2360,33 @@ static BOOL run_deletetest(int dummy) } else printf("fourth delete on close test succeeded.\n"); - if (!cli_close(cli1, fnum1)) { - printf("[4] close - 2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[4] close - 2 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } /* Test 5 ... */ - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { - printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } /* This should fail - only allowed on NT opens with DELETE access. */ - if (cli_nt_delete_on_close(cli1, fnum1, True)) { + if (cli_nt_delete_on_close(cli1->tree, fnum1, True)) { printf("[5] setting delete_on_close on OpenX file succeeded - should fail !\n"); correct = False; goto fail; } - if (!cli_close(cli1, fnum1)) { - printf("[5] close - 2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[5] close - 2 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } @@ -2394,10 +2394,10 @@ static BOOL run_deletetest(int dummy) printf("fifth delete on close test succeeded.\n"); /* Test 6 ... */ - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA | SA_RIGHT_FILE_WRITE_DATA, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ | @@ -2406,21 +2406,21 @@ static BOOL run_deletetest(int dummy) NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("[6] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[6] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } /* This should fail - only allowed on NT opens with DELETE access. */ - if (cli_nt_delete_on_close(cli1, fnum1, True)) { + if (cli_nt_delete_on_close(cli1->tree, fnum1, True)) { printf("[6] setting delete_on_close on file with no delete access succeeded - should fail !\n"); correct = False; goto fail; } - if (!cli_close(cli1, fnum1)) { - printf("[6] close - 2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[6] close - 2 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } @@ -2428,50 +2428,50 @@ static BOOL run_deletetest(int dummy) printf("sixth delete on close test succeeded.\n"); /* Test 7 ... */ - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA | SA_RIGHT_FILE_WRITE_DATA | STD_RIGHT_DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL, 0, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("[7] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[7] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_nt_delete_on_close(cli1, fnum1, True)) { + if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) { printf("[7] setting delete_on_close on file failed !\n"); correct = False; goto fail; } - if (!cli_nt_delete_on_close(cli1, fnum1, False)) { + if (!cli_nt_delete_on_close(cli1->tree, fnum1, False)) { printf("[7] unsetting delete_on_close on file failed !\n"); correct = False; goto fail; } - if (!cli_close(cli1, fnum1)) { - printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } /* This next open should succeed - we reset the flag. */ - fnum1 = cli_open(cli1, fname, O_RDONLY, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE); if (fnum1 == -1) { - printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_close(cli1, fnum1)) { - printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } @@ -2479,8 +2479,8 @@ static BOOL run_deletetest(int dummy) printf("seventh delete on close test succeeded.\n"); /* Test 7 ... */ - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); if (!torture_open_connection(&cli2)) { printf("[8] failed to open second connection.\n"); @@ -2488,46 +2488,46 @@ static BOOL run_deletetest(int dummy) goto fail; } - fnum1 = cli_nt_create_full(cli1, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } - fnum2 = cli_nt_create_full(cli2, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS, + fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN, 0, 0); if (fnum2 == -1) { - printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_nt_delete_on_close(cli1, fnum1, True)) { + if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) { printf("[8] setting delete_on_close on file failed !\n"); correct = False; goto fail; } - if (!cli_close(cli1, fnum1)) { - printf("[8] close - 1 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[8] close - 1 failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } - if (!cli_close(cli2, fnum2)) { - printf("[8] close - 2 failed (%s)\n", cli_errstr(cli2)); + if (!cli_close(cli2->tree, fnum2)) { + printf("[8] close - 2 failed (%s)\n", cli_errstr(cli2->tree)); correct = False; goto fail; } /* This should fail.. */ - fnum1 = cli_open(cli1, fname, O_RDONLY, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE); if (fnum1 != -1) { printf("[8] open of %s succeeded should have been deleted on close !\n", fname); goto fail; @@ -2536,7 +2536,7 @@ static BOOL run_deletetest(int dummy) printf("eighth delete on close test succeeded.\n"); /* This should fail - we need to set DELETE_ACCESS. */ - fnum1 = cli_nt_create_full(cli1, fname, 0,SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0,SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0); if (fnum1 != -1) { @@ -2547,23 +2547,23 @@ static BOOL run_deletetest(int dummy) printf("ninth delete on close test succeeded.\n"); - fnum1 = cli_nt_create_full(cli1, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0); if (fnum1 == -1) { - printf("[10] open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("[10] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); correct = False; goto fail; } /* This should delete the file. */ - if (!cli_close(cli1, fnum1)) { - printf("[10] close failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("[10] close failed (%s)\n", cli_errstr(cli1->tree)); correct = False; goto fail; } /* This should fail.. */ - fnum1 = cli_open(cli1, fname, O_RDONLY, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE); if (fnum1 != -1) { printf("[10] open of %s succeeded should have been deleted on close !\n", fname); goto fail; @@ -2577,10 +2577,10 @@ static BOOL run_deletetest(int dummy) * intialized, because these functions don't handle * uninitialized connections. */ - cli_close(cli1, fnum1); - cli_close(cli1, fnum2); - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_close(cli1->tree, fnum1); + cli_close(cli1->tree, fnum2); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); if (!torture_close_connection(cli1)) { correct = False; @@ -2654,22 +2654,22 @@ static BOOL run_xcopy(int dummy) return False; } - fnum1 = cli_nt_create_full(cli1, fname, 0, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0x4044, 0); if (fnum1 == -1) { - printf("First open failed - %s\n", cli_errstr(cli1)); + printf("First open failed - %s\n", cli_errstr(cli1->tree)); return False; } - fnum2 = cli_nt_create_full(cli1, fname, 0, + fnum2 = cli_nt_create_full(cli1->tree, fname, 0, SECOND_DESIRED_ACCESS, 0, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN, 0x200000, 0); if (fnum2 == -1) { - printf("second open failed - %s\n", cli_errstr(cli1)); + printf("second open failed - %s\n", cli_errstr(cli1->tree)); return False; } @@ -2697,31 +2697,31 @@ static BOOL run_rename(int dummy) return False; } - cli_unlink(cli1, fname); - cli_unlink(cli1, fname1); - fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, + cli_unlink(cli1->tree, fname); + cli_unlink(cli1->tree, fname1); + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("First open failed - %s\n", cli_errstr(cli1)); + printf("First open failed - %s\n", cli_errstr(cli1->tree)); return False; } - if (!cli_rename(cli1, fname, fname1)) { - printf("First rename failed (this is correct) - %s\n", cli_errstr(cli1)); + if (!cli_rename(cli1->tree, fname, fname1)) { + printf("First rename failed (this is correct) - %s\n", cli_errstr(cli1->tree)); } else { printf("First rename succeeded - this should have failed !\n"); correct = False; } - if (!cli_close(cli1, fnum1)) { - printf("close - 1 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close - 1 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - cli_unlink(cli1, fname); - cli_unlink(cli1, fname1); - fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, + cli_unlink(cli1->tree, fname); + cli_unlink(cli1->tree, fname1); + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL, #if 0 NTCREATEX_SHARE_ACCESS_DELETE|NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); #else @@ -2729,30 +2729,30 @@ static BOOL run_rename(int dummy) #endif if (fnum1 == -1) { - printf("Second open failed - %s\n", cli_errstr(cli1)); + printf("Second open failed - %s\n", cli_errstr(cli1->tree)); return False; } - if (!cli_rename(cli1, fname, fname1)) { - printf("Second rename failed - this should have succeeded - %s\n", cli_errstr(cli1)); + if (!cli_rename(cli1->tree, fname, fname1)) { + printf("Second rename failed - this should have succeeded - %s\n", cli_errstr(cli1->tree)); correct = False; } else { printf("Second rename succeeded\n"); } - if (!cli_close(cli1, fnum1)) { - printf("close - 2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close - 2 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - cli_unlink(cli1, fname); - cli_unlink(cli1, fname1); + cli_unlink(cli1->tree, fname); + cli_unlink(cli1->tree, fname1); - fnum1 = cli_nt_create_full(cli1, fname, 0, STD_RIGHT_READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("Third open failed - %s\n", cli_errstr(cli1)); + printf("Third open failed - %s\n", cli_errstr(cli1->tree)); return False; } @@ -2761,39 +2761,39 @@ static BOOL run_rename(int dummy) { int fnum2; - fnum2 = cli_nt_create_full(cli1, fname, 0, DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli1->tree, fname, 0, DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum2 == -1) { - printf("Fourth open failed - %s\n", cli_errstr(cli1)); + printf("Fourth open failed - %s\n", cli_errstr(cli1->tree)); return False; } - if (!cli_nt_delete_on_close(cli1, fnum2, True)) { + if (!cli_nt_delete_on_close(cli1->tree, fnum2, True)) { printf("[8] setting delete_on_close on file failed !\n"); return False; } - if (!cli_close(cli1, fnum2)) { - printf("close - 4 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum2)) { + printf("close - 4 failed (%s)\n", cli_errstr(cli1->tree)); return False; } } #endif - if (!cli_rename(cli1, fname, fname1)) { - printf("Third rename failed - this should have succeeded - %s\n", cli_errstr(cli1)); + if (!cli_rename(cli1->tree, fname, fname1)) { + printf("Third rename failed - this should have succeeded - %s\n", cli_errstr(cli1->tree)); correct = False; } else { printf("Third rename succeeded\n"); } - if (!cli_close(cli1, fnum1)) { - printf("close - 3 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close - 3 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - cli_unlink(cli1, fname); - cli_unlink(cli1, fname1); + cli_unlink(cli1->tree, fname); + cli_unlink(cli1->tree, fname1); if (!torture_close_connection(cli1)) { correct = False; @@ -2815,11 +2815,11 @@ static BOOL run_pipe_number(int dummy) } while(1) { - fnum = cli_nt_create_full(cli1, pipe_name, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL, + fnum = cli_nt_create_full(cli1->tree, pipe_name, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OPEN_IF, 0, 0); if (fnum == -1) { - printf("Open of pipe %s failed with error (%s)\n", pipe_name, cli_errstr(cli1)); + printf("Open of pipe %s failed with error (%s)\n", pipe_name, cli_errstr(cli1->tree)); break; } num_pipes++; @@ -2852,35 +2852,35 @@ static BOOL run_pipe_number(int dummy) return False; } - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli1, fnum1)) { - printf("close2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close2 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - if (!cli_setatr(cli1, fname, FILE_ATTRIBUTE_READONLY, 0)) { - printf("cli_setatr failed (%s)\n", cli_errstr(cli1)); + if (!cli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0)) { + printf("cli_setatr failed (%s)\n", cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test1); return False; } - fnum1 = cli_open(cli1, fname, O_RDONLY, DENY_WRITE); + fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE); if (fnum1 == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test1); return False; } /* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */ - fnum2 = cli_open(cli1, fname, O_RDWR, DENY_ALL); + fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_ALL); if (check_error(__LINE__, cli1, ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED)) { @@ -2889,40 +2889,40 @@ static BOOL run_pipe_number(int dummy) printf("finished open test 1\n"); error_test1: - cli_close(cli1, fnum1); + cli_close(cli1->tree, fnum1); /* Now try not readonly and ensure ERRbadshare is returned. */ - cli_setatr(cli1, fname, 0, 0); + cli_setatr(cli1->tree, fname, 0, 0); - fnum1 = cli_open(cli1, fname, O_RDONLY, DENY_WRITE); + fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE); if (fnum1 == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } /* This will fail - but the error should be ERRshare. */ - fnum2 = cli_open(cli1, fname, O_RDWR, DENY_ALL); + fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_ALL); if (check_error(__LINE__, cli1, ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION)) { printf("correct error code ERRDOS/ERRbadshare returned\n"); } - if (!cli_close(cli1, fnum1)) { - printf("close2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close2 failed (%s)\n", cli_errstr(cli1->tree)); return False; } - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); printf("finished open test 2\n"); /* Test truncate open disposition on file opened for read. */ - fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { - printf("(3) open (1) of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("(3) open (1) of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } @@ -2930,19 +2930,19 @@ error_test1: memset(buf, '\0', 20); - if (cli_write(cli1, fnum1, 0, buf, 0, 20) != 20) { - printf("write failed (%s)\n", cli_errstr(cli1)); + if (cli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) { + printf("write failed (%s)\n", cli_errstr(cli1->tree)); correct = False; } - if (!cli_close(cli1, fnum1)) { - printf("(3) close1 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("(3) close1 failed (%s)\n", cli_errstr(cli1->tree)); return False; } /* Ensure size == 20. */ - if (!cli_getatr(cli1, fname, NULL, &fsize, NULL)) { - printf("(3) getatr failed (%s)\n", cli_errstr(cli1)); + if (!cli_getatr(cli1->tree, fname, NULL, &fsize, NULL)) { + printf("(3) getatr failed (%s)\n", cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); return False; } @@ -2955,21 +2955,21 @@ error_test1: /* Now test if we can truncate a file opened for readonly. */ - fnum1 = cli_open(cli1, fname, O_RDONLY|O_TRUNC, DENY_NONE); + fnum1 = cli_open(cli1->tree, fname, O_RDONLY|O_TRUNC, DENY_NONE); if (fnum1 == -1) { - printf("(3) open (2) of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("(3) open (2) of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); return False; } - if (!cli_close(cli1, fnum1)) { - printf("close2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close2 failed (%s)\n", cli_errstr(cli1->tree)); return False; } /* Ensure size == 0. */ - if (!cli_getatr(cli1, fname, NULL, &fsize, NULL)) { - printf("(3) getatr failed (%s)\n", cli_errstr(cli1)); + if (!cli_getatr(cli1->tree, fname, NULL, &fsize, NULL)) { + printf("(3) getatr failed (%s)\n", cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); return False; } @@ -2981,22 +2981,22 @@ error_test1: } printf("finished open test 3\n"); error_test3: - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); printf("testing ctemp\n"); - fnum1 = cli_ctemp(cli1, "\\", &tmp_path); + fnum1 = cli_ctemp(cli1->tree, "\\", &tmp_path); if (fnum1 == -1) { - printf("ctemp failed (%s)\n", cli_errstr(cli1)); + printf("ctemp failed (%s)\n", cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test4); return False; } printf("ctemp gave path %s\n", tmp_path); - if (!cli_close(cli1, fnum1)) { - printf("close of temp failed (%s)\n", cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close of temp failed (%s)\n", cli_errstr(cli1->tree)); } - if (!cli_unlink(cli1, tmp_path)) { - printf("unlink of temp failed (%s)\n", cli_errstr(cli1)); + if (!cli_unlink(cli1->tree, tmp_path)) { + printf("unlink of temp failed (%s)\n", cli_errstr(cli1->tree)); } error_test4: /* Test the non-io opens... */ @@ -3005,165 +3005,165 @@ error_test4: return False; } - cli_setatr(cli2, fname, 0, 0); - cli_unlink(cli2, fname); + cli_setatr(cli2->tree, fname, 0, 0); + cli_unlink(cli2->tree, fname); printf("TEST #1 testing 2 non-io opens (no delete)\n"); - fnum1 = cli_nt_create_full(cli1, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("test 1 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("test 1 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test10); return False; } - fnum2 = cli_nt_create_full(cli2, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0); if (fnum2 == -1) { - printf("test 1 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + printf("test 1 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test10); return False; } - if (!cli_close(cli1, fnum1)) { - printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli2, fnum2)) { - printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + if (!cli_close(cli2->tree, fnum2)) { + printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); return False; } printf("non-io open test #1 passed.\n"); error_test10: - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); printf("TEST #2 testing 2 non-io opens (first with delete)\n"); - fnum1 = cli_nt_create_full(cli1, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("test 2 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("test 2 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test20); return False; } - fnum2 = cli_nt_create_full(cli2, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0); if (fnum2 == -1) { - printf("test 2 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + printf("test 2 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test20); return False; } - if (!cli_close(cli1, fnum1)) { - printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli2, fnum2)) { - printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli1)); + if (!cli_close(cli2->tree, fnum2)) { + printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } printf("non-io open test #2 passed.\n"); error_test20: - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); printf("TEST #3 testing 2 non-io opens (second with delete)\n"); - fnum1 = cli_nt_create_full(cli1, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("test 3 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("test 3 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test30); return False; } - fnum2 = cli_nt_create_full(cli2, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0); if (fnum2 == -1) { - printf("test 3 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + printf("test 3 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test30); return False; } - if (!cli_close(cli1, fnum1)) { - printf("test 3 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("test 3 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli2, fnum2)) { - printf("test 3 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + if (!cli_close(cli2->tree, fnum2)) { + printf("test 3 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); return False; } printf("non-io open test #3 passed.\n"); error_test30: - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); printf("TEST #4 testing 2 non-io opens (both with delete)\n"); - fnum1 = cli_nt_create_full(cli1, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("test 4 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("test 4 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test40); return False; } - fnum2 = cli_nt_create_full(cli2, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0); if (fnum2 != -1) { - printf("test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2)); + printf("test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test40); return False; } - printf("test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2), "sharing violation"); + printf("test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2->tree), "sharing violation"); - if (!cli_close(cli1, fnum1)) { - printf("test 4 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("test 4 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } printf("non-io open test #4 passed.\n"); error_test40: - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); printf("TEST #5 testing 2 non-io opens (both with delete - both with file share delete)\n"); - fnum1 = cli_nt_create_full(cli1, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("test 5 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("test 5 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test50); return False; } - fnum2 = cli_nt_create_full(cli2, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN_IF, 0, 0); if (fnum2 == -1) { - printf("test 5 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + printf("test 5 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test50); return False; } - if (!cli_close(cli1, fnum1)) { - printf("test 5 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("test 5 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli2, fnum2)) { - printf("test 5 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + if (!cli_close(cli2->tree, fnum2)) { + printf("test 5 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); return False; } @@ -3171,33 +3171,33 @@ error_test40: error_test50: printf("TEST #6 testing 1 non-io open, one io open\n"); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("test 6 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("test 6 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test60); return False; } - fnum2 = cli_nt_create_full(cli2, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ, NTCREATEX_DISP_OPEN_IF, 0, 0); if (fnum2 == -1) { - printf("test 6 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + printf("test 6 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test60); return False; } - if (!cli_close(cli1, fnum1)) { - printf("test 6 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("test 6 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli2, fnum2)) { - printf("test 6 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2)); + if (!cli_close(cli2->tree, fnum2)) { + printf("test 6 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree)); return False; } @@ -3205,36 +3205,36 @@ error_test50: error_test60: printf("TEST #7 testing 1 non-io open, one io open with delete\n"); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("test 7 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + printf("test 7 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test70); return False; } - fnum2 = cli_nt_create_full(cli2, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, + fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN_IF, 0, 0); if (fnum2 != -1) { - printf("test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2)); + printf("test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test70); return False; } - printf("test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2), "sharing violation"); + printf("test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2->tree), "sharing violation"); - if (!cli_close(cli1, fnum1)) { - printf("test 7 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("test 7 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree)); return False; } printf("non-io open test #7 passed.\n"); error_test70: - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); if (!torture_close_connection(cli1)) { correct = False; @@ -3320,23 +3320,23 @@ static BOOL run_openattrtest(int dummy) } for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32); i++) { - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); - fnum1 = cli_nt_create_full(cli1, fname, 0, SA_RIGHT_FILE_WRITE_DATA, open_attrs_table[i], + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_WRITE_DATA, open_attrs_table[i], NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum1 == -1) { - printf("open %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1)); + printf("open %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1->tree)); return False; } - if (!cli_close(cli1, fnum1)) { - printf("close %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1->tree)); return False; } for (j = 0; j < ARRAY_SIZE(open_attrs_table); j++) { - fnum1 = cli_nt_create_full(cli1, fname, 0, + fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA, open_attrs_table[j], NTCREATEX_SHARE_ACCESS_NONE, @@ -3348,15 +3348,15 @@ static BOOL run_openattrtest(int dummy) printf("[%d] trunc open 0x%x -> 0x%x of %s failed - should have succeeded !(0x%x:%s)\n", k, open_attrs_table[i], open_attrs_table[j], - fname, NT_STATUS_V(cli_nt_error(cli1)), cli_errstr(cli1)); + fname, NT_STATUS_V(cli_nt_error(cli1->tree)), cli_errstr(cli1->tree)); correct = False; CHECK_MAX_FAILURES(error_exit); } } - if (NT_STATUS_V(cli_nt_error(cli1)) != NT_STATUS_V(NT_STATUS_ACCESS_DENIED)) { + if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_ACCESS_DENIED)) { printf("[%d] trunc open 0x%x -> 0x%x failed with wrong error code %s\n", k, open_attrs_table[i], open_attrs_table[j], - cli_errstr(cli1)); + cli_errstr(cli1->tree)); correct = False; CHECK_MAX_FAILURES(error_exit); } @@ -3367,13 +3367,13 @@ static BOOL run_openattrtest(int dummy) continue; } - if (!cli_close(cli1, fnum1)) { - printf("close %d (2) of %s failed (%s)\n", j, fname, cli_errstr(cli1)); + if (!cli_close(cli1->tree, fnum1)) { + printf("close %d (2) of %s failed (%s)\n", j, fname, cli_errstr(cli1->tree)); return False; } - if (!cli_getatr(cli1, fname, &attr, NULL, NULL)) { - printf("getatr(2) failed (%s)\n", cli_errstr(cli1)); + if (!cli_getatr(cli1->tree, fname, &attr, NULL, NULL)) { + printf("getatr(2) failed (%s)\n", cli_errstr(cli1->tree)); return False; } @@ -3402,8 +3402,8 @@ static BOOL run_openattrtest(int dummy) } } error_exit: - cli_setatr(cli1, fname, 0, 0); - cli_unlink(cli1, fname); + cli_setatr(cli1->tree, fname, 0, 0); + cli_unlink(cli1->tree, fname); printf("open attr test %s.\n", correct ? "passed" : "failed"); @@ -3441,20 +3441,20 @@ static BOOL run_dirtest(int dummy) for (i=0;i<torture_numops;i++) { char *fname; asprintf(&fname, "\\%x", (int)random()); - 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) { fprintf(stderr,"Failed to open %s\n", fname); return False; } - cli_close(cli, fnum); + cli_close(cli->tree, fnum); free(fname); } t1 = end_timer(); - printf("Matched %d\n", cli_list(cli, "a*.*", 0, list_fn, NULL)); - printf("Matched %d\n", cli_list(cli, "b*.*", 0, list_fn, NULL)); - printf("Matched %d\n", cli_list(cli, "xyzabc", 0, list_fn, NULL)); + printf("Matched %d\n", cli_list(cli->tree, "a*.*", 0, list_fn, NULL)); + printf("Matched %d\n", cli_list(cli->tree, "b*.*", 0, list_fn, NULL)); + printf("Matched %d\n", cli_list(cli->tree, "xyzabc", 0, list_fn, NULL)); printf("dirtest core %g seconds\n", end_timer() - t1); @@ -3462,7 +3462,7 @@ static BOOL run_dirtest(int dummy) for (i=0;i<torture_numops;i++) { char *fname; asprintf(&fname, "\\%x", (int)random()); - cli_unlink(cli, fname); + cli_unlink(cli->tree, fname); free(fname); } @@ -3485,11 +3485,11 @@ static void del_fn(file_info *finfo, const char *mask, void *state) return; if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) { - if (!cli_rmdir(pcli, fname)) - printf("del_fn: failed to rmdir %s, error=%s\n", fname, cli_errstr(pcli) ); + if (!cli_rmdir(pcli->tree, fname)) + printf("del_fn: failed to rmdir %s, error=%s\n", fname, cli_errstr(pcli->tree) ); } else { - if (!cli_unlink(pcli, fname)) - printf("del_fn: failed to unlink %s, error=%s\n", fname, cli_errstr(pcli) ); + if (!cli_unlink(pcli->tree, fname)) + printf("del_fn: failed to unlink %s, error=%s\n", fname, cli_errstr(pcli->tree) ); } free(fname); } @@ -3516,18 +3516,18 @@ BOOL torture_ioctl_test(int dummy) printf("starting ioctl test\n"); - cli_unlink(cli, fname); + cli_unlink(cli->tree, fname); - fnum = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { - printf("open of %s failed (%s)\n", fname, cli_errstr(cli)); + printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree)); return False; } parms.ioctl.level = RAW_IOCTL_IOCTL; parms.ioctl.in.request = IOCTL_QUERY_JOB_INFO; status = smb_raw_ioctl(cli->tree, mem_ctx, &parms); - printf("ioctl job info: %s\n", cli_errstr(cli)); + printf("ioctl job info: %s\n", cli_errstr(cli->tree)); for (device=0;device<0x100;device++) { printf("testing device=0x%x\n", device); @@ -3568,38 +3568,38 @@ BOOL torture_chkpath_test(int dummy) printf("Testing valid and invalid paths\n"); /* cleanup from an old run */ - cli_rmdir(cli, "\\chkpath.dir\\dir2"); - cli_unlink(cli, "\\chkpath.dir\\*"); - cli_rmdir(cli, "\\chkpath.dir"); + cli_rmdir(cli->tree, "\\chkpath.dir\\dir2"); + cli_unlink(cli->tree, "\\chkpath.dir\\*"); + cli_rmdir(cli->tree, "\\chkpath.dir"); - if (!cli_mkdir(cli, "\\chkpath.dir")) { - printf("mkdir1 failed : %s\n", cli_errstr(cli)); + if (!cli_mkdir(cli->tree, "\\chkpath.dir")) { + printf("mkdir1 failed : %s\n", cli_errstr(cli->tree)); return False; } - if (!cli_mkdir(cli, "\\chkpath.dir\\dir2")) { - printf("mkdir2 failed : %s\n", cli_errstr(cli)); + if (!cli_mkdir(cli->tree, "\\chkpath.dir\\dir2")) { + printf("mkdir2 failed : %s\n", cli_errstr(cli->tree)); return False; } - fnum = cli_open(cli, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + fnum = cli_open(cli->tree, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { - printf("open1 failed (%s)\n", cli_errstr(cli)); + printf("open1 failed (%s)\n", cli_errstr(cli->tree)); return False; } - cli_close(cli, fnum); + cli_close(cli->tree, fnum); - if (!cli_chkpath(cli, "\\chkpath.dir")) { - printf("chkpath1 failed: %s\n", cli_errstr(cli)); + if (!cli_chkpath(cli->tree, "\\chkpath.dir")) { + printf("chkpath1 failed: %s\n", cli_errstr(cli->tree)); ret = False; } - if (!cli_chkpath(cli, "\\chkpath.dir\\dir2")) { - printf("chkpath2 failed: %s\n", cli_errstr(cli)); + if (!cli_chkpath(cli->tree, "\\chkpath.dir\\dir2")) { + printf("chkpath2 failed: %s\n", cli_errstr(cli->tree)); ret = False; } - if (!cli_chkpath(cli, "\\chkpath.dir\\foo.txt")) { + if (!cli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt")) { ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath, NT_STATUS_NOT_A_DIRECTORY); } else { @@ -3607,7 +3607,7 @@ BOOL torture_chkpath_test(int dummy) ret = False; } - if (!cli_chkpath(cli, "\\chkpath.dir\\bar.txt")) { + if (!cli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt")) { ret = check_error(__LINE__, cli, ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND); } else { @@ -3615,7 +3615,7 @@ BOOL torture_chkpath_test(int dummy) ret = False; } - if (!cli_chkpath(cli, "\\chkpath.dir\\dirxx\\bar.txt")) { + if (!cli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt")) { ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND); } else { @@ -3623,9 +3623,9 @@ BOOL torture_chkpath_test(int dummy) ret = False; } - cli_rmdir(cli, "\\chkpath.dir\\dir2"); - cli_unlink(cli, "\\chkpath.dir\\*"); - cli_rmdir(cli, "\\chkpath.dir"); + cli_rmdir(cli->tree, "\\chkpath.dir\\dir2"); + cli_unlink(cli->tree, "\\chkpath.dir\\*"); + cli_rmdir(cli->tree, "\\chkpath.dir"); if (!torture_close_connection(cli)) { return False; @@ -3647,14 +3647,14 @@ static BOOL run_dirtest1(int dummy) return False; } - cli_list(cli, "\\LISTDIR\\*", 0, del_fn, cli); - cli_list(cli, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, del_fn, cli); - if (cli_deltree(cli, "\\LISTDIR") == -1) { - fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", cli_errstr(cli)); + cli_list(cli->tree, "\\LISTDIR\\*", 0, del_fn, cli); + cli_list(cli->tree, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, del_fn, cli); + if (cli_deltree(cli->tree, "\\LISTDIR") == -1) { + fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree)); return False; } - if (!cli_mkdir(cli, "\\LISTDIR")) { - fprintf(stderr,"Failed to mkdir %s, error=%s\n", "\\LISTDIR", cli_errstr(cli)); + if (!cli_mkdir(cli->tree, "\\LISTDIR")) { + fprintf(stderr,"Failed to mkdir %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree)); return False; } @@ -3664,27 +3664,27 @@ static BOOL run_dirtest1(int dummy) for (i=0;i<torture_entries;i++) { char *fname; asprintf(&fname, "\\LISTDIR\\f%d", i); - fnum = cli_nt_create_full(cli, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE, + fnum = cli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum == -1) { - fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli)); + fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree)); return False; } free(fname); - cli_close(cli, fnum); + cli_close(cli->tree, fnum); } for (i=0;i<torture_entries;i++) { char *fname; asprintf(&fname, "\\LISTDIR\\d%d", i); - if (!cli_mkdir(cli, fname)) { - fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli)); + if (!cli_mkdir(cli->tree, fname)) { + fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree)); return False; } free(fname); } /* Now ensure that doing an old list sees both files and directories. */ - num_seen = cli_list_old(cli, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); + num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); printf("num_seen = %d\n", num_seen ); /* We should see (torture_entries) each of files & directories + . and .. */ if (num_seen != (2*torture_entries)+2) { @@ -3697,7 +3697,7 @@ static BOOL run_dirtest1(int dummy) /* Ensure if we have the "must have" bits we only see the * relevant entries. */ - num_seen = cli_list_old(cli, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); + num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); printf("num_seen = %d\n", num_seen ); if (num_seen != torture_entries+2) { correct = False; @@ -3705,7 +3705,7 @@ static BOOL run_dirtest1(int dummy) torture_entries+2, num_seen); } - num_seen = cli_list_old(cli, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); + num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); printf("num_seen = %d\n", num_seen ); if (num_seen != torture_entries) { correct = False; @@ -3714,14 +3714,14 @@ static BOOL run_dirtest1(int dummy) } /* Delete everything. */ - cli_list(cli, "\\LISTDIR\\*", 0, del_fn, cli); - cli_list(cli, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, del_fn, cli); - cli_rmdir(cli, "\\LISTDIR"); + cli_list(cli->tree, "\\LISTDIR\\*", 0, del_fn, cli); + cli_list(cli->tree, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, del_fn, cli); + cli_rmdir(cli->tree, "\\LISTDIR"); #if 0 - printf("Matched %d\n", cli_list(cli, "a*.*", 0, list_fn, NULL)); - printf("Matched %d\n", cli_list(cli, "b*.*", 0, list_fn, NULL)); - printf("Matched %d\n", cli_list(cli, "xyzabc", 0, list_fn, NULL)); + printf("Matched %d\n", cli_list(cli->tree, "a*.*", 0, list_fn, NULL)); + printf("Matched %d\n", cli_list(cli->tree, "b*.*", 0, list_fn, NULL)); + printf("Matched %d\n", cli_list(cli->tree, "xyzabc", 0, list_fn, NULL)); #endif if (!torture_close_connection(cli)) { @@ -3756,23 +3756,23 @@ static BOOL run_deny3test(int dummy) fname = "\\deny_dos1.dat"; - cli_unlink(cli1, fname); - fnum1 = cli_open(cli1, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS); - fnum2 = cli_open(cli1, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS); - if (fnum1 != -1) cli_close(cli1, fnum1); - if (fnum2 != -1) cli_close(cli1, fnum2); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); + fnum1 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS); + fnum2 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS); + if (fnum1 != -1) cli_close(cli1->tree, fnum1); + if (fnum2 != -1) cli_close(cli1->tree, fnum2); + cli_unlink(cli1->tree, fname); printf("fnum1=%d fnum2=%d\n", fnum1, fnum2); fname = "\\deny_dos2.dat"; - cli_unlink(cli1, fname); - fnum1 = cli_open(cli1, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS); - fnum2 = cli_open(cli2, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS); - if (fnum1 != -1) cli_close(cli1, fnum1); - if (fnum2 != -1) cli_close(cli2, fnum2); - cli_unlink(cli1, fname); + cli_unlink(cli1->tree, fname); + fnum1 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS); + fnum2 = cli_open(cli2->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS); + if (fnum1 != -1) cli_close(cli1->tree, fnum1); + if (fnum2 != -1) cli_close(cli2->tree, fnum2); + cli_unlink(cli1->tree, fname); printf("fnum1=%d fnum2=%d\n", fnum1, fnum2); diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index 8dbec60b12..57add86602 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -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; diff --git a/source4/torture/utable.c b/source4/torture/utable.c index 2d7ad5a025..9d23f10121 100644 --- a/source4/torture/utable.c +++ b/source4/torture/utable.c @@ -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; } |