Mercurial > dropbear
annotate dbmalloc.h @ 1930:299f4f19ba19
Add /usr/sbin and /sbin to default root PATH
When dropbear is used in a very restricted environment (such as in a
initrd), the default user shell is often also very restricted
and doesn't take care of setting the PATH so the user ends up
with the PATH set by dropbear. Unfortunately, dropbear always
sets "/usr/bin:/bin" as default PATH even for the root user
which should have /usr/sbin and /sbin too.
For a concrete instance of this problem, see the "Remote Unlocking"
section in this tutorial: https://paxswill.com/blog/2013/11/04/encrypted-raspberry-pi/
It speaks of a bug in the initramfs script because it's written "blkid"
instead of "/sbin/blkid"... this is just because the scripts from the
initramfs do not expect to have a PATH without the sbin directories and
because dropbear is not setting the PATH appropriately for the root user.
I'm thus suggesting to use the attached patch to fix this misbehaviour (I
did not test it, but it's easy enough). It might seem anecdotic but
multiple Kali users have been bitten by this.
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903403
author | Raphael Hertzog <hertzog@debian.org> |
---|---|
date | Mon, 09 Jul 2018 16:27:53 +0200 |
parents | 8dc43b30c6bf |
children |
rev | line source |
---|---|
1361 | 1 #ifndef DBMALLOC_H_ |
2 #define DBMALLOC_H_ | |
3 | |
1571
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
4 #include "options.h" |
1798
8dc43b30c6bf
Define _GNU_SOURCE properly, other header fixes
Matt Johnston <matt@ucc.asn.au>
parents:
1571
diff
changeset
|
5 #include <stdint.h> |
8dc43b30c6bf
Define _GNU_SOURCE properly, other header fixes
Matt Johnston <matt@ucc.asn.au>
parents:
1571
diff
changeset
|
6 #include <stdlib.h> |
1361 | 7 |
8 void * m_malloc(size_t size); | |
9 void * m_calloc(size_t nmemb, size_t size); | |
10 void * m_strdup(const char * str); | |
11 void * m_realloc(void* ptr, size_t size); | |
1569
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
12 |
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
13 #if DROPBEAR_TRACKING_MALLOC |
1361 | 14 void m_free_direct(void* ptr); |
15 void m_malloc_set_epoch(unsigned int epoch); | |
1378 | 16 void m_malloc_free_epoch(unsigned int epoch, int dofree); |
1361 | 17 |
1569
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
18 #else |
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
19 /* plain wrapper */ |
1571
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
20 #define m_free_direct free |
1569
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
21 |
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
22 #endif |
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
23 |
1571
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
24 #define m_free(X) do {m_free_direct(X); (X) = NULL;} while (0) |
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
25 |
1569
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
26 |
1361 | 27 #endif /* DBMALLOC_H_ */ |