summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--acconfig.h12
-rw-r--r--configure.in81
-rw-r--r--helper.c40
-rw-r--r--includes.h12
-rw-r--r--login.c16
-rw-r--r--mktemp.c2
-rw-r--r--rsa.h10
-rw-r--r--ssh.h6
9 files changed, 128 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index 047c5b70b..f95a7ec05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
119991111
2 - Added (untested) Entropy Gathering Daemon (EGD) support
3
119991110 419991110
2 - Merged several minor fixed: 5 - Merged several minor fixed:
3 - ssh-agent commandline parsing 6 - ssh-agent commandline parsing
4 - RPM spec file now installs ssh setuid root 7 - RPM spec file now installs ssh setuid root
5 - Makefile creates libdir 8 - Makefile creates libdir
9 - Merged beginnings of Solaris compability from Marc G. Fournier
10 <marc.fournier@acadiau.ca>
6 11
719991109 1219991109
8 - Autodetection of SSL/Crypto library location via autoconf 13 - Autodetection of SSL/Crypto library location via autoconf
diff --git a/acconfig.h b/acconfig.h
index c859c253a..063b91711 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -3,8 +3,20 @@
3/* SSL directory. */ 3/* SSL directory. */
4#undef ssldir 4#undef ssldir
5 5
6/* Random number pool */
7#undef RANDOM_POOL
8
9/* Are we using the Entropy gathering daemon */
10#undef HAVE_EGD
11
6/* Define if your ssl headers are included with #include <ssl/header.h> */ 12/* Define if your ssl headers are included with #include <ssl/header.h> */
7#undef HAVE_SSL 13#undef HAVE_SSL
8 14
9/* Define if your ssl headers are included with #include <openssl/header.h> */ 15/* Define if your ssl headers are included with #include <openssl/header.h> */
10#undef HAVE_OPENSSL 16#undef HAVE_OPENSSL
17
18/* Define is utmp.h has a ut_host field */
19#undef HAVE_HOST_IN_UTMP
20
21/* Define is libutil has login() function */
22#undef HAVE_LIBUTIL_LOGIN
diff --git a/configure.in b/configure.in
index fc59cbb8b..b16c12919 100644
--- a/configure.in
+++ b/configure.in
@@ -1,44 +1,25 @@
1dnl Process this file with autoconf to produce a configure script. 1AC_INIT(ssh.c)
2
3AC_INIT(auth-krb4.c)
4 2
5AC_CONFIG_HEADER(config.h) 3AC_CONFIG_HEADER(config.h)
6 4
7dnl Checks for programs. 5dnl Checks for programs.
8AC_PROG_CC 6AC_PROG_CC
7AC_PROG_CPP
9AC_PROG_RANLIB 8AC_PROG_RANLIB
10AC_CHECK_PROG(AR, ar, ar) 9AC_CHECK_PROG(AR, ar, ar)
11if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi 10if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi
12 11
13dnl Checks for libraries.
14dnl Replace `main' with a function in -lcrypto:
15AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***]))
16dnl Replace `main' with a function in -lutil:
17AC_CHECK_LIB(util, logout, ,AC_MSG_ERROR([*** -lutil missing - this is part of libc. ***]))
18dnl Replace `main' with a function in -lz:
19AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
20dnl check for nsl
21AC_CHECK_LIB(nsl, yp_match, , )
22dnl check for dl
23AC_CHECK_LIB(dl, dlopen, , )
24dnl check for pam
25AC_CHECK_LIB(pam, pam_authenticate, , )
26
27dnl Check for OpenSSL/SSLeay directories. 12dnl Check for OpenSSL/SSLeay directories.
28AC_MSG_CHECKING([for OpenSSL/SSLeay directory]) 13AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
29for dir in /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg ; do 14for ssldir in /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local $prefix /usr/pkg ; do
30 ssldir="$dir" 15 if test -f "$ssldir/include/openssl/crypto.h"; then
31 if test -f "$dir/include/openssl/crypto.h"; then
32 AC_DEFINE(HAVE_OPENSSL) 16 AC_DEFINE(HAVE_OPENSSL)
33 break 17 break
34 fi 18 fi
35 if test -f "$dir/include/ssl/crypto.h"; then 19 if test -f "$ssldir/include/ssl/crypto.h"; then
36 AC_DEFINE(HAVE_SSL) 20 AC_DEFINE(HAVE_SSL)
37 break 21 break
38 fi 22 fi
39 if test -f "$dir/include/crypto.h"; then
40 break
41 fi
42done 23done
43AC_MSG_RESULT($ssldir) 24AC_MSG_RESULT($ssldir)
44AC_SUBST(ssldir) 25AC_SUBST(ssldir)
@@ -57,17 +38,67 @@ AC_TRY_LINK([], [],
57[AC_MSG_RESULT(yes); ], 38[AC_MSG_RESULT(yes); ],
58[AC_MSG_RESULT(no)]; LIBS="$saved_LIBS") 39[AC_MSG_RESULT(no)]; LIBS="$saved_LIBS")
59 40
41dnl Checks for libraries.
42AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***]))
43AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
44AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
45AC_CHECK_LIB(nsl, yp_match, , )
46AC_CHECK_LIB(socket, main, , )
47
48dnl libdl is needed by PAM on Redhat systems
49AC_CHECK_LIB(dl, dlopen, , )
50AC_CHECK_LIB(pam, pam_authenticate, , )
51
60dnl Checks for header files. 52dnl Checks for header files.
61AC_CHECK_HEADERS(pty.h) 53AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h)
62 54
63dnl Checks for library functions. 55dnl Checks for library functions.
64AC_PROG_GCC_TRADITIONAL 56AC_PROG_GCC_TRADITIONAL
65AC_CHECK_FUNCS(openpty strlcpy mkdtemp arc4random setproctitle) 57AC_CHECK_FUNCS(openpty strlcpy mkdtemp arc4random setproctitle)
66 58
59dnl Check for ut_host field in utmp
60AC_MSG_CHECKING([whether utmp.h has ut_host field])
61AC_EGREP_HEADER(ut_host, utmp.h,
62 [AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ],
63 [AC_MSG_RESULT(no)]
64)
65
67dnl Check whether user wants GNOME ssh-askpass 66dnl Check whether user wants GNOME ssh-askpass
68AC_ARG_WITH(gnome-askpass, 67AC_ARG_WITH(gnome-askpass,
69 [ --with-gnome-askpass Build and use the GNOME passphrase requester], 68 [ --with-gnome-askpass Build and use the GNOME passphrase requester],
70 [GNOME_ASKPASS="gnome-ssh-askpass"]) 69 [GNOME_ASKPASS="gnome-ssh-askpass"])
71AC_SUBST(GNOME_ASKPASS) 70AC_SUBST(GNOME_ASKPASS)
72 71
72dnl Check for user-specified random device
73AC_ARG_WITH(random,
74 [ --with-random=FILE read randomness from FILE (default /dev/urandom)],
75 [
76 RANDOM_POOL="$withval";
77 AC_DEFINE(RANDOM_POOL, "$RANDOM_POOL")
78 ],
79 [
80 dnl Check for random device
81 AC_CHECK_FILE("/dev/urandom",
82 [
83 RANDOM_POOL="/dev/urandom";
84 AC_DEFINE(RANDOM_POOL, "$RANDOM_POOL")
85 ]
86 )
87 ]
88)
89
90dnl Check for EGD pool file
91AC_ARG_WITH(egd-pool,
92 [ --with-egd-pool=FILE read randomness from EGD pool FILE],
93 [
94 RANDOM_POOL="$withval";
95 AC_DEFINE(HAVE_EGD)
96 AC_DEFINE(RANDOM_POOL, "$RANDOM_POOL")
97 ]
98)
99
100if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then
101 AC_MSG_ERROR([No random device found, and no EGD random pool specified])
102fi
103
73AC_OUTPUT(Makefile) 104AC_OUTPUT(Makefile)
diff --git a/helper.c b/helper.c
index 6959535d2..6d77759de 100644
--- a/helper.c
+++ b/helper.c
@@ -45,6 +45,7 @@
45 45
46#include "rc4.h" 46#include "rc4.h"
47#include "xmalloc.h" 47#include "xmalloc.h"
48#include "ssh.h"
48#include "config.h" 49#include "config.h"
49#include "helper.h" 50#include "helper.h"
50 51
@@ -79,28 +80,35 @@ void arc4random_stir(void)
79 80
80void get_random_bytes(unsigned char *buf, int len) 81void get_random_bytes(unsigned char *buf, int len)
81{ 82{
82 int urandom; 83 int random_pool;
83 int c; 84 int c;
85#ifdef HAVE_EGD
86 char egd_message[2] = { 0x02, 0x00 };
87#endif /* HAVE_EGD */
84 88
85 urandom = open("/dev/urandom", O_RDONLY); 89 random_pool = open(RANDOM_POOL, O_RDONLY);
86 if (urandom == -1) 90 if (random_pool == -1)
87 { 91 fatal("Couldn't open random pool \"%s\": %s", RANDOM_POOL, strerror(errno));
88 fprintf(stderr, "Couldn't open /dev/urandom: %s", strerror(errno));
89 exit(1);
90 }
91 92
92 c = read(urandom, buf, len); 93#ifdef HAVE_EGD
94 if (len > 255)
95 fatal("Too many bytes to read from EGD");
96
97 /* Send blocking read request to EGD */
98 egd_message[1] = len;
99 c = write(random_pool, egd_message, sizeof(egd_message));
100 if (c == -1)
101 fatal("Couldn't write to EGD socket \"%s\": %s", RANDOM_POOL, strerror(errno));
102#endif /* HAVE_EGD */
103
104 c = read(random_pool, buf, len);
93 if (c == -1) 105 if (c == -1)
94 { 106 fatal("Couldn't read from random pool \"%s\": %s", RANDOM_POOL, strerror(errno));
95 fprintf(stderr, "Couldn't read from /dev/urandom: %s", strerror(errno));
96 exit(1);
97 }
98 107
99 if (c != len) 108 if (c != len)
100 { 109 fatal("Short read from random pool \"%s\"", RANDOM_POOL);
101 fprintf(stderr, "Short read from /dev/urandom"); 110
102 exit(1); 111 close(random_pool);
103 }
104} 112}
105#endif /* !HAVE_ARC4RANDOM */ 113#endif /* !HAVE_ARC4RANDOM */
106 114
diff --git a/includes.h b/includes.h
index a1a6da6bd..198e72979 100644
--- a/includes.h
+++ b/includes.h
@@ -37,7 +37,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
37#include <arpa/inet.h> 37#include <arpa/inet.h>
38#include <netdb.h> 38#include <netdb.h>
39 39
40#include <endian.h>
41#include <stdio.h> 40#include <stdio.h>
42#include <ctype.h> 41#include <ctype.h>
43#include <errno.h> 42#include <errno.h>
@@ -52,13 +51,18 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
52#include <grp.h> 51#include <grp.h>
53#include <unistd.h> 52#include <unistd.h>
54#include <time.h> 53#include <time.h>
55#include <paths.h>
56#include <dirent.h> 54#include <dirent.h>
57 55
58#include "version.h"
59
60#include "config.h" 56#include "config.h"
61 57
58#ifdef HAVE_PATHS_H
59# include <paths.h>
60#endif
61#ifdef HAVE_ENDIAN_H
62# include <endian.h>
63#endif
64
65#include "version.h"
62#include "helper.h" 66#include "helper.h"
63#include "mktemp.h" 67#include "mktemp.h"
64#include "strlcpy.h" 68#include "strlcpy.h"
diff --git a/login.c b/login.c
index 0c1e61b77..8791ec55a 100644
--- a/login.c
+++ b/login.c
@@ -18,9 +18,14 @@ on a tty.
18*/ 18*/
19 19
20#include "includes.h" 20#include "includes.h"
21RCSID("$Id: login.c,v 1.1 1999/10/27 03:42:44 damien Exp $"); 21RCSID("$Id: login.c,v 1.2 1999/11/10 23:40:23 damien Exp $");
22 22
23#include <utmp.h> 23#include <utmp.h>
24
25#ifdef HAVE_LASTLOG_H
26# include <lastlog.h>
27#endif
28
24#include "ssh.h" 29#include "ssh.h"
25 30
26/* Returns the time when the user last logged in. Returns 0 if the 31/* Returns the time when the user last logged in. Returns 0 if the
@@ -76,7 +81,9 @@ void record_login(int pid, const char *ttyname, const char *user, uid_t uid,
76 strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line)); 81 strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line));
77 u.ut_time = time(NULL); 82 u.ut_time = time(NULL);
78 strncpy(u.ut_name, user, sizeof(u.ut_name)); 83 strncpy(u.ut_name, user, sizeof(u.ut_name));
84#ifdef HAVE_HOST_IN_UTMP
79 strncpy(u.ut_host, host, sizeof(u.ut_host)); 85 strncpy(u.ut_host, host, sizeof(u.ut_host));
86#endif
80 87
81 /* Figure out the file names. */ 88 /* Figure out the file names. */
82 utmp = _PATH_UTMP; 89 utmp = _PATH_UTMP;
@@ -108,11 +115,14 @@ void record_login(int pid, const char *ttyname, const char *user, uid_t uid,
108 } 115 }
109} 116}
110 117
111/* Records that the user has logged out. */
112
113void record_logout(int pid, const char *ttyname) 118void record_logout(int pid, const char *ttyname)
114{ 119{
120#ifdef HAVE_LIBUTIL_LOGIN
115 const char *line = ttyname + 5; /* /dev/ttyq8 -> ttyq8 */ 121 const char *line = ttyname + 5; /* /dev/ttyq8 -> ttyq8 */
116 if (logout(line)) 122 if (logout(line))
117 logwtmp(line, "", ""); 123 logwtmp(line, "", "");
124#else /* HAVE_LIBUTIL_LOGIN */
125 record_login(pid, ttyname, "", -1, "", NULL);
126#endif /* HAVE_LIBUTIL_LOGIN */
118} 127}
128
diff --git a/mktemp.c b/mktemp.c
index de11a6b53..be03ac909 100644
--- a/mktemp.c
+++ b/mktemp.c
@@ -52,7 +52,7 @@ static char rcsid[] = "$OpenBSD: mktemp.c,v 1.13 1998/06/30 23:03:13 deraadt Exp
52 52
53#ifndef HAVE_MKDTEMP 53#ifndef HAVE_MKDTEMP
54 54
55static int _gettemp __P((char *, int *, int, int)); 55static int _gettemp(char *, int *, int, int);
56 56
57int 57int
58mkstemps(path, slen) 58mkstemps(path, slen)
diff --git a/rsa.h b/rsa.h
index 98a183f57..c19b5a965 100644
--- a/rsa.h
+++ b/rsa.h
@@ -13,7 +13,7 @@ RSA key generation, encryption and decryption.
13 13
14*/ 14*/
15 15
16/* RCSID("$Id: rsa.h,v 1.2 1999/10/28 03:25:17 damien Exp $"); */ 16/* RCSID("$Id: rsa.h,v 1.3 1999/11/10 23:40:23 damien Exp $"); */
17#include "config.h" 17#include "config.h"
18 18
19#ifndef RSA_H 19#ifndef RSA_H
@@ -34,11 +34,11 @@ void rsa_generate_key(RSA *prv, RSA *pub, unsigned int bits);
34 34
35/* Indicates whether the rsa module is permitted to show messages on 35/* Indicates whether the rsa module is permitted to show messages on
36 the terminal. */ 36 the terminal. */
37void rsa_set_verbose __P((int verbose)); 37void rsa_set_verbose(int verbose);
38 38
39int rsa_alive __P((void)); 39int rsa_alive(void);
40 40
41void rsa_public_encrypt __P((BIGNUM *out, BIGNUM *in, RSA *prv)); 41void rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *prv);
42void rsa_private_decrypt __P((BIGNUM *out, BIGNUM *in, RSA *prv)); 42void rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *prv);
43 43
44#endif /* RSA_H */ 44#endif /* RSA_H */
diff --git a/ssh.h b/ssh.h
index ddcb5381b..a91312a81 100644
--- a/ssh.h
+++ b/ssh.h
@@ -13,12 +13,14 @@ Generic header file for ssh.
13 13
14*/ 14*/
15 15
16/* RCSID("$Id: ssh.h,v 1.8 1999/11/08 23:28:04 damien Exp $"); */ 16/* RCSID("$Id: ssh.h,v 1.9 1999/11/10 23:40:23 damien Exp $"); */
17 17
18#ifndef SSH_H 18#ifndef SSH_H
19#define SSH_H 19#define SSH_H
20 20
21/* Added by Dan */ 21#include <netinet/in.h> /* For struct sockaddr_in */
22#include <pwd.h> /* For struct pw */
23
22#ifndef SHUT_RDWR 24#ifndef SHUT_RDWR
23enum 25enum
24{ 26{