diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-06-16 17:14:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:53:23 -0500 |
commit | b2668fe8e15d77bc810f7501644b2c28fe877d6b (patch) | |
tree | d7501fcfe2c91ff54bb136c3eaf16120f67ad299 /source4/client | |
parent | 491c63a78de92252148d0d7ac7cb50a2f420b062 (diff) | |
download | samba-b2668fe8e15d77bc810f7501644b2c28fe877d6b.tar.gz samba-b2668fe8e15d77bc810f7501644b2c28fe877d6b.tar.bz2 samba-b2668fe8e15d77bc810f7501644b2c28fe877d6b.zip |
r23520: display shadow copy information in 'allinfo'
(This used to be commit 6855dba72e41a4399bc9cd03ebe9924120c43436)
Diffstat (limited to 'source4/client')
-rw-r--r-- | source4/client/client.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source4/client/client.c b/source4/client/client.c index 2de071a195..7585a15a39 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -1726,6 +1726,7 @@ static int cmd_allinfo(struct smbclient_context *ctx, const char **args) char *fname; union smb_fileinfo finfo; NTSTATUS status; + int fnum; if (!args[1]) { d_printf("allinfo <filename>\n"); @@ -1809,6 +1810,40 @@ static int cmd_allinfo(struct smbclient_context *ctx, const char **args) d_printf("\tcluster_shift %ld\n", (long)finfo.compression_info.out.cluster_shift); } + /* shadow copies if available */ + fnum = smbcli_open(ctx->cli->tree, fname, O_RDONLY, DENY_NONE); + if (fnum != -1) { + struct smb_shadow_copy info; + int i; + info.in.file.fnum = fnum; + info.in.max_data = ~0; + status = smb_raw_shadow_data(ctx->cli->tree, ctx, &info); + if (NT_STATUS_IS_OK(status)) { + d_printf("\tshadow_copy: %u volumes %u names\n", + info.out.num_volumes, info.out.num_names); + for (i=0;i<info.out.num_names;i++) { + d_printf("\t%s\n", info.out.names[i]); + finfo.generic.level = RAW_FILEINFO_ALL_INFO; + finfo.generic.in.file.path = talloc_asprintf(ctx, "%s%s", + info.out.names[i], fname); + status = smb_raw_pathinfo(ctx->cli->tree, ctx, &finfo); + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_NOT_FOUND)) { + continue; + } + if (!NT_STATUS_IS_OK(status)) { + d_printf("%s - %s\n", finfo.generic.in.file.path, + nt_errstr(status)); + return 1; + } + + d_printf("\t\tcreate_time: %s\n", nt_time_string(ctx, finfo.all_info.out.create_time)); + d_printf("\t\twrite_time: %s\n", nt_time_string(ctx, finfo.all_info.out.write_time)); + d_printf("\t\tchange_time: %s\n", nt_time_string(ctx, finfo.all_info.out.change_time)); + d_printf("\t\tsize: %lu\n", (unsigned long)finfo.all_info.out.size); + } + } + } + return 0; } |