mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Delete old squid 1.x authenticaton support
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
# edit_auth.cgi
|
||||
# Display authentication options and list of proxy users
|
||||
|
||||
require './squid-lib.pl';
|
||||
$access{'proxyauth'} || &error($text{'eauth_ecannot'});
|
||||
&ui_print_header(undef, $text{'eauth_header'}, "", undef, 0, 0, 0, &restart_button());
|
||||
$conf = &get_config();
|
||||
|
||||
print "<form action=save_auth.cgi>\n";
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'eauth_aopt'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table>\n";
|
||||
|
||||
$v = &find_config("proxy_auth", $conf);
|
||||
$authfile = $v->{'values'}->[0];
|
||||
$authdom = $v->{'values'}->[1];
|
||||
print "<tr> <td><b>$text{'eauth_puf'}</b></td> <td>\n";
|
||||
printf "<input type=radio name=authfile_def value=1 %s> $text{'eauth_none'} \n",
|
||||
$authfile ? "" : "checked";
|
||||
printf "<input type=radio name=authfile_def value=0 %s>\n",
|
||||
$authfile ? "checked" : "";
|
||||
printf "<input name=authfile size=30 value=\"%s\">\n",
|
||||
$authfile ? $authfile : "";
|
||||
print &file_chooser_button("authfile"),"</td> </tr>\n";
|
||||
|
||||
print "<tr>\n";
|
||||
print "<td><b>$text{'eauth_nologin'}</b></td> <td>\n";
|
||||
printf "<input type=radio name=authdom_def value=1 %s> $text{'eauth_none'} \n",
|
||||
$authdom ? "" : "checked";
|
||||
printf "<input type=radio name=authdom_def value=0 %s>\n",
|
||||
$authdom ? "checked" : "";
|
||||
printf "<input name=authdom size=20 value=\"%s\"></td>\n",
|
||||
$authdom ? $authdom : "";
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print "<input type=submit value=$text{'eauth_buttsave'}></form>\n";
|
||||
|
||||
if ($authfile) {
|
||||
print &ui_hr();
|
||||
print $text{'eauth_msgaccess'};
|
||||
print "\n<p>\n";
|
||||
@users = &list_auth_users($authfile);
|
||||
if (@users) {
|
||||
print "<a href=\"edit_user.cgi?new=1\">$text{'eauth_addpuser'}</a><br>\n";
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'eauth_pusers'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
for($i=0; $i<@users; $i++) {
|
||||
print "<tr>\n" if ($i%4 == 0);
|
||||
print "<td width=25%><a href=\"edit_user.cgi?",
|
||||
"index=$i\">$users[$i]->{'user'}</a></td>\n";
|
||||
print "</tr>\n" if ($i%4 == 3);
|
||||
}
|
||||
while($i++%4) { print "<td width=25%></td>\n"; }
|
||||
print "</table></td></tr></table>\n";
|
||||
}
|
||||
else {
|
||||
print "<b>$text{'eauth_nopusers'}</b> <p>\n";
|
||||
}
|
||||
print "<a href=\"edit_user.cgi?new=1\">$text{'eauth_addpuser'}</a><p>\n";
|
||||
}
|
||||
|
||||
&ui_print_footer("", $text{'eauth_return'});
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
# edit_user.cgi
|
||||
# A form for adding or editing a squid user
|
||||
|
||||
require './squid-lib.pl';
|
||||
$access{'proxyauth'} || &error($text{'eauth_ecannot'});
|
||||
&ReadParse();
|
||||
if ($in{'new'}) {
|
||||
&ui_print_header(undef, $text{'euser_header'}, "");
|
||||
}
|
||||
else {
|
||||
&ui_print_header(undef, $text{'euser_header1'}, "");
|
||||
$conf = &get_config();
|
||||
@users = &list_auth_users(
|
||||
&find_config("proxy_auth", $conf)->{'values'}->[0]);
|
||||
%user = %{$users[$in{'index'}]};
|
||||
}
|
||||
|
||||
print "<form action=save_user.cgi>\n";
|
||||
print "<input type=hidden name=index value=$in{'index'}>\n";
|
||||
print "<input type=hidden name=new value=$in{'new'}>\n";
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'euser_pud'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table>\n";
|
||||
|
||||
print "<tr> <td><b>$text{'euser_u'}</b></td>\n";
|
||||
print "<td><input name=user size=25 value=\"$user{'user'}\"></td> </tr>\n";
|
||||
|
||||
print "<tr> <td><b>$text{'euser_p'}</b></td> <td>\n";
|
||||
if (%user) {
|
||||
print "<input type=radio name=pass_def value=1 checked> $text{'euser_u1'}\n";
|
||||
print "<input type=radio name=pass_def value=0>\n";
|
||||
print "<input name=pass size=20 type=password></td> </tr>\n";
|
||||
}
|
||||
else {
|
||||
print "<input name=pass size=20 type=password></td> </tr>\n";
|
||||
}
|
||||
print "</table></td></tr></table>\n";
|
||||
if (%user) {
|
||||
print "<input type=submit value=$text{'buttsave'}>\n";
|
||||
print "<input type=submit name=delete value=$text{'buttdel'}>\n";
|
||||
}
|
||||
else {
|
||||
print "<input type=submit value=$text{'euser_buttcreat'}>\n";
|
||||
}
|
||||
print "</form>\n";
|
||||
|
||||
&ui_print_footer("edit_auth.cgi", $text{'euser_return'},
|
||||
"", $text{'index_return'});
|
||||
|
||||
@@ -98,14 +98,13 @@ else {
|
||||
undef, undef, &text('index_version', $squid_version));
|
||||
}
|
||||
|
||||
# Check if authentication is setup
|
||||
my $auth;
|
||||
if ($squid_version < 2) {
|
||||
$auth = 1;
|
||||
}
|
||||
else {
|
||||
if ($squid_version >= 2) {
|
||||
my $file = &get_auth_file($conf);
|
||||
$auth = 2 if ($file);
|
||||
$auth = 1 if ($file);
|
||||
}
|
||||
|
||||
my $calamaris = &has_command($config{'calamaris'});
|
||||
my $delay = $squid_version >= 2.3;
|
||||
my $authparam = $squid_version >= 2;
|
||||
@@ -126,8 +125,7 @@ my @otitles = ( 'portsnets', 'othercaches', 'musage', 'logging',
|
||||
my @olinks = ( "edit_ports.cgi", "edit_icp.cgi", "edit_mem.cgi",
|
||||
"edit_logs.cgi", "edit_cache.cgi", "edit_progs.cgi",
|
||||
"edit_acl.cgi", "edit_admin.cgi",
|
||||
( $auth == 1 ? ( "edit_auth.cgi" ) :
|
||||
$auth == 2 ? ( "edit_nauth.cgi" ) : ( ) ),
|
||||
( $auth ? ( "edit_nauth.cgi" ) : ( ) ),
|
||||
( $authparam ? ( "edit_authparam.cgi" ) : ( ) ),
|
||||
( $delay ? ( 'edit_delay.cgi' ) : ( ) ),
|
||||
( $headeracc ? ( 'list_headeracc.cgi' ) : ( ) ),
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
# save_user.cgi
|
||||
# Save, create or delete a proxy user
|
||||
|
||||
require './squid-lib.pl';
|
||||
$access{'proxyauth'} || &error($text{'eauth_ecannot'});
|
||||
&ReadParse();
|
||||
$conf = &get_config();
|
||||
$file = &find_config("proxy_auth", $conf)->{'values'}->[0];
|
||||
&lock_file($file);
|
||||
@users = &list_auth_users($file);
|
||||
|
||||
$user = $users[$in{'index'}];
|
||||
if ($in{'delete'}) {
|
||||
&replace_file_line($file, $user->{'line'});
|
||||
}
|
||||
else {
|
||||
$whatfailed = $text{'suser_ftsu'};
|
||||
$in{'user'} =~ /^[^:\s]+$/ || &error($text{'suser_emsg1'});
|
||||
$salt = substr(time(), -2);
|
||||
local ($same) = grep { $_->{'user'} eq $in{'user'} } @users;
|
||||
if ($in{'new'}) {
|
||||
!$same || &error($text{'suser_etaken'});
|
||||
&open_tempfile(FILE, ">>$file");
|
||||
&print_tempfile(FILE, $in{'user'},":",&unix_crypt($in{'pass'}, $salt),"\n");
|
||||
&close_tempfile(FILE);
|
||||
}
|
||||
else {
|
||||
!$same || $same->{'user'} eq $user->{'user'} ||
|
||||
&error($text{'suser_etaken'});
|
||||
$pass = $in{'pass_def'} ? $user->{'pass'}
|
||||
: &unix_crypt($in{'pass'}, $salt);
|
||||
&replace_file_line($file, $user->{'line'},
|
||||
"$in{'user'}:$pass\n");
|
||||
}
|
||||
}
|
||||
&unlock_file($file);
|
||||
&webmin_log($in{'delete'} ? 'delete' : $in{'new'} ? 'create' : 'modify',
|
||||
'user', $in{'user'} ? $in{'user'} : $user->{'user'});
|
||||
&redirect("edit_auth.cgi");
|
||||
|
||||
Reference in New Issue
Block a user