|
Lines 250-255
Buffer loginmsg;
Link Here
|
| 250 |
/* Unprivileged user */ |
250 |
/* Unprivileged user */ |
| 251 |
struct passwd *privsep_pw = NULL; |
251 |
struct passwd *privsep_pw = NULL; |
| 252 |
|
252 |
|
|
|
253 |
#ifdef OOM_ADJUST |
| 254 |
/* Linux out-of-memory killer adjustment */ |
| 255 |
static char oom_adj_save[8]; |
| 256 |
#endif |
| 257 |
|
| 253 |
/* Prototypes for various functions defined later in this file. */ |
258 |
/* Prototypes for various functions defined later in this file. */ |
| 254 |
void destroy_sensitive_data(void); |
259 |
void destroy_sensitive_data(void); |
| 255 |
void demote_sensitive_data(void); |
260 |
void demote_sensitive_data(void); |
|
Lines 901-906
recv_rexec_state(int fd, Buffer *conf)
Link Here
|
| 901 |
debug3("%s: done", __func__); |
906 |
debug3("%s: done", __func__); |
| 902 |
} |
907 |
} |
| 903 |
|
908 |
|
|
|
909 |
#ifdef OOM_ADJUST |
| 910 |
/* |
| 911 |
* If requested in the environment, tell the Linux kernel's out-of-memory |
| 912 |
* killer to avoid sshd. The old state will be restored when forking child |
| 913 |
* processes. |
| 914 |
*/ |
| 915 |
static void |
| 916 |
oom_adjust_startup(void) |
| 917 |
{ |
| 918 |
const char *oom_adj = getenv("SSHD_OOM_ADJUST"); |
| 919 |
|
| 920 |
if (!oom_adj) |
| 921 |
return; |
| 922 |
oom_adj_get(oom_adj_save, sizeof(oom_adj_save)); |
| 923 |
oom_adj_set(oom_adj); |
| 924 |
} |
| 925 |
|
| 926 |
static void |
| 927 |
oom_restore(void) |
| 928 |
{ |
| 929 |
if (oom_adj_save[0]) |
| 930 |
oom_adj_set(oom_adj_save); |
| 931 |
} |
| 932 |
#endif |
| 933 |
|
| 904 |
/* Accept a connection from inetd */ |
934 |
/* Accept a connection from inetd */ |
| 905 |
static void |
935 |
static void |
| 906 |
server_accept_inetd(int *sock_in, int *sock_out) |
936 |
server_accept_inetd(int *sock_in, int *sock_out) |
|
Lines 1606-1611
main(int ac, char **av)
Link Here
|
| 1606 |
/* ignore SIGPIPE */ |
1636 |
/* ignore SIGPIPE */ |
| 1607 |
signal(SIGPIPE, SIG_IGN); |
1637 |
signal(SIGPIPE, SIG_IGN); |
| 1608 |
|
1638 |
|
|
|
1639 |
#ifdef OOM_ADJUST |
| 1640 |
/* Adjust out-of-memory killer */ |
| 1641 |
oom_adjust_startup(); |
| 1642 |
#endif |
| 1643 |
|
| 1609 |
/* Get a connection, either from inetd or a listening TCP socket */ |
1644 |
/* Get a connection, either from inetd or a listening TCP socket */ |
| 1610 |
if (inetd_flag) { |
1645 |
if (inetd_flag) { |
| 1611 |
server_accept_inetd(&sock_in, &sock_out); |
1646 |
server_accept_inetd(&sock_in, &sock_out); |
|
Lines 1643-1648
main(int ac, char **av)
Link Here
|
| 1643 |
|
1678 |
|
| 1644 |
/* This is the child processing a new connection. */ |
1679 |
/* This is the child processing a new connection. */ |
| 1645 |
setproctitle("%s", "[accepted]"); |
1680 |
setproctitle("%s", "[accepted]"); |
|
|
1681 |
|
| 1682 |
#ifdef OOM_ADJUST |
| 1683 |
oom_restore(); |
| 1684 |
#endif |
| 1646 |
|
1685 |
|
| 1647 |
/* |
1686 |
/* |
| 1648 |
* Create a new session and process group since the 4.4BSD |
1687 |
* Create a new session and process group since the 4.4BSD |