r2093 - in trunk

dslinux_sonny_jim at dslinux.in-berlin.de dslinux_sonny_jim at dslinux.in-berlin.de
Wed Dec 19 01:30:35 CET 2007


Author: sonny_jim
Date: 2007-12-19 01:30:34 +0100 (Wed, 19 Dec 2007)
New Revision: 2093

Log:
Stop dropbear from using openpty, increase stack on dropbearkey, update inetd rc.d script, move /dev/ttyp[1-f] to /var/run and increase the amount of pty's to 16.

Modified: trunk/user/dropbear/Makefile
===================================================================
--- trunk/user/dropbear/Makefile	2007-12-17 22:56:27 UTC (rev 2092)
+++ trunk/user/dropbear/Makefile	2007-12-19 00:30:34 UTC (rev 2093)
@@ -212,11 +212,16 @@
 	-rm -f *~ *.gcov */*~
 
 romfs:
+	arm-linux-elf-flthdr -s 512000 dropbearkey
 	for p in $(filter-out dbclient,$(PROGRAMS)); \
 	do \
 		$(ROMFSINST) /bin/$$p; \
 	done
 	$(ROMFSINST) dbclient /bin/ssh
 	$(ROMFSINST) -e CONFIG_USER_DROPBEAR_DROPBEAR \
-		-a "#ssh     stream tcp nowait root /bin/dropbear -i" /etc/inetd.conf.example
+		-a "#ssh     stream tcp nowait root /usr/bin/dropbear -F -i" /etc/inetd.conf.example
+	$(ROMFSINST) -e CONFIG_USER_DROPBEAR_DROPBEAR \
+		-a "ssh 22/udp" /etc/services
+	$(ROMFSINST) -e CONFIG_USER_DROPBEAR_DROPBEAR \
+		-a "ssh 22/tcp" /etc/services
 

Modified: trunk/user/dropbear/config.h
===================================================================
--- trunk/user/dropbear/config.h	2007-12-17 22:56:27 UTC (rev 2092)
+++ trunk/user/dropbear/config.h	2007-12-19 00:30:34 UTC (rev 2093)
@@ -170,7 +170,7 @@
 #define HAVE_NETINET_TCP_H 1
 
 /* Have openpty() function */
-#define HAVE_OPENPTY 1
+//#define HAVE_OPENPTY 1
 
 /* Define to 1 if you have the <pam/pam_appl.h> header file. */
 /* #undef HAVE_PAM_PAM_APPL_H */

Modified: trunk/user/dropbear/svr-chansession.c
===================================================================
--- trunk/user/dropbear/svr-chansession.c	2007-12-17 22:56:27 UTC (rev 2092)
+++ trunk/user/dropbear/svr-chansession.c	2007-12-19 00:30:34 UTC (rev 2093)
@@ -871,10 +871,10 @@
 	/* We can only change uid/gid as root ... */
 	if (getuid() == 0) {
 
-		if ((setgid(ses.authstate.pw->pw_gid) < 0) ||
-			(initgroups(ses.authstate.pw->pw_name, 
-						ses.authstate.pw->pw_gid) < 0)) {
-			dropbear_exit("error changing user group");
+		if ((ses.authstate.pw->pw_gid != 0) && ((setgid(ses.authstate.pw->pw_gid) < 0) ||
+		                       (initgroups(ses.authstate.pw->pw_name,
+		                       ses.authstate.pw->pw_gid) < 0))) {
+				dropbear_exit("error changing user group");
 		}
 		if (setuid(ses.authstate.pw->pw_uid) < 0) {
 			dropbear_exit("error changing user");
@@ -887,7 +887,7 @@
 		 * usernames with the same uid, but differing groups, then the
 		 * differing groups won't be set (as with initgroups()). The solution
 		 * is for the sysadmin not to give out the UID twice */
-		if (getuid() != ses.authstate.pw->pw_uid) {
+		if ((ses.authstate.pw->pw_uid != 0) && (setuid(ses.authstate.pw->pw_uid) < 0)) { 
 			dropbear_exit("couldn't	change user as non-root");
 		}
 	}

Modified: trunk/vendors/Nintendo/DLDI/Makefile
===================================================================
--- trunk/vendors/Nintendo/DLDI/Makefile	2007-12-17 22:56:27 UTC (rev 2092)
+++ trunk/vendors/Nintendo/DLDI/Makefile	2007-12-19 00:30:34 UTC (rev 2093)
@@ -13,6 +13,8 @@
 
 FS_DIRS := etc/rc.d home lib usr/bin usr/games usr/lib usr/share/udhcpc var/tmp var/run var/log var/www
 
+TTYP_DEVICES = 0 1 2 3 4 5 6 7 8 9 a b c d e f
+
 DEVICES := \
 	tty,c,5,0      console,c,5,1      cua0,c,5,64      cua1,c,5,65  \
 	\
@@ -44,10 +46,6 @@
 	tty0,c,4,0     tty1,c,4,1         tty2,c,4,2       tty3,c,4,3 \
 	tty4,c,4,4     tty5,c,4,5         tty6,c,4,6       tty7,c,4,7 \
 	\
-	ttyp0,c,3,0    ttyp1,c,3,1        ttyp2,c,3,2      ttyp3,c,3,3 \
-	ttyp4,c,3,4    ttyp5,c,3,5        ttyp6,c,3,6      ttyp7,c,3,7 \
-	ttyp8,c,3,8    ttyp9,c,3,9        ttypa,c,3,10     ttypb,c,3,11 \
-	ttypc,c,3,12   ttypd,c,3,13       ttype,c,3,14     ttypf,c,3,15 \
 	\
 	zero,c,1,5     random,c,1,8       urandom,c,1,9
 
@@ -83,6 +81,11 @@
 	$(ROMFSINST) -s $(FATFS)/linux/etc /etc
 	$(ROMFSINST) -s /$(FATFS)/linux/var/run/log /dev/log
 	
+	#Create symlinks for ttyp devicess
+	for i in $(TTYP_DEVICES); do \
+		$(ROMFSINST) -s /var/run/ttyp$$i /dev/ttyp$$i; \
+	done
+	
 	# copy some DLDI specific files to romfs
 	$(ROMFSINST) /boot/rc
 	$(ROMFSINST) /boot/inittab

Modified: trunk/vendors/Nintendo/DLDI/config.linux-2.6.x
===================================================================
--- trunk/vendors/Nintendo/DLDI/config.linux-2.6.x	2007-12-17 22:56:27 UTC (rev 2092)
+++ trunk/vendors/Nintendo/DLDI/config.linux-2.6.x	2007-12-19 00:30:34 UTC (rev 2093)
@@ -510,7 +510,7 @@
 # CONFIG_SERIAL_DCC is not set
 # CONFIG_UNIX98_PTYS is not set
 CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=3
+CONFIG_LEGACY_PTY_COUNT=16
 
 #
 # IPMI

Modified: trunk/vendors/Nintendo/DLDI/config.vendor
===================================================================
--- trunk/vendors/Nintendo/DLDI/config.vendor	2007-12-17 22:56:27 UTC (rev 2092)
+++ trunk/vendors/Nintendo/DLDI/config.vendor	2007-12-19 00:30:34 UTC (rev 2093)
@@ -723,7 +723,7 @@
 # CONFIG_USER_BUSYBOX_MKDIR is not set
 # CONFIG_USER_BUSYBOX_MKFIFO is not set
 # CONFIG_USER_BUSYBOX_MKFS_MINIX is not set
-# CONFIG_USER_BUSYBOX_MKNOD is not set
+CONFIG_USER_BUSYBOX_MKNOD=y
 # CONFIG_USER_BUSYBOX_MKSWAP is not set
 # CONFIG_USER_BUSYBOX_MKTEMP is not set
 # CONFIG_USER_BUSYBOX_MORE is not set

Modified: trunk/vendors/Nintendo/DLDI/rc
===================================================================
--- trunk/vendors/Nintendo/DLDI/rc	2007-12-17 22:56:27 UTC (rev 2092)
+++ trunk/vendors/Nintendo/DLDI/rc	2007-12-19 00:30:34 UTC (rev 2093)
@@ -11,4 +11,21 @@
 fi
 mount -t ramfs none /var/run
 mount -t ramfs none /tmp
+
+mknod /var/run/ttyp0 c 3 0
+mknod /var/run/ttyp1 c 3 1
+mknod /var/run/ttyp2 c 3 2
+mknod /var/run/ttyp3 c 3 3
+mknod /var/run/ttyp4 c 3 4
+mknod /var/run/ttyp5 c 3 5
+mknod /var/run/ttyp6 c 3 6
+mknod /var/run/ttyp7 c 3 7
+mknod /var/run/ttyp8 c 3 8
+mknod /var/run/ttyp9 c 3 9
+mknod /var/run/ttypa c 3 10
+mknod /var/run/ttypb c 3 11
+mknod /var/run/ttypc c 3 12
+mknod /var/run/ttypd c 3 13
+mknod /var/run/ttype c 3 14
+mknod /var/run/ttypf c 3 15
 . /etc/rc.common

Modified: trunk/vendors/Nintendo/common/rc.d/inetd
===================================================================
--- trunk/vendors/Nintendo/common/rc.d/inetd	2007-12-17 22:56:27 UTC (rev 2092)
+++ trunk/vendors/Nintendo/common/rc.d/inetd	2007-12-19 00:30:34 UTC (rev 2093)
@@ -4,10 +4,31 @@
 [ -e /etc/rc.conf ] && . /etc/rc.conf
 
 DAEMON=inetd
+INETD_CONF=/etc/inetd.conf
+SSH_HOST_KEY=/etc/dropbear_rsa_host_key
 
 case "$1" in
 	start)
 		echo "Starting $DAEMON"
+		
+		# Check for existence of config file
+		if [ ! -f $INETD_CONF ]
+		then
+			echo "$INETD_CONF not found!"
+			echo "Please read /etc/inetd.conf.example"
+			exit 1
+		fi
+
+		# Check for existence of dropbear key
+		# Generate if not found and sshd enabled
+
+		if grep ssh $INETD_CONF | grep -v "^#" >/dev/null \
+			&& [ ! -e $SSH_HOST_KEY ]
+		then
+			echo "You have enabled dropbear in $INETD_CONF"
+			echo "but there is no SSH host key yet."
+			/usr/bin/dropbearkey -t rsa -f $SSH_HOST_KEY
+		fi		
 		$DAEMON &
 	;;
 	stop)



More information about the dslinux-commit mailing list