diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Makefile.in | 6 | ||||
-rw-r--r-- | acconfig.h | 17 | ||||
-rw-r--r-- | bsd-login.c | 2 | ||||
-rw-r--r-- | bsd-strlcat.c | 76 | ||||
-rw-r--r-- | bsd-strlcat.h | 10 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | includes.h | 5 |
8 files changed, 116 insertions, 7 deletions
@@ -5,6 +5,9 @@ | |||
5 | don't create ~/.ssh only if the user wants to store the private | 5 | don't create ~/.ssh only if the user wants to store the private |
6 | key there. show fingerprint instead of public-key after | 6 | key there. show fingerprint instead of public-key after |
7 | keygeneration. ok niels@ | 7 | keygeneration. ok niels@ |
8 | - Added OpenBSD bsd-strlcat.c, created bsd-strlcat.h | ||
9 | - Added timersum() macro | ||
10 | - Tidy RCSIDs of bsd-*.c | ||
8 | 11 | ||
9 | 19991121 | 12 | 19991121 |
10 | - OpenBSD CVS Changes: | 13 | - OpenBSD CVS Changes: |
diff --git a/Makefile.in b/Makefile.in index b338c9ca8..4400c258c 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -28,12 +28,12 @@ OBJS= authfd.o authfile.o auth-passwd.o auth-rhosts.o auth-rh-rsa.o \ | |||
28 | hostfile.o log-client.o login.o log-server.o match.o mpaux.o \ | 28 | hostfile.o log-client.o login.o log-server.o match.o mpaux.o \ |
29 | packet.o pty.o readconf.o readpass.o rsa.o servconf.o serverloop.o \ | 29 | packet.o pty.o readconf.o readpass.o rsa.o servconf.o serverloop.o \ |
30 | sshconnect.o tildexpand.o ttymodes.o uidswap.o xmalloc.o \ | 30 | sshconnect.o tildexpand.o ttymodes.o uidswap.o xmalloc.o \ |
31 | helper.o bsd-mktemp.o bsd-strlcpy.o bsd-daemon.o bsd-login.o rc4.o \ | 31 | helper.o bsd-mktemp.o bsd-strlcpy.o bsd-strlcat.o bsd-daemon.o \ |
32 | md5crypt.o | 32 | bsd-login.o rc4.o md5crypt.o |
33 | 33 | ||
34 | all: $(OBJS) $(TARGETS) | 34 | all: $(OBJS) $(TARGETS) |
35 | 35 | ||
36 | libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o hostfile.o match.o mpaux.o nchan.o packet.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o helper.o rc4.o bsd-mktemp.o bsd-strlcpy.o log.o fingerprint.o | 36 | libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o hostfile.o match.o mpaux.o nchan.o packet.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o helper.o rc4.o bsd-mktemp.o bsd-strlcpy.o bsd-strlcat.o log.o fingerprint.o |
37 | $(AR) rv $@ $^ | 37 | $(AR) rv $@ $^ |
38 | $(RANLIB) $@ | 38 | $(RANLIB) $@ |
39 | 39 | ||
diff --git a/acconfig.h b/acconfig.h index a37c0823c..db7fd18b1 100644 --- a/acconfig.h +++ b/acconfig.h | |||
@@ -71,6 +71,10 @@ | |||
71 | # include <paths.h> /* For _PATH_XXX */ | 71 | # include <paths.h> /* For _PATH_XXX */ |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | #ifdef HAVE_SYS_TIME_H | ||
75 | # include <sys/time.h> /* For timersub */ | ||
76 | #endif | ||
77 | |||
74 | #ifndef SHUT_RDWR | 78 | #ifndef SHUT_RDWR |
75 | enum | 79 | enum |
76 | { | 80 | { |
@@ -178,3 +182,16 @@ enum | |||
178 | # define MAX(a,b) (((a)>(b))?(a):(b)) | 182 | # define MAX(a,b) (((a)>(b))?(a):(b)) |
179 | # define MIN(a,b) (((a)<(b))?(a):(b)) | 183 | # define MIN(a,b) (((a)<(b))?(a):(b)) |
180 | #endif | 184 | #endif |
185 | |||
186 | #ifndef timersub | ||
187 | #define timersub(a, b, result) \ | ||
188 | do { \ | ||
189 | (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ | ||
190 | (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ | ||
191 | if ((result)->tv_usec < 0) { \ | ||
192 | --(result)->tv_sec; \ | ||
193 | (result)->tv_usec += 1000000; \ | ||
194 | } \ | ||
195 | } while (0) | ||
196 | |||
197 | #endif | ||
diff --git a/bsd-login.c b/bsd-login.c index 98010ec3c..93f230266 100644 --- a/bsd-login.c +++ b/bsd-login.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #if defined(LIBC_SCCS) && !defined(lint) | 38 | #if defined(LIBC_SCCS) && !defined(lint) |
39 | /* from: static char sccsid[] = "@(#)login.c 8.1 (Berkeley) 6/4/93"; */ | 39 | /* from: static char sccsid[] = "@(#)login.c 8.1 (Berkeley) 6/4/93"; */ |
40 | static char *rcsid = "$Id: bsd-login.c,v 1.2 1999/11/20 01:18:40 damien Exp $"; | 40 | static char *rcsid = "$OpenBSD: login.c,v 1.5 1998/07/13 02:11:12 millert Exp $"; |
41 | #endif /* LIBC_SCCS and not lint */ | 41 | #endif /* LIBC_SCCS and not lint */ |
42 | 42 | ||
43 | #include <sys/types.h> | 43 | #include <sys/types.h> |
diff --git a/bsd-strlcat.c b/bsd-strlcat.c new file mode 100644 index 000000000..10ad9e71a --- /dev/null +++ b/bsd-strlcat.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions | ||
9 | * are met: | ||
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. 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 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
19 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
20 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
21 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
24 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
26 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | #include "config.h" | ||
31 | #ifndef HAVE_STRLCAT | ||
32 | |||
33 | #if defined(LIBC_SCCS) && !defined(lint) | ||
34 | static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $"; | ||
35 | #endif /* LIBC_SCCS and not lint */ | ||
36 | |||
37 | #include <sys/types.h> | ||
38 | #include <string.h> | ||
39 | |||
40 | /* | ||
41 | * Appends src to string dst of size siz (unlike strncat, siz is the | ||
42 | * full size of dst, not space left). At most siz-1 characters | ||
43 | * will be copied. Always NUL terminates (unless siz == 0). | ||
44 | * Returns strlen(src); if retval >= siz, truncation occurred. | ||
45 | */ | ||
46 | size_t strlcat(dst, src, siz) | ||
47 | char *dst; | ||
48 | const char *src; | ||
49 | size_t siz; | ||
50 | { | ||
51 | register char *d = dst; | ||
52 | register const char *s = src; | ||
53 | register size_t n = siz; | ||
54 | size_t dlen; | ||
55 | |||
56 | /* Find the end of dst and adjust bytes left but don't go past end */ | ||
57 | while (*d != '\0' && n-- != 0) | ||
58 | d++; | ||
59 | dlen = d - dst; | ||
60 | n = siz - dlen; | ||
61 | |||
62 | if (n == 0) | ||
63 | return(dlen + strlen(s)); | ||
64 | while (*s != '\0') { | ||
65 | if (n != 1) { | ||
66 | *d++ = *s; | ||
67 | n--; | ||
68 | } | ||
69 | s++; | ||
70 | } | ||
71 | *d = '\0'; | ||
72 | |||
73 | return(dlen + (s - src)); /* count does not include NUL */ | ||
74 | } | ||
75 | |||
76 | #endif /* !HAVE_STRLCAT */ | ||
diff --git a/bsd-strlcat.h b/bsd-strlcat.h new file mode 100644 index 000000000..562dc7045 --- /dev/null +++ b/bsd-strlcat.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _BSD_STRLCAT_H | ||
2 | #define _BSD_STRLCAT_H | ||
3 | |||
4 | #include "config.h" | ||
5 | #ifndef HAVE_STRLCAT | ||
6 | #include <sys/types.h> | ||
7 | size_t strlcat(char *dst, const char *src, size_t siz); | ||
8 | #endif /* !HAVE_STRLCAT */ | ||
9 | |||
10 | #endif /* _BSD_STRLCAT_H */ | ||
diff --git a/configure.in b/configure.in index 2a4a2c7de..1fe0c30b4 100644 --- a/configure.in +++ b/configure.in | |||
@@ -55,10 +55,10 @@ AC_CHECK_LIB(dl, dlopen, , ) | |||
55 | AC_CHECK_LIB(pam, pam_authenticate, , ) | 55 | AC_CHECK_LIB(pam, pam_authenticate, , ) |
56 | 56 | ||
57 | dnl Checks for header files. | 57 | dnl Checks for header files. |
58 | AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h shadow.h netgroup.h maillock.h sys/select.h) | 58 | AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h shadow.h netgroup.h maillock.h sys/select.h sys/time.h) |
59 | 59 | ||
60 | dnl Checks for library functions. | 60 | dnl Checks for library functions. |
61 | AC_CHECK_FUNCS(openpty strlcpy mkdtemp arc4random setproctitle setlogin) | 61 | AC_CHECK_FUNCS(openpty strlcpy strlcat mkdtemp arc4random setproctitle setlogin) |
62 | 62 | ||
63 | AC_CHECK_FUNC(login, | 63 | AC_CHECK_FUNC(login, |
64 | [AC_DEFINE(HAVE_LOGIN)], | 64 | [AC_DEFINE(HAVE_LOGIN)], |
diff --git a/includes.h b/includes.h index 06245fdce..722c6b3bd 100644 --- a/includes.h +++ b/includes.h | |||
@@ -27,7 +27,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } | |||
27 | #include <sys/ioctl.h> | 27 | #include <sys/ioctl.h> |
28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
29 | #include <sys/wait.h> | 29 | #include <sys/wait.h> |
30 | #include <sys/time.h> | ||
31 | #include <sys/un.h> | 30 | #include <sys/un.h> |
32 | #include <sys/resource.h> | 31 | #include <sys/resource.h> |
33 | 32 | ||
@@ -65,6 +64,9 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } | |||
65 | #ifdef HAVE_SYS_SELECT_H | 64 | #ifdef HAVE_SYS_SELECT_H |
66 | # include <sys/select.h> | 65 | # include <sys/select.h> |
67 | #endif | 66 | #endif |
67 | #ifdef HAVE_SYS_TIME_H | ||
68 | # include <sys/time.h> | ||
69 | #endif | ||
68 | #ifdef HAVE_LIBPAM | 70 | #ifdef HAVE_LIBPAM |
69 | # include <security/pam_appl.h> | 71 | # include <security/pam_appl.h> |
70 | #endif | 72 | #endif |
@@ -72,6 +74,7 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } | |||
72 | #include "version.h" | 74 | #include "version.h" |
73 | #include "helper.h" | 75 | #include "helper.h" |
74 | #include "bsd-strlcpy.h" | 76 | #include "bsd-strlcpy.h" |
77 | #include "bsd-strlcat.h" | ||
75 | #include "bsd-mktemp.h" | 78 | #include "bsd-mktemp.h" |
76 | 79 | ||
77 | /* Define this to be the path of the xauth program. */ | 80 | /* Define this to be the path of the xauth program. */ |