fix set password issue in header function
authorFelix Fietkau <nbd@openwrt.org>
Mon, 10 Oct 2005 20:11:47 +0000 (20:11 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 10 Oct 2005 20:11:47 +0000 (20:11 +0000)
SVN-Revision: 2097

openwrt/package/webif/files/usr/lib/webif/webif.sh

index a2c889158a196ff0f247d795dfef93fb6f8392cc..f624720db9df443bbab419f16fdfcf359e47be54 100644 (file)
@@ -71,6 +71,12 @@ header() {
        _savebutton="${5:+<p><input type=\"submit\" name=\"action\" value=\"Save changes\" /></p>}"
        _categories=$(categories $1)
        _subcategories=${2:+$(subcategories "$1" "$2")}
+       
+       empty "$REMOTE_USER" && neq "${SCRIPT_NAME#/cgi-bin/}" "webif.sh" && grep 'root:!' /etc/passwd >&- 2>&- && {
+               _nopasswd=1
+               _form=""
+               _savebutton=""
+       }
 
        update_changes
        cat <<EOF
@@ -107,7 +113,7 @@ Pragma: no-cache
                                $ERROR
 EOF
        empty "$REMOTE_USER" && neq "${SCRIPT_NAME#/cgi-bin/}" "webif.sh" && {
-               empty "$FORM_passwd" || {
+               empty "$FORM_passwd1" || {
                        echo '<pre>'
                        (
                                echo "$FORM_passwd1"
@@ -119,7 +125,8 @@ EOF
                        footer
                        exit
                }
-               grep 'root:!' /etc/passwd >&- 2>&- && {
+               
+               equal "$_nopasswd" 1 && {
                        cat <<EOF
 <br />
 <br />