ctdb-protocol: Replace ctdb_event_header with sock_packet_header
[Samba.git] / examples / libsmbclient / testacl3.c
blob59d9994ef39f6158cea415292c3448e97995a489
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 p = fgets(path, sizeof(path) - 1, stdin);
31 if (p == NULL) {
32 printf("Error reading from stdin\n");
33 return 1;
35 if (strlen(path) == 0)
37 return 0;
40 p = path + strlen(path) - 1;
41 if (*p == '\n')
43 *p = '\0';
46 the_acl = strdup("system.nt_sec_desc.*+");
47 ret = smbc_getxattr(path, the_acl, value, sizeof(value));
48 if (ret < 0)
50 printf("Could not get attributes for [%s] %d: %s\n",
51 path, errno, strerror(errno));
52 return 1;
55 printf("Attributes for [%s] are:\n%s\n", path, value);
58 return 0;