From dc3c757f577ba1f81df4a65c3fd3dcb79f3bb8c2 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Fri, 4 Oct 2002 23:54:54 +0000 Subject: - (bal) Disable post-authentication Privsep for OSF/1. It conflicts with SIA. --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 5fe50e56b..c7223c7aa 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.89 2002/09/26 00:38:47 tim Exp $ +# $Id: configure.ac,v 1.90 2002/10/04 23:54:55 mouring Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -330,6 +330,7 @@ mips-sony-bsd|mips-sony-newsos4) AC_MSG_RESULT(no) fi fi + AC_DEFINE(DISABLE_FD_PASSING) ;; *-*-nto-qnx) -- cgit v1.2.3 From 3e0064781bfd3a0efdd28ee84f34a3807ff2988a Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Wed, 16 Oct 2002 00:24:03 +0000 Subject: - (bal) More advanced strsep test by Darren Tucker --- ChangeLog | 3 ++- configure.ac | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 315a37328..0947b39e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 20021015 - (bal) Fix bug id 383 and only call loginrestrict for AIX if not root. + - (bal) More advanced strsep test by Darren Tucker 20021015 - (tim) [contrib/caldera/openssh.spec] make ssh-agent setgid nobody @@ -767,4 +768,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2495 2002/10/16 00:13:52 mouring Exp $ +$Id: ChangeLog,v 1.2496 2002/10/16 00:24:03 mouring Exp $ diff --git a/configure.ac b/configure.ac index c7223c7aa..4be5f641e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.90 2002/10/04 23:54:55 mouring Exp $ +# $Id: configure.ac,v 1.91 2002/10/16 00:24:05 mouring Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -605,9 +605,12 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ realpath recvmsg rresvport_af sendmsg setdtablesize setegid \ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ - socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \ + socketpair strerror strlcat strlcpy strmode sysconf tcgetpgrp \ truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty) +dnl Make sure strsep prototype is defined before defining HAVE_STRSEP +AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)]) + dnl IRIX and Solaris 2.5.1 have dirname() in libgen AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[ AC_CHECK_LIB(gen, dirname,[ -- cgit v1.2.3 From be2396458eb442f095402019609d425fd54cacc1 Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Wed, 13 Nov 2002 15:55:55 -0800 Subject: [configure.ac] remove unused variables no_libsocket and no_libnsl --- ChangeLog | 5 ++++- configure.ac | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index ebcda10f5..57c6d6d62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +20021113 + - (tim) [configure.ac] remove unused variables no_libsocket and no_libnsl + 20021111 - (tim) [contrib/solaris/opensshd.in] add umask 022 so sshd.pid is not world writable. @@ -822,4 +825,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2512 2002/11/13 23:50:04 tim Exp $ +$Id: ChangeLog,v 1.2513 2002/11/13 23:55:55 tim Exp $ diff --git a/configure.ac b/configure.ac index 4be5f641e..0736e41ab 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.91 2002/10/16 00:24:05 mouring Exp $ +# $Id: configure.ac,v 1.92 2002/11/13 23:55:57 tim Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -290,8 +290,6 @@ mips-sony-bsd|mips-sony-newsos4) MANTYPE=man ;; *-*-unicosmk*) - no_libsocket=1 - no_libnsl=1 AC_DEFINE(USE_PIPES) AC_DEFINE(DISABLE_FD_PASSING) LDFLAGS="$LDFLAGS" @@ -299,8 +297,6 @@ mips-sony-bsd|mips-sony-newsos4) MANTYPE=cat ;; *-*-unicos*) - no_libsocket=1 - no_libnsl=1 AC_DEFINE(USE_PIPES) AC_DEFINE(DISABLE_FD_PASSING) AC_DEFINE(NO_SSH_LASTLOG) -- cgit v1.2.3 From 1c9e688548a0f47fcfe41de43625f5b8a7d500dd Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Fri, 22 Nov 2002 13:29:01 -0800 Subject: [configure.ac] fix STDPATH test for IRIX. First reported by advax@triumf.ca. This type of solution tested by --- ChangeLog | 6 +++++- configure.ac | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 57c6d6d62..f8fdc9bab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20021122 + - (tim) [configure.ac] fix STDPATH test for IRIX. First reported by + advax@triumf.ca. This type of solution tested by + 20021113 - (tim) [configure.ac] remove unused variables no_libsocket and no_libnsl @@ -825,4 +829,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2513 2002/11/13 23:55:55 tim Exp $ +$Id: ChangeLog,v 1.2514 2002/11/22 21:29:01 tim Exp $ diff --git a/configure.ac b/configure.ac index 0736e41ab..e96a0721d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.92 2002/11/13 23:55:57 tim Exp $ +# $Id: configure.ac,v 1.93 2002/11/22 21:29:03 tim Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -2060,7 +2060,11 @@ Edit /etc/login.conf instead.]) # include #endif #ifndef _PATH_STDPATH -# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" +# ifdef _PATH_USERPATH /* Irix */ +# define _PATH_STDPATH _PATH_USERPATH +# else +# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" +# endif #endif #include #include -- cgit v1.2.3 From e832819cf7289b467070fc31c5080c133f0a101e Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 7 Jan 2003 15:18:32 +1100 Subject: - (djm) Bug #26: Use local mkstemp() rather than glibc's silly one. Fixes Can't pass KRB4 TGT passing. Fix from: jan.iven@cern.ch --- ChangeLog | 4 +++- acconfig.h | 5 ++++- configure.ac | 28 +++++++++++++++++++++++++++- openbsd-compat/mktemp.c | 4 ++-- openbsd-compat/mktemp.h | 6 +++--- 5 files changed, 39 insertions(+), 8 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 3be46f5cb..681c51f1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ Based on fix from yoshfuji@linux-ipv6.org - (djm) Bug #442: Check for and deny access to accounts with locked passwords. Patch from dtucker@zip.com.au + - (djm) Bug #26: Use local mkstemp() rather than glibc's silly one. Fixes + Can't pass KRB4 TGT passing. Fix from: jan.iven@cern.ch 20030103 - (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from @@ -931,4 +933,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2542 2003/01/07 01:19:32 djm Exp $ +$Id: ChangeLog,v 1.2543 2003/01/07 04:18:32 djm Exp $ diff --git a/acconfig.h b/acconfig.h index 3e058f3ea..314cbaaa4 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,4 +1,4 @@ -/* $Id: acconfig.h,v 1.145 2002/09/26 00:38:48 tim Exp $ */ +/* $Id: acconfig.h,v 1.146 2003/01/07 04:18:33 djm Exp $ */ #ifndef _CONFIG_H #define _CONFIG_H @@ -364,6 +364,9 @@ /* Define if your platform needs to skip post auth file descriptor passing */ #undef DISABLE_FD_PASSING +/* Silly mkstemp() */ +#undef HAVE_STRICT_MKSTEMP + @BOTTOM@ /* ******************* Shouldn't need to edit below this line ************** */ diff --git a/configure.ac b/configure.ac index e96a0721d..f01c0c642 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.93 2002/11/22 21:29:03 tim Exp $ +# $Id: configure.ac,v 1.94 2003/01/07 04:18:33 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -680,6 +680,32 @@ int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} ) fi +dnl see whether mkstemp() requires XXXXXX +if test "x$ac_cv_func_mkdtemp" = "xyes" ; then +AC_MSG_CHECKING([for (overly) strict mkstemp]) +AC_TRY_RUN( + [ +#include +main() { char template[]="conftest.mkstemp-test"; +if (mkstemp(template) == -1) + exit(1); +unlink(template); exit(0); +} + ], + [ + AC_MSG_RESULT(no) + ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_STRICT_MKSTEMP) + ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_STRICT_MKSTEMP) + ] +) +fi + AC_FUNC_GETPGRP # Check for PAM libs diff --git a/openbsd-compat/mktemp.c b/openbsd-compat/mktemp.c index d256ee448..c951050c0 100644 --- a/openbsd-compat/mktemp.c +++ b/openbsd-compat/mktemp.c @@ -36,7 +36,7 @@ #include "includes.h" -#ifndef HAVE_MKDTEMP +#if !defined(HAVE_MKDTEMP) || defined(HAVE_STRICT_MKSTEMP) #if defined(LIBC_SCCS) && !defined(lint) static char rcsid[] = "$OpenBSD: mktemp.c,v 1.16 2002/05/27 18:20:45 millert Exp $"; @@ -181,4 +181,4 @@ _gettemp(path, doopen, domkdir, slen) /*NOTREACHED*/ } -#endif /* !HAVE_MKDTEMP */ +#endif /* !defined(HAVE_MKDTEMP) || defined(HAVE_STRICT_MKSTEMP) */ diff --git a/openbsd-compat/mktemp.h b/openbsd-compat/mktemp.h index 6a96f6fa6..505ca6a1f 100644 --- a/openbsd-compat/mktemp.h +++ b/openbsd-compat/mktemp.h @@ -1,13 +1,13 @@ -/* $Id: mktemp.h,v 1.2 2001/02/09 01:55:36 djm Exp $ */ +/* $Id: mktemp.h,v 1.3 2003/01/07 04:18:33 djm Exp $ */ #ifndef _BSD_MKTEMP_H #define _BSD_MKTEMP_H #include "config.h" -#ifndef HAVE_MKDTEMP +#if !defined(HAVE_MKDTEMP) || defined(HAVE_STRICT_MKSTEMP) int mkstemps(char *path, int slen); int mkstemp(char *path); char *mkdtemp(char *path); -#endif /* !HAVE_MKDTEMP */ +#endif /* !defined(HAVE_MKDTEMP) || defined(HAVE_STRICT_MKSTEMP) */ #endif /* _BSD_MKTEMP_H */ -- cgit v1.2.3 From b93addb6d667b36bdbb298b8b3c581c1738c0c9f Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 7 Jan 2003 17:04:18 +1100 Subject: - (djm) Bug #111: Run syslog and stderr logging through strnvis to eliminate nasties. Report from peak@argo.troja.mff.cuni.cz --- ChangeLog | 4 +- configure.ac | 6 +- log.c | 7 +- openbsd-compat/Makefile.in | 4 +- openbsd-compat/openbsd-compat.h | 3 +- openbsd-compat/vis.c | 232 ++++++++++++++++++++++++++++++++++++++++ openbsd-compat/vis.h | 91 ++++++++++++++++ 7 files changed, 338 insertions(+), 9 deletions(-) create mode 100644 openbsd-compat/vis.c create mode 100644 openbsd-compat/vis.h (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 0ab9043a1..0c7bfaca0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ - (djm) Fix Bug #442 for PAM case - (djm) Bug #110: bogus error messages in lastlog_get_entry(). Fix based on one by peak@argo.troja.mff.cuni.cz + - (djm) Bug #111: Run syslog and stderr logging through strnvis to eliminate + nasties. Report from peak@argo.troja.mff.cuni.cz 20030103 - (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from @@ -936,4 +938,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2545 2003/01/07 05:46:58 djm Exp $ +$Id: ChangeLog,v 1.2546 2003/01/07 06:04:18 djm Exp $ diff --git a/configure.ac b/configure.ac index f01c0c642..d4213af5f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.94 2003/01/07 04:18:33 djm Exp $ +# $Id: configure.ac,v 1.95 2003/01/07 06:04:18 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -601,8 +601,8 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ realpath recvmsg rresvport_af sendmsg setdtablesize setegid \ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ - socketpair strerror strlcat strlcpy strmode sysconf tcgetpgrp \ - truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty) + socketpair strerror strlcat strlcpy strmode strvis sysconf \ + tcgetpgrp truncate utimes vhangup vsnprintf waitpid __b64_ntop \ _getpty) dnl Make sure strsep prototype is defined before defining HAVE_STRSEP AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)]) diff --git a/log.c b/log.c index 96626d7d4..ead7e9028 100644 --- a/log.c +++ b/log.c @@ -386,11 +386,14 @@ do_log(LogLevel level, const char *fmt, va_list args) } else { vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); } + /* Escape magic chars in output. */ + strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_OCTAL); + if (log_on_stderr) { - fprintf(stderr, "%s\r\n", msgbuf); + fprintf(stderr, "%s\r\n", fmtbuf); } else { openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility); - syslog(pri, "%.500s", msgbuf); + syslog(pri, "%.500s", fmtbuf); closelog(); } } diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in index 5229e7e20..8b1e5b538 100644 --- a/openbsd-compat/Makefile.in +++ b/openbsd-compat/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.23 2002/09/12 00:33:02 djm Exp $ +# $Id: Makefile.in,v 1.24 2003/01/07 06:04:18 djm Exp $ sysconfdir=@sysconfdir@ piddir=@piddir@ @@ -16,7 +16,7 @@ RANLIB=@RANLIB@ INSTALL=@INSTALL@ LDFLAGS=-L. @LDFLAGS@ -OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o +OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o vis.o COMPAT=bsd-arc4random.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o bsd-misc.o bsd-nextstep.o bsd-snprintf.o bsd-waitpid.o fake-getaddrinfo.o fake-getnameinfo.o xmmap.o diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index ae18afd34..dcb7ba15b 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h @@ -1,4 +1,4 @@ -/* $Id: openbsd-compat.h,v 1.17 2002/09/12 00:33:02 djm Exp $ */ +/* $Id: openbsd-compat.h,v 1.18 2003/01/07 06:04:18 djm Exp $ */ #ifndef _OPENBSD_H #define _OPENBSD_H @@ -26,6 +26,7 @@ #include "glob.h" #include "readpassphrase.h" #include "getopt.h" +#include "vis.h" /* Home grown routines */ #include "bsd-arc4random.h" diff --git a/openbsd-compat/vis.c b/openbsd-compat/vis.c new file mode 100644 index 000000000..303a9a5b3 --- /dev/null +++ b/openbsd-compat/vis.c @@ -0,0 +1,232 @@ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include "config.h" +#if !defined(HAVE_STRVIS) + +#if defined(LIBC_SCCS) && !defined(lint) +static char rcsid[] = "$OpenBSD: vis.c,v 1.8 2002/02/19 19:39:36 millert Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include + +#include "vis.h" + +#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') +#define isvisible(c) (((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \ + isgraph((u_char)(c))) || \ + ((flag & VIS_SP) == 0 && (c) == ' ') || \ + ((flag & VIS_TAB) == 0 && (c) == '\t') || \ + ((flag & VIS_NL) == 0 && (c) == '\n') || \ + ((flag & VIS_SAFE) && \ + ((c) == '\b' || (c) == '\007' || (c) == '\r'))) + +/* + * vis - visually encode characters + */ +char * +vis(dst, c, flag, nextc) + register char *dst; + int c, nextc; + register int flag; +{ + if (isvisible(c)) { + *dst++ = c; + if (c == '\\' && (flag & VIS_NOSLASH) == 0) + *dst++ = '\\'; + *dst = '\0'; + return (dst); + } + + if (flag & VIS_CSTYLE) { + switch(c) { + case '\n': + *dst++ = '\\'; + *dst++ = 'n'; + goto done; + case '\r': + *dst++ = '\\'; + *dst++ = 'r'; + goto done; + case '\b': + *dst++ = '\\'; + *dst++ = 'b'; + goto done; + case '\a': + *dst++ = '\\'; + *dst++ = 'a'; + goto done; + case '\v': + *dst++ = '\\'; + *dst++ = 'v'; + goto done; + case '\t': + *dst++ = '\\'; + *dst++ = 't'; + goto done; + case '\f': + *dst++ = '\\'; + *dst++ = 'f'; + goto done; + case ' ': + *dst++ = '\\'; + *dst++ = 's'; + goto done; + case '\0': + *dst++ = '\\'; + *dst++ = '0'; + if (isoctal(nextc)) { + *dst++ = '0'; + *dst++ = '0'; + } + goto done; + } + } + if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) { + *dst++ = '\\'; + *dst++ = ((u_char)c >> 6 & 07) + '0'; + *dst++ = ((u_char)c >> 3 & 07) + '0'; + *dst++ = ((u_char)c & 07) + '0'; + goto done; + } + if ((flag & VIS_NOSLASH) == 0) + *dst++ = '\\'; + if (c & 0200) { + c &= 0177; + *dst++ = 'M'; + } + if (iscntrl(c)) { + *dst++ = '^'; + if (c == 0177) + *dst++ = '?'; + else + *dst++ = c + '@'; + } else { + *dst++ = '-'; + *dst++ = c; + } +done: + *dst = '\0'; + return (dst); +} + +/* + * strvis, strnvis, strvisx - visually encode characters from src into dst + * + * Dst must be 4 times the size of src to account for possible + * expansion. The length of dst, not including the trailing NULL, + * is returned. + * + * Strnvis will write no more than siz-1 bytes (and will NULL terminate). + * The number of bytes needed to fully encode the string is returned. + * + * Strvisx encodes exactly len bytes from src into dst. + * This is useful for encoding a block of data. + */ +int +strvis(dst, src, flag) + register char *dst; + register const char *src; + int flag; +{ + register char c; + char *start; + + for (start = dst; (c = *src);) + dst = vis(dst, c, flag, *++src); + *dst = '\0'; + return (dst - start); +} + +int +strnvis(dst, src, siz, flag) + register char *dst; + register const char *src; + size_t siz; + int flag; +{ + register char c; + char *start, *end; + + for (start = dst, end = start + siz - 1; (c = *src) && dst < end; ) { + if (isvisible(c)) { + *dst++ = c; + if (c == '\\' && (flag & VIS_NOSLASH) == 0) { + /* need space for the extra '\\' */ + if (dst < end) + *dst++ = '\\'; + else { + dst--; + break; + } + } + src++; + } else { + /* vis(3) requires up to 4 chars */ + if (dst + 3 < end) + dst = vis(dst, c, flag, *++src); + else + break; + } + } + *dst = '\0'; + if (dst >= end) { + char tbuf[5]; + + /* adjust return value for truncation */ + while ((c = *src)) + dst += vis(tbuf, c, flag, *++src) - tbuf; + } + return (dst - start); +} + +int +strvisx(dst, src, len, flag) + register char *dst; + register const char *src; + register size_t len; + int flag; +{ + register char c; + char *start; + + for (start = dst; len > 1; len--) { + c = *src; + dst = vis(dst, c, flag, *++src); + } + if (len) + dst = vis(dst, *src, flag, '\0'); + *dst = '\0'; + return (dst - start); +} + +#endif diff --git a/openbsd-compat/vis.h b/openbsd-compat/vis.h new file mode 100644 index 000000000..98924bde4 --- /dev/null +++ b/openbsd-compat/vis.h @@ -0,0 +1,91 @@ +/* $OpenBSD: vis.h,v 1.5 2002/02/16 21:27:17 millert Exp $ */ +/* $NetBSD: vis.h,v 1.4 1994/10/26 00:56:41 cgd Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vis.h 5.9 (Berkeley) 4/3/91 + */ +#include "config.h" +#if !defined(HAVE_STRVIS) + +#ifndef _VIS_H_ +#define _VIS_H_ + +#include +#include + +/* + * to select alternate encoding format + */ +#define VIS_OCTAL 0x01 /* use octal \ddd format */ +#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */ + +/* + * to alter set of characters encoded (default is to encode all + * non-graphic except space, tab, and newline). + */ +#define VIS_SP 0x04 /* also encode space */ +#define VIS_TAB 0x08 /* also encode tab */ +#define VIS_NL 0x10 /* also encode newline */ +#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL) +#define VIS_SAFE 0x20 /* only encode "unsafe" characters */ + +/* + * other + */ +#define VIS_NOSLASH 0x40 /* inhibit printing '\' */ + +/* + * unvis return codes + */ +#define UNVIS_VALID 1 /* character valid */ +#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */ +#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */ +#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */ +#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */ + +/* + * unvis flags + */ +#define UNVIS_END 1 /* no more characters */ + +char *vis(char *, int, int, int); +int strvis(char *, const char *, int); +int strnvis(char *, const char *, size_t, int); +int strvisx(char *, const char *, size_t, int); +int strunvis(char *, const char *); +int unvis(char *, char, int *, int); + +#endif /* !_VIS_H_ */ + +#endif /* !HAVE_STRVIS */ -- cgit v1.2.3 From bc9b7c41e2339cc5158357213dad9f238612705b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 8 Jan 2003 00:06:48 +1100 Subject: missing newline --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index d4213af5f..a115d3cd2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.95 2003/01/07 06:04:18 djm Exp $ +# $Id: configure.ac,v 1.96 2003/01/07 13:06:48 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -602,7 +602,8 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ socketpair strerror strlcat strlcpy strmode strvis sysconf \ - tcgetpgrp truncate utimes vhangup vsnprintf waitpid __b64_ntop \ _getpty) + tcgetpgrp truncate utimes vhangup vsnprintf waitpid __b64_ntop \ + _getpty) dnl Make sure strsep prototype is defined before defining HAVE_STRSEP AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)]) -- cgit v1.2.3 From d0d7a8b27b4cc9faaa4d8e4112d5d1fe759b0939 Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Wed, 8 Jan 2003 17:22:59 -0800 Subject: [Makefile.in configure.ac] replace fixpath with sed script. Patch by Mo DeJong. --- ChangeLog | 4 +++- Makefile.in | 37 +++++++++++++++++++------------------ configure.ac | 3 ++- 3 files changed, 24 insertions(+), 20 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 35995d3dc..af4ec49e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ markus@ ok - (djm) Update README to reflect AIX's status as a well supported platform. From dtucker@zip.com.au + - (tim) [Makefile.in configure.ac] replace fixpath with sed script. Patch + by Mo DeJong. 20030107 - (djm) Bug #401: Work around Linux breakage with IPv6 mapped addresses. @@ -960,4 +962,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2554 2003/01/08 12:28:40 djm Exp $ +$Id: ChangeLog,v 1.2555 2003/01/09 01:22:59 tim Exp $ diff --git a/Makefile.in b/Makefile.in index 89d02c959..85b108d16 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.222 2002/07/14 17:02:21 tim Exp $ +# $Id: Makefile.in,v 1.223 2003/01/09 01:22:59 tim Exp $ # uncomment if you run a non bourne compatable shell. Ie. csh #SHELL = @SH@ @@ -48,6 +48,7 @@ AR=@AR@ RANLIB=@RANLIB@ INSTALL=@INSTALL@ PERL=@PERL@ +SED=@SED@ ENT=@ENT@ XAUTH_PATH=@XAUTH_PATH@ LDFLAGS=-L. -Lopenbsd-compat/ @LDFLAGS@ @@ -74,23 +75,23 @@ CONFIGFILES=sshd_config.out ssh_config.out moduli.out CONFIGFILES_IN=sshd_config ssh_config moduli PATHSUBS = \ - -D/etc/ssh/ssh_prng_cmds=$(sysconfdir)/ssh_prng_cmds \ - -D/etc/ssh/ssh_config=$(sysconfdir)/ssh_config \ - -D/etc/ssh/ssh_known_hosts=$(sysconfdir)/ssh_known_hosts \ - -D/etc/ssh/sshd_config=$(sysconfdir)/sshd_config \ - -D/usr/libexec=$(libexecdir) \ - -D/etc/shosts.equiv=$(sysconfdir)/shosts.equiv \ - -D/etc/ssh/ssh_host_key=$(sysconfdir)/ssh_host_key \ - -D/etc/ssh/ssh_host_dsa_key=$(sysconfdir)/ssh_host_dsa_key \ - -D/etc/ssh/ssh_host_rsa_key=$(sysconfdir)/ssh_host_rsa_key \ - -D/var/run/sshd.pid=$(piddir)/sshd.pid \ - -D/etc/ssh/moduli=$(sysconfdir)/moduli \ - -D/etc/ssh/sshrc=$(sysconfdir)/sshrc \ - -D/usr/X11R6/bin/xauth=$(XAUTH_PATH) \ - -D/var/empty=$(PRIVSEP_PATH) \ - -D/usr/bin:/bin:/usr/sbin:/sbin=@user_path@ - -FIXPATHSCMD = $(PERL) $(srcdir)/fixpaths $(PATHSUBS) + -e 's|/etc/ssh/ssh_prng_cmds|$(sysconfdir)/ssh_prng_cmds|g' \ + -e 's|/etc/ssh/ssh_config|$(sysconfdir)/ssh_config|g' \ + -e 's|/etc/ssh/ssh_known_hosts|$(sysconfdir)/ssh_known_hosts|g' \ + -e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \ + -e 's|/usr/libexec|$(libexecdir)|g' \ + -e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \ + -e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \ + -e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \ + -e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \ + -e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \ + -e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \ + -e 's|/etc/sshrc|$(sysconfdir)/sshrc|g' \ + -e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \ + -e 's|/var/empty|$(PRIVSEP_PATH)|g' \ + -e 's|/usr/bin:/bin:/usr/sbin:/sbin|@user_path@|g' + +FIXPATHSCMD = $(SED) $(PATHSUBS) all: $(CONFIGFILES) $(MANPAGES) $(TARGETS) diff --git a/configure.ac b/configure.ac index a115d3cd2..d384f7dd7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.96 2003/01/07 13:06:48 djm Exp $ +# $Id: configure.ac,v 1.97 2003/01/09 01:22:59 tim Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -14,6 +14,7 @@ AC_PROG_RANLIB AC_PROG_INSTALL AC_PATH_PROG(AR, ar) AC_PATH_PROGS(PERL, perl5 perl) +AC_PATH_PROG(SED, sed) AC_SUBST(PERL) AC_PATH_PROG(ENT, ent) AC_SUBST(ENT) -- cgit v1.2.3 From a8ed44b79e6dd78d7871b0fb8149951b54662ef5 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 10 Jan 2003 09:53:12 +1100 Subject: - (djm) Enable new setproctitle emulation for Linux, AIX and HP/UX. More systems may be added later. --- ChangeLog | 6 +- TODO | 4 +- configure.ac | 6 +- openbsd-compat/bsd-misc.c | 12 +- openbsd-compat/setproctitle.c | 288 ++++++++++++++++++++++++++++++++---------- openbsd-compat/setproctitle.h | 3 +- session.c | 11 +- sshd.c | 10 +- 8 files changed, 258 insertions(+), 82 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 6b3409317..492eadab3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20030110 + - (djm) Enable new setproctitle emulation for Linux, AIX and HP/UX. More + systems may be added later. + 20030108 - (djm) Sync openbsd-compat/ with OpenBSD -current - (djm) Avoid redundant xstrdup/xfree in auth2-pam.c. From Solar via markus@ @@ -965,4 +969,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2557 2003/01/09 04:09:30 tim Exp $ +$Id: ChangeLog,v 1.2558 2003/01/09 22:53:12 djm Exp $ diff --git a/TODO b/TODO index f667d59d6..d3246144e 100644 --- a/TODO +++ b/TODO @@ -13,7 +13,7 @@ Programming: - Write a test program that calls stat() to search for EGD/PRNGd socket rather than use the (non-portable) "test -S". -- Replacement for setproctitle() - HP-UX support only currently +- More platforms for for setproctitle() emulation (testing needed) - Handle changing passwords for the non-PAM expired password case @@ -133,4 +133,4 @@ PrivSep Issues: - Cygwin + Privsep for Pre-auth only (no fd passing) -$Id: TODO,v 1.51 2002/09/05 06:32:03 djm Exp $ +$Id: TODO,v 1.52 2003/01/09 22:53:12 djm Exp $ diff --git a/configure.ac b/configure.ac index d384f7dd7..e64a0dd83 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.97 2003/01/09 01:22:59 tim Exp $ +# $Id: configure.ac,v 1.98 2003/01/09 22:53:12 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -380,7 +380,7 @@ AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \ netinet/in_systm.h paths.h pty.h readpassphrase.h \ rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \ strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \ - sys/mman.h sys/select.h sys/stat.h \ + sys/mman.h sys/pstat.h sys/select.h sys/stat.h \ sys/stropts.h sys/sysmacros.h sys/time.h \ sys/un.h time.h tmpdir.h ttyent.h usersec.h \ util.h utime.h utmp.h utmpx.h) @@ -598,7 +598,7 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\ getrlimit getrusage getttyent glob inet_aton inet_ntoa \ inet_ntop innetgr login_getcapbool md5_crypt memmove \ - mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \ + mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo pstat readpassphrase \ realpath recvmsg rresvport_af sendmsg setdtablesize setegid \ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 1c1e43a52..d7180d424 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -23,15 +23,20 @@ */ #include "includes.h" +#include "xmalloc.h" -RCSID("$Id: bsd-misc.c,v 1.10 2002/07/08 21:09:41 mouring Exp $"); +RCSID("$Id: bsd-misc.c,v 1.11 2003/01/09 22:53:13 djm Exp $"); +/* + * NB. duplicate __progname in case it is an alias for argv[0] + * Otherwise it may get clobbered by setproctitle() + */ char *get_progname(char *argv0) { #ifdef HAVE___PROGNAME extern char *__progname; - return __progname; + return xstrdup(__progname); #else char *p; @@ -42,7 +47,8 @@ char *get_progname(char *argv0) p = argv0; else p++; - return p; + + return xstrdup(p); #endif } diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c index e165dd13c..5439bd07e 100644 --- a/openbsd-compat/setproctitle.c +++ b/openbsd-compat/setproctitle.c @@ -1,102 +1,250 @@ /* - * Modified for OpenSSH by Kevin Steves - * October 2000 + * Based on src/backend/utils/misc/pg_status.c from + * PostgreSQL Database Management System + * + * Portions Copyright (c) 1996-2001, The PostgreSQL Global Development Group + * + * Portions Copyright (c) 1994, The Regents of the University of California + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without a written agreement + * is hereby granted, provided that the above copyright notice and this + * paragraph and the following two paragraphs appear in all copies. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING + * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS + * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -/* - * Copyright (c) 1994, 1995 Christopher G. Demetriou - * All rights reserved. +/*-------------------------------------------------------------------- + * ps_status.c + * + * Routines to support changing the ps display of PostgreSQL backends + * to contain some useful information. Mechanism differs wildly across + * platforms. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission + * $Header: /var/cvs/openssh/openbsd-compat/setproctitle.c,v 1.3 2003/01/09 22:53:13 djm Exp $ * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2000 by PostgreSQL Global Development Group + * various details abducted from various places + *-------------------------------------------------------------------- */ -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.8 2001/11/06 19:21:40 art Exp $"; -#endif /* LIBC_SCCS and not lint */ - #include "includes.h" #ifndef HAVE_SETPROCTITLE -#define SPT_NONE 0 -#define SPT_PSTAT 1 +#include +#ifdef HAVE_SYS_PSTAT_H +#include /* for HP-UX */ +#endif +#ifdef HAVE_PS_STRINGS +#include /* for old BSD */ +#include +#endif + +extern char **environ; -#ifndef SPT_TYPE -#define SPT_TYPE SPT_NONE +/*------ + * Alternative ways of updating ps display: + * + * PS_USE_PSTAT + * use the pstat(PSTAT_SETCMD, ) + * (HPUX) + * PS_USE_PS_STRINGS + * assign PS_STRINGS->ps_argvstr = "string" + * (some BSD systems) + * PS_USE_CHANGE_ARGV + * assign argv[0] = "string" + * (some other BSD systems) + * PS_USE_CLOBBER_ARGV + * write over the argv and environment area + * (most SysV-like systems) + * PS_USE_NONE + * don't update ps display + * (This is the default, as it is safest.) + */ +#if defined(HAVE_PSTAT) && defined(PSTAT_SETCMD) +#define PS_USE_PSTAT +#elif defined(HAVE_PS_STRINGS) +#define PS_USE_PS_STRINGS +#elif defined(BSD) || defined(__bsdi__) || defined(__hurd__) +#define PS_USE_CHANGE_ARGV +#elif defined(__linux__) || defined(_AIX) +#define PS_USE_CLOBBER_ARGV +#else +#define PS_USE_NONE #endif -#if SPT_TYPE == SPT_PSTAT -#include -#include -#endif /* SPT_TYPE == SPT_PSTAT */ +/* Different systems want the buffer padded differently */ +#if defined(_AIX) || defined(__linux__) || defined(__QNX__) || defined(__svr4__) +#define PS_PADDING '\0' +#else +#define PS_PADDING ' ' +#endif -#define MAX_PROCTITLE 2048 +/* + * argv clobbering uses existing argv space, all other methods need a buffer + */ +#ifndef PS_USE_CLOBBER_ARGV +static char ps_buffer[256]; +static const size_t ps_buffer_size = sizeof(ps_buffer); +#else /* PS_USE_CLOBBER_ARGV */ +static char *ps_buffer; /* will point to argv area */ +static size_t ps_buffer_size; /* space determined at run time */ +#endif /* PS_USE_CLOBBER_ARGV */ + +/* save the original argv[] location here */ +static int save_argc; +static char **save_argv; extern char *__progname; /* - * Set Process Title (SPT) defines. Modeled after sendmail's - * SPT type definition strategy. - * - * SPT_TYPE: - * - * SPT_NONE: Don't set the process title. Default. - * SPT_PSTAT: Use pstat(PSTAT_SETCMD). HP-UX specific. + * Call this to update the ps status display to a fixed prefix plus an + * indication of what you're currently doing passed in the argument. */ - void setproctitle(const char *fmt, ...) { -#if SPT_TYPE != SPT_NONE +#ifdef PS_USE_PSTAT + union pstun pst; +#endif +#ifndef PS_USE_NONE + ssize_t used; va_list ap; - - char buf[MAX_PROCTITLE]; - size_t used; -#if SPT_TYPE == SPT_PSTAT - union pstun pst; -#endif /* SPT_TYPE == SPT_PSTAT */ + /* no ps display if you didn't call save_ps_display_args() */ + if (save_argv == NULL) + return; +#ifdef PS_USE_CLOBBER_ARGV + /* If ps_buffer is a pointer, it might still be null */ + if (ps_buffer == NULL) + return; +#endif /* PS_USE_CLOBBER_ARGV */ + + /* + * Overwrite argv[] to point at appropriate space, if needed + */ +#ifdef PS_USE_CHANGE_ARGV + save_argv[0] = ps_buffer; + save_argv[1] = NULL; +#endif /* PS_USE_CHANGE_ARGV */ + +#ifdef PS_USE_CLOBBER_ARGV + save_argv[1] = NULL; +#endif /* PS_USE_CLOBBER_ARGV */ + + /* + * Make fixed prefix of ps display. + */ va_start(ap, fmt); - if (fmt != NULL) { - used = snprintf(buf, MAX_PROCTITLE, "%s: ", __progname); - if (used >= MAX_PROCTITLE) - used = MAX_PROCTITLE - 1; - (void)vsnprintf(buf + used, MAX_PROCTITLE - used, fmt, ap); - } else - (void)snprintf(buf, MAX_PROCTITLE, "%s", __progname); + if (fmt == NULL) + snprintf(ps_buffer, ps_buffer_size, "%s", __progname); + else { + used = snprintf(ps_buffer, ps_buffer_size, "%s: ", __progname); + if (used == -1 || used >= ps_buffer_size) + used = ps_buffer_size; + vsnprintf(ps_buffer + used, ps_buffer_size - used, fmt, ap); + } va_end(ap); - used = strlen(buf); -#if SPT_TYPE == SPT_PSTAT - pst.pst_command = buf; - pstat(PSTAT_SETCMD, pst, used, 0, 0); -#endif /* SPT_TYPE == SPT_PSTAT */ +#if 0 + error("XXXXXXXXX %s", __progname); + error("XXXXXXXXX %d", ps_buffer_size); + error("XXXXXXXXX %s", ps_buffer); +#endif + +#ifdef PS_USE_PSTAT + pst.pst_command = ps_buffer; + pstat(PSTAT_SETCMD, pst, strlen(ps_buffer), 0, 0); +#endif /* PS_USE_PSTAT */ + +#ifdef PS_USE_PS_STRINGS + PS_STRINGS->ps_nargvstr = 1; + PS_STRINGS->ps_argvstr = ps_buffer; +#endif /* PS_USE_PS_STRINGS */ -#endif /* SPT_TYPE != SPT_NONE */ +#ifdef PS_USE_CLOBBER_ARGV + /* pad unused memory */ + used = strlen(ps_buffer); + memset(ps_buffer + used, PS_PADDING, ps_buffer_size - used); +#endif /* PS_USE_CLOBBER_ARGV */ + +#endif /* PS_USE_NONE */ } + #endif /* HAVE_SETPROCTITLE */ + +/* + * Call this early in startup to save the original argc/argv values. + * + * argv[] will not be overwritten by this routine, but may be overwritten + * during setproctitle. Also, the physical location of the environment + * strings may be moved, so this should be called before any code that + * might try to hang onto a getenv() result. + */ +void +compat_init_setproctitle(int argc, char *argv[]) +{ +#ifdef PS_USE_CLOBBER_ARGV + char *end_of_area = NULL; + char **new_environ; + int i; +#endif + + save_argc = argc; + save_argv = argv; + +#ifdef PS_USE_CLOBBER_ARGV + /* + * If we're going to overwrite the argv area, count the available + * space. Also move the environment to make additional room. + */ + + /* + * check for contiguous argv strings + */ + for (i = 0; i < argc; i++) { + if (i == 0 || end_of_area + 1 == argv[i]) + end_of_area = argv[i] + strlen(argv[i]); + } + + /* probably can't happen? */ + if (end_of_area == NULL) { + ps_buffer = NULL; + ps_buffer_size = 0; + return; + } + + /* + * check for contiguous environ strings following argv + */ + for (i = 0; environ[i] != NULL; i++) { + if (end_of_area + 1 == environ[i]) + end_of_area = environ[i] + strlen(environ[i]); + } + + ps_buffer = argv[0]; + ps_buffer_size = end_of_area - argv[0] - 1; + + /* + * Duplicate and move the environment out of the way + */ + new_environ = malloc(sizeof(char *) * (i + 1)); + for (i = 0; environ[i] != NULL; i++) + new_environ[i] = strdup(environ[i]); + new_environ[i] = NULL; + environ = new_environ; +#endif /* PS_USE_CLOBBER_ARGV */ +} + diff --git a/openbsd-compat/setproctitle.h b/openbsd-compat/setproctitle.h index 8261bd0ee..48d26c6ea 100644 --- a/openbsd-compat/setproctitle.h +++ b/openbsd-compat/setproctitle.h @@ -1,4 +1,4 @@ -/* $Id: setproctitle.h,v 1.2 2001/02/09 01:55:36 djm Exp $ */ +/* $Id: setproctitle.h,v 1.3 2003/01/09 22:53:13 djm Exp $ */ #ifndef _BSD_SETPROCTITLE_H #define _BSD_SETPROCTITLE_H @@ -7,6 +7,7 @@ #ifndef HAVE_SETPROCTITLE void setproctitle(const char *fmt, ...); +void compat_init_setproctitle(int argc, char *argv[]); #endif #endif /* _BSD_SETPROCTITLE_H */ diff --git a/session.c b/session.c index c16cdcc13..812681d0f 100644 --- a/session.c +++ b/session.c @@ -2002,13 +2002,22 @@ session_tty_list(void) { static char buf[1024]; int i; + char *cp; + buf[0] = '\0'; for (i = 0; i < MAX_SESSIONS; i++) { Session *s = &sessions[i]; if (s->used && s->ttyfd != -1) { + + if (strncmp(s->tty, "/dev/", 5) != 0) { + cp = strrchr(s->tty, '/'); + cp = (cp == NULL) ? s->tty : cp + 1; + } else + cp = s->tty + 5; + if (buf[0] != '\0') strlcat(buf, ",", sizeof buf); - strlcat(buf, strrchr(s->tty, '/') + 1, sizeof buf); + strlcat(buf, cp, sizeof buf); } } if (buf[0] == '\0') diff --git a/sshd.c b/sshd.c index 8bf1557a2..8a7ec6b8e 100644 --- a/sshd.c +++ b/sshd.c @@ -827,9 +827,17 @@ main(int ac, char **av) __progname = get_progname(av[0]); init_rng(); - /* Save argv. */ + /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */ saved_argc = ac; saved_argv = av; + saved_argv = xmalloc(sizeof(*saved_argv) * ac); + for (i = 0; i < ac; i++) + saved_argv[i] = xstrdup(av[i]); + +#ifndef HAVE_SETPROCTITLE + /* Prepare for later setproctitle emulation */ + compat_init_setproctitle(ac, av); +#endif /* Initialize configuration options to their default values. */ initialize_server_options(&options); -- cgit v1.2.3 From ec201964e4afc9d97b4f11251cb42db0bd4fb062 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 13 Jan 2003 10:04:58 +1100 Subject: - (djm) Rework openbsd-compat/setproctitle.c a bit: move emulation type detection to configure.ac. Prompted by stevesk@ --- ChangeLog | 6 +++- acconfig.h | 6 +++- configure.ac | 12 ++++--- openbsd-compat/setproctitle.c | 73 +++++++++++++++++++------------------------ 4 files changed, 50 insertions(+), 47 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 498a3193c..13ca10ba4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20030103 + - (djm) Rework openbsd-compat/setproctitle.c a bit: move emulation type + detection to configure.ac. Prompted by stevesk@ + 20030110 - (djm) Enable new setproctitle emulation for Linux, AIX and HP/UX. More systems may be added later. @@ -994,4 +998,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2564 2003/01/10 10:46:02 djm Exp $ +$Id: ChangeLog,v 1.2565 2003/01/12 23:04:58 djm Exp $ diff --git a/acconfig.h b/acconfig.h index 314cbaaa4..cf5f961f2 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,4 +1,4 @@ -/* $Id: acconfig.h,v 1.146 2003/01/07 04:18:33 djm Exp $ */ +/* $Id: acconfig.h,v 1.147 2003/01/12 23:04:59 djm Exp $ */ #ifndef _CONFIG_H #define _CONFIG_H @@ -367,6 +367,10 @@ /* Silly mkstemp() */ #undef HAVE_STRICT_MKSTEMP +/* Setproctitle emulation */ +#undef SETPROCTITLE_STRATEGY +#undef SETPROCTITLE_PS_PADDING + @BOTTOM@ /* ******************* Shouldn't need to edit below this line ************** */ diff --git a/configure.ac b/configure.ac index e64a0dd83..54aad3704 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.98 2003/01/09 22:53:12 djm Exp $ +# $Id: configure.ac,v 1.99 2003/01/12 23:04:59 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -82,6 +82,8 @@ case "$host" in dnl AIX handles lastlog as part of its login message AC_DEFINE(DISABLE_LASTLOG) AC_DEFINE(LOGIN_NEEDS_UTMPX) + AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV) + AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0') ;; *-*-cygwin*) LIBS="$LIBS /usr/lib/textmode.o" @@ -122,7 +124,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) AC_DEFINE(LOGIN_NEEDS_UTMPX) AC_DEFINE(DISABLE_SHADOW) AC_DEFINE(DISABLE_UTMP) - AC_DEFINE(SPT_TYPE,SPT_PSTAT) + AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT) LIBS="$LIBS -lsec -lsecpw" AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])) disable_ptmx_check=yes @@ -138,7 +140,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) AC_DEFINE(LOGIN_NEEDS_UTMPX) AC_DEFINE(DISABLE_SHADOW) AC_DEFINE(DISABLE_UTMP) - AC_DEFINE(SPT_TYPE,SPT_PSTAT) + AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT) LIBS="$LIBS -lsec" AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])) ;; @@ -151,7 +153,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) AC_DEFINE(LOGIN_NEEDS_UTMPX) AC_DEFINE(DISABLE_SHADOW) AC_DEFINE(DISABLE_UTMP) - AC_DEFINE(SPT_TYPE,SPT_PSTAT) + AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT) LIBS="$LIBS -lsec" AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])) ;; @@ -178,6 +180,8 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) check_for_libcrypt_later=1 AC_DEFINE(DONT_TRY_OTHER_AF) AC_DEFINE(PAM_TTY_KLUDGE) + AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV) + AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0') inet6_default_4in6=yes ;; mips-sony-bsd|mips-sony-newsos4) diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c index 5439bd07e..14d5d2f3c 100644 --- a/openbsd-compat/setproctitle.c +++ b/openbsd-compat/setproctitle.c @@ -31,7 +31,7 @@ * to contain some useful information. Mechanism differs wildly across * platforms. * - * $Header: /var/cvs/openssh/openbsd-compat/setproctitle.c,v 1.3 2003/01/09 22:53:13 djm Exp $ + * $Header: /var/cvs/openssh/openbsd-compat/setproctitle.c,v 1.4 2003/01/12 23:04:59 djm Exp $ * * Copyright 2000 by PostgreSQL Global Development Group * various details abducted from various places @@ -56,51 +56,47 @@ extern char **environ; /*------ * Alternative ways of updating ps display: * - * PS_USE_PSTAT + * SETPROCTITLE_STRATEGY == PS_USE_PSTAT * use the pstat(PSTAT_SETCMD, ) * (HPUX) - * PS_USE_PS_STRINGS + * SETPROCTITLE_STRATEGY == PS_USE_PS_STRINGS * assign PS_STRINGS->ps_argvstr = "string" * (some BSD systems) - * PS_USE_CHANGE_ARGV + * SETPROCTITLE_STRATEGY == PS_USE_CHANGE_ARGV * assign argv[0] = "string" * (some other BSD systems) - * PS_USE_CLOBBER_ARGV + * SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV * write over the argv and environment area * (most SysV-like systems) - * PS_USE_NONE + * SETPROCTITLE_STRATEGY == PS_USE_NONE * don't update ps display * (This is the default, as it is safest.) */ -#if defined(HAVE_PSTAT) && defined(PSTAT_SETCMD) -#define PS_USE_PSTAT -#elif defined(HAVE_PS_STRINGS) -#define PS_USE_PS_STRINGS -#elif defined(BSD) || defined(__bsdi__) || defined(__hurd__) -#define PS_USE_CHANGE_ARGV -#elif defined(__linux__) || defined(_AIX) -#define PS_USE_CLOBBER_ARGV -#else -#define PS_USE_NONE + +#define PS_USE_NONE 0 +#define PS_USE_PSTAT 1 +#define PS_USE_PS_STRINGS 2 +#define PS_USE_CHANGE_ARGV 3 +#define PS_USE_CLOBBER_ARGV 4 + +#ifndef SETPROCTITLE_STRATEGY +# define SETPROCTITLE_STRATEGY PS_USE_NONE #endif -/* Different systems want the buffer padded differently */ -#if defined(_AIX) || defined(__linux__) || defined(__QNX__) || defined(__svr4__) -#define PS_PADDING '\0' -#else -#define PS_PADDING ' ' +#ifndef SETPROCTITLE_PS_PADDING +# define SETPROCTITLE_PS_PADDING ' ' #endif /* * argv clobbering uses existing argv space, all other methods need a buffer */ -#ifndef PS_USE_CLOBBER_ARGV +#if SETPROCTITLE_STRATEGY != PS_USE_CLOBBER_ARGV static char ps_buffer[256]; static const size_t ps_buffer_size = sizeof(ps_buffer); -#else /* PS_USE_CLOBBER_ARGV */ +#else static char *ps_buffer; /* will point to argv area */ static size_t ps_buffer_size; /* space determined at run time */ -#endif /* PS_USE_CLOBBER_ARGV */ +#endif /* save the original argv[] location here */ static int save_argc; @@ -115,17 +111,17 @@ extern char *__progname; void setproctitle(const char *fmt, ...) { -#ifdef PS_USE_PSTAT +#if SETPROCTITLE_STRATEGY == PS_USE_PSTAT union pstun pst; #endif -#ifndef PS_USE_NONE +#if SETPROCTITLE_STRATEGY != PS_USE_NONE ssize_t used; va_list ap; /* no ps display if you didn't call save_ps_display_args() */ if (save_argv == NULL) return; -#ifdef PS_USE_CLOBBER_ARGV +#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV /* If ps_buffer is a pointer, it might still be null */ if (ps_buffer == NULL) return; @@ -134,12 +130,12 @@ setproctitle(const char *fmt, ...) /* * Overwrite argv[] to point at appropriate space, if needed */ -#ifdef PS_USE_CHANGE_ARGV +#if SETPROCTITLE_STRATEGY == PS_USE_CHANGE_ARGV save_argv[0] = ps_buffer; save_argv[1] = NULL; #endif /* PS_USE_CHANGE_ARGV */ -#ifdef PS_USE_CLOBBER_ARGV +#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV save_argv[1] = NULL; #endif /* PS_USE_CLOBBER_ARGV */ @@ -158,26 +154,21 @@ setproctitle(const char *fmt, ...) } va_end(ap); -#if 0 - error("XXXXXXXXX %s", __progname); - error("XXXXXXXXX %d", ps_buffer_size); - error("XXXXXXXXX %s", ps_buffer); -#endif - -#ifdef PS_USE_PSTAT +#if SETPROCTITLE_STRATEGY == PS_USE_PSTAT pst.pst_command = ps_buffer; pstat(PSTAT_SETCMD, pst, strlen(ps_buffer), 0, 0); #endif /* PS_USE_PSTAT */ -#ifdef PS_USE_PS_STRINGS +#if SETPROCTITLE_STRATEGY == PS_USE_PS_STRINGS PS_STRINGS->ps_nargvstr = 1; PS_STRINGS->ps_argvstr = ps_buffer; #endif /* PS_USE_PS_STRINGS */ -#ifdef PS_USE_CLOBBER_ARGV +#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV /* pad unused memory */ used = strlen(ps_buffer); - memset(ps_buffer + used, PS_PADDING, ps_buffer_size - used); + memset(ps_buffer + used, SETPROCTITLE_PS_PADDING, + ps_buffer_size - used); #endif /* PS_USE_CLOBBER_ARGV */ #endif /* PS_USE_NONE */ @@ -196,7 +187,7 @@ setproctitle(const char *fmt, ...) void compat_init_setproctitle(int argc, char *argv[]) { -#ifdef PS_USE_CLOBBER_ARGV +#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV char *end_of_area = NULL; char **new_environ; int i; @@ -205,7 +196,7 @@ compat_init_setproctitle(int argc, char *argv[]) save_argc = argc; save_argv = argv; -#ifdef PS_USE_CLOBBER_ARGV +#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV /* * If we're going to overwrite the argv area, count the available * space. Also move the environment to make additional room. -- cgit v1.2.3 From 7d9012729123a55cbed793028618c81339309cbb Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 13 Jan 2003 16:55:22 +1100 Subject: - (djm) Bug #467: Add a --disable-strip option to turn off stripping of installed binaries. From mdev@idg.nl --- ChangeLog | 4 +++- Makefile.in | 25 +++++++++++++------------ configure.ac | 13 ++++++++++++- 3 files changed, 28 insertions(+), 14 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 13ca10ba4..971caa643 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 20030103 - (djm) Rework openbsd-compat/setproctitle.c a bit: move emulation type detection to configure.ac. Prompted by stevesk@ + - (djm) Bug #467: Add a --disable-strip option to turn off stripping of + installed binaries. From mdev@idg.nl 20030110 - (djm) Enable new setproctitle emulation for Linux, AIX and HP/UX. More @@ -998,4 +1000,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2565 2003/01/12 23:04:58 djm Exp $ +$Id: ChangeLog,v 1.2566 2003/01/13 05:55:22 djm Exp $ diff --git a/Makefile.in b/Makefile.in index 8d5987afd..c3efac60f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.224 2003/01/10 10:43:25 djm Exp $ +# $Id: Makefile.in,v 1.225 2003/01/13 05:55:23 djm Exp $ # uncomment if you run a non bourne compatable shell. Ie. csh #SHELL = @SH@ @@ -27,6 +27,7 @@ SSH_KEYSIGN=$(libexecdir)/ssh-keysign RAND_HELPER=$(libexecdir)/ssh-rand-helper PRIVSEP_PATH=@PRIVSEP_PATH@ SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@ +STRIP_OPT=@STRIP_OPT@ PATHS= -DSSHDIR=\"$(sysconfdir)\" \ -D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \ @@ -218,19 +219,19 @@ install-files: scard-install $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8 $(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir) (umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH)) - $(INSTALL) -m 0755 -s ssh $(DESTDIR)$(bindir)/ssh - $(INSTALL) -m 0755 -s scp $(DESTDIR)$(bindir)/scp - $(INSTALL) -m 0755 -s ssh-add $(DESTDIR)$(bindir)/ssh-add - $(INSTALL) -m 0755 -s ssh-agent $(DESTDIR)$(bindir)/ssh-agent - $(INSTALL) -m 0755 -s ssh-keygen $(DESTDIR)$(bindir)/ssh-keygen - $(INSTALL) -m 0755 -s ssh-keyscan $(DESTDIR)$(bindir)/ssh-keyscan - $(INSTALL) -m 0755 -s sshd $(DESTDIR)$(sbindir)/sshd + $(INSTALL) -m 0755 $(STRIP_OPT) ssh $(DESTDIR)$(bindir)/ssh + $(INSTALL) -m 0755 $(STRIP_OPT) scp $(DESTDIR)$(bindir)/scp + $(INSTALL) -m 0755 $(STRIP_OPT) ssh-add $(DESTDIR)$(bindir)/ssh-add + $(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent $(DESTDIR)$(bindir)/ssh-agent + $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen $(DESTDIR)$(bindir)/ssh-keygen + $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan $(DESTDIR)$(bindir)/ssh-keyscan + $(INSTALL) -m 0755 $(STRIP_OPT) sshd $(DESTDIR)$(sbindir)/sshd if test ! -z "$(INSTALL_SSH_RAND_HELPER)" ; then \ - $(INSTALL) -m 0755 -s ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \ + $(INSTALL) -m 0755 $(STRIP_OPT) ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \ fi - $(INSTALL) -m 4711 -s ssh-keysign $(DESTDIR)$(SSH_KEYSIGN) - @NO_SFTP@$(INSTALL) -m 0755 -s sftp $(DESTDIR)$(bindir)/sftp - @NO_SFTP@$(INSTALL) -m 0755 -s sftp-server $(DESTDIR)$(SFTP_SERVER) + $(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign $(DESTDIR)$(SSH_KEYSIGN) + @NO_SFTP@$(INSTALL) -m 0755 $(STRIP_OPT) sftp $(DESTDIR)$(bindir)/sftp + @NO_SFTP@$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server $(DESTDIR)$(SFTP_SERVER) $(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1 $(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1 $(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1 diff --git a/configure.ac b/configure.ac index 54aad3704..3054a4394 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.99 2003/01/12 23:04:59 djm Exp $ +# $Id: configure.ac,v 1.100 2003/01/13 05:55:23 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -1938,6 +1938,17 @@ AC_ARG_WITH(xauth, ] ) +STRIP_OPT=-s +AC_ARG_ENABLE(strip, + [ --disable-strip Disable calling strip(1) on install], + [ + if test "x$enableval" = "xno" ; then + STRIP_OPT= + fi + ] +) +AC_SUBST(STRIP_OPT) + if test -z "$xauth_path" ; then XAUTH_PATH="undefined" AC_SUBST(XAUTH_PATH) -- cgit v1.2.3 From 9715bb1833947456dc4fa1cf536fbd32a129979f Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 17 Jan 2003 10:31:38 +1100 Subject: - (djm) Bug #470: Detect strnvis, not strvis in configure. From d_wllms@lanl.gov --- ChangeLog | 6 +++++- configure.ac | 4 ++-- openbsd-compat/vis.c | 2 +- openbsd-compat/vis.h | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 63979507f..c43ccc907 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20030117 + - (djm) Bug #470: Detect strnvis, not strvis in configure. + From d_wllms@lanl.gov + 20030116 - (djm) OpenBSD CVS Sync - djm@cvs.openbsd.org 2003/01/16 03:41:55 @@ -1027,4 +1031,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2573 2003/01/16 04:39:13 djm Exp $ +$Id: ChangeLog,v 1.2574 2003/01/16 23:31:38 djm Exp $ diff --git a/configure.ac b/configure.ac index 3054a4394..df4168096 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.100 2003/01/13 05:55:23 djm Exp $ +# $Id: configure.ac,v 1.101 2003/01/16 23:31:38 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -606,7 +606,7 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ realpath recvmsg rresvport_af sendmsg setdtablesize setegid \ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ - socketpair strerror strlcat strlcpy strmode strvis sysconf \ + socketpair strerror strlcat strlcpy strmode strnvis sysconf \ tcgetpgrp truncate utimes vhangup vsnprintf waitpid __b64_ntop \ _getpty) diff --git a/openbsd-compat/vis.c b/openbsd-compat/vis.c index 303a9a5b3..fc5741390 100644 --- a/openbsd-compat/vis.c +++ b/openbsd-compat/vis.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ #include "config.h" -#if !defined(HAVE_STRVIS) +#if !defined(HAVE_STRNVIS) #if defined(LIBC_SCCS) && !defined(lint) static char rcsid[] = "$OpenBSD: vis.c,v 1.8 2002/02/19 19:39:36 millert Exp $"; diff --git a/openbsd-compat/vis.h b/openbsd-compat/vis.h index 98924bde4..5df6f3694 100644 --- a/openbsd-compat/vis.h +++ b/openbsd-compat/vis.h @@ -36,7 +36,7 @@ * @(#)vis.h 5.9 (Berkeley) 4/3/91 */ #include "config.h" -#if !defined(HAVE_STRVIS) +#if !defined(HAVE_STRNVIS) #ifndef _VIS_H_ #define _VIS_H_ @@ -88,4 +88,4 @@ int unvis(char *, char, int *, int); #endif /* !_VIS_H_ */ -#endif /* !HAVE_STRVIS */ +#endif /* !HAVE_STRNVIS */ -- cgit v1.2.3 From 89fe3f30a71dee3b5effbcbc3b142c86ab129fe2 Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Sun, 19 Jan 2003 20:20:24 -0800 Subject: [configure.ac] Add -belf to build ELF binaries on OpenServer 5 when using cc. (gcc already did) --- ChangeLog | 4 +++- configure.ac | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 23230b5d4..85fb7c177 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 20030120 - (djm) Fix compilation for NetBSD from dtucker@zip.com.au - (tim) [progressmeter.c] make compilers without long long happy. + - (tim) [configure.ac] Add -belf to build ELF binaries on OpenServer 5 when + using cc. (gcc already did) 20030118 - (djm) Revert fix for Bug #442 for now. @@ -1038,4 +1040,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2577 2003/01/20 04:15:13 tim Exp $ +$Id: ChangeLog,v 1.2578 2003/01/20 04:20:24 tim Exp $ diff --git a/configure.ac b/configure.ac index df4168096..b85f1884e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.101 2003/01/16 23:31:38 djm Exp $ +# $Id: configure.ac,v 1.102 2003/01/20 04:20:25 tim Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -283,6 +283,9 @@ mips-sony-bsd|mips-sony-newsos4) do_sco3_extra_lib_check=yes ;; *-*-sco3.2v5*) + if test -z "$GCC"; then + CFLAGS="$CFLAGS -belf" + fi CPPFLAGS="$CPPFLAGS -I/usr/local/include" LDFLAGS="$LDFLAGS -L/usr/local/lib" LIBS="$LIBS -lprot -lx -ltinfo -lm" -- cgit v1.2.3 From 6dc562a7aacbedbf9d2dfcef19fcba19c226b453 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Mon, 27 Jan 2003 21:15:10 +0000 Subject: - (bal) Bugzilla 477 patch by wendyp@cray.com. Define TIOCGPGRP for cray. Also removed test for tcgetpgrp in configure.ac since it is no longer used. --- ChangeLog | 7 ++++++- configure.ac | 5 ++--- openbsd-compat/bsd-cray.h | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 70ce05524..2dd3bc6f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +200301027 + - (bal) Bugzilla 477 patch by wendyp@cray.com. Define TIOCGPGRP for + cray. Also removed test for tcgetpgrp in configure.ac since it + is no longer used. + 20030124 - (djm) OpenBSD CVS Sync - jmc@cvs.openbsd.org 2003/01/23 08:58:47 @@ -1074,4 +1079,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2587 2003/01/24 00:50:32 djm Exp $ +$Id: ChangeLog,v 1.2588 2003/01/27 21:15:10 mouring Exp $ diff --git a/configure.ac b/configure.ac index b85f1884e..870def2ae 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.102 2003/01/20 04:20:25 tim Exp $ +# $Id: configure.ac,v 1.103 2003/01/27 21:15:10 mouring Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -610,8 +610,7 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ socketpair strerror strlcat strlcpy strmode strnvis sysconf \ - tcgetpgrp truncate utimes vhangup vsnprintf waitpid __b64_ntop \ - _getpty) + truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty) dnl Make sure strsep prototype is defined before defining HAVE_STRSEP AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)]) diff --git a/openbsd-compat/bsd-cray.h b/openbsd-compat/bsd-cray.h index 8868b4364..9a15cb251 100644 --- a/openbsd-compat/bsd-cray.h +++ b/openbsd-compat/bsd-cray.h @@ -1,5 +1,5 @@ /* - * $Id: bsd-cray.h,v 1.5 2002/09/26 00:38:51 tim Exp $ + * $Id: bsd-cray.h,v 1.6 2003/01/27 21:15:11 mouring Exp $ * * bsd-cray.h * @@ -49,6 +49,8 @@ extern char cray_tmpdir[]; /* cray tmpdir */ #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif +#include +#define TIOCGPGRP (tIOC|20) #endif #endif /* _BSD_CRAY_H */ -- cgit v1.2.3 From cd6853c31c226d4538f0a46b4ebcdcc734d4b6c0 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 28 Jan 2003 11:33:42 +1100 Subject: - (djm) Search libposix4 and librt for nanosleep. From dtucker@zip.com.au and openssh-unix-dev@thewrittenword.com --- ChangeLog | 6 +++++- acconfig.h | 5 ++++- configure.ac | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 2dd3bc6f5..f6a07fd91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +200301028 + - (djm) Search libposix4 and librt for nanosleep. From dtucker@zip.com.au + and openssh-unix-dev@thewrittenword.com + 200301027 - (bal) Bugzilla 477 patch by wendyp@cray.com. Define TIOCGPGRP for cray. Also removed test for tcgetpgrp in configure.ac since it @@ -1079,4 +1083,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2588 2003/01/27 21:15:10 mouring Exp $ +$Id: ChangeLog,v 1.2589 2003/01/28 00:33:42 djm Exp $ diff --git a/acconfig.h b/acconfig.h index cf5f961f2..b28966084 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,4 +1,4 @@ -/* $Id: acconfig.h,v 1.147 2003/01/12 23:04:59 djm Exp $ */ +/* $Id: acconfig.h,v 1.148 2003/01/28 00:33:44 djm Exp $ */ #ifndef _CONFIG_H #define _CONFIG_H @@ -371,6 +371,9 @@ #undef SETPROCTITLE_STRATEGY #undef SETPROCTITLE_PS_PADDING +/* Some systems put this outside of libc */ +#undef HAVE_NANOSLEEP + @BOTTOM@ /* ******************* Shouldn't need to edit below this line ************** */ diff --git a/configure.ac b/configure.ac index 870def2ae..f66104e78 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.103 2003/01/27 21:15:10 mouring Exp $ +# $Id: configure.ac,v 1.104 2003/01/28 00:33:44 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -612,6 +612,8 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ socketpair strerror strlcat strlcpy strmode strnvis sysconf \ truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty) +AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP)) + dnl Make sure strsep prototype is defined before defining HAVE_STRSEP AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)]) -- cgit v1.2.3 From 4b0f1ad4dbf1e3c42e9043ce0b0739a89f5b4c86 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Sat, 1 Feb 2003 04:43:34 +0000 Subject: - (bal) AIX 4.2.1 lacks nanosleep(). Patch to use nsleep() provided by dtucker@zip.com.au --- ChangeLog | 6 +++++- configure.ac | 8 ++++---- openbsd-compat/port-aix.h | 11 +++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 300552af3..a6acb5c50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20030131 + - (bal) AIX 4.2.1 lacks nanosleep(). Patch to use nsleep() provided by + dtucker@zip.com.au + 20030130 - (djm) Unbreak root password auth. Spotted by dtucker@zip.com.au @@ -1086,4 +1090,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2590 2003/01/29 23:20:56 djm Exp $ +$Id: ChangeLog,v 1.2591 2003/02/01 04:43:34 mouring Exp $ diff --git a/configure.ac b/configure.ac index f66104e78..608127f55 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.104 2003/01/28 00:33:44 djm Exp $ +# $Id: configure.ac,v 1.105 2003/02/01 04:43:34 mouring Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -388,7 +388,7 @@ AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \ rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \ strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \ sys/mman.h sys/pstat.h sys/select.h sys/stat.h \ - sys/stropts.h sys/sysmacros.h sys/time.h \ + sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \ sys/un.h time.h tmpdir.h ttyent.h usersec.h \ util.h utime.h utmp.h utmpx.h) @@ -604,8 +604,8 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ clock fchmod fchown freeaddrinfo futimes gai_strerror \ getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\ getrlimit getrusage getttyent glob inet_aton inet_ntoa \ - inet_ntop innetgr login_getcapbool md5_crypt memmove \ - mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo pstat readpassphrase \ + inet_ntop innetgr login_getcapbool md5_crypt memmove mkdtemp \ + mmap ngetaddrinfo nsleep openpty ogetaddrinfo pstat readpassphrase \ realpath recvmsg rresvport_af sendmsg setdtablesize setegid \ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ diff --git a/openbsd-compat/port-aix.h b/openbsd-compat/port-aix.h index 79570a206..4abe00316 100644 --- a/openbsd-compat/port-aix.h +++ b/openbsd-compat/port-aix.h @@ -25,5 +25,16 @@ */ #ifdef _AIX + +/* AIX 4.2.x doesn't have nanosleep but does have nsleep which is equivalent */ +#if !defined(HAVE_NANOSLEEP) && defined(HAVE_NSLEEP) +# define nanosleep(a,b) nsleep(a,b) +#endif + +/* For struct timespec on AIX 4.2.x */ +#ifdef HAVE_SYS_TIMERS_H +# include +#endif + void aix_usrinfo(struct passwd *pw); #endif /* _AIX */ -- cgit v1.2.3 From c8936acfe1a3c570d79d8868f636c94adba3ca36 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 11 Feb 2003 10:04:03 +1100 Subject: - (djm) Cygwin needs libcrypt too. Patch from vinschen@redhat.com --- ChangeLog | 5 ++++- configure.ac | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index af9bf9a48..c152b768e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +20030211 + - (djm) Cygwin needs libcrypt too. Patch from vinschen@redhat.com + 20030206 - (djm) Teach fake-getaddrinfo to use getservbyname() when provided a string service name. Suggested by markus@, review by itojun@ @@ -1094,4 +1097,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2592 2003/02/05 23:51:06 djm Exp $ +$Id: ChangeLog,v 1.2593 2003/02/10 23:04:03 djm Exp $ diff --git a/configure.ac b/configure.ac index 608127f55..03c5358fe 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.105 2003/02/01 04:43:34 mouring Exp $ +# $Id: configure.ac,v 1.106 2003/02/10 23:04:03 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -86,6 +86,7 @@ case "$host" in AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0') ;; *-*-cygwin*) + check_for_libcrypt_later=1 LIBS="$LIBS /usr/lib/textmode.o" AC_DEFINE(HAVE_CYGWIN) AC_DEFINE(USE_PIPES) -- cgit v1.2.3 From b16f874d89402333aabcc7988de59766934bf83d Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 24 Feb 2003 12:47:15 +1100 Subject: - (djm) Most of Bug #499: Cygwin compile fixes for new progressmeter --- ChangeLog | 3 ++- configure.ac | 6 +++--- progressmeter.c | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index fab77a966..6650c9970 100644 --- a/ChangeLog +++ b/ChangeLog @@ -81,6 +81,7 @@ - (djm) Add new object files to Makefile and reorder - (djm) Bug #501: gai_strerror should return char*; fix from dtucker@zip.com.au + - (djm) Most of Bug #499: Cygwin compile fixes for new progressmeter 20030211 - (djm) Cygwin needs libcrypt too. Patch from vinschen@redhat.com @@ -1181,4 +1182,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2617 2003/02/24 01:35:08 djm Exp $ +$Id: ChangeLog,v 1.2618 2003/02/24 01:47:15 djm Exp $ diff --git a/configure.ac b/configure.ac index 03c5358fe..6965c05f2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.106 2003/02/10 23:04:03 djm Exp $ +# $Id: configure.ac,v 1.107 2003/02/24 01:47:16 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -383,7 +383,7 @@ AC_ARG_WITH(libs, # Checks for header files. AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \ - getopt.h glob.h ia.h lastlog.h limits.h login.h \ + getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \ login_cap.h maillock.h netdb.h netgroup.h \ netinet/in_systm.h paths.h pty.h readpassphrase.h \ rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \ @@ -610,7 +610,7 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ realpath recvmsg rresvport_af sendmsg setdtablesize setegid \ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ - socketpair strerror strlcat strlcpy strmode strnvis sysconf \ + socketpair strerror strlcat strlcpy strmode strnvis sysconf tcgetpgrp \ truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty) AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP)) diff --git a/progressmeter.c b/progressmeter.c index 948d361d2..9956201f3 100644 --- a/progressmeter.c +++ b/progressmeter.c @@ -62,7 +62,9 @@ #include "includes.h" RCSID("$OpenBSD: progressmeter.c,v 1.2 2003/01/12 16:57:02 markus Exp $"); +#ifdef HAVE_LIBGEN_H #include +#endif #include "atomicio.h" #include "progressmeter.h" @@ -147,8 +149,13 @@ foregroundproc(void) if (pgrp == -1) pgrp = getpgrp(); +#ifdef HAVE_TCGETPGRP + return ((ctty_pgrp = tcgetpgrp(STDOUT_FILENO)) != -1 && + ctty_pgrp == pgrp); +#else return ((ioctl(STDOUT_FILENO, TIOCGPGRP, &ctty_pgrp) != -1 && ctty_pgrp == pgrp)); +#endif } static void -- cgit v1.2.3 From 8d8168a255c17ca343865d1ee4962f2cba46b2d8 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 24 Feb 2003 12:55:55 +1100 Subject: - (djm) Rest of Bug #499: Import a basename() function from OpenBSD libc --- ChangeLog | 3 +- configure.ac | 4 +-- openbsd-compat/Makefile.in | 4 +-- openbsd-compat/basename.c | 73 +++++++++++++++++++++++++++++++++++++++++ openbsd-compat/basename.h | 12 +++++++ openbsd-compat/openbsd-compat.h | 3 +- 6 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 openbsd-compat/basename.c create mode 100644 openbsd-compat/basename.h (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 6650c9970..008a7f4f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -82,6 +82,7 @@ - (djm) Bug #501: gai_strerror should return char*; fix from dtucker@zip.com.au - (djm) Most of Bug #499: Cygwin compile fixes for new progressmeter + - (djm) Rest of Bug #499: Import a basename() function from OpenBSD libc 20030211 - (djm) Cygwin needs libcrypt too. Patch from vinschen@redhat.com @@ -1182,4 +1183,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2618 2003/02/24 01:47:15 djm Exp $ +$Id: ChangeLog,v 1.2619 2003/02/24 01:55:55 djm Exp $ diff --git a/configure.ac b/configure.ac index 6965c05f2..20110761b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.107 2003/02/24 01:47:16 djm Exp $ +# $Id: configure.ac,v 1.108 2003/02/24 01:55:55 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -601,7 +601,7 @@ AC_ARG_WITH(tcp-wrappers, ) dnl Checks for library functions. -AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \ +AC_CHECK_FUNCS(arc4random b64_ntop bcopy basename bindresvport_sa \ clock fchmod fchown freeaddrinfo futimes gai_strerror \ getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\ getrlimit getrusage getttyent glob inet_aton inet_ntoa \ diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in index 8b1e5b538..8615e3633 100644 --- a/openbsd-compat/Makefile.in +++ b/openbsd-compat/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.24 2003/01/07 06:04:18 djm Exp $ +# $Id: Makefile.in,v 1.25 2003/02/24 01:55:56 djm Exp $ sysconfdir=@sysconfdir@ piddir=@piddir@ @@ -16,7 +16,7 @@ RANLIB=@RANLIB@ INSTALL=@INSTALL@ LDFLAGS=-L. @LDFLAGS@ -OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o vis.o +OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o vis.o COMPAT=bsd-arc4random.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o bsd-misc.o bsd-nextstep.o bsd-snprintf.o bsd-waitpid.o fake-getaddrinfo.o fake-getnameinfo.o xmmap.o diff --git a/openbsd-compat/basename.c b/openbsd-compat/basename.c new file mode 100644 index 000000000..5a3823bc5 --- /dev/null +++ b/openbsd-compat/basename.c @@ -0,0 +1,73 @@ +/* $OpenBSD: basename.c,v 1.8 2002/06/09 05:03:59 deraadt Exp $ */ + +/* + * Copyright (c) 1997 Todd C. Miller + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "includes.h" + +#if !defined(HAVE_BASENAME) + +#ifndef lint +static char rcsid[] = "$OpenBSD: basename.c,v 1.8 2002/06/09 05:03:59 deraadt Exp $"; +#endif /* not lint */ + +char * +basename(const char *path) +{ + static char bname[MAXPATHLEN]; + register const char *endp, *startp; + + /* Empty or NULL string gets treated as "." */ + if (path == NULL || *path == '\0') { + (void)strlcpy(bname, ".", sizeof bname); + return(bname); + } + + /* Strip trailing slashes */ + endp = path + strlen(path) - 1; + while (endp > path && *endp == '/') + endp--; + + /* All slashes become "/" */ + if (endp == path && *endp == '/') { + (void)strlcpy(bname, "/", sizeof bname); + return(bname); + } + + /* Find the start of the base */ + startp = endp; + while (startp > path && *(startp - 1) != '/') + startp--; + + if (endp - startp + 2 > sizeof(bname)) { + errno = ENAMETOOLONG; + return(NULL); + } + strlcpy(bname, startp, endp - startp + 2); + return(bname); +} + +#endif /* !defined(HAVE_BASENAME) */ diff --git a/openbsd-compat/basename.h b/openbsd-compat/basename.h new file mode 100644 index 000000000..0a14ff5c1 --- /dev/null +++ b/openbsd-compat/basename.h @@ -0,0 +1,12 @@ +/* $Id: basename.h,v 1.1 2003/02/24 01:55:56 djm Exp $ */ + +#ifndef _BASENAME_H +#define _BASENAME_H +#include "config.h" + +#if !defined(HAVE_BASENAME) + +char *getcwd(char *pt, size_t size); + +#endif /* !defined(HAVE_BASENAME) */ +#endif /* _BASENAME_H */ diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index dcb7ba15b..c3e19b9cb 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h @@ -1,4 +1,4 @@ -/* $Id: openbsd-compat.h,v 1.18 2003/01/07 06:04:18 djm Exp $ */ +/* $Id: openbsd-compat.h,v 1.19 2003/02/24 01:55:56 djm Exp $ */ #ifndef _OPENBSD_H #define _OPENBSD_H @@ -6,6 +6,7 @@ #include "config.h" /* OpenBSD function replacements */ +#include "basename.h" #include "bindresvport.h" #include "getcwd.h" #include "realpath.h" -- cgit v1.2.3 From fe1f14375a6a739fa662b4a9d5e9744bff9716eb Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 24 Feb 2003 15:45:42 +1100 Subject: - (djm) Bug #456: Support for NEC SX6 with Unicos; from wendyp@cray.com --- ChangeLog | 3 ++- config.sub | 4 ++++ configure.ac | 28 +++++++++++++++------------- openbsd-compat/base64.c | 9 +++++++-- openbsd-compat/base64.h | 11 ++++++++--- 5 files changed, 36 insertions(+), 19 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 0fc1191bf..b99e2bb98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -86,6 +86,7 @@ - (djm) Rest of Bug #499: Import a basename() function from OpenBSD libc - (djm) Bug #494: Allow multiple accounts on Windows 9x/Me; From vinschen@redhat.com + - (djm) Bug #456: Support for NEC SX6 with Unicos; from wendyp@cray.com 20030211 - (djm) Cygwin needs libcrypt too. Patch from vinschen@redhat.com @@ -1186,4 +1187,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2620 2003/02/24 02:04:01 djm Exp $ +$Id: ChangeLog,v 1.2621 2003/02/24 04:45:42 djm Exp $ diff --git a/config.sub b/config.sub index 9ff085efa..a03c1d15a 100755 --- a/config.sub +++ b/config.sub @@ -887,6 +887,10 @@ case $basic_machine in basic_machine=sv1-cray os=-unicos ;; + sx*-nec) + basic_machine=sx6-nec + os=-sysv + ;; symmetry) basic_machine=i386-sequent os=-dynix diff --git a/configure.ac b/configure.ac index 20110761b..bdf80288e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.108 2003/02/24 01:55:55 djm Exp $ +# $Id: configure.ac,v 1.109 2003/02/24 04:45:43 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -600,18 +600,20 @@ AC_ARG_WITH(tcp-wrappers, ] ) -dnl Checks for library functions. -AC_CHECK_FUNCS(arc4random b64_ntop bcopy basename bindresvport_sa \ - clock fchmod fchown freeaddrinfo futimes gai_strerror \ - getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\ - getrlimit getrusage getttyent glob inet_aton inet_ntoa \ - inet_ntop innetgr login_getcapbool md5_crypt memmove mkdtemp \ - mmap ngetaddrinfo nsleep openpty ogetaddrinfo pstat readpassphrase \ - realpath recvmsg rresvport_af sendmsg setdtablesize setegid \ - setenv seteuid setgroups setlogin setproctitle setresgid setreuid \ - setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \ - socketpair strerror strlcat strlcpy strmode strnvis sysconf tcgetpgrp \ - truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty) +dnl Checks for library functions. Please keep in alphabetical order +AC_CHECK_FUNCS(\ + arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename bcopy \ + bindresvport_sa clock fchmod fchown freeaddrinfo futimes \ + gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \ + getpeereid _getpty getrlimit getrusage getttyent glob inet_aton \ + inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \ + mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openpty pstat \ + readpassphrase realpath recvmsg rresvport_af sendmsg setdtablesize \ + setegid setenv seteuid setgroups setlogin setpcred setproctitle \ + setresgid setreuid setrlimit setsid setvbuf sigaction sigvec \ + snprintf socketpair strerror strlcat strlcpy strmode strnvis \ + sysconf tcgetpgrp truncate utimes vhangup vsnprintf waitpid \ +) AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP)) diff --git a/openbsd-compat/base64.c b/openbsd-compat/base64.c index 005170b80..91a5ab0ed 100644 --- a/openbsd-compat/base64.c +++ b/openbsd-compat/base64.c @@ -44,7 +44,7 @@ #include "includes.h" -#if !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) +#if (!defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP)) || (!defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON)) #include #include @@ -130,6 +130,7 @@ static const char Pad64 = '='; characters followed by one "=" padding character. */ +#if !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { @@ -190,6 +191,9 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (datalength); } +#endif /* !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) */ + +#if !defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON) /* skips all whitespace anywhere. converts characters, four at a time, starting at (or after) @@ -314,4 +318,5 @@ b64_pton(char const *src, u_char *target, size_t targsize) return (tarindex); } -#endif /* !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) */ +#endif /* !defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON) */ +#endif diff --git a/openbsd-compat/base64.h b/openbsd-compat/base64.h index c92e70ea0..72db3ffc7 100644 --- a/openbsd-compat/base64.h +++ b/openbsd-compat/base64.h @@ -1,4 +1,4 @@ -/* $Id: base64.h,v 1.3 2002/02/26 16:59:59 stevesk Exp $ */ +/* $Id: base64.h,v 1.4 2003/02/24 04:45:43 djm Exp $ */ #ifndef _BSD_BASE64_H #define _BSD_BASE64_H @@ -9,10 +9,15 @@ # ifndef HAVE_B64_NTOP int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize); -int b64_pton(char const *src, u_char *target, size_t targsize); # endif /* !HAVE_B64_NTOP */ # define __b64_ntop b64_ntop -# define __b64_pton b64_pton #endif /* HAVE___B64_NTOP */ +#ifndef HAVE___B64_PTON +# ifndef HAVE_B64_PTON +int b64_pton(char const *src, u_char *target, size_t targsize); +# endif /* !HAVE_B64_PTON */ +# define __b64_pton b64_pton +#endif /* HAVE___B64_PTON */ + #endif /* _BSD_BASE64_H */ -- cgit v1.2.3 From 933cc8fb9cd3e34b9b656f73ad8b661c08551875 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 10 Mar 2003 11:38:10 +1100 Subject: - (djm) Bug #245: TTY problems on Solaris. Fix by stevesk@ and dtucker@zip.com.au --- ChangeLog | 4 +++- acconfig.h | 5 ++++- configure.ac | 3 ++- sshd.c | 8 ++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index d060257e9..37a51edaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ fix memory leaks; from dlheine@suif.Stanford.EDU/CLOUSEAU; ok djm@ - (djm) One more portable-specific one from dlheine@suif.Stanford.EDU/ CLOUSEAU + - (djm) Bug #245: TTY problems on Solaris. Fix by stevesk@ and + dtucker@zip.com.au 20030225 - (djm) Fix some compile errors spotted by dtucker and his fabulous @@ -1200,4 +1202,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2624 2003/03/10 00:23:06 djm Exp $ +$Id: ChangeLog,v 1.2625 2003/03/10 00:38:10 djm Exp $ diff --git a/acconfig.h b/acconfig.h index b28966084..b6e4b37cc 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,4 +1,4 @@ -/* $Id: acconfig.h,v 1.148 2003/01/28 00:33:44 djm Exp $ */ +/* $Id: acconfig.h,v 1.149 2003/03/10 00:38:10 djm Exp $ */ #ifndef _CONFIG_H #define _CONFIG_H @@ -374,6 +374,9 @@ /* Some systems put this outside of libc */ #undef HAVE_NANOSLEEP +/* Pushing STREAMS modules incorrectly acquires a controlling TTY */ +#undef STREAMS_PUSH_ACQUIRES_CTTY + @BOTTOM@ /* ******************* Shouldn't need to edit below this line ************** */ diff --git a/configure.ac b/configure.ac index bdf80288e..3469af2f4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.109 2003/02/24 04:45:43 djm Exp $ +# $Id: configure.ac,v 1.110 2003/03/10 00:38:10 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -216,6 +216,7 @@ mips-sony-bsd|mips-sony-newsos4) AC_DEFINE(LOGIN_NEEDS_UTMPX) AC_DEFINE(LOGIN_NEEDS_TERM) AC_DEFINE(PAM_TTY_KLUDGE) + AC_DEFINE(STREAMS_PUSH_ACQUIRES_CTTY) # hardwire lastlog location (can't detect it on some versions) conf_lastlog_location="/var/adm/lastlog" AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x) diff --git a/sshd.c b/sshd.c index 86441cff1..0f2b2a3ce 100644 --- a/sshd.c +++ b/sshd.c @@ -1400,8 +1400,12 @@ main(int ac, char **av) * setlogin() affects the entire process group. We don't * want the child to be able to affect the parent. */ -#if 0 - /* XXX: this breaks Solaris */ +#if !defined(STREAMS_PUSH_ACQUIRES_CTTY) + /* + * If setsid is called on Solaris, sshd will acquire the controlling + * terminal while pushing STREAMS modules. This will prevent the + * shell from acquiring it later. + */ if (!debug_flag && !inetd_flag && setsid() < 0) error("setsid: %.100s", strerror(errno)); #endif -- cgit v1.2.3 From 4e4dc561ae948a410fb82fd8b0960ec2cf8e2e70 Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Tue, 18 Mar 2003 10:21:40 -0800 Subject: [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] add nanosleep(). testing/corrections by Darren Tucker --- ChangeLog | 6 +++++- configure.ac | 4 +++- openbsd-compat/bsd-misc.c | 33 ++++++++++++++++++++++++++++++++- openbsd-compat/bsd-misc.h | 11 ++++++++++- 4 files changed, 50 insertions(+), 4 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 9346f1351..b53c81590 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20030318 + - (tim) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] + add nanosleep(). testing/corrections by Darren Tucker + 20030317 - (djm) Fix return value checks for RAND_bytes. Report from Steve G @@ -1218,4 +1222,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2630 2003/03/17 05:13:53 djm Exp $ +$Id: ChangeLog,v 1.2631 2003/03/18 18:21:40 tim Exp $ diff --git a/configure.ac b/configure.ac index 3469af2f4..83575758f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.110 2003/03/10 00:38:10 djm Exp $ +# $Id: configure.ac,v 1.111 2003/03/18 18:21:41 tim Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -1483,6 +1483,8 @@ if test "x$ac_cv_have_struct_timeval" = "xyes" ; then have_struct_timeval=1 fi +AC_CHECK_TYPES(struct timespec) + # If we don't have int64_t then we can't compile sftp-server. So don't # even attempt to do it. if test "x$ac_cv_have_int64_t" = "xno" -a \ diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index d7180d424..b8e9996d5 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -25,7 +25,7 @@ #include "includes.h" #include "xmalloc.h" -RCSID("$Id: bsd-misc.c,v 1.11 2003/01/09 22:53:13 djm Exp $"); +RCSID("$Id: bsd-misc.c,v 1.12 2003/03/18 18:21:41 tim Exp $"); /* * NB. duplicate __progname in case it is an alias for argv[0] @@ -135,3 +135,34 @@ setgroups(size_t size, const gid_t *list) } #endif +#if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP) +int nanosleep(const struct timespec *req, struct timespec *rem) +{ + int rc, saverrno; + extern int errno; + struct timeval tstart, tstop, tremain, time2wait; + + TIMESPEC_TO_TIMEVAL(&time2wait, req) + (void) gettimeofday(&tstart, NULL); + rc = select(0, NULL, NULL, NULL, &time2wait); + if (rc == -1) { + saverrno = errno; + (void) gettimeofday (&tstop, NULL); + errno = saverrno; + tremain.tv_sec = time2wait.tv_sec - + (tstop.tv_sec - tstart.tv_sec); + tremain.tv_usec = time2wait.tv_usec - + (tstop.tv_usec - tstart.tv_usec); + tremain.tv_sec += tremain.tv_usec / 1000000L; + tremain.tv_usec %= 1000000L; + } else { + tremain.tv_sec = 0; + tremain.tv_usec = 0; + } + TIMEVAL_TO_TIMESPEC(&tremain, rem) + + return(rc); +} + +#endif + diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h index 981196044..78d9ccdd4 100644 --- a/openbsd-compat/bsd-misc.h +++ b/openbsd-compat/bsd-misc.h @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: bsd-misc.h,v 1.6 2002/06/13 21:34:58 mouring Exp $ */ +/* $Id: bsd-misc.h,v 1.7 2003/03/18 18:21:41 tim Exp $ */ #ifndef _BSD_MISC_H #define _BSD_MISC_H @@ -80,5 +80,14 @@ int truncate (const char *path, off_t length); int setgroups(size_t size, const gid_t *list); #endif +#if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP) +#ifndef HAVE_STRUCT_TIMESPEC +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#endif +int nanosleep(const struct timespec *req, struct timespec *rem); +#endif #endif /* _BSD_MISC_H */ -- cgit v1.2.3 From 1182f654ee0ab474c40f28e6f10fa543194a973e Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Fri, 21 Mar 2003 00:51:35 +0000 Subject: - (bal) The days of lack of int64_t support are over. Sorry kids. --- ChangeLog | 3 ++- Makefile.in | 14 ++++++-------- configure.ac | 17 ++++++----------- 3 files changed, 14 insertions(+), 20 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index 52b6650a6..aa8836e9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ - markus@cvs.openbsd.org 2003/03/17 11:43:47 [version.h] enter 3.6 + - (bal) The days of lack of int64_t support are over. Sorry kids. 20030318 - (tim) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] @@ -1231,4 +1232,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2633 2003/03/19 23:11:34 djm Exp $ +$Id: ChangeLog,v 1.2633.2.1 2003/03/21 00:51:35 mouring Exp $ diff --git a/Makefile.in b/Makefile.in index 350b417f1..b94eae158 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.227 2003/02/24 23:22:36 djm Exp $ +# $Id: Makefile.in,v 1.227.2.1 2003/03/21 00:51:35 mouring Exp $ # uncomment if you run a non bourne compatable shell. Ie. csh #SHELL = @SH@ @@ -58,9 +58,7 @@ EXEEXT=@EXEEXT@ INSTALL_SSH_PRNG_CMDS=@INSTALL_SSH_PRNG_CMDS@ INSTALL_SSH_RAND_HELPER=@INSTALL_SSH_RAND_HELPER@ -@NO_SFTP@SFTP_PROGS=sftp-server$(EXEEXT) sftp$(EXEEXT) - -TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} $(SFTP_PROGS) +TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} sftp-server$(EXEEXT) sftp$(EXEEXT) LIBSSH_OBJS=authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o \ cipher.o compat.o compress.o crc32.o deattack.o fatal.o \ @@ -247,8 +245,8 @@ install-files: scard-install $(INSTALL) -m 0755 $(STRIP_OPT) ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \ fi $(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign $(DESTDIR)$(SSH_KEYSIGN) - @NO_SFTP@$(INSTALL) -m 0755 $(STRIP_OPT) sftp $(DESTDIR)$(bindir)/sftp - @NO_SFTP@$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server $(DESTDIR)$(SFTP_SERVER) + $(INSTALL) -m 0755 $(STRIP_OPT) sftp $(DESTDIR)$(bindir)/sftp + $(INSTALL) -m 0755 $(STRIP_OPT) sftp-server $(DESTDIR)$(SFTP_SERVER) $(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1 $(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1 $(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1 @@ -261,8 +259,8 @@ install-files: scard-install if [ ! -z "$(INSTALL_SSH_RAND_HELPER)" ]; then \ $(INSTALL) -m 644 ssh-rand-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-rand-helper.8 ; \ fi - @NO_SFTP@$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1 - @NO_SFTP@$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8 + $(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1 + $(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8 $(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8 -rm -f $(DESTDIR)$(bindir)/slogin ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin diff --git a/configure.ac b/configure.ac index 83575758f..6f4bdacc4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.111 2003/03/18 18:21:41 tim Exp $ +# $Id: configure.ac,v 1.111.2.1 2003/03/21 00:51:35 mouring Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -1485,12 +1485,14 @@ fi AC_CHECK_TYPES(struct timespec) -# If we don't have int64_t then we can't compile sftp-server. So don't -# even attempt to do it. +# We need int64_t or else certian parts of the compile will fail. if test "x$ac_cv_have_int64_t" = "xno" -a \ "x$ac_cv_sizeof_long_int" != "x8" -a \ "x$ac_cv_sizeof_long_long_int" = "x0" ; then - NO_SFTP='#' + echo "OpenSSH requires int64_t support. Contact your vendor or install" + echo "an alternative compiler (I.E., GCC) before continuing." + echo "" + exit 1; else dnl test snprintf (broken on SCO w/gcc) AC_TRY_RUN( @@ -1520,7 +1522,6 @@ main() { exit(0); } ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ] ) fi -AC_SUBST(NO_SFTP) dnl Checks for structure members OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP) @@ -2555,12 +2556,6 @@ if test "x$PAM_MSG" = "xyes" ; then echo "" fi -if test ! -z "$NO_SFTP"; then - echo "sftp-server will be disabled. Your compiler does not " - echo "support 64bit integers." - echo "" -fi - if test ! -z "$RAND_HELPER_CMDHASH" ; then echo "WARNING: you are using the builtin random number collection " echo "service. Please read WARNING.RNG and request that your OS " -- cgit v1.2.3 From 1f1ac904ad19c2dc12203a43de8dd8b90a9cfa96 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Fri, 21 Mar 2003 01:15:17 +0000 Subject: - (bal) Disable Privsep for Tru64 after pre-authentication due to issues with SIA. Also, clean up of tru64 support patch by Chris Adams --- ChangeLog | 5 ++++- README.privsep | 6 +++++- auth-sia.c | 47 ++++++++++++++++------------------------------- auth-sia.h | 2 +- configure.ac | 3 ++- session.c | 2 +- 6 files changed, 29 insertions(+), 36 deletions(-) (limited to 'configure.ac') diff --git a/ChangeLog b/ChangeLog index f710f8f64..015ab286b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ - (bal) scp.c 'limit' conflicts with Cray. Rename to 'limitbw' - (bal) Collection of Cray patches (bsd-cray.h fix for CRAYT3E and improved guessing rules) + - (bal) Disable Privsep for Tru64 after pre-authentication due to issues + with SIA. Also, clean up of tru64 support patch by Chris Adams + 20030318 - (tim) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] @@ -1235,4 +1238,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2633.2.3 2003/03/21 01:07:44 mouring Exp $ +$Id: ChangeLog,v 1.2633.2.4 2003/03/21 01:15:17 mouring Exp $ diff --git a/README.privsep b/README.privsep index ced943f26..e92af2c41 100644 --- a/README.privsep +++ b/README.privsep @@ -43,6 +43,10 @@ It does not function on HP-UX with a trusted system configuration. PAMAuthenticationViaKbdInt does not function with privsep. +On Compaq Tru64 Unix, only the pre-authentication part of privsep is +supported. Post-authentication privsep is disabled automatically (so +you won't see the additional process mentioned below). + Note that for a normal interactive login with a shell, enabling privsep will require 1 additional process per login session. @@ -58,4 +62,4 @@ process 1005 is the sshd process listening for new connections. process 6917 is the privileged monitor process, 6919 is the user owned sshd process and 6921 is the shell process. -$Id: README.privsep,v 1.10 2002/06/26 00:43:57 stevesk Exp $ +$Id: README.privsep,v 1.10.6.1 2003/03/21 01:15:18 mouring Exp $ diff --git a/auth-sia.c b/auth-sia.c index 071e154d8..5c9b3f5de 100644 --- a/auth-sia.c +++ b/auth-sia.c @@ -45,27 +45,25 @@ extern ServerOptions options; extern int saved_argc; extern char **saved_argv; -extern int errno; - int auth_sia_password(Authctxt *authctxt, char *pass) { int ret; SIAENTITY *ent = NULL; const char *host; - char *user = authctxt->user; host = get_canonical_hostname(options.verify_reverse_mapping); - if (pass[0] == '\0') + if (!authctxt->user || !pass || pass[0] == '\0') return(0); - if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, NULL, 0, - NULL) != SIASUCCESS) + if (sia_ses_init(&ent, saved_argc, saved_argv, host, authctxt->user, + NULL, 0, NULL) != SIASUCCESS) return(0); if ((ret = sia_ses_authent(NULL, pass, ent)) != SIASUCCESS) { - error("Couldn't authenticate %s from %s", user, host); + error("Couldn't authenticate %s from %s", authctxt->user, + host); if (ret & SIASTOP) sia_ses_release(&ent); return(0); @@ -77,48 +75,35 @@ auth_sia_password(Authctxt *authctxt, char *pass) } void -session_setup_sia(char *user, char *tty) +session_setup_sia(struct passwd *pw, char *tty) { - struct passwd *pw; SIAENTITY *ent = NULL; const char *host; - host = get_canonical_hostname (options.verify_reverse_mapping); + host = get_canonical_hostname(options.verify_reverse_mapping); - if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, tty, 0, - NULL) != SIASUCCESS) { + if (sia_ses_init(&ent, saved_argc, saved_argv, host, pw->pw_name, tty, + 0, NULL) != SIASUCCESS) fatal("sia_ses_init failed"); - } - if ((pw = getpwnam(user)) == NULL) { - sia_ses_release(&ent); - fatal("getpwnam: no user: %s", user); - } if (sia_make_entity_pwd(pw, ent) != SIASUCCESS) { sia_ses_release(&ent); fatal("sia_make_entity_pwd failed"); } ent->authtype = SIA_A_NONE; - if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS) { - fatal("Couldn't establish session for %s from %s", user, - host); - } - - if (setpriority(PRIO_PROCESS, 0, 0) == -1) { - sia_ses_release(&ent); - fatal("setpriority: %s", strerror (errno)); - } + if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS) + fatal("Couldn't establish session for %s from %s", + pw->pw_name, host); - if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS) { - fatal("Couldn't launch session for %s from %s", user, host); - } + if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS) + fatal("Couldn't launch session for %s from %s", pw->pw_name, + host); sia_ses_release(&ent); - if (setreuid(geteuid(), geteuid()) < 0) { + if (setreuid(geteuid(), geteuid()) < 0) fatal("setreuid: %s", strerror(errno)); - } } #endif /* HAVE_OSF_SIA */ diff --git a/auth-sia.h b/auth-sia.h index caa584132..7aecce940 100644 --- a/auth-sia.h +++ b/auth-sia.h @@ -27,6 +27,6 @@ #ifdef HAVE_OSF_SIA int auth_sia_password(Authctxt *authctxt, char *pass); -void session_setup_sia(char *user, char *tty); +void session_setup_sia(struct passwd *pw, char *tty); #endif /* HAVE_OSF_SIA */ diff --git a/configure.ac b/configure.ac index 6f4bdacc4..48a98d319 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.111.2.1 2003/03/21 00:51:35 mouring Exp $ +# $Id: configure.ac,v 1.111.2.2 2003/03/21 01:15:18 mouring Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -331,6 +331,7 @@ mips-sony-bsd|mips-sony-newsos4) AC_MSG_RESULT(yes) AC_DEFINE(HAVE_OSF_SIA) AC_DEFINE(DISABLE_LOGIN) + AC_DEFINE(DISABLE_FD_PASSING) LIBS="$LIBS -lsecurity -ldb -lm -laud" else AC_MSG_RESULT(no) diff --git a/session.c b/session.c index ce9db27ef..c75fea966 100644 --- a/session.c +++ b/session.c @@ -1321,7 +1321,7 @@ do_child(Session *s, const char *command) */ if (!options.use_login) { #ifdef HAVE_OSF_SIA - session_setup_sia(pw->pw_name, s->ttyfd == -1 ? NULL : s->tty); + session_setup_sia(pw, s->ttyfd == -1 ? NULL : s->tty); if (!check_quietlogin(s, command)) do_motd(); #else /* HAVE_OSF_SIA */ -- cgit v1.2.3