summaryrefslogtreecommitdiffstats
path: root/examples/libsmbclient
diff options
context:
space:
mode:
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-05-30 10:38:35 -0400
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-05-30 10:38:35 -0400
commit3e20aeb18e418a5a1a7821fd8c3f0d0bc5169489 (patch)
treeb5ea082502597ab83d0be970c80cf9f90d3f16e6 /examples/libsmbclient
parentcf4b2f4d24a69234cbc62f367dece28446b6bac5 (diff)
downloadsamba-3e20aeb18e418a5a1a7821fd8c3f0d0bc5169489.tar.gz
samba-3e20aeb18e418a5a1a7821fd8c3f0d0bc5169489.tar.xz
samba-3e20aeb18e418a5a1a7821fd8c3f0d0bc5169489.zip
Working on bug #5475
- Add code to test whether smbc_stat() munges future smbc_getxattr() results. Derrell (This used to be commit 5f6b301f92e9e9d5ee1dab9ef8eca2cc77e12941)
Diffstat (limited to 'examples/libsmbclient')
-rw-r--r--examples/libsmbclient/testacl.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c
index 00e1c2c9da9..a57dd4a499b 100644
--- a/examples/libsmbclient/testacl.c
+++ b/examples/libsmbclient/testacl.c
@@ -24,6 +24,7 @@ int main(int argc, const char *argv[])
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;
static char *the_acl = NULL;
@@ -33,6 +34,7 @@ int main(int argc, const char *argv[])
char path[1024];
char value[1024];
poptContext pc;
+ struct stat st;
struct poptOption long_options[] =
{
POPT_AUTOHELP
@@ -78,6 +80,10 @@ int main(int argc, const char *argv[])
'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
}
};
@@ -175,26 +181,40 @@ int main(int argc, const char *argv[])
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: