Commit Graph

637 Commits

Author SHA1 Message Date
Darren Tucker 627824480c Include priv.h for priv_set_t.
From alex at cooperi.net.
2016-03-11 14:47:41 +11:00
Darren Tucker 907091acb1 Make Solaris privs code build on older systems.
Not all systems with Solaris privs have priv_basicset so factor that
out and provide backward compatibility code.  Similarly, not all have
PRIV_NET_ACCESS so wrap that in #ifdef.  Based on code from
alex at cooperi.net and djm@ with help from carson at taltos.org and
wieland at purdue.edu.
2016-02-19 09:05:39 +11:00
Darren Tucker 60d860e54b Rollback addition of va_start.
va_start was added in 0f754e29dd, however
it has the wrong number of args and it's not usable in non-variadic
functions anyway so it breaks things (for example Solaris 2.6 as
reported by Tom G. Christensen).i  ok djm@
2016-02-17 13:37:09 +11:00
Damien Miller 4626cbaf78 Support Illumos/Solaris fine-grained privileges
Includes a pre-auth privsep sandbox and several pledge()
emulations. bz#2511, patch by Alex Wilson.

ok dtucker@
2016-01-08 14:29:12 +11:00
Damien Miller f0191d7c8e Revert "stub for pledge(2) for systems that lack it"
This reverts commit 14c887c839.

dtucker beat me to it :/
2015-11-30 10:53:25 +11:00
Damien Miller 14c887c839 stub for pledge(2) for systems that lack it 2015-11-30 09:45:54 +11:00
Darren Tucker 3ddd15e1b6 Add a null implementation of pledge.
Fixes builds on almost everything.
2015-11-30 07:23:53 +11:00
Darren Tucker 8db134e7f4 Prevent name collisions with system glob (bz#2463)
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@
2015-10-29 10:48:23 +11:00
Damien Miller 0f754e29dd need va_copy before va_start
reported by Nicholas Lemonias
2015-10-16 10:53:38 +11:00
Damien Miller eb6c50d82a fix compilation on systems without SYMLOOP_MAX 2015-10-15 15:48:28 -07:00
Damien Miller 8f22911027 upstream commit
revision 1.20
date: 2015/10/13 20:55:37;  author: millert;  state: Exp;  lines: +2 -2;  commitid: X39sl5ay1czgFIgp;
In rev 1.15 the sizeof argument was fixed in a strlcat() call but
the truncation check immediately following it was not updated to
match.  Not an issue in practice since the buffers are the same
size.  OK deraadt@
2015-10-14 08:28:19 +11:00
Damien Miller 23fa695bb7 upstream commit
revision 1.19
date: 2015/01/16 16:48:51;  author: deraadt;  state: Exp;  lines: +3 -3;  commitid: 0DYulI8hhujBHMcR;
Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther
2015-10-14 08:27:51 +11:00
Damien Miller c71be375a6 upstream commit
revision 1.18
date: 2014/10/19 03:56:28;  author: doug;  state: Exp;  lines: +9 -9;  commitid: U6QxmtbXrGoc02S5;
Revert last commit due to changed semantics found by make release.
2015-10-14 08:27:08 +11:00
Damien Miller c39ad23b06 upstream commit
revision 1.17
date: 2014/10/18 20:43:52;  author: doug;  state: Exp;  lines: +10 -10;  commitid: I74hI1tVZtsspKEt;
Better POSIX compliance in realpath(3).

millert@ made changes to realpath.c based on FreeBSD's version.  I merged
Todd's changes into dl_realpath.c.

ok millert@, guenther@
2015-10-14 08:26:24 +11:00
Damien Miller e929a43f95 upstream commit
revision 1.16
date: 2013/04/05 12:59:54;  author: kurt;  state: Exp;  lines: +3 -1;
- Add comments regarding copies of these files also in libexec/ld.so
okay guenther@
2015-10-14 08:25:55 +11:00
Damien Miller 5225db68e5 upstream commit
revision 1.15
date: 2012/09/13 15:39:05;  author: deraadt;  state: Exp;  lines: +2 -2;
specify the bounds of the dst to strlcat (both values were static and
equal, but it is more correct)
from Michal Mazurek
2015-10-14 08:25:32 +11:00
Damien Miller 7365fe5b48 upstream commit
revision 1.14
date: 2011/07/24 21:03:00;  author: miod;  state: Exp;  lines: +35 -13;
Recent Single Unix will malloc memory if the second argument of realpath()
is NULL, and third-party software is starting to rely upon this.
Adapted from FreeBSD via Jona Joachim (jaj ; hcl-club , .lu), with minor
tweaks from nicm@ and yours truly.
2015-10-14 08:25:09 +11:00
Damien Miller 189de02d9a expose POLLHUP and POLLNVAL for netcat.c 2015-08-21 15:45:02 +10:00
Damien Miller 0c30ba91f8 downgrade OOM adjustment logging: verbose -> debug 2015-07-30 12:32:42 +10:00
Damien Miller d56fd18280 make realpath.c compile -Wsign-compare clean 2015-07-20 11:19:51 +10:00
Darren Tucker d3e2aee414 Check if realpath works on nonexistent files.
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@
2015-07-17 12:58:02 +10:00
Darren Tucker d7a58bbac6 Replace strcpy with strlcpy.
ok djm, sanity check by Corinna Vinschen.
2015-06-02 20:15:26 +10:00
Damien Miller d028d5d3a6 upstream commit
- tedu@cvs.openbsd.org 2015/01/12 03:20:04
     [bcrypt_pbkdf.c]
     rename blocks to words. bcrypt "blocks" are unrelated to blowfish blocks,
     nor are they the same size.
2015-05-10 11:57:31 +10:00
Damien Miller f6391d4e59 upstream commit
- deraadt@cvs.openbsd.org 2015/01/08 00:30:07
     [bcrypt_pbkdf.c]
     declare a local version of MIN(), call it MINIMUM()
2015-05-10 11:57:27 +10:00
Damien Miller 8ac6b13cc9 upstream commit
- djm@cvs.openbsd.org 2014/12/30 01:41:43
     [bcrypt_pbkdf.c]
     typo in comment: ouput => output
2015-05-10 11:57:23 +10:00
Darren Tucker a647b9b8e6 Put brackets around mblen() compat constant.
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.
2015-05-08 11:07:27 +10:00
Darren Tucker ee15d9c9f0 Wrap endian.h include inside ifdef (bz#2370). 2015-04-17 10:40:23 +10:00
Darren Tucker e7bf3a5eda Use do{}while(0) for no-op functions.
From FreeBSD.
2015-04-07 10:48:04 +10:00
Darren Tucker bb99844aba Wrap blf.h include in ifdef. From FreeBSD. 2015-04-07 10:47:15 +10:00
Darren Tucker 678e473e2a Remove dependency on xmalloc.
Remove ssh_get_progname's dependency on xmalloc, which should reduce
link order problems.  ok djm@
2015-02-26 04:12:58 +11:00
Darren Tucker 1734e276d9 Move definition of _NSIG.
_NSIG is only unsed in one file, so move it there prevent redefinition
warnings reported by Kevin Brott.
2015-02-25 13:40:45 +11:00
Darren Tucker c9c88355c6 Add AI_NUMERICSERV to fake-rfc2553.
Our getaddrinfo implementation always returns numeric values already.
2015-02-24 13:43:57 +11:00
Darren Tucker 37f9220db8 Wrap stdint.h includes in ifdefs. 2015-02-23 03:07:24 +11:00
Damien Miller bc42cc6fe7 kludge around tun API mismatch betterer 2015-01-15 03:08:29 +11:00
Damien Miller 0cdc5a3eb6 unbreak across API change 2015-01-15 02:35:33 +11:00
Damien Miller 72ef7c148c support --without-openssl at configure time
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.
2015-01-15 02:28:36 +11:00
Damien Miller 81bfbd0bd3 support --without-openssl at configure time
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.
2015-01-14 21:48:18 +11:00
Damien Miller 462082eacb avoid uninitialised free of ldns_res
If an invalid rdclass was passed to getrrsetbyname() then
this would execute a free on an uninitialised pointer.
OpenSSH only ever calls this with a fixed and valid rdclass.

Reported by Joshua Rogers
2014-12-30 08:16:11 +11:00
Damien Miller 01b6349880 pull updated OpenBSD BCrypt PBKDF implementation
Includes fix for 1 byte output overflow for large key length
requests (not reachable in OpenSSH).

Pointed out by Joshua Rogers
2014-12-29 18:10:18 +11:00
Damien Miller 7de5991aa3 upstream libc change
revision 1.2
date: 2014/12/08 03:45:00;  author: bcook;  state: Exp;  lines: +2 -2;  commitid: 7zWEBgJJOCZ2hvTV;
avoid left shift overflow in reallocarray.

Some 64-bit platforms (e.g. Windows 64) have a 32-bit long. So, shifting
1UL 32-bits to the left causes an overflow. This replaces the constant 1UL with
(size_t)1 so that we get the correct constant size for the platform.

discussed with tedu@ & deraadt@
2014-12-18 11:44:06 +11:00
Darren Tucker 642652d280 Add reallocarray to compat library 2014-12-10 01:32:23 +11:00
Damien Miller 703b98a267 - (djm) [openbsd-compat/Makefile.in openbsd-compat/kludge-fd_set.c]
[openbsd-compat/openbsd-compat.h] Kludge around bad glibc
   _FORTIFY_SOURCE check that doesn't grok heap-allocated fd_sets;
   ok dtucker@
2014-10-01 09:43:07 +10:00
Damien Miller 2a8699f37c - (djm) [openbsd-compat/arc4random.c] Zero seed after keying PRNG 2014-09-04 03:46:05 +10:00
Damien Miller d7c81e216a - (djm) [openbsd-compat/openssl-compat.h] add include guard 2014-08-30 04:18:28 +10:00
Damien Miller 51c77e2922 - (djm) [openbsd-compat/openssl-compat.h] add
OPENSSL_[RD]SA_MAX_MODULUS_BITS defines for OpenSSL that lacks them
2014-08-30 02:30:30 +10:00
Damien Miller 3d673d103b - (djm) [openbsd-compat/explicit_bzero.c] implement explicit_bzero()
using memset_s() where possible; improve fallback to indirect bzero
   via a volatile pointer to give it more of a chance to avoid being
   optimised away.
2014-08-27 06:32:01 +10:00
Damien Miller 4d69aeabd6 - (djm) [openbsd-compat/bsd-snprintf.c] Fix compilation failure (prototype/
definition mismatch) and warning for broken/missing snprintf case.
2014-08-22 17:48:27 +10:00
Darren Tucker 5573171352 - (dtucker) [cipher.c openbsd-compat/openssl-compat.h] Restore the bits
needed to build AES CTR mode against OpenSSL 0.9.8f and above.  ok djm
2014-07-21 02:24:59 +10:00
Tim Rice 74e2868271 - (tim) [openbsd-compat/port-uw.c] Include misc.h for fwd_opts, used
in servconf.h.
2014-07-18 20:00:11 -07:00
Damien Miller 8668706d0f - djm@cvs.openbsd.org 2014/06/24 01:13:21
[Makefile.in auth-bsdauth.c auth-chall.c auth-options.c auth-rsa.c
     [auth2-none.c auth2-pubkey.c authfile.c authfile.h cipher-3des1.c
     [cipher-chachapoly.c cipher-chachapoly.h cipher.c cipher.h
     [digest-libc.c digest-openssl.c digest.h dns.c entropy.c hmac.h
     [hostfile.c key.c key.h krl.c monitor.c packet.c rsa.c rsa.h
     [ssh-add.c ssh-agent.c ssh-dss.c ssh-ecdsa.c ssh-ed25519.c
     [ssh-keygen.c ssh-pkcs11-client.c ssh-pkcs11-helper.c ssh-pkcs11.c
     [ssh-rsa.c sshbuf-misc.c sshbuf.h sshconnect.c sshconnect1.c
     [sshconnect2.c sshd.c sshkey.c sshkey.h
     [openbsd-compat/openssl-compat.c openbsd-compat/openssl-compat.h]
     New key API: refactor key-related functions to be more library-like,
     existing API is offered as a set of wrappers.

     with and ok markus@

     Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
     Dempsky and Ron Bowes for a detailed review a few months ago.

     NB. This commit also removes portable OpenSSH support for OpenSSL
     <0.9.8e.
2014-07-02 15:28:02 +10:00