1 diff -ur openssh-3.2.3p1.orig/session.c openssh-3.2.3p1/session.c
2 --- openssh-3.2.3p1.orig/session.c Mon May 13 02:48:58 2002
3 +++ openssh-3.2.3p1/session.c Thu May 30 21:33:40 2002
8 +struct _user_limits_struct {
10 + struct rlimit limit;
13 +static int _save_limits(struct _user_limits_struct *pl)
18 + for(i = 0; i < RLIM_NLIMITS; i++) {
19 + pl[i].supported = 0;
20 + pl[i].limit.rlim_cur = RLIM_INFINITY;
21 + pl[i].limit.rlim_max = RLIM_INFINITY;
22 + r = getrlimit(i, &pl[i].limit);
24 + if (errno != EINVAL) {
28 + pl[i].supported = 1;
35 +static void _restore_limits(struct _user_limits_struct *pl)
40 + for (i=0; i<RLIM_NLIMITS; i++) {
41 + if (pl[i].supported)
42 + status |= setrlimit(i, &pl[i].limit);
47 * This is called to fork and execute a command when we have no tty. This
48 * will call do_child from the child, and server_loop from the parent after
50 do_exec_no_pty(Session *s, const char *command)
54 + struct _user_limits_struct pl[RLIM_NLIMITS];
58 int pin[2], pout[2], perr[2];
64 do_pam_session(s->pw->pw_name, NULL);
66 if (is_pam_password_change_required())
72 + _restore_limits(pl);
76 cygwin_set_impersonation_token(INVALID_HANDLE_VALUE);
79 int fdout, ptyfd, ttyfd, ptymaster;
82 + struct _user_limits_struct pl[RLIM_NLIMITS];
86 fatal("do_exec_pty: no session");
92 do_pam_session(s->pw->pw_name, s->tty);
100 + _restore_limits(pl);
101 +#endif /* USE_PAM */
104 cygwin_set_impersonation_token(INVALID_HANDLE_VALUE);