annotate debug.h @ 1938:77bc00dcc19f default tip main master

Bump version to 2022.82
author Matt Johnston <matt@ucc.asn.au>
date Fri, 01 Apr 2022 14:43:27 +0800
parents be236878efcf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 /*
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 * Dropbear - a SSH2 server
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 *
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 * Copyright (c) 2002,2003 Matt Johnston
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 * All rights reserved.
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 *
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 * of this software and associated documentation files (the "Software"), to deal
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 * in the Software without restriction, including without limitation the rights
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11 * copies of the Software, and to permit persons to whom the Software is
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 * furnished to do so, subject to the following conditions:
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 *
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 * The above copyright notice and this permission notice shall be included in
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 * all copies or substantial portions of the Software.
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 *
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 * SOFTWARE. */
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24
1036
deed0571cacc DROPBEAR_ prefix for include guards to avoid collisions
Thorsten Horstmann <thorsten.horstmann@web.de>
parents: 1015
diff changeset
25 #ifndef DROPBEAR_DEBUG_H_
deed0571cacc DROPBEAR_ prefix for include guards to avoid collisions
Thorsten Horstmann <thorsten.horstmann@web.de>
parents: 1015
diff changeset
26 #define DROPBEAR_DEBUG_H_
4
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 #include "includes.h"
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 /* Debugging */
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 /* Work well for valgrind - don't clear environment, be nicer with signals
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33 * etc. Don't use this normally, it might cause problems */
659
1e0414b29ce9 Fix accidentally committed change
Matt Johnston <matt@ucc.asn.au>
parents: 658
diff changeset
34 /* #define DEBUG_VALGRIND */
4
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 /* All functions writing to the cleartext payload buffer call
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37 * CHECKCLEARTOWRITE() before writing. This is only really useful if you're
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38 * attempting to track down a problem */
343
ffbe6f691ca3 CHECKCLEARTOWRITE() can normally be defined blank
Matt Johnston <matt@ucc.asn.au>
parents: 179
diff changeset
39 /*#define CHECKCLEARTOWRITE() assert(ses.writepayload->len == 0 && \
ffbe6f691ca3 CHECKCLEARTOWRITE() can normally be defined blank
Matt Johnston <matt@ucc.asn.au>
parents: 179
diff changeset
40 ses.writepayload->pos == 0)*/
ffbe6f691ca3 CHECKCLEARTOWRITE() can normally be defined blank
Matt Johnston <matt@ucc.asn.au>
parents: 179
diff changeset
41
1456
a90fdd2d2ed8 add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents: 1358
diff changeset
42 #ifndef CHECKCLEARTOWRITE
343
ffbe6f691ca3 CHECKCLEARTOWRITE() can normally be defined blank
Matt Johnston <matt@ucc.asn.au>
parents: 179
diff changeset
43 #define CHECKCLEARTOWRITE()
1456
a90fdd2d2ed8 add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents: 1358
diff changeset
44 #endif
4
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46 /* A couple of flags, not usually useful, and mightn't do anything */
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48 /*#define DEBUG_KEXHASH*/
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49 /*#define DEBUG_RSA*/
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50
1904
be236878efcf Add -v variable debug levels for server too
Matt Johnston <matt@ucc.asn.au>
parents: 1898
diff changeset
51 /* The level of TRACE() statements */
be236878efcf Add -v variable debug levels for server too
Matt Johnston <matt@ucc.asn.au>
parents: 1898
diff changeset
52 #define DROPBEAR_VERBOSE_LEVEL 4
1893
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
53
1295
750ec4ec4cbe Convert #ifdef to #if, other build changes
Matt Johnston <matt@ucc.asn.au>
parents: 1036
diff changeset
54 #if DEBUG_TRACE
1358
6b89eb92f872 glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents: 1295
diff changeset
55 extern int debug_trace;
1893
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
56 #endif
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
57
1898
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
58 /* Enable debug trace levels.
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
59 We can't use __VA_ARGS_ here because Dropbear supports
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
60 old ~C89 compilers */
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
61 /* Default is to discard output ... */
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
62 #define DEBUG1(X)
1893
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
63 #define DEBUG2(X)
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
64 #define DEBUG3(X)
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
65 #define TRACE(X)
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
66 #define TRACE2(X)
1898
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
67 /* ... unless DEBUG_TRACE is high enough */
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
68 #if (DEBUG_TRACE>=1)
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
69 #undef DEBUG1
1893
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
70 #define DEBUG1(X) dropbear_trace1 X;
1898
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
71 #endif
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
72 #if (DEBUG_TRACE>=2)
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
73 #undef DEBUG2
1893
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
74 #define DEBUG2(X) dropbear_trace2 X;
1898
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
75 #endif
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
76 #if (DEBUG_TRACE>=3)
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
77 #undef DEBUG3
1893
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
78 #define DEBUG3(X) dropbear_trace3 X;
1898
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
79 #endif
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
80 #if (DEBUG_TRACE>=4)
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
81 #undef TRACE
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
82 #define TRACE(X) dropbear_trace4 X;
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
83 #endif
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
84 #if (DEBUG_TRACE>=5)
3f87f7ff1092 Fix building with DEBUG_TRACE = 0
Matt Johnston <matt@ucc.asn.au>
parents: 1893
diff changeset
85 #undef TRACE2
1893
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
86 #define TRACE2(X) dropbear_trace5 X;
180e580778df Added DEBUG1,DEBUG2,DEBUG3 to separate functions while keeping TRACE and TRACE2.
HansH111 <hans@atbas.org>
parents: 1706
diff changeset
87 #endif
4
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
88
476
df7f7da7f6e4 - Rework pubkey options to be more careful about buffer lengths. Needs review.
Matt Johnston <matt@ucc.asn.au>
parents: 428
diff changeset
89 /* To debug with GDB it is easier to run with no forking of child processes.
df7f7da7f6e4 - Rework pubkey options to be more careful about buffer lengths. Needs review.
Matt Johnston <matt@ucc.asn.au>
parents: 428
diff changeset
90 You will need to pass "-F" as well. */
1677
e05c0e394f1d Make DEBUG_NOFORK a #if not #ifdef
Matt Johnston <matt@ucc.asn.au>
parents: 1511
diff changeset
91 #ifndef DEBUG_NOFORK
e05c0e394f1d Make DEBUG_NOFORK a #if not #ifdef
Matt Johnston <matt@ucc.asn.au>
parents: 1511
diff changeset
92 #define DEBUG_NOFORK 0
e05c0e394f1d Make DEBUG_NOFORK a #if not #ifdef
Matt Johnston <matt@ucc.asn.au>
parents: 1511
diff changeset
93 #endif
476
df7f7da7f6e4 - Rework pubkey options to be more careful about buffer lengths. Needs review.
Matt Johnston <matt@ucc.asn.au>
parents: 428
diff changeset
94
df7f7da7f6e4 - Rework pubkey options to be more careful about buffer lengths. Needs review.
Matt Johnston <matt@ucc.asn.au>
parents: 428
diff changeset
95
4
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
96 /* For testing as non-root on shadowed systems, include the crypt of a password
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
97 * here. You can then log in as any user with this password. Ensure that you
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
98 * make your own password, and are careful about using this. This will also
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
99 * disable some of the chown pty code etc*/
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
100 /* #define DEBUG_HACKCRYPT "hL8nrFDt0aJ3E" */ /* this is crypt("password") */
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
101
fe6bca95afa7 Makefile.in contains updated files required
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
102 #endif