/* Unix SMB/CIFS implementation. helper functions for SMB2 test suite Copyright (C) Andrew Tridgell 2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" #include "libcli/raw/libcliraw.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" #include "lib/cmdline/popt_common.h" #include "lib/events/events.h" /* show lots of information about a file */ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle) { NTSTATUS status; TALLOC_CTX *tmp_ctx = talloc_new(tree); union smb2_fileinfo io; status = smb2_getinfo_level(tree, tmp_ctx, handle, SMB2_GETINFO_FILE_ALL_INFO, &io); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("getinfo failed - %s\n", nt_errstr(status))); talloc_free(tmp_ctx); return; } d_printf("\tcreate_time: %s\n", nt_time_string(tmp_ctx, io.all_info.create_time)); d_printf("\taccess_time: %s\n", nt_time_string(tmp_ctx, io.all_info.access_time)); d_printf("\twrite_time: %s\n", nt_time_string(tmp_ctx, io.all_info.write_time)); d_printf("\tchange_time: %s\n", nt_time_string(tmp_ctx, io.all_info.change_time)); d_printf("\tattrib: 0x%x\n", io.all_info.file_attr); d_printf("\talloc_size: %llu\n", (uint64_t)io.all_info.alloc_size); d_printf("\tsize: %llu\n", (uint64_t)io.all_info.size); d_printf("\tnlink: %u\n", io.all_info.nlink); d_printf("\tdelete_pending: %u\n", io.all_info.delete_pending); d_printf("\tdirectory: %u\n", io.all_info.directory); d_printf("\tfile_id: %llu\n", io.all_info.file_id); d_printf("\tea_size: %u\n", io.all_info.ea_size); d_printf("\taccess_mask: 0x%08x\n", io.all_info.access_mask); d_printf("\tunknown5: 0x%llx\n", io.all_info.unknown5); d_printf("\tunknown6: 0x%llx\n", io.all_info.unknown6); d_printf("\tfname: '%s'\n", io.all_info.fname); /* the EAs, if any */ status = smb2_getinfo_level(tree, tmp_ctx, handle, SMB2_GETINFO_FILE_ALL_EAS, &io); if (NT_STATUS_IS_OK(status)) { int i; for (i=0;itree, fname); } talloc_free(cli); return fnum != -1; } /* create a complex directory using the old SMB protocol, to make it easier to find fields in SMB2 getinfo levels */ BOOL torture_setup_complex_dir(const char *dname) { struct smbcli_state *cli; int fnum; if (!torture_open_connection(&cli)) { return False; } fnum = create_complex_dir(cli, cli, dname); if (DEBUGLVL(1)) { torture_all_info(cli->tree, dname); } talloc_free(cli); return fnum != -1; }