diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Makefile.in | 6 | ||||
-rw-r--r-- | README | 17 | ||||
-rw-r--r-- | acconfig.h | 6 | ||||
-rw-r--r-- | bsd-daemon.c | 78 | ||||
-rw-r--r-- | bsd-daemon.h | 9 | ||||
-rw-r--r-- | bsd-login.c | 83 | ||||
-rw-r--r-- | bsd-login.h | 13 | ||||
-rw-r--r-- | bsd-mktemp.c (renamed from mktemp.c) | 7 | ||||
-rw-r--r-- | bsd-mktemp.h (renamed from mktemp.h) | 6 | ||||
-rw-r--r-- | bsd-strlcpy.c (renamed from strlcpy.c) | 6 | ||||
-rw-r--r-- | bsd-strlcpy.h (renamed from strlcpy.h) | 7 | ||||
-rw-r--r-- | configure.in | 12 | ||||
-rw-r--r-- | includes.h | 6 |
14 files changed, 232 insertions, 27 deletions
@@ -14,6 +14,9 @@ | |||
14 | - Added autoconf option to enable AFS support (untested) | 14 | - Added autoconf option to enable AFS support (untested) |
15 | - Added autoconf option to enable S/Key support (untested) | 15 | - Added autoconf option to enable S/Key support (untested) |
16 | - Added autoconf option to enable TCP wrappers support (compiles OK) | 16 | - Added autoconf option to enable TCP wrappers support (compiles OK) |
17 | - Renamed BSD helper function files to bsd-* | ||
18 | - Added tests for login and daemon and OpenBSD replacements for when they | ||
19 | are absent. | ||
17 | 20 | ||
18 | 19991118 | 21 | 19991118 |
19 | - Merged OpenBSD CVS changes | 22 | - Merged OpenBSD CVS changes |
diff --git a/Makefile.in b/Makefile.in index 4daa810ec..fec1d1301 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -27,18 +27,18 @@ OBJS= authfd.o authfile.o auth-passwd.o auth-rhosts.o auth-rh-rsa.o \ | |||
27 | hostfile.o log-client.o login.o log-server.o match.o mpaux.o \ | 27 | hostfile.o log-client.o login.o log-server.o match.o mpaux.o \ |
28 | packet.o pty.o readconf.o readpass.o rsa.o servconf.o serverloop.o \ | 28 | packet.o pty.o readconf.o readpass.o rsa.o servconf.o serverloop.o \ |
29 | sshconnect.o tildexpand.o ttymodes.o uidswap.o xmalloc.o \ | 29 | sshconnect.o tildexpand.o ttymodes.o uidswap.o xmalloc.o \ |
30 | helper.o mktemp.o strlcpy.o rc4.o | 30 | helper.o bsd-mktemp.o bsd-strlcpy.o bsd-daemon.o bsd-login.o rc4.o |
31 | 31 | ||
32 | all: $(OBJS) $(TARGETS) | 32 | all: $(OBJS) $(TARGETS) |
33 | 33 | ||
34 | 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 mktemp.o strlcpy.o log.o fingerprint.o | 34 | 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 |
35 | $(AR) rv $@ $^ | 35 | $(AR) rv $@ $^ |
36 | $(RANLIB) $@ | 36 | $(RANLIB) $@ |
37 | 37 | ||
38 | ssh: ssh.o sshconnect.o log-client.o readconf.o clientloop.o libssh.a | 38 | ssh: ssh.o sshconnect.o log-client.o readconf.o clientloop.o libssh.a |
39 | $(CC) -o $@ $^ $(LFLAGS) $(LIBS) | 39 | $(CC) -o $@ $^ $(LFLAGS) $(LIBS) |
40 | 40 | ||
41 | sshd: sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o pty.o log-server.o login.o servconf.o serverloop.o libssh.a | 41 | sshd: sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o pty.o log-server.o login.o servconf.o serverloop.o bsd-login.o bsd-daemon.o libssh.a |
42 | $(CC) -o $@ $^ $(LFLAGS) $(LIBS) | 42 | $(CC) -o $@ $^ $(LFLAGS) $(LIBS) |
43 | 43 | ||
44 | scp: scp.o libssh.a | 44 | scp: scp.o libssh.a |
@@ -10,9 +10,9 @@ Niels Provos, Theo de Raadt, and Dug Song. It has a homepage at | |||
10 | http://www.openssh.com/ | 10 | http://www.openssh.com/ |
11 | 11 | ||
12 | This port consists of the re-introduction of autoconf support, PAM | 12 | This port consists of the re-introduction of autoconf support, PAM |
13 | support (for Linux and Solaris), EGD[1] support, and replacements for | 13 | support (for Linux and Solaris), EGD[1] support, and replacements |
14 | OpenBSD library functions that are (regrettably) absent from most | 14 | for OpenBSD library functions that are (regrettably) absent from |
15 | other unices. This patch has been best tested on Linux, though some | 15 | other unices. This port has been best tested on Linux, though some |
16 | Solaris support is beginning to filter in. This version actively | 16 | Solaris support is beginning to filter in. This version actively |
17 | tracks changes in the OpenBSD CVS repository. | 17 | tracks changes in the OpenBSD CVS repository. |
18 | 18 | ||
@@ -22,8 +22,8 @@ all logins, not just when using password authentication. | |||
22 | 22 | ||
23 | All new code is released under a XFree style license, which is very | 23 | All new code is released under a XFree style license, which is very |
24 | liberal. Please refer to the source files for details. The code in | 24 | liberal. Please refer to the source files for details. The code in |
25 | strlcpy.c and mktemp.c is from the OpenBSD project and has its own | 25 | bsd-*.[ch] is from the OpenBSD project and has its own license (again, |
26 | license (again, see source file for details). | 26 | see the source files for details). |
27 | 27 | ||
28 | OpenSSH depends on Zlib[2], OpenSSL[3] and optionally PAM[4]. To build | 28 | OpenSSH depends on Zlib[2], OpenSSL[3] and optionally PAM[4]. To build |
29 | the GNOME[5] pass-phrase requester (--with-gnome-askpass), you will | 29 | the GNOME[5] pass-phrase requester (--with-gnome-askpass), you will |
@@ -52,13 +52,14 @@ Credits - | |||
52 | Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, | 52 | Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, |
53 | Theo de Raadt, and Dug Song - Creators of OpenSSH | 53 | Theo de Raadt, and Dug Song - Creators of OpenSSH |
54 | 'jonchen' - the original author of PAM support of SSH | 54 | 'jonchen' - the original author of PAM support of SSH |
55 | Chip Salzenberg <chip@valinux.com> - Assorted patches | ||
55 | Dan Brosemer <odin@linuxfreak.com> - Autoconf and build fixes & Debian scripts | 56 | Dan Brosemer <odin@linuxfreak.com> - Autoconf and build fixes & Debian scripts |
57 | Jim Knoble <jmknoble@pobox.com> - RPM spec file fixes | ||
58 | Marc G. Fournier <marc.fournier@acadiau.ca> - Solaris patches | ||
56 | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> - PAM environment patch | 59 | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> - PAM environment patch |
57 | Phil Hands <phil@hands.com> - Debian scripts, assorted patches | ||
58 | Niels Kristian Bech Jensen <nkbj@image.dk> - Assorted patches | 60 | Niels Kristian Bech Jensen <nkbj@image.dk> - Assorted patches |
59 | Marc G. Fournier <marc.fournier@acadiau.ca> - Solaris patches | 61 | Phil Hands <phil@hands.com> - Debian scripts, assorted patches |
60 | Thomas Neumann <tom@smart.ruhr.de> - Shadow passwords | 62 | Thomas Neumann <tom@smart.ruhr.de> - Shadow passwords |
61 | Jim Knoble <jmknoble@pobox.com> - RPM spec file fixes | ||
62 | 63 | ||
63 | Miscellania - | 64 | Miscellania - |
64 | 65 | ||
diff --git a/acconfig.h b/acconfig.h index 44c5c1a14..2732c26cc 100644 --- a/acconfig.h +++ b/acconfig.h | |||
@@ -42,6 +42,12 @@ | |||
42 | /* Define if you want TCP Wrappers support */ | 42 | /* Define if you want TCP Wrappers support */ |
43 | #undef LIBWRAP | 43 | #undef LIBWRAP |
44 | 44 | ||
45 | /* Define if your libraries define login() */ | ||
46 | #undef HAVE_LOGIN | ||
47 | |||
48 | /* Define if your libraries define daemon() */ | ||
49 | #undef HAVE_DAEMON | ||
50 | |||
45 | @BOTTOM@ | 51 | @BOTTOM@ |
46 | 52 | ||
47 | /* ******************* Shouldn't need to edit below this line ************** */ | 53 | /* ******************* Shouldn't need to edit below this line ************** */ |
diff --git a/bsd-daemon.c b/bsd-daemon.c new file mode 100644 index 000000000..7b292c126 --- /dev/null +++ b/bsd-daemon.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /*- | ||
2 | * Copyright (c) 1990, 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 | #ifndef HAVE_DAEMON | ||
37 | |||
38 | #if defined(LIBC_SCCS) && !defined(lint) | ||
39 | static char rcsid[] = "$OpenBSD: daemon.c,v 1.2 1996/08/19 08:22:13 tholo Exp $"; | ||
40 | #endif /* LIBC_SCCS and not lint */ | ||
41 | |||
42 | #include <fcntl.h> | ||
43 | #include <paths.h> | ||
44 | #include <unistd.h> | ||
45 | |||
46 | int | ||
47 | daemon(nochdir, noclose) | ||
48 | int nochdir, noclose; | ||
49 | { | ||
50 | int fd; | ||
51 | |||
52 | switch (fork()) { | ||
53 | case -1: | ||
54 | return (-1); | ||
55 | case 0: | ||
56 | break; | ||
57 | default: | ||
58 | _exit(0); | ||
59 | } | ||
60 | |||
61 | if (setsid() == -1) | ||
62 | return (-1); | ||
63 | |||
64 | if (!nochdir) | ||
65 | (void)chdir("/"); | ||
66 | |||
67 | if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { | ||
68 | (void)dup2(fd, STDIN_FILENO); | ||
69 | (void)dup2(fd, STDOUT_FILENO); | ||
70 | (void)dup2(fd, STDERR_FILENO); | ||
71 | if (fd > 2) | ||
72 | (void)close (fd); | ||
73 | } | ||
74 | return (0); | ||
75 | } | ||
76 | |||
77 | #endif /* !HAVE_DAEMON */ | ||
78 | |||
diff --git a/bsd-daemon.h b/bsd-daemon.h new file mode 100644 index 000000000..cd91ea07b --- /dev/null +++ b/bsd-daemon.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _BSD_DAEMON_H | ||
2 | #define _BSD_DAEMON_H | ||
3 | |||
4 | #include "config.h" | ||
5 | #ifndef HAVE_DAEMON | ||
6 | int daemon(int nochdir, int noclose); | ||
7 | #endif /* !HAVE_DAEMON */ | ||
8 | |||
9 | #endif /* _BSD_DAEMON_H */ | ||
diff --git a/bsd-login.c b/bsd-login.c new file mode 100644 index 000000000..8c84272f8 --- /dev/null +++ b/bsd-login.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* $OpenBSD: login.c,v 1.5 1998/07/13 02:11:12 millert Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 1988, 1993 | ||
4 | * The Regents of the University of California. All rights reserved. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * 3. All advertising materials mentioning features or use of this software | ||
15 | * must display the following acknowledgement: | ||
16 | * This product includes software developed by the University of | ||
17 | * California, Berkeley and its contributors. | ||
18 | * 4. Neither the name of the University nor the names of its contributors | ||
19 | * may be used to endorse or promote products derived from this software | ||
20 | * without specific prior written permission. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
32 | * SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | #include "config.h" | ||
36 | #ifndef HAVE_LOGIN | ||
37 | |||
38 | #if defined(LIBC_SCCS) && !defined(lint) | ||
39 | /* from: static char sccsid[] = "@(#)login.c 8.1 (Berkeley) 6/4/93"; */ | ||
40 | static char *rcsid = "$Id: bsd-login.c,v 1.1 1999/11/19 04:32:34 damien Exp $"; | ||
41 | #endif /* LIBC_SCCS and not lint */ | ||
42 | |||
43 | #include <sys/types.h> | ||
44 | |||
45 | #include <fcntl.h> | ||
46 | #include <unistd.h> | ||
47 | #include <stdlib.h> | ||
48 | #include <utmp.h> | ||
49 | #include <stdio.h> | ||
50 | |||
51 | void | ||
52 | login(utp) | ||
53 | struct utmp *utp; | ||
54 | { | ||
55 | struct utmp old_ut; | ||
56 | register int fd; | ||
57 | int tty; | ||
58 | |||
59 | tty = ttyslot(); | ||
60 | if (tty > 0 && (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) >= 0) { | ||
61 | (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET); | ||
62 | /* | ||
63 | * Prevent luser from zero'ing out ut_host. | ||
64 | * If the new ut_line is empty but the old one is not | ||
65 | * and ut_line and ut_name match, preserve the old ut_line. | ||
66 | */ | ||
67 | if (read(fd, &old_ut, sizeof(struct utmp)) == | ||
68 | sizeof(struct utmp) && utp->ut_host[0] == '\0' && | ||
69 | old_ut.ut_host[0] != '\0' && | ||
70 | strncmp(old_ut.ut_line, utp->ut_line, UT_LINESIZE) == 0 && | ||
71 | strncmp(old_ut.ut_name, utp->ut_name, UT_NAMESIZE) == 0) | ||
72 | (void)memcpy(utp->ut_host, old_ut.ut_host, UT_HOSTSIZE); | ||
73 | (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET); | ||
74 | (void)write(fd, utp, sizeof(struct utmp)); | ||
75 | (void)close(fd); | ||
76 | } | ||
77 | if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) >= 0) { | ||
78 | (void)write(fd, utp, sizeof(struct utmp)); | ||
79 | (void)close(fd); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | #endif /* HAVE_LOGIN */ | ||
diff --git a/bsd-login.h b/bsd-login.h new file mode 100644 index 000000000..26a8505b3 --- /dev/null +++ b/bsd-login.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _BSD_LOGIN_H | ||
2 | #define _BSD_LOGIN_H | ||
3 | |||
4 | #include "config.h" | ||
5 | #ifndef HAVE_LOGIN | ||
6 | |||
7 | #include <utmp.h> | ||
8 | |||
9 | void login(struct utmp *utp); | ||
10 | |||
11 | #endif /* !HAVE_LOGIN */ | ||
12 | |||
13 | #endif /* _BSD_LOGIN_H */ | ||
diff --git a/mktemp.c b/bsd-mktemp.c index be03ac909..cdef62da2 100644 --- a/mktemp.c +++ b/bsd-mktemp.c | |||
@@ -34,6 +34,10 @@ | |||
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "config.h" | ||
38 | |||
39 | #ifndef HAVE_MKDTEMP | ||
40 | |||
37 | #if defined(LIBC_SCCS) && !defined(lint) | 41 | #if defined(LIBC_SCCS) && !defined(lint) |
38 | static char rcsid[] = "$OpenBSD: mktemp.c,v 1.13 1998/06/30 23:03:13 deraadt Exp $"; | 42 | static char rcsid[] = "$OpenBSD: mktemp.c,v 1.13 1998/06/30 23:03:13 deraadt Exp $"; |
39 | #endif /* LIBC_SCCS and not lint */ | 43 | #endif /* LIBC_SCCS and not lint */ |
@@ -47,11 +51,8 @@ static char rcsid[] = "$OpenBSD: mktemp.c,v 1.13 1998/06/30 23:03:13 deraadt Exp | |||
47 | #include <ctype.h> | 51 | #include <ctype.h> |
48 | #include <unistd.h> | 52 | #include <unistd.h> |
49 | 53 | ||
50 | #include "config.h" | ||
51 | #include "helper.h" | 54 | #include "helper.h" |
52 | 55 | ||
53 | #ifndef HAVE_MKDTEMP | ||
54 | |||
55 | static int _gettemp(char *, int *, int, int); | 56 | static int _gettemp(char *, int *, int, int); |
56 | 57 | ||
57 | int | 58 | int |
diff --git a/mktemp.h b/bsd-mktemp.h index ac92cbae0..faddc916e 100644 --- a/mktemp.h +++ b/bsd-mktemp.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _MKTEMP_H | 1 | #ifndef _BSD_MKTEMP_H |
2 | #define _MKTEMP_H | 2 | #define _BSD_MKTEMP_H |
3 | 3 | ||
4 | #include "config.h" | 4 | #include "config.h" |
5 | #ifndef HAVE_MKDTEMP | 5 | #ifndef HAVE_MKDTEMP |
@@ -8,4 +8,4 @@ int mkstemp(char *path); | |||
8 | char *mkdtemp(char *path); | 8 | char *mkdtemp(char *path); |
9 | #endif /* !HAVE_MKDTEMP */ | 9 | #endif /* !HAVE_MKDTEMP */ |
10 | 10 | ||
11 | #endif /* _MKTEMP_H */ | 11 | #endif /* _BSD_MKTEMP_H */ |
diff --git a/strlcpy.c b/bsd-strlcpy.c index 4df4080d6..276c25c37 100644 --- a/strlcpy.c +++ b/bsd-strlcpy.c | |||
@@ -27,6 +27,9 @@ | |||
27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "config.h" | ||
31 | #ifndef HAVE_STRLCPY | ||
32 | |||
30 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) |
31 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $"; | 34 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $"; |
32 | #endif /* LIBC_SCCS and not lint */ | 35 | #endif /* LIBC_SCCS and not lint */ |
@@ -34,9 +37,6 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp | |||
34 | #include <sys/types.h> | 37 | #include <sys/types.h> |
35 | #include <string.h> | 38 | #include <string.h> |
36 | 39 | ||
37 | #include "config.h" | ||
38 | #ifndef HAVE_STRLCPY | ||
39 | |||
40 | /* | 40 | /* |
41 | * Copy src to string dst of size siz. At most siz-1 characters | 41 | * Copy src to string dst of size siz. At most siz-1 characters |
42 | * will be copied. Always NUL terminates (unless siz == 0). | 42 | * will be copied. Always NUL terminates (unless siz == 0). |
diff --git a/strlcpy.h b/bsd-strlcpy.h index 9afbd39c5..dafa44af8 100644 --- a/strlcpy.h +++ b/bsd-strlcpy.h | |||
@@ -1,9 +1,10 @@ | |||
1 | #ifndef _STRLCPY_H | 1 | #ifndef _BSD_STRLCPY_H |
2 | #define _STRLCPY_H | 2 | #define _BSD_STRLCPY_H |
3 | 3 | ||
4 | #include "config.h" | 4 | #include "config.h" |
5 | #ifndef HAVE_STRLCPY | 5 | #ifndef HAVE_STRLCPY |
6 | #include <sys/types.h> | ||
6 | size_t strlcpy(char *dst, const char *src, size_t siz); | 7 | size_t strlcpy(char *dst, const char *src, size_t siz); |
7 | #endif /* !HAVE_STRLCPY */ | 8 | #endif /* !HAVE_STRLCPY */ |
8 | 9 | ||
9 | #endif /* _STRLCPY_H */ | 10 | #endif /* _BSD_STRLCPY_H */ |
diff --git a/configure.in b/configure.in index 0b54fd58a..dd74b3b4f 100644 --- a/configure.in +++ b/configure.in | |||
@@ -60,6 +60,16 @@ AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h shadow.h netgroup.h maillock.h | |||
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 mkdtemp arc4random setproctitle setlogin) |
62 | 62 | ||
63 | AC_CHECK_FUNC(login, | ||
64 | [AC_DEFINE(HAVE_LOGIN)], | ||
65 | [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])] | ||
66 | ) | ||
67 | |||
68 | AC_CHECK_FUNC(daemon, | ||
69 | [AC_DEFINE(HAVE_DAEMON)], | ||
70 | [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])] | ||
71 | ) | ||
72 | |||
63 | dnl Check whether use wants to disable the external ssh-askpass | 73 | dnl Check whether use wants to disable the external ssh-askpass |
64 | INSTALL_ASKPASS="yes" | 74 | INSTALL_ASKPASS="yes" |
65 | AC_MSG_CHECKING([whether to enable external ssh-askpass support]) | 75 | AC_MSG_CHECKING([whether to enable external ssh-askpass support]) |
@@ -156,7 +166,7 @@ done | |||
156 | 166 | ||
157 | AC_MSG_CHECKING([whether libc defines __progname]) | 167 | AC_MSG_CHECKING([whether libc defines __progname]) |
158 | AC_TRY_LINK([], | 168 | AC_TRY_LINK([], |
159 | [extern char *__progname;], | 169 | [extern char *__progname; printf("%s", __progname);], |
160 | [ | 170 | [ |
161 | AC_DEFINE(HAVE___PROGNAME) | 171 | AC_DEFINE(HAVE___PROGNAME) |
162 | AC_MSG_RESULT(yes) | 172 | AC_MSG_RESULT(yes) |
diff --git a/includes.h b/includes.h index 75349cf3e..06245fdce 100644 --- a/includes.h +++ b/includes.h | |||
@@ -67,12 +67,12 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } | |||
67 | #endif | 67 | #endif |
68 | #ifdef HAVE_LIBPAM | 68 | #ifdef HAVE_LIBPAM |
69 | # include <security/pam_appl.h> | 69 | # include <security/pam_appl.h> |
70 | #endif /* HAVE_PAM */ | 70 | #endif |
71 | 71 | ||
72 | #include "version.h" | 72 | #include "version.h" |
73 | #include "helper.h" | 73 | #include "helper.h" |
74 | #include "mktemp.h" | 74 | #include "bsd-strlcpy.h" |
75 | #include "strlcpy.h" | 75 | #include "bsd-mktemp.h" |
76 | 76 | ||
77 | /* Define this to be the path of the xauth program. */ | 77 | /* Define this to be the path of the xauth program. */ |
78 | #ifndef XAUTH_PATH | 78 | #ifndef XAUTH_PATH |