|
Lines 160-165
login_cap_t *lc;
Link Here
|
| 160 |
|
160 |
|
| 161 |
static int is_child = 0; |
161 |
static int is_child = 0; |
| 162 |
static int in_chroot = 0; |
162 |
static int in_chroot = 0; |
|
|
163 |
static int have_dev_log = 1; |
| 163 |
|
164 |
|
| 164 |
/* Name and directory of socket for authentication agent forwarding. */ |
165 |
/* Name and directory of socket for authentication agent forwarding. */ |
| 165 |
static char *auth_sock_name = NULL; |
166 |
static char *auth_sock_name = NULL; |
|
Lines 365-372
do_exec_no_pty(Session *s, const char *c
Link Here
|
| 365 |
is_child = 1; |
366 |
is_child = 1; |
| 366 |
|
367 |
|
| 367 |
/* Child. Reinitialize the log since the pid has changed. */ |
368 |
/* Child. Reinitialize the log since the pid has changed. */ |
| 368 |
log_init(__progname, options.log_level, |
369 |
log_init_handler(__progname, options.log_level, |
| 369 |
options.log_facility, log_stderr); |
370 |
options.log_facility, log_stderr, have_dev_log); |
| 370 |
|
371 |
|
| 371 |
/* |
372 |
/* |
| 372 |
* Create a new session and process group since the 4.4BSD |
373 |
* Create a new session and process group since the 4.4BSD |
|
Lines 523-530
do_exec_pty(Session *s, const char *comm
Link Here
|
| 523 |
close(ptymaster); |
524 |
close(ptymaster); |
| 524 |
|
525 |
|
| 525 |
/* Child. Reinitialize the log because the pid has changed. */ |
526 |
/* Child. Reinitialize the log because the pid has changed. */ |
| 526 |
log_init(__progname, options.log_level, |
527 |
log_init_handler(__progname, options.log_level, |
| 527 |
options.log_facility, log_stderr); |
528 |
options.log_facility, log_stderr, have_dev_log); |
| 528 |
/* Close the master side of the pseudo tty. */ |
529 |
/* Close the master side of the pseudo tty. */ |
| 529 |
close(ptyfd); |
530 |
close(ptyfd); |
| 530 |
|
531 |
|
|
Lines 619-624
do_exec(Session *s, const char *command)
Link Here
|
| 619 |
int ret; |
620 |
int ret; |
| 620 |
const char *forced = NULL, *tty = NULL; |
621 |
const char *forced = NULL, *tty = NULL; |
| 621 |
char session_type[1024]; |
622 |
char session_type[1024]; |
|
|
623 |
struct stat dev_log_stat; |
| 622 |
|
624 |
|
| 623 |
if (options.adm_forced_command) { |
625 |
if (options.adm_forced_command) { |
| 624 |
original_command = command; |
626 |
original_command = command; |
|
Lines 676-681
do_exec(Session *s, const char *command)
Link Here
|
| 676 |
tty += 5; |
678 |
tty += 5; |
| 677 |
} |
679 |
} |
| 678 |
|
680 |
|
|
|
681 |
if (lstat("/dev/log", &dev_log_stat) != 0) { |
| 682 |
have_dev_log = 0; |
| 683 |
} |
| 684 |
|
| 679 |
verbose("Starting session: %s%s%s for %s from %.200s port %d id %d", |
685 |
verbose("Starting session: %s%s%s for %s from %.200s port %d id %d", |
| 680 |
session_type, |
686 |
session_type, |
| 681 |
tty == NULL ? "" : " on ", |
687 |
tty == NULL ? "" : " on ", |
|
Lines 1486-1499
child_close_fds(void)
Link Here
|
| 1486 |
* descriptors left by system functions. They will be closed later. |
1492 |
* descriptors left by system functions. They will be closed later. |
| 1487 |
*/ |
1493 |
*/ |
| 1488 |
endpwent(); |
1494 |
endpwent(); |
| 1489 |
|
|
|
| 1490 |
/* |
| 1491 |
* Close any extra open file descriptors so that we don't have them |
| 1492 |
* hanging around in clients. Note that we want to do this after |
| 1493 |
* initgroups, because at least on Solaris 2.3 it leaves file |
| 1494 |
* descriptors open. |
| 1495 |
*/ |
| 1496 |
closefrom(STDERR_FILENO + 1); |
| 1497 |
} |
1495 |
} |
| 1498 |
|
1496 |
|
| 1499 |
/* |
1497 |
/* |
|
Lines 1629-1636
do_child(Session *s, const char *command
Link Here
|
| 1629 |
exit(1); |
1627 |
exit(1); |
| 1630 |
} |
1628 |
} |
| 1631 |
|
1629 |
|
| 1632 |
closefrom(STDERR_FILENO + 1); |
|
|
| 1633 |
|
| 1634 |
do_rc_files(s, shell); |
1630 |
do_rc_files(s, shell); |
| 1635 |
|
1631 |
|
| 1636 |
/* restore SIGPIPE for child */ |
1632 |
/* restore SIGPIPE for child */ |
|
Lines 1653-1661
do_child(Session *s, const char *command
Link Here
|
| 1653 |
argv[i] = NULL; |
1649 |
argv[i] = NULL; |
| 1654 |
optind = optreset = 1; |
1650 |
optind = optreset = 1; |
| 1655 |
__progname = argv[0]; |
1651 |
__progname = argv[0]; |
| 1656 |
exit(sftp_server_main(i, argv, s->pw)); |
1652 |
exit(sftp_server_main(i, argv, s->pw, have_dev_log)); |
| 1657 |
} |
1653 |
} |
| 1658 |
|
1654 |
|
|
|
1655 |
/* |
| 1656 |
* Close any extra open file descriptors so that we don't have them |
| 1657 |
* hanging around in clients. Note that we want to do this after |
| 1658 |
* initgroups, because at least on Solaris 2.3 it leaves file |
| 1659 |
* descriptors open. |
| 1660 |
*/ |
| 1661 |
closefrom(STDERR_FILENO + 1); |
| 1662 |
|
| 1659 |
fflush(NULL); |
1663 |
fflush(NULL); |
| 1660 |
|
1664 |
|
| 1661 |
/* Get the last component of the shell name. */ |
1665 |
/* Get the last component of the shell name. */ |