20001227
- (bal) Typo in configure.in: entut?ent should be endut?ent. Suggested by Takumi Yamane <yamtak@b-session.com> - (bal) Checks for getrlimit(), sysconf(), and setdtablesize(). Patch by Corinna Vinschen <vinschen@redhat.com>
This commit is contained in:
parent
3deda8b091
commit
2c467a20f4
|
@ -1,3 +1,9 @@
|
|||
20001227
|
||||
- (bal) Typo in configure.in: entut?ent should be endut?ent. Suggested by
|
||||
Takumi Yamane <yamtak@b-session.com>
|
||||
- (bal) Checks for getrlimit(), sysconf(), and setdtablesize(). Patch
|
||||
by Corinna Vinschen <vinschen@redhat.com>
|
||||
|
||||
20001223
|
||||
- (bal) Fixed Makefile.in to support recompile of all ssh and sshd objects
|
||||
if a change to config.h has occurred. Suggested by Gert Doering
|
||||
|
|
|
@ -304,16 +304,16 @@ fi
|
|||
AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h vis.h)
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getnameinfo getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strsep strtok_r vsnprintf vhangup vis waitpid _getpty __b64_ntop)
|
||||
AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strsep strtok_r sysconf vsnprintf vhangup vis waitpid _getpty __b64_ntop)
|
||||
dnl Checks for time functions
|
||||
AC_CHECK_FUNCS(gettimeofday time)
|
||||
dnl Checks for libutil functions
|
||||
AC_CHECK_FUNCS(login logout updwtmp logwtmp)
|
||||
dnl Checks for utmp functions
|
||||
AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
|
||||
AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
|
||||
AC_CHECK_FUNCS(utmpname)
|
||||
dnl Checks for utmpx functions
|
||||
AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
|
||||
AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
|
||||
AC_CHECK_FUNCS(setutxent utmpxname)
|
||||
|
||||
AC_CHECK_FUNC(getuserattr,
|
||||
|
|
|
@ -674,7 +674,9 @@ main(int ac, char **av)
|
|||
fd_set readset, writeset;
|
||||
int sock, c_flag = 0, k_flag = 0, s_flag = 0, ch;
|
||||
struct sockaddr_un sunaddr;
|
||||
#ifdef HAVE_SETRLIMIT
|
||||
struct rlimit rlim;
|
||||
#endif
|
||||
pid_t pid;
|
||||
char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid];
|
||||
extern int optind;
|
||||
|
@ -805,12 +807,14 @@ main(int ac, char **av)
|
|||
close(1);
|
||||
close(2);
|
||||
|
||||
#ifdef HAVE_SETRLIMIT
|
||||
/* deny core dumps, since memory contains unencrypted private keys */
|
||||
rlim.rlim_cur = rlim.rlim_max = 0;
|
||||
if (setrlimit(RLIMIT_CORE, &rlim) < 0) {
|
||||
perror("setrlimit rlimit_core failed");
|
||||
cleanup_exit(1);
|
||||
}
|
||||
#endif
|
||||
if (setsid() == -1) {
|
||||
perror("setsid");
|
||||
cleanup_exit(1);
|
||||
|
|
|
@ -183,6 +183,7 @@ getline(Linebuf * lb)
|
|||
static int
|
||||
fdlim_get(int hard)
|
||||
{
|
||||
#if defined(HAVE_GETRLIMIT)
|
||||
struct rlimit rlfd;
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)
|
||||
return (-1);
|
||||
|
@ -190,19 +191,30 @@ fdlim_get(int hard)
|
|||
return 10000;
|
||||
else
|
||||
return hard ? rlfd.rlim_max : rlfd.rlim_cur;
|
||||
#elif defined (HAVE_SYSCONF)
|
||||
return sysconf (_SC_OPEN_MAX);
|
||||
#else
|
||||
return 10000;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
fdlim_set(int lim)
|
||||
{
|
||||
#if defined(HAVE_SETRLIMIT)
|
||||
struct rlimit rlfd;
|
||||
#endif
|
||||
if (lim <= 0)
|
||||
return (-1);
|
||||
#if defined(HAVE_SETRLIMIT)
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)
|
||||
return (-1);
|
||||
rlfd.rlim_cur = lim;
|
||||
if (setrlimit(RLIMIT_NOFILE, &rlfd) < 0)
|
||||
return (-1);
|
||||
#elif defined (HAVE_SETDTABLESIZE)
|
||||
setdtablesize (lim);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue