smbd: Print ACL used to create hash in vfs_xattr_common
[Samba/bb.git] / examples / libsmbclient / testacl3.c
blobf34e273d6b7f884ab3b77feaaf23f4842faa2aa4
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <unistd.h>
4 #include <string.h>
5 #include <time.h>
6 #include <errno.h>
7 #include <libsmbclient.h>
8 #include "get_auth_data_fn.h"
11 int main(int argc, char * argv[])
13 int ret;
14 int debug = 0;
15 char value[2048];
16 char path[2048];
17 char * the_acl;
18 char * p;
19 SMBCCTX * context;
21 smbc_init(get_auth_data_fn, debug);
23 context = smbc_set_context(NULL);
24 smbc_setOptionFullTimeNames(context, 1);
26 for (;;)
28 fprintf(stdout, "Path: ");
29 *path = '\0';
30 fgets(path, sizeof(path) - 1, stdin);
31 if (strlen(path) == 0)
33 return 0;
36 p = path + strlen(path) - 1;
37 if (*p == '\n')
39 *p = '\0';
42 the_acl = strdup("system.nt_sec_desc.*+");
43 ret = smbc_getxattr(path, the_acl, value, sizeof(value));
44 if (ret < 0)
46 printf("Could not get attributes for [%s] %d: %s\n",
47 path, errno, strerror(errno));
48 return 1;
51 printf("Attributes for [%s] are:\n%s\n", path, value);
54 return 0;