diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | acconfig.h | 12 | ||||
-rw-r--r-- | configure.in | 81 | ||||
-rw-r--r-- | helper.c | 40 | ||||
-rw-r--r-- | includes.h | 12 | ||||
-rw-r--r-- | login.c | 16 | ||||
-rw-r--r-- | mktemp.c | 2 | ||||
-rw-r--r-- | rsa.h | 10 | ||||
-rw-r--r-- | ssh.h | 6 |
9 files changed, 128 insertions, 56 deletions
@@ -1,8 +1,13 @@ | |||
1 | 19991111 | ||
2 | - Added (untested) Entropy Gathering Daemon (EGD) support | ||
3 | |||
1 | 19991110 | 4 | 19991110 |
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 | ||
7 | 19991109 | 12 | 19991109 |
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 @@ | |||
1 | dnl Process this file with autoconf to produce a configure script. | 1 | AC_INIT(ssh.c) |
2 | |||
3 | AC_INIT(auth-krb4.c) | ||
4 | 2 | ||
5 | AC_CONFIG_HEADER(config.h) | 3 | AC_CONFIG_HEADER(config.h) |
6 | 4 | ||
7 | dnl Checks for programs. | 5 | dnl Checks for programs. |
8 | AC_PROG_CC | 6 | AC_PROG_CC |
7 | AC_PROG_CPP | ||
9 | AC_PROG_RANLIB | 8 | AC_PROG_RANLIB |
10 | AC_CHECK_PROG(AR, ar, ar) | 9 | AC_CHECK_PROG(AR, ar, ar) |
11 | if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi | 10 | if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi |
12 | 11 | ||
13 | dnl Checks for libraries. | ||
14 | dnl Replace `main' with a function in -lcrypto: | ||
15 | AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***])) | ||
16 | dnl Replace `main' with a function in -lutil: | ||
17 | AC_CHECK_LIB(util, logout, ,AC_MSG_ERROR([*** -lutil missing - this is part of libc. ***])) | ||
18 | dnl Replace `main' with a function in -lz: | ||
19 | AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***])) | ||
20 | dnl check for nsl | ||
21 | AC_CHECK_LIB(nsl, yp_match, , ) | ||
22 | dnl check for dl | ||
23 | AC_CHECK_LIB(dl, dlopen, , ) | ||
24 | dnl check for pam | ||
25 | AC_CHECK_LIB(pam, pam_authenticate, , ) | ||
26 | |||
27 | dnl Check for OpenSSL/SSLeay directories. | 12 | dnl Check for OpenSSL/SSLeay directories. |
28 | AC_MSG_CHECKING([for OpenSSL/SSLeay directory]) | 13 | AC_MSG_CHECKING([for OpenSSL/SSLeay directory]) |
29 | for dir in /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg ; do | 14 | for 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 | ||
42 | done | 23 | done |
43 | AC_MSG_RESULT($ssldir) | 24 | AC_MSG_RESULT($ssldir) |
44 | AC_SUBST(ssldir) | 25 | AC_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 | ||
41 | dnl Checks for libraries. | ||
42 | AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***])) | ||
43 | AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***])) | ||
44 | AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil") | ||
45 | AC_CHECK_LIB(nsl, yp_match, , ) | ||
46 | AC_CHECK_LIB(socket, main, , ) | ||
47 | |||
48 | dnl libdl is needed by PAM on Redhat systems | ||
49 | AC_CHECK_LIB(dl, dlopen, , ) | ||
50 | AC_CHECK_LIB(pam, pam_authenticate, , ) | ||
51 | |||
60 | dnl Checks for header files. | 52 | dnl Checks for header files. |
61 | AC_CHECK_HEADERS(pty.h) | 53 | AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h) |
62 | 54 | ||
63 | dnl Checks for library functions. | 55 | dnl Checks for library functions. |
64 | AC_PROG_GCC_TRADITIONAL | 56 | AC_PROG_GCC_TRADITIONAL |
65 | AC_CHECK_FUNCS(openpty strlcpy mkdtemp arc4random setproctitle) | 57 | AC_CHECK_FUNCS(openpty strlcpy mkdtemp arc4random setproctitle) |
66 | 58 | ||
59 | dnl Check for ut_host field in utmp | ||
60 | AC_MSG_CHECKING([whether utmp.h has ut_host field]) | ||
61 | AC_EGREP_HEADER(ut_host, utmp.h, | ||
62 | [AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ], | ||
63 | [AC_MSG_RESULT(no)] | ||
64 | ) | ||
65 | |||
67 | dnl Check whether user wants GNOME ssh-askpass | 66 | dnl Check whether user wants GNOME ssh-askpass |
68 | AC_ARG_WITH(gnome-askpass, | 67 | AC_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"]) |
71 | AC_SUBST(GNOME_ASKPASS) | 70 | AC_SUBST(GNOME_ASKPASS) |
72 | 71 | ||
72 | dnl Check for user-specified random device | ||
73 | AC_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 | |||
90 | dnl Check for EGD pool file | ||
91 | AC_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 | |||
100 | if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then | ||
101 | AC_MSG_ERROR([No random device found, and no EGD random pool specified]) | ||
102 | fi | ||
103 | |||
73 | AC_OUTPUT(Makefile) | 104 | AC_OUTPUT(Makefile) |
@@ -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 | ||
80 | void get_random_bytes(unsigned char *buf, int len) | 81 | void 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" |
@@ -18,9 +18,14 @@ on a tty. | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: login.c,v 1.1 1999/10/27 03:42:44 damien Exp $"); | 21 | RCSID("$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 | |||
113 | void record_logout(int pid, const char *ttyname) | 118 | void 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 | |||
@@ -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 | ||
55 | static int _gettemp __P((char *, int *, int, int)); | 55 | static int _gettemp(char *, int *, int, int); |
56 | 56 | ||
57 | int | 57 | int |
58 | mkstemps(path, slen) | 58 | mkstemps(path, slen) |
@@ -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. */ |
37 | void rsa_set_verbose __P((int verbose)); | 37 | void rsa_set_verbose(int verbose); |
38 | 38 | ||
39 | int rsa_alive __P((void)); | 39 | int rsa_alive(void); |
40 | 40 | ||
41 | void rsa_public_encrypt __P((BIGNUM *out, BIGNUM *in, RSA *prv)); | 41 | void rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *prv); |
42 | void rsa_private_decrypt __P((BIGNUM *out, BIGNUM *in, RSA *prv)); | 42 | void rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *prv); |
43 | 43 | ||
44 | #endif /* RSA_H */ | 44 | #endif /* RSA_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 |
23 | enum | 25 | enum |
24 | { | 26 | { |