}
static int
+GetCallerAccess(struct cmd_syndesc *as, void *arock)
+{
+ afs_int32 code;
+ struct ViceIoctl blob;
+ struct cmd_item *ti;
+ int error = 0;
+ int literal = 0;
+ cm_ioctlQueryOptions_t options;
+
+ if (as->parms[1].items)
+ literal = 1;
+
+ SetDotDefault(&as->parms[0].items);
+ for(ti=as->parms[0].items; ti; ti=ti->next) {
+ cm_fid_t fid;
+ afs_uint32 rights[2];
+
+ /* once per file */
+ memset(&fid, 0, sizeof(fid));
+ memset(&options, 0, sizeof(options));
+ options.size = sizeof(options);
+ options.field_flags |= CM_IOCTL_QOPTS_FIELD_LITERAL;
+ options.literal = literal;
+ blob.in_size = options.size; /* no variable length data */
+ blob.in = &options;
+
+ blob.out_size = sizeof(cm_fid_t);
+ blob.out = (char *) &fid;
+ if (0 == pioctl_utf8(ti->data, VIOCGETFID, &blob, 1) &&
+ blob.out_size == sizeof(cm_fid_t)) {
+ options.field_flags |= CM_IOCTL_QOPTS_FIELD_FID;
+ options.fid = fid;
+ } else {
+ fs_Die(errno, ti->data);
+ error = 1;
+ continue;
+ }
+
+ blob.out_size = sizeof(rights);
+ blob.out = rights;
+ code = pioctl_utf8(ti->data, VIOC_GETCALLERACCESS, &blob, 1);
+ if (code || blob.out_size != sizeof(rights)) {
+ fs_Die(errno, ti->data);
+ error = 1;
+ continue;
+ }
+
+ printf("Callers access to '%s' is ", ti->data);
+ PRights(rights[0], 0);
+ printf("\n");
+ }
+ return error;
+}
+
+static int
FlushAllCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 code;
{
afs_int32 code;
char confDir[257];
+ int secFlags;
cm_GetConfigDir(confDir, sizeof(confDir));
- code = ugen_ClientInit(noAuthFlag, confDir,
- info->name, 0, &uclient,
- NULL, pn, rxkad_clear,
- VLDB_MAXSERVERS, AFSCONF_VLDBSERVICE, 50,
- 0, 0, USER_SERVICE_ID);
+ secFlags = AFSCONF_SECOPTS_FALLBACK_NULL;
+
+ if (noAuthFlag)
+ secFlags |= AFSCONF_SECOPTS_NOAUTH;
+
+ code = ugen_ClientInitFlags(confDir, info->name, secFlags,
+ &uclient, NULL, VLDB_MAXSERVERS,
+ AFSCONF_VLDBSERVICE, 50);
+
rxInitDone = 1;
return code;
}
return error;
}
+static afs_int32
+SetDataVerifyCmd(struct cmd_syndesc *as, void *arock)
+{
+ afs_int32 code = 0, flag;
+ struct ViceIoctl blob;
+ char *tp;
+
+#ifdef WIN32
+ if ( !fs_IsAdmin() ) {
+ fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n");
+ return EACCES;
+ }
+#endif /* WIN32 */
+
+ tp = as->parms[0].items->data;
+ if (strcmp(tp, "on") == 0)
+ flag = 1;
+ else if (strcmp(tp, "off") == 0)
+ flag = 0;
+ else {
+ fprintf (stderr, "%s: %s must be \"on\" or \"off\".\n", pn, tp);
+ return EINVAL;
+ }
+
+ blob.in = (char *) &flag;
+ blob.in_size = sizeof(flag);
+ blob.out_size = 0;
+ code = pioctl_utf8(0, VIOC_SETVERIFYDATA, &blob, 1);
+ if (code)
+ fs_Die(code, NULL);
+ return 0;
+}
+
+static afs_int32
+GetDataVerifyCmd(struct cmd_syndesc *as, void *arock)
+{
+ afs_int32 code = 0, flag;
+ struct ViceIoctl blob;
+ char *tp;
+ errno_t err;
+
+ blob.in = NULL;
+ blob.in_size = 0;
+ blob.out_size = sizeof(flag);
+ blob.out = space;
+
+ code = pioctl_utf8(0, VIOC_GETVERIFYDATA, &blob, 1);
+
+ if (code || blob.out_size != sizeof(flag))
+ fs_Die(code, NULL);
+ else {
+ tp = space;
+#if _MSC_VER < 1400
+ memcpy(&flag, tp, sizeof(afs_int32));
+#else
+ err = memcpy_s(&flag, sizeof(flag), tp, sizeof(afs_int32));
+ if ( err ) {
+ fprintf (stderr, "memcpy_s failure on flag");
+ exit(1);
+ }
+#endif
+
+ printf("Data verify mode is currently ");
+ if (flag == 1)
+ printf("on.\n");
+ else
+ printf("off.\n");
+ }
+ return 0;
+}
+
#ifndef WIN32
#include "AFS_component_version_number.c"
#endif
cmd_AddParm(ts, "-cmd", CMD_FLAG, CMD_OPTIONAL, "output as 'fs setacl' command");
cmd_CreateAlias(ts, "la");
+ ts = cmd_CreateSyntax("getcalleraccess", GetCallerAccess, NULL,
+ "list callers access");
+ cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
+ cmd_AddParm(ts, "-literal", CMD_FLAG, CMD_OPTIONAL, "literal evaluation of mountpoints and symlinks");
+ cmd_CreateAlias(ts, "gca");
+
ts = cmd_CreateSyntax("cleanacl", CleanACLCmd, NULL, "clean up access control list");
cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
cmd_AddParm(ts, "-literal", CMD_FLAG, CMD_OPTIONAL, "literal evaluation of mountpoints and symlinks");
+ ts = cmd_CreateSyntax("setverify", SetDataVerifyCmd, NULL, "set cache manager data verify mode");
+ cmd_AddParm(ts, "-verify", CMD_SINGLE, 0, "on or off");
+
+ ts = cmd_CreateSyntax("getverify", GetDataVerifyCmd, NULL, "get cache manager data verify mode");
+
code = cmd_Dispatch(argc, argv);
if (rxInitDone)