/*
* 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>
-RCSID
- ("$Header$");
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#include <fcntl.h>
-#include <io.h>
-#else
-#include <sys/file.h>
-#include <netinet/in.h>
-#endif
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
+#include <roken.h>
+
+#include <hcrypto/des.h>
+
#include <ubik.h>
#include <afs/cmd.h>
-
+#include <rx/rxkad.h>
#include <afs/com_err.h>
#include "kauth.h"
int fd;
FILE *out;
-void badEntry();
+void badEntry(afs_int32, afs_int32);
int listuheader, listkheader, listentries, verbose;
int
-readUbikHeader()
+readUbikHeader(void)
{
int offset, r;
struct ubik_hdr uheader;
/* now read the info */
r = read(fd, &uheader, sizeof(uheader));
if (r != sizeof(uheader)) {
- printf("error: read of %d bytes failed: %d %d\n", sizeof(uheader), r,
+ printf("error: read of %" AFS_SIZET_FMT " bytes failed: %d %d\n", sizeof(uheader), r,
errno);
return (-1);
}
uheader.magic = ntohl(uheader.magic);
- uheader.size = ntohl(uheader.size);
+ uheader.size = ntohs(uheader.size);
uheader.version.epoch = ntohl(uheader.version.epoch);
uheader.version.counter = ntohl(uheader.version.counter);
}
void
-PrintHeader(header)
- struct kaheader *header;
+PrintHeader(struct kaheader *header)
{
printf("Version = %d\n", header->version);
printf("HeaderSize = %d\n", header->headerSize);
}
void
-PrintEntry(index, entry)
- afs_int32 index;
- struct kaentry *entry;
+PrintEntry(afs_int32 index, struct kaentry *entry)
{
int i;
char Time[100];
}
/* ntohEntry - convert back to host-order */
+void
ntohEntry(struct kaentry *entryp)
{
entryp->flags = ntohl(entryp->flags);
char principal[64];
char *
-EntryName(entryp)
- struct kaentry *entryp;
+EntryName(struct kaentry *entryp)
{
char name[32], inst[32];
}
void
-RebuildEntry(entryp)
- struct kaentry *entryp;
+RebuildEntry(struct kaentry *entryp)
{
char key[33];
char flags[128];
ntohl(entryp->key_version));
}
-CheckHeader(header)
- struct kaheader *header;
+int
+CheckHeader(struct kaheader *header)
{
afs_int32 i, code = 0;
if (header->headerSize != sizeof(struct kaheader)) {
code++;
fprintf(stderr,
- "HEADER SIZE WRONG: file indicates %d, should be %d\n",
+ "HEADER SIZE WRONG: file indicates %d, should be %" AFS_SIZET_FMT "\n",
header->headerSize, sizeof(struct kaheader));
}
if (header->hashsize != HASHSIZE) {
}
afs_int32
-NameHash(entryp)
- struct kaentry *entryp;
+NameHash(struct kaentry *entryp)
{
unsigned int hash;
int i;
return (hash % HASHSIZE);
}
-readDB(offset, buffer, size)
- afs_int32 offset;
- char *buffer;
- afs_int32 size;
+int
+readDB(afs_int32 offset, void *buffer, afs_int32 size)
{
afs_int32 code;
afs_com_err(whoami, errno, "reading db got %d bytes", code);
exit(3);
}
+ return 0;
}
#include "AFS_component_version_number.c"
-WorkerBee(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+static int
+WorkerBee(struct cmd_syndesc *as, void *arock)
{
afs_int32 code;
char *dbFile;
if ((info.st_size - UBIK_HEADERSIZE) % UBIK_BUFFERSIZE)
fprintf(stderr,
"DATABASE SIZE INCONSISTENT: was %d, should be (n*%d + %d), for integral n\n",
- info.st_size, UBIK_BUFFERSIZE, UBIK_HEADERSIZE);
+ (int) info.st_size, UBIK_BUFFERSIZE, UBIK_HEADERSIZE);
readUbikHeader();
printf("Entry %d has zero length name\n", i);
continue;
}
- if (!des_check_key_parity(&entry.key)
- || des_is_weak_key(&entry.key)) {
+ if (!DES_check_key_parity(ktc_to_cblock(&entry.key))
+ || DES_is_weak_key(ktc_to_cblock(&entry.key))) {
fprintf(stderr, "Entry %d, %s, has bad key\n", i,
EntryName(&entry));
continue;
i = NameHash(&entry);
if (i != j) {
fprintf(stderr,
- "Entry %d, %s, found in hash chain %d (should be %d)\n",
+ "Entry %" AFS_SIZET_FMT ", %s, found in hash chain %d (should be %d)\n",
((index -
sizeof(struct kaheader)) / sizeof(struct kaentry)),
EntryName(&entry), j, i);
}
void
-badEntry(e, i)
- afs_int32 e, i;
+badEntry(afs_int32 e, afs_int32 i)
{
int offset;
struct kaentry entry;
fprintf(stderr, " ]\n");
}
-main(argc, argv)
- int argc;
- char *argv[];
+int
+main(int argc, char **argv)
{
struct cmd_syndesc *ts;