/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afsconfig.h>
#include <afs/param.h>
+#include <afs/stds.h>
-RCSID
- ("$Header$");
+#include <roken.h>
+#include <afs/opr.h>
-#ifdef AFS_AIX32_ENV
-#include <signal.h>
-#endif
-#include <sys/types.h>
#ifdef AFS_NT40_ENV
-#include <winsock2.h>
#include <WINNT/afsevent.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
#endif
-#include <stdio.h>
+
#include <rx/xdr.h>
#include <rx/rx.h>
-#include <string.h>
-#include <afs/stds.h>
#include <afs/com_err.h>
#include <afs/cellconfig.h>
-#include "ptclient.h"
-#include "pterror.h"
#include <afs/afsutil.h>
+#include "ptclient.h"
+#include "ptuser.h"
+#include "pterror.h"
+#include "display.h"
afs_int32 security = 0;
char confdir[AFSDIR_PATH_MAX];
char *whoami;
-#ifndef AFS_PTHREAD_ENV
extern struct ubik_client *pruclient;
-#endif
+static void skip(char **);
+static void PrintHelp(void);
static int ignoreExist = 0;
static char line[256];
#define WHITESPACE " \t\n"
-#ifndef AFS_PTHREAD_ENV
int
-osi_audit()
+osi_audit(void)
{
/* OK, this REALLY sucks bigtime, but I can't tell who is calling
* afsconf_CheckAuth easily, and only *SERVERS* should be calling osi_audit
*/
return 0;
}
-#endif /* !AFS_PTHREAD_ENV */
int
-GetToken(format, l)
- char *format;
- afs_int32 *l;
+GetToken(char *format, afs_int32 *l)
{
int c;
#define GetXInt32(l) GetToken ("%x", l)
int
-GetString(s, slen)
- char *s;
- int slen;
+GetString(char *s, int slen)
{
char *beg;
int l;
}
int
-CodeOk(code)
- afs_int32 code;
+CodeOk(afs_int32 code)
{
if (!ignoreExist)
return code;
}
int
-PrintEntry(ea, e, indent)
- afs_int32 ea;
- struct prentry *e;
- int indent;
+PrintEntry(afs_int32 ea, struct prentry *e, int indent)
{
/* handle screwed up versions of DumpEntry */
if (e->flags & PRCONT) {
- afs_int32 id = *(afs_int32 *) (e->name);
+ afs_int32 id;
+
+ memcpy(&id, e->name, sizeof(id));
if ((id != PRBADID) && ((id > (1 << 24)) || (id < -(1 << 24)))) {
/* assume server incorrectly swapped these bytes... */
int i = 0;
return pr_PrintEntry(stdout, /*host order */ 1, ea, e, indent);
}
-#ifndef AFS_PTHREAD_ENV
/* main program */
#include "AFS_component_version_number.c"
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
- register afs_int32 code;
+ afs_int32 code;
char op[8];
char name[PR_MAXNAMELEN];
afs_int32 id, oid = ANONYMOUSID, gid;
afs_int32 pos;
- int i;
+ unsigned int i;
+ int n;
struct prentry entry;
prlist alist;
idlist lid;
char *foo;
afs_int32 over;
char *cell;
+ afs_int32 rxgk_level = 0;
#ifdef AFS_AIX32_ENV
/*
- * The following signal action for AIX is necessary so that in case of a
- * crash (i.e. core is generated) we can include the user's data section
+ * The following signal action for AIX is necessary so that in case of a
+ * crash (i.e. core is generated) we can include the user's data section
* in the core dump. Unfortunately, by default, only a partial core is
* generated which, in many cases, isn't too useful.
*/
strcpy(confdir, AFSDIR_CLIENT_ETC_DIRPATH);
cell = 0;
- i = 1;
- while (i < argc) {
- int arglen = strlen(argv[i]);
+ n = 1;
+ while (n < argc) {
+ int arglen = strlen(argv[n]);
char arg[256];
- lcstring(arg, argv[i], sizeof(arg));
+ lcstring(arg, argv[n], sizeof(arg));
#define IsArg(a) (strncmp (arg,a, arglen) == 0)
if (IsArg("-testconfdir"))
- strncpy(confdir, argv[++i], sizeof(confdir));
+ strncpy(confdir, argv[++n], sizeof(confdir));
else if (IsArg("client"))
strncpy(confdir, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(confdir));
else if (IsArg("server"))
strncpy(confdir, AFSDIR_SERVER_ETC_DIRPATH, sizeof(confdir));
- else if (IsArg("0") || IsArg("1") || IsArg("2"))
- security = atoi(argv[i]);
+ else if (IsArg("0") || IsArg("1") || IsArg("2") || IsArg("3"))
+ security = atoi(argv[n]);
+ else if (IsArg("-rxgk"))
+ rxgk_level = atoi(argv[++n]);
else if (IsArg("-ignoreexist"))
ignoreExist++;
else if (IsArg("-cell"))
- cell = argv[++i];
+ cell = argv[++n];
else {
printf
- ("Usage is: 'prclient [-testconfdir <dir> | server | client] [0 | 1 | 2] [-ignoreExist] [-cell <cellname>]\n");
+ ("Usage is: 'prclient [-testconfdir <dir> | server | client] [0 | 1 | 2 | 3] [-rxgk 0 | 1 | 2] [-ignoreExist] [-cell <cellname>]\n");
exit(1);
}
- i++;
+ n++;
}
printf("Using CellServDB file in %s\n", confdir);
if (security == 0)
printf("Making unauthenticated connection to prserver\n");
- code = pr_Initialize(security, confdir, cell);
+ code = pr_Initialize2(security, confdir, cell, rxgk_level);
if (code) {
afs_com_err(whoami, code, "Couldn't initialize protection library");
exit(1);
if (code) {
afs_com_err(whoami, PRBADARG,
"error reading opcode in line '%s', got '%.*s'", line,
- sizeof(op), op);
+ (int) sizeof(op), op);
exit(1);
}
if (strlen(op) == 0)
if (GetInt32(&pos))
code = PRBADARG;
else
- code = ubik_PR_DumpEntry(pruclient, 0, pos, &entry);
+ code = ubik_PR_DumpEntry(pruclient, 0, pos, (struct prdebugentry *)&entry);
if (CodeOk(code))
printf("%s\n", pr_ErrorMsg(code));
if (code == PRSUCCESS) {
if (CodeOk(code))
afs_com_err(whoami, code, "on %s %d %d", op, id, gid);
} else if (!strcmp(op, "iton")) {
- lid.idlist_val = (afs_int32 *) malloc(20 * sizeof(afs_int32));
+ lid.idlist_val = malloc(20 * sizeof(afs_int32));
ptr = lid.idlist_val;
lid.idlist_len = 0;
foo = line;
lid.idlist_val = 0;
lid.idlist_len = 0;
} else if (!strcmp(op, "ntoi")) {
- lnames.namelist_val =
- (prname *) malloc(PR_MAXLIST * PR_MAXNAMELEN);
+ lnames.namelist_val = malloc(PR_MAXLIST * PR_MAXNAMELEN);
lnames.namelist_len = 0;
foo = line;
skip(&foo);
for (i = 0; ((lnames.namelist_len < PR_MAXLIST)
- && (sscanf(foo, "%s", lnames.namelist_val[i]) !=
+ && (sscanf(foo, "%63s", lnames.namelist_val[i]) !=
EOF)); i++) {
lnames.namelist_len++;
skip(&foo);
else if (!(hostinfo = gethostbyname(name)))
code = PRBADARG;
else {
- hostaddr = hostinfo->h_addr_list[0];
+ hostaddr = (struct in_addr *)hostinfo->h_addr_list[0];
id = ntohl(hostaddr->s_addr);
code =
ubik_PR_GetHostCPS(pruclient, 0, id, &alist, &over);
else if (!strcmp(op, "fih")) {
char tname[128];
struct PrUpdateEntry uentry;
- bzero(&uentry, sizeof(uentry));
+ memset(&uentry, 0, sizeof(uentry));
/* scanf("%s",name); */
if (GetString(name, sizeof(name))) {
code = PRBADARG;
} else if (!strcmp(op, "fnh")) {
int tid;
struct PrUpdateEntry uentry;
- bzero(&uentry, sizeof(uentry));
+ memset(&uentry, 0, sizeof(uentry));
/* scanf("%d", &id); */
if (GetInt32(&id)) {
code = PRBADARG;
else
printf("Unknown op: '%s'! ? for help\n", op);
}
+ return 0;
}
-PrintHelp()
+static void
+PrintHelp(void)
{
printf("cr name id owner - create entry with name and id.\n");
printf("wh id - what is the offset into database for id?\n");
printf("q - quit.\n?- this message.\n");
}
-
-skip(s)
- char **s;
+static void
+skip(char **s)
{
while (**s != ' ' && **s != '\0')
(*s)++;
while (**s == ' ')
(*s)++;
}
-#endif /* !AFS_PTHREAD_ENV */