Commit Graph

132 Commits

Author SHA1 Message Date
Francois Perrad
01415ef826 const parameter mp_int 2022-12-22 10:19:54 +01:00
Matt Johnston
ec2215726c Fix y2038 issues with time_t conversion
These changes were identified by building with and without
-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64
on 32-bit arm, logging warnings to files.
-Wconversion was added to CFLAGS in both builds.

Then a "diff -I Wconversion log1 log2" shows new warnings that appear
with the 64-bit time_t. There are a few false positives that have been
fixed for quietness.

struct logininfo and struct wtmp are still problematic, those will
need to be handled by libc.
2022-12-01 13:40:13 +08:00
Matt Johnston
ac2433cb8d Add m_snprintf() that won't return negative 2022-04-01 12:10:48 +08:00
Matt Johnston
02a8c6cadd Fix C99 comment 2022-03-30 14:28:59 +08:00
Matt Johnston
85f56f438a Fix tilde expansion of paths
(Part was missed from previous series of commits)
2022-03-30 14:08:15 +08:00
Matt Johnston
bceba1f2ed Only set soft core limit not hard limit
Otherwise child shells can't enable coredumps if desired.

Fixes #145 on github
2022-03-24 14:18:45 +08:00
Matt Johnston
9411bc21a8 Fix building with DEBUG_TRACE = 0
Also try a less repetitive way of specifying macros
2022-03-22 23:29:38 +08:00
HansH111
9ea30b8932 Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2. 2022-03-19 09:01:05 +00:00
Matt Robinson
742e296115
Use HOME before /etc/passwd to find id_dropbear (#137)
Currently dbclient uses the value of HOME by default when looking for
~/.ssh/known_hosts, falling back to /etc/passwd if HOME is not set (so
that people can work around broken values in /etc/passwd).

However, when locating the default authentication key (defaults to
~/.ssh/id_dropbear), paths not starting with / are always prefixed with
the value from /etc/passwd.

Make the behaviour consistent by adjusting expand_homedir_path to use
the value of HOME, falling back to /etc/passwd if HOME is not set.
2021-10-19 13:02:47 +08:00
Matt Johnston
a7ef149463 Bring back recently removed channel->flushing
This resolves the "sleep 10&echo hello" case which should
return immediately
2021-10-14 20:55:15 +08:00
Matt Johnston
110b55214b Partial strings from strtoul should return error 2021-10-12 23:31:09 +08:00
Matt Johnston
acd6a22a0c Print ascii in printhex too 2020-10-26 22:51:44 +08:00
Matt Johnston
cc1b07dcf1 Make wrapfd share a common buffer for all FDs
--HG--
branch : fuzz
2020-10-15 22:46:24 +08:00
Matt Johnston
02ffdd09dc - Add adaptive authentication failure delay
- Rework monotonic_now/gettime_wrapper and use clock_gettime on more platforms
2018-11-05 23:36:34 +08:00
François Perrad
257bba00ac some linting after fuzz merge (#60)
* fix prototype

* remove extra comma

* use m_free after m_strdup
2018-03-03 11:06:45 +08:00
Matt Johnston
5f2447edbb Fix to be able to compile normal(ish) binaries with --enable-fuzz
--HG--
branch : fuzz
2018-02-28 22:02:12 +08:00
Matt Johnston
c658b275fd - #if not #ifdef for DROPBEAR_FUZZ
- fix some unused variables

--HG--
branch : fuzz
2018-02-28 21:40:08 +08:00
Matt Johnston
7e8094d53a merge from main
--HG--
branch : fuzz
2018-02-17 19:29:51 +08:00
Michael Witten
3ee685ad1c options: Complete the transition to numeric toggles (`#if')
For the sake of review, this commit alters only the code; the affiliated
comments within the source files also need to be updated, but doing so
now would obscure the operational changes that have been made here.

* All on/off options have been switched to the numeric `#if' variant;
  that is the only way to make this `default_options.h.in' thing work
  in a reasonable manner.

* There is now some very minor compile-time checking of the user's
  choice of options.

* NO_FAST_EXPTMOD doesn't seem to be used, so it has been removed.

* ENABLE_USER_ALGO_LIST was supposed to be renamed DROPBEAR_USER_ALGO_LIST,
  and this commit completes that work.

* DROPBEAR_FUZZ seems to be a relatively new, as-yet undocumented option,
  which was added by the following commit:

    commit 6e0b539e9c
    Author: Matt Johnston <matt@ucc.asn.au>
    Date:   Tue May 23 22:29:21 2017 +0800

        split out checkpubkey_line() separately

  It has now been added to `sysoptions.h' and defined as `0' by default.

* The configuration option `DROPBEAR_PASSWORD_ENV' is no longer listed in
  `default_options.h.in'; it is no longer meant to be set by the user, and
  is instead left to be defined in `sysoptions.h' (where it was already being
  defined) as merely the name of the environment variable in question:

    DROPBEAR_PASSWORD

  To enable or disable use of that environment variable, the user must now
  toggle `DROPBEAR_USE_DROPBEAR_PASSWORD'.

* The sFTP support is now toggled by setting `DROPBEAR_SFTPSERVER', and the
  path of the sFTP server program is set independently through the usual
  SFTPSERVER_PATH.
2018-02-16 23:13:47 +08:00
Matt Johnston
f581ef9453 define CLOCK_MONOTONIC if needed 2018-02-08 22:07:59 +08:00
Matt Johnston
e64e25e4d6 Merge pull request #49 from fperrad/20170812_lint
Some linting, const parameters
2018-01-25 21:55:25 +08:00
Matt Johnston
597f7eb5e9 merge up to date
--HG--
branch : fuzz
2018-01-23 22:46:07 +08:00
Matt Johnston
fa3b0dd3ca test close < 0, from Marco Wenzel 2017-10-18 22:41:27 +08:00
Francois Perrad
598056d168 Pointer parameter could be declared as pointing to const (callback) 2017-08-19 22:39:53 +02:00
Matt Johnston
17a9b8802f fix dss debug printing
--HG--
branch : fuzz
2017-06-24 10:34:58 +08:00
Matt Johnston
81b64ea0b5 Add a flag whether to longjmp, missed that last commit
--HG--
branch : fuzz
2017-06-01 21:30:26 +08:00
Matt Johnston
4d07aa315b Disable setnonblocking(), get_socket_address(), set_sock_priority()
for fuzzing

--HG--
branch : fuzz
2017-05-26 22:10:51 +08:00
Matt Johnston
87c4586d61 fuzzing has a constant time
--HG--
branch : fuzz
2017-05-25 22:20:10 +08:00
Matt Johnston
0363d3c32e fuzzer-pubkey
--HG--
branch : fuzz
2017-05-23 22:43:34 +08:00
Matt Johnston
fb8fb7fed0 add dbmalloc epoch cleanup
--HG--
branch : fuzz
2017-05-21 10:54:11 +08:00
Matt Johnston
c169423051 glaring wrapfd problems fixed
--HG--
branch : fuzz
2017-05-20 22:47:19 +08:00
Matt Johnston
45b27b0194 merge 2017.75 2017-05-18 22:59:38 +08:00
Matt Johnston
597f12c44a Use atomic key generation in all cases 2016-11-19 00:31:21 +08:00
Matt Johnston
32df924d02 ses.debug_trace is wrong 2016-09-01 23:08:56 +08:00
Matt Johnston
32a28d0d9c Convert #ifdef to #if, other build changes 2016-05-04 15:33:40 +02:00
Matt Johnston
420151dbd9 move m_burn and function attributes to dbhelpers
use m_burn for libtomcrypt zeromem() too
2016-03-17 23:21:33 +08:00
Matt Johnston
b647b753e0 Use memset_s or explicit_bzero 2016-03-16 23:39:39 +08:00
Francois Perrad
9bda22e702 more hard tab 2016-01-01 15:02:09 +01:00
Konstantin Tokarev
c59827334c Allow setting syslog identifier via startsyslog(). 2015-12-15 16:43:29 +03:00
Matt Johnston
941c067765 change DROPBEAR_DEFAULT_CLI_AUTHKEY to just prepend homedir
rather than doing ~ expansion
2015-08-03 20:45:04 +08:00
Matt Johnston
31e379c300 merge from default
--HG--
branch : fastopen
2015-02-28 09:06:40 +08:00
Thorsten Horstmann
ab9439519a Fix for old compilers, variable declarations at beginning of functions
and /**/ comments
2015-02-24 20:51:18 +08:00
Matt Johnston
364a53577e Move generic network routines to netio.c
--HG--
branch : fastopen
2015-02-20 23:16:38 +08:00
Matt Johnston
34f9adb1c9 merge
--HG--
branch : fastopen
2015-02-19 22:42:30 +08:00
Matt Johnston
2e7d468b90 Add the missing second half of iov code
--HG--
branch : fastopen
2015-02-19 22:41:51 +08:00
Matt Johnston
86a717c80c fallback for old glibc and fastopen
memset rather than = {0} initialiser

--HG--
branch : fastopen
2015-02-19 22:33:51 +08:00
Matt Johnston
76a3eb393c In theory TFO should work. Needs platform cleanup and testing
--HG--
branch : fastopen
2015-02-19 00:32:00 +08:00
Matt Johnston
755c1458f0 async connections working
--HG--
branch : fastopen
2015-02-18 22:46:15 +08:00
Matt Johnston
8795d733ec work in progress for async connect
--HG--
branch : fastopen
2015-02-18 00:05:27 +08:00
Matt Johnston
28f61c8b3a tcp fastopen for the server
--HG--
branch : fastopen
2015-02-15 22:34:05 +08:00