version 1.12, 1996/10/02 03:49:34 |
version 1.13, 1996/10/02 18:11:30 |
|
|
n = 99; |
n = 99; |
|
|
/* Set hash type if asked to */ |
/* Set hash type if asked to */ |
if (ht) |
if (ht) { |
skey_set_algorithm(ht); |
/* Need to zero out old key when changing algorithm */ |
|
if (strcmp(ht, skey_get_algorithm()) && skey_set_algorithm(ht)) |
|
zerokey = 1; |
|
} |
|
|
if (!defaultsetup) { |
if (!defaultsetup) { |
(void)printf("You need the 6 english words generated from the \"skey\" command.\n"); |
(void)printf("You need the 6 english words generated from the \"skey\" command.\n"); |
|
|
if ((skey.val = (char *)malloc(16 + 1)) == NULL) |
if ((skey.val = (char *)malloc(16 + 1)) == NULL) |
err(1, "Can't allocate memory"); |
err(1, "Can't allocate memory"); |
|
|
|
/* Zero out old key if necesary (entry would change size) */ |
|
if (zerokey) { |
|
(void)skeyzero(&skey, pp->pw_name); |
|
/* Re-open keys file and seek to the end */ |
|
if (skeylookup(&skey, pp->pw_name) == -1) |
|
err(1, "cannot open database"); |
|
} |
|
|
btoa8(skey.val, key); |
btoa8(skey.val, key); |
|
|
/* Don't save algorithm type for md4 (keep record length same) */ |
/* Don't save algorithm type for md4 (keep record length same) */ |
if (strcmp(skey_get_algorithm(), "md4") == 0) |
if (strcmp(skey_get_algorithm(), "md4") == 0) |
(void)fprintf(skey.keyfile, "%s s %04d %-16s %s %-21s\n", |
(void)fprintf(skey.keyfile, "%s %04d %-16s %s %-21s\n", |
pp->pw_name, n, seed, skey.val, tbuf); |
pp->pw_name, n, seed, skey.val, tbuf); |
else |
else |
(void)fprintf(skey.keyfile, "%s %s %04d %-16s %s %-21s\n", |
(void)fprintf(skey.keyfile, "%s %s %04d %-16s %s %-21s\n", |