return 0;
}
+int
+PrintContError(struct misc_data *misc, afs_int32 ea, struct contentry *c, int indent)
+{
+ pr_PrintContEntry(stderr, /*net order */ 0, ea, c, indent);
+ return 0;
+}
+
afs_int32
WalkHashTable(afs_int32 hashtable[], /* hash table to walk */
int hashType, /* hash function to use */
afs_int32 head;
int bit;
afs_int32 code;
- struct prentry c; /* continuation entry */
+ struct contentry c; /* continuation entry */
afs_int32 na; /* next thread */
int ni;
afs_int32 eid = 0;
return PRDBBAD;
if (na != sghead) {
fprintf(stderr, "last block: \n");
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
}
return 0;
fprintf(stderr, "Continuation entry reused\n");
if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
noErrors = 0;
break;
fprintf(stderr, "Continuation id mismatch\n");
if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
noErrors = 0;
continue;
if (id == PRBADID)
continue;
else if (id) {
- int eid_s, id_s;
+ int id_s;
sgcount++;
/* in case the ids are large, convert to pure sign. */
if (id > 0)
id_s = 1;
else
id_s = -1;
- if (eid > 0)
- eid_s = 1;
- else
- eid_s = -1;
if (id_s > 0) {
fprintf(stderr,
"User can't be member of supergroup list\n");
if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
noErrors = 0;
}
return PRDBBAD;
if (na != head) {
fprintf(stderr, "last block: \n");
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
}
return 0;
fprintf(stderr, "walking free list");
else if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
noErrors = 0;
break;
fprintf(stderr, "walking free list");
else if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
noErrors = 0;
continue;
"User can't be member of user in membership list\n");
if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
noErrors = 0;
}
"Bad user/group dicotomy in membership list\n");
if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintContError(misc, na, &c, 4))
return PRDBBAD;
noErrors = 0;
}
{
afs_int32 head;
afs_int32 code;
- struct prentry c; /* continuation entry */
+ struct prentry te; /* next entry in owner chain */
afs_int32 na; /* next thread */
int ni;
afs_int32 eid = 0;
head = ntohl(cheader.orphan);
length = 0;
- for (na = head; na; na = ntohl(c.nextOwned)) {
+ for (na = head; na; na = ntohl(te.nextOwned)) {
code = ConvertDiskAddress(na, &ni);
if (code) {
fprintf(stderr, "Bad owned list ptr %d", na);
return PRDBBAD;
if (na != head) {
fprintf(stderr, "last block: \n");
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintEntryError(misc, na, &te, 4))
return PRDBBAD;
}
return 0;
}
- code = pr_Read(na, (char *)&c, sizeof(c));
+ code = pr_Read(na, (char *)&te, sizeof(te));
if (code)
return code;
length++;
+ if ((ntohl(te.flags) & PRTYPE) == PRCONT) {
+ fprintf(stderr, "Continuation entry found on owner chain\n");
+ if (e == 0)
+ fprintf(stderr, "walking orphan list");
+ else if (PrintEntryError(misc, ea, e, 2))
+ return PRDBBAD;
+ if (PrintEntryError(misc, na, &te, 4))
+ return PRDBBAD;
+ break;
+ }
if (map[ni] & MAP_OWNED) {
fprintf(stderr, "Entry on multiple owner chains\n");
if (e == 0)
fprintf(stderr, "walking orphan list");
else if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintEntryError(misc, na, &te, 4))
return PRDBBAD;
break;
}
fprintf(stderr, "walking orphan list");
else if (PrintEntryError(misc, ea, e, 2))
return PRDBBAD;
- if (PrintEntryError(misc, na, &c, 4))
+ if (PrintEntryError(misc, na, &te, 4))
return PRDBBAD;
continue;
}
if (e) {
- if (ntohl(c.owner) != eid) {
+ if (ntohl(te.owner) != eid) {
fprintf(stderr, "Owner id mismatch\n");
goto abort;
}
- } else /* orphan */ if (c.owner) {
+ } else /* orphan */ if (te.owner) {
fprintf(stderr, "Orphan group owner not zero\n");
goto abort;
}
{
char *qs;
if (strpbrk(s, " \t")) {
- asprintf(&qs, "\"%s\"", s);
+ if (asprintf(&qs, "\"%s\"", s) < 0)
+ qs = "<<-OUT-OF-MEMORY->>";
} else
qs = s;
return qs;
}
na = ntohl(e.next);
while (na) {
- struct prentry c;
+ struct contentry c;
code = pr_Read(na, (char *)&c, sizeof(c));
if (code)
return code;
setlinebuf(stdout);
- ts = cmd_CreateSyntax(NULL, WorkerBee, NULL, "PRDB check");
+ ts = cmd_CreateSyntax(NULL, WorkerBee, NULL, 0, "PRDB check");
cmd_AddParm(ts, "-database", CMD_SINGLE, CMD_REQUIRED, "ptdb_file");
cmd_AddParm(ts, "-uheader", CMD_FLAG, CMD_OPTIONAL,
"Display UBIK header");