source: vendor/current/examples/libsmbclient/testacl3.c

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 1.2 KB
Line 
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"
9
10
11int main(int argc, char * argv[])
12{
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;
20
21 smbc_init(get_auth_data_fn, debug);
22
23 context = smbc_set_context(NULL);
24 smbc_setOptionFullTimeNames(context, 1);
25
26 for (;;)
27 {
28 fprintf(stdout, "Path: ");
29 *path = '\0';
30 fgets(path, sizeof(path) - 1, stdin);
31 if (strlen(path) == 0)
32 {
33 return 0;
34 }
35
36 p = path + strlen(path) - 1;
37 if (*p == '\n')
38 {
39 *p = '\0';
40 }
41
42 the_acl = strdup("system.nt_sec_desc.*+");
43 ret = smbc_getxattr(path, the_acl, value, sizeof(value));
44 if (ret < 0)
45 {
46 printf("Could not get attributes for [%s] %d: %s\n",
47 path, errno, strerror(errno));
48 return 1;
49 }
50
51 printf("Attributes for [%s] are:\n%s\n", path, value);
52 }
53
54 return 0;
55}
Note: See TracBrowser for help on using the repository browser.