summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2022-11-09 18:40:10 +0800
committerMatt Johnston <matt@ucc.asn.au>2022-11-09 18:40:10 +0800
commitdc3c1a30cf7ce984986654ec78632f8de7db79c1 (patch)
tree03c2c33be842c1293ab9cb47c8b7b84e42c4574b
parent71d78653c7c4e9e42377ed96d3d7817d41ecf5b5 (diff)
downloaddropbear-dc3c1a30cf7ce984986654ec78632f8de7db79c1.tar.gz
Allow overriding shells for compat getusershell()
-rw-r--r--compat.c3
-rw-r--r--sysoptions.h9
2 files changed, 10 insertions, 2 deletions
diff --git a/compat.c b/compat.c
index 7a0e78a..8bd6add 100644
--- a/compat.c
+++ b/compat.c
@@ -231,8 +231,7 @@ void setusershell() {
}
static char **initshells() {
- /* don't touch this list. */
- static const char *okshells[] = { "/bin/sh", "/bin/csh", NULL };
+ static const char *okshells[] = { COMPAT_USER_SHELLS, NULL };
register char **sp, *cp;
register FILE *fp;
struct stat statb;
diff --git a/sysoptions.h b/sysoptions.h
index af931ff..24b902d 100644
--- a/sysoptions.h
+++ b/sysoptions.h
@@ -79,6 +79,15 @@
#define _PATH_CP "/bin/cp"
+/* Default contents of /etc/shells if system getusershell() doesn't exist.
+ * Paths taken from getusershell(3) manpage. These can be customised
+ * on other platforms. One the commandline for CFLAGS it would look like eg
+ -DCOMPAT_USER_SHELLS='"/bin/sh","/apps/bin/sh","/data/bin/zsh"
+ */
+#ifndef COMPAT_USER_SHELLS
+#define COMPAT_USER_SHELLS "/bin/sh","/bin/csh"
+#endif
+
#define DROPBEAR_ESCAPE_CHAR '~'
/* success/failure defines */