version 1.187, 2010/04/16 06:47:04 |
version 1.189, 2010/04/23 22:48:31 |
|
|
struct passwd *pw; |
struct passwd *pw; |
struct stat st; |
struct stat st; |
int opt, type, fd; |
int opt, type, fd; |
|
u_int maxbits; |
u_int32_t memory = 0, generator_wanted = 0, trials = 100; |
u_int32_t memory = 0, generator_wanted = 0, trials = 100; |
int do_gen_candidates = 0, do_screen_candidates = 0; |
int do_gen_candidates = 0, do_screen_candidates = 0; |
BIGNUM *start = NULL; |
BIGNUM *start = NULL; |
|
|
} |
} |
if (bits == 0) |
if (bits == 0) |
bits = (type == KEY_DSA) ? DEFAULT_BITS_DSA : DEFAULT_BITS; |
bits = (type == KEY_DSA) ? DEFAULT_BITS_DSA : DEFAULT_BITS; |
|
maxbits = (type == KEY_DSA) ? |
|
OPENSSL_DSA_MAX_MODULUS_BITS : OPENSSL_RSA_MAX_MODULUS_BITS; |
|
if (bits > maxbits) { |
|
fprintf(stderr, "key bits exceeds maximum %d\n", maxbits); |
|
exit(1); |
|
} |
if (type == KEY_DSA && bits != 1024) |
if (type == KEY_DSA && bits != 1024) |
fatal("DSA keys must be 1024 bits"); |
fatal("DSA keys must be 1024 bits"); |
if (!quiet) |
if (!quiet) |
|
|
ask_filename(pw, "Enter file in which to save the key"); |
ask_filename(pw, "Enter file in which to save the key"); |
|
|
/* Create ~/.ssh directory if it doesn't already exist. */ |
/* Create ~/.ssh directory if it doesn't already exist. */ |
snprintf(dotsshdir, sizeof dotsshdir, "%s/%s", pw->pw_dir, _PATH_SSH_USER_DIR); |
snprintf(dotsshdir, sizeof dotsshdir, "%s/%s", |
if (strstr(identity_file, dotsshdir) != NULL && |
pw->pw_dir, _PATH_SSH_USER_DIR); |
stat(dotsshdir, &st) < 0) { |
if (strstr(identity_file, dotsshdir) != NULL) { |
if (mkdir(dotsshdir, 0700) < 0) |
if (stat(dotsshdir, &st) < 0) { |
error("Could not create directory '%s'.", dotsshdir); |
if (errno != ENOENT) { |
else if (!quiet) |
error("Could not stat %s: %s", dotsshdir, |
printf("Created directory '%s'.\n", dotsshdir); |
strerror(errno)); |
|
} else if (mkdir(dotsshdir, 0700) < 0) { |
|
error("Could not create directory '%s': %s", |
|
dotsshdir, strerror(errno)); |
|
} else if (!quiet) |
|
printf("Created directory '%s'.\n", dotsshdir); |
|
} |
} |
} |
/* If the file already exists, ask the user to confirm. */ |
/* If the file already exists, ask the user to confirm. */ |
if (stat(identity_file, &st) >= 0) { |
if (stat(identity_file, &st) >= 0) { |