Allow overriding shells for compat getusershell()

This commit is contained in:
Matt Johnston 2022-11-09 18:40:10 +08:00
parent 71d78653c7
commit dc3c1a30cf
2 changed files with 10 additions and 2 deletions

View File

@ -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;

View File

@ -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 */