]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/chpasswd.cgi
Forward Firewall: added GPL header to all files
[people/teissler/ipfire-2.x.git] / html / cgi-bin / chpasswd.cgi
index 41aba2986d5ab5213b3cc333b893cd4bdf64d743..ae9e6ec70b29bf47989b32d2ec820cb79e4f11b1 100644 (file)
@@ -1,12 +1,28 @@
 #!/usr/bin/perl
-
-#
-# $Id: chpasswd.cgi,v 1.0 2005/01/25 00:00:00 marco Exp $
-#
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 use CGI qw(param);
+use Crypt::PasswdMD5;
 
-$swroot = "/var/ipcop";
+$swroot = "/var/ipfire";
 
 my %cgiparams;
 my %mainsettings;
@@ -83,12 +99,15 @@ if ($cgiparams{'SUBMIT'} eq $tr{'advproxy chgwebpwd change password'})
                $errormessage = $tr{'advproxy errmsg invalid user'};
                goto ERROR;
        }
-       if (!(crypt($cgiparams{'OLD_PASSWORD'}, $cryptpwd) eq $cryptpwd))
+       if (
+           !(crypt($cgiparams{'OLD_PASSWORD'}, $cryptpwd) eq $cryptpwd) &&
+           !(apache_md5_crypt($cgiparams{'OLD_PASSWORD'}, $cryptpwd) eq $cryptpwd)
+          )
        {
                $errormessage = $tr{'advproxy errmsg password incorrect'};
                goto ERROR;
        }
-       $returncode = system("/usr/bin/htpasswd -b $userdb $username $cgiparams{'NEW_PASSWORD_1'}");
+       $returncode = system("/usr/sbin/htpasswd -b $userdb $username $cgiparams{'NEW_PASSWORD_1'}");
        if ($returncode == 0)
        {
                $success = 1;
@@ -119,59 +138,52 @@ print <<END
 
 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
 
-<table width="80%" cellspacing="10" cellpadding="5" border="0">
+<table width="80%" cellspacing="10" cellpadding="5">
 
 <tr>
-       <td bgcolor="#C0C0C0">
-               <font face="verdana, arial, sans serif" color="#000000" size="2">
-               <b>&nbsp;</b>
-               </font>
-       </td>
-</tr>
-<tr>
-       <td bgcolor="#F4F4F4" align="center">
-               <table width="100%" cellspacing="10" cellpadding="10">
+       <td bgcolor="#FFFFFF" align="center">
+               <table width="100%" cellspacing="10" cellpadding="10" bordercolor="#9A9A9A" border="1">
                <tr>
-                       <td nowrap bgcolor="#0050C0" align="center">
-                       <font face="verdana, arial, sans serif" color="#FFFFFF" size="3">
+                       <td nowrap bgcolor="#993333" align="center" >
+                       <font face="trebuchet ms, helvetica, sans-serif" color="#FFFFFF" size="4">
                        <b>$tr{'advproxy chgwebpwd change web password'}</b>
                        </font>
                        </td>
                </tr>
                <tr>
                        <td align="center">
-                               <table width="70%" cellspacing="7" cellpadding="7">
+                               <table width="50%" cellspacing="7" cellpadding="7">
                                <tr>
-                                       <td nowrap bgcolor="#F4F4F4" align="left">
-                                       <font face="verdana, arial, sans serif" color="#000000" size="2">
+                                       <td nowrap bgcolor="#FFFFFF" align="left">
+                                       <font face="trebuchet ms, helvetica, sans-serif" color="#666666" size="2">
                                        <b>$tr{'advproxy chgwebpwd username'}:</b>
                                        </font>
                                        </td>
-                                       <td><input type="text" name="USERNAME" value="$cgiparams{'USERNAME'}" size="15"></td>
+                                       <td ><input type="text" name="USERNAME" value="$cgiparams{'USERNAME'}" size="30"></td>
                                </tr>
                                <tr>
-                                       <td nowrap bgcolor="#F4F4F4" align="left">
-                                       <font face="verdana, arial, sans serif" color="#000000" size="2">
+                                       <td nowrap bgcolor="#FFFFFF" align="left">
+                                       <font face="trebuchet ms, helvetica, sans-serif" color="#666666" size="2">
                                        <b>$tr{'advproxy chgwebpwd old password'}:</b>
                                        </font>
                                        </td>
-                                       <td><input type="password" name="OLD_PASSWORD" value="$cgiparams{'OLD_PASSWORD'}" size="15"></td>
+                                       <td><input type="password" name="OLD_PASSWORD" value="$cgiparams{'OLD_PASSWORD'}" size="30"></td>
                                </tr>
                                <tr>
-                                       <td nowrap bgcolor="#F4F4F4" align="left">
-                                       <font face="verdana, arial, sans serif" color="#000000" size="2">
+                                       <td nowrap bgcolor="#FFFFFF" align="left">
+                                       <font face="trebuchet ms, helvetica, sans-serif" color="#666666" size="2">
                                        <b>$tr{'advproxy chgwebpwd new password'}:</b>
                                        </font>
                                        </td>
-                                       <td><input type="password" name="NEW_PASSWORD_1" value="$cgiparams{'NEW_PASSWORD_1'}" size="15"></td>
+                                       <td><input type="password" name="NEW_PASSWORD_1" value="$cgiparams{'NEW_PASSWORD_1'}" size="30"></td>
                                </tr>
                                <tr>
-                                       <td nowrap bgcolor="#F4F4F4" align="left">
-                                       <font face="verdana, arial, sans serif" color="#000000" size="2">
+                                       <td nowrap bgcolor="#FFFFFF" align="left">
+                                       <font face="trebuchet ms, helvetica, sans-serif" color="#666666" size="2">
                                        <b>$tr{'advproxy chgwebpwd new password confirm'}:</b>
                                        </font>
                                        </td>
-                                       <td><input type="password" name="NEW_PASSWORD_2" value="$cgiparams{'NEW_PASSWORD_2'}" size="15"></td>
+                                       <td><input type="password" name="NEW_PASSWORD_2" value="$cgiparams{'NEW_PASSWORD_2'}" size="30"></td>
                                </tr>
                                </table>
                                <table width="100%" cellspacing="7" cellpadding="7">
@@ -189,7 +201,7 @@ if ($errormessage)
        print <<END
        <tr>
                <td nowrap bgcolor="#FF0000" align="center">
-               <font face="verdana, arial, sans serif" color="#FFFFFF" size="2">
+               <font face="trebuchet ms, helvetica, sans-serif" color="#FFFFFF" size="2">
                <b>$tr{'advproxy chgwebpwd ERROR'}</b> $errormessage
                </font>
                </td>
@@ -203,7 +215,7 @@ if ($success)
        print <<END
        <tr>
                <td nowrap bgcolor="#00C000" align="center">
-               <font face="verdana, arial, sans serif" color="#FFFFFF" size="2">
+               <font face="trebuchet ms, helvetica, sans-serif" color="#FFFFFF" size="2">
                <b>$tr{'advproxy chgwebpwd SUCCESS'}</b> $tr{'advproxy errmsg change success'}
                </font>
                </td>
@@ -219,15 +231,6 @@ print <<END
 </tr>
 </table>
 
-<tr>
-       <td bgcolor="#C0C0C0" align="right">
-               <a href="http://www.advproxy.net" target="_blank"><b>
-               <font face="verdana,arial,sans serif" color="#FFFFFF" size="1">Advanced Proxy</b></a> running on</font>
-               <a href="http://www.ipcop.org" target="_blank"><b>
-               <font face="verdana,arial,sans serif" color="#FFFFFF" size="1">IPCop</b></a></font>
-       </td>
-</tr>
-
 </table>
 
 </form>