openafs-string-header-cleanup-20071030
[openafs.git] / src / kauth / rebuild.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13 RCSID
14     ("$Header$");
15
16 #include <sys/types.h>
17 #include <sys/stat.h>
18 #ifdef AFS_NT40_ENV
19 #include <winsock2.h>
20 #include <fcntl.h>
21 #include <io.h>
22 #else
23 #include <sys/file.h>
24 #include <netinet/in.h>
25 #endif
26 #include <string.h>
27 #include <stdio.h>
28 #include <errno.h>
29 #include <time.h>
30 #include <ubik.h>
31 #include <afs/cmd.h>
32
33 #include <afs/com_err.h>
34
35 #include "kauth.h"
36 #include "kautils.h"
37 #include "kaserver.h"
38
39 #define UBIK_HEADERSIZE 64
40 #define UBIK_BUFFERSIZE 1024
41
42 char *whoami = "kadb_check";
43 int fd;
44 FILE *out;
45
46 void badEntry();
47
48 int listuheader, listkheader, listentries, verbose;
49
50 int
51 readUbikHeader()
52 {
53     int offset, r;
54     struct ubik_hdr uheader;
55
56     offset = lseek(fd, 0, 0);
57     if (offset != 0) {
58         printf("error: lseek to 0 failed: %d %d\n", offset, errno);
59         return (-1);
60     }
61
62     /* now read the info */
63     r = read(fd, &uheader, sizeof(uheader));
64     if (r != sizeof(uheader)) {
65         printf("error: read of %d bytes failed: %d %d\n", sizeof(uheader), r,
66                errno);
67         return (-1);
68     }
69
70     uheader.magic = ntohl(uheader.magic);
71     uheader.size = ntohl(uheader.size);
72     uheader.version.epoch = ntohl(uheader.version.epoch);
73     uheader.version.counter = ntohl(uheader.version.counter);
74
75     if (listuheader) {
76         printf("Ubik Header\n");
77         printf("   Magic           = 0x%x\n", uheader.magic);
78         printf("   Size            = %u\n", uheader.size);
79         printf("   Version.epoch   = %u\n", uheader.version.epoch);
80         printf("   Version.counter = %u\n", uheader.version.counter);
81     }
82
83     if (uheader.size != UBIK_HEADERSIZE)
84         printf("Ubik header size is %u (should be %u)\n", uheader.size,
85                UBIK_HEADERSIZE);
86     if (uheader.magic != UBIK_MAGIC)
87         printf("Ubik header magic is 0x%x (should be 0x%x)\n", uheader.magic,
88                UBIK_MAGIC);
89
90     return (0);
91 }
92
93 void
94 PrintHeader(header)
95      struct kaheader *header;
96 {
97     printf("Version          = %d\n", header->version);
98     printf("HeaderSize       = %d\n", header->headerSize);
99     printf("Free Ptr         = %u\n", header->freePtr);
100     printf("EOF  Ptr         = %u\n", header->eofPtr);
101     printf("Kvno Ptr         = %u\n", header->kvnoPtr);
102     printf("SpecialKeysVersion changed = %d\n", header->specialKeysVersion);
103     printf("# admin accounts = %d\n", header->admin_accounts);
104     printf("HashSize         = %d\n", header->hashsize);
105     printf("Check Version    = %d\n", header->checkVersion);
106     printf("stats.minorVersion     = %d\n", header->stats.minor_version);
107     printf("stats.AllocBlock calls = %d\n", header->stats.allocs);
108     printf("stats.FreeBlock  calls = %d\n", header->stats.frees);
109     printf("stats.cpw commands     = %d\n", header->stats.cpws);
110 }
111
112 void
113 PrintEntry(index, entry)
114      afs_int32 index;
115      struct kaentry *entry;
116 {
117     int i;
118     char Time[100];
119     struct tm *tm_p;
120     time_t tt;
121     time_t modification_time = entry->modification_time;
122     time_t change_password_time = entry->change_password_time;
123     time_t max_ticket_lifetime = entry->max_ticket_lifetime;
124
125     printf("\n");
126
127     i = (index - sizeof(struct kaheader)) / sizeof(struct kaentry);
128
129     printf("Entry %5d (%u):\n", i, index);
130
131     if (entry->flags & KAFNORMAL) {
132         printf("   Name = %s", entry->userID.name);
133         if (strlen(entry->userID.instance) > 0) {
134             printf(".%s", entry->userID.instance);
135         }
136         printf("\n");
137     }
138
139     printf("   flags = ");
140     if (entry->flags & KAFNORMAL)
141         printf("NORMAL ");
142     if (entry->flags & KAFADMIN)
143         printf("ADMIN ");
144     if (entry->flags & KAFNOTGS)
145         printf("NOTGS ");
146     if (entry->flags & KAFNOSEAL)
147         printf("NOSEAL ");
148     if (entry->flags & KAFNOCPW)
149         printf("NOCPW ");
150
151     if (entry->flags & KAFNEWASSOC)
152         printf("CR-ASSOC ");
153     if (entry->flags & KAFFREE)
154         printf("FREE ");
155     if (entry->flags & KAFOLDKEYS)
156         printf("OLDKEYS ");
157     if (entry->flags & KAFSPECIAL)
158         printf("SPECIAL ");
159     if (entry->flags & KAFASSOCROOT)
160         printf("ROOT-ASSOC ");
161     if (entry->flags & KAFASSOC)
162         printf("AN-ASSOC ");
163     printf("\n");
164
165     printf("   Next = %u\n", entry->next);
166
167     if (entry->flags & KAFFREE)
168         return;
169     if (entry->flags & KAFOLDKEYS)
170         return;
171
172     tt = entry->user_expiration;
173     tm_p = localtime(&tt);
174     if (tm_p)
175         strftime(Time, 100, "%m/%d/%Y %H:%M", tm_p);
176
177     printf("   User Expiration = %s\n",
178            (entry->user_expiration == 0xffffffff) ? "never" : Time);
179
180     printf("   Password Expiration = %u days %s\n",
181            entry->misc_auth_bytes[EXPIRES],
182            (entry->misc_auth_bytes[EXPIRES] ? "" : "(never)"));
183
184     printf("   Password Attempts before lock = ");
185     if (!entry->misc_auth_bytes[ATTEMPTS])
186         printf("unlimited\n");
187     else
188         printf("%d\n", entry->misc_auth_bytes[ATTEMPTS]);
189
190     printf("   Password lockout time = ");
191     if (!entry->misc_auth_bytes[LOCKTIME])
192         printf("unlimited\n");
193     else
194         printf("%.1f min\n", (entry->misc_auth_bytes[LOCKTIME] * 8.5));
195
196     printf("   Is entry locked = %s\n",
197            (entry->misc_auth_bytes[REUSEFLAGS] ==
198             KA_ISLOCKED) ? "yes" : "no");
199
200     printf("   Permit password reuse = %s\n",
201            (!entry->pwsums[0] && !entry->pwsums[1]) ? "yes" : "no");
202
203     printf("   Mod Time = %u: %s", entry->modification_time,
204            ctime(&modification_time));
205     printf("   Mod ID = %u\n", entry->modification_id);
206     printf("   Change Password Time = %u: %s", entry->change_password_time,
207            ctime(&change_password_time));
208     printf("   Ticket lifetime = %u: %s", entry->max_ticket_lifetime,
209            ctime(&max_ticket_lifetime));
210     printf("   Key Version = %d\n", entry->key_version);
211
212     printf("   Key = ");
213     ka_PrintBytes((char *)&entry->key, sizeof(entry->key));
214     printf("\n");
215
216     /* What about asServer structs and such and misc_ath_bytes */
217 }
218
219 /* ntohEntry - convert back to host-order */
220 ntohEntry(struct kaentry *entryp)
221 {
222     entryp->flags = ntohl(entryp->flags);
223     entryp->next = ntohl(entryp->next);
224     entryp->user_expiration = ntohl(entryp->user_expiration);
225     entryp->modification_time = ntohl(entryp->modification_time);
226     entryp->modification_id = ntohl(entryp->modification_id);
227     entryp->change_password_time = ntohl(entryp->change_password_time);
228     entryp->max_ticket_lifetime = ntohl(entryp->max_ticket_lifetime);
229     entryp->key_version = ntohl(entryp->key_version);
230     entryp->misc.asServer.nOldKeys = ntohl(entryp->misc.asServer.nOldKeys);
231     entryp->misc.asServer.oldKeys = ntohl(entryp->misc.asServer.oldKeys);
232 }
233
234 char principal[64];
235 char *
236 EntryName(entryp)
237      struct kaentry *entryp;
238 {
239     char name[32], inst[32];
240
241     ka_ConvertBytes(name, sizeof(name), entryp->userID.name,
242                     strlen(entryp->userID.name));
243     ka_ConvertBytes(inst, sizeof(inst), entryp->userID.instance,
244                     strlen(entryp->userID.instance));
245
246     if (strlen(entryp->userID.instance)) {
247         sprintf(principal, "%s.%s", name, inst);
248     } else {
249         strcpy(principal, name);
250     }
251
252     return (principal);
253 }
254
255 void
256 RebuildEntry(entryp)
257      struct kaentry *entryp;
258 {
259     char key[33];
260     char flags[128];
261     char Time[50];
262
263     /* Special entries are not rebuilt */
264     if (entryp->flags & KAFSPECIAL)
265         return;
266
267     fprintf(out, "create    -name %s", EntryName(entryp));
268
269     ka_ConvertBytes(key, sizeof(key), (char *)&entryp->key,
270                     sizeof(entryp->key));
271     fprintf(out, " -initial_password foo\n");
272
273     strcpy(flags, "");
274     if (entryp->flags & KAFADMIN)
275         strcat(flags, "+ADMIN");
276     if (entryp->flags & KAFNOTGS)
277         strcat(flags, "+NOTGS");
278     if (entryp->flags & KAFNOSEAL)
279         strcat(flags, "+NOSEAL");
280     if (entryp->flags & KAFNOCPW)
281         strcat(flags, "+NOCPW");
282
283     fprintf(out, "setfields -name %s", principal);
284     if (strcmp(flags, "") != 0)
285         fprintf(out, " -flags %s", &flags[1]);
286     if (entryp->user_expiration != 0xffffffff) {
287         time_t tt = entryp->user_expiration;
288         strftime(Time, 50, "%m/%d/%Y %H:%M",localtime(&tt));
289         fprintf(out, " -expiration '%s'", Time);
290     }
291     fprintf(out, " -lifetime %u", entryp->max_ticket_lifetime);
292     if (entryp->misc_auth_bytes[EXPIRES])
293         fprintf(out, " -pwexpires %u", entryp->misc_auth_bytes[EXPIRES]);
294     if (entryp->pwsums[0] || entryp->pwsums[1])
295         fprintf(out, " -reuse no");
296     if (entryp->misc_auth_bytes[ATTEMPTS])
297         fprintf(out, " -attempts %u", entryp->misc_auth_bytes[ATTEMPTS]);
298     if (entryp->misc_auth_bytes[LOCKTIME])
299         fprintf(out, " -locktime %d",
300                 (int)(entryp->misc_auth_bytes[LOCKTIME] * 8.5));
301     fprintf(out, "\n");
302
303     fprintf(out, "setkey    -name %s -new_key %s -kvno %d\n", principal, key,
304             ntohl(entryp->key_version));
305 }
306
307 CheckHeader(header)
308      struct kaheader *header;
309 {
310     afs_int32 i, code = 0;
311
312     header->version = ntohl(header->version);
313     header->headerSize = ntohl(header->headerSize);
314     header->freePtr = ntohl(header->freePtr);
315     header->eofPtr = ntohl(header->eofPtr);
316     header->kvnoPtr = ntohl(header->kvnoPtr);
317     header->stats.minor_version = ntohl(header->stats.minor_version);
318     header->stats.allocs = ntohl(header->stats.allocs);
319     header->stats.frees = ntohl(header->stats.frees);
320     header->stats.cpws = ntohl(header->stats.cpws);
321     header->admin_accounts = ntohl(header->admin_accounts);
322     header->specialKeysVersion = ntohl(header->specialKeysVersion);
323     header->hashsize = ntohl(header->hashsize);
324     for (i = 0; i < HASHSIZE; i++) {
325         header->nameHash[i] = ntohl(header->nameHash[i]);
326     }
327     header->checkVersion = ntohl(header->checkVersion);
328
329     if (header->version != header->checkVersion) {
330         code++;
331         fprintf(stderr, "HEADER VERSION MISMATCH: initial %d, final %d\n",
332                 header->version, header->checkVersion);
333     }
334     if (header->headerSize != sizeof(struct kaheader)) {
335         code++;
336         fprintf(stderr,
337                 "HEADER SIZE WRONG: file indicates %d, should be %d\n",
338                 header->headerSize, sizeof(struct kaheader));
339     }
340     if (header->hashsize != HASHSIZE) {
341         code++;
342         fprintf(stderr, "HASH SIZE WRONG: file indicates %d, should be %d\n",
343                 header->hashsize, HASHSIZE);
344     }
345     if ((header->kvnoPtr && ((header->kvnoPtr < header->headerSize)
346                              || (header->eofPtr < header->freePtr)))
347         || (header->freePtr && ((header->freePtr < header->headerSize)
348                                 || (header->eofPtr < header->kvnoPtr)))) {
349         code++;
350         fprintf(stderr,
351                 "DATABASE POINTERS BAD: header size = %d, freePtr = %d, kvnoPtr = %d, eofPtr = %d\n",
352                 header->headerSize, header->freePtr, header->kvnoPtr,
353                 header->eofPtr);
354     }
355
356 /*
357  *  fprintf(stderr, "DB Version %d, %d possible entries\n", header->version,
358  *          (header->eofPtr-header->headerSize) / sizeof(struct kaentry));
359  */
360     return code;
361 }
362
363 afs_int32
364 NameHash(entryp)
365      struct kaentry *entryp;
366 {
367     unsigned int hash;
368     int i;
369     char *aname = entryp->userID.name;
370     char *ainstance = entryp->userID.instance;
371
372     /* stolen directly from the HashString function in the vol package */
373     hash = 0;
374     for (i = strlen(aname), aname += i - 1; i--; aname--)
375         hash = (hash * 31) + (*((unsigned char *)aname) - 31);
376     for (i = strlen(ainstance), ainstance += i - 1; i--; ainstance--)
377         hash = (hash * 31) + (*((unsigned char *)ainstance) - 31);
378     return (hash % HASHSIZE);
379 }
380
381 readDB(offset, buffer, size)
382      afs_int32 offset;
383      char *buffer;
384      afs_int32 size;
385 {
386     afs_int32 code;
387
388     offset += UBIK_HEADERSIZE;
389     code = lseek(fd, offset, SEEK_SET);
390     if (code != offset) {
391         afs_com_err(whoami, errno, "skipping Ubik header");
392         exit(2);
393     }
394     code = read(fd, buffer, size);
395     if (code != size) {
396         afs_com_err(whoami, errno, "reading db got %d bytes", code);
397         exit(3);
398     }
399 }
400
401 #include "AFS_component_version_number.c"
402
403 WorkerBee(as, arock)
404      struct cmd_syndesc *as;
405      char *arock;
406 {
407     afs_int32 code;
408     char *dbFile;
409     char *outFile;
410     afs_int32 index;
411     struct stat info;
412     struct kaheader header;
413     int nentries, i, j, count;
414     int *entrys;
415     struct kaentry entry;
416
417     dbFile = as->parms[0].items->data;  /* -database */
418     listuheader = (as->parms[1].items ? 1 : 0); /* -uheader  */
419     listkheader = (as->parms[2].items ? 1 : 0); /* -kheader  */
420     listentries = (as->parms[3].items ? 1 : 0); /* -entries  */
421     verbose = (as->parms[4].items ? 1 : 0);     /* -verbose  */
422     outFile = (as->parms[5].items ? as->parms[5].items->data : NULL);   /* -rebuild  */
423
424     if (outFile) {
425         out = fopen(outFile, "w");
426         if (!out) {
427             afs_com_err(whoami, errno, "opening output file %s", outFile);
428             exit(7);
429         }
430     } else
431         out = 0;
432
433     fd = open(dbFile, O_RDONLY, 0);
434     if (fd < 0) {
435         afs_com_err(whoami, errno, "opening database file %s", dbFile);
436         exit(6);
437     }
438     code = fstat(fd, &info);
439     if (code) {
440         afs_com_err(whoami, errno, "stat'ing file %s", dbFile);
441         exit(6);
442     }
443     if ((info.st_size - UBIK_HEADERSIZE) % UBIK_BUFFERSIZE)
444         fprintf(stderr,
445                 "DATABASE SIZE INCONSISTENT: was %d, should be (n*%d + %d), for integral n\n",
446                 info.st_size, UBIK_BUFFERSIZE, UBIK_HEADERSIZE);
447
448     readUbikHeader();
449
450     readDB(0, &header, sizeof(header));
451     code = CheckHeader(&header);
452     if (listkheader)
453         PrintHeader(&header);
454
455     nentries =
456         (info.st_size -
457          (UBIK_HEADERSIZE + header.headerSize)) / sizeof(struct kaentry);
458     entrys = (int *)malloc(nentries * sizeof(int));
459     memset(entrys, 0, nentries * sizeof(int));
460
461     for (i = 0, index = sizeof(header); i < nentries;
462          i++, index += sizeof(struct kaentry)) {
463         readDB(index, &entry, sizeof(entry));
464
465         if (index >= header.eofPtr) {
466             entrys[i] |= 0x8;
467         } else if (listentries) {
468             PrintEntry(index, &entry);
469         }
470
471         if (entry.flags & KAFNORMAL) {
472             entrys[i] |= 0x1;   /* user entry */
473
474             if (strlen(entry.userID.name) == 0) {
475                 if (verbose)
476                     printf("Entry %d has zero length name\n", i);
477                 continue;
478             }
479             if (!des_check_key_parity(&entry.key)
480                 || des_is_weak_key(&entry.key)) {
481                 fprintf(stderr, "Entry %d, %s, has bad key\n", i,
482                         EntryName(&entry));
483                 continue;
484             }
485
486             if (out) {
487                 RebuildEntry(&entry);
488             }
489
490         } else if (entry.flags & KAFFREE) {
491             entrys[i] |= 0x2;   /* free entry */
492
493         } else if (entry.flags & KAFOLDKEYS) {
494             entrys[i] |= 0x4;   /* old keys block */
495             /* Should check the structure of the oldkeys block? */
496
497         } else {
498             if (index < header.eofPtr) {
499                 fprintf(stderr, "Entry %d is unrecognizable\n", i);
500             }
501         }
502     }
503
504     /* Follow the hash chains */
505     for (j = 0; j < HASHSIZE; j++) {
506         for (index = header.nameHash[j]; index; index = entry.next) {
507             readDB(index, &entry, sizeof(entry));
508
509             /* check to see if the name is hashed correctly */
510             i = NameHash(&entry);
511             if (i != j) {
512                 fprintf(stderr,
513                         "Entry %d, %s, found in hash chain %d (should be %d)\n",
514                         ((index -
515                           sizeof(struct kaheader)) / sizeof(struct kaentry)),
516                         EntryName(&entry), j, i);
517             }
518
519             /* Is it on another hash chain or circular hash chain */
520             i = (index - header.headerSize) / sizeof(entry);
521             if (entrys[i] & 0x10) {
522                 fprintf(stderr,
523                         "Entry %d, %s, hash index %d, was found on another hash chain\n",
524                         i, EntryName(&entry), j);
525                 if (entry.next)
526                     fprintf(stderr, "Skipping rest of hash chain %d\n", j);
527                 else
528                     fprintf(stderr, "No next entry in hash chain %d\n", j);
529                 code++;
530                 break;
531             }
532             entrys[i] |= 0x10;  /* On hash chain */
533         }
534     }
535
536     /* Follow the free pointers */
537     count = 0;
538     for (index = header.freePtr; index; index = entry.next) {
539         readDB(index, &entry, sizeof(entry));
540
541         /* Is it on another chain or circular free chain */
542         i = (index - header.headerSize) / sizeof(entry);
543         if (entrys[i] & 0x20) {
544             fprintf(stderr, "Entry %d, %s, already found on free chain\n", i,
545                     EntryName(&entry));
546             fprintf(stderr, "Skipping rest of free chain\n");
547             code++;
548             break;
549         }
550         entrys[i] |= 0x20;      /* On free chain */
551
552         count++;
553     }
554     if (verbose)
555         printf("Found %d free entries\n", count);
556
557     /* Follow the oldkey blocks */
558     count = 0;
559     for (index = header.kvnoPtr; index; index = entry.next) {
560         readDB(index, &entry, sizeof(entry));
561
562         /* Is it on another chain or circular free chain */
563         i = (index - header.headerSize) / sizeof(entry);
564         if (entrys[i] & 0x40) {
565             fprintf(stderr, "Entry %d, %s, already found on olkeys chain\n",
566                     i, EntryName(&entry));
567             fprintf(stderr, "Skipping rest of oldkeys chain\n");
568             code++;
569             break;
570         }
571         entrys[i] |= 0x40;      /* On free chain */
572
573         count++;
574     }
575     if (verbose)
576         printf("Found %d oldkey blocks\n", count);
577
578     /* Now recheck all the blocks and see if they are allocated correctly
579      * 0x1 --> User Entry           0x10 --> On hash chain
580      * 0x2 --> Free Entry           0x20 --> On Free chain
581      * 0x4 --> OldKeys Entry        0x40 --> On Oldkeys chain
582      * 0x8 --> Past EOF
583      */
584     for (i = 0; i < nentries; i++) {
585         j = entrys[i];
586         if (j & 0x1) {          /* user entry */
587             if (!(j & 0x10))
588                 badEntry(j, i); /* on hash chain? */
589             else if (j & 0xee)
590                 badEntry(j, i); /* anything else? */
591         } else if (j & 0x2) {   /* free entry */
592             if (!(j & 0x20))
593                 badEntry(j, i); /* on free chain? */
594             else if (j & 0xdd)
595                 badEntry(j, i); /* anything else? */
596         } else if (j & 0x4) {   /* oldkeys entry */
597             if (!(j & 0x40))
598                 badEntry(j, i); /* on oldkeys chain? */
599             else if (j & 0xbb)
600                 badEntry(j, i); /* anything else? */
601         } else if (j & 0x8) {   /* past eof */
602             if (j & 0xf7)
603                 badEntry(j, i); /* anything else? */
604         } else
605             badEntry(j, i);     /* anything else? */
606     }
607
608     exit(code != 0);
609 }
610
611 void
612 badEntry(e, i)
613      afs_int32 e, i;
614 {
615     int offset;
616     struct kaentry entry;
617
618     offset = i * sizeof(struct kaentry) + sizeof(struct kaheader);
619     readDB(offset, &entry, sizeof(entry));
620
621     fprintf(stderr, "Entry %d, %s, hash index %d, is bad: [", i,
622             EntryName(&entry), NameHash(&entry));
623     if (e & 0x1)
624         fprintf(stderr, " UserEntry");
625     if (e & 0x2)
626         fprintf(stderr, " FreeEntry");
627     if (e & 0x4)
628         fprintf(stderr, " OldkeysEntry");
629     if (e & 0x8)
630         fprintf(stderr, " PastEOF");
631     if (!(e & 0xf))
632         fprintf(stderr, " <NULL>");
633     fprintf(stderr, " ] [");
634     if (e & 0x10)
635         fprintf(stderr, " UserChain");
636     if (e & 0x20)
637         fprintf(stderr, " FreeChain");
638     if (e & 0x40)
639         fprintf(stderr, " OldkeysChain");
640     if (!(e & 0xf0))
641         fprintf(stderr, " <NULL>");
642     fprintf(stderr, " ]\n");
643 }
644
645 main(argc, argv)
646      int argc;
647      char *argv[];
648 {
649     struct cmd_syndesc *ts;
650
651     setlinebuf(stdout);
652
653     ts = cmd_CreateSyntax(NULL, WorkerBee, NULL, "KADB check");
654     cmd_AddParm(ts, "-database", CMD_SINGLE, CMD_REQUIRED, "kadb_file");
655     cmd_AddParm(ts, "-uheader", CMD_FLAG, CMD_OPTIONAL,
656                 "Display UBIK header");
657     cmd_AddParm(ts, "-kheader", CMD_FLAG, CMD_OPTIONAL,
658                 "Display KADB header");
659     cmd_AddParm(ts, "-entries", CMD_FLAG, CMD_OPTIONAL, "Display entries");
660     cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");
661     cmd_AddParm(ts, "-rebuild", CMD_SINGLE, CMD_OPTIONAL, "out_file");
662
663     return cmd_Dispatch(argc, argv);
664 }