summaryrefslogtreecommitdiff
path: root/openbsd-compat/openbsd-compat.h
Commit message (Collapse)AuthorAgeFilesLines
* Add prototypes for mkstemp replacements.Darren Tucker2023-03-101-0/+1
| | | | Should prevent warnings due to our wrapper function.
* Wrap mkstemp calls with umask set/restore.Darren Tucker2023-03-101-0/+2
| | | | | | glibc versions 2.06 and earlier did not set a umask on files created by mkstemp created the world-writable. Wrap mkstemp to set and restore the umask. From Coverity (CIDs 291826 291886 291891), ok djm@
* Include time.h when defining timegm.Darren Tucker2022-11-031-0/+1
| | | | Fixes build on some platforms eg recent AIX.
* Always use compat getentropy.Darren Tucker2022-11-021-4/+0
| | | | | | Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey.
* Resync arc4random with OpenBSD.Darren Tucker2022-09-021-7/+6
| | | | | | | This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@.
* Add a timegm implementation from Heimdal via Samba.Darren Tucker2022-08-111-0/+4
| | | | Fixes build on (at least Solaris 10).
* Rename our getentropy to prevent possible loops.Darren Tucker2022-08-101-1/+1
| | | | | | | | Since arc4random seeds from getentropy, and we use OpenSSL for that if enabled, there's the possibility that if we build on a system that does not have getentropy then run on a system that does have it, then OpenSSL could end up calling our getentropy and getting stuck in a loop. Pointed out by deraadt@, ok djm@
* Give unused param a name.Darren Tucker2022-08-081-1/+1
| | | | | Fixes builds on platforms that do have fido2 but don't have fido_dev_is_winhello.
* Factor out getrnd() and rename to getentropy().Darren Tucker2022-08-051-0/+4
| | | | | | | Factor out the arc4random seeding into its own file and change the interface to match getentropy. Use native getentropy if available. This will make it easier to resync OpenBSD changes to arc4random. Prompted by bz#3467, ok djm@.
* Provide killpg implementation.Darren Tucker2022-03-091-0/+4
| | | | Based on github PR#301 for Tandem NonStop.
* Check for missing ftruncate prototype.Darren Tucker2022-03-091-0/+4
| | | | From github PR#301 in conjunction with rsbeckerca.
* sync bcrypt-related files with OpenBSDDamien Miller2021-11-291-2/+2
| | | | | | | | The main change is that Niels Provos kindly agreed to rescind the BSD license advertising clause, shifting them to the 3-term BSD license. This was the last thing in OpenSSH that used the advertising clause.
* openbsd-compat/openbsd-compat.h: put bsd-signal.h before bsd-misc.hTim Rice2021-08-141-1/+1
| | | | to get sigset_t from signal.h needed for the pselect replacement.
* Include login_cap.h for login_getpwclass override.Darren Tucker2021-05-271-0/+1
| | | | | | On minix3, login_getpwclass is __RENAME'ed to __login_getpwclass50 so without this the include overriding login_getpwclass causes a compile error.
* prefer login_getpwclass() to login_getclass()Damien Miller2021-02-181-0/+4
| | | | | | | | FreeBSD has login_getpwclass() that does some special magic for UID=0. Prefer this to login_getclass() as its easier to emulate the former with the latter. Based on FreeBSD PR 37416 via Ed Maste; ok dtucker@
* Remove checks for strict POSIX mkdtemp()Damien Miller2020-10-271-1/+1
| | | | | | | We needed a mkdtemp() that accepted template paths that did not end in XXXXXX a long time ago for KRB4, but that code is long deprecated. We no longer need to replace mkdtemp() for strictly following POSIX. ok dtucker@
* Check if getpeereid is actually declared.Darren Tucker2020-02-171-1/+1
| | | | | Check in sys/socket.h (AIX) and unistd.h (FreeBSD, DragonFLy and OS X). Prevents undeclared function warning on at least some versions of AIX.
* Remove configure test & compat code for ripemd160.Darren Tucker2020-01-141-1/+0
| | | | | RIPEMD160 support was removed upstream in 2017, however we still had a configure test and compat code for it, so clean those up now.
* Check if memmem is declared in system headers.Darren Tucker2019-12-111-1/+1
| | | | | | If the system (or one of the dependencies) implements memmem but does not define the header, we would not declare it either resulting in compiler warnings. Check for declaration explicitly. bz#3102.
* Hook up fnmatch for platforms that don't have it.Darren Tucker2019-11-011-0/+1
|
* Add prototype for localtime_r if needed.Darren Tucker2019-11-011-0/+4
|
* Fix ifdef typo for declaration of memmem.Darren Tucker2019-10-101-1/+1
| | | | Fixes build on IRIX. bz#3081.
* Hook memmem compat code into build.Darren Tucker2019-07-161-0/+4
| | | | | This fixes builds on platforms that don't have it (at least old DragonFly, probably others).
* remove realpath() compat replacementDamien Miller2019-07-081-12/+0
| | | | | | | | | | | | 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@
* Add prototype for strnlen to prevent warnings.Darren Tucker2019-07-061-0/+4
|
* Add prototype for compat strndup.(bz#3032).Darren Tucker2019-07-061-0/+4
|
* Include stdio.h for FILE if needed.Darren Tucker2018-11-251-0/+1
|
* Add implementation of getline.Darren Tucker2018-07-021-0/+4
| | | | | | Add getline for the benefit of platforms that don't have it. Sourced from NetBSD (OpenBSD's implementation is a little too chummy with the internals of FILE).
* Add prototype for readv if needed.Darren Tucker2018-02-261-1/+9
|
* Remove UNICOS support.Darren Tucker2018-02-151-1/+0
| | | | | | | The code required to support it is quite invasive to the mainline code that is synced with upstream and is an ongoing maintenance burden. Both the hardware and software are literal museum pieces these days and we could not find anyone still running OpenSSH on one.
* Move signal compat code into bsd-signal.{c,h}Darren Tucker2018-02-111-0/+1
|
* rename port-tun.[ch] => port-net.[ch]Damien Miller2017-10-251-1/+1
| | | | Ahead of adding rdomain support
* add freezero(3) replacementDamien Miller2017-09-191-0/+4
| | | | ok dtucker@
* add recallocarray replacement and dependencyDamien Miller2017-06-011-0/+8
| | | | recallocarray() needs getpagesize() so add a tiny replacement for that.
* Remove commented-out includes.Darren Tucker2016-12-131-5/+0
| | | | | These commented-out includes have "Still needed?" comments. Since they've been commented out for ~13 years I assert that they're not.
* Add prototype for strcasestr in compat library.Darren Tucker2016-12-131-0/+4
|
* Remove portability support for mmapDamien Miller2016-09-291-1/+0
| | | | | We no longer need to wrap/replace mmap for portability now that pre-auth compression has been removed from OpenSSH.
* Remove obsolete CVS $Id from source files.Darren Tucker2016-08-171-2/+0
| | | | | Since -portable switched to git the CVS $Id tags are no longer being updated and are becoming increasingly misleading. Remove them.
* Strip trailing whitespace.Darren Tucker2016-08-021-7/+7
| | | | | Mechanically strip trailing whitespace on files not synced with OpenBSD (or in the case of bsd-snprint.c, rsync).
* Move VA_COPY macro into compat header.Darren Tucker2016-07-151-0/+17
| | | | | | | | Some AIX compilers unconditionally undefine va_copy but don't set it back to an internal function, causing link errors. In some compat code we already use VA_COPY instead so move the two existing instances into the shared header and use for sshbuf-getput-basic.c too. Should fix building with at lease some versions of AIX's compiler. bz#2589, ok djm@
* Add compat code for missing wcwidth.Darren Tucker2016-07-141-0/+18
| | | | | If we don't have wcwidth force fallback implementations of nl_langinfo and mbtowc. Based on advice from Ingo Schwarze.
* Revert "stub for pledge(2) for systems that lack it"Damien Miller2015-11-301-4/+0
| | | | | | This reverts commit 14c887c8393adde2d9fd437d498be30f8c98535c. dtucker beat me to it :/
* stub for pledge(2) for systems that lack itDamien Miller2015-11-301-0/+4
|
* Prevent name collisions with system glob (bz#2463)Darren Tucker2015-10-291-1/+0
| | | | | | | Move glob.h from includes.h to the only caller (sftp) and override the names for the symbols. This prevents name collisions with the system glob in the case where something other than ssh uses it (eg kerberos). With jjelen at redhat.com, ok djm@
* Check if realpath works on nonexistent files.Darren Tucker2015-07-171-1/+9
| | | | | | | | | | | | | On some platforms the native realpath doesn't work with non-existent files (this is actually specified in some versions of POSIX), however the sftp spec says its realpath with "canonicalize any given path name". On those platforms, use realpath from the compat library. In addition, when compiling with -DFORTIFY_SOURCE, glibc redefines the realpath symbol to the checked version, so redefine ours to something else so we pick up the compat version we want. bz#2428, ok djm@
* Put brackets around mblen() compat constant.Darren Tucker2015-05-081-1/+1
| | | | | | This might help with the reported problem cross compiling for Android ("error: expected identifier or '(' before numeric constant") but shouldn't hurt in any case.
* support --without-openssl at configure timeDamien Miller2015-01-151-0/+3
| | | | | | | | Disables and removes dependency on OpenSSL. Many features don't work and the set of crypto options is greatly restricted. This will only work on system with native arc4random or /dev/urandom. Considered highly experimental for now.
* Add reallocarray to compat libraryDarren Tucker2014-12-101-0/+4
|
* - (djm) [openbsd-compat/Makefile.in openbsd-compat/kludge-fd_set.c]Damien Miller2014-10-011-1/+17
| | | | | | [openbsd-compat/openbsd-compat.h] Kludge around bad glibc _FORTIFY_SOURCE check that doesn't grok heap-allocated fd_sets; ok dtucker@
* - tedu@cvs.openbsd.org 2014/01/31 16:39:19Damien Miller2014-02-041-1/+5
| | | | | | | | | | [auth2-chall.c authfd.c authfile.c bufaux.c bufec.c canohost.c] [channels.c cipher-chachapoly.c clientloop.c configure.ac hostfile.c] [kexc25519.c krl.c monitor.c sandbox-systrace.c session.c] [sftp-client.c ssh-keygen.c ssh.c sshconnect2.c sshd.c sshlogin.c] [openbsd-compat/explicit_bzero.c openbsd-compat/openbsd-compat.h] replace most bzero with explicit_bzero, except a few that cna be memset ok djm dtucker