summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-10-24 13:32:30 +0200
committerVolker Lendecke <vlendec@samba.org>2010-10-24 20:46:28 +0000
commit86cb0ad242002014a4bfcdd9d0b40a3d3d172b81 (patch)
treedaa19be70be12bcbdf098b73aced9519b15d79b7
parent0831807782e01d8fb6e4e5ebcd46c014dc3ab599 (diff)
downloadsamba-86cb0ad242002014a4bfcdd9d0b40a3d3d172b81.tar.gz
samba-86cb0ad242002014a4bfcdd9d0b40a3d3d172b81.tar.bz2
samba-86cb0ad242002014a4bfcdd9d0b40a3d3d172b81.zip
s3: Add "geteas" to smbclient
-rw-r--r--source3/client/client.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 761d8d39ee..35ee66067a 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3231,6 +3231,63 @@ static int cmd_getfacl(void)
return 0;
}
+static void printf_cb(const char *buf, void *private_data)
+{
+ printf("%s", buf);
+}
+
+/****************************************************************************
+ Get the EA list of a file
+****************************************************************************/
+
+static int cmd_geteas(void)
+{
+ TALLOC_CTX *ctx = talloc_tos();
+ char *src = NULL;
+ char *name = NULL;
+ char *targetname = NULL;
+ struct cli_state *targetcli;
+ NTSTATUS status;
+ size_t i, num_eas;
+ struct ea_struct *eas;
+
+ if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) {
+ d_printf("geteas filename\n");
+ return 1;
+ }
+ src = talloc_asprintf(ctx,
+ "%s%s",
+ client_get_cur_dir(),
+ name);
+ if (!src) {
+ return 1;
+ }
+
+ if (!cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
+ &targetname)) {
+ d_printf("stat %s: %s\n", src, cli_errstr(cli));
+ return 1;
+ }
+
+ status = cli_get_ea_list_path(targetcli, targetname, talloc_tos(),
+ &num_eas, &eas);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("cli_get_ea_list_path: %s\n", nt_errstr(status));
+ return 1;
+ }
+
+ for (i=0; i<num_eas; i++) {
+ d_printf("%s (%d) =\n", eas[i].name, (int)eas[i].flags);
+ dump_data_cb(eas[i].value.data, eas[i].value.length, false,
+ printf_cb, NULL);
+ d_printf("\n");
+ }
+
+ TALLOC_FREE(eas);
+
+ return 0;
+}
+
/****************************************************************************
UNIX stat.
****************************************************************************/
@@ -4070,6 +4127,8 @@ static struct {
{"exit",cmd_quit,"logoff the server",{COMPL_NONE,COMPL_NONE}},
{"get",cmd_get,"<remote name> [local name] get a file",{COMPL_REMOTE,COMPL_LOCAL}},
{"getfacl",cmd_getfacl,"<file name> get the POSIX ACL on a file (UNIX extensions only)",{COMPL_REMOTE,COMPL_LOCAL}},
+ {"geteas", cmd_geteas, "<file name> get the EA list of a file",
+ {COMPL_REMOTE, COMPL_LOCAL}},
{"hardlink",cmd_hardlink,"<src> <dest> create a Windows hard link",{COMPL_REMOTE,COMPL_REMOTE}},
{"help",cmd_help,"[command] give help on a command",{COMPL_NONE,COMPL_NONE}},
{"history",cmd_history,"displays the command history",{COMPL_NONE,COMPL_NONE}},