summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--Makefile.in2
-rw-r--r--bsd-strsep.c89
-rw-r--r--bsd-strsep.h10
-rw-r--r--configure.in2
5 files changed, 102 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e41481ef..16bd6649b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,7 @@
52 - (djm) Fix problem with debug mode and MaxStartups 52 - (djm) Fix problem with debug mode and MaxStartups
53 - (djm) Don't generate host keys when $(DESTDIR) is set (e.g. during RPM 53 - (djm) Don't generate host keys when $(DESTDIR) is set (e.g. during RPM
54 builds) 54 builds)
55 - (djm) Add strsep function from OpenBSD libc for systems that lack it
55 56
5620000709 5720000709
57 - (djm) Only enable PAM_TTY kludge for Linux. Problem report from 58 - (djm) Only enable PAM_TTY kludge for Linux. Problem report from
diff --git a/Makefile.in b/Makefile.in
index 23e2bce8f..8954f834c 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
37LIBSSH_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 37LIBSSH_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
39LIBOPENBSD_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 fake-getaddrinfo.o fake-getnameinfo.o next-posix.o 39LIBOPENBSD_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
40 40
41SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o 41SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o
42 42
diff --git a/bsd-strsep.c b/bsd-strsep.c
new file mode 100644
index 000000000..c03649cff
--- /dev/null
+++ b/bsd-strsep.c
@@ -0,0 +1,89 @@
1/* $OpenBSD: strsep.c,v 1.3 1997/08/20 04:28:14 millert Exp $ */
2
3/*-
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include "config.h"
37
38#if !defined(HAVE_STRSEP)
39
40#include <string.h>
41#include <stdio.h>
42
43#if defined(LIBC_SCCS) && !defined(lint)
44#if 0
45static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93";
46#else
47static char *rcsid = "$OpenBSD: strsep.c,v 1.3 1997/08/20 04:28:14 millert Exp $";
48#endif
49#endif /* LIBC_SCCS and not lint */
50
51/*
52 * Get next token from string *stringp, where tokens are possibly-empty
53 * strings separated by characters from delim.
54 *
55 * Writes NULs into the string at *stringp to end tokens.
56 * delim need not remain constant from call to call.
57 * On return, *stringp points past the last NUL written (if there might
58 * be further tokens), or is NULL (if there are definitely no more tokens).
59 *
60 * If *stringp is NULL, strsep returns NULL.
61 */
62char *
63strsep(char **stringp, const char *delim)
64{
65 register char *s;
66 register const char *spanp;
67 register int c, sc;
68 char *tok;
69
70 if ((s = *stringp) == NULL)
71 return (NULL);
72 for (tok = s;;) {
73 c = *s++;
74 spanp = delim;
75 do {
76 if ((sc = *spanp++) == c) {
77 if (c == 0)
78 s = NULL;
79 else
80 s[-1] = 0;
81 *stringp = s;
82 return (tok);
83 }
84 } while (sc != 0);
85 }
86 /* NOTREACHED */
87}
88
89#endif /* !defined(HAVE_STRSEP) */
diff --git a/bsd-strsep.h b/bsd-strsep.h
new file mode 100644
index 000000000..d5ba6e0f1
--- /dev/null
+++ b/bsd-strsep.h
@@ -0,0 +1,10 @@
1#ifndef _BSD_STRSEP_H
2#define _BSD_STRSEP_H
3
4#include "config.h"
5
6#ifndef HAVE_STRSEP
7char *strsep(char **stringp, const char *delim);
8#endif /* HAVE_STRSEP */
9
10#endif /* _BSD_STRSEP_H */
diff --git a/configure.in b/configure.in
index 2e2422597..a99127993 100644
--- a/configure.in
+++ b/configure.in
@@ -219,7 +219,7 @@ fi
219AC_CHECK_HEADERS(bstring.h endian.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 usersec.h util.h utmp.h utmpx.h) 219AC_CHECK_HEADERS(bstring.h endian.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 usersec.h util.h utmp.h utmpx.h)
220 220
221# Checks for library functions. 221# Checks for library functions.
222AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage inet_aton innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strlcat strlcpy vsnprintf vhangup _getpty __b64_ntop) 222AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage inet_aton innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
223dnl checks for time functions 223dnl checks for time functions
224AC_CHECK_FUNCS(gettimeofday time) 224AC_CHECK_FUNCS(gettimeofday time)
225dnl checks for libutil functions 225dnl checks for libutil functions