#include <afs/stds.h>
#include <afs/vice.h>
#include <afs/venus.h>
+#include <afs/com_err.h>
#ifdef AFS_AIX32_ENV
#include <signal.h>
#endif
#undef VICE
#include "afs/prs_fs.h"
#include <afs/afsint.h>
-#include <afs/auth.h>
#include <afs/cellconfig.h>
#include <ubik.h>
#include <rx/rxkad.h>
static struct ubik_client *uclient;
static int GetClientAddrsCmd(), SetClientAddrsCmd(), FlushMountCmd();
-static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd();
+static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd(), UuidCmd();
extern char *hostutil_GetNameByINet();
extern struct hostent *hostutil_GetHostByName();
return error;
}
+/*
+ * The Windows version of UuidCmd displays the UUID.
+ * When the UNIX version is updated to do the same
+ * be sure to replace the CMD_REQUIRED flag with
+ * CMD_OPTIONAL in the cmd_AddParam(-generate) call
+ */
+static int
+UuidCmd(struct cmd_syndesc *as, char *arock)
+{
+ afs_int32 code;
+ struct ViceIoctl blob;
+
+ blob.in_size = 0;
+ blob.out_size = 0;
+
+ if (as->parms[0].items) {
+ if (geteuid()) {
+ fprintf (stderr, "Permission denied: requires root access.\n");
+ return EACCES;
+ }
+
+ /* generate new UUID */
+ code = pioctl(0, VIOC_NEWUUID, &blob, 1);
+
+ if (code) {
+ Die(errno, 0);
+ return 1;
+ }
+
+ printf("New uuid generated.\n");
+ } else {
+ /* This will never execute */
+ printf("Please add the '-generate' option to generate a new UUID.\n");
+ }
+ return 0;
+}
+
static int
FlushCmd(struct cmd_syndesc *as, char *arock)
{
ts = cmd_CreateSyntax("nukenfscreds", NukeNFSCredsCmd, 0, "nuke credentials for NFS client");
cmd_AddParm(ts, "-addr", CMD_SINGLE, 0, "host name or address");
+ ts = cmd_CreateSyntax("uuid", UuidCmd, 0, "manage the UUID for the cache manager");
+ cmd_AddParm(ts, "-generate", CMD_FLAG, CMD_REQUIRED, "generate a new UUID");
+
code = cmd_Dispatch(argc, argv);
if (rxInitDone)
rx_Finalize();
fprintf(stderr, "%s:'%s'", pn, filename);
else
fprintf(stderr, "%s", pn);
- fprintf(stderr, ": %s\n", error_message(errnum));
+ fprintf(stderr, ": %s\n", afs_error_message(errnum));
break;
}
}