From b03bd394bf57de8882bed56e8e3a0ab8b963d0c5 Mon Sep 17 00:00:00 2001 From: mouring Date: Wed, 27 Dec 2000 04:57:41 +0000 Subject: [PATCH] 20001227 - (bal) Typo in configure.in: entut?ent should be endut?ent. Suggested by Takumi Yamane - (bal) Checks for getrlimit(), sysconf(), and setdtablesize(). Patch by Corinna Vinschen --- ChangeLog | 6 ++++++ configure.in | 6 +++--- ssh-agent.c | 4 ++++ ssh-keyscan.c | 12 ++++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a727479b..d23a7f55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +20001227 + - (bal) Typo in configure.in: entut?ent should be endut?ent. Suggested by + Takumi Yamane + - (bal) Checks for getrlimit(), sysconf(), and setdtablesize(). Patch + by Corinna Vinschen + 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 diff --git a/configure.in b/configure.in index 4601cd38..fa93d5e1 100644 --- a/configure.in +++ b/configure.in @@ -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, diff --git a/ssh-agent.c b/ssh-agent.c index 9c0a583e..55704e49 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -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); diff --git a/ssh-keyscan.c b/ssh-keyscan.c index d85cc337..41bd733c 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c @@ -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); } -- 2.45.1