s3:test: don't rely on pyhton being in /usr/bin/python in the sids2xids test
[Samba/gebeck_regimport.git] / examples / libsmbclient / testacl3.c
blob4ef6e80a7bd626c24f3a1de7ccdc134953647ccd
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 i;
14 int fd;
15 int ret;
16 int debug = 0;
17 int mode = 0666;
18 int savedErrno;
19 char value[2048];
20 char path[2048];
21 char * the_acl;
22 char * p;
23 time_t t0;
24 time_t t1;
25 struct stat st;
26 SMBCCTX * context;
28 smbc_init(get_auth_data_fn, debug);
30 context = smbc_set_context(NULL);
31 smbc_setOptionFullTimeNames(context, 1);
33 for (;;)
35 fprintf(stdout, "Path: ");
36 *path = '\0';
37 fgets(path, sizeof(path) - 1, stdin);
38 if (strlen(path) == 0)
40 return 0;
43 p = path + strlen(path) - 1;
44 if (*p == '\n')
46 *p = '\0';
49 the_acl = strdup("system.nt_sec_desc.*+");
50 ret = smbc_getxattr(path, the_acl, value, sizeof(value));
51 if (ret < 0)
53 printf("Could not get attributes for [%s] %d: %s\n",
54 path, errno, strerror(errno));
55 return 1;
58 printf("Attributes for [%s] are:\n%s\n", path, value);
61 return 0;