ka-util-differently-useless-20020117

drop state here
This commit is contained in:
Derrick Brashear 2002-01-17 06:47:28 +00:00
parent 80ce7296a1
commit 30807bbcfe

View File

@ -71,7 +71,6 @@ char **argv;
register long code; register long code;
long cc, upos=0, gpos; long cc, upos=0, gpos;
struct ubik_hdr *uh; struct ubik_hdr *uh;
struct timeval time;
char *dfile = 0; char *dfile = 0;
char *pfile = "/usr/afs/db/kaserver.DB0"; char *pfile = "/usr/afs/db/kaserver.DB0";
@ -147,20 +146,42 @@ char **argv;
exit (1); exit (1);
} }
init_kaprocs(pfile,9);
initialize_KA_error_table(); initialize_KA_error_table();
if (wflag) { if (wflag) {
struct kaheader header;
afs_int32 ltime=time(0);
memset(&header, 0, sizeof(header));
header.version = htonl(KADBVERSION);
header.headerSize = htonl(sizeof(header));
header.freePtr = 0;
header.eofPtr = htonl(sizeof(header));
header.kvnoPtr = 0;
header.stats.allocs = 0;
header.stats.frees = 0;
header.stats.cpws = 0;
header.admin_accounts = 0;
header.specialKeysVersion = htonl(ltime);
header.hashsize = htonl(HASHSIZE);
header.checkVersion = htonl(KADBVERSION);
write(dbase_fd, &header, sizeof(header));
while(fgets(buffer, sizeof(buffer), dfp)) { while(fgets(buffer, sizeof(buffer), dfp)) {
struct kaentry tentry; struct kaentry tentry;
int flags, exp, modtime, modid, cpwtime, maxlife, kvno; int flags, exp, modtime, modid, cpwtime, maxlife, kvno;
char kaname[64+64+2], key[33], name[64], instance[64]; char kaname[64+64+2], key[33], name[64], instance[64], rlm[64];
afs_int32 maxLifetime; afs_int32 maxLifetime;
sscanf(buffer, "%s %d %d %d %d %d %d %d %s", sscanf(buffer, "%s %d %d %d %d %d %d %d %s",
kaname, &flags, &exp, &modtime, &modid, &cpwtime, kaname, &flags, &exp, &modtime, &modid, &cpwtime,
&maxlife, &kvno, key); &maxlife, &kvno, key);
printf("%s %d %d %d %d %d %d %d %s", kaname, flags, exp, modtime,
modid, cpwtime, maxlife, kvno, key);
memset(name,0,sizeof(name));
memset(instance,0,sizeof(instance));
ka_ParseLoginName(&kaname, &name, &instance, &rlm);
printf("%s %s %s\n", kaname, name, instance);
strncpy(tentry.userID.name, name, sizeof(tentry.userID.name)); strncpy(tentry.userID.name, name, sizeof(tentry.userID.name));
strncpy(tentry.userID.instance, instance, sizeof(tentry.userID.instance)); strncpy(tentry.userID.instance, instance, sizeof(tentry.userID.instance));
tentry.flags = htonl(flags); tentry.flags = htonl(flags);
@ -183,8 +204,9 @@ char **argv;
else else
tentry.max_ticket_lifetime = htonl(maxLifetime); tentry.max_ticket_lifetime = htonl(maxLifetime);
write(dbase_fd, &tentry, sizeof(&tentry)); write(dbase_fd, &tentry, sizeof(tentry));
} }
/*CheckInit(0,0);*/
} else { } else {
while (1) { while (1) {
gpos = display_entry(upos*sizeof(struct kaentry)); gpos = display_entry(upos*sizeof(struct kaentry));