version 1.17, 2003/04/06 21:22:31 |
version 1.18, 2003/06/14 23:19:18 |
|
|
{ |
{ |
|
|
(void)fprintf(stderr, |
(void)fprintf(stderr, |
"usage: %s [-k] [-b rounds] [-m] [-s salt] [-p | string]\n", |
"usage: %s [-k] [-b rounds] [-c class] [-m] [-s salt] [-p | string]\n", |
__progname); |
__progname); |
exit(1); |
exit(1); |
} |
} |
|
|
|
|
default: |
default: |
pwd.pw_name = "default"; |
pwd.pw_name = "default"; |
if ((lc = login_getclass(NULL)) == NULL) |
if ((lc = login_getclass(extra)) == NULL) |
errx(1, "unable to get default login class."); |
errx(1, "unable to get login class `%s'", |
|
extra ? (char *)extra : "default"); |
if (!pwd_gensalt(buffer, _PASSWORD_LEN, &pwd, lc, 'l')) |
if (!pwd_gensalt(buffer, _PASSWORD_LEN, &pwd, lc, 'l')) |
errx(1, "can't generate salt"); |
errx(1, "can't generate salt"); |
salt = buffer; |
salt = buffer; |
|
|
int operation = -1; |
int operation = -1; |
int prompt = 0; |
int prompt = 0; |
int rounds; |
int rounds; |
void *extra; /* Store salt or number of rounds */ |
void *extra = NULL; /* Store salt or number of rounds */ |
|
|
if (strcmp(__progname, "makekey") == 0) |
if (strcmp(__progname, "makekey") == 0) |
operation = DO_MAKEKEY; |
operation = DO_MAKEKEY; |
|
|
while ((opt = getopt(argc, argv, "kmps:b:")) != -1) { |
while ((opt = getopt(argc, argv, "kmps:b:c:")) != -1) { |
switch (opt) { |
switch (opt) { |
case 'k': /* Stdin/Stdout Unix crypt */ |
case 'k': /* Stdin/Stdout Unix crypt */ |
if (operation != -1 || prompt) |
if (operation != -1 || prompt) |
|
|
operation = DO_BLF; |
operation = DO_BLF; |
rounds = atoi(optarg); |
rounds = atoi(optarg); |
extra = &rounds; |
extra = &rounds; |
|
break; |
|
|
|
case 'c': /* user login class */ |
|
extra = optarg; |
|
operation = -1; |
break; |
break; |
|
|
default: |
default: |