Commit Graph

868 Commits

Author SHA1 Message Date
Damien Miller a5ab488234 remove built-in support for md5crypt()
Users of MD5-hashed password should arrange for ./configure to link
against libxcrypt or similar. Though it would be better to avoid use
of MD5 password hashing entirely, it's arguably worse than DEScrypt.

feedback and ok dtucker@
2021-10-28 16:16:13 +11:00
Darren Tucker 207648d7a6 Include stdlib.h for arc4random_uniform prototype. 2021-09-29 20:03:58 +10:00
Darren Tucker b6255593ed Increment nfds when coming from startup_pipe.
If we have to increase nfds because startup_pipe[0] is above any of the
descriptors passed in the fd_sets, we also need to add 1 to nfds since
select takes highest FD number plus one.  bz#3345 from yaroslav.kuzmin
at vmssoftware.com.
2021-09-08 18:39:44 +10:00
Darren Tucker 9a2ed62173 Also check pid in pselect_notify_setup.
Spotted by djm@.
2021-08-20 10:48:13 +10:00
Darren Tucker deaadcb93c Prefix pselect functions to clarify debug messages 2021-08-20 08:39:33 +10:00
Darren Tucker 10e45654cf Fix race in pselect replacement code.
On the second and subsequent calls to pselect the notify_pipe was not
added to the select readset, opening up a race that om G. Christensen
discovered on multiprocessor Solaris <=9 systems.

Also reinitialize notify_pipe if the pid changes.  This will prevent a
parent and child from using the same FD, although this is not an issue
in the current structure it might be in future.
2021-08-20 08:30:42 +10:00
Tim Rice e65198e52c openbsd-compat/openbsd-compat.h: put bsd-signal.h before bsd-misc.h
to get sigset_t from signal.h needed for the pselect replacement.
2021-08-14 13:08:07 -07:00
Darren Tucker 419aa01123 Add includes.h to compat tests.
On platforms where closefrom returns void (eg glibc>=2.34) the prototype
for closefrom in its compat tests would cause compile errors.  Remove
this and have the tests pull in the compat headers in the same way as
the main code.  bz#3336.
2021-08-11 09:21:09 +10:00
Darren Tucker 0f494236b4 lastenv is only used in setenv.
Prevents an unused variable warning on platforms that have setenv but
not unsetenv.
2021-07-27 17:45:34 +10:00
Darren Tucker f841fc9c8c Fix ifdefs around get_random_bytes_prngd.
get_random_bytes_prngd() is used if either of PRNGD_PORT or PRNGD_SOCKET
are defined, so adjust ifdef accordingly.
2021-07-02 15:20:32 +10:00
Damien Miller 0767627cf6 wrap get_random_bytes_prngd() in ifdef
avoid unused static function warning
2021-07-02 14:30:23 +10:00
Darren Tucker e409d79667 Try EGD/PRNGD if random device fails.
When built --without-openssl, try EGD/PRGGD (if configured) as a last
resort before failing.
2021-06-18 19:32:11 +10:00
Darren Tucker e43a898043 Split EGD/PRNGD interface into its own file.
This will allow us to use it when building --without-openssl.
2021-06-18 18:32:51 +10:00
Darren Tucker acb2887a76 Handle GIDs > 2^31 in getgrouplist.
When compiled in 32bit mode, the getgrouplist implementation may fail
for GIDs greater than LONG_MAX.  Analysis and change from ralf.winkel
at tui.com.
2021-06-17 21:03:19 +10:00
Darren Tucker aa99b2d9a3 Clear notify_pipe from readset if present.
Prevents leaking an implementation detail to the caller.
2021-06-04 23:41:29 +10:00
Darren Tucker 6de8dadf6b space->tabs. 2021-06-04 23:24:25 +10:00
Darren Tucker c867706507 Add pselect implementation for platforms without.
This is basically the existing notify_pipe kludge from serverloop.c
moved behind a pselect interface.  It works by installing a signal
handler that writes to a pipe that the select is watching, then calls
the original handler.

The select call in serverloop will become pselect soon, at which point the
kludge will be removed from thereand will only exist in the compat layer.
Original code by markus, help from djm.
2021-06-04 18:39:48 +10:00
Darren Tucker eb68e669bc Include login_cap.h for login_getpwclass override.
On minix3, login_getpwclass is __RENAME'ed to __login_getpwclass50 so
without this the include overriding login_getpwclass causes a compile
error.
2021-05-27 21:14:15 +10:00
Darren Tucker a6b4ec94e5 Add OPENBSD ORIGINAL marker. 2021-04-24 17:52:24 +10:00
Darren Tucker 80032102d0 ifdef out MIN and MAX.
In -portable, defines.h ensures that these are defined, so redefining
potentially causes a warning.  We don't just delete it to make any
future code syncs a little but easier.  bz#3293.
2021-04-08 13:25:57 +10:00
Damien Miller 57ed647ee0 polish whitespace for portable files 2021-04-03 17:47:37 +11:00
Darren Tucker 1cd67ee15c Move generic includes outside of ifdef.
This ensures that the macros in log.h are defined in the case where
either of --with-solaris-projects or --with-solaris-privs are used
without --with-solaris-contracts.  bz#3278.
2021-03-12 13:16:10 +11:00
Damien Miller 324449a68d support OpenSSL 3.x cipher IV API change
OpenSSL renamed the "get current CIPHER_CTX" IV operation in 3.x.
This uses the new name if available.

https://github.com/openssl/openssl/issues/13411

bz#3238 ok dtucker@
2021-02-18 12:06:25 +11:00
Damien Miller 845fe9811c prefer login_getpwclass() to login_getclass()
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@
2021-02-18 11:27:09 +11:00
David Carlier 1cb6ce98d6 Using explicit_memset for the explicit_bzero compatibility layer.
Favoriting the native implementation in this case.
2021-02-05 17:07:03 +11:00
Darren Tucker 0f2e21c9dc Include stdio.h for FILE in misc.h.
Fixes build on at least OpenBSD.
2020-12-22 18:56:54 +11:00
Damien Miller e51dc7fab6 SELinux has deprecated security_context_t
(it was only ever a char* anyway)
2020-11-13 13:46:28 +11:00
Damien Miller 33267feaff Remove checks for strict POSIX mkdtemp()
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@
2020-10-27 16:50:38 +11:00
Damien Miller f9ea651520 logging is now macros, remove function pointers 2020-10-17 11:51:20 +11:00
Damien Miller 86cc8ce002 use relative rather than system include here 2020-10-03 13:39:17 +10:00
Darren Tucker 05c215de8d Wrap stdint.h include in ifdef HAVE_STDINT_H. 2020-08-17 21:34:32 +10:00
Damien Miller eaf2765efe sync memmem.c with OpenBSD 2020-08-10 13:24:20 +10:00
Damien Miller 32c63e75a7 wrap a declaration in the same ifdefs as its use
avoids warnings on NetBSD
2020-08-04 14:59:21 +10:00
Damien Miller c9e3be9f4b undef TAILQ_CONCAT and friends
Needed for NetBSD. etc that supply these macros
2020-08-04 14:58:46 +10:00
Damien Miller adfdbf1211 sync sys-queue.h with OpenBSD upstream
needed for TAILQ_CONCAT
2020-07-03 15:15:15 +10:00
Darren Tucker b4556c8ad7 Add OPENBSD ORIGINAL marker to bcrypt_pbkdf. 2020-06-19 19:22:00 +10:00
Darren Tucker 1babb8bb14 Extra brackets around sizeof() in bcrypt.
Prevents following warning from clang 10:
bcrypt_pbkdf.c:94:40: error: expression does not compute the number of
  elements in this array; element type is ´uint32_tÂ[...]
  place parentheses around the ´sizeof(uint64_t)´ expression to
  silence this warning
2020-06-19 19:10:47 +10:00
Darren Tucker 8854724cce Sync rev 1.49.
Prevent infinite for loop since i went from ssize_t to size_t.  Patch from
eagleoflqj via OpenSSH github PR#178, ok djm@, feedback & ok millert@
2020-04-21 18:28:19 +10:00
Damien Miller 931c50c588 fix inverted test for LibreSSL version 2020-04-06 10:04:56 +10:00
Damien Miller abe2b245b3 prefer libcrypto chacha20-poly1305 where possible 2020-04-03 17:26:29 +11:00
Damien Miller 955c4cf4c6 sync fnmatch.c with upstream to fix another typo 2020-03-13 14:30:16 +11:00
Damien Miller 397f217e86 another spelling error in comment 2020-03-13 14:24:23 +11:00
Damien Miller def31bc542 spelling mistakes
from https://fossies.org/linux/misc/openssh-8.2p1.tar.gz/codespell.html
2020-03-13 14:23:07 +11:00
Darren Tucker 31c9348c5e Constify aix_krb5_get_principal_name.
Prevents warning about discarding type qualifiers on AIX.
2020-02-17 22:53:24 +11:00
Darren Tucker 290c994336 Check if TILDE is already defined and undef.
Prevents redefinition warning on AIX.
2020-02-17 22:51:36 +11:00
Darren Tucker 41a2e64ae4 Prevent unused variable warning. 2020-02-17 22:51:00 +11:00
Darren Tucker d4860ec4ef Check if getpeereid is actually declared.
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.
2020-02-17 22:48:50 +11:00
Michael Forney 9716e8c495 Fix sha2 MAKE_CLONE no-op definition
The point of the dummy declaration is so that MAKE_CLONE(...) can have
a trailing semicolon without introducing an empty declaration. So,
the macro replacement text should *not* have a trailing semicolon,
just like DEF_WEAK.
2020-02-06 11:53:38 +11:00
Darren Tucker 0373f9eba2 Include signal.h to prevent redefintion of _NSIG. 2020-01-26 14:09:17 +11:00
Damien Miller e1e97cae19 include tunnel device path in error message 2020-01-25 16:30:22 +11:00