|
|
1.1 root 1: /*
2: * serialno.c
3: * 06/25/92
4: * Check encrypted COHERENT serial number.
5: */
6:
7: #include "build0.h"
8: #include "serialno.h"
9:
10: char serialno[NSERIAL];
11:
12: /*
13: * Store serial number from s to serialno[].
14: * Return 1 if legal, 0 if not.
15: */
16: int
17: isserial(s) register char *s;
18: {
19: int c, susp, suspen;
20:
21: if (strlen(s) > NSERIAL)
22: return 0;
23: strcpy(serialno, s);
24: if (sscanf(s, "%1d%3d%5d", &c, &susp, &suspen) != 3)
25: return 0;
26: if ( c < 1 || c > VERSIONS)
27: return 0;
28: --c;
29: if (((suspen ^ magic3[c]) % magic2[c]) != (susp ^ magic1[c]))
30: return 0;
31: #if 0
32: /* Conditionalized out so users cannot decypher serialno... */
33: if (dflag)
34: printf("serialno=%s v=%d n=%d\n", serialno, c+1,
35: suspen^magic3[c]);
36: #endif
37: return 1;
38: }
39:
40: /* end of serialno.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.