Commit Graph

815 Commits

Author SHA1 Message Date
Darren Tucker e0cedcad51 Improve search for 'struct timespec'.
Make struct timespec test consistent with existing timeval test.
Include time.h for timespec in compat header where required.
2020-01-14 14:28:01 +11:00
Darren Tucker 26b2675b0c Remove configure test & compat code for ripemd160.
RIPEMD160 support was removed upstream in 2017, however we still had
a configure test and compat code for it, so clean those up now.
2020-01-14 12:05:00 +11:00
Darren Tucker afffd31036 Check if memmem is declared in system headers.
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.
2019-12-11 13:22:06 +11:00
Damien Miller 443848155f compile sk-dummy.so with no-PIE version of LDFLAGS
This lets it pick up the -L path to libcrypto for example.
2019-11-29 15:10:21 +11:00
Damien Miller b218055e59 (yet) another x-platform fix for sk-dummy.so
Check for -fPIC support from compiler

Compile libopenbsd-compat -fPIC

Don't mix -fPIE and -fPIC when compiling
2019-11-29 12:32:23 +11:00
Damien Miller fbcb9a7fa5 upstream commit
revision 1.48
date: 2019/02/04 16:45:40;  author: millert;  state: Exp;  lines: +16 -17;  commitid: cpNtVC7erojNyctw;
Make gl_pathc, gl_matchc and gl_offs size_t in glob_t to match POSIX.
This requires a libc major version bump.  OK deraadt@
2019-11-15 16:06:30 +11:00
Damien Miller 2cfb11abac upstream commit
revision 1.47
date: 2017/05/08 14:53:27;  author: millert;  state: Exp;  lines: +34 -21;  commitid: sYfxfyUHAfarP8sE;
Fix exponential CPU use with repeated '*' operators by changing '*'
handling to be interative instead of recursive.
Fix by Yves Orton, ported to OpenBSD glob.c by Ray Lai.  OK tb@
2019-11-15 16:05:07 +11:00
Damien Miller 228dd595c7 upstream commit
revision 1.46
date: 2015/12/28 22:08:18;  author: mmcc;  state: Exp;  lines: +5 -9;  commitid: 0uXuF2O13NH9q2e1;
Remove NULL-checks before free() and a few related dead assignments.

ok and valuable input from millert@
2019-11-15 16:04:28 +11:00
Damien Miller a16f748690 upstream commit
revision 1.44
date: 2015/09/14 16:09:13;  author: tedu;  state: Exp;  lines: +3 -5;  commitid: iWfSX2BIn0sLw62l;
remove null check before free. from Michael McConville
ok semarie
2019-11-15 16:02:43 +11:00
Damien Miller fd37cdeafe upstream commit
revision 1.43
date: 2015/06/13 16:57:04;  author: deraadt;  state: Exp;  lines: +4 -4;  commitid: zOUKuqWBdOPOz1SZ;
in glob() initialize the glob_t before the first failure check.
from j@pureftpd.org
ok millert stsp
2019-11-15 16:02:27 +11:00
Damien Miller fd62769c38 upstream commit
revision 1.42
date: 2015/02/05 12:59:57;  author: millert;  state: Exp;  lines: +2 -1;  commitid: DTQbfd4poqBW8iSJ;
Include stdint.h, not limits.h to get SIZE_MAX.  OK guenther@
2019-11-15 16:01:20 +11:00
Damien Miller 2b6cba7ee2 upstream commit
revision 1.41
date: 2014/10/08 05:35:27;  author: deraadt;  state: Exp;  lines: +3 -3;  commitid: JwTGarRLHQKDgPh2;
obvious realloc -> reallocarray conversion
2019-11-15 16:00:07 +11:00
Damien Miller 19f8ec428d upstream commit
revision 1.40
date: 2013/09/30 12:02:34;  author: millert;  state: Exp;  lines: +14 -15;
Use PATH_MAX, NAME_MAX and LOGIN_NAME_MAX not MAXPATHNAMELEN,
MAXNAMLEN or MAXLOGNAME where possible.  OK deraadt@
2019-11-15 15:08:28 +11:00
Damien Miller bb7413db98 upstream commit
revision 1.39
date: 2012/01/20 07:09:42;  author: tedu;  state: Exp;  lines: +4 -4;
the glob stat limit is way too low.  bump to 2048.
while here, failed stats should count against the limit too.
ok deraadt sthen stsp
2019-11-15 15:07:30 +11:00
Darren Tucker 245dcbdca5 Put headers inside ifdef _AIX.
Prevents compile errors due to missing definitions (eg va_list) on
non-AIX platforms.
2019-11-13 11:19:26 +11:00
Darren Tucker 3611bfe89b Define __BSD_VISIBLE in fnmatch.h.
.. since we use symbols defined only when it is when using the compat
fnmatch.
2019-11-02 22:46:22 +11:00
Darren Tucker 0e3c5bc509 Hook up fnmatch for platforms that don't have it. 2019-11-01 18:27:37 +11:00
Darren Tucker b56dbfd9d9 Add missing bracket in realpath macro. 2019-11-01 18:27:37 +11:00
Darren Tucker 59ccb56f15 Import fnmatch.c from OpenBSD. 2019-11-01 18:27:37 +11:00
Darren Tucker 79d46de9fb Use sftp_realpath if no native realpath. 2019-11-01 18:27:37 +11:00
Darren Tucker 5eb7b9563f Add prototype for localtime_r if needed. 2019-11-01 14:41:07 +11:00
Darren Tucker 1bcd1169c5 Add implementation of localtime_r. 2019-10-29 20:48:46 +11:00
Darren Tucker 5fe81da226 Fix ifdefs to not mask needed bits. 2019-10-28 21:19:47 +11:00
Darren Tucker d561b0b2fa Make sure we have struct statfs before using. 2019-10-28 16:27:53 +11:00
Darren Tucker 7169e31121 Move utimensat definition into timespec section.
Since utimensat uses struct timespec, move it to the section where we
define struct timespec when needed.
2019-10-28 16:27:53 +11:00
Darren Tucker 9b9e3ca694 Re-add SA_RESTART to mysignal.
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-11 14:12:16 +11:00
Darren Tucker 0bd312a362 Fix ifdef typo for declaration of memmem.
Fixes build on IRIX.  bz#3081.
2019-10-10 09:42:03 +11:00
Darren Tucker 86a0323374 Make MAKE_CLONE no-op macro more correct.
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-09 09:36:06 +11:00
Damien Miller 13b3369830 avoid "return (value)" in void-declared function
spotted by Tim Rice; ok dtucker
2019-10-08 15:32:02 +11:00
Darren Tucker fbec7dba01 Include stdio.h for snprintf.
Patch from vapier@gentoo.org.
2019-09-30 18:01:12 +10:00
Damien Miller 368f1cc2fb fixed test in OSX closefrom() replacement
from likan_999.student AT sina.com
2019-09-02 10:28:42 +10:00
Damien Miller 6b7c53498d retain Solaris PRIV_FILE_LINK_ANY in sftp-server
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-09-02 10:22:02 +10:00
Damien Miller 28744182cf proc_pidinfo()-based closefrom() for OS X
Refactor closefrom() to use a single brute-force close() loop fallback.

Based on patch from likan_999.student@sina.com in bz#3049. ok dtucker@
2019-08-30 13:23:04 +10:00
Darren Tucker d0e51810f3 Fix pasto in fallback code.
There is no parameter called "pathname", it should simply be "path".
bz#3059, patch from samuel at cendio.se.
2019-08-24 15:12:11 +10:00
Darren Tucker d46075b923 Fix mem leak in unit test.
Patch from jitendra.sharma at intel.com.
2019-08-05 21:36:48 +10:00
Darren Tucker 4317b2a048 upstream rev 1.28: fix comment typo. 2019-07-23 23:24:47 +10:00
Darren Tucker fd0684b319 Remove sys/cdefs.h include.
It's not needed on -portable (that's handled by includes.h) and not all
platforms have it.
2019-07-23 22:36:39 +10:00
Darren Tucker 11cba2a452 Re-apply portability changes to current sha2.{c,h}.
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-23 22:06:24 +10:00
Darren Tucker 09159594a3 Import current sha2.c and sha2.h from OpenBSD.
These are not changed from their original state, the next commit will
re-apply the portable changes.
2019-07-23 22:06:24 +10:00
Damien Miller 01dddb231f fix SIGWINCH delivery of Solaris for mux sessions
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-19 13:22:16 +10:00
Darren Tucker 22b9b3e944 Fix format string integer type in error message. 2019-07-19 07:23:26 +10:00
Darren Tucker 45478898f9 Hook memmem compat code into build.
This fixes builds on platforms that don't have it (at least old DragonFly,
probably others).
2019-07-16 09:21:20 +10:00
Darren Tucker c7bd461729 Import memmem.c from OpenBSD. 2019-07-16 09:07:18 +10:00
Darren Tucker eb0b51dac4 Move log.h include inside ifdefs.
Fixes build on some other platforms that don't have va_list immediately
available (eg NetBSD).
2019-07-08 17:27:26 +10:00
Darren Tucker 43702f8e6f Include log.h for debug() and friends.
Should fix some compiler warnings on IRIX (bz#3032).
2019-07-08 14:27:37 +10:00
Damien Miller 4efe1adf05 remove realpath() compat replacement
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-08 13:38:39 +10:00
Darren Tucker b8e2b79736 Add prototype for strnlen to prevent warnings. 2019-07-06 13:13:57 +10:00
Darren Tucker 4c3e00b1ed Cast *ID types to unsigned long when printing.
UID and GID types vary by platform so cast to u_long and use %lu when
printing them to prevent warnings.
2019-07-06 13:02:34 +10:00
Darren Tucker 2753521e89 Add prototype for compat strndup.(bz#3032). 2019-07-06 12:54:43 +10:00
Darren Tucker 73eb6cef41 Include stdio.h for vsnprintf.
Patch from mforney at mforney.org.
2019-06-16 12:55:27 +10:00