Compare commits
27
Commits
V_1_2_2
...
V_1_2_2_P1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
668b78c385 | ||
|
|
cf87b5b71b | ||
|
|
65165f8d83 | ||
|
|
9fb07e4b8b | ||
|
|
fac99cd12a | ||
|
|
01bedb83b1 | ||
|
|
00d4bb117a | ||
|
|
3c7eeb2af5 | ||
|
|
4095f894dc | ||
|
|
2453d01611 | ||
|
|
204ad074e5 | ||
|
|
c4cea3e5c7 | ||
|
|
c7d8dbbb0d | ||
|
|
a22ba0152c | ||
|
|
36143d7851 | ||
|
|
8b171bc4cd | ||
|
|
dd777a441f | ||
|
|
0c0e4bfe3c | ||
|
|
1852246d30 | ||
|
|
1787252789 | ||
|
|
6552758bae | ||
|
|
9e53f35a6a | ||
|
|
6034fdfd1f | ||
|
|
f07390e90d | ||
|
|
4e61b79d5b | ||
|
|
c85f9b4851 | ||
|
|
27f4c78698 |
@@ -6,6 +6,7 @@ Theo de Raadt, and Dug Song - Creators of OpenSSH
|
||||
Andrew Stribblehill <[email protected]> - Bugfixes
|
||||
Andre Lucas <[email protected]> - build, login and many other fixes
|
||||
Andy Sloane <[email protected]> - bugfixes
|
||||
Arkadiusz Miskiewicz <[email protected]> - IPv6 compat fixes
|
||||
Ben Taylor <[email protected]> - Solaris debugging and fixes
|
||||
Chip Salzenberg <[email protected]> - Assorted patches
|
||||
Chris Saia <[email protected]> - SuSE packaging
|
||||
@@ -17,6 +18,7 @@ Darren Hall <[email protected]> - AIX patches
|
||||
David Agraz <[email protected]> - Build fixes
|
||||
David Rankin <[email protected]> - libwrap, AIX, NetBSD fixes
|
||||
Gary E. Miller <[email protected]> - SCO support
|
||||
HARUYAMA Seigo <[email protected]> - Translations & doc fixes
|
||||
Holger Trapp <[email protected]> - KRB4/AFS config patch
|
||||
Jani Hakala <[email protected]> - Patches
|
||||
Jarno Huuskonen <[email protected]> - Bugfixes
|
||||
@@ -34,3 +36,7 @@ Phil Hands <[email protected]> - Debian scripts, assorted patches
|
||||
Thomas Neumann <[email protected]> - Shadow passwords
|
||||
Tor-Ake Fransson <[email protected]> - AIX support
|
||||
Tudor Bosman <[email protected]> - MD5 password support
|
||||
|
||||
Apologies to anyone I have missed.
|
||||
|
||||
Damien Miller <[email protected]>
|
||||
|
||||
@@ -1,3 +1,68 @@
|
||||
20000305
|
||||
- Fix DEC compile fix
|
||||
- Explicitly seed OpenSSL's PRNG before checking rsa_alive()
|
||||
- Check for getpagesize in libucb.a if not found in libc. Fix for old
|
||||
Solaris from Andre Lucas <[email protected]>
|
||||
- Check for libwrap if --with-tcp-wrappers option specified. Suggestion
|
||||
Mate Wierdl <[email protected]>
|
||||
|
||||
20000303
|
||||
- Added "make host-key" target, Suggestion from Dominik Brettnacher
|
||||
<[email protected]>
|
||||
- Don't permanently fail on bind() if getaddrinfo has more choices left for
|
||||
us. Needed to work around messy IPv6 on Linux. Patch from Arkadiusz
|
||||
Miskiewicz <[email protected]>
|
||||
- DEC Unix compile fix from David Del Piero <[email protected]>
|
||||
- Manpage fix from David Del Piero <[email protected]>
|
||||
|
||||
20000302
|
||||
- Big cleanup of autoconf code
|
||||
- Rearranged to be a little more logical
|
||||
- Added -R option for Solaris
|
||||
- Rewrote OpenSSL detection code. Now uses AC_TRY_RUN with a test program
|
||||
to detect library and header location _and_ ensure library has proper
|
||||
RSA support built in (this is a problem with OpenSSL 0.9.5).
|
||||
- Applied pty cleanup patch from [email protected]
|
||||
- Avoid warning message with Unix98 ptys
|
||||
- Warning was valid - possible race condition on PTYs. Avoided using
|
||||
platform-specific code.
|
||||
- Document some common problems
|
||||
- Allow root access to any key. Patch from
|
||||
[email protected]
|
||||
|
||||
20000207
|
||||
- Removed SOCKS code. Will support through a ProxyCommand.
|
||||
|
||||
20000203
|
||||
- Fixed SEGVs in authloop, fix from [email protected]
|
||||
- Add --with-ssl-dir option
|
||||
|
||||
20000202
|
||||
- Fix lastlog code for directory based lastlogs. Fix from Josh Durham
|
||||
<[email protected]>
|
||||
- Documentation fixes from HARUYAMA Seigo <[email protected]>
|
||||
- Added URLs to Japanese translations of documents by HARUYAMA Seigo
|
||||
<[email protected]>
|
||||
|
||||
20000201
|
||||
- Use socket pairs by default (instead of pipes). Prevents race condition
|
||||
on several (buggy) OSs. Report and fix from [email protected]
|
||||
|
||||
20000127
|
||||
- Seed OpenSSL's random number generator before generating RSA keypairs
|
||||
- Split random collector into seperate file
|
||||
- Compile fix from Andre Lucas <[email protected]>
|
||||
|
||||
20000126
|
||||
- Released 1.2.2 stable
|
||||
|
||||
- NeXT keeps it lastlog in /usr/adm. Report from
|
||||
[email protected]
|
||||
- Added note in UPGRADING re interop with commercial SSH using idea.
|
||||
Report from Jim Knoble <[email protected]>
|
||||
- Fix linking order for Kerberos/AFS. Fix from Holget Trapp
|
||||
<[email protected]>
|
||||
|
||||
20000125
|
||||
- Fix NULL pointer dereference in login.c. Fix from Andre Lucas
|
||||
<[email protected]>
|
||||
|
||||
@@ -155,6 +155,9 @@ IPv4 addresses. On Linux/glibc-2.1.2 this causes long delays in name
|
||||
resolution. If this option is specified, you can still attempt to
|
||||
connect to IPv6 addresses using the command line option '-6'.
|
||||
|
||||
--with-ssl-dir=DIR allows you to specify where your OpenSSL libraries
|
||||
are installed.
|
||||
|
||||
If you need to pass special options to the compiler or linker, you
|
||||
can specify these as enviornment variables before running ./configure.
|
||||
For example:
|
||||
@@ -170,8 +173,8 @@ whatever you specified as your --sysconfdir (/usr/local/etc by default).
|
||||
The default configuration should be instantly usable, though you should
|
||||
review it to ensure that it matches your security requirements.
|
||||
|
||||
To generate a host key, issue the following command: (replacing
|
||||
/etc/ssh/ssh_host_key with an appropriate path)
|
||||
To generate a host key, run "make host-key". Alternately you can do so
|
||||
manually using the following command:
|
||||
|
||||
/usr/bin/ssh-keygen -b 1024 -f /etc/ssh/ssh_host_key -N ''
|
||||
|
||||
|
||||
+4
-1
@@ -34,7 +34,7 @@ GNOME_LIBS=`gnome-config --libs gnome gnomeui`
|
||||
|
||||
TARGETS=ssh sshd ssh-add ssh-keygen ssh-agent scp $(EXTRA_TARGETS)
|
||||
|
||||
LIBOBJS= atomicio.o authfd.o authfile.o bsd-bindresvport.o bsd-daemon.o bsd-misc.o bsd-mktemp.o bsd-rresvport.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o fake-getaddrinfo.o fake-getnameinfo.o fingerprint.o hostfile.o log.o match.o mpaux.o nchan.o packet.o radix.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o
|
||||
LIBOBJS= atomicio.o authfd.o authfile.o bsd-bindresvport.o bsd-daemon.o bsd-misc.o bsd-mktemp.o bsd-rresvport.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o fake-getaddrinfo.o fake-getnameinfo.o fingerprint.o hostfile.o log.o match.o mpaux.o nchan.o packet.o radix.o random.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o
|
||||
|
||||
SSHOBJS= ssh.o sshconnect.o log-client.o readconf.o clientloop.o
|
||||
|
||||
@@ -136,6 +136,9 @@ install: $(TARGETS)
|
||||
$(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
|
||||
fi
|
||||
|
||||
host-key: ssh-keygen
|
||||
./ssh-keygen -b 1024 -f $(sysconfdir)/ssh_host_key -N ''
|
||||
|
||||
uninstallall: uninstall
|
||||
-rm -f $(DESTDIR)$(sysconfdir)/ssh_config
|
||||
-rm -f $(DESTDIR)$(sysconfdir)/sshd_config
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[ A Japanese translation of this document is available at
|
||||
[ http://www.unixuser.org/%7Eharuyama/security/openssh/index.html
|
||||
[ Thanks to HARUYAMA Seigo <[email protected]>
|
||||
|
||||
This is the port of OpenBSD's excellent OpenSSH to Linux and other
|
||||
Unices.
|
||||
|
||||
|
||||
@@ -10,3 +10,5 @@
|
||||
- Move all compatability cruft (bsd-*, fake-*) into subordinate library
|
||||
|
||||
- Cleanup configure.in
|
||||
|
||||
- A good source of strong random numbers. Waiting on a Yarrow port.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[ A Japanese translation of this document is available at
|
||||
[ http://www.unixuser.org/%7Eharuyama/security/openssh/index.html
|
||||
[ Thanks to HARUYAMA Seigo <[email protected]>
|
||||
|
||||
OpenSSH is almost completely compatible with the commercial SSH 1.2.x.
|
||||
There are, however, a few exceptions that you will need to bear in
|
||||
mind while upgrading:
|
||||
@@ -21,7 +25,7 @@ key.
|
||||
Solution: You will need to run the *commercial* version of ssh-keygen
|
||||
on the host's private key:
|
||||
|
||||
ssh-keygen -u /etc/ssh/ssh_host_key
|
||||
ssh-keygen -u -f /etc/ssh/ssh_host_key
|
||||
|
||||
3. Incompatible changes to sshd_config format.
|
||||
|
||||
@@ -78,17 +82,12 @@ users access to the account regardless of the policy specified by
|
||||
not add the "nullok" directive to your PAM configuration file unless
|
||||
you specifically wish to allow empty passwords.
|
||||
|
||||
7. Rhosts authentication does not work
|
||||
|
||||
Make sure that ssh is installed with the setuid bit set. Note that the
|
||||
Makefile does not do this by default.
|
||||
|
||||
8. X11 and/or agent forwarding does not work
|
||||
7. X11 and/or agent forwarding does not work
|
||||
|
||||
Check your ssh_config and sshd_config. The default configuration files
|
||||
disable authentication agent and X11 forwarding.
|
||||
|
||||
9. ssh takes a long time to connect with Linux/glibc 2.1
|
||||
8. ssh takes a long time to connect with Linux/glibc 2.1
|
||||
|
||||
The glibc shipped with Redhat 6.1 appears to take a long time to resolve
|
||||
"IPv6 or IPv4" addresses from domain names. This can be kludged around
|
||||
@@ -96,3 +95,28 @@ with the --with-ipv4-default configure option. This instructs OpenSSH to
|
||||
use IPv4-only address resolution. (IPv6 lookups may still be made by
|
||||
specifying the -6 option).
|
||||
|
||||
9. Logins from commercial ssh generate the error "Selected cipher type
|
||||
idea not supported by server"
|
||||
|
||||
This error is generated when a commercial ssh which has been configured to
|
||||
use the 'idea' cipher attempts to connect to an OpenSSH server. To rectify
|
||||
this, select a different cipher in ssh_config or ~/.ssh/config (3des for
|
||||
security or blowfish for speed).
|
||||
|
||||
10. "can't locate module net-pf-10" messages in log under Linux
|
||||
|
||||
The Linux kernel is looking (via modprobe) for protocol family 10 (IPv6).
|
||||
Either 1. load the appropriate kernel module, 2. enter the correct alias
|
||||
in /etc/modules.conf or 3. disable IPv6 in /etc/modules.conf.
|
||||
|
||||
For some silly reason /etc/modules.conf may also be named /etc/conf.modules
|
||||
|
||||
11. Password authentication doesn't work on Slackware 7.0
|
||||
|
||||
Configure OpenSSH with --with-md5-passwords
|
||||
|
||||
12. ./configure or sshd complain about lack of RSA support
|
||||
|
||||
Ensure that your OpenSSL libraries have been built to include RSA support
|
||||
either internally or through RSAref.
|
||||
|
||||
|
||||
+6
-3
@@ -6,9 +6,6 @@
|
||||
|
||||
@TOP@
|
||||
|
||||
/* SSL directory. */
|
||||
#undef ssldir
|
||||
|
||||
/* Define if you want to disable PAM support */
|
||||
#undef DISABLE_PAM
|
||||
|
||||
@@ -95,6 +92,9 @@
|
||||
/* Define if your libraries define daemon() */
|
||||
#undef HAVE_DAEMON
|
||||
|
||||
/* Define if your libraries define getpagesize() */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if xauth is found in your path */
|
||||
#undef XAUTH_PATH
|
||||
|
||||
@@ -153,6 +153,9 @@
|
||||
/* getaddrinfo is broken (if present) */
|
||||
#undef BROKEN_GETADDRINFO
|
||||
|
||||
/* Whether Unix98 ptys are automatically removed when they are closed */
|
||||
#undef PTY_REMOVED_ON_CLOSE
|
||||
|
||||
@BOTTOM@
|
||||
|
||||
/* ******************* Shouldn't need to edit below this line ************** */
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$Id: authfile.c,v 1.6 1999/12/07 04:38:32 damien Exp $");
|
||||
RCSID("$Id: authfile.c,v 1.7 2000/03/02 12:57:18 damien Exp $");
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
#include <openssl/bn.h>
|
||||
@@ -228,7 +228,7 @@ load_private_key(const char *filename, const char *passphrase,
|
||||
|
||||
/* check owner and modes */
|
||||
if (fstat(fd, &st) < 0 ||
|
||||
(st.st_uid != 0 && st.st_uid != getuid()) ||
|
||||
(st.st_uid != 0 && getuid() != 0 && st.st_uid != getuid()) ||
|
||||
(st.st_mode & 077) != 0) {
|
||||
close(fd);
|
||||
error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
||||
|
||||
+3
-61
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
**
|
||||
** OpenBSD emulation routines
|
||||
** OpenBSD replacement routines
|
||||
**
|
||||
** Damien Miller <[email protected]>
|
||||
**
|
||||
@@ -44,8 +44,6 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
@@ -54,10 +52,7 @@
|
||||
#include "xmalloc.h"
|
||||
#include "ssh.h"
|
||||
#include "bsd-misc.h"
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(type, member) ((size_t) &((type *)0)->member)
|
||||
#endif
|
||||
#include "random.h"
|
||||
|
||||
#ifndef HAVE_ARC4RANDOM
|
||||
|
||||
@@ -68,7 +63,6 @@ typedef struct
|
||||
int j;
|
||||
} rc4_t;
|
||||
|
||||
void get_random_bytes(unsigned char *buf, int len);
|
||||
void rc4_key(rc4_t *r, unsigned char *key, int len);
|
||||
void rc4_getbytes(rc4_t *r, unsigned char *buffer, int len);
|
||||
|
||||
@@ -134,59 +128,7 @@ void arc4random_stir(void)
|
||||
|
||||
get_random_bytes(rand_buf, sizeof(rand_buf));
|
||||
rc4_key(rc4, rand_buf, sizeof(rand_buf));
|
||||
}
|
||||
|
||||
void get_random_bytes(unsigned char *buf, int len)
|
||||
{
|
||||
static int random_pool;
|
||||
int c;
|
||||
#ifdef HAVE_EGD
|
||||
char egd_message[2] = { 0x02, 0x00 };
|
||||
struct sockaddr_un addr;
|
||||
int addr_len;
|
||||
|
||||
memset(&addr, '\0', sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
|
||||
/* FIXME: compile time check? */
|
||||
if (sizeof(RANDOM_POOL) > sizeof(addr.sun_path))
|
||||
fatal("Random pool path is too long");
|
||||
|
||||
strcpy(addr.sun_path, RANDOM_POOL);
|
||||
|
||||
addr_len = offsetof(struct sockaddr_un, sun_path) + sizeof(RANDOM_POOL);
|
||||
|
||||
random_pool = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
if (random_pool == -1)
|
||||
fatal("Couldn't create AF_UNIX socket: %s", strerror(errno));
|
||||
|
||||
if (connect(random_pool, (struct sockaddr*)&addr, addr_len) == -1)
|
||||
fatal("Couldn't connect to EGD socket \"%s\": %s", addr.sun_path, strerror(errno));
|
||||
|
||||
if (len > 255)
|
||||
fatal("Too many bytes to read from EGD");
|
||||
|
||||
/* Send blocking read request to EGD */
|
||||
egd_message[1] = len;
|
||||
|
||||
c = atomicio(write, random_pool, egd_message, sizeof(egd_message));
|
||||
if (c == -1)
|
||||
fatal("Couldn't write to EGD socket \"%s\": %s", RANDOM_POOL, strerror(errno));
|
||||
|
||||
#else /* HAVE_EGD */
|
||||
|
||||
random_pool = open(RANDOM_POOL, O_RDONLY);
|
||||
if (random_pool == -1)
|
||||
fatal("Couldn't open random pool \"%s\": %s", RANDOM_POOL, strerror(errno));
|
||||
|
||||
#endif /* HAVE_EGD */
|
||||
|
||||
c = atomicio(read, random_pool, buf, len);
|
||||
if (c <= 0)
|
||||
fatal("Couldn't read from random pool \"%s\": %s", RANDOM_POOL, strerror(errno));
|
||||
|
||||
close(random_pool);
|
||||
memset(rand_buf, 0, sizeof(rand_buf));
|
||||
}
|
||||
#endif /* !HAVE_ARC4RANDOM */
|
||||
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ vsnprintf(str, n, fmt, ap)
|
||||
char *str;
|
||||
size_t n;
|
||||
char *fmt;
|
||||
char *ap;
|
||||
va_list *ap;
|
||||
{
|
||||
struct sigaction osa, nsa;
|
||||
char *p;
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ int snprintf(char *str, size_t n, char const *fmt, ...);
|
||||
#endif /* !HAVE_SNPRINTF */
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
int vsnprintf(char *str, size_t n, char *fmt, char *ap);
|
||||
int vsnprintf(char *str, size_t n, char *fmt, va_list *ap);
|
||||
#endif /* !HAVE_SNPRINTF */
|
||||
|
||||
|
||||
|
||||
+10
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$Id: channels.c,v 1.16 2000/01/17 02:22:55 damien Exp $");
|
||||
RCSID("$Id: channels.c,v 1.17 2000/03/03 11:35:33 damien Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "packet.h"
|
||||
@@ -935,7 +935,11 @@ channel_request_local_forwarding(u_short port, const char *host,
|
||||
/* Bind the socket to the address. */
|
||||
if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
|
||||
/* address can be in use ipv6 address is already bound */
|
||||
verbose("bind: %.100s", strerror(errno));
|
||||
if (!ai->ai_next)
|
||||
error("bind: %.100s", strerror(errno));
|
||||
else
|
||||
verbose("bind: %.100s", strerror(errno));
|
||||
|
||||
close(sock);
|
||||
continue;
|
||||
}
|
||||
@@ -1199,6 +1203,10 @@ x11_create_display_inet(int screen_number, int x11_display_offset)
|
||||
debug("bind port %d: %.100s", port, strerror(errno));
|
||||
shutdown(sock, SHUT_RDWR);
|
||||
close(sock);
|
||||
|
||||
if (ai->ai_next)
|
||||
continue;
|
||||
|
||||
for (n = 0; n < num_socks; n++) {
|
||||
shutdown(socks[n], SHUT_RDWR);
|
||||
close(socks[n]);
|
||||
|
||||
+279
-244
@@ -3,7 +3,11 @@ AC_INIT(ssh.c)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
dnl Checks for programs.
|
||||
# C Compiler features
|
||||
if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi
|
||||
AC_C_INLINE
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_RANLIB
|
||||
@@ -12,71 +16,7 @@ AC_CHECK_PROG(AR, ar, ar)
|
||||
AC_PATH_PROG(PERL, perl)
|
||||
AC_SUBST(PERL)
|
||||
|
||||
AC_ARG_WITH(rsh,
|
||||
[ --with-rsh=PATH Specify path to remote shell program ],
|
||||
[
|
||||
if test "x$withval" != "$xno" ; then
|
||||
AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
|
||||
fi
|
||||
],
|
||||
[
|
||||
AC_PATH_PROG(rsh_path, rsh)
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(xauth,
|
||||
[ --with-xauth=PATH Specify path to xauth program ],
|
||||
[
|
||||
if test "x$withval" != "$xno" ; then
|
||||
AC_DEFINE_UNQUOTED(XAUTH_PATH, "$withval")
|
||||
fi
|
||||
],
|
||||
[
|
||||
AC_PATH_PROG(xauth_path, xauth)
|
||||
if test ! -z "$xauth_path" -a -x "/usr/openwin/bin/xauth" ; then
|
||||
xauth_path="/usr/openwin/bin/xauth"
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
if test ! -z "$xauth_path" ; then
|
||||
AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
|
||||
fi
|
||||
if test ! -z "$rsh_path" ; then
|
||||
AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
|
||||
fi
|
||||
|
||||
dnl Checks for compiler characteristics
|
||||
if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi
|
||||
|
||||
AC_C_INLINE
|
||||
|
||||
dnl Check for OpenSSL/SSLeay directories.
|
||||
AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
|
||||
for ssldir in $prefix /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local $prefix /usr/pkg ; do
|
||||
if test -f "$ssldir/include/openssl/crypto.h"; then
|
||||
AC_DEFINE(HAVE_OPENSSL)
|
||||
GOT_SSL="yes"
|
||||
break
|
||||
fi
|
||||
if test -f "$ssldir/include/ssl/crypto.h"; then
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
GOT_SSL="yes"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$GOT_SSL" ; then
|
||||
AC_MSG_ERROR([Could not find SSLeay / OpenSSL libraries, please install])
|
||||
fi
|
||||
AC_SUBST(ssldir)
|
||||
AC_DEFINE_UNQUOTED(ssldir, "$ssldir")
|
||||
if test "$ssldir" != "/usr"; then
|
||||
CFLAGS="$CFLAGS -I$ssldir/include"
|
||||
LDFLAGS="$LDFLAGS -L$ssldir/lib"
|
||||
fi
|
||||
AC_MSG_RESULT($ssldir)
|
||||
|
||||
dnl Check for some target-specific stuff
|
||||
# Check for some target-specific stuff
|
||||
case "$host" in
|
||||
*-*-aix*)
|
||||
AFS_LIBS="-lld"
|
||||
@@ -115,13 +55,14 @@ case "$host" in
|
||||
;;
|
||||
*-*-linux*)
|
||||
no_dev_ptmx=1
|
||||
need_pty_removed_on_close=1
|
||||
;;
|
||||
*-*-netbsd*)
|
||||
if test "$GOT_SSL" = "yes"; then
|
||||
LDFLAGS="$LDFLAGS -R$ssldir/lib"
|
||||
fi
|
||||
need_dash_r=1
|
||||
;;
|
||||
*-*-solaris*)
|
||||
need_dash_r=1
|
||||
LDFLAGS="-L/usr/ucblib"
|
||||
AC_DEFINE(USE_UTMPX)
|
||||
;;
|
||||
*-*-sysv*)
|
||||
@@ -132,17 +73,7 @@ case "$host" in
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Check for RSAref library.
|
||||
AC_MSG_CHECKING([for RSAref library])
|
||||
saved_LIBS="$LIBS"
|
||||
LIBS="$saved_LIBS -lRSAglue -lrsaref"
|
||||
AC_TRY_LINK([], [],
|
||||
[AC_MSG_RESULT(yes);
|
||||
AC_DEFINE(RSAREF)],
|
||||
[AC_MSG_RESULT(no)]; LIBS="$saved_LIBS")
|
||||
|
||||
dnl Checks for libraries.
|
||||
AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***]))
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
|
||||
AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
|
||||
|
||||
@@ -153,11 +84,11 @@ if test -z "$no_libnsl" ; then
|
||||
AC_CHECK_LIB(socket, main, , )
|
||||
fi
|
||||
|
||||
dnl Checks for header files.
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS(bstring.h endian.h lastlog.h login.h maillock.h netdb.h netgroup.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h util.h utmp.h utmpx.h)
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(arc4random bindresvport_af freeaddrinfo gai_strerror getaddrinfo getpagesize getnameinfo innetgr md5_crypt mkdtemp openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf _getpty)
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS(arc4random bindresvport_af freeaddrinfo gai_strerror getaddrinfo getnameinfo innetgr md5_crypt mkdtemp openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf _getpty)
|
||||
|
||||
AC_CHECK_FUNC(login,
|
||||
[AC_DEFINE(HAVE_LOGIN)],
|
||||
@@ -169,14 +100,123 @@ AC_CHECK_FUNC(daemon,
|
||||
[AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
|
||||
)
|
||||
|
||||
dnl Checks for data types
|
||||
AC_CHECK_FUNC(getpagesize,
|
||||
[AC_DEFINE(HAVE_GETPAGESIZE)],
|
||||
[AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(pam,
|
||||
[ --without-pam Disable PAM support ],
|
||||
[
|
||||
if test "x$withval" = "xno" ; then
|
||||
no_pam=1
|
||||
AC_DEFINE(DISABLE_PAM)
|
||||
fi
|
||||
]
|
||||
)
|
||||
if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
|
||||
AC_CHECK_LIB(dl, dlopen, , )
|
||||
LIBS="$LIBS -lpam"
|
||||
|
||||
# Check PAM strerror arguments (old PAM)
|
||||
AC_MSG_CHECKING([whether pam_strerror takes only one argument])
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
#include <security/pam_appl.h>
|
||||
],
|
||||
[(void)pam_strerror((pam_handle_t *)NULL, -1);],
|
||||
[AC_MSG_RESULT(no)],
|
||||
[
|
||||
AC_DEFINE(HAVE_OLD_PAM)
|
||||
AC_MSG_RESULT(yes)
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
# The big search for OpenSSL
|
||||
AC_ARG_WITH(ssl-dir,
|
||||
[ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
|
||||
[
|
||||
if test "x$withval" != "$xno" ; then
|
||||
tryssldir=$withval
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
saved_LIBS="$LIBS"
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
if test "x$prefix" != "xNONE" ; then
|
||||
tryssldir="$tryssldir $prefix"
|
||||
fi
|
||||
AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
|
||||
for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
|
||||
if test ! -z "$ssldir" ; then
|
||||
LIBS="$saved_LIBS -L$ssldir"
|
||||
CFLAGS="$CFLAGS -I$ssldir/include"
|
||||
if test "x$need_dash_r" = "x1" ; then
|
||||
LIBS="$LIBS -R$ssldir"
|
||||
fi
|
||||
fi
|
||||
LIBS="$LIBS -lcrypto"
|
||||
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/sha.h>
|
||||
int main(void)
|
||||
{RSA *key; char seed[2048];memset(seed, 0, sizeof(seed));
|
||||
RAND_seed(seed, sizeof(seed));key=RSA_generate_key(32,3,NULL,NULL);
|
||||
return(key==NULL);}
|
||||
],
|
||||
[
|
||||
AC_DEFINE(HAVE_OPENSSL)
|
||||
found_crypto=1
|
||||
break;
|
||||
], []
|
||||
)
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <ssl/rsa.h>
|
||||
#include <ssl/bn.h>
|
||||
#include <ssl/sha.h>
|
||||
int main(void)
|
||||
{RSA *key; char seed[2048];memset(seed, 0, sizeof(seed));
|
||||
RAND_seed(seed, sizeof(seed));key=RSA_generate_key(32,3,NULL,NULL);
|
||||
return(key==NULL);}
|
||||
],
|
||||
[
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
found_crypto=1
|
||||
break;
|
||||
], []
|
||||
)
|
||||
done
|
||||
|
||||
if test -z "$found_crypto" ; then
|
||||
AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
|
||||
fi
|
||||
if test -z "$ssldir" ; then
|
||||
ssldir="(system)"
|
||||
else
|
||||
CFLAGS="$CFLAGS -I$ssldir/include"
|
||||
LDFLAGS="$LDFLAGS -L$ssldir/lib"
|
||||
if test "x$need_dash_r" = "x1" ; then
|
||||
LDFLAGS="$LDFLAGS -R$ssldir"
|
||||
fi
|
||||
fi
|
||||
LIBS="$saved_LIBS -lcrypto"
|
||||
AC_MSG_RESULT($ssldir)
|
||||
|
||||
# Checks for data types
|
||||
AC_CHECK_SIZEOF(char, 1)
|
||||
AC_CHECK_SIZEOF(short int, 2)
|
||||
AC_CHECK_SIZEOF(int, 4)
|
||||
AC_CHECK_SIZEOF(long int, 4)
|
||||
AC_CHECK_SIZEOF(long long int, 8)
|
||||
|
||||
dnl More checks for data types
|
||||
# More checks for data types
|
||||
AC_MSG_CHECKING([for intXX_t types])
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
@@ -309,89 +349,7 @@ AC_TRY_COMPILE(
|
||||
[AC_MSG_RESULT(no)]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(pam,
|
||||
[ --without-pam Disable PAM support ],
|
||||
[
|
||||
if test "x$withval" = "xno" ; then
|
||||
no_pam=1
|
||||
AC_DEFINE(DISABLE_PAM)
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
|
||||
AC_CHECK_LIB(dl, dlopen, , )
|
||||
LIBS="$LIBS -lpam"
|
||||
dnl Check PAM strerror arguments
|
||||
AC_MSG_CHECKING([whether pam_strerror takes only one argument])
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
#include <security/pam_appl.h>
|
||||
],
|
||||
[(void)pam_strerror((pam_handle_t *)NULL, -1);],
|
||||
[AC_MSG_RESULT(no)],
|
||||
[
|
||||
AC_DEFINE(HAVE_OLD_PAM)
|
||||
AC_MSG_RESULT(yes)
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to build GNOME ssh-askpass])
|
||||
dnl Check whether user wants GNOME ssh-askpass
|
||||
AC_ARG_WITH(gnome-askpass,
|
||||
[ --with-gnome-askpass Build the GNOME passphrase requester (default=no)],
|
||||
[
|
||||
if test x$withval = xno ; then
|
||||
GNOME_ASKPASS="";
|
||||
else
|
||||
GNOME_ASKPASS="gnome-ssh-askpass";
|
||||
fi
|
||||
])
|
||||
AC_SUBST(GNOME_ASKPASS)
|
||||
|
||||
if test -z "$GNOME_ASKPASS" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
|
||||
dnl Check for user-specified random device
|
||||
AC_ARG_WITH(random,
|
||||
[ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
|
||||
[
|
||||
RANDOM_POOL="$withval";
|
||||
AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
|
||||
],
|
||||
[
|
||||
dnl Check for random device
|
||||
AC_CHECK_FILE("/dev/urandom",
|
||||
[
|
||||
RANDOM_POOL="/dev/urandom";
|
||||
AC_SUBST(RANDOM_POOL)
|
||||
AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
dnl Check for EGD pool file
|
||||
AC_ARG_WITH(egd-pool,
|
||||
[ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
|
||||
[
|
||||
RANDOM_POOL="$withval";
|
||||
AC_DEFINE(HAVE_EGD)
|
||||
AC_SUBST(RANDOM_POOL)
|
||||
AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
|
||||
]
|
||||
)
|
||||
|
||||
dnl Make sure we have random number support
|
||||
if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then
|
||||
AC_MSG_ERROR([No random device found, and no EGD random pool specified])
|
||||
fi
|
||||
|
||||
# Checks for structure members
|
||||
AC_MSG_CHECKING([whether utmp.h has ut_host field])
|
||||
AC_EGREP_HEADER(ut_host, utmp.h,
|
||||
[AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ],
|
||||
@@ -475,7 +433,60 @@ AC_TRY_COMPILE(
|
||||
[AC_MSG_RESULT(no)]
|
||||
)
|
||||
|
||||
dnl Look for lastlog location
|
||||
AC_MSG_CHECKING([whether libc defines __progname])
|
||||
AC_TRY_LINK([],
|
||||
[extern char *__progname; printf("%s", __progname);],
|
||||
[
|
||||
AC_DEFINE(HAVE___PROGNAME)
|
||||
AC_MSG_RESULT(yes)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
]
|
||||
)
|
||||
|
||||
# Looking for programs, paths and files
|
||||
AC_ARG_WITH(rsh,
|
||||
[ --with-rsh=PATH Specify path to remote shell program ],
|
||||
[
|
||||
if test "x$withval" != "$xno" ; then
|
||||
AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
|
||||
fi
|
||||
],
|
||||
[
|
||||
AC_PATH_PROG(rsh_path, rsh)
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(xauth,
|
||||
[ --with-xauth=PATH Specify path to xauth program ],
|
||||
[
|
||||
if test "x$withval" != "$xno" ; then
|
||||
AC_DEFINE_UNQUOTED(XAUTH_PATH, "$withval")
|
||||
fi
|
||||
],
|
||||
[
|
||||
AC_PATH_PROG(xauth_path, xauth)
|
||||
if test ! -z "$xauth_path" -a -x "/usr/openwin/bin/xauth" ; then
|
||||
xauth_path="/usr/openwin/bin/xauth"
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
if test ! -z "$xauth_path" ; then
|
||||
AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
|
||||
fi
|
||||
if test ! -z "$rsh_path" ; then
|
||||
AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
|
||||
fi
|
||||
|
||||
# Check for mail directory (last resort if we cannot get it from headers)
|
||||
if test ! -z "$MAIL" ; then
|
||||
maildir=`dirname $MAIL`
|
||||
AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
|
||||
fi
|
||||
|
||||
# Look for lastlog location
|
||||
AC_ARG_WITH(lastlog,
|
||||
[ --with-lastlog=FILE Location of lastlog file],
|
||||
[
|
||||
@@ -487,7 +498,7 @@ AC_ARG_WITH(lastlog,
|
||||
],
|
||||
[
|
||||
AC_MSG_CHECKING([location of lastlog file])
|
||||
for lastlog in /var/log/lastlog /var/adm/lastlog /etc/security/lastlog ; do
|
||||
for lastlog in /var/log/lastlog /var/adm/lastlog /usr/adm/lastlog /etc/security/lastlog ; do
|
||||
if test -f $lastlog ; then
|
||||
gotlastlog="file"
|
||||
break
|
||||
@@ -517,59 +528,85 @@ if test ! -z "$nolastlog" ; then
|
||||
AC_DEFINE(DISABLE_LASTLOG)
|
||||
fi
|
||||
|
||||
dnl Compile with dante SOCKS library
|
||||
AC_ARG_WITH(dante,
|
||||
[ --with-dante=DIR Use Dante SOCKS lib (default is system library path)],
|
||||
if test -z "$no_dev_ptmx" ; then
|
||||
AC_CHECK_FILE("/dev/ptmx",
|
||||
[
|
||||
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
|
||||
have_dev_ptmx=1
|
||||
]
|
||||
)
|
||||
fi
|
||||
AC_CHECK_FILE("/dev/ptc",
|
||||
[
|
||||
SAVELIBS="$LIBS"
|
||||
SOCKSLIBS=""
|
||||
SOCKSLIBPATH=""
|
||||
if test "x$withval" != "xno" ; then
|
||||
if test -n $withval ; then
|
||||
LIBS="$LIBS -L$withval"
|
||||
SOCKSLIBPATH="-L$withval"
|
||||
fi
|
||||
AC_CHECK_LIB(socks, Rconnect, AC_DEFINE(HAVE_DANTE) SOCKSLIBS="$SOCKSLIBPATH -lsocks")
|
||||
fi
|
||||
LIBS="$SAVELIBS $SOCKSLIBS"
|
||||
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
|
||||
have_dev_ptc=1
|
||||
]
|
||||
)
|
||||
|
||||
dnl Compile with SOCKS4 SOCKS library
|
||||
AC_ARG_WITH(socks4,
|
||||
[ --with-socks4=DIR Use Socks4 SOCKS lib (default is system library path)],
|
||||
# Some systems (defined in platform-specific code above) automagically remove
|
||||
# Unix98 ptys when they are closed
|
||||
if test "x$ac_cv_func_openpty" = "xyes" -o "x$have_dev_ptmx" = "x1" -o "x$have_dev_ptc" = "x1" ; then
|
||||
if test "x$need_pty_removed_on_close" = "x1" ; then
|
||||
AC_DEFINE(PTY_REMOVED_ON_CLOSE)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Options from here on. Some of these are preset by platform above
|
||||
|
||||
# Check whether user wants GNOME ssh-askpass
|
||||
AC_MSG_CHECKING([whether to build GNOME ssh-askpass])
|
||||
AC_ARG_WITH(gnome-askpass,
|
||||
[ --with-gnome-askpass Build the GNOME passphrase requester (default=no)],
|
||||
[
|
||||
SAVELIBS="$LIBS"
|
||||
SOCKSLIBS=""
|
||||
SOCKSLIBPATH=""
|
||||
if test "x$withval" != "xno" ; then
|
||||
if test -n $withval ; then
|
||||
LIBS="$LIBS -L$withval"
|
||||
SOCKSLIBPATH="-L$withval"
|
||||
fi
|
||||
AC_CHECK_LIB(socks, Rconnect, AC_DEFINE(HAVE_SOCKS4) SOCKSLIBS="$SOCKSLIBPATH -lsocks")
|
||||
if test x$withval = xno ; then
|
||||
GNOME_ASKPASS="";
|
||||
else
|
||||
GNOME_ASKPASS="gnome-ssh-askpass";
|
||||
fi
|
||||
LIBS="$SAVELIBS $SOCKSLIBS"
|
||||
])
|
||||
AC_SUBST(GNOME_ASKPASS)
|
||||
|
||||
if test -z "$GNOME_ASKPASS" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
|
||||
# Check for user-specified random device, otherwise check /dev/urandom
|
||||
AC_ARG_WITH(random,
|
||||
[ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
|
||||
[
|
||||
RANDOM_POOL="$withval";
|
||||
AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
|
||||
],
|
||||
[
|
||||
# Check for random device
|
||||
AC_CHECK_FILE("/dev/urandom",
|
||||
[
|
||||
RANDOM_POOL="/dev/urandom";
|
||||
AC_SUBST(RANDOM_POOL)
|
||||
AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
dnl Compile with SOCKS5 SOCKS library
|
||||
AC_ARG_WITH(socks5,
|
||||
[ --with-socks5=DIR Use Socks5 SOCKS lib (default is system library path)],
|
||||
# Check for EGD pool file
|
||||
AC_ARG_WITH(egd-pool,
|
||||
[ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
|
||||
[
|
||||
SAVELIBS="$LIBS"
|
||||
SOCKSLIBS=""
|
||||
SOCKSLIBPATH=""
|
||||
if test "x$withval" != "xno" ; then
|
||||
if test -n $withval ; then
|
||||
LIBS="$LIBS -L$withval"
|
||||
SOCKSLIBPATH="-L$withval"
|
||||
fi
|
||||
AC_CHECK_LIB(socks5, SOCKSconnect, AC_DEFINE(HAVE_SOCKS5) SOCKSLIBS="$SOCKSLIBPATH -lsocks5")
|
||||
fi
|
||||
LIBS="$SAVELIBS $SOCKSLIBS"
|
||||
RANDOM_POOL="$withval";
|
||||
AC_DEFINE(HAVE_EGD)
|
||||
AC_SUBST(RANDOM_POOL)
|
||||
AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
|
||||
]
|
||||
)
|
||||
|
||||
# Make sure we have some random number support
|
||||
if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then
|
||||
AC_MSG_ERROR([No random device found, and no EGD random pool specified])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(catman,
|
||||
[ --with-catman=man|cat Install preformatted manpages[no]],
|
||||
[
|
||||
@@ -589,24 +626,7 @@ AC_ARG_WITH(catman,
|
||||
AC_SUBST(MANTYPE)
|
||||
AC_SUBST(mansubdir)
|
||||
|
||||
if test -z "$no_dev_ptmx" ; then
|
||||
AC_CHECK_FILE("/dev/ptmx", AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX))
|
||||
fi
|
||||
AC_CHECK_FILE("/dev/ptc", AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC))
|
||||
|
||||
AC_MSG_CHECKING([whether libc defines __progname])
|
||||
AC_TRY_LINK([],
|
||||
[extern char *__progname; printf("%s", __progname);],
|
||||
[
|
||||
AC_DEFINE(HAVE___PROGNAME)
|
||||
AC_MSG_RESULT(yes)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
]
|
||||
)
|
||||
|
||||
dnl Check whether user wants Kerberos support
|
||||
# Check whether user wants Kerberos support
|
||||
AC_ARG_WITH(kerberos4,
|
||||
[ --with-kerberos4=PATH Enable Kerberos 4 support],
|
||||
[
|
||||
@@ -630,7 +650,7 @@ AC_ARG_WITH(kerberos4,
|
||||
AC_MSG_WARN([Cannot find libkrb, build may fail])
|
||||
fi
|
||||
|
||||
LIBS="$LIBS -lkrb -ldes"
|
||||
KLIBS="-lkrb -ldes"
|
||||
AC_CHECK_LIB(resolv, dn_expand, , )
|
||||
KRB4=yes
|
||||
AC_DEFINE(KRB4)
|
||||
@@ -638,7 +658,7 @@ AC_ARG_WITH(kerberos4,
|
||||
]
|
||||
)
|
||||
|
||||
dnl Check whether user wants AFS support
|
||||
# Check whether user wants AFS support
|
||||
AC_ARG_WITH(afs,
|
||||
[ --with-afs=PATH Enable AFS support],
|
||||
[
|
||||
@@ -661,8 +681,9 @@ AC_ARG_WITH(afs,
|
||||
fi
|
||||
]
|
||||
)
|
||||
LIBS="$LIBS $KLIBS"
|
||||
|
||||
dnl Check whether user wants S/Key support
|
||||
# Check whether user wants S/Key support
|
||||
AC_ARG_WITH(skey,
|
||||
[ --with-skey Enable S/Key support],
|
||||
[
|
||||
@@ -673,18 +694,35 @@ AC_ARG_WITH(skey,
|
||||
]
|
||||
)
|
||||
|
||||
dnl Check whether user wants TCP wrappers support
|
||||
# Check whether user wants TCP wrappers support
|
||||
AC_ARG_WITH(tcp-wrappers,
|
||||
[ --with-tcp-wrappers Enable tcpwrappers support],
|
||||
[
|
||||
if test "x$withval" != "$xno" ; then
|
||||
AC_DEFINE(LIBWRAP)
|
||||
saved_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lwrap"
|
||||
AC_MSG_CHECKING(for libwrap)
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <tcpd.h>
|
||||
int deny_severity = 0, allow_severity = 0;
|
||||
],
|
||||
[hosts_access(0);],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(LIBWRAP)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN([*** libwrap missing - tcpwrapper support disabled ***])
|
||||
LIBS="$saved_LIBS"
|
||||
]
|
||||
)
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
dnl Check whether to enable MD5 passwords
|
||||
# Check whether to enable MD5 passwords
|
||||
AC_ARG_WITH(md5-passwords,
|
||||
[ --with-md5-passwords Enable use of MD5 passwords],
|
||||
[
|
||||
@@ -694,7 +732,7 @@ AC_ARG_WITH(md5-passwords,
|
||||
]
|
||||
)
|
||||
|
||||
dnl Check whether to enable utmpx support
|
||||
# Check whether to enable utmpx support
|
||||
AC_ARG_WITH(utmpx,
|
||||
[ --with-utmpx Enable utmpx support],
|
||||
[
|
||||
@@ -704,7 +742,7 @@ AC_ARG_WITH(utmpx,
|
||||
]
|
||||
)
|
||||
|
||||
dnl Whether to disable shadow password support
|
||||
# Whether to disable shadow password support
|
||||
AC_ARG_WITH(shadow,
|
||||
[ --without-shadow Disable shadow password support],
|
||||
[
|
||||
@@ -714,7 +752,7 @@ AC_ARG_WITH(shadow,
|
||||
]
|
||||
)
|
||||
|
||||
dnl Use ip address instead of hostname in $DISPLAY
|
||||
# Use ip address instead of hostname in $DISPLAY
|
||||
AC_ARG_WITH(ipaddr-display,
|
||||
[ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
|
||||
[
|
||||
@@ -724,6 +762,7 @@ AC_ARG_WITH(ipaddr-display,
|
||||
]
|
||||
)
|
||||
|
||||
# Whether to mess with the default path
|
||||
AC_ARG_WITH(default-path,
|
||||
[ --with-default-path=PATH Specify default \$PATH environment for server],
|
||||
[
|
||||
@@ -733,6 +772,7 @@ AC_ARG_WITH(default-path,
|
||||
]
|
||||
)
|
||||
|
||||
# Whether to force IPv4 by default (needed on broken glibc Linux)
|
||||
AC_ARG_WITH(ipv4-default,
|
||||
[ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
|
||||
[
|
||||
@@ -742,6 +782,7 @@ AC_ARG_WITH(ipv4-default,
|
||||
]
|
||||
)
|
||||
|
||||
# Where to place sshd.pid
|
||||
piddir=/var/run
|
||||
AC_ARG_WITH(pid-dir,
|
||||
[ --with-pid-dir=PATH Specify location of ssh.pid file],
|
||||
@@ -754,10 +795,4 @@ AC_ARG_WITH(pid-dir,
|
||||
AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
|
||||
AC_SUBST(piddir)
|
||||
|
||||
dnl Check for mail directory (last resort if we cannot get it from headers)
|
||||
if test ! -z "$MAIL" ; then
|
||||
maildir=`dirname $MAIL`
|
||||
AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
|
||||
+1
-1
@@ -122,6 +122,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
|
||||
* Define this to use pipes instead of socketpairs for communicating with the
|
||||
* client program. Socketpairs do not seem to work on all systems.
|
||||
*/
|
||||
#define USE_PIPES 1
|
||||
/* #define USE_PIPES 1 */
|
||||
|
||||
#endif /* INCLUDES_H */
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$Id: login.c,v 1.20 2000/01/26 00:04:48 damien Exp $");
|
||||
RCSID("$Id: login.c,v 1.22 2000/02/02 08:17:41 damien Exp $");
|
||||
|
||||
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
|
||||
# include <utmpx.h>
|
||||
@@ -210,7 +210,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
|
||||
# endif /* HAVE_SYSLEN_IN_UTMPX */
|
||||
# endif
|
||||
#if defined(HAVE_ADDR_IN_UTMPX)
|
||||
if (addr)
|
||||
if (addr) {
|
||||
switch (addr->sa_family) {
|
||||
case AF_INET: {
|
||||
struct sockaddr_in *in = (struct sockaddr_in*)addr;
|
||||
@@ -255,7 +255,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
|
||||
strncpy(ll.ll_line, ttyname + 5, sizeof(ll.ll_line));
|
||||
strncpy(ll.ll_host, host, sizeof(ll.ll_host));
|
||||
#ifdef LASTLOG_IS_DIR
|
||||
snprintf(buf, sizeof(buf), "%s/%s", lastlog, logname);
|
||||
snprintf(buf, sizeof(buf), "%s/%s", lastlog, user);
|
||||
fd = open(buf, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
#else /* LASTLOG_IS_DIR */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Version of OpenSSH
|
||||
%define oversion 1.2.2
|
||||
%define oversion 1.2.2p1
|
||||
|
||||
# Version of ssh-askpass
|
||||
%define aversion 0.99
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Summary: OpenSSH, a free Secure Shell (SSH) implementation
|
||||
Name: openssh
|
||||
Version: 1.2.2
|
||||
Version: 1.2.2p1
|
||||
Release: 1
|
||||
Source0: openssh-%{version}.tar.gz
|
||||
Copyright: BSD
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$Id: pty.c,v 1.11 1999/12/21 00:18:08 damien Exp $");
|
||||
RCSID("$Id: pty.c,v 1.14 2000/03/02 12:56:13 damien Exp $");
|
||||
|
||||
#ifdef HAVE_UTIL_H
|
||||
# include <util.h>
|
||||
@@ -187,10 +187,12 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
|
||||
void
|
||||
pty_release(const char *ttyname)
|
||||
{
|
||||
#ifndef PTY_REMOVED_ON_CLOSE
|
||||
if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0)
|
||||
debug("chown %.100s 0 0 failed: %.100s", ttyname, strerror(errno));
|
||||
error("chown %.100s 0 0 failed: %.100s", ttyname, strerror(errno));
|
||||
if (chmod(ttyname, (mode_t) 0666) < 0)
|
||||
debug("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno));
|
||||
error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno));
|
||||
#endif /* PTY_REMOVED_ON_CLOSE */
|
||||
}
|
||||
|
||||
/* Makes the tty the processes controlling tty and sets it to sane modes. */
|
||||
@@ -259,3 +261,29 @@ pty_change_window_size(int ptyfd, int row, int col,
|
||||
w.ws_ypixel = ypixel;
|
||||
(void) ioctl(ptyfd, TIOCSWINSZ, &w);
|
||||
}
|
||||
|
||||
void
|
||||
pty_setowner(struct passwd *pw, const char *ttyname)
|
||||
{
|
||||
struct group *grp;
|
||||
gid_t gid;
|
||||
mode_t mode;
|
||||
|
||||
/* Determine the group to make the owner of the tty. */
|
||||
grp = getgrnam("tty");
|
||||
if (grp) {
|
||||
gid = grp->gr_gid;
|
||||
mode = S_IRUSR | S_IWUSR | S_IWGRP;
|
||||
} else {
|
||||
gid = pw->pw_gid;
|
||||
mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH;
|
||||
}
|
||||
|
||||
/* Change ownership of the tty. */
|
||||
if (chown(ttyname, pw->pw_uid, gid) < 0)
|
||||
fatal("chown(%.100s, %d, %d) failed: %.100s",
|
||||
ttyname, pw->pw_uid, gid, strerror(errno));
|
||||
if (chmod(ttyname, mode) < 0)
|
||||
fatal("chmod(%.100s, 0%o) failed: %.100s",
|
||||
ttyname, mode, strerror(errno));
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* tty.
|
||||
*/
|
||||
|
||||
/* RCSID("$Id: pty.h,v 1.4 1999/12/07 04:38:32 damien Exp $"); */
|
||||
/* RCSID("$Id: pty.h,v 1.5 2000/03/02 12:30:53 damien Exp $"); */
|
||||
|
||||
#ifndef PTY_H
|
||||
#define PTY_H
|
||||
@@ -43,4 +43,6 @@ void
|
||||
pty_change_window_size(int ptyfd, int row, int col,
|
||||
int xpixel, int ypixel);
|
||||
|
||||
void pty_setowner(struct passwd *pw, const char *ttyname);
|
||||
|
||||
#endif /* PTY_H */
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
**
|
||||
** Random number collection
|
||||
**
|
||||
** Damien Miller <djm@ibs.com.au>
|
||||
**
|
||||
** Copyright 1999 Damien Miller
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person
|
||||
** obtaining a copy of this software and associated documentation
|
||||
** files (the "Software"), to deal in the Software without
|
||||
** restriction, including without limitation the rights to use, copy,
|
||||
** modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
** of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so, subject to the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be
|
||||
** included in all copies or substantial portions of the Software.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||
** KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
** WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
** AND NONINFRINGEMENT. IN NO EVENT SHALL DAMIEN MILLER OR INTERNET
|
||||
** BUSINESS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
** OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
**
|
||||
** Except as contained in this notice, the name of Internet Business
|
||||
** Solutions shall not be used in advertising or otherwise to promote
|
||||
** the sale, use or other dealings in this Software without prior
|
||||
** written authorization from Internet Business Solutions.
|
||||
**
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#include "ssh.h"
|
||||
#include "xmalloc.h"
|
||||
#include "random.h"
|
||||
|
||||
#ifndef offsetof
|
||||
# define offsetof(type, member) ((size_t) &((type *)0)->member)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EGD
|
||||
|
||||
/* Collect entropy from EGD */
|
||||
void get_random_bytes(unsigned char *buf, int len)
|
||||
{
|
||||
static int random_pool;
|
||||
int c;
|
||||
char egd_message[2] = { 0x02, 0x00 };
|
||||
struct sockaddr_un addr;
|
||||
int addr_len;
|
||||
|
||||
memset(&addr, '\0', sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
|
||||
/* FIXME: compile time check? */
|
||||
if (sizeof(RANDOM_POOL) > sizeof(addr.sun_path))
|
||||
fatal("Random pool path is too long");
|
||||
|
||||
strcpy(addr.sun_path, RANDOM_POOL);
|
||||
|
||||
addr_len = offsetof(struct sockaddr_un, sun_path) + sizeof(RANDOM_POOL);
|
||||
|
||||
random_pool = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
if (random_pool == -1)
|
||||
fatal("Couldn't create AF_UNIX socket: %s", strerror(errno));
|
||||
|
||||
if (connect(random_pool, (struct sockaddr*)&addr, addr_len) == -1)
|
||||
fatal("Couldn't connect to EGD socket \"%s\": %s", addr.sun_path, strerror(errno));
|
||||
|
||||
if (len > 255)
|
||||
fatal("Too many bytes to read from EGD");
|
||||
|
||||
/* Send blocking read request to EGD */
|
||||
egd_message[1] = len;
|
||||
|
||||
c = atomicio(write, random_pool, egd_message, sizeof(egd_message));
|
||||
if (c == -1)
|
||||
fatal("Couldn't write to EGD socket \"%s\": %s", RANDOM_POOL, strerror(errno));
|
||||
|
||||
c = atomicio(read, random_pool, buf, len);
|
||||
if (c <= 0)
|
||||
fatal("Couldn't read from random pool \"%s\": %s", RANDOM_POOL, strerror(errno));
|
||||
|
||||
close(random_pool);
|
||||
}
|
||||
#else /* HAVE_EGD */
|
||||
|
||||
/* Collect entropy from /dev/urandom or pipe */
|
||||
void get_random_bytes(unsigned char *buf, int len)
|
||||
{
|
||||
static int random_pool;
|
||||
int c;
|
||||
|
||||
random_pool = open(RANDOM_POOL, O_RDONLY);
|
||||
if (random_pool == -1)
|
||||
fatal("Couldn't open random pool \"%s\": %s", RANDOM_POOL, strerror(errno));
|
||||
|
||||
c = atomicio(read, random_pool, buf, len);
|
||||
if (c <= 0)
|
||||
fatal("Couldn't read from random pool \"%s\": %s", RANDOM_POOL, strerror(errno));
|
||||
|
||||
close(random_pool);
|
||||
}
|
||||
|
||||
#endif /* HAVE_EGD */
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
**
|
||||
** Random number collection
|
||||
**
|
||||
** Damien Miller <djm@ibs.com.au>
|
||||
**
|
||||
** Copyright 1999 Damien Miller
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person
|
||||
** obtaining a copy of this software and associated documentation
|
||||
** files (the "Software"), to deal in the Software without
|
||||
** restriction, including without limitation the rights to use, copy,
|
||||
** modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
** of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so, subject to the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be
|
||||
** included in all copies or substantial portions of the Software.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||
** KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
** WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
** AND NONINFRINGEMENT. IN NO EVENT SHALL DAMIEN MILLER OR INTERNET
|
||||
** BUSINESS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
** OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
**
|
||||
** Except as contained in this notice, the name of Internet Business
|
||||
** Solutions shall not be used in advertising or otherwise to promote
|
||||
** the sale, use or other dealings in this Software without prior
|
||||
** written authorization from Internet Business Solutions.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _RANDOM_H
|
||||
#define _RANDOM_H
|
||||
|
||||
void get_random_bytes(unsigned char *buf, int len);
|
||||
|
||||
#endif /* _RANDOM_H */
|
||||
@@ -35,19 +35,34 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$Id: rsa.c,v 1.6 1999/12/17 03:02:47 damien Exp $");
|
||||
RCSID("$Id: rsa.c,v 1.9 2000/03/05 06:14:38 damien Exp $");
|
||||
|
||||
#include "rsa.h"
|
||||
#include "ssh.h"
|
||||
#include "xmalloc.h"
|
||||
#include "random.h"
|
||||
|
||||
int rsa_verbose = 1;
|
||||
|
||||
/*
|
||||
* Seed OpenSSL's random number generator
|
||||
*/
|
||||
void
|
||||
seed_rng()
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
get_random_bytes(buf, sizeof(buf));
|
||||
RAND_seed(buf, sizeof(buf));
|
||||
memset(buf, 0, sizeof(buf));
|
||||
}
|
||||
|
||||
int
|
||||
rsa_alive()
|
||||
{
|
||||
RSA *key;
|
||||
|
||||
seed_rng();
|
||||
key = RSA_generate_key(32, 3, NULL, NULL);
|
||||
if (key == NULL)
|
||||
return (0);
|
||||
@@ -64,9 +79,9 @@ keygen_progress(int p, int n, void *arg)
|
||||
const char progress_chars[] = ".o+O?";
|
||||
|
||||
if ((p < 0) || (p > (sizeof(progress_chars) - 2)))
|
||||
p = 4;
|
||||
p = sizeof(progress_chars) - 2;
|
||||
|
||||
printf("%c", progress_chars[p]);
|
||||
putchar(progress_chars[p]);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
@@ -81,6 +96,8 @@ rsa_generate_key(RSA *prv, RSA *pub, unsigned int bits)
|
||||
{
|
||||
RSA *key;
|
||||
|
||||
seed_rng();
|
||||
|
||||
if (rsa_verbose) {
|
||||
printf("Generating RSA keys: ");
|
||||
fflush(stdout);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* RCSID("$Id: rsa.h,v 1.5 1999/11/25 00:54:59 damien Exp $"); */
|
||||
/* RCSID("$Id: rsa.h,v 1.6 2000/01/29 09:40:22 damien Exp $"); */
|
||||
|
||||
#ifndef RSA_H
|
||||
#define RSA_H
|
||||
@@ -23,11 +23,13 @@
|
||||
#ifdef HAVE_OPENSSL
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/rand.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#include <ssl/bn.h>
|
||||
#include <ssl/rsa.h>
|
||||
#include <ssl/rand.h>
|
||||
#endif
|
||||
|
||||
/* Calls SSL RSA_generate_key, only copies to prv and pub */
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
.\"
|
||||
.\" Created: Sat Apr 22 21:55:14 1995 ylo
|
||||
.\"
|
||||
.\" $Id: ssh.1,v 1.16 2000/01/22 08:57:40 damien Exp $
|
||||
.\" $Id: ssh.1,v 1.17 2000/03/03 11:48:49 damien Exp $
|
||||
.\"
|
||||
.Dd September 25, 1999
|
||||
.Dt SSH 1
|
||||
@@ -626,7 +626,7 @@ forward privileged ports.
|
||||
Gives the verbosity level that is used when logging messages from
|
||||
.Nm ssh .
|
||||
The possible values are:
|
||||
QUIET, FATAL, ERROR, INFO, CHAT and DEBUG.
|
||||
QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
|
||||
The default is INFO.
|
||||
.It Cm NumberOfPasswordPrompts
|
||||
Specifies the number of password prompts before giving up. The
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$Id: ssh.c,v 1.18 2000/01/22 23:32:04 damien Exp $");
|
||||
RCSID("$Id: ssh.c,v 1.20 2000/03/02 12:09:21 damien Exp $");
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "ssh.h"
|
||||
@@ -217,10 +217,6 @@ main(int ac, char **av)
|
||||
/* Save our own name. */
|
||||
av0 = av[0];
|
||||
|
||||
#ifdef SOCKS
|
||||
SOCKSinit(av0);
|
||||
#endif /* SOCKS */
|
||||
|
||||
/* Initialize option structure to indicate that no values have been set. */
|
||||
initialize_options(&options);
|
||||
|
||||
@@ -329,11 +325,7 @@ main(int ac, char **av)
|
||||
case 'V':
|
||||
fprintf(stderr, "SSH Version %s, protocol version %d.%d.\n",
|
||||
SSH_VERSION, PROTOCOL_MAJOR, PROTOCOL_MINOR);
|
||||
#ifndef RSAREF
|
||||
fprintf(stderr, "Compiled with SSL.\n");
|
||||
#else
|
||||
fprintf(stderr, "Compiled with SSL (RSAref version).\n");
|
||||
#endif
|
||||
if (opt == 'V')
|
||||
exit(0);
|
||||
debug_flag = 1;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* RCSID("$Id: ssh.h,v 1.25 2000/01/22 23:32:04 damien Exp $"); */
|
||||
/* RCSID("$Id: ssh.h,v 1.26 2000/02/07 02:20:26 damien Exp $"); */
|
||||
|
||||
#ifndef SSH_H
|
||||
#define SSH_H
|
||||
@@ -752,97 +752,4 @@ extern int IPv4or6;
|
||||
#include "auth-pam.h"
|
||||
#endif /* USE_PAM */
|
||||
|
||||
#if defined(HAVE_DANTE) || defined(HAVE_SOCKS4)
|
||||
/*
|
||||
* The following defines map the normal socket operations to SOCKSified
|
||||
* versions coming from the Dante SOCKS package.
|
||||
*/
|
||||
#define accept Raccept
|
||||
#define bind Rbind
|
||||
#define bindresvport Rbindresvport
|
||||
#define connect Rconnect
|
||||
#define gethostbyname Rgethostbyname
|
||||
#define gethostbyname2 Rgethostbyname2
|
||||
#define getpeername Rgetpeername
|
||||
#define getsockname Rgetsockname
|
||||
#define read Rread
|
||||
#define readv Rreadv
|
||||
#define recv Rrecv
|
||||
#define recvmsg Rrecvmsg
|
||||
#define recvfrom Rrecvfrom
|
||||
#define rresvport Rrresvport
|
||||
#define send Rsend
|
||||
#define sendmsg Rsendmsg
|
||||
#define sendto Rsendto
|
||||
#define write Rwrite
|
||||
#define writev Rwritev
|
||||
int Raccept (int, struct sockaddr *, socklen_t *);
|
||||
int Rbind (int, const struct sockaddr *, socklen_t);
|
||||
int Rbindresvport(int , struct sockaddr_in *);
|
||||
int Rconnect (int, const struct sockaddr *, socklen_t);
|
||||
struct hostent *Rgethostbyname(const char *);
|
||||
struct hostent *Rgethostbyname2(const char *, int);
|
||||
int Rgetpeername (int, struct sockaddr *, socklen_t *);
|
||||
int Rgetsockname (int, struct sockaddr *, socklen_t *);
|
||||
ssize_t Rread(int , void *, size_t );
|
||||
ssize_t Rreadv(int d, const struct iovec *iov, int iovcnt);
|
||||
ssize_t Rrecv (int, void *, size_t, int);
|
||||
ssize_t Rrecvfrom (int, void *, size_t, int, struct sockaddr *,
|
||||
socklen_t *);
|
||||
ssize_t Rsend (int, const void *, size_t, int);
|
||||
ssize_t Rsendmsg (int, const struct msghdr *, int);
|
||||
ssize_t Rsendto (int, const void *,
|
||||
size_t, int, const struct sockaddr *, socklen_t);
|
||||
ssize_t Rwrite(int , const void *, size_t );
|
||||
ssize_t Rwritev(int , const struct iovec *, int );
|
||||
#endif /* HAVE_DANTE || HAVE_SOCKS4 */
|
||||
|
||||
#if defined(HAVE_SOCKS5)
|
||||
/*
|
||||
* The following defines map the normal socket operations to SOCKSified
|
||||
* versions coming from the SOCKS package.
|
||||
*/
|
||||
#define accept SOCKSaccept
|
||||
#define bind SOCKSbind
|
||||
#define bindresvport SOCKSbindresvport
|
||||
#define connect SOCKSconnect
|
||||
#define gethostbyname SOCKSgethostbyname
|
||||
#define gethostbyname2 SOCKSgethostbyname2
|
||||
#define getpeername SOCKSgetpeername
|
||||
#define getsockname SOCKSgetsockname
|
||||
#define read SOCKSread
|
||||
#define readv SOCKSreadv
|
||||
#define recv SOCKSrecv
|
||||
#define recvmsg SOCKSrecvmsg
|
||||
#define recvfrom SOCKSrecvfrom
|
||||
#define rresvport SOCKSrresvport
|
||||
#define send SOCKSsend
|
||||
#define sendmsg SOCKSsendmsg
|
||||
#define sendto SOCKSsendto
|
||||
#define write SOCKSwrite
|
||||
#define writev SOCKSwritev
|
||||
int SOCKSaccept (int, struct sockaddr *, socklen_t *);
|
||||
int SOCKSbind (int, const struct sockaddr *, socklen_t);
|
||||
int SOCKSbindresvport(int , struct sockaddr_in *);
|
||||
int SOCKSconnect (int, const struct sockaddr *, socklen_t);
|
||||
struct hostent *SOCKSgethostbyname(const char *);
|
||||
struct hostent *SOCKSgethostbyname2(const char *, int);
|
||||
int SOCKSgetpeername (int, struct sockaddr *, socklen_t *);
|
||||
int SOCKSgetsockname (int, struct sockaddr *, socklen_t *);
|
||||
ssize_t SOCKSread(int , void *, size_t );
|
||||
ssize_t SOCKSreadv(int d, const struct iovec *iov, int iovcnt);
|
||||
ssize_t SOCKSrecv (int, void *, size_t, int);
|
||||
ssize_t SOCKSrecvfrom (int, void *, size_t, int, struct sockaddr *,
|
||||
socklen_t *);
|
||||
ssize_t SOCKSsend (int, const void *, size_t, int);
|
||||
ssize_t SOCKSsendmsg (int, const struct msghdr *, int);
|
||||
ssize_t SOCKSsendto (int, const void *,
|
||||
size_t, int, const struct sockaddr *, socklen_t);
|
||||
ssize_t SOCKSwrite(int , const void *, size_t );
|
||||
ssize_t SOCKSwritev(int , const struct iovec *, int );
|
||||
#endif /* SOCKS5 */
|
||||
|
||||
#if defined(DANTE) || defined(SOCKS4) || defined(SOCKS5)
|
||||
#define SOCKS
|
||||
#endif /* defined(DANTE) || defined(SOCKS4) || defined(SOCKS5) */
|
||||
#endif /* SSH_H */
|
||||
|
||||
@@ -379,9 +379,6 @@ main(int ac, char **av)
|
||||
case '?':
|
||||
default:
|
||||
fprintf(stderr, "sshd version %s\n", SSH_VERSION);
|
||||
#ifdef RSAREF
|
||||
fprintf(stderr, "Compiled with RSAref.\n");
|
||||
#endif
|
||||
fprintf(stderr, "Usage: %s [options]\n", av0);
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -f file Configuration file (default %s)\n", SERVER_CONFIG_FILE);
|
||||
@@ -561,7 +558,8 @@ main(int ac, char **av)
|
||||
debug("Bind to port %s on %s.", strport, ntop);
|
||||
|
||||
/* Bind the socket to the desired port. */
|
||||
if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) {
|
||||
if ((bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) &&
|
||||
(!ai->ai_next)) {
|
||||
error("Bind to port %s on %s failed: %.200s.",
|
||||
strport, ntop, strerror(errno));
|
||||
close(listen_sock);
|
||||
@@ -1524,8 +1522,10 @@ do_authloop(struct passwd * pw)
|
||||
return;
|
||||
}
|
||||
|
||||
if (client_user != NULL)
|
||||
if (client_user != NULL) {
|
||||
xfree(client_user);
|
||||
client_user = NULL;
|
||||
}
|
||||
|
||||
if (attempt > AUTH_FAIL_MAX)
|
||||
packet_disconnect(AUTH_FAIL_MSG, pw->pw_name);
|
||||
@@ -1623,6 +1623,37 @@ xauthfile_cleanup_proc(void *ignore)
|
||||
}
|
||||
}
|
||||
|
||||
struct pty_cleanup_context {
|
||||
const char *ttyname;
|
||||
int pid;
|
||||
};
|
||||
|
||||
/*
|
||||
* Function to perform cleanup if we get aborted abnormally (e.g., due to a
|
||||
* dropped connection).
|
||||
*/
|
||||
void
|
||||
pty_cleanup_proc(void *context)
|
||||
{
|
||||
struct pty_cleanup_context *cu = context;
|
||||
|
||||
debug("pty_cleanup_proc called");
|
||||
|
||||
/* Record that the user has logged out. */
|
||||
record_logout(cu->pid, cu->ttyname);
|
||||
|
||||
/* Release the pseudo-tty. */
|
||||
pty_release(cu->ttyname);
|
||||
}
|
||||
|
||||
/* simple cleanup: chown tty slave back to root */
|
||||
static void
|
||||
pty_release_proc(void *tty)
|
||||
{
|
||||
char *ttyname = tty;
|
||||
pty_release(ttyname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepares for an interactive session. This is called after the user has
|
||||
* been successfully authenticated. During this message exchange, pseudo
|
||||
@@ -1637,11 +1668,7 @@ do_authenticated(struct passwd * pw)
|
||||
int have_pty = 0, ptyfd = -1, ttyfd = -1, xauthfd = -1;
|
||||
int row, col, xpixel, ypixel, screen;
|
||||
char ttyname[64];
|
||||
char *command, *term = NULL, *display = NULL, *proto = NULL,
|
||||
*data = NULL;
|
||||
struct group *grp;
|
||||
gid_t tty_gid;
|
||||
mode_t tty_mode;
|
||||
char *command, *term = NULL, *display = NULL, *proto = NULL, *data = NULL;
|
||||
int n_bytes;
|
||||
|
||||
/*
|
||||
@@ -1699,33 +1726,20 @@ do_authenticated(struct passwd * pw)
|
||||
error("Failed to allocate pty.");
|
||||
goto fail;
|
||||
}
|
||||
/* Determine the group to make the owner of the tty. */
|
||||
grp = getgrnam("tty");
|
||||
if (grp) {
|
||||
tty_gid = grp->gr_gid;
|
||||
tty_mode = S_IRUSR | S_IWUSR | S_IWGRP;
|
||||
} else {
|
||||
tty_gid = pw->pw_gid;
|
||||
tty_mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH;
|
||||
}
|
||||
|
||||
/* Change ownership of the tty. */
|
||||
if (chown(ttyname, pw->pw_uid, tty_gid) < 0)
|
||||
fatal("chown(%.100s, %d, %d) failed: %.100s",
|
||||
ttyname, pw->pw_uid, tty_gid, strerror(errno));
|
||||
if (chmod(ttyname, tty_mode) < 0)
|
||||
fatal("chmod(%.100s, 0%o) failed: %.100s",
|
||||
ttyname, tty_mode, strerror(errno));
|
||||
fatal_add_cleanup(pty_release_proc, (void *)ttyname);
|
||||
pty_setowner(pw, ttyname);
|
||||
|
||||
/* Get TERM from the packet. Note that the value may be of arbitrary length. */
|
||||
term = packet_get_string(&dlen);
|
||||
packet_integrity_check(dlen, strlen(term), type);
|
||||
/* packet_integrity_check(plen, 4 + dlen + 4*4 + n_bytes, type); */
|
||||
|
||||
/* Remaining bytes */
|
||||
n_bytes = plen - (4 + dlen + 4 * 4);
|
||||
|
||||
if (strcmp(term, "") == 0)
|
||||
if (strcmp(term, "") == 0) {
|
||||
xfree(term);
|
||||
term = NULL;
|
||||
}
|
||||
|
||||
/* Get window size from the packet. */
|
||||
row = packet_get_int();
|
||||
@@ -1999,29 +2013,6 @@ do_exec_no_pty(const char *command, struct passwd * pw,
|
||||
#endif /* USE_PIPES */
|
||||
}
|
||||
|
||||
struct pty_cleanup_context {
|
||||
const char *ttyname;
|
||||
int pid;
|
||||
};
|
||||
|
||||
/*
|
||||
* Function to perform cleanup if we get aborted abnormally (e.g., due to a
|
||||
* dropped connection).
|
||||
*/
|
||||
void
|
||||
pty_cleanup_proc(void *context)
|
||||
{
|
||||
struct pty_cleanup_context *cu = context;
|
||||
|
||||
debug("pty_cleanup_proc called");
|
||||
|
||||
/* Record that the user has logged out. */
|
||||
record_logout(cu->pid, cu->ttyname);
|
||||
|
||||
/* Release the pseudo-tty. */
|
||||
pty_release(cu->ttyname);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is called to fork and execute a command when we have a tty. This
|
||||
* will call do_child from the child, and server_loop from the parent after
|
||||
@@ -2167,6 +2158,15 @@ do_exec_pty(const char *command, int ptyfd, int ttyfd,
|
||||
/* Parent. Close the slave side of the pseudo tty. */
|
||||
close(ttyfd);
|
||||
|
||||
/*
|
||||
* Add a cleanup function to clear the utmp entry and record logout
|
||||
* time in case we call fatal() (e.g., the connection gets closed).
|
||||
*/
|
||||
cleanup_context.pid = pid;
|
||||
cleanup_context.ttyname = ttyname;
|
||||
fatal_add_cleanup(pty_cleanup_proc, (void *) &cleanup_context);
|
||||
fatal_remove_cleanup(pty_release_proc, (void *) ttyname);
|
||||
|
||||
/*
|
||||
* Create another descriptor of the pty master side for use as the
|
||||
* standard input. We could use the original descriptor, but this
|
||||
@@ -2176,14 +2176,6 @@ do_exec_pty(const char *command, int ptyfd, int ttyfd,
|
||||
if (fdout < 0)
|
||||
packet_disconnect("dup failed: %.100s", strerror(errno));
|
||||
|
||||
/*
|
||||
* Add a cleanup function to clear the utmp entry and record logout
|
||||
* time in case we call fatal() (e.g., the connection gets closed).
|
||||
*/
|
||||
cleanup_context.pid = pid;
|
||||
cleanup_context.ttyname = ttyname;
|
||||
fatal_add_cleanup(pty_cleanup_proc, (void *) &cleanup_context);
|
||||
|
||||
/* Enter interactive session. */
|
||||
server_loop(pid, ptyfd, fdout, -1);
|
||||
/* server_loop has not closed ptyfd and fdout. */
|
||||
|
||||
Reference in New Issue
Block a user