summaryrefslogtreecommitdiff
path: root/examples/libsmbclient/testacl.c
diff options
context:
space:
mode:
authorGerald W. Carter <jerry@samba.org>2008-01-16 10:35:36 -0600
committerGerald W. Carter <jerry@samba.org>2008-01-16 10:35:36 -0600
commit1a6415fc77c708b87c8e2ce6e7828f486ffc87ac (patch)
treefe0dbff696381e5af80342dc7e633297617f3e9e /examples/libsmbclient/testacl.c
parent019c245ae15c7fdc414d41f64dad994337f26cf4 (diff)
parent6e94cbdc30afc3c9b5d2504aa8649fa9c87af7aa (diff)
downloadsamba-1a6415fc77c708b87c8e2ce6e7828f486ffc87ac.tar.gz
samba-1a6415fc77c708b87c8e2ce6e7828f486ffc87ac.tar.bz2
samba-1a6415fc77c708b87c8e2ce6e7828f486ffc87ac.zip
Merge branch 'v3-2-test-merge' into v3-2-stable
(This used to be commit 6993b6139419761c649f3ad54467a2c34f29382d)
Diffstat (limited to 'examples/libsmbclient/testacl.c')
-rw-r--r--examples/libsmbclient/testacl.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c
index 4d327b39a7..51cc90f101 100644
--- a/examples/libsmbclient/testacl.c
+++ b/examples/libsmbclient/testacl.c
@@ -7,6 +7,7 @@
enum acl_mode
{
+ SMB_ACL_LIST,
SMB_ACL_GET,
SMB_ACL_SET,
SMB_ACL_DELETE,
@@ -24,7 +25,7 @@ int main(int argc, const char *argv[])
int debug = 0;
int numeric = 0;
int full_time_names = 0;
- enum acl_mode mode = SMB_ACL_GET;
+ enum acl_mode mode = SMB_ACL_LIST;
static char *the_acl = NULL;
int ret;
char *p;
@@ -149,6 +150,30 @@ int main(int argc, const char *argv[])
switch(mode)
{
+ case SMB_ACL_LIST:
+ ret = smbc_listxattr(path, value, sizeof(value)-2);
+ if (ret < 0)
+ {
+ printf("Could not get attribute list for [%s] %d: %s\n",
+ path, errno, strerror(errno));
+ return 1;
+ }
+
+ /*
+ * The list of attributes has a series of null-terminated strings.
+ * The list of strings terminates with an extra null byte, thus two in
+ * a row. Ensure that our buffer, which is conceivably shorter than
+ * the list of attributes, actually ends with two null bytes in a row.
+ */
+ value[sizeof(value) - 2] = '\0';
+ value[sizeof(value) - 1] = '\0';
+ printf("Supported attributes:\n");
+ for (p = value; *p; p += strlen(p) + 1)
+ {
+ printf("\t%s\n", p);
+ }
+ break;
+
case SMB_ACL_GET:
if (the_acl == NULL)
{