git.samba.org
/
samba.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vfs: Remove -D_LARGEFILE64_SOURCE from vfs examples Makefile
[samba.git]
/
examples
/
libsmbclient
/
testacl.c
diff --git
a/examples/libsmbclient/testacl.c
b/examples/libsmbclient/testacl.c
index 00e1c2c9da9c838cee7ba9b73900aada4cd4b45f..b602c5b185453f1420caa44b78af87cb5469f1c1 100644
(file)
--- a/
examples/libsmbclient/testacl.c
+++ b/
examples/libsmbclient/testacl.c
@@
-24,15
+24,17
@@
int main(int argc, const char *argv[])
int flags;
int debug = 0;
int numeric = 0;
int flags;
int debug = 0;
int numeric = 0;
+ int stat_and_retry = 0;
int full_time_names = 0;
enum acl_mode mode = SMB_ACL_LIST;
int full_time_names = 0;
enum acl_mode mode = SMB_ACL_LIST;
- static char *the_acl = NULL;
+ static c
onst c
har *the_acl = NULL;
int ret;
char *p;
int ret;
char *p;
- char *debugstr;
+ c
onst c
har *debugstr;
char path[1024];
char value[1024];
poptContext pc;
char path[1024];
char value[1024];
poptContext pc;
+ struct stat st;
struct poptOption long_options[] =
{
POPT_AUTOHELP
struct poptOption long_options[] =
{
POPT_AUTOHELP
@@
-77,6
+79,10
@@
int main(int argc, const char *argv[])
"get", 'g', POPT_ARG_STRING, NULL,
'g', "Get a specific acl attribute", "ACL"
},
"get", 'g', POPT_ARG_STRING, NULL,
'g', "Get a specific acl attribute", "ACL"
},
+ {
+ "stat_and_retry", 'R', POPT_ARG_NONE, &stat_and_retry,
+ 1, "After 'get' do 'stat' and another 'get'"
+ },
{
NULL
}
{
NULL
}
@@
-175,26
+181,40
@@
int main(int argc, const char *argv[])
break;
case SMB_ACL_GET:
break;
case SMB_ACL_GET:
- if (the_acl == NULL)
+ do
{
{
- if (
numeric
)
+ if (
the_acl == NULL
)
{
{
- the_acl = "system.*";
+ if (numeric)
+ {
+ the_acl = "system.*";
+ }
+ else
+ {
+ the_acl = "system.*+";
+ }
}
}
- else
+ ret = smbc_getxattr(path, the_acl, value, sizeof(value));
+ if (ret < 0)
{
{
- the_acl = "system.*+";
+ printf("Could not get attributes for [%s] %d: %s\n",
+ path, errno, strerror(errno));
+ return 1;
}
}
- }
- ret = smbc_getxattr(path, the_acl, value, sizeof(value));
- if (ret < 0)
- {
- printf("Could not get attributes for [%s] %d: %s\n",
- path, errno, strerror(errno));
- return 1;
- }
- printf("Attributes for [%s] are:\n%s\n", path, value);
+ printf("Attributes for [%s] are:\n%s\n", path, value);
+
+ if (stat_and_retry)
+ {
+ if (smbc_stat(path, &st) < 0)
+ {
+ perror("smbc_stat");
+ return 1;
+ }
+ }
+
+ --stat_and_retry;
+ } while (stat_and_retry >= 0);
break;
case SMB_ACL_ADD:
break;
case SMB_ACL_ADD: