Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next

This commit is contained in:
Michael Tremer
2016-04-08 16:16:57 +01:00
4 changed files with 32 additions and 43 deletions

View File

@@ -1,2 +1,5 @@
etc/system-release etc/system-release
etc/issue etc/issue
srv/web/ipfire/cgi-bin/chpasswd.cgi
srv/web/ipfire/cgi-bin/ipinfo.cgi
srv/web/ipfire/cgi-bin/proxy.cgi

View File

@@ -20,6 +20,7 @@
############################################################################### ###############################################################################
use CGI qw(param); use CGI qw(param);
use Apache::Htpasswd;
use Crypt::PasswdMD5; use Crypt::PasswdMD5;
$swroot = "/var/ipfire"; $swroot = "/var/ipfire";
@@ -74,48 +75,25 @@ if ($cgiparams{'SUBMIT'} eq $tr{'advproxy chgwebpwd change password'})
$errormessage = $tr{'advproxy errmsg password length 1'}.$proxysettings{'NCSA_MIN_PASS_LEN'}.$tr{'advproxy errmsg password length 2'}; $errormessage = $tr{'advproxy errmsg password length 1'}.$proxysettings{'NCSA_MIN_PASS_LEN'}.$tr{'advproxy errmsg password length 2'};
goto ERROR; goto ERROR;
} }
if (! -z $userdb)
{
open FILE, $userdb;
@users = <FILE>;
close FILE;
$username = ''; my $htpasswd = new Apache::Htpasswd("$userdb");
$cryptpwd = '';
foreach (@users) # Check if a user with this name exists
{ my $old_password = $htpasswd->fetchPass($cgiparams{'USERNAME'});
chomp; if (!$old_password) {
@temp = split(/:/,$_);
if ($temp[0] =~ /^$cgiparams{'USERNAME'}$/i)
{
$username = $temp[0];
$cryptpwd = $temp[1];
}
}
}
if ($username eq '')
{
$errormessage = $tr{'advproxy errmsg invalid user'}; $errormessage = $tr{'advproxy errmsg invalid user'};
goto ERROR; goto ERROR;
} }
if (
!(crypt($cgiparams{'OLD_PASSWORD'}, $cryptpwd) eq $cryptpwd) && # Reset password
!(apache_md5_crypt($cgiparams{'OLD_PASSWORD'}, $cryptpwd) eq $cryptpwd) if (!$htpasswd->htpasswd($cgiparams{'USERNAME'}, $cgiparams{'NEW_PASSWORD_1'},
) $cgiparams{'OLD_PASSWORD'})) {
{
$errormessage = $tr{'advproxy errmsg password incorrect'}; $errormessage = $tr{'advproxy errmsg password incorrect'};
goto ERROR; goto ERROR;
} }
$returncode = system("/usr/sbin/htpasswd -b $userdb $username $cgiparams{'NEW_PASSWORD_1'}");
if ($returncode == 0) $success = 1;
{ undef %cgiparams;
$success = 1;
undef %cgiparams;
} else {
$errormessage = $tr{'advproxy errmsg change fail'};
goto ERROR;
}
} }
ERROR: ERROR:

View File

@@ -19,6 +19,7 @@
# # # #
############################################################################### ###############################################################################
use CGI;
use IO::Socket; use IO::Socket;
use strict; use strict;
@@ -34,18 +35,14 @@ my %cgiparams=();
&Header::showhttpheaders(); &Header::showhttpheaders();
&Header::getcgihash(\%cgiparams);
$ENV{'QUERY_STRING'} =~s/&//g;
my @addrs = split(/ip=/,$ENV{'QUERY_STRING'});
&Header::openpage($Lang::tr{'ip info'}, 1, ''); &Header::openpage($Lang::tr{'ip info'}, 1, '');
&Header::openbigbox('100%', 'left'); &Header::openbigbox('100%', 'left');
my @lines=(); my @lines=();
my $extraquery=''; my $extraquery='';
foreach my $addr (@addrs) {
next if $addr eq ""; my $addr = CGI::param("ip") || "";
if (&General::validip($addr)) {
$extraquery=''; $extraquery='';
@lines=(); @lines=();
my $whoisname = "whois.arin.net"; my $whoisname = "whois.arin.net";
@@ -91,6 +88,14 @@ next if $addr eq "";
} }
print "</pre>\n"; print "</pre>\n";
&Header::closebox(); &Header::closebox();
} else {
&Header::openbox('100%', 'left', $Lang::tr{'invalid ip'});
print <<EOF;
<p style="text-align: center;">
$Lang::tr{'invalid ip'}
</p>
EOF
&Header::closebox();
} }
print <<END print <<END

View File

@@ -27,6 +27,7 @@
# #
use strict; use strict;
use Apache::Htpasswd;
# enable only the following on debugging purpose # enable only the following on debugging purpose
#use warnings; #use warnings;
@@ -4134,7 +4135,9 @@ sub adduser
close(FILE); close(FILE);
} else { } else {
&deluser($str_user); &deluser($str_user);
system("/usr/sbin/htpasswd -b $userdb $str_user $str_pass");
my $htpasswd = new Apache::Htpasswd("$userdb");
$htpasswd->htpasswd($str_user, $str_pass);
} }
if ($str_group eq 'standard') { open(FILE, ">>$stdgrp"); if ($str_group eq 'standard') { open(FILE, ">>$stdgrp");