|
Lines 509-515
Link Here
|
| 509 |
struct stat st; |
509 |
struct stat st; |
| 510 |
int status, devnull, p[2], i; |
510 |
int status, devnull, p[2], i; |
| 511 |
pid_t pid; |
511 |
pid_t pid; |
| 512 |
char *username, errmsg[512]; |
512 |
long len; |
|
|
513 |
char *username, *keytext, errmsg[512]; |
| 513 |
|
514 |
|
| 514 |
if (options.authorized_keys_command == NULL || |
515 |
if (options.authorized_keys_command == NULL || |
| 515 |
options.authorized_keys_command[0] != '/') |
516 |
options.authorized_keys_command[0] != '/') |
|
Lines 567-572
Link Here
|
| 567 |
case 0: /* child */ |
568 |
case 0: /* child */ |
| 568 |
for (i = 0; i < NSIG; i++) |
569 |
for (i = 0; i < NSIG; i++) |
| 569 |
signal(i, SIG_DFL); |
570 |
signal(i, SIG_DFL); |
|
|
571 |
|
| 572 |
setenv(SSH_KEY_FINGERPRINT_ENV_NAME, |
| 573 |
key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX), 1); |
| 574 |
|
| 575 |
if ((f = tmpfile()) == NULL) { |
| 576 |
error("%s: tmpfile: %s", __func__, strerror(errno)); |
| 577 |
_exit(1); |
| 578 |
} |
| 579 |
if (!key_write(key, f)) { |
| 580 |
error("%s: key_write: %s", __func__, strerror(errno)); |
| 581 |
_exit(1); |
| 582 |
} |
| 583 |
if ((len = ftell(f)) == -1) { |
| 584 |
error("%s: ftell: %s", __func__, strerror(errno)); |
| 585 |
_exit(1); |
| 586 |
} |
| 587 |
if ((keytext = xmalloc(len + 1)) == NULL) { |
| 588 |
error("%s: xmalloc: %s", __func__, strerror(errno)); |
| 589 |
_exit(1); |
| 590 |
} |
| 591 |
if ((fseek(f, 0, SEEK_SET)) != 0) { |
| 592 |
error("%s: fseek: %s", __func__, strerror(errno)); |
| 593 |
_exit(1); |
| 594 |
} |
| 595 |
if (fread(keytext, 1, len, f) != len) { |
| 596 |
error("%s: fread: %s", __func__, strerror(errno)); |
| 597 |
_exit(1); |
| 598 |
} |
| 599 |
keytext[len] = '\0'; |
| 600 |
fclose(f); |
| 601 |
setenv(SSH_KEY_ENV_NAME, keytext, 1); |
| 570 |
|
602 |
|
| 571 |
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) { |
603 |
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) { |
| 572 |
error("%s: open %s: %s", __func__, _PATH_DEVNULL, |
604 |
error("%s: open %s: %s", __func__, _PATH_DEVNULL, |