Minor bug fixes for login.lua, buildit.s, rc.pcmcia

L J Bayuk <[email protected]>
Newsgroups gmane.linux.tomsrtbt
Message-ID <[email protected]>
Here are 4 rather trivial bugs I came across, and possible patches
to TomsRTBT-2.0.103 for them.

(1)  bin/login.lua - wrong check for disabled account.
It checks the MD5 of the typed-in password for * rather than the line
from /etc/passwd.
(2) bin/login.lua only does prefix match on username.
So, for example, you can log in as 'r' for root.

--- 2.orig/bin/login.lua	Tue Apr 23 14:40:20 2002
+++ 2/bin/login.lua	Wed May  8 19:20:40 2002
@@ -9,7 +9,7 @@
 while 1 do
 	B=read()
 	if not B then break end
-	if strsub(B,1,strlen(arg[2]))==arg[2] then
+	if strsub(B,1,strfind(B,":")-1)==arg[2] then
 		P=strsub(B,strfind(B,":")+1)
 		P=strsub(P,1,strfind(P,":")-1)
 		S=strsub(B,strfindlast(B,":")+1,-1)
@@ -28,7 +28,7 @@
 readfrom("|echo -n "..R.."|md5sum")
 X=strsub(read(),1,32)
 execute("yecho")
-if X=="*" then bad() end
+if P=="*" then bad() end
 if X==P then
 execute("ile "..S.." -c \". /etc/profile\" -si")
 else bad() end


(3) buildit.s script hard-codes kernel name bz2bzImage in lilo.conf.
It should use $KERNEL as defined in settings.s. (With this fix I can use
a bzImage kernel.)

--- 2.orig/bin/buildit.s	Sat Apr 20 20:52:05 2002
+++ 2/bin/buildit.s	Wed May  8 19:19:41 2002
@@ -108,7 +108,7 @@
 	read-write
 	vga=ask
 	prompt
-	image=$MP/bz2bzImage
+	image=$MP/$KERNEL
 	root=$FD
 	append="load_ramdisk=1 prompt_ramdisk=0 ramdisk_start=$O1 parport=0x378,7"
 !


(4) Syntax error in rc.pcmcia: "[: /var/run/pcmcia-scheme: unknown operand"
This seems to be from using -O ('is owned by the effective user ID'), which
apparently isn't a valid test operand for ash (when using built-in test).
I don't see much harm in taking it out.

--- 2.orig/etc/rc.pcmcia	Mon Apr  8 00:06:51 2002
+++ 2/etc/rc.pcmcia	Wed May  8 19:19:26 2002
@@ -30,7 +30,7 @@
 	echo -n "Starting PCMCIA:"
 	    SC=/var/run/pcmcia-scheme
 	    RUN=/var/run
-	if [ -L $SC -o ! -O $SC ] ; then rm -f $SC ; fi
+	if [ -L $SC ] ; then rm -f $SC ; fi
 	if [ ! -f $SC ] ; then touch $SC ; fi
 	if [ "$SCHEME" ] ; then echo $SCHEME > $SC ; fi
 	grep -q pcmcia /proc/devices
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.