diff common-session.c @ 1634:aabde6f57fce

Add a sanity check for DROPBEAR_SVR_MULTIUSER==0 mode
author Matt Johnston <matt@ucc.asn.au>
date Wed, 20 Mar 2019 22:57:06 +0800
parents 60fceff95858
children 76189c9ffea2
line wrap: on
line diff
--- a/common-session.c	Wed Mar 20 14:44:49 2019 +0000
+++ b/common-session.c	Wed Mar 20 22:57:06 2019 +0800
@@ -68,6 +68,16 @@
 	/* Sets it to lowdelay */
 	update_channel_prio();
 
+#if !DROPBEAR_SVR_MULTIUSER
+	/* A sanity check to prevent an accidental configuration option
+	   leaving multiuser systems exposed */
+	errno = 0;
+	getuid();
+	if (errno != ENOSYS) {
+		dropbear_exit("Non-multiuser Dropbear requires a non-multiuser kernel");
+	}
+#endif
+
 	now = monotonic_now();
 	ses.connect_time = now;
 	ses.last_packet_time_keepalive_recv = now;