path: root/openbsd-compat
AgeCommit message (Collapse)Author
2019-11-02Define __BSD_VISIBLE in fnmatch.h.Darren Tucker
.. since we use symbols defined only when it is when using the compat fnmatch.
2019-11-01Hook up fnmatch for platforms that don't have it.Darren Tucker
2019-11-01Add missing bracket in realpath macro.Darren Tucker
2019-11-01Import fnmatch.c from OpenBSD.Darren Tucker
2019-11-01Use sftp_realpath if no native realpath.Darren Tucker
2019-11-01Add prototype for localtime_r if needed.Darren Tucker
2019-10-29Add implementation of localtime_r.Darren Tucker
2019-10-28Fix ifdefs to not mask needed bits.Darren Tucker
2019-10-28Make sure we have struct statfs before using.Darren Tucker
2019-10-28Move utimensat definition into timespec section.Darren Tucker
Since utimensat uses struct timespec, move it to the section where we define struct timespec when needed.
2019-10-11Re-add SA_RESTART to mysignal.Darren Tucker
This makes mysignal implement reliable BSD semantics according to Stevens' APUE. This was first attempted in 2001 but was reverted due to problems with HP-UX 10.20 and select() and possibly grantpt(). Modern systems should be fine with it, but if any current platforms have a problem with it now we can disable it just for those. ok djm@
2019-10-10Fix ifdef typo for declaration of memmem.Darren Tucker
Fixes build on IRIX. bz#3081.
2019-10-09Make MAKE_CLONE no-op macro more correct.Darren Tucker
Similar to the previous change to DEF_WEAK, some compilers don't like the empty statement, so convert into a no-op function prototype.
2019-10-08avoid "return (value)" in void-declared functionDamien Miller
spotted by Tim Rice; ok dtucker
2019-09-30Include stdio.h for snprintf.Darren Tucker
Patch from
2019-09-02fixed test in OSX closefrom() replacementDamien Miller
from likan_999.student AT
2019-09-02retain Solaris PRIV_FILE_LINK_ANY in sftp-serverDamien Miller
Dropping this privilege removes the ability to create hard links to files owned by other users. This is required for the legacy sftp rename operation. bz#3036; approach ok Alex Wilson (the original author of the Solaris sandbox/pledge replacement code)
2019-08-30proc_pidinfo()-based closefrom() for OS XDamien Miller
Refactor closefrom() to use a single brute-force close() loop fallback. Based on patch from in bz#3049. ok dtucker@
2019-08-24Fix pasto in fallback code.Darren Tucker
There is no parameter called "pathname", it should simply be "path". bz#3059, patch from samuel at
2019-08-05Fix mem leak in unit test.Darren Tucker
Patch from jitendra.sharma at
2019-07-23upstream rev 1.28: fix comment typo.Darren Tucker
2019-07-23Remove sys/cdefs.h include.Darren Tucker
It's not needed on -portable (that's handled by includes.h) and not all platforms have it.
2019-07-23Re-apply portability changes to current sha2.{c,h}.Darren Tucker
Rather than attempt to apply 14 years' worth of changes to OpenBSD's sha2 I imported the current versions directly then re-applied the portability changes. This also allowed re-syncing digest-libc.c against upstream.
2019-07-23Import current sha2.c and sha2.h from OpenBSD.Darren Tucker
These are not changed from their original state, the next commit will re-apply the portable changes.
2019-07-19fix SIGWINCH delivery of Solaris for mux sessionsDamien Miller
Remove PRIV_PROC_SESSION which was limiting ability to send SIGWINCH signals to other sessions. bz#3030; report and fix from Darren Moffat
2019-07-19Fix format string integer type in error message.Darren Tucker
2019-07-16Hook memmem compat code into build.Darren Tucker
This fixes builds on platforms that don't have it (at least old DragonFly, probably others).
2019-07-16Import memmem.c from OpenBSD.Darren Tucker
2019-07-08Move log.h include inside ifdefs.Darren Tucker
Fixes build on some other platforms that don't have va_list immediately available (eg NetBSD).
2019-07-08Include log.h for debug() and friends.Darren Tucker
Should fix some compiler warnings on IRIX (bz#3032).
2019-07-08remove realpath() compat replacementDamien Miller
We shipped a BSD implementation of realpath() because sftp-server depended on its behaviour. OpenBSD is now moving to a more strictly POSIX-compliant realpath(2), so sftp-server now unconditionally requires its own BSD-style realpath implementation. As such, there is no need to carry another independant implementation in openbsd-compat. ok dtucker@
2019-07-06Add prototype for strnlen to prevent warnings.Darren Tucker
2019-07-06Cast *ID types to unsigned long when printing.Darren Tucker
UID and GID types vary by platform so cast to u_long and use %lu when printing them to prevent warnings.
2019-07-06Add prototype for compat strndup.(bz#3032).Darren Tucker
2019-06-16Include stdio.h for vsnprintf.Darren Tucker
Patch from mforney at
2019-06-14upstream rev 1.27: fix integer overflow.Darren Tucker
Cast bitcount to u_in64_t before bit shifting to prevent integer overflow on 32bit platforms which cause incorrect results when adding a block >=512M in size. sha1 patch from ante84 at via openssh github, sha2 with djm@, ok tedu@
2019-06-14upstream rev 1.25: add DEF_WEAK.Darren Tucker
Wrap blowfish, sha*, md5, and rmd160 so that internal calls go direct ok deraadt@
2019-06-14upstream rev 1.25: add sys/types.hDarren Tucker
2019-06-14upstream: Use explicit_bzero instead of memsetDarren Tucker
in hash Final and End functions. OK deraadt@ djm@
2019-06-08Always clean up before and after utimensat test.Darren Tucker
2019-06-07Update utimensat test.Darren Tucker
POSIX specifies that when given a symlink, AT_SYMLINK_NOFOLLOW should update the symlink and not the destination. The compat code doesn't have a way to do this, so where possible it fails instead of following a symlink when explicitly asked not to. Instead of checking for an explicit failure, check that it does not update the destination, which both the real and compat implmentations should honour. Inspired by github pull req #125 from chutzpah at
2019-04-26Don't install duplicate STREAMS modules on SolarisDarren Tucker
Check if STREAMS modules are already installed on pty before installing since when compiling with XPG>=4 they will likely be installed already. Prevents hangs and duplicate lines on the terminal. bz#2945 and bz#2998, patch from djm@
2019-04-03Remove "struct ssh" from sys_auth_record_login.Darren Tucker
It's not needed, and is not available from the call site in loginrec.c Should only affect AIX, spotted by Kevin Brott.
2019-04-02Adapt custom_failed_login to new prototype.Darren Tucker
Spotted by Kevin Brott.
2019-03-31Only use O_NOFOLLOW in fchownat and fchmodat if definedTim Rice
2019-03-28Only use O_NOFOLLOW in utimensat if defined.Darren Tucker
Fixes build on systems that don't have it (Solaris <=9) Found by Tom G. Christensen.
2019-03-13Replace alloca with xcalloc.Darren Tucker
The latter checks for memory exhaustion and integer overflow and may be at a less predictable place. Sanity check by vinschen at, ok djm@
2019-03-12Use Cygwin-specific matching only for users+groups.Darren Tucker
Patch from vinschen at, updated a little by me.
2019-02-22Cygwin: implement case-insensitive Unicode user and group name matchingCorinna Vinschen
The previous revert enabled case-insensitive user names again. This patch implements the case-insensitive user and group name matching. To allow Unicode chars, implement the matcher using wchar_t chars in Cygwin-specific code. Keep the generic code changes as small as possible. Cygwin: implement case-insensitive Unicode user and group name matching Signed-off-by: Corinna Vinschen <>
2019-02-22Revert unintended parts of previous commit.Darren Tucker