diff options
author | Damien Miller <djm@mindrot.org> | 2000-08-16 10:35:58 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-08-16 10:35:58 +1000 |
commit | 11fa2cc3839b1e7fed1d85aa1158cce4d498bc58 (patch) | |
tree | f432a585240e930f3accd4aa2ab43ad1835f8ea5 | |
parent | 0da2eaaf06e8d05862dcce34cc8c7d1a0740de7c (diff) |
- (djm) Replacement for inet_ntoa for Irix (which breaks on gcc)
- (djm) Fix strerror replacement for old SunOS. Based on patch from
Charles Levert <charles@comm.polymtl.ca>
- (djm) Seperate arc4random into seperate file and use OpenSSL's RC4
implementation.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | acconfig.h | 6 | ||||
-rw-r--r-- | bsd-arc4random.c | 64 | ||||
-rw-r--r-- | bsd-arc4random.h | 40 | ||||
-rw-r--r-- | bsd-inet_ntoa.c | 64 | ||||
-rw-r--r-- | bsd-inet_ntoa.h | 10 | ||||
-rw-r--r-- | bsd-misc.c | 114 | ||||
-rw-r--r-- | bsd-misc.h | 11 | ||||
-rw-r--r-- | configure.in | 16 | ||||
-rw-r--r-- | openbsd-compat.h | 2 |
11 files changed, 223 insertions, 113 deletions
@@ -1,3 +1,10 @@ | |||
1 | 20000816 | ||
2 | - (djm) Replacement for inet_ntoa for Irix (which breaks on gcc) | ||
3 | - (djm) Fix strerror replacement for old SunOS. Based on patch from | ||
4 | Charles Levert <charles@comm.polymtl.ca> | ||
5 | - (djm) Seperate arc4random into seperate file and use OpenSSL's RC4 | ||
6 | implementation. | ||
7 | |||
1 | 20000815 | 8 | 20000815 |
2 | - (djm) More SunOS 4.1.x fixes from Nate Itkin <nitkin@europa.com> | 9 | - (djm) More SunOS 4.1.x fixes from Nate Itkin <nitkin@europa.com> |
3 | - (djm) Avoid failures on Irix when ssh is not setuid. Fix from | 10 | - (djm) Avoid failures on Irix when ssh is not setuid. Fix from |
diff --git a/Makefile.in b/Makefile.in index 518b4c86d..0aaaa6885 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -36,7 +36,7 @@ TARGETS=ssh sshd ssh-add ssh-keygen ssh-agent scp $(EXTRA_TARGETS) | |||
36 | 36 | ||
37 | LIBSSH_OBJS=atomicio.o authfd.o authfile.o aux.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o dispatch.o dsa.o fingerprint.o hmac.o hostfile.o key.o kex.o log.o match.o mpaux.o nchan.o packet.o radix.o entropy.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o uuencode.o xmalloc.o | 37 | LIBSSH_OBJS=atomicio.o authfd.o authfile.o aux.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o dispatch.o dsa.o fingerprint.o hmac.o hostfile.o key.o kex.o log.o match.o mpaux.o nchan.o packet.o radix.o entropy.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o uuencode.o xmalloc.o |
38 | 38 | ||
39 | LIBOPENBSD_COMPAT_OBJS=bsd-base64.o bsd-bindresvport.o bsd-daemon.o bsd-inet_aton.o bsd-misc.o bsd-mktemp.o bsd-rresvport.o bsd-setenv.o bsd-sigaction.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o bsd-strsep.o fake-getaddrinfo.o fake-getnameinfo.o next-posix.o | 39 | LIBOPENBSD_COMPAT_OBJS=bsd-arc4random.o bsd-base64.o bsd-bindresvport.o bsd-daemon.o bsd-inet_aton.o bsd-inet_ntoa.o bsd-misc.o bsd-mktemp.o bsd-rresvport.o bsd-setenv.o bsd-sigaction.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o bsd-strsep.o fake-getaddrinfo.o fake-getnameinfo.o next-posix.o |
40 | 40 | ||
41 | SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o | 41 | SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o |
42 | 42 | ||
diff --git a/acconfig.h b/acconfig.h index 358390bc4..6c25c8fc9 100644 --- a/acconfig.h +++ b/acconfig.h | |||
@@ -6,9 +6,15 @@ | |||
6 | 6 | ||
7 | @TOP@ | 7 | @TOP@ |
8 | 8 | ||
9 | /* Define if you system's inet_ntoa is busted (e.g. Irix gcc issue) */ | ||
10 | #undef BROKEN_INET_NTOA | ||
11 | |||
9 | /* Define if your system defines sys_errlist[] */ | 12 | /* Define if your system defines sys_errlist[] */ |
10 | #undef HAVE_SYS_ERRLIST | 13 | #undef HAVE_SYS_ERRLIST |
11 | 14 | ||
15 | /* Define if your system defines sys_nerr */ | ||
16 | #undef HAVE_SYS_NERR | ||
17 | |||
12 | /* Define if your system choked on IP TOS setting */ | 18 | /* Define if your system choked on IP TOS setting */ |
13 | #undef IP_TOS_IS_BROKEN | 19 | #undef IP_TOS_IS_BROKEN |
14 | 20 | ||
diff --git a/bsd-arc4random.c b/bsd-arc4random.c new file mode 100644 index 000000000..d01a515b4 --- /dev/null +++ b/bsd-arc4random.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (c) 1999-2000 Damien Miller. All rights reserved. | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions | ||
6 | * are met: | ||
7 | * 1. Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * 2. Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * 3. All advertising materials mentioning features or use of this software | ||
13 | * must display the following acknowledgement: | ||
14 | * This product includes software developed by Markus Friedl. | ||
15 | * 4. The name of the author may not be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | #include "includes.h" | ||
31 | #include <openssl/rand.h> | ||
32 | #include <openssl/rc4.h> | ||
33 | |||
34 | #ifndef HAVE_ARC4RANDOM | ||
35 | |||
36 | static int rc4_ready = 0; | ||
37 | static RC4_KEY rc4; | ||
38 | |||
39 | unsigned int arc4random(void) | ||
40 | { | ||
41 | unsigned int r = 0; | ||
42 | |||
43 | if (!rc4_ready) | ||
44 | arc4random_stir(); | ||
45 | |||
46 | RC4(&rc4, sizeof(r), (unsigned char *)&r, (unsigned char *)&r); | ||
47 | |||
48 | return(r); | ||
49 | } | ||
50 | |||
51 | void arc4random_stir(void) | ||
52 | { | ||
53 | unsigned char rand_buf[32]; | ||
54 | |||
55 | memset(&rc4, 0, sizeof(rc4)); | ||
56 | |||
57 | seed_rng(); | ||
58 | RAND_bytes(rand_buf, sizeof(rand_buf)); | ||
59 | |||
60 | RC4_set_key(&rc4, sizeof(rand_buf), rand_buf); | ||
61 | |||
62 | memset(rand_buf, 0, sizeof(rand_buf)); | ||
63 | } | ||
64 | #endif /* !HAVE_ARC4RANDOM */ | ||
diff --git a/bsd-arc4random.h b/bsd-arc4random.h new file mode 100644 index 000000000..c6ccd35f2 --- /dev/null +++ b/bsd-arc4random.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (c) 1999-2000 Damien Miller. All rights reserved. | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions | ||
6 | * are met: | ||
7 | * 1. Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * 2. Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * 3. All advertising materials mentioning features or use of this software | ||
13 | * must display the following acknowledgement: | ||
14 | * This product includes software developed by Markus Friedl. | ||
15 | * 4. The name of the author may not be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | #ifndef _BSD_ARC4RANDOM_H | ||
31 | #define _BSD_ARC4RANDOM_H | ||
32 | |||
33 | #include "config.h" | ||
34 | |||
35 | #ifndef HAVE_ARC4RANDOM | ||
36 | unsigned int arc4random(void); | ||
37 | void arc4random_stir(void); | ||
38 | #endif /* !HAVE_ARC4RANDOM */ | ||
39 | |||
40 | #endif /* _BSD_ARC4RANDOM_H */ | ||
diff --git a/bsd-inet_ntoa.c b/bsd-inet_ntoa.c new file mode 100644 index 000000000..fe5539be0 --- /dev/null +++ b/bsd-inet_ntoa.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (c) 1983, 1993 | ||
3 | * The Regents of the University of California. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * 1. Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * 2. Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * 3. All advertising materials mentioning features or use of this software | ||
14 | * must display the following acknowledgement: | ||
15 | * This product includes software developed by the University of | ||
16 | * California, Berkeley and its contributors. | ||
17 | * 4. Neither the name of the University nor the names of its contributors | ||
18 | * may be used to endorse or promote products derived from this software | ||
19 | * without specific prior written permission. | ||
20 | * | ||
21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
31 | * SUCH DAMAGE. | ||
32 | */ | ||
33 | |||
34 | #include "config.h" | ||
35 | |||
36 | #if defined(BROKEN_INET_NTOA) || !defined(HAVE_INET_NTOA) | ||
37 | |||
38 | #if defined(LIBC_SCCS) && !defined(lint) | ||
39 | static char rcsid[] = "$OpenBSD: inet_ntoa.c,v 1.2 1996/08/19 08:29:16 tholo Exp $"; | ||
40 | #endif /* LIBC_SCCS and not lint */ | ||
41 | |||
42 | /* | ||
43 | * Convert network-format internet address | ||
44 | * to base 256 d.d.d.d representation. | ||
45 | */ | ||
46 | #include <sys/types.h> | ||
47 | #include <netinet/in.h> | ||
48 | #include <arpa/inet.h> | ||
49 | #include <stdio.h> | ||
50 | #include "bsd-inet_ntoa.h" | ||
51 | |||
52 | char *inet_ntoa(struct in_addr in) | ||
53 | { | ||
54 | static char b[18]; | ||
55 | register char *p; | ||
56 | |||
57 | p = (char *)∈ | ||
58 | #define UC(b) (((int)b)&0xff) | ||
59 | (void)snprintf(b, sizeof(b), | ||
60 | "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3])); | ||
61 | return (b); | ||
62 | } | ||
63 | |||
64 | #endif /* defined(BROKEN_INET_NTOA) || !defined(HAVE_INET_NTOA) */ | ||
diff --git a/bsd-inet_ntoa.h b/bsd-inet_ntoa.h new file mode 100644 index 000000000..e3d48e4af --- /dev/null +++ b/bsd-inet_ntoa.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _BSD_INET_NTOA_H | ||
2 | #define _BSD_INET_NTOA_H | ||
3 | |||
4 | #include "config.h" | ||
5 | |||
6 | #if defined(BROKEN_INET_NTOA) || !defined(HAVE_INET_NTOA) | ||
7 | char *inet_ntoa(struct in_addr in); | ||
8 | #endif /* defined(BROKEN_INET_NTOA) || !defined(HAVE_INET_NTOA) */ | ||
9 | |||
10 | #endif /* _BSD_INET_NTOA_H */ | ||
diff --git a/bsd-misc.c b/bsd-misc.c index e6b529e1e..67614eb76 100644 --- a/bsd-misc.c +++ b/bsd-misc.c | |||
@@ -27,107 +27,9 @@ | |||
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "config.h" | 30 | #include "includes.h" |
31 | |||
32 | #include <stdio.h> | ||
33 | #include <stdlib.h> | ||
34 | #include <string.h> | ||
35 | #include <errno.h> | ||
36 | #include <unistd.h> | ||
37 | |||
38 | #include <sys/types.h> | ||
39 | #include <sys/stat.h> | ||
40 | #include <fcntl.h> | ||
41 | #ifdef HAVE_STDDEF_H | ||
42 | #include <stddef.h> | ||
43 | #endif | ||
44 | |||
45 | #include "xmalloc.h" | 31 | #include "xmalloc.h" |
46 | #include "ssh.h" | 32 | #include "ssh.h" |
47 | #include "bsd-misc.h" | ||
48 | #include "entropy.h" | ||
49 | |||
50 | #include <openssl/rand.h> | ||
51 | |||
52 | #ifndef HAVE_ARC4RANDOM | ||
53 | |||
54 | typedef struct | ||
55 | { | ||
56 | unsigned int s[256]; | ||
57 | int i; | ||
58 | int j; | ||
59 | } rc4_t; | ||
60 | |||
61 | void rc4_key(rc4_t *r, unsigned char *key, int len); | ||
62 | void rc4_getbytes(rc4_t *r, unsigned char *buffer, int len); | ||
63 | |||
64 | static rc4_t *rc4 = NULL; | ||
65 | |||
66 | void rc4_key(rc4_t *r, unsigned char *key, int len) | ||
67 | { | ||
68 | int t; | ||
69 | |||
70 | for(r->i = 0; r->i < 256; r->i++) | ||
71 | r->s[r->i] = r->i; | ||
72 | |||
73 | r->j = 0; | ||
74 | for(r->i = 0; r->i < 256; r->i++) | ||
75 | { | ||
76 | r->j = (r->j + r->s[r->i] + key[r->i % len]) % 256; | ||
77 | t = r->s[r->i]; | ||
78 | r->s[r->i] = r->s[r->j]; | ||
79 | r->s[r->j] = t; | ||
80 | } | ||
81 | r->i = r->j = 0; | ||
82 | } | ||
83 | |||
84 | void rc4_getbytes(rc4_t *r, unsigned char *buffer, int len) | ||
85 | { | ||
86 | int t; | ||
87 | int c; | ||
88 | |||
89 | c = 0; | ||
90 | while(c < len) | ||
91 | { | ||
92 | r->i = (r->i + 1) % 256; | ||
93 | r->j = (r->j + r->s[r->i]) % 256; | ||
94 | t = r->s[r->i]; | ||
95 | r->s[r->i] = r->s[r->j]; | ||
96 | r->s[r->j] = t; | ||
97 | |||
98 | t = (r->s[r->i] + r->s[r->j]) % 256; | ||
99 | |||
100 | buffer[c] = r->s[t]; | ||
101 | c++; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | unsigned int arc4random(void) | ||
106 | { | ||
107 | unsigned int r; | ||
108 | |||
109 | if (rc4 == NULL) | ||
110 | arc4random_stir(); | ||
111 | |||
112 | rc4_getbytes(rc4, (unsigned char *)&r, sizeof(r)); | ||
113 | |||
114 | return(r); | ||
115 | } | ||
116 | |||
117 | void arc4random_stir(void) | ||
118 | { | ||
119 | unsigned char rand_buf[32]; | ||
120 | |||
121 | if (rc4 == NULL) | ||
122 | rc4 = xmalloc(sizeof(*rc4)); | ||
123 | |||
124 | seed_rng(); | ||
125 | RAND_bytes(rand_buf, sizeof(rand_buf)); | ||
126 | |||
127 | rc4_key(rc4, rand_buf, sizeof(rand_buf)); | ||
128 | memset(rand_buf, 0, sizeof(rand_buf)); | ||
129 | } | ||
130 | #endif /* !HAVE_ARC4RANDOM */ | ||
131 | 33 | ||
132 | #ifndef HAVE_SETPROCTITLE | 34 | #ifndef HAVE_SETPROCTITLE |
133 | void setproctitle(const char *fmt, ...) | 35 | void setproctitle(const char *fmt, ...) |
@@ -158,9 +60,15 @@ int seteuid(uid_t euid) | |||
158 | } | 60 | } |
159 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ | 61 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ |
160 | 62 | ||
161 | #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) | 63 | #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR) |
162 | const char *strerror(void) | 64 | const char *strerror(int e) |
163 | { | 65 | { |
164 | return(sys_errlist[errno]); | 66 | extern int sys_nerr; |
67 | extern char *sys_errlist[]; | ||
68 | |||
69 | if ((e >= 0) || (e < sys_nerr)) | ||
70 | return("unlisted error"); | ||
71 | else | ||
72 | return(sys_errlist[e]); | ||
165 | } | 73 | } |
166 | #endif /* !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) */ | 74 | #endif |
diff --git a/bsd-misc.h b/bsd-misc.h index 76b4e1a78..aea285c8d 100644 --- a/bsd-misc.h +++ b/bsd-misc.h | |||
@@ -32,11 +32,6 @@ | |||
32 | 32 | ||
33 | #include "config.h" | 33 | #include "config.h" |
34 | 34 | ||
35 | #ifndef HAVE_ARC4RANDOM | ||
36 | unsigned int arc4random(void); | ||
37 | void arc4random_stir(void); | ||
38 | #endif /* !HAVE_ARC4RANDOM */ | ||
39 | |||
40 | #ifndef HAVE_SETPROCTITLE | 35 | #ifndef HAVE_SETPROCTITLE |
41 | void setproctitle(const char *fmt, ...); | 36 | void setproctitle(const char *fmt, ...); |
42 | #endif /* !HAVE_SETPROCTITLE */ | 37 | #endif /* !HAVE_SETPROCTITLE */ |
@@ -58,8 +53,8 @@ int innetgr(const char *netgroup, const char *host, | |||
58 | int seteuid(uid_t euid); | 53 | int seteuid(uid_t euid); |
59 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ | 54 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ |
60 | 55 | ||
61 | #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) | 56 | #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR) |
62 | const char *strerror(void); | 57 | const char *strerror(int e); |
63 | #endif /* !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) */ | 58 | #endif |
64 | 59 | ||
65 | #endif /* _BSD_MISC_H */ | 60 | #endif /* _BSD_MISC_H */ |
diff --git a/configure.in b/configure.in index 7ad0d01d7..974d0df6b 100644 --- a/configure.in +++ b/configure.in | |||
@@ -87,6 +87,7 @@ case "$host" in | |||
87 | MANTYPE='$(CATMAN)' | 87 | MANTYPE='$(CATMAN)' |
88 | no_libsocket=1 | 88 | no_libsocket=1 |
89 | no_libnsl=1 | 89 | no_libnsl=1 |
90 | AC_DEFINE(BROKEN_INET_NTOA) | ||
90 | ;; | 91 | ;; |
91 | *-*-irix6*) | 92 | *-*-irix6*) |
92 | CFLAGS="$CFLAGS -I/usr/local/include" | 93 | CFLAGS="$CFLAGS -I/usr/local/include" |
@@ -97,6 +98,7 @@ case "$host" in | |||
97 | AC_DEFINE(WITH_IRIX_AUDIT) | 98 | AC_DEFINE(WITH_IRIX_AUDIT) |
98 | no_libsocket=1 | 99 | no_libsocket=1 |
99 | no_libnsl=1 | 100 | no_libnsl=1 |
101 | AC_DEFINE(BROKEN_INET_NTOA) | ||
100 | ;; | 102 | ;; |
101 | *-*-linux*) | 103 | *-*-linux*) |
102 | no_dev_ptmx=1 | 104 | no_dev_ptmx=1 |
@@ -224,7 +226,7 @@ fi | |||
224 | AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h) | 226 | AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h) |
225 | 227 | ||
226 | # Checks for library functions. | 228 | # Checks for library functions. |
227 | AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop) | 229 | AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton inet_ntoa innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop) |
228 | dnl checks for time functions | 230 | dnl checks for time functions |
229 | AC_CHECK_FUNCS(gettimeofday time) | 231 | AC_CHECK_FUNCS(gettimeofday time) |
230 | dnl checks for libutil functions | 232 | dnl checks for libutil functions |
@@ -741,6 +743,18 @@ if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then | |||
741 | fi | 743 | fi |
742 | 744 | ||
743 | 745 | ||
746 | AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [ | ||
747 | AC_TRY_LINK([], | ||
748 | [ extern int sys_nerr; printf("%i", sys_nerr);], | ||
749 | [ ac_cv_libc_defines_sys_nerr="yes" ], | ||
750 | [ ac_cv_libc_defines_sys_nerr="no" ] | ||
751 | ) | ||
752 | ]) | ||
753 | if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then | ||
754 | AC_DEFINE(HAVE_SYS_NERR) | ||
755 | fi | ||
756 | |||
757 | |||
744 | # Looking for programs, paths and files | 758 | # Looking for programs, paths and files |
745 | AC_ARG_WITH(rsh, | 759 | AC_ARG_WITH(rsh, |
746 | [ --with-rsh=PATH Specify path to remote shell program ], | 760 | [ --with-rsh=PATH Specify path to remote shell program ], |
diff --git a/openbsd-compat.h b/openbsd-compat.h index 380226567..521579b96 100644 --- a/openbsd-compat.h +++ b/openbsd-compat.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "config.h" | 4 | #include "config.h" |
5 | 5 | ||
6 | /* BSD function replacements */ | 6 | /* BSD function replacements */ |
7 | #include "bsd-arc4random.h" | ||
7 | #include "bsd-bindresvport.h" | 8 | #include "bsd-bindresvport.h" |
8 | #include "bsd-rresvport.h" | 9 | #include "bsd-rresvport.h" |
9 | #include "bsd-misc.h" | 10 | #include "bsd-misc.h" |
@@ -15,6 +16,7 @@ | |||
15 | #include "bsd-base64.h" | 16 | #include "bsd-base64.h" |
16 | #include "bsd-sigaction.h" | 17 | #include "bsd-sigaction.h" |
17 | #include "bsd-inet_aton.h" | 18 | #include "bsd-inet_aton.h" |
19 | #include "bsd-inet_ntoa.h" | ||
18 | #include "bsd-strsep.h" | 20 | #include "bsd-strsep.h" |
19 | 21 | ||
20 | /* rfc2553 socket API replacements */ | 22 | /* rfc2553 socket API replacements */ |