Merge pull request #156 from pcfreak30/master

Replace links with &ui_link call
This commit is contained in:
Jamie Cameron
2014-06-08 20:55:17 -07:00
114 changed files with 89 additions and 11471 deletions

View File

@@ -22,8 +22,7 @@ if (@clients) {
$addr = &find_value("Address", $f->{'members'});
$cat = &find_value("Catalog", $f->{'members'});
print &ui_checked_columns_row([
"<a href='edit_client.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_client.cgi?name=".&urlize($name)",$name),
$addr,
$cat,
], \@tds, "d", $name);
@@ -34,7 +33,7 @@ if (@clients) {
}
else {
print "<b>$text{'clients_none'}</b><p>\n";
print &ui_link("edit_client.cgi?new=1",$text{'clients_add'})<br>\n";
print &ui_link("edit_client.cgi?new=1",$text{'clients_add'})."<br>\n";
}
&ui_print_footer("", $text{'index_return'});

View File

@@ -22,8 +22,7 @@ if (@devices) {
$device = &find_value("Archive Device", $f->{'members'});
$type = &find_value("Media Type", $f->{'members'});
print &ui_checked_columns_row([
"<a href='edit_device.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_device.cgi?name=".&urlize($name)",$name),
$device,
$type,
], \@tds, "d", $name);

View File

@@ -20,8 +20,7 @@ if (@fdirectors) {
$pass = &find_value("Password", $f->{'members'});
print &ui_columns_row([
&ui_checkbox("d", $name),
"<a href='edit_fdirector.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_fdirector.cgi?name=".&urlize($name)",$name),
$pass,
], \@tds);
}

View File

@@ -25,8 +25,7 @@ if (@filesets) {
@files = ( @files[0..3], "..." );
}
print &ui_checked_columns_row([
"<a href='edit_fileset.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_fileset.cgi?name=".&urlize($name)",$name),
join(" , ", @files),
], \@tds, "d", $name);
}

View File

@@ -27,8 +27,7 @@ if (@jobs) {
$client = &is_oc_object($client);
$fileset = &find_value("FileSet", $f->{'members'});
print &ui_checked_columns_row([
"<a href='edit_gjob.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_gjob.cgi?name=".&urlize($name)",$name),
$type || "<i>$text{'default'}</i>",
$client || "<i>$text{'default'}</i>",
$fileset || "<i>$text{'default'}</i>",

View File

@@ -25,8 +25,7 @@ if (@groups) {
$cat = &find_value("Catalog", $f->{'members'});
$done{$name}++;
print &ui_checked_columns_row([
"<a href='edit_group.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_group.cgi?name=".&urlize($name)",$name),
$port,
$cat,
], \@tds, "d", $name);

View File

@@ -29,8 +29,7 @@ if (@jobs) {
$fileset = &find_value("FileSet", $f->{'members'});
$schedule = &find_value("Schedule", $f->{'members'});
print &ui_checked_columns_row([
"<a href='edit_job.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_job.cgi?name=".&urlize($name)",$name),
$f->{'name'} eq 'Job' ? $text{'no'} : $text{'yes'},
$type || "<i>$text{'default'}</i>",
$client || "<i>$text{'default'}</i>",

View File

@@ -22,8 +22,7 @@ if (@pools) {
$type = &find_value("Pool Type", $f->{'members'});
$reten = &find_value("Volume Retention", $f->{'members'});
print &ui_checked_columns_row([
"<a href='edit_pool.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_pool.cgi?name=".&urlize($name)",$name),
$type,
$reten,
], \@tds, "d", $name);

View File

@@ -23,8 +23,7 @@ if (@schedules) {
@runs = ( @runs[0..1], "..." );
}
print &ui_checked_columns_row([
"<a href='edit_schedule.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_schedule.cgi?name=".&urlize($name)",$name),
join(" , ", @runs),
], \@tds, "d", $name);
}

View File

@@ -20,8 +20,7 @@ if (@sdirectors) {
$pass = &find_value("Password", $f->{'members'});
print &ui_columns_row([
&ui_checkbox("d", $name),
"<a href='edit_sdirector.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_sdirector.cgi?name=".&urlize($name)",$name),
$pass,
], \@tds);
}

View File

@@ -25,8 +25,7 @@ if (@storages) {
$device = &find_value("Device", $f->{'members'});
$type = &find_value("Media Type", $f->{'members'});
print &ui_checked_columns_row([
"<a href='edit_storage.cgi?name=".&urlize($name)."'>".
$name."</a>",
&ui_link("edit_storage.cgi?name=".&urlize($name)",$name),
$addr,
$device,
$type,

View File

@@ -368,7 +368,7 @@ elsif ($type eq "files") {
$i++;
}
if (!$in{'newfiles'} && !$in{'new'}) {
print "<tr> <td colspan=4 align=right><hr><a href='edit_class.cgi?$in&newfiles=1'>$text{'edit_filesnew'}</a></td>\n";
print &ui_link("edit_class.cgi?$in&newfiles=1",$text{'edit_filesnew'})."</td>\n";
}
}
elsif ($type eq "copy") {
@@ -504,7 +504,7 @@ elsif ($type eq "copy") {
$i++;
}
if (!$in{'newcopy'} && !$in{'new'}) {
print "<tr> <td colspan=4 align=right><hr><a href='edit_class.cgi?$in&newcopy=1'>$text{'edit_copynew'}</a></td>\n";
print &ui_link("edit_class.cgi?$in&newcopy=1",$text{'edit_copynew'})."</td>\n";
}
}
elsif ($type eq "disable") {
@@ -576,7 +576,7 @@ elsif ($type eq "disable") {
$i++;
}
if (!$in{'newdis'} && !$in{'new'}) {
print "<tr> <td colspan=4 align=right><hr><a href='edit_class.cgi?$in&newdis=1'>$text{'edit_disnew'}</a></td>\n";
print &ui_link("edit_class.cgi?$in&newdis=1",$text{'edit_disnew'})."</td>\n";
}
}
elsif ($type eq "editfiles") {
@@ -611,7 +611,7 @@ elsif ($type eq "editfiles") {
$i++;
}
if (!$in{'newedit'} && !$in{'new'}) {
print "<tr> <td colspan=4 align=right><hr><a href='edit_class.cgi?$in&newedit=1'>$text{'edit_editnew'}</a></td>\n";
print &ui_link("edit_class.cgi?$in&newedit=1",$text{'edit_editnew'})."</td>\n";
}
}
elsif ($type eq "ignore") {
@@ -722,7 +722,7 @@ elsif ($type eq "processes") {
$i++;
}
if (!$in{'newproc'} && !$in{'new'}) {
print "<tr> <td colspan=4 align=right><hr><a href='edit_class.cgi?$in&newproc=1'>$text{'edit_procnew'}</a></td>\n";
print &ui_link("edit_class.cgi?$in&newproc=1",$text{'edit_procnew'})."</td>\n";
}
}
elsif ($type eq "shellcommands") {
@@ -824,7 +824,7 @@ elsif ($type eq "tidy") {
$i++;
}
if (!$in{'newtidy'} && !$in{'new'}) {
print "<tr> <td colspan=4 align=right><hr><a href='edit_class.cgi?$in&newtidy=1'>$text{'edit_tidynew'}</a></td>\n";
print &ui_link("edit_class.cgi?$in&newtidy=1",$text{'edit_tidynew'})."</td>\n";
}
}
elsif ($type eq "miscmounts") {

View File

@@ -21,7 +21,7 @@ print "<tr $cb> <td><table width=100%>\n";
print "<tr> <td><b>$text{'host_name'}</b></td>\n";
if ($server->{'id'}) {
printf "<td><a href='/servers/link.cgi/%s/'>%s</a></td>\n",
printf &ui_link("/servers/link.cgi/%s/","%s")."</td>\n",
$server->{'id'}, $server->{'desc'} ? "$server->{'desc'} ($server->{'host'}:$server->{'port'})" : "$server->{'host'}:$server->{'port'}";
}
else {

View File

@@ -1,77 +0,0 @@
#!/usr/local/bin/perl
# delete_pack.cgi
# Ask if the user wants to delete a package, and if so do it
require './cluster-software-lib.pl';
&ReadParse();
@servers = &list_servers();
if ($in{'server'} < 0) {
# Find servers that have the package
@hosts = &list_software_hosts();
foreach $h (@hosts) {
foreach $p (@{$h->{'packages'}}) {
if ($p->{'name'} eq $in{'package'}) {
local ($s) = grep { $_->{'id'} == $h->{'id'} }
@servers;
push(@got, $s);
last;
}
}
}
$s = $got[0];
}
else {
($s) = grep { $_->{'id'} == $in{'server'} } @servers;
@got = ( $s );
}
&remote_foreign_require($s->{'host'}, "software", "software-lib.pl");
&header($text{'delete_title'}, "");
print "<hr>\n";
if ($in{'sure'}) {
# do the deletion
print "<b>",&text('delete_header', $in{'package'}),"</b><p>\n";
foreach $g (@got) {
&remote_foreign_require($g->{'host'}, "software", "software-lib.pl")
if ($s ne $g);
local $error = &remote_foreign_call($g->{'host'}, "software",
"delete_package", $in{'package'});
if ($error) {
print &text('delete_error', $g->{'host'}, $error),"<br>\n";
}
else {
print &text('delete_success', $g->{'host'}),"<br>\n";
}
}
print "<p><b>$text{'delete_done'}</b><br>\n";
}
else {
# Ask if the user is sure..
$n = &remote_foreign_call($s->{'host'}, "software", "check_files",
$in{'package'});
$files = &remote_eval($s->{'host'}, "software", "\\%files");
$sz = 0;
for($i=0; $i<$n; $i++) {
if ($files->{$i,'type'} == 0) { $sz += $files->{$i,'size'}; }
}
print "<center>\n";
if ($in{'server'} < 0) {
print &text('delete_rusure', "<b>$in{'package'}</b>", $n, $sz),"<br>\n";
}
else {
print &text('delete_rusure2', "<b>$in{'package'}</b>", $n, $sz,
$s->{'desc'} ? $s->{'desc'} : $s->{'host'}),"<br>\n";
}
print "<form action=delete_pack.cgi>\n";
print "<input type=hidden name=package value=\"$in{'package'}\">\n";
print "<input type=hidden name=server value=\"$in{'server'}\">\n";
print "<input type=hidden name=sure value=1>\n";
print "<input type=hidden name=search value=\"$in{'search'}\">\n";
print "<input type=submit value=\"$text{'delete_ok'}\"></center>\n";
print "</form>\n";
}
print "<hr>\n";
&footer("edit_pack.cgi?search=$in{'search'}&package=".&urlize($p),
$text{'edit_return'});

View File

@@ -20,7 +20,7 @@ print "<tr $cb> <td><table width=100%>\n";
print "<tr> <td><b>$text{'host_name'}</b></td>\n";
if ($server->{'id'}) {
$h = $server->{'realhost'} || $server->{'host'};
printf "<td><a href='/servers/link.cgi/%s/'>%s</a></td>\n",
printf &ui_link("/servers/link.cgi/%s/","%s")."</td>\n",
$server->{'id'}, $server->{'desc'} ? "$server->{'desc'} ($h:$server->{'port'})" : "$h:$server->{'port'}";
}
else {

View File

@@ -1,118 +0,0 @@
#!/usr/local/bin/perl
# edit_host.cgi
# Show details of a managed host, and all the packages on it
require './cluster-software-lib.pl';
&foreign_require("servers", "servers-lib.pl");
&ReadParse();
&header($text{'host_title'}, "");
print "<hr>\n";
@hosts = &list_software_hosts();
($host) = grep { $_->{'id'} eq $in{'id'} } @hosts;
$server = &foreign_call("servers", "get_server", $in{'id'});
@packages = @{$host->{'packages'}};
# Show host details
print "<form action=delete_host.cgi>\n";
print "<input type=hidden name=id value=$in{'id'}>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'host_header'}</b></td> </tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print "<tr> <td><b>$text{'host_name'}</b></td>\n";
if ($server->{'id'}) {
printf "<td><a href='/servers/link.cgi/%s/'>%s</a></td>\n",
$server->{'id'}, $server->{'desc'} ? "$server->{'desc'} ($server->{'host'}:$server->{'port'})" : "$server->{'host'}:$server->{'port'}";
}
else {
print "<td><a href=/>$text{'this_server'}</a></td>\n";
}
if ($server->{'id'}) {
print "<td><b>$text{'host_type'}</b></td> <td>\n";
foreach $t (@servers::server_types) {
print $t->[1] if ($t->[0] eq $server->{'type'});
}
print "</td>\n";
}
print "</tr>\n";
print "<tr> <td><b>$text{'host_count'}</b></td>\n";
printf "<td>%d</td>\n", scalar(@packages);
print "<td><b>$text{'host_os'}</b></td>\n";
print "<td>$host->{'real_os_type'} $host->{'real_os_version'}</td> </tr>\n";
print "</table></td></tr></table>\n";
print "<input type=submit value='$text{'host_delete'}'></form>\n";
# Show tree of packages
$heir{""} = "";
foreach $c (sort { $a cmp $b } &unique(map { $_->{'class'} } @packages)) {
if (!$c) { next; }
@w = split(/\//, $c);
$p = join('/', @w[0..$#w-1]);
if (!defined($heir{$p})) {
$pp = join('/', @w[0..$#w-2]);
$heir{$pp} .= "$p\0";
}
$heir{$p} .= "$c\0";
$hasclasses++;
}
# get the current open list
open(HEIROPEN, "$module_config_directory/heiropen.$in{'id'}");
while(<HEIROPEN>) {
chop;
$heiropen{$_}++;
}
close(HEIROPEN);
$heiropen{""}++;
# traverse the heirarchy
$spacer = "&nbsp;"x3;
print "<hr>\n";
print "<h3>$text{'host_installed'}</h3>\n";
print "<table width=100%>\n";
&traverse("", 0);
print "</table>\n";
if ($hasclasses) {
print "<a href='closeall.cgi?id=$in{'id'}'>$text{'host_close'}</a> $spacer\n";
print "<a href='openall.cgi?id=$in{'id'}'>$text{'host_open'}</a><p>\n";
}
print "<hr>\n";
&footer("", $text{'index_return'});
sub traverse
{
local($s, $act, $i);
print "<tr> <td>", $spacer x $_[1];
if ($_[0]) {
print "<a name=\"$_[0]\"></a>\n";
$act = $heiropen{$_[0]} ? "close" : "open";
print "<a href=\"$act.cgi?id=$in{'id'}&what=",&urlize($_[0]),"\">";
$_[0] =~ /([^\/]+)$/;
print "<img border=0 src=images/$act.gif></a>&nbsp; $1</td>\n",
}
else { print "<img src=images/close.gif> <i>$text{'host_all'}</i></td>\n"; }
print "<td><br></td> </tr>\n";
if ($heiropen{$_[0]}) {
# print sub-folders followed by packages
foreach $i (@packages) {
if ($i->{'class'} eq $_[0]) {
print "<tr> <td>", $spacer x ($_[1]+1);
print "<img border=0 src=images/pack.gif></a>&nbsp;\n";
print "<a href=\"edit_pack.cgi?package=",
&urlize($i->{'name'}),"\">$i->{'name'}</a></td>\n";
print "<td>$i->{'desc'}</td>\n";
print "</tr>\n";
}
}
foreach $s (&unique(split(/\0+/, $heir{$_[0]}))) {
&traverse($s, $_[1]+1);
}
}
}

View File

@@ -47,8 +47,7 @@ if (@links) {
local ($type) = grep { $_->[0] eq $s->{'type'} }
@servers::server_types;
print &ui_columns_row([
"<a href='edit_host.cgi?id=$h->{'id'}'>".
($s->{'host'} || &get_system_hostname())."</a>",
&ui_link("edit_host.cgi?id=$h->{'id'}",($s->{'host'} || &get_system_hostname())),
$s->{'desc'},
scalar(@{$h->{'packages'}}),
$type->[1],

View File

@@ -1,97 +0,0 @@
index_title=Cluster Software Packages
index_hosts=Managed Servers
index_nohosts=No Webmin servers have been registered for software management.
index_add=Add server
index_gadd=Add servers in group
index_installed=Installed Packages
index_search=Search For Package:
index_install=Install a New Package
index_installmsg=Select the location to install a new package from..
index_local=From local file
index_uploaded=From uploaded file
index_ftp=From ftp or http URL
index_installok=Install
index_return=servers list
index_refresh=Refresh package lists
this_server=This Server
install_err=Failed to install package
install_elocal=No local file given
install_elocal2='$1' does not exist
install_eupload=Your browser does not support file uploads
install_eurl=Incomprehensible URL '$1'
install_edir=Not a valid $1 directory
install_ezip=Not a valid compressed or gzipped $1 file
install_efile=Not a valid $1 file
install_title=Install Package
install_header=Install package
install_packs=Package(s) to be installed
install_ok=Install
add_err=Failed to add server
add_gerr=Failed to add group
add_echeck=Server $1 does not have the software packages module
add_esystem=Server $1 is not using the same package system as this machine
search_title=Package Search
search_nomatch=No packages matched $1
search_none=None
search_desc=Description
search_class=Class
search_pack=Package
search_match=Packages matching $1
search_return=search results
host_title=Managed Host
host_header=Software managed host details
host_name=Host name
host_type=Server type
host_delete=Removed from managed list
host_installed=Installed Packages
host_open=Open all
host_close=Close all
host_all=All Packages
host_count=Packages installed
host_os=OS from Webmin
edit_title=Edit Package
edit_details=Package Details from $1
edit_desc=Description
edit_pack=Package
edit_class=Class
edit_none=None
edit_ver=Version
edit_vend=Vendor
edit_arch=Architecture
edit_inst=Installed
edit_list=List files on:
edit_uninst=Uninstall from:
edit_return=package details
edit_hosts=Installed on Hosts
edit_all=&lt;all hosts&gt;
list_title=Package Files
list_files=Files for Package $1 on $2
list_path=Path
list_owner=Owner
list_group=Group
list_type=Type
list_size=Size
list_status=Status
list_ok=OK
refresh_title=Refresh Package Lists
refresh_header=Re-requesting package lists from all servers ..
refresh_1=Refreshed $1 (added $2 , removed $3)
refresh_2=Refreshed $1 (added $2)
refresh_3=Refreshed $1 (removed $2)
refresh_4=Refreshed $1 (no changes)
refresh_done=.. done
refresh_del=Removed $1 from server list
delete_err=Failed to delete package $1
delete_epack=The package $1 does not exist
delete_title=Delete Package
delete_rusure=Are you sure you want to delete the package $1 from all servers ? Up to $2 files ($3 bytes) will be deleted forever.
delete_rusure2=Are you sure you want to delete the package $1 from $4 ? Up to $2 files ($3 bytes) will be deleted forever.
delete_ok=Delete

View File

@@ -1,5 +0,0 @@
name=Cluster Software
desc=Cluster Software Packages
os_support=redhat-linux open-linux msc-linux
depends=software
category=cluster

View File

@@ -1,71 +0,0 @@
#!/usr/local/bin/perl
# refresh.cgi
# Reload the list of packages from all managed hosts
require './cluster-software-lib.pl';
&header($text{'refresh_title'}, "");
print "<hr>\n";
$| = 1;
print "<b>$text{'refresh_header'}</b><p>\n";
@hosts = &list_software_hosts();
@servers = &list_servers();
foreach $h (@hosts) {
local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers;
if ($s) {
# Refresh the list
&remote_foreign_require($s->{'host'}, "software",
"software-lib.pl");
local $gconfig = &remote_foreign_config($s->{'host'}, undef);
foreach $g ('os_type', 'os_version',
'real_os_type', 'real_os_version') {
$h->{$g} = $gconfig{$g};
}
local @old = map { $_->{'name'} } @{$h->{'packages'}};
undef($h->{'packages'});
local $n = &remote_foreign_call($s->{'host'}, "software",
"list_packages");
local $packages = &remote_eval($s->{'host'}, "software",
"\\%packages");
local @added;
for($i=0; $i<$n; $i++) {
push(@{$h->{'packages'}},
{ 'name' => $packages->{$i,'name'},
'class' => $packages->{$i,'class'},
'desc' => $packages->{$i,'desc'} });
$idx = &indexof($packages->{$i,'name'}, @old);
if ($idx < 0) {
push(@added, $packages->{$i,'name'});
}
else {
splice(@old, $idx, 1);
}
}
&save_software_host($h);
local $d = $s->{'desc'} ? $s->{'desc'} : $s->{'host'};
if (@added && @old) {
print &text('refresh_1', $d,
join(" ", @added),join(" ", @old)),"<br>\n";
}
elsif (@added) {
print &text('refresh_2', $d,
join(" ", @added)),"<br>\n";
}
elsif (@old) {
print &text('refresh_3', $d, join(" ", @old)),"<br>\n";
}
else {
print &text('refresh_4', $d,"<br>\n";
}
}
else {
# remove from managed list
#&delete_software_host($h);
print &text('refresh_del', $h->{'id'}),"<br>\n";
}
}
print "<p><b>$text{'refresh_done'}</b><p>\n";
print "<hr>\n";
&footer("", $text{'index_return'});

View File

@@ -1,49 +0,0 @@
#!/usr/local/bin/perl
# search.cgi
# Display a list of packages where the name or description matches some string
require './cluster-software-lib.pl';
&ReadParse();
$s = $in{'search'};
@hosts = &list_software_hosts();
foreach $h (@hosts) {
foreach $p (@{$h->{'packages'}}) {
if ($p->{'name'} =~ /$s/i || $p->{'desc'} =~ /$s/i &&
!$already{$p->{'name'}}++) {
push(@match, $p);
}
}
}
if (@match == 1) {
&redirect("edit_pack.cgi?package=".&urlize($match[0]->{'name'}));
exit;
}
&header($text{'search_title'}, "");
print "<hr>\n";
if (@match) {
@match = sort { lc($a->{'name'}) cmp lc($b->{'name'}) } @match;
print "<h3>",&text('search_match', "<tt>$s</tt>"),"</h3>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'search_pack'}</b></td> ",
"<td><b>$text{'search_class'}</b></td> ",
"<td><b>$text{'search_desc'}</b></td> </tr>\n";
foreach $i (@match) {
print "<tr $cb>\n";
print "<td><a href=\"edit_pack.cgi?search=$s&package=",
&urlize($i->{'name'}),"\">$i->{'name'}</a></td>\n";
$c = $i->{'class'};
print "<td>",$c ? $c : $text{'search_none'},"</td>\n";
print "<td>$i->{'desc'}</td>\n";
print "</tr>\n";
}
print "</table><p>\n";
}
else {
print "<h3>",&text('search_nomatch', "<tt>$s</tt>"),"</h3>\n";
}
print "<hr>\n";
&footer("", $text{'index_return'});

View File

@@ -18,7 +18,7 @@ print "<tr $cb> <td><table width=100%>\n";
print "<tr> <td><b>$text{'host_name'}</b></td>\n";
if ($server->{'id'}) {
printf "<td><a href='/servers/link.cgi/%s/'>%s</a></td>\n",
printf &ui_link("/servers/link.cgi/%s/","%s")."</td>\n",
$server->{'id'}, $server->{'desc'} ? "$server->{'desc'} ($server->{'host'}:$server->{'port'})" : "$server->{'host'}:$server->{'port'}";
}
else {

View File

@@ -44,8 +44,7 @@ if (@links) {
local ($type) = grep { $_->[0] eq $s->{'type'} }
@servers::server_types;
print &ui_columns_row([
"<a href='edit_host.cgi?id=$h->{'id'}'>".
($s->{'host'} || &get_system_hostname())."</a>",
&ui_link("edit_host.cgi?id=$h->{'id'}",($s->{'host'} || &get_system_hostname())),
$s->{'desc'},
scalar(@{$h->{'users'}}),
scalar(@{$h->{'groups'}}),

View File

@@ -41,8 +41,7 @@ if (@links) {
local ($type) = grep { $_->[0] eq $s->{'type'} }
@servers::server_types;
print &ui_columns_row([
"<a href='edit_host.cgi?id=$h->{'id'}'>".
($s->{'host'} || &get_system_hostname())."</a>",
&ui_link("edit_host.cgi?id=$h->{'id'}",($s->{'host'} || &get_system_hostname())),
$s->{'desc'},
$h->{'version'},
$type->[1],

View File

@@ -43,8 +43,7 @@ if (@links) {
local ($type) = grep { $_->[0] eq $s->{'type'} }
@servers::server_types;
print &ui_columns_row([
"<a href='edit_host.cgi?id=$h->{'id'}'>".
($s->{'host'} || &get_system_hostname())."</a>",
&ui_link("edit_host.cgi?id=$h->{'id'}",($s->{'host'} || &get_system_hostname())),
$s->{'desc'},
$h->{'version'},
$type->[1],

View File

@@ -112,8 +112,7 @@ else {
print &ui_columns_row([
"<a name=$name><a href='cpan.cgi?$pars'>".
"<img src=images/cat.gif border=0></a>",
"<a href='cpan.cgi?$pars'>".
&html_escape($name)."</a>",
&ui_link("cpan.cgi?$pars",&html_escape($name)),
""
]);
}

View File

@@ -1,65 +0,0 @@
#!/usr/local/bin/perl
# exec_cron.cgi
# Execute an existing cron job, and display the output
require './cron-lib.pl';
&ReadParse();
@jobs = &list_cron_jobs();
$job = $jobs[$in{'idx'}];
&can_edit_user(\%access, $job->{'user'}) || &error($text{'exec_ecannot'});
&foreign_require("proc", "proc-lib.pl");
# split command into command and input
$job->{'command'} =~ s/\\%/\0/g;
@lines = split(/%/ , $job->{'command'});
foreach (@lines) { s/\0/%/g; }
for($i=1; $i<@lines; $i++) {
$input .= $lines[$i]."\n";
}
$| = 1;
$theme_no_table++;
&header($text{'exec_title'}, "");
print "<hr>\n";
&additional_log('exec', undef, $lines[0]);
&webmin_log("exec", "cron", $job->{'user'}, $job);
# Remove variables that wouldn't be in the 'real' cron
foreach $e ('SERVER_PORT', 'GATEWAY_INTERFACE', 'WEBMIN_VAR', 'SERVER_ROOT',
'REMOTE_USER', 'SERVER_ADMIN', 'REQUEST_METHOD', 'REMOTE_HOST',
'REMOTE_ADDR', 'SERVER_SOFTWARE', 'PATH_TRANSLATED', 'QUERY_STRING',
'MINISERV_CONFIG', 'SERVER_NAME', 'SERVER_PROTOCOL', 'REQUEST_URI',
'DOCUMENT_ROOT', 'WEBMIN_CONFIG', 'SESSION_ID', 'PATH_INFO',
'BASE_REMOTE_USER') {
delete($ENV{$e});
}
foreach $e (keys %ENV) {
delete($ENV{$e}) if ($e =~ /^HTTP_/);
}
# Set cron environment variables
foreach $e (&read_envs($job->{'user'})) {
$ENV{$1} = $2 if ($e =~ /^(\S+)\s+(.*)$/);
}
# Get command and switch uid/gid
@uinfo = getpwnam($job->{'user'});
$ENV{"HOME"} = $uinfo[7];
$ENV{"SHELL"} = "/bin/sh";
$ENV{"LOGNAME"} = $ENV{"USER"} = $job->{'user'};
$( = $) = $uinfo[3];
($>, $<) = ($uinfo[2], $uinfo[2]);
# Execute cron command and display output..
print &text('exec_cmd', "<tt>$lines[0]</tt>"),"<p>\n";
print "<pre>";
$got = &foreign_call("proc", "safe_process_exec",
$lines[0], 0, 0, STDOUT, $input, 1);
print "<i>$text{'exec_none'}</i>\n" if (!$got);
print "</pre>\n";
print "<hr>\n";
&footer("edit_cron.cgi?idx=$in{'idx'}", $text{'edit_return'},
"", $text{'index_return'});

View File

@@ -115,38 +115,28 @@ else {
}
if ($c->{'edit'} && !@{$c->{'args'}}) {
# Open file editor directly, as file is known
push(@cols, "<a href='view.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='view.cgi?id=$c->{'id'}'>".
$text{'index_acted'}."</a>");
push(@cols, &ui_link("view.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("view.cgi?id=$c->{'id'}",$text{'index_acted'}));
}
elsif ($c->{'sql'} && !@{$c->{'args'}}) {
# Execute SQL directorly, as no args
push(@cols, "<a href='sql.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='sql.cgi?id=$c->{'id'}'>".
$text{'index_actrun'}."</a>");
push(@cols, &ui_link("sql.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("sql.cgi?id=$c->{'id'}",$text{'index_actrun'}));
}
elsif ($c->{'sql'}) {
# Link to SQL query form
push(@cols, "<a href='sqlform.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='sqlform.cgi?id=$c->{'id'}'>".
$text{'index_actsql'}."</a>");
push(@cols, &ui_link("sqlform.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("sqlform.cgi?id=$c->{'id'}",$text{'index_actsql'}));
}
elsif (!@{$c->{'args'}}) {
# Link direct to execute page
push(@cols, "<a href='run.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='run.cgi?id=$c->{'id'}'>".
$text{'index_actrun'}."</a>");
push(@cols, &ui_link("run.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("run.cgi?id=$c->{'id'}",$text{'index_actrun'}));
}
else {
# Link to parameters form
push(@cols, "<a href='form.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='form.cgi?id=$c->{'id'}'>".
$text{'index_actform'}."</a>");
push(@cols, &ui_link("form.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("form.cgi?id=$c->{'id'}",$text{'index_actform'}));
}
push(@cols, $c->{'html'});
push(@cols, &ui_links_row(\@links));

View File

@@ -1,131 +0,0 @@
# dfs-lib.pl
# Common functions for managing dfstab files
do '../web-lib.pl';
&init_config();
$default_type = 'nfs';
if ($config{'fstypes_file'} && open(TYPES, $config{'fstypes_file'})) {
if (<TYPES> =~ /^(\S+)/) {
$default_type = $1;
}
close(TYPES);
}
# list_shares()
# Returns a list of structures containing share details
sub list_shares
{
local $lnum = 0;
local @rv;
open(DFS, $config{'dfstab_file'});
while(<DFS>) {
s/\r|\n//g; s/#.*$//;
if (/^\s*\S*share\s+(.*)/) {
# Found a share line
local $share = { 'line' => $lnum,
'index' => scalar(@rv) };
local $line = $_;
while($line =~ /\\$/) {
$_ = <DFS>;
s/\r|\n//g; s/#.*$//;
$line =~ s/\\$//;
$line .= $_;
$lnum++;
}
$share->{'eline'} = $lnum;
if ($line =~ /(\/\S+)/) {
$share->{'dir'} = $1;
}
if ($line =~ /-d\s+"([^"]+)"/) { $share->{'desc'} = $1; }
elsif ($line =~ /-d\s+(\S+)/) { $share->{'desc'} = $1; }
if ($line =~ /-o\s+"([^"]+)"/) { $share->{'opts'} = $1; }
elsif ($line =~ /-o\s+(\S+)/) { $share->{'opts'} = $1; }
if ($line =~ /\s-F\s+(\S+)/) { $share->{'type'} = $1; }
else { $share->{'type'} = $default_type; }
push(@rv, $share);
}
$lnum++;
}
close(DFS);
return @rv;
}
# create_share(&share)
# Add a new share to the dfstab file
sub create_share
{
open(DFS, ">> $config{dfstab_file}");
print DFS &share_line($_[0]),"\n";
close(DFS);
}
# modify_share(&share)
# Modify an existing share
sub modify_share
{
local $lref = &read_file_lines($config{'dfstab_file'});
splice(@$lref, $_[0]->{'line'}, $_[0]->{'eline'} - $_[0]->{'line'} + 1,
&share_line($_[0]));
&flush_file_lines();
}
# share_line(&share)
sub share_line
{
local $s = "share";
$s .= " -d \"$_[0]->{'desc'}\"" if ($_[0]->{'desc'});
$s .= " -o $_[0]->{'opts'}" if ($_[0]->{'opts'});
$s .= " -F $_[0]->{'type'}" if ($_[0]->{'type'} &&
$_[0]->{'type'} ne $default_type);
$s .= " $_[0]->{'dir'}";
return $s;
}
# delete_share(&share)
# Delete the share for a particular directory
sub delete_share
{
local $lref = &read_file_lines($config{'dfstab_file'});
splice(@$lref, $_[0]->{'line'}, $_[0]->{'eline'} - $_[0]->{'line'} + 1);
&flush_file_lines();
}
# parse_options(string)
# Parse a mount options string like rw=foo,nosuid,... into the associative
# array %options. Parts with no value are given an empty string as the value
sub parse_options
{
local($opt);
undef(%options);
foreach $opt (split(/,/, $_[0])) {
if ($opt =~ /^([^=]+)=(.*)$/) {
$options{$1} = $2;
}
else {
$options{$opt} = "";
}
}
return \%options;
}
# join_options([&options])
# Returns a list of options from the %options array, in the form used in
# the dfstab file
sub join_options
{
local $o = $_[0] ? $_[0] : \%options;
local(@list, $k);
foreach $k (keys %$o) {
if ($o->{$k} eq "") {
push(@list, $k);
}
else {
push(@list, "$k=$o->{$k}");
}
}
return join(',', @list);
}
1;

View File

@@ -1,660 +0,0 @@
# dhcpd-lib.pl
# Functions for parsing the DHCPD config file
do '../web-lib.pl';
&init_config();
# get_parent_config()
# Returns a dummy parent structure for the DHCP config
sub get_parent_config
{
return $get_parent_config_cache if ($get_parent_config_cache);
return ($get_parent_config_cache =
{
'file' => $config{'dhcpd_conf'},
'members' => &get_config(),
'line' => -1,
'eline' => $get_config_lines
} );
}
# get_config()
# Parses the DHCPD config file into a data structure
sub get_config
{
return \@get_config_cache if (@get_config_cache);
local(@tok, @rv, $i, $t, $j, $ifile, @inc, $str);
$get_config_lines = &tokenize_file($config{'dhcpd_conf'}, \@tok);
$i = 0; $j = 0;
while($i < @tok) {
$str = &parse_struct(\@tok, \$i, $j++, $config{'dhcpd_conf'});
if ($str) { push(@rv, $str); }
}
@get_config_cache = @rv;
return \@get_config_cache;
}
# tokenize_file(file, &tokens)
sub tokenize_file
{
local $lines = 0;
local ($line, $cmode);
open(FILE, $_[0]);
while($line = <FILE>) {
# strip comments
$line =~ s/\r|\n//g;
$line =~ s/^([^"#]*)#.*$/$1/g;
$line =~ s/^([^"]*)\/\/.*$/$1/g;
while(1) {
if (!$cmode && $line =~ /\/\*/) {
# start of a C-style comment
$cmode = 1;
$line =~ s/\/\*.*$//g;
}
elsif ($cmode) {
if ($line =~ /\*\//) {
# end of comment
$cmode = 0;
$line =~ s/^.*\*\///g;
}
else { $line = ""; last; }
}
else { last; }
}
# split line into tokens
while(1) {
if ($line =~ /^\s*"([^"]*)"(.*)$/) {
push(@{$_[1]}, [ $1, 1, $lines ]); $line = $2;
}
elsif ($line =~ /^\s*([{};])(.*)$/) {
push(@{$_[1]}, [ $1, 0, $lines ]); $line = $2;
}
elsif ($line =~ /^\s*([^{}; \t]+)(.*)$/) {
push(@{$_[1]}, [ $1, 0, $lines ]); $line = $2;
}
else { last; }
}
$lines++;
}
close(FILE);
return $lines;
}
# parse_struct(&tokens, &token_num, index, file)
# A structure can either have one value, or a list of values.
# Pos will end up at the start of the next structure
sub parse_struct
{
local(%str, $i, $t, @vals, @quotes, $str, @text);
$i = ${$_[1]};
$str{'name'} = $_[0]->[$i]->[0];
$str{'line'} = $_[0]->[$i]->[2];
while(1) {
$t = $_[0]->[++$i];
if ($t->[0] eq "{" || $t->[0] eq ";") { last; }
elsif (!defined($t->[0])) { ${$_[1]} = $i; return undef; }
else { push(@vals, $t->[0]); push(@quotes, $t->[1]); }
push(@text, $t->[1] ? "\"$t->[0]\"" : $t->[0]);
}
$str{'values'} = \@vals;
$str{'quotes'} = \@quotes;
$str{'value'} = $vals[0];
$str{'text'} = join(" ", @text);
$str{'index'} = $_[2];
$str{'file'} = $_[3];
if ($t->[0] eq "{") {
# contains sub-structures.. parse them
local(@mems, $j);
$i++; # skip {
$str{'type'} = 1;
$j = 0;
while($_[0]->[$i]->[0] ne "}") {
if (!defined($_[0]->[$i]->[0]))
{ ${$_[1]} = $i; return undef; }
$str = &parse_struct($_[0], \$i, $j++, $_[3]);
if ($str) { push(@mems, $str); }
}
$str{'members'} = \@mems;
$i++; # skip trailing }
}
else {
# only a single value..
$str{'type'} = 0;
$i++; # skip trailing ;
}
$str{'eline'} = $_[0]->[$i-1]->[2]; # ending line is the line number the
# trailing ; is on
${$_[1]} = $i;
return \%str;
}
# find(name, &array)
sub find
{
local($c, @rv);
foreach $c (@{$_[1]}) {
if ($c->{'name'} eq $_[0]) {
push(@rv, $c);
}
}
return @rv ? wantarray ? @rv : $rv[0]
: wantarray ? () : undef;
}
# find_value(name, &array)
sub find_value
{
local(@v);
@v = &find($_[0], $_[1]);
if (!@v) { return undef; }
elsif (wantarray) { return map { $_->{'value'} } @v; }
else { return $v[0]->{'value'}; }
}
# choice_input(text, name, &config, [display, option]+)
sub choice_input
{
local($rv, $v, $i, @ops);
$rv = "<td><b>$_[0]</b></td> <td>";
$v = &find_value($_[1], $_[2]);
for($i=3; $i<@_; $i+=2) {
@ops = split(/,/, $_[$i+1]);
$rv .= "<input type=radio name=$_[1] value=\"$ops[0]\" ".
($v eq $ops[0] ? "checked" : "").">$_[$i]\n";
}
return $rv."</td>\n";
}
# save_choice(name, &parent, indent)
sub save_choice
{
local($nd);
if ($in{$_[0]}) { $nd = { 'name' => $_[0], 'values' => [ $in{$_[0]} ] }; }
&save_directive($_[1], $_[0], $nd ? [ $nd ] : [ ], $_[2], 1);
}
# addr_match_input(text, name, &config)
# A field for editing a list of addresses, ACLs and partial IP addresses
sub addr_match_input
{
local($v, $rv, $av, @av);
$v = &find($_[1], $_[2]);
$rv = "<td><b>$_[0]</b></td> <td>";
$rv .= "<input type=radio name=$_[1]_def value=1 ".
($v ? "" : "checked").">Default ";
$rv .= "<input type=radio name=$_[1]_def value=0 ".
($v ? "checked" : "").">Listed..<br>";
foreach $av (@{$v->{'members'}}) { push(@av, $av->{'name'}); }
$rv .= "<textarea name=$_[1] rows=3 cols=15>".
join("\n", @av)."</textarea></td>\n";
}
sub save_addr_match
{
local($addr, @vals, $dir);
if ($in{"$_[0]_def"}) { &save_directive($_[1], $_[0], [ ], $_[2], 1); }
else {
foreach $addr (split(/\s+/, $in{$_[0]})) {
push(@vals, { 'name' => $addr });
}
$dir = { 'name' => $_[0], 'type' => 1, 'members' => \@vals };
&save_directive($_[1], $_[0], [ $dir ], $_[2], 1);
}
}
# address_input(text, name, &config, type)
sub address_input
{
local($v, $rv, $av, @av);
$v = &find($_[1], $_[2]);
foreach $av (@{$v->{'members'}}) { push(@av, $av->{'name'}); }
if ($_[3] == 0) {
# text area
$rv = "<td><b>$_[0]</b></td> <td>";
$rv .= "<textarea name=$_[1] rows=3 cols=15>".
join("\n", @av)."</textarea></td>\n";
}
else {
$rv = "<td><b>$_[0]</b></td> <td colspan=3>";
$rv .= "<input name=$_[1] size=50 value=\"".join(' ',@av)."\"></td>\n";
}
return $rv;
}
sub save_address
{
local($addr, @vals, $dir);
foreach $addr (split(/\s+/, $in{$_[0]})) {
&check_ipaddress($addr) || &error("'$addr' is not a valid IP address");
push(@vals, { 'name' => $addr });
}
$dir = { 'name' => $_[0], 'type' => 1, 'members' => \@vals };
&save_directive($_[1], $_[0], @vals ? [ $dir ] : [ ], $_[2], 1);
}
# opt_input(text, name, &config, default, size, units)
sub opt_input
{
local($v, $rv);
$v = &find($_[1], $_[2]);
$rv = "<td><b>$_[0]</b></td> <td nowrap";
$rv .= $_[4] > 30 ? " colspan=3>\n" : ">\n";
$rv .= sprintf "<input type=radio name=$_[1]_def value=1 %s> $_[3]\n",
$v ? "" : "checked";
$rv .= sprintf "<input type=radio name=$_[1]_def value=0 %s> ",
$v ? "checked" : "";
$rv .= sprintf "<input name=$_[1] size=$_[4] value=\"%s\"> $_[5]</td>\n",
$v ? $v->{'value'} : "";
return $rv;
}
# save_opt(name, &func, &parent, [indent], [quote])
sub save_opt
{
local($dir);
if ($in{"$_[0]_def"}) { &save_directive($_[2], $_[0], [ ], $_[3], 1); }
elsif ($_[1] && ($err = &{$_[1]}($in{$_[0]}))) {
&error($err);
}
else {
$dir = { 'name' => $_[0],
'values' => [ $in{$_[0]} ],
'quotes' => [ $_[4] ] };
&save_directive($_[2], $_[0], [ $dir ], $_[3], 1);
}
}
# save_directive(&parent, [name|&oldvalues], &values, indent, start)
# Given a structure containing a directive name, type, values and members
# add, update or remove that directive in config structure and data files.
# Updating of files assumes that there is no overlap between directives -
# each line in the config file must contain part or all of only one directive.
sub save_directive
{
local(@oldv, @newv, $pm, $i, $o, $n, $lref, @nl);
$pm = $_[0]->{'members'};
@oldv = ref($_[1]) ? @{$_[1]} : &find($_[1], $pm);
@newv = @{$_[2]};
for($i=0; $i<@oldv || $i<@newv; $i++) {
if ($i >= @oldv && $_[4]) {
# a new directive is being added.. put it at the start of
# the parent
$lref = &read_file_lines($_[0]->{'file'});
@nl = &directive_lines($newv[$i], $_[3]);
splice(@$lref, $_[0]->{'line'}+1, 0, @nl);
&renumber(&get_config(), $_[0]->{'line'}+1,
$_[0]->{'file'}, scalar(@nl));
&renumber_index($_[0]->{'members'}, 0, 1);
$newv[$i]->{'file'} = $_[0]->{'file'};
$newv[$i]->{'line'} = $_[0]->{'line'}+1;
$newv[$i]->{'eline'} = $_[0]->{'line'} + scalar(@nl);
unshift(@$pm, $newv[$i]);
}
elsif ($i >= @oldv) {
# a new directive is being added.. put it at the end of
# the parent
$lref = &read_file_lines($_[0]->{'file'});
@nl = &directive_lines($newv[$i], $_[3]);
splice(@$lref, $_[0]->{'eline'}, 0, @nl);
&renumber(&get_config(), $_[0]->{'eline'},
$_[0]->{'file'}, scalar(@nl));
$newv[$i]->{'file'} = $_[0]->{'file'};
$newv[$i]->{'line'} = $_[0]->{'eline'};
$newv[$i]->{'eline'} = $_[0]->{'eline'} + scalar(@nl) - 1;
push(@$pm, $newv[$i]);
}
elsif ($i >= @newv) {
# a directive was deleted
$lref = &read_file_lines($oldv[$i]->{'file'});
$ol = $oldv[$i]->{'eline'} - $oldv[$i]->{'line'} + 1;
splice(@$lref, $oldv[$i]->{'line'}, $ol);
&renumber(&get_config(), $oldv[$i]->{'eline'},
$oldv[$i]->{'file'}, -$ol);
&renumber_index($_[0]->{'members'}, $oldv[$i]->{'index'}, -1);
splice(@$pm, &indexof($oldv[$i], @$pm), 1);
}
else {
# updating some directive
$lref = &read_file_lines($oldv[$i]->{'file'});
@nl = &directive_lines($newv[$i], $_[3]);
$ol = $oldv[$i]->{'eline'} - $oldv[$i]->{'line'} + 1;
&renumber(&get_config(), $oldv[$i]->{'eline'},
$oldv[$i]->{'file'}, scalar(@nl) - $ol);
splice(@$lref, $oldv[$i]->{'line'}, $ol, @nl);
$newv[$i]->{'file'} = $_[0]->{'file'};
$newv[$i]->{'line'} = $oldv[$i]->{'line'};
$newv[$i]->{'eline'} = $oldv[$i]->{'line'} + scalar(@nl) - 1;
$pm->[&indexof($oldv[$i], @$pm)] = $newv[$i];
}
}
}
# directive_lines(&directive, tabs)
# Renders some directive into a number of lines of text
sub directive_lines
{
local(@rv, $v, $m, $i);
$rv[0] = "\t" x $_[1];
$rv[0] .= "$_[0]->{'name'}";
for($i=0; $i<@{$_[0]->{'values'}}; $i++) {
$v = $_[0]->{'values'}->[$i];
if ($_[0]->{'quotes'}->[$i]) { $rv[0] .= " \"$v\""; }
else { $rv[0] .= " $v"; }
}
if ($_[0]->{'type'}) {
# multiple values.. include them as well
$rv[0] .= " {";
foreach $m (@{$_[0]->{'members'}}) {
push(@rv, &directive_lines($m, $_[1]+1));
}
push(@rv, ("\t" x ($_[1]+1))."}");
}
else { $rv[$#rv] .= ";"; }
return @rv;
}
# renumber(&directives, line, file, count)
# Runs through the given array of directives and increases the line numbers
# of all those greater than some line by the given count
sub renumber
{
local($d);
local ($list, $line, $file, $count) = @_;
return if (!$count);
foreach $d (@$list) {
if ($d->{'file'} eq $file) {
if ($d->{'line'} >= $line) { $d->{'line'} += $count; }
if ($d->{'eline'} >= $line) { $d->{'eline'} += $count; }
}
if ($d->{'type'}) {
&renumber($d->{'members'}, $line, $file, $count);
}
}
}
# renumber_index(&directives, index, count)
sub renumber_index
{
local($d);
foreach $d (@{$_[0]}) {
if ($d->{'index'} >= $_[1]) {
$d->{'index'} += $_[2];
}
}
}
# directive_diff(&d1, &d2)
# Do two directives differ?
sub directive_diff
{
local $i;
local ($d1, $d2) = @_;
return 1 if ($d1->{'name'} ne $d2->{'name'});
local $l1 = @{$d1->{'values'}};
local $l2 = @{$d2->{'values'}};
return 1 if ($l1 != $l2);
for($i=0; $i<$l1; $i++) {
return 1 if ($d1->{'values'}->[$i] ne $d2->{'values'}->[$i]);
}
return 1 if ($d1->{'type'} != $d2->{'type'});
if ($d1->{'type'}) {
$l1 = @{$d1->{'members'}};
$l2 = @{$d2->{'members'}};
return 1 if ($l1 != $l2);
for($i=0; $i<$l1; $i++) {
return 1 if (&directive_diff($d1->{'members'}->[$i],
$d2->{'members'}->[$i]));
}
}
return 0;
}
# group_name($members)
sub group_name
{
return ($_[0] == 0) ? $text{'index_nomemb'} :
($_[0] == 1) ? $text{'index_1memb'} :
($_[0] >= 2 && $_[0] <= 4) ? &text('index_234memb', $_[0]) :
&text('index_memb', $_[0]);
}
# get_subnets_and_hosts()
# returns the references to sorted lists of hosts and subnets
sub get_subnets_and_hosts
{
return (\@get_subnets_cache, \@get_hosts_cache)
if (@get_subnets_cache && @get_hosts_cache);
local(@subn,@host,@group,@shan, $s,$h,$g,$sn, $conf);
$conf = &get_config();
# get top level hosts and groups
@host = &find("host", $conf);
foreach $h (&find("host", $conf)) {
$h->{'order'} = $h->{'index'};
}
@group = &find("group", $conf);
foreach $g (@group) {
foreach $h (&find("host", $g->{'members'})) {
push(@host, $h);
}
}
@subn = &find("subnet", $conf);
foreach $u (@subn) {
foreach $h (&find("host", $u->{'members'})) {
push(@host, $h);
}
foreach $g (&find("group", $u->{'members'})) {
push(@group, $g);
foreach $h (&find("host", $g->{'members'})) {
push(@host, $h);
}
}
}
@shan = &find("shared-network", $conf);
foreach $s (@shan) {
foreach $h (&find("host", $s->{'members'})) {
push(@host, $h);
}
foreach $g (&find("group", $s->{'members'})) {
push(@group, $g);
foreach $h (&find("host", $g->{'members'})) {
push(@host, $h);
}
}
foreach $u (&find("subnet", $s->{'members'})) {
push(@subn, $u);
foreach $h (&find("host", $u->{'members'})) {
push(@host, $h);
}
foreach $g (&find("group", $sn->{'members'})) {
push(@group, $g);
foreach $h (&find("host", $g->{'members'})) {
push(@host, $h);
}
}
}
}
@get_subnets_cache = sort { $a->{'order'} <=> $b->{'order'} } @subn;
@get_hosts_cache = sort { $a->{'order'} <=> $b->{'order'} } @host;
return (\@get_subnets_cache, \@get_hosts_cache);
}
sub get_subnets
{
local ($sr, $hr) = &get_subnets_and_hosts();
return @{$sr};
}
sub get_hosts
{
local ($sr, $hr) = &get_subnets_and_hosts();
return @{$hr};
}
# hash that links objtypes shortcuts with object names
%obj_names2types = qw(host hst group grp subnet sub shared-network sha);
# get_branch($objtype)
# usefull for edit_*.cgi and save_*.cgi scripts
# $objtype = one of 'hst' 'grp' 'sub' 'sha'
sub get_branch
{
local %obj_types2names = reverse %obj_names2types;
local $name = $obj_types2names{$_[0]};
local ($parnode, $nparnode, $node, $indent, $nindent);
$parnode = $nparnode = &get_parent_config();
$indent = $nindent = 0;
foreach ($in{'sidx'}, $in{'uidx'}, $in{'gidx'}) {
if ($_ ne '') {
$parnode = $parnode->{'members'}->[$_];
$indent++;
}
}
if (!($in{'delete'} && $in{'options'})) {
if ($in{'assign'} > 0 && !defined($in{'parent'})) {
# A quirk for not javascript-capable browser
# New parent is undefined yet; we need 2nd step
undef $nparnode;
}
else {
foreach (split(/\,/, $in{'parent'})) {
$nindent++;
if ($_ < @{$nparnode->{'members'}}) {
$nparnode = $nparnode->{'members'}->[$_];
}
}
}
}
if (!$in{'new'}) {
$node = $parnode->{'members'}->[$in{'idx'}];
}
else {
die "Wrong call to get_nodes: pass objtype for new object" unless $name;
# Construct new node structure
$node->{'name'} = $name;
$node->{'type'} = 1;
$node->{'members'} = [ ];
}
return ($parnode, $node, $indent, $nparnode, $nindent);
}
# can(permissions_string, \%access, \%config_node, smode)
# this is a cached wrapper of can_noncached(...)
sub can
{
local ($perm, $acc, $node, $smode) = @_;
if (defined($can_cache) &&
($can_perm_cache eq $perm) &&
($can_node_cache eq $node) &&
($can_smode_cache eq $smode)) {
return $can_cache;
}
else {
$can_perm_cache = $perm;
$can_node_cache = $node;
$can_smode_cache = $smode;
return ($can_cache = &can_noncached(@_));
}
}
# can_noncached(permissions_string, \%access, \%config_node, smode)
# check global and per-object permissions:
#
# permissions_string= 'c' 'r' 'w' or any combination.
# smode= 0 or undef - check only current, 1 - recursive childs check,
# 2 - check parents, 3 - check parents and all childs
# note: while deleting an object you must allways enforce smode=1 or 3
# because all child objects are deletes recursevly.
# this maybe an optional parameter
sub can_noncached
{
local $acl;
local ($perm, $acc, $node, $smode) = @_;
local @perm = split(//, $perm);
if ($node ne get_parent_config()) {
foreach (@perm) {
next if ($_ ne 'c') && ($_ ne 'r') && ($_ ne 'w');
return 0 unless $acc->{$_ . '_' . $obj_names2types{$node->{'name'}} };
}
# per-object permissions
return 0 unless &can_node(\@perm, $acc, $node);
if (($acc->{'smode'} == 2) || ($smode == 2) ||
($acc->{'smode'} == 3) || ($smode == 3)) {
# check parents
$parnode=&get_parent_config();
foreach ($in{'sidx'}, $in{'uidx'}, $in{'gidx'}) {
if ($_ ne '') {
$parnode = $parnode->{'members'}->[$_];
return 0 unless &can_node(\@perm, $acc, $parnode);
}
}
}
if (($acc->{'smode'} == 1) || ($smode == 1) ||
($acc->{'smode'} == 3) || ($smode == 3)) {
# check childs
return 0 unless &can_subtree(\@perm, $acc, $node);
}
}
return 1;
}
# can_node(\@perm, $acc, $node)
# checks object permissions for current node
sub can_node
{
local ($rperm, $acc, $node)=@_;
# per-object permissions
local $otype=$obj_names2types{$node->{'name'}};
if ($acc->{'per_' . $otype . '_acls'}) {
local $acl = $acc->{'ACL' . $otype . '_' . $node->{'values'}->[0]};
foreach (@{$rperm}) {
next if $_ eq 'c'; # skip creation perms for per-obj acls
return 0 if index($acl, $_) == -1;
}
}
return 1;
}
# can_subtree(\@perm, $acc, $node)
# checks object permissions for subtree
sub can_subtree
{
local ($rperm, $acc, $node)=@_;
return 0 unless &can_node($rperm, $acc, $node);
if($node->{'members'}) {
# recursevly process this subtree
foreach (@{$node->{'members'}}) {
return 0 unless &can_subtree($rperm, $acc, $_);
}
}
return 1;
}
# save_dhcpd_acl(permissions_string, obj_type, \%access, obj_name)
sub save_dhcpd_acl
{
$_[2]->{'ACL'.$_[1].'_'.$_[3]} = $_[0];
undef($can_cache);
return &save_module_acl($_[2]);
}
# drop_dhcpd_acl(obj_type, \%access, obj_name)
sub drop_dhcpd_acl
{
delete($_[1]->{'ACL'.$_[0].'_'.$_[2]});
undef($can_cache);
return &save_module_acl($_[1]);
}
1;

View File

@@ -44,8 +44,7 @@ if (@exps) {
$ccount = 0;
foreach $c (@cl) {
$dirs .= "&nbsp;|&nbsp; " if ($ccount++);
$dirs .= "<a href='edit_export.cgi?idx=$c->{'index'}'>".
&describe_host($c->{'host'})."</a>\n";
$dirs .= &ui_link("edit_export.cgi?idx=$c->{'index'}",&describe_host($c->{'host'}))\n";
if (!$c->{'active'}) {
$dirs .= "<font color=#ff0000>(".
$text{'index_inactive'}.")</font>\n"

View File

@@ -69,8 +69,7 @@ if (@disks) {
"disk=$d->{'index'}'>$text{'index_blink'}</a>");
}
print &ui_columns_row([
$ed ? "<a href='edit_disk.cgi?device=$d->{'device'}'>".
$d->{'desc'}."</a>"
$ed ? &ui_link("edit_disk.cgi?device=$d->{'device'}",$d->{'desc'})
: $d->{'desc'},
$d->{'size'} ? &nice_size($d->{'size'}) : "",
$d->{'model'},

View File

@@ -122,7 +122,7 @@ else {
$i = 0;
foreach $u (@users) {
print "<tr>\n" if ($i%4 == 0);
print "<td width=25%><a href='edit_user.cgi?user=$u->[1]->[0]'>$u->[1]->[0]</a></td>\n";
print &ui_link("edit_user.cgi?user=$u->[1]->[0]","$u->[1]->[0]")."</td>\n";
print "</tr>\n" if ($i%4 == 3);
$i++;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,345 +0,0 @@
// Hierarchy
// An AWT component for displaying a tree-like heirachy, with each node
// having an icon and a name. This heirachy can be expanded or contracted
// by the user.
import java.awt.*;
import java.util.Vector;
public class Hierarchy extends BorderPanel implements CbScrollbarCallback
{
HierarchyNode root; // the root of the tree
CbScrollbar sb; // scrollbar at right
int width, height; // usable drawing area
int sbwidth; // size of scrollbar
HierarchyCallback callback; // who to call on open / close
Image bim; // double-buffer image
Font font = new Font("courier", Font.PLAIN, 12);
FontMetrics fnm; // size of font used
Graphics bg; // back-images graphics
int top = 0; // top-most row displayed
int count = 0; // total rows in the tree
Insets in; // insets from border
HierarchyNode sel; // selected node
long last; // time of last mouse click
static boolean broken_awt = System.getProperty("os.name").
startsWith("Windows");
// Create a new Hierarchy object with the given root
Hierarchy(HierarchyNode r)
{
this();
root = r;
}
// Create a new Hierarchy object that calls back to the given object
// when nodes are clicked on.
Hierarchy(HierarchyNode r, HierarchyCallback c)
{
this(r);
callback = c;
}
// Create an empty hierarchy object, with no callback
Hierarchy()
{
super(3, new Color(50,50,50), new Color(220,220,220));
// Create UI
setLayout(null);
sb = new CbScrollbar(CbScrollbar.VERTICAL, this);
add(sb);
}
// Create an empty hierarchy object, set to report user actions to
// the given object.
Hierarchy(HierarchyCallback c)
{
this();
callback = c;
}
// redraw
// Called by the using class when the tree passed to this object
// changes, to force a redraw and resizing of the scrollbar
void redraw()
{
if (fnm != null) {
render();
paint(getGraphics());
compscroll();
}
}
// setRoot
// Set the root node for this hierarchy
void setRoot(HierarchyNode r)
{
root = r;
redraw();
}
// selected
// Return the currently selected node, or null
HierarchyNode selected()
{
return sel;
}
// select
// Selected the given node
void select(HierarchyNode s)
{
sel = s;
}
// force the use of some font
void setFont(Font f)
{
font = f;
bim = null;
repaint();
}
// reshape
// Called when this component gets resized
public void reshape(int nx, int ny, int nw, int nh)
{
in = insets();
sbwidth = sb.minimumSize().width;
width = nw-sbwidth - (in.left + in.right);
height = nh - (in.top + in.bottom);
sb.reshape(width+in.left, in.top, sbwidth, height);
// force creation of a new backing images
bim = null;
repaint();
compscroll();
super.reshape(nx, ny, nw, nh);
}
// update
// Called sometime after repaint()
public void update(Graphics g)
{
render();
paint(g);
}
// paint
// Blit the backing image to the front
public void paint(Graphics g)
{
super.paint(g);
if (bim == null) {
// This is the first rendering
bim = createImage(width, height);
bg = bim.getGraphics();
bg.setFont(font);
fnm = bg.getFontMetrics();
render();
compscroll();
}
g.drawImage(bim, in.left, in.top, this);
}
// mouseDown
// Called upon a mouseclick
public boolean mouseDown(Event evt, int x, int y)
{
if (root == null)
return false; // nothing to do
HierarchyNode s = nodeat(root, x/16, (y/16)+top);
if (s == null) {
// Just deselect
sel = null;
repaint();
return true;
}
// Check for double-click
boolean dc = false;
if (evt.when-last < 500 && sel == s)
dc = true;
else
last = evt.when;
sel = s;
if (dc && sel.ch != null) {
// Open or close this node
sel.open = !sel.open;
if (callback != null) {
// Notify callback, which MAY do something to change
// the structure of the tree
if (sel.open) callback.openNode(this, sel);
else callback.closeNode(this, sel);
}
}
else if (callback != null) {
// Single click on a node or double-click on leaf node
if (dc) callback.doubleNode(this, sel);
else callback.clickNode(this, sel);
}
compscroll();
repaint();
return true;
}
public void moved(CbScrollbar s, int v)
{
moving(s, v);
}
public void moving(CbScrollbar s, int v)
{
top = sb.getValue();
compscroll();
repaint();
}
// render
// Draw the current tree view into the backing image
private void render()
{
if (fnm != null) {
int fh = fnm.getHeight(), // useful font metrics
fa = fnm.getAscent();
bg.setColor(Color.white);
bg.fillRect(0, 0, width, height);
if (root == null)
return; // nothing to do
bg.setColor(Color.black);
recurse(root, 0, 0, fh, fa);
}
}
// recurse
// Render a node in the tree at the given location, maybe followed
// by all it's children. Return the number of rows this node took
// to display.
private int recurse(HierarchyNode n, int x, int y, int fh, int fa)
{
int xx = x*16, yy = (y-top)*16;
int len = 1;
n.x = x;
n.y = y;
int tw = fnm.stringWidth(n.text);
if (yy >= 0 && yy <= height) {
// Draw this node
if (n.im != null)
bg.drawImage(n.im, xx, yy, this);
if (sel == n) {
// Select this node
bg.setColor(Color.lightGray);
bg.fillRect(xx+17, yy+2, tw+2, 13);
bg.setColor(Color.black);
}
bg.drawString(n.text, xx+18, yy+12);
}
if (n.ch != null && n.open && yy <= height) {
// Mark this node
bg.drawLine(xx+18, yy+14, xx+17+tw, yy+14);
// Draw subnodes
yy += 16;
for(int i=0; i<n.ch.size() && yy<=height; i++) {
int l=recurse((HierarchyNode)n.ch.elementAt(i),
x+1, y+len, fh, fa);
bg.drawLine(xx+7, yy+7, xx+15, yy+7);
if (i == n.ch.size()-1)
bg.drawLine(xx+7, yy, xx+7, yy+7);
else
bg.drawLine(xx+7, yy, xx+7,yy+(l*16)-1);
len += l;
yy += l*16;
}
}
return len;
}
// compscroll
// Re-compute scrollbar size
private void compscroll()
{
if (fnm == null)
return;
int ct = root!=null ? count(root) : 1;
int r = Math.min(ct, height/16 - 1);
int c = ct - r;
//sb.setValues(top, r==0?1:r, c<0?0:c);
sb.setValues(top, r==0?1:r, ct);
}
// count
// Returns the number of visible rows from a node
private int count(HierarchyNode n)
{
int l = 1;
if (n.open && n.ch != null)
for(int i=0; i<n.ch.size(); i++)
l += count((HierarchyNode)n.ch.elementAt(i));
return l;
}
// nodeat
// Is the given node at the given position? If not, check its
// children too.
private HierarchyNode nodeat(HierarchyNode n, int x, int y)
{
if (y == n.y && x >= n.x)
return n;
if (n.ch == null || !n.open)
return null;
for(int i=0; i<n.ch.size(); i++) {
HierarchyNode c = nodeat((HierarchyNode)n.ch.elementAt(i),x,y);
if (c != null) return c;
}
return null;
}
}
// HierarchyNode
// One node in the tree displayed by the Hierarchy object.
class HierarchyNode
{
boolean open; // is this node open?
Image im; // icon for this node (assumed to be 16x16!)
Vector ch; // sub-nodes of this one, or null
String text; // name of this node
int x, y; // row/column in list
HierarchyNode() { }
HierarchyNode(boolean o, Image i, Vector c, String t)
{
open = o;
im = i;
ch = c;
text = t;
}
}
// HierarchyCallback
// Programmers using the Hierarchy class pass an object that implements the
// HierarchyCallback interface to its constructor, to receive information
// about user actions.
interface HierarchyCallback
{
// openNode
// Called when a node with children is opened
void openNode(Hierarchy h, HierarchyNode n);
// closeNode
// Called when a node is closed
void closeNode(Hierarchy h, HierarchyNode n);
// clickNode
// Called when the user clicks on a node
void clickNode(Hierarchy h, HierarchyNode n);
// doubleNode
// Called when a user double-clicks on a node
void doubleNode(Hierarchy h, HierarchyNode n);
}

View File

@@ -1,578 +0,0 @@
// MultiColumn
// A List box that supports multiple columns.
import java.awt.*;
import java.util.Vector;
public class MultiColumn extends BorderPanel implements CbScrollbarCallback
{
MultiColumnCallback callback; // what to call back to
String title[]; // column titles
boolean adjustable = true;
boolean drawlines = true;
Color colors[][] = null;
boolean enabled = true;
boolean multiselect = false;
int cpos[]; // column x positions
float cwidth[]; // proportional column widths
Vector list[]; // columns of the list
CbScrollbar sb; // scrollbar at the right side
int width, height; // size, minus the scrollbar
Insets in; // used space around the border
int sbwidth; // width of the scrollbar
int th; // height of title bar
Image bim; // backing image
Graphics bg; // backing graphics
Font font = new Font("timesRoman", Font.PLAIN, 12);
FontMetrics fnm; // drawing font size
int coldrag = -1; // column being resized
int sel = -1; // selected row
int sels[] = new int[0]; // all selected rows
int top = 0; // first row displayed
long last; // last mouse click time
int rowh = 16; // row height
Event last_event; // last event that triggered callback
int sortcol; // Column currently being sorted
int sortdir; // Sort direction (0=none, 1=up, 2=down)
// Create a new list with the given column titles
MultiColumn(String t[])
{
super(3, new Color(50,50,50), new Color(220,220,220));
title = new String[t.length];
for(int i=0; i<t.length; i++)
title[i] = t[i];
list = new Vector[t.length];
for(int i=0; i<t.length; i++)
list[i] = new Vector();
cwidth = new float[t.length];
for(int i=0; i<t.length; i++)
cwidth[i] = 1.0f/t.length;
cpos = new int[t.length+1];
setLayout(null);
sb = new CbScrollbar(CbScrollbar.VERTICAL, this);
add(sb);
}
// Create a new list that calls back to the given object on
// single or double clicks.
MultiColumn(String t[], MultiColumnCallback c)
{
this(t);
callback = c;
}
// addItem
// Add a row to the list
void addItem(Object item[])
{
for(int i=0; i<title.length; i++)
list[i].addElement(item[i]);
repaint();
compscroll();
}
// addItems
// Add several rows to the list
void addItems(Object item[][])
{
for(int i=0; i<item.length; i++)
for(int j=0; j<title.length; j++)
list[j].addElement(item[i][j]);
repaint();
compscroll();
}
// modifyItem
// Changes one row of the table
void modifyItem(Object item[], int row)
{
for(int i=0; i<title.length; i++)
list[i].setElementAt(item[i], row);
repaint();
compscroll();
}
// getItem
// Returns the contents of a given row
Object []getItem(int n)
{
Object r[] = new Object[title.length];
for(int i=0; i<title.length; i++)
r[i] = list[i].elementAt(n);
return r;
}
// selected
// Return the most recently selected row
int selected()
{
return sel;
}
// select
// Select some row
void select(int s)
{
sel = s;
sels = new int[1];
sels[0] = s;
repaint();
}
// select
// Select multiple rows
void select(int s[])
{
if (s.length == 0) {
sel = -1;
sels = new int[0];
}
else {
sel = s[0];
sels = s;
}
repaint();
}
// allSelected
// Returns all the selected rows
int[] allSelected()
{
return sels;
}
// scrollto
// Scroll to make some row visible
void scrollto(int s)
{
int r = rows();
if (s < top || s >= top+r) {
top = s-1;
if (top > list[0].size() - r)
top = list[0].size() - r;
sb.setValue(top);
repaint();
}
}
// deleteItem
// Remove one row from the list
void deleteItem(int n)
{
for(int i=0; i<title.length; i++)
list[i].removeElementAt(n);
if (n == sel) {
// De-select deleted file
sel = -1;
}
for(int i=0; i<sels.length; i++) {
if (sels[i] == n) {
// Remove from selection list
int nsels[] = new int[sels.length-1];
if (nsels.length > 0) {
System.arraycopy(sels, 0, nsels, 0, i);
System.arraycopy(sels, i+1, nsels, i,
nsels.length-i);
sel = nsels[0];
}
break;
}
}
repaint();
compscroll();
}
// clear
// Remove everything from the list
void clear()
{
for(int i=0; i<title.length; i++)
list[i].removeAllElements();
sel = -1;
sels = new int[0];
top = 0;
repaint();
sb.setValues(0, 1, 0);
}
// setWidths
// Set the proportional widths of each column
void setWidths(float w[])
{
for(int i=0; i<title.length; i++)
cwidth[i] = w[i];
respace();
repaint();
}
/**Turns on or off the user's ability to adjust column widths
* @param a Can adjust or not?
*/
void setAdjustable(boolean a)
{
adjustable = a;
}
/**Turns on or off the drawing of column lines
* @param d Draw lines or not?
*/
void setDrawLines(boolean d)
{
drawlines = d;
}
/**Sets the array of colors used to draw text items.
* @param c The color array (in row/column order), or null to
* use the default
*/
void setColors(Color c[][])
{
colors = c;
repaint();
}
// Turns on or off multi-row selection with ctrl and shift
void setMultiSelect(boolean m)
{
multiselect = m;
}
// Enables the entire list
public void enable()
{
enabled = true;
sb.enable();
repaint();
}
// Disables the entire list
public void disable()
{
enabled = false;
sb.disable();
repaint();
}
// Sets or turns off the sort indication arrow for a column
// Direction 0 = None, 1 = Up arrow, 2 = Down arrow
public void sortingArrow(int col, int dir)
{
sortcol = col;
sortdir = dir;
repaint();
}
// reshape
// Called when this component gets resized
public void reshape(int nx, int ny, int nw, int nh)
{
if (nw != width+sbwidth || nh != height) {
in = insets();
sbwidth = sb.minimumSize().width;
width = nw-sbwidth - (in.left + in.right);
height = nh - (in.top + in.bottom);
sb.reshape(width+in.left, in.top, sbwidth, height);
respace();
// Force creation of a new backing image and re-painting
bim = null;
repaint();
compscroll();
}
super.reshape(nx, ny, nw, nh);
}
// respace
// Compute pixel column widths from proportional widths
void respace()
{
cpos[0] = 0;
for(int i=0; i<title.length; i++)
cpos[i+1] = cpos[i] + (int)(width*cwidth[i]);
}
// paint
// Blit the backing image to the front
public void paint(Graphics g)
{
super.paint(g);
if (bim == null) {
// This is the first rendering
bim = createImage(width, height);
bg = bim.getGraphics();
bg.setFont(font);
fnm = bg.getFontMetrics();
th = fnm.getHeight() + 4;
render();
compscroll();
}
g.drawImage(bim, in.left, in.top, this);
}
// update
// Called sometime after repaint()
public void update(Graphics g)
{
if (fnm != null) {
render();
paint(g);
}
}
// render
// Re-draw the list into the backing image
void render()
{
int fh = fnm.getHeight(), // useful font metrics
fd = fnm.getDescent(),
fa = fnm.getAscent();
int bot = Math.min(top+rows()-1, list[0].size()-1);
// Clear title section and list
bg.setColor(Color.lightGray);
bg.fillRect(0, 0, width, th);
bg.setColor(Color.white);
bg.fillRect(0, th, width, height-th);
Color lighterGray = new Color(Color.lightGray.getRed() + 20,
Color.lightGray.getGreen() + 20,
Color.lightGray.getBlue() + 20);
if (enabled) {
// Mark the selected rows
for(int i=0; i<sels.length; i++) {
if (sels[i] >= top && sels[i] <= bot) {
bg.setColor(sels[i] == sel ? Color.lightGray
: lighterGray);
bg.fillRect(0, th+(sels[i]-top)*rowh,
width, rowh);
}
}
}
// Draw each column
for(int i=0; i<title.length; i++) {
int x = cpos[i], w = cpos[i+1]-x-1;
// Column title
bg.setColor(Color.white);
bg.drawLine(x, 0, x+w, 0);
bg.drawLine(x, 1, x+w-1, 1);
bg.drawLine(x, 0, x, th-1);
bg.drawLine(x+1, 0, x+1, th-2);
bg.setColor(Color.black);
bg.drawLine(x, th-1, x+w, th-1);
bg.drawLine(x, th-2, x+w-1, th-2);
bg.drawLine(x+w, th-1, x+w, 0);
bg.drawLine(x+w-1, th-1, x+w-1, 1);
int tw = fnm.stringWidth(title[i]);
if (tw < w-6)
bg.drawString(title[i], x+(w-tw)/2, th-fd-2);
// Sorting arrow
int as = th-8;
if (sortcol == i && sortdir == 1) {
bg.setColor(Color.white);
bg.drawLine(x+4, th-5, x+4+as, th-5);
bg.drawLine(x+4+as, th-5, x+4+as/2, th-5-as);
bg.setColor(Color.black);
bg.drawLine(x+4+as/2, th-5-as, x+4, th-5);
}
else if (sortcol == i && sortdir == 2) {
bg.setColor(Color.white);
bg.drawLine(x+4+as/2, th-5, x+4+as, th-5-as);
bg.setColor(Color.black);
bg.drawLine(x+4, th-5-as, x+4+as, th-5-as);
bg.drawLine(x+4, th-5-as, x+4+as/2, th-5);
}
// Column items
if (drawlines) {
bg.setColor(Color.lightGray);
bg.drawLine(x+w-1, th, x+w-1, height);
bg.setColor(Color.black);
bg.drawLine(x+w, th, x+w, height);
}
for(int j=top; j<=bot; j++) {
Object o = list[i].elementAt(j);
if (o instanceof String) {
// Render string in column
String s = (String)o;
while(fnm.stringWidth(s) > w-3)
s = s.substring(0, s.length()-1);
if (!enabled)
bg.setColor(Color.lightGray);
else if (colors != null)
bg.setColor(colors[j][i]);
bg.drawString(s, x+1, th+(j+1-top)*rowh-fd);
}
else if (o instanceof Image) {
// Render image in column
Image im = (Image)o;
bg.drawImage(im, x+1, th+(j-top)*rowh, this);
}
}
}
}
// mouseDown
// Select a list item or a column to drag
public boolean mouseDown(Event e, int x, int y)
{
if (!enabled) {
return true;
}
x -= in.left;
y -= in.top;
coldrag = -1;
if (y < th) {
// Click in title bar
for(int i=0; i<title.length; i++) {
if (adjustable && i > 0 && Math.abs(cpos[i] - x) < 3) {
// clicked on a column separator
coldrag = i;
}
else if (x >= cpos[i] && x < cpos[i+1]) {
// clicked in a title
callback.headingClicked(this, i);
}
}
}
else {
// Item chosen from list
int row = (y-th)/rowh + top;
if (row < list[0].size()) {
// Double-click?
boolean dclick = false;
if (e.when-last < 1000 && sel == row)
dclick = true;
else
last = e.when;
if (e.shiftDown() && multiselect && sel != -1) {
// Select all from last selection to this one
int zero = sels[0];
if (zero < row) {
sels = new int[row-zero+1];
for(int i=zero; i<=row; i++)
sels[i-zero] = i;
}
else {
sels = new int[zero-row+1];
for(int i=zero; i>=row; i--)
sels[zero-i] = i;
}
}
else if (e.controlDown() && multiselect) {
// Add this one to selection
int nsels[] = new int[sels.length + 1];
System.arraycopy(sels, 0, nsels, 0,sels.length);
nsels[sels.length] = row;
sels = nsels;
}
else {
// Select one row only, and de-select others
sels = new int[1];
sels[0] = row;
}
sel = row;
repaint();
last_event = e;
if (callback != null) {
// Callback the right function
if (dclick) callback.doubleClick(this, row);
else callback.singleClick(this, row);
}
else {
// Send an event
getParent().postEvent(
new Event(this,
Event.ACTION_EVENT,
dclick?"Double":"Single"));
}
}
}
return true;
}
// mouseDrag
// If a column is selected, change it's width
public boolean mouseDrag(Event e, int x, int y)
{
if (!enabled) {
return true;
}
x -= in.left;
y -= in.top;
if (coldrag != -1) {
if (x > cpos[coldrag-1]+3 && x < cpos[coldrag+1]-3) {
cpos[coldrag] = x;
cwidth[coldrag-1] = (cpos[coldrag]-cpos[coldrag-1]) /
(float)width;
cwidth[coldrag] = (cpos[coldrag+1]-cpos[coldrag]) /
(float)width;
repaint();
}
}
return true;
}
public void moved(CbScrollbar s, int v)
{
moving(s, v);
}
public void moving(CbScrollbar s, int v)
{
top = sb.getValue();
compscroll();
repaint();
}
// compscroll
// Re-compute the size of the scrollbar
private void compscroll()
{
if (fnm == null)
return; // not visible
int r = rows();
int c = list[0].size() - r;
sb.setValues(top, r==0?1:r, list[0].size());
}
// rows
// Returns the number of rows visible in the list
private int rows()
{
return Math.min(height/rowh - 1, list[0].size());
}
public Dimension minimumSize()
{
return new Dimension(400, 100);
}
public Dimension preferredSize()
{
return minimumSize();
}
}
// MultiColumnCallback
// Objects implementing this interface can be passed to the MultiColumn
// class, to have their singleClick() and doubleClick() functions called in
// response to single or double click in the list.
interface MultiColumnCallback
{
// singleClick
// Called on a single click on a list item
void singleClick(MultiColumn list, int num);
// doubleClick
// Called upon double-clicking on a list item
void doubleClick(MultiColumn list, int num);
// headingClicked
// Called when a column heading is clicked on
void headingClicked(MultiColumn list, int col);
}

View File

@@ -1,24 +0,0 @@
#!/usr/local/bin/perl
# getext.cgi
# Returns a string of EXT attributes for some file
require './file-lib.pl';
&ReadParse();
&switch_acl_uid();
print "Content-type: text/plain\n\n";
if (!&can_access($in{'file'})) {
print $text{'facl_eaccess'},"\n";
}
else {
$out = `lsattr -d '$in{'file'}' 2>&1`;
if ($? || $out !~ /^(\S+)\s/) {
print $out,"\n";
}
else {
print "\n";
@a = split(//, $1);
print join("", grep { $_ ne '-' } @a),"\n";
}
}

View File

@@ -1,79 +0,0 @@
#!/usr/local/bin/perl
# index.cgi
# Output HTML for the file manager applet
require './file-lib.pl';
&ReadParse();
$theme_no_table = 1;
if ($access{'uid'} < 0 && !defined(getpwnam($remote_user))) {
&error(&text('index_eremote', $remote_user));
}
# Display header, depending on how many modules the user has
&read_acl(undef, \%acl);
$mc = @{$acl{$base_remote_user}} == 1;
$nolo = $ENV{'ANONYMOUS_USER'} ||
$ENV{'SSL_USER'} || $ENV{'LOCAL_USER'} ||
$ENV{'HTTP_USER_AGENT'} =~ /webmin/i;
if ($gconfig{'gotoone'} && $mc == 1 && !$nolo) {
&header($text{'index_title'}, "", undef, 0, 1);
$w = 100;
$h = 80;
}
else {
&header($text{'index_title'});
$w = 100;
$h = 100;
}
if ($gconfig{'referers_none'}) {
# Because java applet HTTP requests don't always include a referer:
# header, we need to use a DBM of trust keys to identify trusted applets
if (defined(&seed_random)) { &seed_random(); }
else { srand(time() ^ $$); }
$trust = int(rand(1000000000));
local $now = time();
&open_trust_db();
foreach $k (keys %trustdb) {
if ($now - $trustdb{$k} > 30*24*60*60) {
delete($trustdb{$k});
}
}
$trustdb{$trust} = $now;
dbmclose(%trustdb);
}
$sharing = $access{'uid'} ? 0 : 1;
&read_acl(undef, \%acl);
$mc = @{$acl{$base_remote_user}};
if (!$gconfig{'gotoone'} || $mc > 1) {
%minfo = &get_module_info();
$return = "<param name=return value=\"$gconfig{'webprefix'}/?cat=$minfo{'category'}\">";
}
if ($in{'open'}) {
$open = "<param name=open value=\"$in{'open'}\">\n";
}
print <<EOF;
<script>
function upload(dir)
{
open("upform.cgi?dir="+dir+"&trust=$trust", "upload", "toolbar=no,menubar=no,scrollbar=no,width=450,height=200");
}
</script>
<applet code=FileManager name=FileManager width=$w% height=$h% MAYSCRIPT>
<param name=root value="$access{'root'}">
<param name=follow value="$access{'follow'}">
<param name=ro value="$access{'ro'}">
<param name=sharing value="$sharing">
<param name=trust value="$trust">
<param name=goto value="$access{'goto'}">
$open
$return
$text{'index_nojava'} <p>
</applet>
EOF
&footer();

View File

@@ -1,198 +0,0 @@
index_title=Dosya Yöneticisi
index_nojava=Bu modül java gerektirir, fakat sizin tarayıcınız java'yi desteklemiyor
top_open=Aç
top_view=Göster
top_edit=Değiştir
top_refresh=Yenile
top_info=Bilgi
top_delete=Sil
top_new=Yeni
top_upload=Yükleme(Upload)
top_rename=Yeniden Adlandır
top_copy=Kopyala
top_cut=Kes
top_paste=Yapıştır
top_share=Paylaştır
right_name=Ad
right_size=Boyut
right_user=Kullanıcı
right_group=Grup
right_date=Tarih
edit_enormal=Sadece normal dosyalar değiştirilebilir
edit_title=$1 değiştiriliyor
edit_title2=Dosya oluşturuluyor
edit_filename=Dosya İsmi:
edit_eover=$1 üzerine yazılamaz
edit_esave=Dosyanın kaydedilmesinde hata oluştu : $1
edit_eaccess='$1' kaydedilmesine izininiz yoktur
info_file=Dosya
info_path=Yol:
info_type=Tip:
info_size=Boyut:
info_mod=Değiştirildi:
info_link=Link to:#####
info_perms=Haklar
info_user=Kullanıcı:
info_group=Grup:
info_other=Diğerleri:
info_sticky=Sticky:
info_sticky2=Dosyaları sadece sahipleri silebilir
info_own=Sahiplik
info_setuid=Uid'yi belirt:
info_setuid2=Kullanıcı Olarak Çalıştır
info_setgid=Gid'yi Oluştur:
info_setgid2=Dosyalar grubun olsun
info_setgid3=Grup olarak çalıştır
info_apply=Değişiklikleri uygula ...
info_apply1=Sadece bu dizine
info_apply2=Bu dizin ve dosyalarına
info_apply3=Bu dizin ve alt dizinlerine
info_efailed=Güncellemede hata oluştu $1 : $2
info_read=Oku
info_write=Yaz
info_list=Listele
info_exec=Çalıştır
delete_dtitle=Dizin Sil
delete_ftitle=Dosya Sil
delete_ddesc=$1 dizinini ve içindekileri silmek istediğinizden eminmisiniz?
delete_fdesc=$1 dizinini silmek istediinizden eminmisiniz?
delete_efailed=Silme işleminde hata oluştu $1 : $2
mkdir_title=Yeni Dizin
mkdir_dir=Yeni dizin:
mkdir_eexists=$1 dizini mevcut
mkdir_efailed=Dizin oluşturmada hata oluştu : $1
mkdir_eaccess='$1' dizini oluşturmaya hakkınız yok
link_title=Link Oluştur
link_from=Link buradan:
link_to=Link buraya:
link_eexists=$1 her zaman mevcut
link_efailed=Link oluşturulurken hata oluştu : $1
link_efrom='$1' den link oluşturmaya hakkınız yoktur
link_efollow=Sembolik linkler oluşturmaya hakkınız yoktur
rename_title=Yeniden Adlandır $1
rename_old=Eski İsmi:
rename_new=Yeni İsmi:
rename_ok=Yeniden Adlandır
rename_eexists=$1 dosyası her zaman mevcut
rename_efailed=Yeniden adlandırmada hata oluştu : $1
rename_eold='$1'i yeniden adlandırmaya hakkınız yoktur
rename_enew='$1' olarak yeniden adlandyrmaya hakkynyz yoktur
file_type0=Dizin
file_type1=Yazı Dosyası
file_type2=Resim Dosyası
file_type3=İkili Dosya
file_type4=Dosya
file_type5=Sembolik Link
file_type6=Araç Dosyası
file_type7=Boru
view_enormal=Sadece normal dosyalar görüntülenebilir
view_eaccess=$1'e erişime hakkınız yoktur
view_eopen=Açma işleminde hata oluştu $1 : $2
paste_ecopy=Yapıştırmadan önce kopyalamalı veya kesmelisiniz
paste_egone=Kopyalanan dosya $1 artık yok
paste_eover=$1 üzerine yazılamaz
paste_eself=Dosyayı kendi üzerine yapıştıramazsınız
paste_emfailed=Taşımada hata oluştu : $1
paste_ecfailed=Kopyalamada hata olutu : $1
over_title=Dosya Mevcut
over_msg=$1 dosyası her zaman mevcut. Yapıştırılan dosyaya yeni bir isim girmek için boş formu kullanınız.
over_new=Yeni dosya ismi
over_ok=Tamam
upload_efailed=Dosyanın yüklenmesinde hata oluştu : $1
upload_title=Dosyayı Yükle
upload_file=Yüklecek Dosya
upload_dir=Dizine Yükleme
upload_ok=Yükle
upload_conv=DOS satırları çevirilsin mi?
upload_efile=Yüklenecek dosya seçilmedi.
upload_edir=Yükleme dizini mevcut değil
upload_eperm=$1 oluşturmanıza izin verilmedi
upload_ewrite=$1'i yazmada hata oluştu : $2.
find_eaccess=$1'e erişim izininiz yoktur
find_eexist=$1, $2 içinde mevcut değil
find_edir=$1, $2'de bir dizin değil
cancel=İptal
chmod_eaccess='$1'e eriim izininiz yoktur
chmod_euser=$1 : Kullanııcı yok
chmod_egroup=$1 : Grup yok
chmod_elink=Sembolik linkte hata oluştu : $1
chmod_echown=chown'da hata oluştu : $1
chmod_echmod=chmod'da hata olustu : $1
copy_efrom='$1'den kopyalamanıza izin verilmemiştir
copy_eto='$1'e kopyalamanıza izin verilmemiştir
copy_elink=Sembolik linkte hata oluştu : $1
delete_eaccess='$1'i silmede hata oluştu
list_eaccess=Bu dizine giriş izininiz yoktur
move_eto='$1'e taşımaya hakkınız yoktur
move_afrom='$1'i taşımaya hakkynyz yoktur
acl_user=Sunucuda kullanıcı olarak dosyalara ulaş
acl_umask=Yeni dosyalar için umask
acl_follow=Sembolik linkleri her zaman takip et.
acl_dirs=Sadece dizinlere girişlere izin ver.
share_title=Paylaştırma
share_samba=Windows
share_nfs=NFS
share_son=Windows dosya paylaşımıık
share_soff=Windows dosya paylaşımı kapalı
share_writable=Yazılabilir?
share_available=Aktif mi?
share_sheader=Paylaşım seçenekleri
share_only=Sadece
share_guest=Ziyaretçi girişleri?
share_comment=Açıklama
share_nheader=NFS sunum seçenekleri
share_non=NFS dosya paylaşımıık
share_noff=NFS dosya paylaşımı kapalı
share_desc=Açıklama
share_ro=Sadece okuma izinli makineler
share_rw=Okuma-yazma izinli makineler
share_root=Root girişli makineler
share_none=Hiçbiri
share_all=Hepsi
share_listed=Listeli...
share_host=Makineler
share_opts=Seçenekler
share_s0=Hiçkimseye güvenme
share_s1=Root dışındakilere güven
share_s2=Herkese güven
share_lro=Sadece okunur
share_lrw=Okunur-yazılır
log_create_export=NFS sunumu $1 oluşturuldu
log_modify_export=NFS sunumu $1 değiştirildi
log_delete_export=NFS sunumu $1 silindi
log_create_share=Samba paylaşımı $1 oluşturuldu
log_modify_share=Samba paylaşımı $1 değiştirildi
log_delete_share=Samba paylaşımı $1 silindi
log_save=$1 dosyası kaydedildi
log_chmod=$1 dosyasının hakları değiştirildi
log_mkdir=$1 dizini oluşturuldu
log_upload=$1 dosyası yüklendi
log_link=$2'ye sembolik link $1 oluşturuldu
log_relink=$2'ye sembolik link $1 değiştirildi
log_copy=$1 dosyası $2'ye kopyalandı
log_move=$1 dosyası $2'ye taşındı
log_delete=$1 dosyası silindi

View File

@@ -1,204 +0,0 @@
index_title=Linux Firewall
index_ecommand=The command $1 was not found on your system. Webmin needs this command to configure IPtables.
index_ekernel=An error occured when checking your current IPtables configuration : $1 This may indicate that your kernel does not support IPtables.
index_header=Firewall configuration from $1
index_change=Showing IPtable:
index_chain_input=Incoming packets (INPUT)
index_chain_output=Outgoing packets (OUTPUT)
index_chain_forward=Forwarded packets (FORWARD)
index_chain_prerouting=Packets before routing (PREROUTING)
index_chain_postrouting=Packets after routing (POSTROUTING)
index_chain=Chain $1
index_action=Action
index_desc=Condition
index_move=Move
index_none=There are no rules defined for this chain.
index_policy=Set default action to:
index_policy_accept=Accept
index_policy_drop=Drop
index_policy_queue=Userspace
index_policy_return=Exit chain
index_jump_accept=<font color=#00aa00>Accept</font>
index_jump_drop=<font color=#ff0000>Drop</font>
index_jump_queue=<font color=#0000ff>Userspace</font>
index_jump_return=Exit chain
index_jump_masquerade=Masquerade
index_jump_redirect=Redirect
index_jump_=Do nothing
index_jump=Run chain $1
index_radd=Add rule
index_cdelete=Delete chain
index_cclear=Clear all rules
index_cadd=Add a new chain named:
index_apply=Apply Configuration
index_applydesc=Click this button to make the firewall configuration listed above active. Any firewall rules currently in effect will be flushed and replaced
index_unapply=Revert Configuration
index_unapplydesc=Click this button to reset the configuration listed above to the one that is currently active.
index_table_filter=Packet filtering (filter)
index_table_nat=Network address translation (nat)
index_table_mangle=Packet alteration (mangle)
index_existing=Webmin has detected $1 IPtables firewall rules currently in use, which are not recorded in the save file $2. These rules were probably setup from a script, which this module does not know how to read and edit.<p>If you want to use this module to manage your IPtables firewall, click the button below to convert the existing rules to a save file, and then disable your existing firewall script.
index_saveex=Save Firewall Rules
index_atboot=Enable firewall at boot time?
index_headerex=Existing firewall configuration
index_bootup=Activate at boot
index_bootupdesc=Change this option to control whether your firewall is activated at boot time or not.
index_return=rules list
index_setup=No IPtables firewall has been setup yet on your system. Webmin can set one up for you, to be stored in the save file $1, with the initial settings based your selection of firewall type below..
index_auto0=Allow all traffic
index_auto1=Do network address translation on external interface:
index_auto2=Block all incoming connections on external interface:
index_auto=Setup Firewall
desc_p=protocol is $1
desc_p!=protocol is not $1
desc_s=source is $1
desc_s!=source is not $1
desc_d=destination is $1
desc_d!=destination is not $1
desc_i=input interface is $1
desc_i!=input interface is not $1
desc_o=output interface is $1
desc_o!=output interface is not $1
desc_f=packet is a fragment
desc_f!=packet is not a fragment
desc_sport=source port is $1
desc_sport!=source port is not $1
desc_dport=destination port is $1
desc_dport!=destination port is not $1
desc_tcp-flags=TCP flags $2 (of $1) are set
desc_tcp-flags!=TCP flags $2 (of $1) are not set
desc_tcp-option=packet uses TCP option $1
desc_tcp-option!=packet does not use TCP option $1
desc_icmp-type=ICMP type is $1
desc_icmp-type!=ICMP type is not $1
desc_mac=ethernet address is $1
desc_mac!=ethernet address is not $1
desc_limit=rate is less than $1
desc_limit!=rate is more than $1
desc_limit-burst=burst rate is less than $1
desc_limit-burst!=burst rate is more than $1
desc_ports=source and destination port are $1
desc_ports!=source and destination port are not $1
desc_uid-owner=sender is user $1
desc_uid-owner!=sender is not user $1
desc_gid-owner=sender is group $1
desc_gid-owner!=sender is not group $1
desc_pid-owner=process ID of sender is $1
desc_pid-owner!=process ID of sender is not $1
desc_sid-owner=session group of sender is $1
desc_sid-owner!=session group of sender is not $1
desc_state=state of connection is $1
desc_state!=state of connection is not $1
desc_tos=type of service field is $1
desc_tos!=type of service field is not $1
desc_conds=If $1
desc_and=and
desc_always=Always
redhat_escript=The Redhat IPtables startup script $1 was not found on your system.
redhat_eoutput=An error occured getting IPtables status from the command $1. This probably indicates that your system has been configured to use IPchains instead of IPtables.
gentoo_escript=The Gentoo IPtables startup script $1 was not found on your system.
eiptables=Unknown IPtables save file line : $1
edit_title1=Add Rule
edit_title2=Edit Rule
edit_header1=Chain and action details
edit_chain=Part of chain
edit_jump=Action to take
edit_jump_other=Run chain
edit_header2=Condition details
edit_desc=The action selected above will only be carried out if <b>all</b> the conditions below are met.
edit_source=Source address or network
edit_ignore=Ignored
edit_is=Equals
edit_not=Does not equal
edit_dest=Destination address or network
edit_in=Incoming interface
edit_out=Outgoing interface
edit_frag=Fragmentation
edit_fragis=Is fragmented
edit_fragnot=Is not fragmented
edit_proto=Network protocol
edit_sport=Source TCP or UDP port
edit_dport=Destination TCP or UDP port
edit_port0=Port(s)
edit_port1=Port range $1 to $2
edit_ports=Source and destination port(s)
edit_tcpflags=TCP flags set
edit_flags=$2 out of<br> $1
edit_tcpoption=TCP option number is set
edit_icmptype=ICMP packet type
edit_mac=Ethernet address
edit_limit=Packet flow rate
edit_below=Below
edit_above=Above
edit_limitburst=Packet burst rate
edit_uidowner=Sending unix user
edit_gidowner=Sending unix group
edit_pidowner=Sending process ID
edit_sidowner=Sending process group
edit_state=Connection state
edit_state_new=New connection
edit_state_established=Existing connection
edit_state_related=Related to existing
edit_state_invalid=Not part of any connection
edit_tos=Type of service
save_err=Failed to save rule
save_echain=Missing or invalid chain to run
save_esource=Missing or invalid source address or network
save_edest=Missing or invalid destination address or network
save_ein=Missing or invalid incoming interface
save_eout=Missing or invalid outgoing interface
save_eproto=No protocol selected
save_esport=Missing or invalid source port(s)
save_esportfrom=Invalid range start for source ports
save_esportto=Invalid range end for source ports
save_esportrange=You must enter at least a start or end for the source port range
save_etcpudp=Source and destination port conditions can only be used if the protocol is TCP or UDP
save_edport=Missing or invalid destination port(s)
save_edportfrom=Invalid range start for destination ports
save_edportto=Invalid range end for destination ports
save_edportrange=You must enter at least a start or end for the destination port range
save_eports=Missing or invalid source and destination port(s)
save_etcp1=The TCP flags condition can only be used if the protocol is TCP
save_etcpflags=You must select at least one TCP flag from each row
save_etcp2=The TCP option number condition can only be used if the protocol is TCP
save_etcpoption=Missing or invalid TCP option number
save_eicmp=The ICMP packet type condition can only be used if the protocol is ICMP
save_emac=Missing or invalid ethernet address
save_elimit=Missing or invalid packet flow rate
save_elimitburst=Missing or invalid packet burst rate
save_euidowner=Missing or invalid sending unix user
save_egidowner=Missing or invalid sending unix group
save_epidowner=Missing or invalid sending process ID
save_esidowner=Missing or invalid sending process group ID
delete_title=Delete Chain
delete_rusure=Are you sure you want to delete the chain $1 ? $2 rules within it will be deleted.
delete_ok=Delete Now
clear_title=Clear Chain
clear_rusure=Are you sure you want to delete all $2 rules from chain $1 ?
new_err=Failed to create chain
new_ename=Missing or invalid chain name
new_etaken=A chain with this name already exists
apply_err=Failed to apply configuration
unapply_err=Failed to revert configuration
log_create_rule=Added rule to chain $1 in table $2
log_modify_rule=Modified rule in chain $1 in table $2
log_delete_rule=Deleted rule in chain $1 in table $2
log_move_rule=Moved rule in chain $1 in table $2
log_delete_chain=Deleted chain $1 from table $2
log_clear_chain=Cleared chain $1 in table $2
log_create_chain=Created chain $1 in table $2
log_modify_chain=Set default action for chain $1 in table $2
log_apply=Applied configuration
log_unapply=Reverted configuration
log_setup=Set up firewall
log_convert=Converted existing firewall

View File

@@ -1,414 +0,0 @@
# linux-lib.pl
# supported_filesystems()
# Returns a list of filesystem types on which dumping is supported
sub supported_filesystems
{
local @rv;
push(@rv, "ext2", "ext3") if (&has_command("dump"));
push(@rv, "xfs") if (&has_command("xfsdump"));
return @rv;
}
# dump_form(&dump)
sub dump_form
{
# Display common options
print "<tr> <td valign=top><b>",&hlink($text{'dump_dest'}, "dest"),
"</b></td> <td colspan=3>\n";
printf "<input type=radio name=mode value=0 %s> %s\n",
$_[0]->{'host'} ? '' : 'checked', $text{'dump_file'};
printf "<input name=file size=50 value='%s'> %s<br>\n",
$_[0]->{'host'} ? '' : $_[0]->{'file'},
&file_chooser_button("file");
printf "<input type=radio name=mode value=1 %s>\n",
$_[0]->{'host'} ? 'checked' : '';
print &text('dump_host',
"<input name=host size=15 value='$_[0]->{'host'}'>",
"<input name=huser size=8 value='$_[0]->{'huser'}'>",
"<input name=hfile size=20 value='$_[0]->{'hfile'}'>"),
"</td> </tr>\n";
if ($_[0]->{'fs'} eq 'xfs') {
# Display xfs dump options
print "<tr> <td><b>",&hlink($text{'dump_level'},"level"),"</b></td>\n";
print "<td><select name=level>\n";
foreach $l (0 .. 9) {
printf "<option value=%d %s>%d %s\n",
$l, $_[0]->{'level'} == $l ? "selected" : "", $l,
$text{'dump_level_'.$l};
}
print "</select></td>\n";
print "<td><b>",&hlink($text{'dump_label'},"label"),"</b></td>\n";
printf "<td><input name=label size=15 value='%s'></td> </tr>\n",
$_[0]->{'label'};
print "<tr> <td><b>",&hlink($text{'dump_max'},"max"),"</b></td>\n";
printf "<td><input type=radio name=max_def value=1 %s> %s\n",
$_[0]->{'max'} ? '' : 'checked', $text{'dump_unlimited'};
printf "<input type=radio name=max_def value=0 %s>\n",
$_[0]->{'max'} ? 'checked' : '';
printf "<input name=max size=8 value='%s'> kB</td>\n", $_[0]->{'max'};
print "<td><b>",&hlink($text{'dump_attribs'},"attribs"),"</b></td>\n";
printf "<td><input type=radio name=noattribs value=0 %s> %s\n",
$_[0]->{'noattribs'} ? '' : 'checked', $text{'yes'};
printf "<input type=radio name=noattribs value=1 %s> %s</td> </tr>\n",
$_[0]->{'noattribs'} ? 'checked' : '', $text{'no'};
print "<tr> <td><b>",&hlink($text{'dump_over'},"over"),"</b></td>\n";
printf "<td><input type=radio name=over value=0 %s> %s\n",
$_[0]->{'over'} ? '' : 'checked', $text{'yes'};
printf "<input type=radio name=over value=1 %s> %s</td>\n",
$_[0]->{'over'} ? 'checked' : '', $text{'no'};
print "<td><b>",&hlink($text{'dump_invent'},"invent"),"</b></td>\n";
printf "<td><input type=radio name=noinvent value=0 %s> %s\n",
$_[0]->{'noinvent'} ? '' : 'checked', $text{'yes'};
printf "<input type=radio name=noinvent value=1 %s> %s</td> </tr>\n",
$_[0]->{'noinvent'} ? 'checked' : '', $text{'no'};
print "<tr> <td><b>",&hlink($text{'dump_overwrite'},"overwrite"),
"</b></td>\n";
printf "<td><input type=radio name=overwrite value=1 %s> %s\n",
$_[0]->{'overwrite'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=overwrite value=0 %s> %s</td>\n",
$_[0]->{'overwrite'} ? '' : 'checked', $text{'no'};
print "<td><b>",&hlink($text{'dump_erase'},"erase"),"</b></td>\n";
printf "<td><input type=radio name=erase value=1 %s> %s\n",
$_[0]->{'erase'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=erase value=0 %s> %s</td> </tr>\n",
$_[0]->{'erase'} ? '' : 'checked', $text{'no'};
}
else {
# Display ext2/3 filesystem dump options
print "<tr> <td><b>",&hlink($text{'dump_update'},"update"),
"</b></td>\n";
printf "<td><input name=update type=radio value=1 %s> %s\n",
$_[0]->{'update'} ? 'checked' : '', $text{'yes'};
printf "<input name=update type=radio value=0 %s> %s</td>\n",
$_[0]->{'update'} ? '' : 'checked', $text{'no'};
print "<td><b>",&hlink($text{'dump_multi'},"multi"),"</b></td>\n";
printf "<td><input name=multi type=radio value=1 %s> %s\n",
$_[0]->{'multi'} ? 'checked' : '', $text{'yes'};
printf "<input name=multi type=radio value=0 %s> %s</td> </tr>\n",
$_[0]->{'multi'} ? '' : 'checked', $text{'no'};
print "<tr> <td><b>",&hlink($text{'dump_level'},"level"),"</b></td>\n";
print "<td><select name=level>\n";
foreach $l (0 .. 9) {
printf "<option value=%d %s>%d %s\n",
$l, $_[0]->{'level'} == $l ? "selected" : "", $l,
$text{'dump_level_'.$l};
}
print "</select></td>\n";
print "<td><b>",&hlink($text{'dump_label'},"label"),"</b></td>\n";
printf "<td><input name=label size=15 value='%s'></td> </tr>\n",
$_[0]->{'label'};
}
}
# parse_dump(&dump)
sub parse_dump
{
# Parse common options
if ($in{'mode'} == 0) {
$in{'file'} =~ /\S/ || &error($text{'dump_efile'});
$_[0]->{'file'} = $in{'file'};
delete($_[0]->{'host'});
delete($_[0]->{'huser'});
delete($_[0]->{'hfile'});
}
else {
gethostbyname($in{'host'}) || &check_ipaddress($in{'host'}) ||
&error($text{'dump_ehost'});
$_[0]->{'host'} = $in{'host'};
$in{'huser'} =~ /^\S+$/ || &error($text{'dump_ehuser'});
$_[0]->{'huser'} = $in{'huser'};
$in{'hfile'} || &error($text{'dump_ehfile'});
$_[0]->{'hfile'} = $in{'hfile'};
delete($_[0]->{'file'});
}
if ($_[0]->{'fs'} eq 'xfs') {
# Parse xfs options
local $mp;
foreach $m (&foreign_call("mount", "list_mounted")) {
$mp++ if ($m->[0] eq $in{'dir'});
}
$mp || &error($text{'dump_emp'});
$in{'label'} =~ /^\S*$/ && length($in{'label'}) < 256 ||
&error($text{'dump_elabel2'});
$_[0]->{'label'} = $in{'label'};
$_[0]->{'level'} = $in{'level'};
if ($in{'max_def'}) {
delete($_[0]->{'max'});
}
else {
$in{'max'} =~ /^\d+$/ || &error($text{'dump_emax'});
$_[0]->{'max'} = $in{'max'};
}
$_[0]->{'noattribs'} = $in{'noattribs'};
$_[0]->{'over'} = $in{'over'};
$_[0]->{'noinvent'} = $in{'noinvent'};
$_[0]->{'overwrite'} = $in{'overwrite'};
$_[0]->{'erase'} = $in{'erase'};
}
else {
# Parse ext2/3 options
$_[0]->{'update'} = $in{'update'};
$_[0]->{'multi'} = $in{'multi'};
$_[0]->{'level'} = $in{'level'};
$in{'label'} =~ /^\S*$/ && length($in{'label'}) < 16 ||
&error($text{'dump_elabel'});
$_[0]->{'label'} = $in{'label'};
}
}
# execute_dump(&dump, filehandle, escape)
# Executes a dump and displays the output
sub execute_dump
{
local $fh = $_[1];
local ($cmd, $flag);
if ($_[0]->{'huser'}) {
$flag = " -f '$_[0]->{'huser'}@$_[0]->{'host'}:$_[0]->{'hfile'}'";
}
elsif ($_[0]->{'host'}) {
$flag = " -f '$_[0]->{'host'}:$_[0]->{'hfile'}'";
}
else {
$flag = " -f '$_[0]->{'file'}'";
}
if ($_[0]->{'fs'} eq 'xfs') {
# xfs backup
$cmd = "xfsdump -l $_[0]->{'level'}";
$cmd .= $flag;
$cmd .= " -L '$_[0]->{'label'}'" if ($_[0]->{'label'});
$cmd .= " -M '$_[0]->{'label'}'" if ($_[0]->{'label'});
$cmd .= " -z '$_[0]->{'max'}'" if ($_[0]->{'max'});
$cmd .= " -A" if ($_[0]->{'noattribs'});
$cmd .= " -F" if ($_[0]->{'over'});
$cmd .= " -J" if ($_[0]->{'noinvent'});
$cmd .= " -o" if ($_[0]->{'overwrite'});
$cmd .= " -E -F" if ($_[0]->{'erase'});
$cmd .= " '$_[0]->{'dir'}'";
}
else {
# ext2/3 backup
$cmd = "dump -$_[0]->{'level'}";
$cmd .= $flag;
$cmd .= " -u" if ($_[0]->{'update'});
$cmd .= " -M" if ($_[0]->{'multi'});
$cmd .= " -L '$_[0]->{'label'}'" if ($_[0]->{'label'});
$cmd .= " '$_[0]->{'dir'}'";
}
&system_logged("sync");
sleep(1);
&additional_log('exec', undef, $cmd);
open(CMD, "$cmd 2>&1 </dev/null |");
while(<CMD>) {
if ($_[2]) {
print $fh &html_escape($_);
}
else {
print $fh $_;
}
}
close(CMD);
}
# dump_dest(&dump)
sub dump_dest
{
if ($_[0]->{'file'}) {
return "<tt>".&html_escape($_[0]->{'file'})."</tt>";
}
elsif ($_[0]->{'huser'}) {
return "<tt>".&html_escape("$_[0]->{'huser'}@$_[0]->{'host'}:$_[0]->{'hfile'}")."</tt>";
}
else {
return "<tt>".&html_escape("$_[0]->{'host'}:$_[0]->{'hfile'}")."</tt>";
}
}
# missing_restore_command(filesystem)
sub missing_restore_command
{
local $cmd = $_[0] eq 'xfs' ? 'xfsrestore' : 'restore';
return &has_command($cmd) ? undef : $cmd;
}
# restore_form(filesystem)
sub restore_form
{
# common options
print "<tr> <td valign=top><b>",&hlink($text{'restore_src'}, "rsrc"),
"</b></td>\n";
printf "<td colspan=3><input type=radio name=mode value=0 checked> %s\n",
$text{'dump_file'};
printf "<input name=file size=50> %s<br>\n",
&file_chooser_button("file");
printf "<input type=radio name=mode value=1>\n";
print &text('dump_host',
"<input name=host size=15>",
"<input name=huser size=8>",
"<input name=hfile size=20>"),
"</td> </tr>\n";
if ($_[0] eq 'xfs') {
# xfs restore options
print "<tr> <td><b>",&hlink($text{'restore_dir'},"rdir"),
"</b></td> <td colspan=3>\n";
print "<input name=dir size=50> ",&file_chooser_button("dir", 1),
"</td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'restore_over'},"rover"),
"</b></td>\n";
print "<td colspan=3><input type=radio name=over value=0 checked> ",
"$text{'restore_over0'}\n";
print "<input type=radio name=over value=1> $text{'restore_over1'}\n";
print "<input type=radio name=over value=2> ",
"$text{'restore_over2'}</td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'restore_noattribs'},"rnoattribs"),
"</b></td> <td>\n";
print "<input type=radio name=noattribs value=0 checked> $text{'yes'}\n";
print "<input type=radio name=noattribs value=1> $text{'no'}</td>\n";
print "<td><b>",&hlink($text{'restore_label'},"rlabel"),"</b></td>\n";
print "<td><input name=label size=20></td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'restore_test'},"rtest"),"</td>\n";
print "<td><input type=radio name=test value=1> $text{'yes'}\n";
print "<input type=radio name=test value=0 checked> $text{'no'}</td> </tr>\n";
}
else {
# ext2/3 restore options
print "<tr> <td><b>",&hlink($text{'restore_files'},"rfiles"),
"</b></td>\n";
print "<td colspan=3><input type=radio name=files_def value=1 checked> ",
"$text{'restore_all'}\n";
print "<input type=radio name=files_def value=0> $text{'restore_sel'}\n";
print "<input name=files size=40></td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'restore_dir'},"rdir"),"</td>\n";
print "<td colspan=3><input name=dir size=40> ",
&file_chooser_button("dir", 1),"</td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'restore_multi'},"rmulti"),
"</b></td>\n";
print "<td><input type=radio name=multi value=1> $text{'yes'}\n";
print "<input type=radio name=multi value=0 checked> $text{'no'}</td>\n";
print "<td><b>",&hlink($text{'restore_test'},"rtest"),"</td>\n";
print "<td><input type=radio name=test value=1> $text{'yes'}\n";
print "<input type=radio name=test value=0 checked> $text{'no'}</td> </tr>\n";
}
}
# parse_restore(filesystem)
# Parses inputs from restore_form() and returns a command to be passed to
# restore_backup()
sub parse_restore
{
local $cmd;
if ($_[0] eq 'xfs') {
$cmd = "xfsrestore";
$cmd .= " -t" if ($in{'test'});
}
else {
$cmd = "restore";
$cmd .= ($in{'test'} ? " -t" : " -x");
}
if ($in{'mode'} == 0) {
$in{'file'} || &error($text{'restore_efile'});
$cmd .= " -f '$in{'file'}'";
}
else {
gethostbyname($in{'host'}) || &check_ipaddress($in{'host'}) ||
&error($text{'restore_ehost'});
$in{'huser'} =~ /^\S*$/ || &error($text{'restore_ehuser'});
$in{'hfile'} || &error($text{'restore_ehfile'});
if ($in{'huser'}) {
$cmd .= " -f '$in{'huser'}@$in{'host'}:$in{'hfile'}'";
}
else {
$cmd .= " -f '$in{'host'}:$in{'hfile'}'";
}
}
if ($_[0] eq 'xfs') {
# parse xfs options
$cmd .= " -E" if ($in{'over'} == 1);
$cmd .= " -e" if ($in{'over'} == 2);
$cmd .= " -A" if ($in{'noattribs'});
$cmd .= " -L '$in{'label'}'" if ($in{'label'});
$cmd .= " -F";
if (!$in{'test'}) {
-d $in{'dir'} || &error($text{'restore_edir'});
$cmd .= " '$in{'dir'}'";
}
}
else {
# parse ext2/3 options
$cmd .= " -M" if ($in{'multi'});
if (!$in{'files_def'}) {
$in{'files'} || &error($text{'restore_efiles'});
$cmd .= " $in{'files'}";
}
-d $in{'dir'} || &error($text{'restore_edir'});
}
return $cmd;
}
# restore_backup(filesystem, command)
# Restores a backup based on inputs from restore_form(), and displays the results
sub restore_backup
{
&additional_log('exec', undef, $_[1]);
if ($_[0] eq 'xfs') {
# Just run the backup command
open(CMD, "$_[1] 2>&1 </dev/null |");
while(<CMD>) {
print &html_escape($_);
}
close(CMD);
}
else {
# Need to supply prompts
&foreign_require("proc", "proc-lib.pl");
local ($fh, $fpid) = &foreign_call("proc", "pty_process_exec", "cd '$in{'dir'}' ; $_[1]");
local $donevolume;
while(1) {
local $rv = &wait_for($fh, "(next volume #)", "(set owner.mode for.*\\[yn\\])", "((.*)\\[yn\\])", "(.*\\n)");
last if ($rv < 0);
print &html_escape($matches[1]);
if ($rv == 0) {
if ($donevolume++) {
return $text{'restore_evolume'};
}
else {
syswrite($fh, "1\n");
}
}
elsif ($rv == 1) {
syswrite($fh, "n\n");
}
elsif ($rv == 2) {
return &text('restore_equestion',
"<tt>$matches[2]</tt>");
}
}
close($fh);
}
return undef;
}
1;

View File

@@ -1,7 +0,0 @@
name=Dump
desc=Filesystem Backup
category=system
depends=mount cron proc
os_support=redhat-linux mandrake-linux slackware-linux debian-linux suse-linux open-linux turbo-linux corel-linux cobalt-linux msc-linux generic-linux solaris freebsd
desc_zh_TW.Big5=Àɮרt²Î³Æ¥÷
desc_ca=Còpia de Sistemes de Fitxers

View File

@@ -1,244 +0,0 @@
# solaris-lib.pl
# supported_filesystems()
# Returns a list of filesystem types on which dumping is supported
sub supported_filesystems
{
local @rv;
push(@rv, "ufs") if (&has_command("ufsdump"));
return @rv;
}
# dump_form(&dump)
sub dump_form
{
# Display common options
print "<tr> <td valign=top><b>",&hlink($text{'dump_dest'}, "dest"),
"</b></td> <td colspan=3>\n";
printf "<input type=radio name=mode value=0 %s> %s\n",
$_[0]->{'host'} ? '' : 'checked', $text{'dump_file'};
printf "<input name=file size=50 value='%s'> %s<br>\n",
$_[0]->{'host'} ? '' : $_[0]->{'file'},
&file_chooser_button("file");
printf "<input type=radio name=mode value=1 %s>\n",
$_[0]->{'host'} ? 'checked' : '';
print &text('dump_host',
"<input name=host size=15 value='$_[0]->{'host'}'>",
"<input name=huser size=8 value='$_[0]->{'huser'}'>",
"<input name=hfile size=20 value='$_[0]->{'hfile'}'>"),
"</td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'dump_update'},"update"),
"</b></td>\n";
printf "<td><input name=update type=radio value=1 %s> %s\n",
$_[0]->{'update'} ? 'checked' : '', $text{'yes'};
printf "<input name=update type=radio value=0 %s> %s</td>\n",
$_[0]->{'update'} ? '' : 'checked', $text{'no'};
print "<td><b>",&hlink($text{'dump_verify'},"verify"),"</b></td>\n";
printf "<td><input name=verify type=radio value=1 %s> %s\n",
$_[0]->{'verify'} ? 'checked' : '', $text{'yes'};
printf "<input name=verify type=radio value=0 %s> %s</td> </tr>\n",
$_[0]->{'verify'} ? '' : 'checked', $text{'no'};
print "<tr> <td><b>",&hlink($text{'dump_level'},"level"),"</b></td>\n";
print "<td><select name=level>\n";
foreach $l (0 .. 9) {
printf "<option value=%d %s>%d %s\n",
$l, $_[0]->{'level'} == $l ? "selected" : "", $l,
$text{'dump_level_'.$l};
}
print "</select></td>\n";
print "<td><b>",&hlink($text{'dump_offline'},"offline"),"</b></td>\n";
printf "<td><input name=offline type=radio value=1 %s> %s\n",
$_[0]->{'offline'} ? 'checked' : '', $text{'yes'};
printf "<input name=offline type=radio value=0 %s> %s</td> </tr>\n",
$_[0]->{'offline'} ? '' : 'checked', $text{'no'};
}
# parse_dump(&dump)
sub parse_dump
{
# Parse common options
if ($in{'mode'} == 0) {
$in{'file'} =~ /\S/ || &error($text{'dump_efile'});
$_[0]->{'file'} = $in{'file'};
delete($_[0]->{'host'});
delete($_[0]->{'huser'});
delete($_[0]->{'hfile'});
}
else {
gethostbyname($in{'host'}) || &check_ipaddress($in{'host'}) ||
&error($text{'dump_ehost'});
$_[0]->{'host'} = $in{'host'};
$in{'huser'} =~ /^\S+$/ || &error($text{'dump_ehuser'});
$_[0]->{'huser'} = $in{'huser'};
$in{'hfile'} || &error($text{'dump_ehfile'});
$_[0]->{'hfile'} = $in{'hfile'};
delete($_[0]->{'file'});
}
$_[0]->{'update'} = $in{'update'};
$_[0]->{'verify'} = $in{'verify'};
$_[0]->{'level'} = $in{'level'};
$_[0]->{'offline'} = $in{'offline'};
}
# execute_dump(&dump, filehandle, escape)
# Executes a dump and displays the output
sub execute_dump
{
local $fh = $_[1];
local $cmd = "ufsdump $_[0]->{'level'}";
$cmd .= "u" if ($_[0]->{'update'});
$cmd .= "v" if ($_[0]->{'verify'});
$cmd .= "o" if ($_[0]->{'offline'});
if ($_[0]->{'huser'}) {
$cmd .= "f '$_[0]->{'huser'}@$_[0]->{'host'}:$_[0]->{'hfile'}'";
}
elsif ($_[0]->{'host'}) {
$cmd .= "f '$_[0]->{'host'}:$_[0]->{'hfile'}'";
}
else {
$cmd .= "f '$_[0]->{'file'}'";
}
$cmd .= " '$_[0]->{'dir'}'";
&system_logged("sync");
sleep(1);
&additional_log('exec', undef, $cmd);
open(CMD, "$cmd 2>&1 </dev/null |");
while(<CMD>) {
if ($_[2]) {
print $fh &html_escape($_);
}
else {
print $fh $_;
}
}
close(CMD);
}
# dump_dest(&dump)
sub dump_dest
{
if ($_[0]->{'file'}) {
return "<tt>".&html_escape($_[0]->{'file'})."</tt>";
}
elsif ($_[0]->{'huser'}) {
return "<tt>".&html_escape("$_[0]->{'huser'}@$_[0]->{'host'}:$_[0]->{'hfile'}")."</tt>";
}
else {
return "<tt>".&html_escape("$_[0]->{'host'}:$_[0]->{'hfile'}")."</tt>";
}
}
# missing_restore_command(filesystem)
sub missing_restore_command
{
return &has_command("ufsrestore") ? undef : "ufsrestore";
}
# restore_form(filesystem)
sub restore_form
{
# common options
print "<tr> <td valign=top><b>",&hlink($text{'restore_src'}, "rsrc"),
"</b></td>\n";
printf "<td colspan=3><input type=radio name=mode value=0 checked> %s\n",
$text{'dump_file'};
printf "<input name=file size=50> %s<br>\n",
&file_chooser_button("file");
printf "<input type=radio name=mode value=1>\n";
print &text('dump_host',
"<input name=host size=15>",
"<input name=huser size=8>",
"<input name=hfile size=20>"),
"</td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'restore_files'},"rfiles"),
"</b></td>\n";
print "<td colspan=3><input type=radio name=files_def value=1 checked> ",
"$text{'restore_all'}\n";
print "<input type=radio name=files_def value=0> $text{'restore_sel'}\n";
print "<input name=files size=40></td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'restore_dir'},"rdir"),"</td>\n";
print "<td><input name=dir size=40> ",&file_chooser_button("dir", 1),
"</td> </tr>\n";
print "<tr> <td><b>",&hlink($text{'restore_test'},"rtest"),"</td>\n";
print "<td><input type=radio name=test value=1> $text{'yes'}\n";
print "<input type=radio name=test value=0 checked> $text{'no'}</td> </tr>\n";
}
# parse_restore(filesystem)
# Parses inputs from restore_form() and returns a command to be passed to
# restore_backup()
sub parse_restore
{
local $cmd;
$cmd = "ufsrestore";
$cmd .= ($in{'test'} ? " t" : " x");
if ($in{'mode'} == 0) {
$in{'file'} || &error($text{'restore_efile'});
$cmd .= "f '$in{'file'}'";
}
else {
gethostbyname($in{'host'}) || &check_ipaddress($in{'host'}) ||
&error($text{'restore_ehost'});
$in{'huser'} =~ /^\S*$/ || &error($text{'restore_ehuser'});
$in{'hfile'} || &error($text{'restore_ehfile'});
if ($in{'huser'}) {
$cmd .= "f '$in{'huser'}@$in{'host'}:$in{'hfile'}'";
}
else {
$cmd .= "f '$in{'host'}:$in{'hfile'}'";
}
}
if (!$in{'files_def'}) {
$in{'files'} || &error($text{'restore_efiles'});
$cmd .= " $in{'files'}";
}
-d $in{'dir'} || &error($text{'restore_edir'});
return $cmd;
}
# restore_backup(filesystem, command)
# Restores a backup based on inputs from restore_form(), and displays the results
sub restore_backup
{
&additional_log('exec', undef, $_[1]);
&foreign_require("proc", "proc-lib.pl");
local ($fh, $fpid) = &foreign_call("proc", "pty_process_exec", "cd '$in{'dir'}' ; $_[1]");
local $donevolume;
while(1) {
local $rv = &wait_for($fh, "(next volume #)", "(set owner.mode for.*\\[yn\\])", "(Directories already exist, set modes anyway. \\[yn\\])", "((.*)\\[yn\\])", "(.*\\n)");
last if ($rv < 0);
print &html_escape($matches[1]);
if ($rv == 0) {
if ($donevolume++) {
return $text{'restore_evolume'};
}
else {
syswrite($fh, "1\n");
}
}
elsif ($rv == 1 || $rv == 2) {
syswrite($fh, "n\n");
}
elsif ($rv == 3) {
return &text('restore_equestion',
"<tt>$matches[2]</tt>");
}
}
close($fh);
return undef;
}
1;

View File

@@ -1,5 +0,0 @@
name=Heartbeat
desc=Heartbeat Monitor
category=system
depends=init
os_support=msc-linux redhat-linux open-linux slackware-linux debian-linux suse-linux corel-linux turbo-linux cobalt-linux mandrake-linux

View File

@@ -1,101 +0,0 @@
index_title=Internet Services
index_list=service list
index_save=Save
index_delete=Delete
index_create=Create
index_service=Internet Services
index_newservice=Create a new internet service
index_rpc=RPC Programs
index_newrpc=Create a new RPC program
index_apply=Apply Changes
index_applymsg=Click this button to apply the current configuration by sending a SIGHUP signal to the running <tt>inetd</tt> process
error_restart=Failed to restart Inetd
error_saverpc=Failed to save RPC program
error_invalidprgname='$1' is not a valid program name
error_invalidprgnum='$1' is not a valid program number
error_invalidver='$1' is not a valid RPC version
error_noprotocol=You must choose at least one protocol
error_notexist='$1' does not exist
error_notexecutable='$1' is not executable
error_invalidcmd='$1' is not a valid command
error_nouser=You must select a user
error_prgexist=An RPC program called $1 already exists
error_prginuse=The RPC program number $1 is already in use
error_saveservice=Failed to save internet service
error_invalidport='$1' is not a valid port number
error_invalidservice='$1' is not a valid service name
error_portnum=Port number $1 must be >0 and <65536
error_invalidprg='$1' is not a valid program
error_invalidarg='$1' is not a valid arg list
error_invalidwrapper='$1' is not a valid TCP-wrappers service
error_invalidpermin='$1' is not a valid maximum per minute
error_invalidchildnum='$1' is not a valid number of child processes
error_childnum=If a maximum per minute is given, so must a number of child processes
error_serviceexist=A service using port $1 and protocol $2 already exists
error_nameexist=A service with name $1 and protocol $2 already exists
error_inetservice=An internet service with name $1 and protocol $2 already exists
editrpc_title1=Create RPC Program
editrpc_title2=Edit RPC Program
editrpc_detail=RPC Program Details
editrpc_prgname=Program Name
editrpc_prgnum=Program Number
editrpc_aliase=Aliases
editrpc_server=Server Program
editrpc_noassigned=No program assigned
editrpc_disable=Program disabled..
editrpc_enable=Program enabled..
editrpc_socket=Socket Type
editrpc_version=RPC Versions
editrpc_protocol=Protocols
editrpc_internal=Internal
editrpc_command=Command
editrpc_waitmode=Wait Mode
editrpc_wait=Wait until complete
editrpc_nowait=Don't wait
editrpc_execasuser=Execute As User
editrpc_max=Max per Minute
editrpc_default=Default
editrpc_execasgrp=Execute as Group
editserv_title1=Create Internet Service
editserv_title2=Edit Internet Service
editserv_detail=Internet Service Details
editserv_name=Service Name
editserv_port=Port Number
editserv_program=Program
editserv_args=Args
editserv_maxchild=Max Child Processes
editserv_execlogin=Execute As Login Class
editserv_wrapper=TCP-Wrapper
editserv_inetd=Internal to <tt>inetd</tt>
log_apply=Applied changes
log_create_serv=Created service $1
log_modify_serv=Modified service $1
log_delete_serv=Deleted service $1
log_create_prog=Created service and program $1
log_modify_prog=Modified service and program $1
log_delete_prog=Deleted service and program $1
log_create_serv_l=Created service $1 on port $2
log_modify_serv_l=Modified service $1 on port $2
log_delete_serv_l=Deleted service $1 on port $2
log_create_prog_l=Created service $1 on port $2 for program $3
log_modify_prog_l=Modified service $1 on port $2 for program $3
log_delete_prog_l=Deleted service $1 on port $2 for program $3
log_create_rpc=Created RPC $1
log_modify_rpc=Modified RPC $1
log_delete_rpc=Deleted RPC $1
log_create_rprog=Created RPC and program $1
log_modify_rprog=Modified RPC and program $1
log_delete_rprog=Deleted RPC and program $1
log_create_rpc_l=Created RPC $1 number $2
log_modify_rpc_l=Modified RPC $1 number $2
log_delete_rpc_l=Deleted RPC $1 number $2
log_create_rprog_l=Created RPC $1 number $2 for program $3
log_modify_rprog_l=Modified RPC $1 number $2 for program $3
log_delete_rprog_l=Deleted RPC $1 number $2 for program $3

View File

@@ -101,8 +101,7 @@ elsif (@$rules && !$in{'reset'}) {
"before=$r->{'index'}'>".
"<img src=images/before.gif border=0></a>";
local $ls = "<a href='edit_rule.cgi?idx=$r->{'index'}'>";
local $le = "</a>";
local $ls = &ui_link("edit_rule.cgi?idx=$r->{'index'}","local $le =");
local $act = $amap{int($r->{'num'})};
print &ui_checked_columns_row(
[ $ls.($r->{'active'} ? $text{'yes'} :
@@ -170,8 +169,7 @@ elsif (@$rules && !$in{'reset'}) {
"border=0></a>";
}
local $ls = "<a href='edit_nat.cgi?idx=$r->{'index'}'>";
local $le = "</a>";
local $ls = &ui_link("edit_nat.cgi?idx=$r->{'index'}","local $le =");
print &ui_columns_row(
[ &ui_checkbox("d", $r->{'index'}, "", 0),
$ls.($r->{'active'} ? $text{'yes'} :

View File

@@ -111,8 +111,7 @@ elsif (@$rules && !$in{'reset'}) {
local ($ls, $le);
if ($r->{'index'} <= $lastidx) {
$ls = "<a href='edit_rule.cgi?idx=$r->{'index'}'>";
$le = "</a>";
$ls = &ui_link("edit_rule.cgi?idx=$r->{'index'}","$le =");
}
local $act = $amap{int($r->{'num'})};
print &ui_checked_columns_row(

View File

@@ -20,8 +20,7 @@ if (@secs) {
$desc = &text('secrets_mod', "<tt>".substr($1, 0, 20)."..</tt>");
}
print &ui_columns_row([
"<a href='edit_secret.cgi?idx=$s->{'idx'}'>".
($s->{'name'} || $text{'secrets_any'})."</a>",
&ui_link("edit_secret.cgi?idx=$s->{'idx'}","($s->{'name'} || $text{'secrets_any'})"),
$text{'secrets_'.lc($s->{'type'})} || uc($s->{'type'}),
$desc,
]);

View File

@@ -24,8 +24,7 @@ if (@$conns) {
100, 0, \@tds);
foreach my $c (@$conns) {
print &ui_checked_columns_row([
"<a href='view_conn.cgi?num=$c->{'num'}'>".
$c->{'ip'}."</a>",
&ui_link("view_conn.cgi?num=$c->{'num'}",$c->{'ip'}),
$c->{'port'},
$c->{'iface'},
$c->{'name'},

View File

@@ -23,8 +23,7 @@ if (@devices) {
my %omap = map { $_->{'type'}.$_->{'num'}, $_ } @$conf;
foreach my $e (@devices) {
print &ui_checked_columns_row([
"<a href='edit_device.cgi?num=$e->{'num'}'>".
$e->{'type'}.$e->{'num'}."</a>",
&ui_link("edit_device.cgi?num=$e->{'num'}","$e->{'type'}.$e->{'num'}"),
$text{'devices_mode_'.$e->{'mode'}} ||
uc($e->{'mode'}),
join("&nbsp;|&nbsp;",

View File

@@ -23,8 +23,7 @@ if (@extents) {
$text{'extents_size'} ], 100, 0, \@tds);
foreach my $e (@extents) {
print &ui_checked_columns_row([
"<a href='edit_extent.cgi?num=$e->{'num'}'>".
$e->{'type'}.$e->{'num'}."</a>",
&ui_link("edit_extent.cgi?num=$e->{'num'}","$e->{'type'}.$e->{'num'}"),
&mount::device_name($e->{'device'}),
&nice_size($e->{'start'}),
&nice_size($e->{'size'}),

View File

@@ -24,8 +24,7 @@ if (@targets) {
my %omap = map { $_->{'type'}.$_->{'num'}, $_ } @$conf;
foreach my $e (@targets) {
print &ui_checked_columns_row([
"<a href='edit_target.cgi?num=$e->{'num'}'>".
$e->{'type'}.$e->{'num'}."</a>",
&ui_link("edit_target.cgi?num=$e->{'num'}","$e->{'type'}.$e->{'num'}"),
$text{'targets_flags_'.$e->{'flags'}} ||
uc($e->{'flags'}),
&describe_object($omap{$e->{'export'}}),

View File

@@ -20,8 +20,7 @@ if (@users) {
$text{'users_mode'} ], 50, 0, \@tds);
foreach my $e (@users) {
print &ui_checked_columns_row([
"<a href='edit_user.cgi?user=$e->{'user'}'>".
&html_escape($e->{'user'})."</a>",
&ui_link("edit_user.cgi?user=$e->{'user'}",&html_escape($e->{'user'})),
uc($e->{'mode'}),
], \@tds, "d", $e->{'user'});
}

View File

@@ -10,8 +10,7 @@ my $allow = &get_allow_config($in{'mode'});
&ui_print_header(undef, $text{$in{'mode'}.'_title'}, "");
my @links = ( "<a href='edit_allow.cgi?new=1&mode=$in{'mode'}'>".
$text{'allow_add'}."</a>" );
my @links = ( &ui_link("edit_allow.cgi?new=1&mode=$in{'mode'}",$text{'allow_add'}) );
if (@$allow) {
unshift(@links, &select_all_link("d"), &select_invert_link("d"));
print &ui_form_start("delete_allows.cgi", "post");

View File

@@ -314,8 +314,7 @@ local $g;
local @rv;
foreach $g (split(/\s+/, $_[0])) {
if ($g =~ /^\@(.*)$/ || $g =~ /^\!\@(.*)$/) {
push(@rv, "<a href='edit_group.cgi?name=$1&from=$_[1]'>".
&group_name($g, $_[2])."</a>");
push(@rv, &ui_link("edit_group.cgi?name=$1&from=$_[1]",&group_name($g, $_[2])));
}
else {
push(@rv, &group_name($g, $_[2]));
@@ -861,8 +860,7 @@ else {
foreach $sn (split(/,/, $_[0])) {
local $serv = $sn{$sn};
if (!$serv->{'standard'}){
$editServO="<a href='edit_service.cgi?name=".$serv->{'name'}."'>";
$editServC="</a>";
$editServO=&ui_link("edit_service.cgi?name=".$serv->{'name'}",$editServC);
} else {
$editServO="";
$editServC="";

View File

@@ -1,208 +0,0 @@
main_return=Return to $1
main_homepage=Home Page
main_feedback=Feedback..
main_switch=Switch user..
main_logout=Logout
main_version=Version $1 on $2 ($3)
main_title=Webmin $1 on $2 ($3)
main_title2=Webmin
main_none=You do not have access to any Webmin modules.
main_skill=Skill level
category_servers=Servers
category_hardware=Hardware
category_system=System
category_webmin=Webmin
category_net=Networking
category_syslet=Syslets
category_cluster=Cluster
category_info=Information
category_=Others
header_webmin=Webmin Index
header_module=Module Index
header_help=Help..
header_config=Module Config
header_servers=Webmin Servers
index=index
yes=Yes
no=No
save=Save
create=Create
delete=Delete
find=Find
error=Error
efilewrite=Failed to write to $1 : $2
default=Default
modify=Modify
reset=Reset
ok=OK
cancel=Cancel
helpsearch=Search docs..
switch_remote_euser=The Unix user $1 does not exist.
programname=Webmin
chooser_title1=Choose File..
chooser_title2=Choose Directory..
chooser_dir=Directory of $1
chooser_ok=Ok
users_title1=Select Users..
users_title2=Select User..
users_sel=Selected Users
users_all=All Users
users_ok=Ok
users_cancel=Cancel
users_clear=Clear
groups_title1=Select Groups..
groups_title2=Select Group..
groups_all=All Groups
groups_sel=Selected Groups
groups_ok=Ok
groups_cancel=Cancel
groups_clear=Clear
config_ecannot=You are not allowed to configure this module
config_title=Configuration
config_dir=For module $1
config_header=Configurable options for $1
config_none=None
config_eaccess=You are not allowed to access this module
config_err=Failed to save config
help_err=Failed to display help
help_epath=Missing or invalid help path
help_efile=Failed to read help file $1
help_eheader=Missing &lt;header&gt; section
help_einclude=Failed to include $1
help_eif=$1 failed : $2
help_eexec=$1 failed : $2
referer_title=Security Warning
referer_warn=<b>Warning!</b> Webmin has detected that the program $2 was linked to from the URL $1, which appears to be outside the Webmin server. This may be an attempt to trick your server into executing a dangerous command.
referer_warn_unknown=<b>Warning!</b> Webmin has detected that the program $1 was linked to from an unknown URL, which appears to be outside the Webmin server. This may be an attempt to trick your server into executing a dangerous command.
referer_ok=Continue executing Webmin program
referer_again=Don't show this warning in future.
session_header=Login to Webmin
session_mesg=You must enter a username and password to login to the Webmin server on $1.
session_mesg2=You must enter a username and password to login.
session_user=Username
session_pass=Password
session_login=Login
session_clear=Clear
session_failed=Login failed. Please try again.
session_logout=Logout successful. Use the form below to login again.
session_timed_out=Session timed out after $1 minutes of inactivity.
session_save=Remember login permanently?
acl_root=Root directory for file chooser
acl_home=User's home directory
acl_uedit=Users visible in user chooser
acl_uedit_all=All users
acl_uedit_none=No users
acl_uedit_only=Only users
acl_uedit_except=All except users
acl_uedit_uid=Users with UIDs in range
acl_uedit_group=Users with group
acl_gedit=Groups visible in group chooser
acl_gedit_all=All groups
acl_gedit_none=No groups
acl_gedit_only=Only groups
acl_gedit_except=All except groups
acl_gedit_gid=Groups with GIDs in range
acl_feedback=Can send feedback email?
acl_feedback2=Yes
acl_feedback1=Yes, but not with config files
acl_feedback0=No
acl_rpc=Can accept RPC calls?
acl_rpc2=Only for <tt>root</tt> or <tt>admin</tt>
acl_rpc1=Yes
acl_rpc0=No
month_1=January
month_2=February
month_3=March
month_4=April
month_5=May
month_6=June
month_7=July
month_8=August
month_9=September
month_10=October
month_11=November
month_12=December
day_0=Sunday
day_1=Monday
day_2=Tuesday
day_3=Wednesday
day_4=Thursday
day_5=Friday
day_6=Saturday
smonth_1=Jan
smonth_2=Feb
smonth_3=Mar
smonth_4=Apr
smonth_5=May
smonth_6=Jun
smonth_7=Jul
smonth_8=Aug
smonth_9=Sep
smonth_10=Oct
smonth_11=Nov
smonth_12=Dec
sday_0=Su
sday_1=Mo
sday_2=Tu
sday_3=We
sday_4=Th
sday_5=Fr
sday_6=Sa
emodule=Access denied : User $1 is not allowed to use the $2 module
elock_tries=Failed to lock file $1 after $2 minutes
skill_high=Expert
skill_medium=Intermediate
skill_low=Novice
feedback_title=Webmin Feedback
feedback_desc=This form allows you to report bugs on make suggestions to the Webmin developers regarding any problems or missing features that you have found. When the Send button is clicked, the details entered into the form will be emailed to $1.
feedback_desc2=This feedback will be sent to the developer of Usermin, not your system administrator, ISP or hosting company. Please write your feedback in english, even if you are currently running Webmin in another language.
feedback_header=Feedback details
feedback_name=Your name
feedback_email=Your email address
feedback_module=Regarding module
feedback_all=All modules
feedback_text=Description of problem or suggestion
feedback_os=Include operating system details in email?
feedback_osdesc=If this option is selected, the automatic feedback email will include your operating system name and version.
feedback_config=Include module configuration in email?
feedback_configdesc=If this is selected, the email will include the configuration of the related module and the contents of any config files that the module uses. For example, if the feedback was related to the <i>Users and Groups</i> module, your <tt>/etc/passwd</tt> and <tt>/etc/shadow</tt> files would be sent.
feedback_attach=Additional files to attach
feedback_send=Send Feedback
feedback_mailserver=Send via SMTP server
feedback_mailserver_def=Local sendmail program
feedback_err=Failed to send feedback
feedback_emodule=You chose to include module configuration in the email, but did not select a module.
feedback_emodule2=Selected module does not exist
feedback_econfig=You do not have full access to the selected module.
feedback_via=Sent feedback to $1 via SMTP server $2
feedback_prog=Sent feedback to $1 using sendmail program $2
feedback_esend=Failed to send feedback via sendmail program or local SMTP server.
feedback_to=Send feedback to addresses
feedback_enoto=No addresses were entered to send feedback to
feedback_ecannot=You are not allowed to send feedback
feedback_ecannot2=You are not allowed to send feedback containing config files
progress_size=Downloading $1 ($2 bytes) ..
progress_nosize=Downloading $1 ..
progress_data=Received $1 bytes ($2 %)
progress_data2=Received $1 bytes
progress_done=.. Download complete.

View File

@@ -54,8 +54,7 @@ else {
# Show sub-objects
foreach $dn (sort { lc($a->dn()) cmp lc($b->dn()) } $rv->all_entries) {
print "<a href='browser.cgi?base=".&urlize($dn->dn())."'>".
&html_escape($dn->dn())."</a><br>\n";
print &ui_link("browser.cgi?base=".&urlize($dn->dn())","&html_escape($dn->dn())")<br>\n";
}
if (!$rv->all_entries) {
print "<i>$text{'browser_none'}</i><br>\n";

View File

@@ -200,7 +200,7 @@ if (@attach) {
# Links to download all / slideshow
@links = ( );
if (@attach > 1) {
push(@links, "<a href='detachall.cgi/attachments.zip?folder=$in{'folder'}&idx=$in{'idx'}&user=$uuser$subs'>$text{'view_aall'}</a>");
push(@links, &ui_link("detachall.cgi/attachments.zip?folder=$in{'folder'}&idx=$in{'idx'}&user=$uuser$subs","$text{'view_aall'}"));
}
@iattach = grep { $_->{'type'} =~ /^image\// } @attach;
if (@iattach > 1) {

View File

@@ -16,8 +16,7 @@ if (@conns) {
print $text{'conns_desc'},"<p>\n";
my @grid;
@grid = map { &ui_checkbox("d", $_)." ".
"<a href='view_conn.cgi?name=".&urlize($_)."'>".
&html_escape($_)."</a>" } @conns;
&ui_link("view_conn.cgi?name=".&urlize($_)","&html_escape($_)") } @conns;
print &ui_form_start("mass_conns.cgi", "post");
my @links = ( &select_all_link("d"),
&select_invert_link("d") );

View File

@@ -19,8 +19,7 @@ if (keys %$playtime) {
foreach my $u (sort { $playtime->{$b} <=> $playtime->{$a} }
keys %$playtime) {
print &ui_columns_row([
"<a href='view_conn.cgi?name=".&urlize($u)."'>".
&html_escape($u)."</a>",
&ui_link("view_conn.cgi?name=".&urlize($u)","&html_escape($u)"),
&nice_seconds($playtime->{$u}),
&nice_seconds($limit_playtime->{$u} || 0),
&indexof($u, @conns) >= 0 ?

View File

@@ -25,8 +25,7 @@ if (@{$d->{'data'}}) {
$i++;
next if ($access{'perms'} == 2 && !&can_edit_db($u->[1]));
local @cols;
push(@cols, "<a href='edit_cpriv.cgi?idx=$i'>".
&html_escape($u->[4])."</a>");
push(@cols, &ui_link("edit_cpriv.cgi?idx=$i",&html_escape($u->[4])));
push(@cols, &html_escape($u->[3]));
push(@cols, &html_escape($u->[1]));
push(@cols, $u->[0] eq '' || $u->[0] eq '%' ?

View File

@@ -25,8 +25,7 @@ if (@{$d->{'data'}}) {
$i++;
next if ($access{'perms'} == 2 && !&can_edit_db($u->[1]));
local @cols;
push(@cols, "<a href='edit_tpriv.cgi?idx=$i'>".
&html_escape($u->[3])."</a>");
push(@cols, &ui_link("edit_tpriv.cgi?idx=$i",&html_escape($u->[3])));
push(@cols, &html_escape($u->[1]));
push(@cols, $u->[0] eq '' || $u->[0] eq '%' ?
$text{'tprivs_all'} : &html_escape($u->[0]));

View File

@@ -31,10 +31,10 @@ if (@_ > 1 && !$one && $remote_user && !$notabs) {
if (!$ENV{'ANONYMOUS_USER'} && !$ENV{'SSL_USER'} &&
!$ENV{'LOCAL_USER'} && !$ENV{'HTTP_WEBMIN_SERVERS'}) {
if ($main::session_id) {
$logout = "<a href='/session_login.cgi?logout=1'>$text{'main_logout'}</a>";
$logout = &ui_link("/session_login.cgi?logout=1",$text{'main_logout'});
}
else {
$logout = "<a href='/switch_user.cgi'>$text{'main_switch'}</a>";
$logout = &ui_link("/switch_user.cgi",$text{'main_switch'});
}
}
&start_osx_table("Module Categories", $logout);

View File

@@ -859,8 +859,7 @@ sub generate_map_edit
my $nt = $_[3] || $text{'mapping_name'};
my $vt = $_[4] || $text{'mapping_value'};
local @links = ( "<a href='edit_mapping.cgi?map_name=$_[0]'>".
$text{'new_mapping'}."</a>",);
local @links = ( &ui_link("edit_mapping.cgi?map_name=$_[0]",$text{'new_mapping'}),);
if ($#{$mappings} ne -1)
{

View File

@@ -104,7 +104,7 @@ if (@attach) {
}
else {
print &ui_columns_row([
"<a href='detach_queue.cgi/$a->{'filename'}?id=$in{'id'}&attach=$a->{'idx'}$subs'>$a->{'filename'}</a>",
&ui_link("detach_queue.cgi/$a->{'filename'}?id=$in{'id'}&attach=$a->{'idx'}$subs",$a->{'filename'}),
$a->{'type'},
&nice_size(length($a->{'data'})),
]);

View File

@@ -1,53 +0,0 @@
#!/usr/local/bin/perl
# backup.cgi
# Backup a database to a local file
require './postgresql-lib.pl' ;
&ReadParse ( ) ;
&error_setup ( $text{'backup_err'} ) ;
$access{'backup'} || &error($text{'backup_ecannot'});
&can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
$in{'format'} =~ /^[a-z]$/ || &redirect ( "" );
$in{'path'} =~ /^\S+$/ || &error(&text('backup_pe3', $in{'path'})) ;
if ( -e $in{'path'} ) {
&error ( &text ( 'backup_pe2', $in{'path'} ) ) ;
}
$db_find_f = 0 ;
if ( $in{'db'} ) {
foreach ( &list_databases() ) {
if ( $_ eq $in{'db'} ) { $db_find_f = 1 ; }
}
}
if ( $db_find_f == 0 ) { &error ( &text ( 'backup_edb' ) ) ; }
$bkup_command = $config{'dump_cmd'}.
($config{'login'} ? " -U $config{'login'}" : "").
($config{'host'} ? " -h $config{'host'}" : "").
($in{'format'} eq 'p' ? "" : " -b").
" -F$in{'format'} -f $in{'path'} $in{'db'}" ;
if ( $config{'sameunix'} && defined(getpwnam($config{'login'})) ) {
$bkup_command =~ s/"/\\"/g ;
$bkup_command = "su $config{'login'} -c ".quotemeta($bkup_command);
}
$temp = &tempname();
open(TEMP, ">$temp");
print TEMP "$config{'pass'}\n";
close(TEMP);
$out = &backquote_logged("$bkup_command 2>&1 <$temp");
unlink($temp);
if ( $? == 0 ) {
&redirect ("edit_dbase.cgi?db=$in{'db'}") ;
} else {
&error ( &text ( 'backup_exe', $bkup_command )."<pre>$out</pre>" ) ;
}

View File

@@ -1,341 +0,0 @@
index_title=PostgreSQL Database Server
index_notrun=PostgreSQL is not running on your system - database list could not be retrieved.
index_start=Start PostgreSQL Server
index_startmsg=Click this button to start the PostgreSQL database server on your system with the command<br>$1<br>. This Webmin module cannot administer the database until it is started.
index_nopass=Webmin needs to know your PostgreSQL administration login and password in order to manage your database. Please enter your administration username and password below.
index_ltitle=PostgreSQL Login
index_sameunix=Connect as same Unix user?
index_login=Login
index_pass=Password
index_clear=Clear
index_stop=Stop PostgreSQL Server
index_stopmsg=Click this button to stop the PostgreSQL database server on your system. This will prevent any users or programs from accessing the database, including this Webmin module.
index_dbs=PostgreSQL Databases
index_add=Create a new database
index_users=User Options
index_return=database list
index_esql=The PostgreSQL client program $1 was not found on your system. Maybe PostgreSQL is not installed, or your <a href='$2'>module configuration</a> is incorrect.
index_ehba=The PostgreSQL host configuration file $1 was not found on your system. Maybe PostgreSQL has not been initialised, or your <a href='$2'>module configuration</a> is incorrect.
index_superuser=The PostgreSQL client program psql could not execute on your system. Maybe PostgreSQL is not installed, or your <a href='$1'>module configuration</a> is incorrect.
index_eversion=The PostgreSQL database on your system is version $1, but Webmin only supports versions $2 and above.
index_elibrary=The PostgreSQL client program $1 could not be run because it could not find the Postgres shared libraries. Check the <a href='$2'>module configuration</a> and make sure the <i>Path to PostgreSQL shared libraries</i> is set.
index_ldpath=Your shared library path is set to $1, and the output from $2 was :
index_version=PostgreSQL version $1
index_setup=The PostgreSQL host configuration file $1 was not found on your system, indicating that the database has not been initialized yet. Click the button below to setup PostgreSQL with the command $2.
index_setupok=Initialize Database
index_nomod=Warning: The Perl module $1 is not installed on your system, so Webmin will not be able to reliably access your PostgreSQL database. <a href='$2'>Click here</a> to install it now.
index_nomods=Warning: The Perl modules $1 and $2 are not installed on your system, so Webmin will not be able to reliably access your PostgreSQL database. <a href='$3'>Click here</a> to install them now.
login_err=Login failed
login_ecannot=You are not allowed to configure the database login
login_elogin=Missing adminstration login
login_epass=Incorrect administration username or password
dbase_title=Edit Database
dbase_noconn=This database is not currently accepting connections, so no actions can be performed in it.
dbase_tables=Database Tables
dbase_add=Create a new table
dbase_drop=Drop Database
dbase_exec=Execute SQL
dbase_none=This database has no tables.
dbase_fields=Fields:
dbase_return=table list
dbase_ecannot=You are not allowed to edit this database
table_title=Edit Table
table_title2=Create Table
table_opts=Field options
table_header=Table $1 in database $2
table_field=Field name
table_type=Type
table_null=Allow nulls?
table_arr=Array?
table_none=None
table_add=Add field of type:
table_return=field list
table_data=View Data
table_drop=Drop Table
table_name=Table name
table_initial=Initial fields
table_header2=New table options
table_err=Failed to create table
table_ename=Missing or invalid table name
table_efield='$1' is not a valid field name
table_etype=Missing type for field $1
table_esize=Missing type size for field $1
table_enone=No initial fields entered
table_fielddrop=Drop Field
field_title1=Add Field
field_title2=Modify Field
field_in=In table $1 in database $2
field_header=Field parameters
field_name=Field name
field_type=Data type
field_size=Type width
field_none=None
field_null=Allow nulls?
field_arr=Array field?
field_key=Primary key?
field_uniq=Unique?
field_err=Failed to save field
field_esize='$1' is not a valid field size
field_eenum=No enumerated values entered
field_efield='$1' is not a valid field name
field_ekey=Fields that allow nulls cannot be part of the primary key
exec_title=Execute SQL
exec_header=Enter SQL command to execute on database $1 ..
exec_exec=Execute
exec_err=Failed to execute SQL
exec_out=Output from SQL command $1 ..
exec_none=No data returned
stop_err=Failed to stop database server
stop_epidfile=Failed to open PID file $1
stop_ekill=Failed to kill process $1 : $2
stop_ecannot=You are not allowed to stop the database server
start_err=Failed to start database server
start_ecannot=You are not allowed to start the database server
ddrop_err=Failed to drop database
ddrop_title=Drop Database
ddrop_rusure=Are you sure you want to drop the database $1 ? $2 tables containing $3 rows of data will be deleted.
ddrop_mysql=Because this is the master database, dropping it will probably make your PostgreSQL server unusable!
ddrop_ok=Drop Database
tdrop_err=Failed to drop table
tdrop_title=Drop Table
tdrop_rusure=Are you sure you want to drop the table $1 in database $2 ? $3 rows of data will be deleted.
tdrop_ok=Drop Table
view_title=Table Data
view_pos=Rows $1 to $2 of $3
view_none=This table contains no data
view_edit=Edit selected rows
view_new=Add row
view_delete=Delete selected rows
view_nokey=Data in this table cannot be edited because it has no primary key.
view_all=Select all
view_invert=Invert selection
newdb_title=Create Database
newdb_header=New database options
newdb_db=Database name
newdb_path=Database file path
newdb_err=Failed to create database
newdb_edb=Missing or invalid database name
newdb_ecannot=You are not allowed to create databases
newdb_epath=Missing database path
user_title=PostgreSQL Users
user_ecannot=You are not allowed to edit users
user_name=Username
user_db=Can create databases?
user_other=Can create users?
user_until=Valid until
user_add=Create a new user
user_forever=Forever
user_pass=Requires password?
user_edit=Edit User
user_create=Create User
user_return=user list
user_header=PostgreSQL user details
user_passwd=Password
user_none=None
user_err=Failed to save user
user_epass=Missing or invalid password
user_ename=Missing or invalid username
user_sync=The options below configure synchronization between Unix users created through Webmin and PostgreSQL users.
user_sync_create=Add a new PostgreSQL user when a Unix user is added.
user_sync_modify=Update a PostgreSQL user when the matching Unix user is modified.
user_sync_delete=Delete a PostgreSQL user when the matching Unix user is deleted.
host_ecannot=You are not allowed to edit allowed hosts
host_title=Allowed Hosts
host_desc=When a client connects to the database, hosts listed below are processed in order until one matches and the client is allowed or denied.
host_header=PostgreSQL client authentication details
host_local=Local connection
host_address=Host address
host_db=Database
host_user=Users
host_uall=All users
host_auth=Authentication mode
host_any=Any network host
host_all=All databases
host_same=Same as username
host_gsame=Same as group name
host_other=Other..
host_usel=Listed users..
host_add=Create a new allowed host
host_ident=Check <tt>ident</tt> server on host
host_trust=No authentication required
host_reject=Reject connection
host_password=Plaintext password
host_crypt=Encrypted password
host_md5=MD5 encrypted password
host_krb4=Kerberos V4
host_krb5=Kerberos V5
host_pam=PAM
host_passwordarg=Use password file
host_identarg=Use user map
host_pamarg=Use PAM service
host_create=Create Allowed Host
host_edit=Edit Allowed Host
host_single=Single host
host_network=Network
host_netmask=Netmask
host_return=host access list
host_err=Failed to save allowed host
host_eident=Missing or invalid user map
host_epam=Missing or invalid PAM service
host_epassword=Missing or invalid password file
host_enetmask=Missing or invalid netmask
host_enetwork=Missing or invalid network
host_ehost=Missing or invalid host IP address
host_move=Move
host_edb=No database name(s) entered
host_euser=No user name(s) entered
grant_title=Granted Privileges
grant_tvi=Object
grant_type=Type
grant_db=Database
grant_public=Everyone
grant_group=Group $1
grant_add=Add grant in database :
grant_return=privileges list
grant_ecannot=You are not allowed to edit privileges
grant_create=Create Grant
grant_edit=Edit Grant
grant_header=Privileges granted to users
grant_to=Grant privileges on
grant_table=Table
grant_view=View or index
grant_users=Grant privileges to
grant_user=User
grant_what=Privileges
grant_r=Table
grant_v=View
grant_i=Index
grant_S=Sequence
grant_none=No tables, views, sequences or indexes exist to grant privileges on.
group_title=PostgreSQL Groups
group_ecannot=You are not allowed to edit groups
group_name=Group name
group_id=Group ID
group_mems=Members
group_add=Create a new group
group_edit=Edit Group
group_create=Create Group
group_header=PostgreSQL group details
group_return=groups list
group_err=Failed to save group
group_ename=Missing or invalid group name
group_egid=Missing or invalid group ID
group_etaken=Group name is already in use
group_none=No PostgreSQL groups currently exist
esql=SQL $1 failed : $2
log_start=Started PostgreSQL server
log_stop=Stopped PostgreSQL server
log_db_create=Created database $1
log_db_delete=Dropped database $1
log_table_create=Created table $1 in database $2
log_table_delete=Dropped table $1 from database $2
log_field_create=Added field $1 $4 to $2 in database $3
log_field_modify=Modified field $1 $4 in $2 in database $3
log_field_delete=Deleted field $1 from $2 in database $3
log_data_create=Added row to table $2 in database $3
log_data_modify=Modified $1 rows in table $2 in database $3
log_data_delete=Deleted $1 rows from table $2 in database $3
log_exec=Executed SQL in database $1
log_exec_l=Executed SQL command $2 in database $1
log_create_user=Created user $1
log_delete_user=Deleted user $1
log_modify_user=Modified user $1
log_create_group=Created group $1
log_delete_group=Deleted group $1
log_modify_group=Modified group $1
log_create_local=Created allowed local connection
log_modify_local=Modified allowed local connection
log_delete_local=Deleted allowed local connection
log_move_local=Moved allowed local connection
log_create_all=Created any allowed host
log_modify_all=Modified any allowed host
log_delete_all=Deleted any allowed host
log_move_all=Moved any allowed host
log_create_hba=Created allowed host $1
log_modify_hba=Modified allowed host $1
log_delete_hba=Deleted allowed host $1
log_move_hba=Moved allowed host $1
log_grant=Granted privileges on $1 in database $2
log_setup=Initialized database
acl_dbs=Databases this user can manage
acl_dbscannot=This access control will become effective, after starting the PostgreSQL database server.
acl_dall=All databases
acl_dsel=Selected..
acl_create=Can create new databases?
acl_delete=Can drop databases?
acl_stop=Can stop and start the PostgreSQL server?
acl_users=Can edit users, groups, hosts and grants?
acl_backup=Can create backups?
acl_restore=Can restore backups?
fdrop_err=Error during field drop
fdrop_header=Drop This One
fdrop_lose_data=Select box to confirm that you understand that definitions, such as indexes and default values, on all fields may be lost.
fdrop_perform=Drop Field
fdrop_title=Drop Field
setup_err=Failed to initialize database
setup_ecannot=You are not allowed to initialize the database
dbase_bkup=Backup
dbase_rstr=Restore
restore_title=Restore Database
restore_header=Restore database options
restore_db=Database name
restore_path=Backup file path
restore_err=Failed to restore database
restore_edb=Missing or invalid database name
restore_eacl=You must be allowed to create and drop database
restore_ecannot=You are not allowed to restore databases
restore_epath=Missing database path
restore_go=Restore
restore_pe1=File must be tar file ($1)
restore_pe2=File not found ($1)
restore_exe=Command execution error ($1)
restore_ecmd=The restore command $1 was not found on your system
restore_ecannot=You are not allowed to restore backups
restore_only=Only restore data, not tables?
restore_clean=Delete tables before restoring?
backup_title=Backup Database
backup_header=Backup database options
backup_db=Database name
backup_path=Backup file path
backup_err=Failed to backup database
backup_eacl=You must be allowed to create and drop database
backup_edb=Missing or invalid database name
backup_ecannot=You are not allowed to backup databases
backup_epath=Missing database path
backup_go=Backup
backup_pe1=File must be TAR (.tar) file ($1)
backup_pe2=File is existing already ($1)
backup_pe3=Missing or invalid backup file path
backup_exe=Command execution error ($1)
backup_ecmd=The backup command $1 was not found on your system
backup_format=Backup file format
backup_format_p=Plain SQL text
backup_format_t=Tar archive
backup_format_c=Custom archive
backup_ecannot=You are not allowed to create backups
r_command=Command Unsupported

View File

@@ -25,8 +25,7 @@ if (@{$s->{'data'}}) {
$text{'group_mems'} ], 100, 0, \@tds);
foreach $g (@{$s->{'data'}}) {
local @cols;
push(@cols, "<a href='edit_group.cgi?gid=$g->[1]'>".
&html_escape($g->[0])."</a>");
push(@cols, &ui_link("edit_group.cgi?gid=$g->[1]",&html_escape($g->[0])));
push(@cols, $g->[1]);
push(@cols, join("&nbsp;|&nbsp;",
map { &html_escape($uid{$_}) } &split_array($g->[2])));

View File

@@ -19,8 +19,7 @@ print &ui_columns_start([ "", $text{'user_name'},
$text{'user_until'} ], 100);
foreach $u (sort { $a->[0] cmp $b->[0] } @{$s->{'data'}}) {
local @cols;
push(@cols, "<a href='edit_user.cgi?user=$u->[0]'>".
&html_escape($u->[0])."</a>");
push(@cols, &ui_link("edit_user.cgi?user=$u->[0]",&html_escape($u->[0])));
push(@cols, $u->[5] ? $text{'yes'} : $text{'no'});
push(@cols, $u->[2] =~ /t|1/ ? $text{'yes'} : $text{'no'});
push(@cols, $u->[4] =~ /t|1/ ? $text{'yes'} : $text{'no'});

View File

@@ -1,363 +0,0 @@
# postgresql-lib.pl
# Common PostgreSQL functions
do '../web-lib.pl';
&init_config();
if ($config{'plib'}) {
$ENV{$gconfig{'ld_env'}} .= ':' if ($ENV{$gconfig{'ld_env'}});
$ENV{$gconfig{'ld_env'}} .= $config{'plib'};
}
if ($config{'psql'} =~ /^(.*)\/bin\/psql$/ && $1 ne '' && $1 ne '/usr') {
$ENV{$gconfig{'ld_env'}} .= ':' if ($ENV{$gconfig{'ld_env'}});
$ENV{$gconfig{'ld_env'}} .= "$1/lib";
}
%access = &get_module_acl();
if (!$config{'nodbi'}) {
# Check if we have DBD::Pg
eval <<EOF;
use DBI;
\$driver_handle = DBI->install_driver("Pg");
EOF
}
# is_postgresql_running()
# Returns 1 if yes, 0 if no, -1 if the login is invalid, -2 if there
# is a library problem
sub is_postgresql_running
{
local $temp = &tempname();
local $host = $config{'host'} ? "-h $config{'host'}" : "";
local $cmd;
if ($config{'login'}) {
open(TEMP, ">$temp");
print TEMP "$config{'login'}\n$config{'pass'}\n";
close(TEMP);
local $out;
$cmd = "$config{'psql'} -u -c '' $host $config{'basedb'} <$temp";
}
else {
$cmd = "$config{'psql'} -c '' $host $config{'basedb'}";
}
if ($config{'unix'} && getpwnam($config{'unix'})) {
$cmd = "su $config{'unix'} -c \"$cmd\"";
}
open(OUT, "$cmd 2>&1 |");
while(<OUT>) { $out .= $_; }
close(OUT);
unlink($temp);
if ($out =~ /setuserid:/i || $out =~ /no\s+password\s+supplied/i ||
$out =~ /no\s+postgres\s+username/i || $out =~ /authentication\s+failed/i ||
$out =~ /password:.*password:/i || $out =~ /database.*does.*not/i) {
return -1;
}
elsif ($out =~ /connect.*failed/i || $out =~ /could not connect to server:/) {
return 0;
}
elsif ($out =~ /lib\S+\.so/i) {
return -2;
}
else {
return 1;
}
}
# get_postgresql_version()
sub get_postgresql_version
{
local $v = &execute_sql($config{'basedb'}, 'select version()');
$v = $v->{'data'}->[0]->[0];
if ($v =~ /postgresql\s+([0-9\.]+)/i) {
return $1;
}
else {
return undef;
}
}
# list_databases()
# Returns a list of all databases
sub list_databases
{
local $t = &execute_sql($config{'basedb'}, 'select * from pg_database order by datname');
return map { $_->[0] } @{$t->{'data'}};
}
# list_tables(database)
# Returns a list of tables in some database
sub list_tables
{
#local $t = &execute_sql($_[0], 'select relname from pg_class where relkind = \'r\' and relname not like \'pg_%\' and relhasrules = \'f\' order by relname');
local $t = &execute_sql($_[0], 'select tablename from pg_tables where tablename not like \'pg_%\' order by tablename');
return map { $_->[0] } @{$t->{'data'}};
}
# list_types()
# Returns a list of all available field types
sub list_types
{
local $t = &execute_sql($config{'basedb'}, 'select typname from pg_type where typrelid = 0 and typname !~ \'^_.*\' order by typname');
return map { $_->[0] } @{$t->{'data'}};
}
# table_structure(database, table)
# Returns a list of hashes detailing the structure of a table
sub table_structure
{
local $t = &execute_sql($_[0], "select a.attnum, a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull, a.atthasdef FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '$_[1]' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid order by attnum");
local (@rv, $r);
foreach $r (@{$t->{'data'}}) {
local $arr;
$arr++ if ($r->[2] =~ s/^_//);
local $sz = $r->[4] - 4;
if ($sz >= 65536) {
$sz = int($sz/65536).",".($sz%65536);
}
push(@rv, { 'field' => $r->[1],
'arr' => $arr ? 'YES' : 'NO',
'type' => $r->[4] < 0 ? $r->[2]
: $r->[2]."($sz)",
'null' => $r->[5] =~ /f|0/ ? 'YES' : 'NO' } );
}
return @rv;
}
# execute_sql(database, sql)
sub execute_sql
{
if ($driver_handle && !$config{'unix'} &&
$_[1] !~ /^(create|drop)\s+database/ && $_[1] !~ /^\\/) {
# Use the DBI interface
local $cstr = "dbname=$_[0]";
$cstr .= ";host=$config{'host'}" if ($config{'host'});
local $dbh = $driver_handle->connect($cstr,
$config{'login'}, $config{'pass'});
$dbh || &error("DBI connect failed : ",$DBI::errstr);
$dbh->{'AutoCommit'} = 0;
local $cmd = $dbh->prepare($_[1]);
if (!$cmd->execute()) {
&error(&text('esql', "<tt>".&html_escape($_[1])."</tt>",
"<tt>".&html_escape($dbh->errstr)."</tt>"));
}
local (@data, @row);
local @titles = @{$cmd->{'NAME'}};
while(@row = $cmd->fetchrow()) {
push(@data, [ @row ]);
}
$cmd->finish();
$dbh->commit();
$dbh->disconnect();
return { 'titles' => \@titles,
'data' => \@data };
}
else {
# Call the psql program
local $temp = &tempname();
open(TEMP, ">$temp");
print TEMP "$config{'login'}\n$config{'pass'}\n";
close(TEMP);
local $host = $config{'host'} ? "-h $config{'host'}" : "";
local $cmd = "$config{'psql'} -u -c \"$_[1]\" $host $_[0] <$temp";
if ($config{'unix'}) {
$cmd =~ s/"/\\"/g;
$cmd = "su $config{'unix'} -c \"$cmd\"";
}
open(OUT, "$cmd <$temp 2>&1 |");
local ($line, $rv, @data);
do {
$line = <OUT>;
} while($line =~ /^(username|password|user name):/i ||
$line =~ /(warning|notice):/i || $line !~ /\S/);
if ($line =~ /^ERROR:\s+(.*)/ || $line =~ /FATAL.*:\s+(.*)/) {
&error(&text('esql', "<tt>$_[1]</tt>", "<tt>$1</tt>"));
}
else {
local $dash = <OUT>;
if ($dash =~ /^\s*\+\-/) {
# mysql-style output
$line = <OUT>;
$line =~ s/^[\s\|]+//; $line =~ s/[\s\|]+$//;
local @titles = split(/\|/, $line);
map { s/^\s+//; s/\s+$// } @titles;
$line = <OUT>; # skip useless dashes
while(1) {
$line = <OUT>;
last if (!$line || $line =~ /^\s*\+/);
$line =~ s/^[\s\|]+//; $line =~ s/[\s\|]+$//;
local @row = split(/\|/, $line);
map { s/^\s+//; s/\s+$// } @row;
push(@data, \@row);
}
$rv = { 'titles' => \@titles, 'data' => \@data };
}
elsif ($dash !~ /^-/) {
# no output, such as from an insert
$rv = undef;
}
else {
# psql-style output
local @titles = split(/\|/, $line);
map { s/^\s+//; s/\s+$// } @titles;
while(1) {
$line = <OUT>;
last if (!$line || $line =~ /^\(\d+\s+\S+\)/);
local @row = split(/ \| /, $line);
map { s/^\s+//; s/\s+$// } @row;
push(@data, \@row);
}
$rv = { 'titles' => \@titles, 'data' => \@data };
}
}
close(OUT);
unlink($temp);
return $rv;
}
}
# execute_sql_logged(database, command)
sub execute_sql_logged
{
&additional_log('sql', $_[0], $_[1]);
return &execute_sql(@_);
}
# run_as_postgres(command)
sub run_as_postgres
{
pipe(OUTr, OUTw);
local $pid = fork();
if (!$pid) {
untie(*STDIN);
untie(*STDOUT);
untie(*STDERR);
close(STDIN);
open(STDOUT, ">&OUTw");
open(STDERR, ">&OUTw");
local @u = getpwnam($config{'user'});
$( = $u[3]; $) = "$u[3] $u[3]";
($>, $<) = ($u[2], $u[2]);
exec(@_);
print "Exec failed : $!\n";
exit 1;
}
close(OUTw);
return OUTr;
}
sub can_edit_db
{
local $d;
return 1 if ($access{'dbs'} eq '*');
foreach $d (split(/\s+/, $access{'dbs'})) {
return 1 if ($d eq $_[0]);
}
return 0;
}
# get_hba_config()
# Parses the postgres host access config file
sub get_hba_config
{
local $lnum = 0;
open(HBA, $config{'hba_conf'});
while(<HBA>) {
s/\r|\n//g;
s/^\s*#.*$//g;
if (/^\s*host\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)(\s+(\S+))?/) {
push(@rv, { 'type' => 'host',
'index' => scalar(@rv),
'line' => $lnum,
'db' => $1,
'address' => $2,
'netmask' => $3,
'auth' => $4,
'arg' => $6 } );
}
elsif (/^\s*local\s+(\S+)\s+(\S+)(\s+(\S+))?/) {
push(@rv, { 'type' => 'local',
'index' => scalar(@rv),
'line' => $lnum,
'db' => $1,
'auth' => $2,
'arg' => $4 } );
}
$lnum++;
}
close(HBA);
return @rv;
}
# create_hba(&hba)
sub create_hba
{
local $lref = &read_file_lines($config{'hba_conf'});
push(@$lref, &hba_line($_[0]));
&flush_file_lines();
}
# delete_hba(&hba)
sub delete_hba
{
local $lref = &read_file_lines($config{'hba_conf'});
splice(@$lref, $_[0]->{'line'}, 1);
&flush_file_lines();
}
# modify_hba(&hba)
sub modify_hba
{
local $lref = &read_file_lines($config{'hba_conf'});
splice(@$lref, $_[0]->{'line'}, 1, &hba_line($_[0]));
&flush_file_lines();
}
# swap_hba(&hba1, &hba2)
sub swap_hba
{
local $lref = &read_file_lines($config{'hba_conf'});
local $line0 = $lref->[$_[0]->{'line'}];
local $line1 = $lref->[$_[1]->{'line'}];
$lref->[$_[1]->{'line'}] = $line0;
$lref->[$_[0]->{'line'}] = $line1;
&flush_file_lines();
}
sub hba_line
{
if ($_[0]->{'type'} eq 'host') {
return join(" ", 'host', $_[0]->{'db'}, $_[0]->{'address'},
$_[0]->{'netmask'}, $_[0]->{'auth'},
$_[0]->{'arg'} ? ( $_[0]->{'arg'} ) : () );
}
else {
return join(" ", 'local', $_[0]->{'db'}, $_[0]->{'auth'},
$_[0]->{'arg'} ? ( $_[0]->{'arg'} ) : () );
}
}
# split_array(value)
sub split_array
{
if ($_[0] =~ /^\{(.*)\}$/) {
local @a = split(/,/, $1);
return @a;
}
else {
return ( $_[0] );
}
}
# join_array(values ..)
sub join_array
{
local $alpha;
map { $alpha++ if (!/^-?[0-9\.]+/) } @_;
return $alpha ? '{'.join(',', map { "'$_'" } @_).'}'
: '{'.join(',', @_).'}';
}
1;

View File

@@ -1,51 +0,0 @@
#!/usr/local/bin/perl
# restore.cgi
# Restore a database from a local file
require './postgresql-lib.pl' ;
&ReadParse ( ) ;
&error_setup ( $text{'restore_err'} ) ;
$access{'restore'} || &error($text{'restore_ecannot'});
&can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
if ( ! -f $in{'path'} ) {
&error ( &text ( 'restore_pe2', $in{'path'} ) ) ;
}
$db_find_f = 0 ;
if ( $in{'db'} ) {
foreach ( &list_databases() ) {
if ( $_ eq $in{'db'} ) { $db_find_f = 1 ; }
}
}
if ( $db_find_f == 0 ) { &error ( &text ( 'restore_edb' ) ) ; }
$rstr_command = $config{'rstr_cmd'}.
($config{'login'} ? " -U $config{'login'}" : "").
($config{'host'} ? " -h $config{'host'}" : "").
($in{'only'} ? " -a" : "").
($in{'clean'} ? " -c" : "").
" -d $in{'db'} $in{'path'}" ;
if ( $config{'sameunix'} && defined(getpwnam($config{'login'})) ) {
$rstr_command =~ s/"/\\"/g ;
$rstr_command = "su $config{'login'} -c ".quotemeta($rstr_command);
}
$temp = &tempname();
open(TEMP, ">$temp");
print TEMP "$config{'pass'}\n";
close(TEMP);
$out = &backquote_logged("$rstr_command 2>&1 <$temp");
unlink($temp);
if ( $? == 0 ) {
&redirect ("edit_dbase.cgi?db=$in{'db'}") ;
} else {
&error ( &text ( 'restore_exe', $rstr_command )."<pre>$out</pre>" ) ;
}

View File

@@ -1,45 +0,0 @@
#!/usr/local/bin/perl
# restore_form.cgi
# Display a form for restore a database
require './postgresql-lib.pl' ;
&ReadParse ( ) ;
&error_setup ( $text{'restore_err'} ) ;
$access{'restore'} || &error($text{'restore_ecannot'});
&can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
&has_command($config{'rstr_cmd'}) ||
&error(&text('restore_ecmd', "<tt>$config{'rstr_cmd'}</tt>"));
&header ( $text{'restore_title'}, "", "restore_form" ) ;
print "<hr>\n" ;
print "<form action=restore.cgi method=post>\n" ;
print "<input type=hidden name=db value=\"$in{'db'}\">\n" ;
print "<table border>\n" ;
print "<tr $tb> <td><b>$text{'restore_header'}</b></td> </tr>\n" ;
print "<tr $cb> <td><table>\n" ;
print "<tr> <td><b>$text{'restore_path'}</b></td>\n" ;
print "<td>\n" ;
print "<input type=text name=path value='$config{'repository'}/' size=64></td> </tr>\n" ;
print "<tr> <td><b>$text{'restore_only'}</b></td>\n";
print "<td><input type=radio name=only value=1> $text{'yes'}\n";
print "<input type=radio name=only value=0 checked> $text{'no'}</td> </tr>\n";
print "<tr> <td><b>$text{'restore_clean'}</b></td>\n";
print "<td><input type=radio name=clean value=1> $text{'yes'}\n";
print "<input type=radio name=clean value=0 checked> $text{'no'}</td> </tr>\n";
print "<td><input type=radio name=only value=1> $text{'yes'}\n";
print "<tr $cb> <td colspan=2 align=right><input type=submit " ,
"value='$text{'restore_go'}'></td> </tr>\n" ;
print "</table></td></tr></table></form>\n" ;
print "<hr>\n" ;
&footer ( "", $text{'index_return'} ) ;

View File

@@ -1,289 +0,0 @@
# proc-lib.pl
# Functions for managing processes
do '../web-lib.pl';
&init_config();
do "$config{ps_style}-lib.pl";
use POSIX;
%access = &get_module_acl();
map { $hide{$_}++ } split(/\s+/, $access{'hide'});
sub process_info
{
local @plist = &list_processes($_[0]);
return @plist ? %{$plist[0]} : ();
}
# index_links(current)
sub index_links
{
local(%linkname, $l);
print "<b>$text{'index_display'} : </b>&nbsp;&nbsp;\n";
foreach $l ("tree", "user", "size", "cpu", "search", "run") {
next if ($l eq "run" && !$access{'run'});
if ($l ne $_[0]) { print "<a href=index_$l.cgi>"; }
else { print "<b>"; }
print $text{"index_$l"};
if ($l ne $_[0]) { print "</a>"; }
else { print "</b>"; }
print "&nbsp;\n";
}
print "<p>\n";
open(INDEX, "> $module_config_directory/index");
$0 =~ /([^\/]+)$/;
print INDEX "$1?$in\n";
close(INDEX);
}
sub cut_string
{
if (length($_[0]) > $_[1]) {
return substr($_[0], 0, $_[1])." ...";
}
return $_[0];
}
# switch_acl_uid()
sub switch_acl_uid
{
if ($access{'uid'} < 0) {
local @u = getpwnam($remote_user);
$( = $u[3]; $) = "$u[3] $u[3]";
($>, $<) = ($u[2], $u[2]);
}
elsif ($access{'uid'}) {
local @u = getpwuid($access{'uid'});
$( = $u[3]; $) = "$u[3] $u[3]";
($>, $<) = ($u[2], $u[2]);
}
}
# safe_process_exec(command, uid, gid, handle, input, fixtags, bsmode)
# Executes the given command as the given user/group and writes all output
# to the given file handle. Finishes when there is no more output or the
# process stops running. Returns the number of bytes read.
sub safe_process_exec
{
# setup pipes and fork the process
local $chld = $SIG{'CHLD'};
$SIG{'CHLD'} = \&safe_exec_reaper;
pipe(OUTr, OUTw);
pipe(INr, INw);
local $pid = fork();
if (!$pid) {
#setsid();
untie(*STDIN);
untie(*STDOUT);
untie(*STDERR);
open(STDIN, "<&INr");
open(STDOUT, ">&OUTw");
open(STDERR, ">&OUTw");
$| = 1;
close(OUTr); close(INw);
if ($_[1]) {
if (defined($_[2])) {
# switch to given UID and GID
$( = $_[2]; $) = "$_[2] $_[2]";
($>, $<) = ($_[1], $_[1]);
}
else {
# switch to UID and all GIDs
local @u = getpwuid($_[1]);
$( = $u[3];
$) = "$u[3] ".join(" ", $u[3], &other_groups($u[0]));
($>, $<) = ($u[2], $u[2]);
}
}
# run the command
delete($ENV{'FOREIGN_MODULE_NAME'});
delete($ENV{'SCRIPT_NAME'});
exec("/bin/sh", "-c", $_[0]);
print "Exec failed : $!\n";
exit 1;
}
close(OUTw); close(INr);
# Feed input (if any)
print INw $_[4];
close(INw);
# Read and show output
local $fn = fileno(OUTr);
local $got = 0;
local $out = $_[3];
local $line;
while(1) {
local ($rmask, $buf);
vec($rmask, $fn, 1) = 1;
local $sel = select($rmask, undef, undef, 1);
if ($sel > 0 && vec($rmask, $fn, 1)) {
# got something to read.. print it
sysread(OUTr, $buf, 1024) || last;
$got += length($buf);
if ($_[5]) {
$buf = &html_escape($buf);
}
if ($_[6]) {
# Convert backspaces and returns
$line .= $buf;
while($line =~ s/^([^\n]*\n)//) {
local $one = $1;
while($one =~ s/.\010//) { }
print $out $one;
}
}
else {
print $out $buf;
}
}
elsif ($sel == 0) {
# nothing to read. maybe the process is done, and a subprocess
# is hanging things up
last if (!kill(0, $pid));
}
}
close(OUTr);
print $out $line;
$SIG{'CHLD'} = $chld;
return $got;
}
# safe_process_exec_logged(..)
# Like safe_process_exec, but also logs the command
sub safe_process_exec_logged
{
&additional_log('exec', undef, $_[0]);
return &safe_process_exec(@_);
}
sub safe_exec_reaper
{
local $xp;
do { local $oldexit = $?;
$xp = waitpid(-1, WNOHANG);
$? = $oldexit if ($? < 0);
} while($xp > 0);
}
# pty_process_exec(command, [uid, gid])
# Starts the given command in a new pty and returns the pty filehandle and PID
sub pty_process_exec
{
local ($ptyfh, $ttyfh, $pty, $tty) = &get_new_pty();
local $pid = fork();
if (!$pid) {
close(STDIN); close(STDOUT); close(STDERR);
untie(*STDIN); untie(*STDOUT); untie(*STDERR);
setsid();
#setpgrp(0, $$);
if ($_[1]) {
$( = $u[3]; $) = "$_[2] $_[2]";
($>, $<) = ($_[1], $_[1]);
}
open(STDIN, "<$tty");
open(STDOUT, ">&$ttyfh");
open(STDERR, ">&STDOUT");
close($ptyfh);
exec($_[0]);
print "Exec failed : $!\n";
exit 1;
}
close($ttyfh);
return ($ptyfh, $pid);
}
# pty_process_exec_logged(..)
# Like pty_process_exec, but logs the command as well
sub pty_process_exec_logged
{
&additional_log('exec', undef, $_[0]);
return &pty_process_exec(@_);
}
# find_process(name)
# Returns an array of all processes matching some name
sub find_process
{
local $name = $_[0];
local @rv = grep { $_->{'args'} =~ /$name/ } &list_processes();
return wantarray ? @rv : $rv[0];
}
$has_lsof_command = &has_command("lsof");
# find_socket_processes(protocol, port)
# Returns all processes using some port and protocol
sub find_socket_processes
{
local @rv;
open(LSOF, "lsof -i '$_[0]:$_[1]' |");
while(<LSOF>) {
if (/^(\S+)\s+(\d+)/) {
push(@rv, $2);
}
}
close(LSOF);
return @rv;
}
# find_process_sockets(pid)
# Returns all network connections made by some process
sub find_process_sockets
{
local @rv;
open(LSOF, "lsof -i tcp -i udp -n |");
while(<LSOF>) {
if (/^(\S+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*(TCP|UDP)\s+(.*)/
&& $2 eq $_[0]) {
local $n = { 'fd' => $4,
'type' => $5,
'proto' => $7 };
local $m = $8;
if ($m =~ /^([^:\s]+):([^:\s]+)\s+\(listen\)/i) {
$n->{'lhost'} = $1;
$n->{'lport'} = $2;
$n->{'listen'} = 1;
}
elsif ($m =~ /^([^:\s]+):([^:\s]+)->([^:\s]+):([^:\s]+)\s+\((\S+)\)/) {
$n->{'lhost'} = $1;
$n->{'lport'} = $2;
$n->{'rhost'} = $3;
$n->{'rport'} = $4;
$n->{'state'} = $5;
}
elsif ($m =~ /^([^:\s]+):([^:\s]+)/) {
$n->{'lhost'} = $1;
$n->{'lport'} = $2;
}
push(@rv, $n);
}
}
close(LSOF);
return @rv;
}
# find_process_files(pid)
# Returns all files currently held open by some process
sub find_process_files
{
local @rv;
open(LSOF, "lsof -p '$_[0]' |");
while(<LSOF>) {
if (/^(\S+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\d+),(\d+)\s+(\d+)\s+(\d+)\s+(.*)/) {
push(@rv, { 'fd' => lc($4),
'type' => lc($5),
'device' => [ $6, $7 ],
'size' => $8,
'inode' => $9,
'file' => $10 });
}
}
close(LSOF);
return @rv;
}
1;

View File

@@ -146,7 +146,7 @@ if (@conf) {
push(@tds, "width=32");
# Add before/after links
push(@cols, "<a href='edit_recipe.cgi?new=1&before=$c->{'index'}'><img src=images/before.gif border=0></a><a href='edit_recipe.cgi?new=1&after=$c->{'index'}'><img src=images/after.gif border=0></a>");
push(@cols, &ui_link("edit_recipe.cgi?new=1&after=$c->{'index'}","<img src=images/after.gif border=0>"));
print &ui_checked_columns_row(\@cols, \@tds, "d",$c->{'index'});
}
print &ui_columns_end();
@@ -165,7 +165,7 @@ print &ui_buttons_row("manual_form.cgi",
$text{'index_man'}, $text{'index_mandesc'});
print &ui_buttons_end();
print "<a href='manual_form.cgi'>$text{'index_manual'}</a>\n";
print &ui_link("manual_form.cgi","$text{'index_manual'}")."\n";
print "<p>\n";
&ui_print_footer("/", $text{'index'});

View File

@@ -1 +0,0 @@
cvs=cvs

View File

@@ -1,3 +0,0 @@
cvs=Path to cvs executable,0
cvsroot=CVS root directory,3,Not set yet

View File

@@ -1,73 +0,0 @@
#!/usr/local/bin/perl
# index.cgi
# Display a table of icons for cvs server options
require './pserver-lib.pl';
&ReadParse();
if (!$cvs_path) {
&header($text{'index_title'}, "", undef, 1, 1);
print "<hr>\n";
print "<p>",&text('index_ecvs', "<tt>$config{'cvs'}</tt>",
"$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
print "<hr>\n";
&footer("/", $text{'index'});
exit;
}
$out = `$config{'cvs'} -v`;
if ($out !~ /CVS[^0-9\.]*([0-9\.]+)/) {
&header($text{'index_title'}, "", undef, 1, 1);
print "<hr>\n";
print "<p>",&text('index_eversion', "<tt>$config{'cvs'} -v</tt>",
"<tt>$out</tt>"),"<p>\n";
print "<hr>\n";
&footer("/", $text{'index'});
exit;
}
$ver = $1;
&header($text{'index_title'}, "", undef, 1, 1, undef,
&help_search_link("cvs", "man", "doc"), undef, undef,
&text('index_version', $ver));
print "<hr>\n";
if (!-d "$config{'cvsroot'}/CVSROOT") {
print "<p>",&text('index_eroot',
"$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
print "<hr>\n";
&footer("/", $text{'index'});
exit;
}
# Show configuration icons
# Check if run from inetd or xinetd
print "<hr>\n";
print "<table width=100%><tr>\n";
$inet = &check_inetd();
if (!$inet) {
print "<form action=setup.cgi>\n";
print "<td><input type=submit value='$text{'index_setup'}'></td>\n";
print "<td>$text{'index_setupdesc'}</td>\n";
print "</form>\n";
}
elsif (!$inet->{'active'}) {
print "<form action=setup.cgi>\n";
print "<td><input type=submit value='$text{'index_act'}'></td>\n";
print "<td>",&text('index_actdesc',
"<tt>$inet->{'type'}</tt>"),"</td>\n";
print "</form>\n";
}
else {
print "<form action=setup.cgi>\n";
print "<td><input type=submit value='$text{'index_deact'}'></td>\n";
print "<td>",&text('index_deactdesc',
"<tt>$inet->{'type'}</tt>"),"</td>\n";
print "</form>\n";
}
print "</tr></table>\n";
print "<hr>\n";
&footer("/", $text{'index'});

View File

@@ -1,11 +0,0 @@
index_title=CVS Server
index_ecvs=The CVS command $1 was not found on your system. Maybe it is not installed, or your <a href='$2'>module configuration</a> is incorrect.
index_eversion=Failed to get the version from CVS command $1. Output was $2.
index_eroot=Your CVS root directory has not been set yet. You must use the <a href='$1'>module configuration</a> to set it before this module will work.
index_version=CVS version $1
index_setup=Setup CVS Server
index_setupdesc=The CVS server does not appear to be currently setup on your system. Click this button to have it run from <tt>inetd</tt> or <tt>xinetd</tt>.
index_act=Activate CVS Server
index_actdesc=The CVS server is setup to run from $1 on your system, but not currently active. Click this button if you want to activate it and allow remote users to access your CVS repository.
index_deact=Deactivate CVS Server
index_deactdesc=The CVS server is setup to run from $1 on your system, and is active. Click this button if you want to deactivate it and prevent remote users from accessing your CVS repository.

View File

@@ -1,48 +0,0 @@
# pserver-lib.pl
do '../web-lib.pl';
&init_config();
$cvs_path = &has_command($config{'cvs'});
$cvs_port = 2401;
$cvs_inet_name = "cvspserver";
$has_xinetd = &foreign_check("xinetd");
$has_inetd = &foreign_check("inetd");
# check_inetd()
# Find out if cvs is being run from inetd or xinetd
sub check_inetd
{
if ($has_xinetd) {
&foreign_require("xinetd", "xinetd-lib.pl");
local @xic = &xinetd::get_xinetd_config();
foreach $x (@xic) {
# XXX not done yet
}
}
if ($has_inetd) {
local (%portmap, $s, $a, $i);
&foreign_require("inetd", "inetd-lib.pl");
foreach $s (&inetd::list_services()) {
$portmap{$s->[1]} = $s;
foreach $a (split(/\s+/, $s->[4])) {
$portmap{$a} = $s;
}
}
foreach $i (&inetd::list_inets()) {
if (($i->[8] eq $cvs_path || $i->[8] eq $config{'cvs'}) &&
$portmap{$i->[3]}->[2] == $cvs_port) {
# Found the entry
return { 'type' => 'inetd',
'command' => $i->[8],
'args' => $i->[9],
'active' => $i->[7],
'inetd' => $i };
}
}
}
return undef;
}
1;

View File

@@ -1,73 +0,0 @@
#!/usr/local/bin/perl
# setup.cgi
# Setup the CVS server in inetd or xinetd
require './pserver-lib.pl';
$inet = &check_inetd();
$restart = $inet->{'type'} if ($inet);
if (!$inet) {
# Need to setup for the first time
if ($has_xinetd) {
# Just add an unlisted service
$restart = "xinetd";
}
elsif ($has_inetd) {
# Is there already a service on port 2401, or named cvspserver?
foreach $s (&inetd::list_services()) {
local @al = split(/\s+/, $s->[4]);
if ($s->[2] == $cvs_port ||
$s->[1] eq $cvs_inet_name ||
&indexof($cvs_inet_name, @al) >= 0) {
# Yes! Use it
$sname = $s->[1];
last;
}
}
if (!$sname) {
$sname = $cvs_inet_name;
&inetd::create_service($sname, $cvs_port, "tcp", undef);
}
&inetd::create_inet(1, $sname, "stream", "tcp", "nowait",
"root", $cvs_path, "cvs -f --allow-root '$config{'cvsroot'}' pserver");
$restart = "inetd";
}
else {
}
}
elsif ($inet->{'active'}) {
# Need to de-activate
if ($inet->{'type'} eq 'inetd') {
local @i = @{$inet->{'inetd'}};
&inetd::modify_inet($i[0], 0, $i[3], $i[4], $i[5],
$i[6], $i[7], $i[8], $i[9], $i[10]);
}
else {
}
}
else {
# Need to activate
if ($inet->{'type'} eq 'inetd') {
local @i = @{$inet->{'inetd'}};
&inetd::modify_inet($i[0], 1, $i[3], $i[4], $i[5],
$i[6], $i[7], $i[8], $i[9], $i[10]);
}
else {
}
}
# Restart inetd or xinetd
if ($restart eq "inetd") {
%iconfig = &foreign_config("inetd");
&system_logged(
"$iconfig{'restart_command'} >/dev/null 2>&1 </dev/null");
}
else {
%xconfig = &foreign_config("xinetd");
if (open(PID, $xconfig{'pid_file'})) {
chop($pid = <PID>);
close(PID);
kill('USR2', $pid);
}
}
&redirect("");

View File

@@ -54,7 +54,7 @@ if (@queue) {
$q = $queue[$i];
print "<tr $cb>\n";
print "<td><input type=checkbox name=file value=$q->{'file'}></td>\n";
print "<td><a href='view_queue.cgi?file=$q->{'file'}'>$q->{'id'}</a></td>\n";
print &ui_link("view_queue.cgi?file=$q->{'file'}",$q->{'id'})."</td>\n";
print "<td>$q->{'date'}</td>\n";
print "<td>",&html_escape($q->{'from'}),"</td>\n";
print "<td>",&html_escape($q->{'to'}),"</td>\n";

View File

@@ -1,18 +0,0 @@
#!/usr/local/bin/perl
# save_locals.cgi
# Save the list of local domains
require './qmail-lib.pl';
&ReadParseMime();
if ($in{'locals_def'}) {
&save_control_file("locals", undef);
}
else {
$in{'locals'} =~ s/\r//g;
@dlist = split(/\s+/, $in{'locals'});
&save_control_file("locals", \@dlist);
}
&webmin_log("locals", undef, undef, \%in);
&redirect("");

View File

@@ -1,61 +0,0 @@
#!/usr/local/bin/perl
# save_virt.cgi
# Save or delete a new or existing virtual mapping
require './qmail-lib.pl';
&ReadParse();
&error_setup($text{'vsave_err'});
@virts = &list_virts();
$v = $virts[$in{'idx'}] if ($in{'idx'} ne '');
if ($in{'delete'}) {
# delete some virt
$logv = $v;
&delete_virt($v);
}
else {
# saving or creating .. check inputs
if ($in{'from_mode'} == 1) {
$in{'domain'} =~ /^[A-Za-z0-9\.\-]+$/ ||
&error(&text('vsave_edomain', $in{'domain'}));
$newv{'domain'} = $in{'domain'};
}
elsif ($in{'from_mode'} == 2) {
$in{'user'} =~ /^[^\@: ]+$/ ||
&error(&text('vsave_euser', $in{'user'}));
$in{'domain2'} =~ /^[A-Za-z0-9\.\-]+$/ ||
&error(&text('vsave_edomain', $in{'domain2'}));
$newv{'domain'} = $in{'domain2'};
$newv{'user'} = $in{'user'};
}
if ($in{'prepend_mode'} == 1) {
$in{'prepend'} =~ /^[^\@: ]+$/ ||
&error(&text('vsave_eprepend', $in{'prepend'}));
$newv{'prepend'} = $in{'prepend'};
}
elsif ($in{'prepend_mode'} == 0) {
$in{'from_mode'} || &error($text{'vsave_eboth'});
}
elsif ($in{'prepend_mode'} == 2) {
if ($in{'from_mode'} == 1) {
$newv{'prepend'} = $in{'domain'};
$newv{'prepend'} =~ s/\.(.*)$//;
}
elsif ($in{'from_mode'} == 2) {
$newv{'prepend'} = $in{'domain2'};
$newv{'prepend'} =~ s/\.(.*)$//;
}
else {
$newv{'prepend'} = 'catchall';
}
}
if ($in{'new'}) { &create_virt(\%newv); }
else { &modify_virt($v, \%newv); }
$logv = \%newv;
}
&webmin_log($in{'delete'} ? 'delete' : $in{'new'} ? 'create' : 'modify',
"virt", $logv->{'user'} ? "$logv->{'user'}\@$logv->{'domain'}" :
$logv->{'domain'}, $logv);
&redirect("list_virts.cgi");

View File

@@ -1,247 +0,0 @@
quota_unlimited=Unlimited
acl_fss=Filesystems this user can edit
acl_fall=All filesystems
acl_fsel=Selected..
acl_quotaon=Can enable and disable quotas?
acl_quotanew=Can configure quotas for new users?
acl_ugrace=Can edit user grace times?
acl_vtotal=Can view total disk space?
acl_ggrace=Can edit group grace times?
acl_uquota=Users this user can edit quotas for
acl_gquota=Groups this user can edit quotas for
acl_uall= All users
acl_uonly= Only users
acl_uexcept= All except users
acl_ugroup= Users with primary group
acl_gall= All groups
acl_gnone= No groups
acl_gonly= Only groups
acl_gexcept= All except groups
acl_uuid=Users with UID in range
acl_maxblocks=Maximum grantable block quota
acl_maxfiles=Maximum grantable file quota
acl_unlimited=Unlimited
activate_eallow=You are not allowed to enable or disable quotas on this filesystem
activate_eon=Failed to turn on quotas
activate_eoff=Failed to turn off quotas
check_title=Check Quotas
check_return=$1 list
check_ecannot=You cannot check quotas on this filesystem
check_running=The <tt>quotacheck</tt> command is now being run to check the block and file usage on <tt>$1</tt>. This may take a long time for a very large filesystem...
check_done=... Done.
check_rgroup=group
check_ruser=user
cgroup_efail=Failed to copy quotas
cgroup_ecannot=You cannot copy quotas
cgroup_egallow=You are not allowed to copy the quotas of this group
cgroup_enogroup=No groups to copy to
cgroup_eallowto=You are not allowed to copy quotas to '$1'
cgform_title=Copy Quotas
cgform_return=group quota
cgform_ecannot=You cannot copy quotas
cgform_egroup=You are not allowed to copy the quotas of this group
cgform_copyto=Copy quotas for <tt>$1</tt> on ALL filesystems to ...
cgform_all=All groups on your system
cgform_select=Selected groups
cgform_contain=Groups containing users
cgform_doit=Copy
cuser_efail=Failed to copy quotas
cuser_ecannot=You cannot copy quotas
cuser_euallow=You are not allowed to copy the quotas of this user
cuser_enouser=No users to copy to
cuser_eallowto=You are not allowed to copy quotas to '$1'
cuform_title=Copy Quotas
cuform_return=user quota
cuform_ecannot=You cannot copy quotas
cuform_euallow=You are not allowed to copy the quotas of this user
cuform_copyto=Copy quotas for <tt>$1</tt> on ALL filesystems to ...
cuform_all=All users on your system
cuform_select=Selected users
cuform_members=Members of selected groups
cuform_doit=Copy
egroup_title=Edit Quota
egroup_freturn=filesystem list
egroup_greturn=group list
egroup_eallowgr=You are not allowed to edit quotas for '$1'
egroup_eallowfs=You are not allowed to edit quotas on this filesystem
egroup_quotas=Quota for <tt>$1</tt> on <tt>$2</tt>
egroup_bused=Blocks Used
egroup_sblimit=Soft Block Limit
egroup_hblimit=Hard Block Limit
egroup_fused=Files Used
egroup_sflimit=Soft File Limit
egroup_hflimit=Hard File Limit
egroup_update=Update
egroup_listall=List All Quotas
euser_title=Edit Quota
euser_freturn=filesystem list
euser_ureturn=user list
euser_eallowus=You are not allowed to edit quotas for '$1'
euser_eallowfs=You are not allowed to edit quotas on this filesystem
euser_quotas=Quota for <tt>$1</tt> on <tt>$2</tt>
euser_bused=Blocks Used
euser_bdisk=Available Blocks on Disk
euser_sblimit=Soft Block Limit
euser_hblimit=Hard Block Limit
euser_fused=Files Used
euser_fdisk=Available Files on Disk
euser_sflimit=Soft File Limit
euser_hflimit=Hard File Limit
euser_update=Update
euser_listall=List All Quotas
gfilesys_title=Group Quotas
gfilesys_return=filesystems list
gfilesys_ecannot=You cannot edit quotas for '$1'
gfilesys_all=All Quotas for $1
gfilesys_blocks=Blocks
gfilesys_files=Files
gfilesys_fs=Filesystem
gfilesys_used=Used
gfilesys_soft=Soft Limit
gfilesys_hard=Hard Limit
gfilesys_nogquota=Group <tt>$1</tt> does not have quotas on any filesystem
gfilesys_edit=Edit Quota On:
gfilesys_copy=Copy Quotas
ggracef_title=Grace Times
ggracef_return=group list
ggracef_ecannot=You cannot edit grace times on this filesystem
ggracef_info=Each filesystem has a grace time for block and file quotas. The grace time determines how long a group can remain over the soft limit before no more files are allowed to be created.
ggracef_graces=Group Grace Times for <tt>$1</tt>
ggracef_block=For block quota
ggracef_file=For file quota
ggracef_update=Update
ggraces_esave=Failed to save grace times
ggraces_eedit=You cannot edit grace times on this filesystem
ggraces_enumber='$1' is not a number
index_quser=User Quotas
index_qgroup=Group Quotas
index_qboth=User and Group Quotas
index_active=Active
index_disable=Disable Quotas
index_inactive=Inactive
index_enable=Enable Quotas
index_mountonly=Enabled at mount
index_title=Disk Quotas
index_fs=Filesystem
index_type=Type
index_mount=Mounted From
index_status=Status
index_action=Action
index_return=index
index_euser=Edit User Quotas:
index_egroup=Edit Group Quotas:
index_nosupport=No local filesystems can support quotas
lgroups_failed=Failed to list groups
lgroups_eallow=You are not allowed to edit quotas on this filesystem
lgroups_title=Filesystem Quotas
lgroups_return=filesystems list
lgroups_toomany=Too many groups have quotas on <tt>$1</tt> to display on one page
lgroups_quotas=All Group Quotas on <tt>$1</tt>
lgroups_blocks=Blocks
lgroups_files=Files
lgroups_group=Group
lgroups_used=Used
lgroups_soft=Soft Limit
lgroups_hard=Hard Limit
lgroups_noquota=No groups have quotas on <tt>$1</tt>
lgroups_equota=Edit Quota For:
lgroups_grace=Edit Grace Times
lgroups_check=Check Quotas
sgroup_egroup=You are not allowed to edit quotas for this group
sgroup_efs=You are not allowed to edit quotas on this filesystem
ssync_ecannot=You cannot set the default quota for this filesystem
suser_euser=You are not allowed to edit quotas for this user
suser_efs=You are not allowed to edit quotas on this filesystem
suser_emaxblocks=You are not allowed to grant block limits above $1
suser_emaxfiles=You are not allowed to grant file limits above $1
ufilesys_title=User Quotas
ufilesys_return=filesystems list
ufilesys_ecannot=You cannot edit quotas for '$1'
ufilesys_all=All Quotas for <tt>$1</tt>
ufilesys_blocks=Blocks
ufilesys_files=Files
ufilesys_fs=Filesystem
ufilesys_used=Used
ufilesys_soft=Soft Limit
ufilesys_hard=Hard Limit
ufilesys_nouquota=User <tt>$1</tt> does not have quotas on any filesystem
ufilesys_edit=Edit Quota On:
ufilesys_copy=Copy Quotas
ugracef_title=Grace Times
ugracef_return=user list
ugracef_ecannot=You cannot edit grace times on this filesystem
ugracef_info=Each filesystem has a grace time for block and file quotas. The grace time determines how long a user can remain over the soft limit before no more files are allowed to be created.
ugracef_graces=User Grace Times for <tt>$1</tt>
ugracef_block=For block quota
ugracef_file=For file quota
ugracef_update=Update
ugraces_esave=Failed to save grace times
ugraces_eedit=You cannot edit grace times on this filesystem
ugraces_enumber='$1' is not a number
lusers_failed=Failed to list users
lusers_eallow=You are not allowed to edit quotas on this filesystem
lusers_title=Filesystem Quotas
lusers_return=filesystems list
lusers_toomany=Too many users have quotas on <tt>$1</tt> to display on one page
lusers_qoutas=All User Quotas on <tt>$1</tt>
lusers_blocks=Blocks
lusers_files=Files
lusers_user=User
lusers_used=Used
lusers_soft=Soft Limit
lusers_hard=Hard Limit
lusers_noquota=No users have quotas on <tt>$1</tt>
lusers_equota=Edit Quota For:
lusers_egrace=Edit Grace Times
lusers_check=Check Quotas
lusers_info=Webmin can be configured to automatically set the quotas on this filesystem when a new Unix user is created. This will only work when the $1 Webmin module is used to add users.
lusers_useradmin=Users and Groups
lusers_newuser=New User Quotas
lusers_sblimit=Soft Block Limit
lusers_hblimit=Hard Block Limit
lusers_sflimit=Soft File Limit
lusers_hflimit=Hard File Limit
lusers_apply=Apply
grace_seconds=Seconds
grace_minutes=Minutes
grace_hours=Hours
grace_days=Days
grace_weeks=Weeks
grace_months=Months
log_activate_u=Enabled user quotas on $1
log_activate_g=Enabled group quotas on $1
log_activate_ug=Enabled user and group quotas on $1
log_deactivate_u=Disabled user quotas on $1
log_deactivate_g=Disabled group quotas on $1
log_deactivate_ug=Disabled user and group quotas on $1
log_save=Changed quotas for $1 on $2
log_sync=Changed new user quotas on $1
log_grace_u=Changed user grace times on $1
log_grace_g=Changed group grace times on $1
log_check=Checked quotas on $1
log_copy_u=Copied user $1's quotas
log_copy_g=Copied group $1's quotas

View File

@@ -46,8 +46,7 @@ if (@$conf) {
}
my @errors = grep { $_ ne "U" } @{$c->{'errors'}};
print &ui_columns_row([
"<a href='view_raid.cgi?idx=$c->{'index'}'>".
&html_escape($c->{'value'})."</a>",
&ui_link("view_raid.cgi?idx=$c->{'index'}",&html_escape($c->{'value'})),
!$c->{'active'} ?
"<font color=#ff0000>$text{'no'}</font>" :
@errors ?

View File

@@ -20,8 +20,7 @@ if (@ulist) {
@grid = ( );
for($i=0; $i<@ulist; $i++) {
$u = $ulist[$i];
push(@grid, "<a href='edit_euser.cgi?idx=$u->{'index'}'>".
&html_escape($u->{'name'})."</a>");
push(@grid, &ui_link("edit_euser.cgi?idx=$u->{'index'}",&html_escape($u->{'name'})));
}
print &ui_grid_table(\@grid, 4, 100,
[ "width=25%", "width=25%", "width=25%", "width=25%" ],

View File

@@ -1,503 +0,0 @@
index_title=Samba Share Manager
index_sharelist=share list
index_userlist=user list
index_fileshare=file share
index_printershare=printer share
index_shareconf=share configuration
index_version=Samba version $1
index_sharename=Share Name
index_path=Path
index_security=Security
index_homedir=All Home Directories
index_allprinter=All Printers
index_printer=Printer
index_defaultprn=Default printer
index_printableto=Printable to
index_prneveryone=Printable to everyone
index_prnalluser=Printable to all known users
index_rwpublic=Read/write to everyone
index_readonly=Read only to $1<br>Read/write to all other known users
index_rwalluser=Read/write to all known users
index_roeveryone=Read only to everyone
index_readwrite=Read/write to $1<br>Read only to all other known users
index_roalluser=Read only to all known users
index_noshares=No Samba shares defined
index_createfileshare=Create a new file share
index_createprnshare=Create a new printer share
index_createcopy=Create a new copy
index_view=View all connections
index_start=Start Samba Servers
index_startmsg=The Samba servers do not appear to be running on your system. This means that the shares listed above will not be accessible to other computers.
index_restart=Restart Samba Servers
index_restartmsg=Click this button to restart the running Samba servers on your system. This will force the current configuration to be applied.
index_restartmsg2=This will also disconnect any connections to the server, so if you do not want the current configuration to be applied immediately you should just wait 1 minute until Samba reloads the configuration automatically.
config_mins=Mins
config_secs=Secs
config_bytes=Bytes
config_never=Never
config_all=All
config_neither=Neither
global_title=Global Configuration
global_unixnetwork=Unix Networking
global_winnetwork=Windows Networking
global_auth=Authentication
global_printing=Windows to Unix Printing
global_misc=Miscellaneous Options
global_filedefault=File Share Defaults
global_prndefault=Printer Share Defaults
global_password=Encrypted Passwords
global_edit=Edit Samba users and passwords
global_convert=Convert Unix users to Samba users
global_sync=Configure automatic Unix and Samba user synchronisation
error_nosamba=The Samba server executable <tt>$1</tt> was not found. Either Samba is not installed on your system or your <a href="$2">module configuration</a> is incorrect.
error_version=Webmin failed to get the version of your Samba server executable <tt>$1</tt>. Check your <a href="$2">module configuration</a> to make sure this is the correct path.
error_config=The configuration file $1 was not found. Most likely Samba is not installed on your system, or your <a href="$2">module configuration</a> is incorrect.
error_include=Webmin cannot handle Samba config files that use the <tt>config</tt> or <tt>include</tt> directives.
error_delshare=Failed to delete share
error_delcopy=The share '$1' copies from this share
error_savename=Failed to save file naming
convert_title=Convert Users
convert_msg=This form allows you to synchronize the Unix and Samba user list. When Samba is using <a href=$1>encrypted passwords</a>, a separate list of users and passwords is used instead of the system user list.
convert_noconv=Don't convert or remove these users:
convert_update=Update existing Samba users from their Unix details
convert_add=Add new Samba users from the Unix user list
convert_delete=Delete Samba users who do not exist under Unix
convert_newuser=For newly created users, set the password to:
convert_nopasswd=No password
convert_lock=Account locked
convert_passwd=Use this password
convert_convert=Convert Users
misc_title=Miscellaneous Options
misc_debug=Debug Level
misc_cachecall=Cache <tt>getwd()</tt> calls?
misc_lockdir=Lock directory
misc_log=Log file
misc_maxlog=Max log size
misc_rawread=Allow raw reads?
misc_rawwrite=Allow raw writes?
misc_overlapread=Overlapping read size
misc_chroot=<tt>chroot()</tt> directory
misc_smbrun=Path to <tt>smbrun</tt>
misc_clienttime=Client time offset
misc_readprediction=Read prediction?
net_title=Unix Networking Options
net_idle=Idle time before disconnect
net_trustlist=Trusted hosts/users file
net_netinterface=Network interfaces
net_auto=Automatic
net_uselist=Use list...
net_interface=Interface
net_netmask=Netmask
net_keepalive=Keepalive packets
net_notsend=Don't send any
net_every=Send every
net_maxpacket=Maximum packet size
net_listen=Listen on address
net_socket=Socket options
passwd_title=Password Options
passwd_encrypt=Use encrypted passwords?
passwd_allownull=Allow null passwords?
passwd_program=Password program
passwd_case=Password case difference
passwd_sync=Change Unix password as well?
passwd_chat=Change password chat
passwd_below=Listed below:
passwd_waitfor=Wait for
passwd_send=Send
passwd_map=Username mapping
passwd_unixuser=Unix Users
passwd_winuser=Windows Users
print_title=Printing Options
print_style=Unix print style
print_show=Show all printers?
print_printcap=Printcap file
print_cachetime=Printer status cache time
smb_title=Windows Networking Options
smb_workgroup=Workgroup
smb_wins=WINS mode
smb_winsserver=Be WINS server
smb_useserver=Use server
smb_description=Server description
smb_name=Server name
smb_aliase=Server aliases
smb_default=Default service
smb_show=Always show services
smb_disksize=Max reported disk size
smb_unlimited=Unlimited
smb_winpopup=Winpopup command
smb_priority=Master browser priority
smb_protocol=Highest protocol
smb_master=Master browser?
smb_security=Security
smb_sharelevel=Share level
smb_userlevel=User level
smb_passwdserver=Password server
smb_domain=Domain
smb_announce=Remote announce to
smb_nowhere=Nowhere
smb_fromlist=From list...
smb_ip=IP Address
smb_asworkgroup=<b>As Workgroup</b> (optional)
create_title=Create Copy
create_msg=A copy share will inherit all its default values from the share you choose. If the source share is changed, so will the copy.
create_from=Share to copy from:
create_name=New share name:
smbuser_title=Samba Users
smbuser_list=Samba User List
smbuser_nouser=No Samba users defined
euser_title=Edit Samba User
euser_name=Username
euser_uid=Unix UID
euser_passwd=Password
euser_noaccess=No access
euser_nopw=No password
euser_currpw=Current password
euser_newpw=New password
euser_realname=Real name
euser_homedir=Home directory
euser_shell=Shell
euser_option=User options
euser_normal=Normal user
euser_nopwrequired=No password required
euser_disable=Account disabled
euser_trust=Workstation trust account
fmisc_title=Miscellaneous File Defaults
fmisc_for=For share <tt>$1</tt>
fmisc_lockfile=Do file locking?
fmisc_maxconn=Max connections
fmisc_fake=Fake oplocks?
fmisc_oplocks=Enable oplocks?
fmisc_level2=Read-only oplocks?
fmisc_sharemode=Use share modes?
fmisc_strict=Strict locking?
fmisc_sync=Sync after writes?
fmisc_volume=Volume name
fmisc_sameas=Same as share
fmisc_unixdos=Unix-DOS file name map
fmisc_conncmd=Command to run on connect
fmisc_disconncmd=Command to run on disconnect
fmisc_rootconn=Command to run on connect <i>as root</i>
fmisc_rootdisconn=Command to run on disconnect <i>as root</i>
fname_title1=File Naming Defaults
fname_title2=Edit File Naming
fname_option=File Naming Options
fname_manglecase=Mangle Case?
fname_case=Case Sensitive?
fname_defaultcase=Default Case?
fname_lower=Lower
fname_upper=Upper
fname_preserve=Preserve Case?
fname_shortpreserve=Short Preserve Case?
fname_hide=Hide dot files?
fname_archive=Save DOS archive flag?
fname_hidden=Save DOS hidden flag?
fname_system=Save DOS system flag?
fperm_title1=File Permissions Defaults
fperm_title2=Edit File Permissions
fperm_option=File Permission Options
fperm_filemode=New Unix file mode
fperm_dirmode=New Unix directory mode
fperm_notlist=Directories not to list
fperm_forceuser=Force Unix user
fperm_forcegrp=Force Unix group
fperm_link=Allow symlinks outside share?
fperm_delro=Can delete readonly files?
fperm_forcefile=Force Unix file mode
fperm_forcedir=Force Unix directory mode
share_title1=File Share Defaults
share_title2=Edit File Share
share_title3=Create File Share
share_info=Share Information
share_copy=This share is a copy of <i>$1</i>
share_name=Share name
share_home=Home Directories Share
share_dir=Directory to share
share_available=Available?
share_browseable=Browseable?
share_comment=Share Comment
share_view=View Connections
share_option=Other Share Options
share_security=Security and Access Control
share_permission=File Permissions
share_naming=File Naming
share_misc=Miscellaneous Options
share_samedesc1=Note - these settings also effect the defaults for all file shartes.
share_samedesc2=Note - these settings also effect the defaults for all printer shares.
print_title1=Printer Option Defaults
print_title2=Edit Printer Options
print_option=Printer Options
print_minspace=Minimum free space
print_postscript=Force postscript printing
print_command=Print command
print_queue=Display queue command
print_delete=Delete job command
print_pause=Pause job command
print_unresume=Unresume job command
print_driver=Printer Driver
pshare_title1=Printer Share Defaults
pshare_title2=Edit Printer Share
pshare_title3=Create Printer Share
pshare_info=Share Information
pshare_name=Share name
pshare_all=All Printers Share
pshare_unixprn=Unix Printer
pshare_spool=Spool directory
sec_index1=Security Defaults
sec_index2=Edit Security
sec_writable=Writable?
sec_guest=Guest Access?
sec_guestonly=Guest only
sec_guestaccount=Guest Unix user
sec_limit=Limit to possible list?
sec_allowhost=Hosts to allow
sec_onlyallow=Only allow
sec_denyhost=Hosts to deny
sec_onlydeny=Only deny
sec_revalidate=Revalidate users?
sec_validuser=Valid users
sec_validgroup=Valid groups
sec_invaliduser=Invalid users
sec_invalidgroup=Invalid groups
sec_possibleuser=Possible users
sec_possiblegroup=Possible groups
sec_rouser=Read only users
sec_rogroup=Read only groups
sec_rwuser=Read/write users
sec_rwgroup=Read/write groups
esync_title=User Synchronisation
esync_msg=Webmin can be configured so that changes to the Unix user list will automatically be applied to the Samba user list. This will only work when the <tt>Users and Groups</tt> Webmin module is used to add, delete or change users.
esync_add=Add a Samba user when a Unix user is added
esync_chg=Change the Samba user when a Unix user is changed
esync_del=Delete the Samba user when a Unix user is deleted
esync_apply=Apply
mkpass_title=Convert Users
mkpass_convfail=Failed to convert user
mkpass_msg=Converting Unix users...
mkpass_skip=being skipped
mkpass_same=is already the same
mkpass_update=being updated
mkpass_del=being deleted
mkpass_passfail=Failed to set password
savecopy_fail=Failed to create copy
savecopy_global=The name 'global' cannot be used for a share
savecopy_exist=A share called '$1' already exists
savecopy_ename=No share name entered
saveuser_fail=Failed to save user
saveuser_uid='$1' is not a valid Unix UID
saveuser_colon=Real name cannot contain the character :
saveuser_home=The home directory '$1' does not exist
saveuser_shell=$1 is not a valid shell
saveuser_pass=Failed to change password using smbpasswd : $1
savefmisc_fail=Failed to save miscellaneous options
savefmisc_number='$1' is not a valid number of connections
savefperm_fail=Failed to save file permissions
savefperm_mode='$1' is not a valid Unix file mode
savefshare_fail=Failed to save share
savefshare_nopath=No path given
savefshare_exist=A share called '$1' already exists
savefshare_mode='$1' is not a valid share name
savefshare_global=The name 'global' cannot be used for a share
savemisc_fail=Failed to save options
savemisc_lockdir=The directory containing the lock directory does not exist
savemisc_logdir=The directory containing the log file does not exist
savemisc_logsize='$1' is not a valid log size
savemisc_overlap='$1' is not a valid overlapping read size
savemisc_chroot=The chroot directory '$1' does not exist
savemisc_smbrun=The smbrun program '$1' does not exist or is not executable
savemisc_time='$1' is not a valid time offset
savenet_fail=Failed to save options
savenet_timeout='$1' is not a valid disconnect timeout
savenet_ip='$1' is not a valid IP byte
savenet_keep='$1' is not a valid keepalive interval
savenet_maxxmit='$1' is not a valid maximum packet size
savepass_fail=Failed to save options
savepass_nopass=Your version of Samba does not support encrypted passwords
savepass_passwd=No password changing program given
savepass_level='$1' is not a valid password case difference
savepass_chat=The change password chat sequence is empty
savepopts_fail=Failed to save printer options
savepopts_number=Minimum free space must be a number
saveprint_fail=Failed to save options
saveprint_printcap=The printcap file '$1' does not exist
saveprint_cache='$1' is not a valid cache time
savepshare_fail=Failed to save printer share
savepshare_exist=A share called '$1' already exists
savepshare_name='$1' is not a valid share name
savepshare_global=The name 'global' cannot be used for a share
savesec_fail=Failed to save security
savesmb_fail=Failed to save options
savesmb_size='$1' is not a valid disk size
savesmb_oslevel='$1' is not a valid master browser priority
savesmb_server=You must enter a password server
start_err=Failed to start Samba servers
start_fail=$1 failed
swats_fail=Failed to save username
swats_user=Missing SWAT username
viewu_index=Current Users
viewu_list=Current users of $1
viewu_share=Share
viewu_user=User
viewu_group=Group
viewu_from=Connected from
viewu_time=Connected at
viewu_pid=Process ID
viewu_msg1=Click on a process ID from the list above to disconnect that user.
viewu_msg2=There are no currently connected users
viewu_locks=Open files
viewu_none=None
log_apply=Restarted Samba servers
log_start=Started Samba servers
log_save_fshare=Modified file share $1
log_save_pshare=Modified printer share $1
log_save_sec=Modified security and access control for share $1
log_save_fperm=Modified file permissions for share $1
log_save_fname=Modified file naming for share $1
log_save_fmisc=Modified miscellaneous options for share $1
log_save_popts=Modified printer options for share $1
log_default_fshare=Changed file share defaults
log_default_pshare=Changed printer share defaults
log_kill=Disconnected process $1
log_skill=Disconnected process $1 from share $2
log_create_fshare=Created file share $1
log_create_pshare=Created printer share $1
log_delete_fshare=Deleted file share $1
log_delete_pshare=Deleted printer share $1
log_net=Changed Unix networking options
log_smb=Changed Windows networking options
log_pass=Changed authentication options
log_print=Changed Windows to Unix printing options
log_misc=Changed miscellaneous options
log_sync=Configured Unix user synchronisation
log_epass=Converted Unix users to Samba users
log_epass_l=Converted Unix users to Samba users ($1 created, $2 modified, $3 deleted)
log_copy=Copied share $2 to $1
log_save_euser=Modified Samba user $1
log_delete_euser=Deleted Samba user $1
swat_title=SWAT Login
swat_list=SWAT Login
swat_msg1=Your current SWAT username and password are incorrect. Use the form below to login again.
swat_msg2=A username and password are required to login to SWAT. This can normally be any user on your system.
swat_msg3=You cannot run SWAT through Webmin, as your Samba configuration has the <tt>$1:...</tt> (allow hosts) option set.
swat_msg4=However, you may be able to connect to SWAT directly at $1
swat_username=Username
swat_password=Password
swat_login=Login
swat_clear=Clear
swat_logout=Logout of SWAT
eacl_aviol=Access control violation
eacl_np=You have not permissions to
eacl_papply=restart this service
eacl_pcn=edit unix networking options
eacl_pcs=edit smb networking options
eacl_pcp=edit password options
eacl_pcprint=edit printing options
eacl_pcm=edit misc options
eacl_pcswat=use SWAT
eacl_pcopy=copy shares
eacl_pconn_all=view all connections
eacl_pconn=view connections for this share
eacl_pgkill=kill connections
eacl_pkill=kill this connection
eacl_pus=update share
eacl_pcrs=create share
eacl_pds=delete share
eacl_pusec=update security and access control options for this share
eacl_pufperm=update file permission options for this share
eacl_pufname=update file naming options for this share
eacl_pufmisc=update misc. options for this share
eacl_pupopt=update printer options for this share
eacl_pmpass=initialize SAMBA users database
eacl_pmsync=maintain UNIX-SAMBA users synchronization
eacl_pmusers=maintain SAMBA users
eacl_pvusers=access SAMBA users
eacl_pvfmisc=access misc. options for this share
eacl_pvfname=access file naming options for this share
eacl_pvperm=access file permission options for this share
eacl_pvsec=access security and access control options for this share
eacl_pvpopt=access printer options for this share
eacl_pafs=access this file share
eacl_paps=access this printer share
eacl_pcps=create printer share
eacl_pcfs=create file share
acl_apply=Can apply changes?
acl_view_all_con=Can view all connections?
acl_kill_con=Can remove connections?
acl_conf_net=Can configure UNIX network options?
acl_conf_smb=Can configure Windows network options?
acl_conf_pass=Can configure authentication options?
acl_conf_print=Can configure printers options?
acl_conf_misc=Can configure misc. options?
acl_swat=Can use SWAT?
acl_enc_passwd_opts=Encripted password options.
acl_view_users=Can view SAMBA users database?
acl_maint_users=Can edit SAMBA users?
acl_maint_makepass=Can convert UNIX users to SAMBA users?
acl_maint_sync=Can maintain auto UNIX to SAMBA users sync?
acl_hide=Hide inaccessible objects?
acl_c=create
acl_r=read
acl_w=write
acl_afs=Access file shares
acl_aps=Access print shares
acl_copy=Can copy shares?
acl_per_fs_acls=Enable per-file_share acls?
acl_per_ps_acls=Enable per-print_share acls?
acl_per_share_acls=Per-share ACLs...
acl_ernow=If you want to enable write access in global ACLs for some object type you must also enable read access for this object type.
acl_sname=Share name
acl_saccess=Access share
acl_sconn=Connections
acl_sopthdr=Share options
acl_ssec=security
acl_sperm=permissions
acl_snaming=file naming
acl_smisc=miscellanious
acl_sprn=or printer
acl_na=n/a
acl_r1=read only
acl_rw=read write
acl_view=view
acl_kill=kill
acl_edit=edit

View File

@@ -21,8 +21,7 @@ if (@groups) {
$text{'groups_sid'} ]);
foreach $g (@groups) {
print &ui_columns_row([
"<a href='edit_group.cgi?idx=$g->{'index'}'>".
&html_escape($g->{'name'})."</a>",
&ui_link("edit_group.cgi?idx=$g->{'index'}",&html_escape($g->{'name'})),
$g->{'unix'} == -1 ? $text{'groups_nounix'} :
"<tt>".&html_escape($g->{'unix'})."</tt>",
$text{'groups_type_'.$g->{'type'}} ||

View File

@@ -1,612 +0,0 @@
# samba-lib.pl
# Common functions for editing the samba config file
do '../web-lib.pl';
&init_config();
# Get the samba version
if (open(VERSION, "$module_config_directory/version")) {
chop($samba_version = <VERSION>);
close(VERSION);
}
# list_shares()
# List all the shares from the samba config file
sub list_shares
{
local(@rv, $_);
open(SAMBA, $config{smb_conf});
while(<SAMBA>) {
chop; s/;.*$//g; s/^\s*#.*$//g;
if (/^\s*\[([^\]]+)\]/) {
push(@rv, $1);
}
}
close(SAMBA);
return @rv;
}
# get_share(share, [array])
# Fills the associative array %share with the parameters from the given share
sub get_share
{
local($found, $_, $first, $arr);
$arr = (@_==2 ? $_[1] : "share");
undef(%$arr);
open(SAMBA, $config{smb_conf});
while(<SAMBA>) {
chop; s/^\s*;.*$//g; s/^\s*#.*$//g;
if (/^\s*\[([^\]]+)\]/) {
# Start of share section
$first = 1;
if ($found) { last; }
elsif ($1 eq $_[0]) { $found = 1; $$arr{share_name} = $1; }
}
elsif ($found && /^\s*([^=]*\S)\s*=\s*(.*)$/) {
# Directives inside a section
if (lc($1) eq "read only") {
# bastard special case.. change to writable
$$arr{'writable'} = $2 =~ /yes|true|1/i ? "no" : "yes";
}
else { $$arr{lc($1)} = $2; }
}
elsif (!$first && /^\s*([^=]*\S)\s*=\s*(.*)$/ && $_[0] eq "global") {
# Directives outside a section! Assume to be part of [global]
$$arr{share_name} = "global";
$$arr{lc($1)} = $2;
$found = 1;
}
}
close(SAMBA);
return $found;
}
# create_share(name)
# Add an entry to the config file
sub create_share
{
open(CONF, ">> $config{smb_conf}");
print CONF "\n";
print CONF "[$_[0]]\n";
foreach $k (grep {!/share_name/} (keys %share)) {
print CONF "\t$k = $share{$k}\n";
}
close(CONF);
}
# modify_share(oldname, newname)
# Change a share (and maybe it's name)
sub modify_share
{
local($_, @conf, $replacing, $first);
open(CONF, $config{smb_conf});
@conf = <CONF>;
close(CONF);
open(CONF, "> $config{smb_conf}");
for($i=0; $i<@conf; $i++) {
chop($_ = $conf[$i]); s/;.*$//g; s/#.*$//g;
if (/^\s*\[([^\]]+)\]/) {
$first = 1;
if ($replacing) { $replacing = 0; }
elsif ($1 eq $_[0]) {
print CONF "[$_[1]]\n";
foreach $k (grep {!/share_name/} (keys %share)) {
print CONF "\t$k = $share{$k}\n";
}
print CONF "\n";
$replacing = 1;
}
}
elsif (!$first && /^\s*([^=]*\S)\s*=\s*(.*)$/ && $_[0] eq "global") {
# found start of directives outside any share - assume [global]
$first = 1;
print CONF "[$_[1]]\n";
foreach $k (grep {!/share_name/} (keys %share)) {
print CONF "\t$k = $share{$k}\n";
}
print CONF "\n";
$replacing = 1;
}
if (!$replacing) { print CONF $conf[$i]; }
}
close(CONF);
}
# delete_share(share)
# Delete some share from the config file
sub delete_share
{
local($_, @conf, $deleting);
open(CONF, $config{smb_conf});
@conf = <CONF>;
close(CONF);
open(CONF, "> $config{smb_conf}");
for($i=0; $i<@conf; $i++) {
chop($_ = $conf[$i]); s/;.*$//g;
if (/^\s*\[([^\]]+)\]/) {
if ($deleting) { $deleting = 0; }
elsif ($1 eq $_[0]) {
print CONF "\n";
$deleting = 1;
}
}
if (!$deleting) { print CONF $conf[$i]; }
}
close(CONF);
}
# list_connections([share])
# Uses the smbstatus program to return a list of connections a share. Each
# element of the returned list is of the form:
# share, user, group, pid, hostname, date/time
sub list_connections
{
local($l, $started, @rv);
foreach $l (split(/\n/ , `$config{samba_status_program} -S`)) {
if ($l =~ /^----/) { $started = 1; }
if ($started && $l =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)\s+\(\S+\)\s+(.*)$/ && (!$_[0] || $1 eq $_[0] || $1 eq $2 && $_[0] eq "homes")) {
push(@rv, [ $1, $2, $3, $4, $5, $6 ]);
}
}
return @rv;
}
# list_locks()
# Returns a list of locked files as an array, in the form:
# pid, mode, rw, oplock, file, date
sub list_locks
{
local($l, $started, @rv);
foreach $l (split(/\n/ , `$config{samba_status_program} -L`)) {
if ($l =~ /^----/) { $started = 1; }
if ($started && $l =~ /^(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)/) {
push(@rv, [ $1, $2, $3, $4, $5, $6 ]);
}
}
return @rv;
}
# istrue(key)
# Checks if the value of this key (or it's synonyms) in %share is true
sub istrue
{
return &getval($_[0]) =~ /yes|true|1/i;
}
# isfalse(key)
# Checks if the value of this key (or it's synonyms) in %share is false
sub isfalse
{
return &getval($_[0]) =~ /no|false|0/i;
}
# getval(name)
# Given the name of a key in %share, return the value. Also looks for synonyms.
# If the value is not found, a default is looked for.. this can come from
# a copied section, the [global] configuration section, or from the SAMBA
# defaults. This means that getval() always returns something..
sub getval
{
local($_, $copy);
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
if (defined($share{$_})) { return $share{$_}; }
}
}
if (defined($share{$_[0]})) {
return $share{$_[0]};
}
elsif ($_[0] ne "copy" && ($copy = $share{"copy"})) {
# this share is a copy.. get the value from the source
local(%share);
&get_share($copy);
return &getval($_[0]);
}
else {
# return the default value...
return &default_value($_[0]);
}
return undef;
}
# setval(name, value, [default])
# Sets some value in %share. Synonyms with the same meaning are removed.
# If the value is the same as the share or given default, dont store it
sub setval
{
local($_);
if (@_ == 3) {
# default was given..
$def = $_[2];
}
elsif ($_[0] ne "copy" && ($copy = $share{"copy"})) {
# get value from copy source..
local(%share);
&get_share($copy);
$def = &getval($_[0]);
}
else {
# get global/samba default
$def = &default_value($_[0]);
}
if ($_[1] eq $def || ($def !~ /\S/ && $_[1] !~ /\S/) ||
($def =~ /^(true|yes|1)$/i && $_[1] =~ /^(true|yes|1)$/i) ||
($def =~ /^(false|no|0)$/i && $_[1] =~ /^(false|no|0)$/i)) {
# The value is the default.. delete this entry
&delval($_[0]);
}
else {
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
delete($share{$_});
}
}
$share{$_[0]} = $_[1];
}
}
# delval(name)
# Delete a value from %share (and it's synonyms)
sub delval
{
local($_);
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
delete($share{$_});
}
}
else { delete($share{$_[0]}); }
}
# default_value(name)
# Returns the default value for a parameter
sub default_value
{
local($_, %global);
# First look in the [global] section.. (unless this _is_ the global section)
if ($share{share_name} ne "global") {
&get_share("global", "global");
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
if (defined($global{$_})) { return $global{$_}; }
}
}
if (defined($global{$_[0]})) { return $global{$_[0]}; }
}
# Else look in the samba defaults
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
if (exists($default_values{$_})) {
return $default_values{$_};
}
}
}
return $default_values{$_[0]};
}
# The list of synonyms used by samba for parameter names
@synon = ( "writable,write ok,writeable",
"public,guest ok",
"printable,print ok",
"allow hosts,hosts allow",
"deny hosts,hosts deny",
"create mode,create mask",
"directory mode,directory mask",
"path,directory",
"exec,preexec",
"group,force group",
"only guest,guest only",
"user,username,users",
"default,default service",
"auto services,preload",
"lock directory,lock dir",
"max xmit,max packet",
"root directory,root dir,root",
"case sensitive,case sig names"
);
foreach $s (@synon) {
foreach $ss (split(/,/ , $s)) {
$synon{$ss} = $s;
}
}
# Default values for samba configuration parameters
%default_values = ( "allow hosts",undef,
"alternate permissions","no",
"available","yes",
"browseable","yes",
"comment",undef,
"create mode","755",
"directory mode","755",
"default case","lower",
"case sensitive","no",
"mangle case","no",
"preserve case","no",
"short preserve case","no",
"delete readonly","no",
"deny hosts",undef,
"dont descend",undef,
"force group",undef,
"force user",undef,
"force create mode","000",
"force directory mode","000",
"guest account","nobody", # depends
"guest only","no",
"hide dot files","yes",
"invalid users",undef,
"locking","yes",
"lppause command",undef, # depends
"lpq command",undef, # depends
"lpresume command",undef, # depends
"lprm command",undef, #depends
"magic output",undef, # odd..
"magic script",undef,
"mangled map",undef,
"mangled names","yes",
"mangling char","~",
"map archive","yes",
"map system","no",
"map hidden","no",
"max connections",0,
"only user","no",
"fake oplocks","no",
"min print space",0,
"path",undef,
"postscript","no",
"preexec",undef,
"print command",undef,
# "print command","lpr -r -P %p %s",
"printer",undef,
"printer driver",undef,
"public","no",
"read list",undef,
"revalidate","no",
"root preexec",undef,
"root postexec",undef,
"set directory","no",
"share modes","yes",
"strict locking","no",
"sync always","no",
"user",undef,
"valid chars",undef,
"volume",undef, # depends
"wide links","yes",
"wins support","no",
"writable","no",
"write list",undef );
# user_list(list)
# Convert a samba unix user list into a more readable form
sub user_list
{
local($u, @rv);
foreach $u (split(/[ \t,]+/ , $_[0])) {
if ($u =~ /^\@(.*)$/) {
push(@rv, "group <tt>".&html_escape($1)."</tt>");
}
else {
push(@rv, "<tt>".&html_escape($u)."</tt>");
}
}
return join("," , @rv);
}
# yesno_input(name)
# Returns HTML for a true/false option
sub yesno_input
{
($n = $_[0]) =~ s/ /_/g;
return sprintf "<input type=radio name=$n value=yes %s> $text{'yes'}\n".
"<input type=radio name=$n value=no %s> $text{'no'}\n",
&istrue($_[0]) ? "checked" : "",
&isfalse($_[0]) ? "checked" : "";
}
# username_input(name)
# Outputs HTML for an username field
sub username_input
{
($n = $_[0]) =~ s/ /_/g;
$v = &getval($_[0]);
print "<td><input name=$n size=8 value=\"$v\"> ",
&user_chooser_button($n, 0),"</td>\n";
}
# username_input(name, default)
sub groupname_input
{
($n = $_[0]) =~ s/ /_/g;
$v = &getval($_[0]);
print "<td><input name=$n size=8 value=\"$v\"> ",
&group_chooser_button($n, 0),"</td>\n";
}
@sock_opts = ("SO_KEEPALIVE", "SO_REUSEADDR", "SO_BROADCAST", "TCP_NODELAY",
"IPTOS_LOWDELAY", "IPTOS_THROUGHPUT", "SO_SNDBUF*", "SO_RCVBUF*",
"SO_SNDLOWAT*", "SO_RCVLOWAT*");
@protocols = ("CORE", "COREPLUS", "LANMAN1", "LANMAN2", "NT1");
# list_users()
# Returns an array of all the users from the samba password file
sub list_users
{
local(@rv, @b, $_, $lnum);
open(PASS, $config{'smb_passwd'});
while(<PASS>) {
$lnum++;
chop;
s/#.*$//g;
local @b = split(/:/, $_);
next if (@b < 4);
local $u = { 'name' => $b[0], 'uid' => $b[1],
'pass1' => $b[2], 'pass2' => $b[3] };
if ($samba_version >= 2 && $b[4] =~ /^\[/) {
$b[4] =~ s/[\[\] ]//g;
$u->{'opts'} = [ split(//, $b[4]) ];
$u->{'change'} = $b[5];
}
else {
$u->{'real'} = $b[4];
$u->{'home'} = $b[5];
$u->{'shell'} = $b[6];
}
$u->{'index'} = scalar(@rv);
$u->{'line'} = $lnum-1;
push(@rv, $u);
}
close(PASS);
return @rv;
}
# create_user(&user)
# Add a user to the samba password file
sub create_user
{
open(PASS, ">>$config{'smb_passwd'}");
print PASS &user_string($_[0]);
close(PASS);
chown(0, 0, $config{'smb_passwd'});
chmod(0600, $config{'smb_passwd'});
}
# modify_user(&user)
# Change an existing samba user
sub modify_user
{
&replace_file_line($config{'smb_passwd'}, $_[0]->{'line'}, &user_string($_[0]));
}
# delete_user(&user)
# Delete a samba user
sub delete_user
{
&replace_file_line($config{'smb_passwd'}, $_[0]->{'line'});
}
sub user_string
{
local @u = ($_[0]->{'name'}, $_[0]->{'uid'},
$_[0]->{'pass1'}, $_[0]->{'pass2'});
if ($_[0]->{'opts'}) {
push(@u, sprintf "[%-11s]", join("", @{$_[0]->{'opts'}}));
push(@u, sprintf "LCT-%X", time());
}
else {
push(@u, $_[0]->{'real'}, $_[0]->{'home'}, $_[0]->{'shell'});
}
return join(":", @u).":\n";
}
# set_password(user, password)
# Changes the password of a user in the encrypted password file
sub set_password
{
local($out);
$out = `$config{'samba_password_program'} "$_[0]" "$_[1]" 2>&1 </dev/null`;
return $out =~ /changed/;
}
# is_samba_running()
# Returns 0 if not, 1 if it is, or 2 if run from (x)inetd
sub is_samba_running
{
local ($found_inet, @smbpids, @nmbpids);
if (&foreign_check("inetd")) {
&foreign_require("inetd", "inetd-lib.pl");
foreach $inet (&foreign_call("inetd", "list_inets")) {
$found_inet++ if (($inet->[8] =~ /smbd/ ||
$inet->[9] =~ /smbd/) && $inet->[1]);
}
}
elsif (&foreign_check("xinetd")) {
&foreign_require("xinetd", "xinetd-lib.pl");
foreach $xi (&foreign_call("xinetd", "get_xinetd_config")) {
local $q = $xi->{'quick'};
$found_inet++ if ($q->{'disable'}->[0] ne 'yes' &&
$q->{'server'}->[0] =~ /smbd/);
}
}
@smbpids = &find_byname("smbd");
@nmbpids = &find_byname("nmbd");
return !$found_inet && !@smbpids && !@nmbpids ? 0 :
!$found_inet ? 1 : 2;
}
# can($permissions_string, \%access, [$sname])
# check global and per-share permissions:
#
# $permissions_string = any exists permissions except 'c' (creation).
# \%access = ref on what get_module_acl() returns.
sub can
{
local ($acl, $stype, @perm);
local ($perm, $acc, $sname) = @_;
@perm = split(//, $perm);
$sname = $in{'old_name'} || $in{'share'} unless $sname;
{ local %share;
&get_share($sname); # use local %share
$stype = &istrue('printable') ? 'ps' : 'fs';
}
# check global acl (r,w)
foreach (@perm) {
next if ($_ ne 'r') && ($_ ne 'w');
return 0 unless $acc->{$_ . '_' . $stype};
}
# check per-share acl
if ($acc->{'per_' . $stype . '_acls'}) {
$acl = $acc->{'ACL' . $stype . '_' . $sname};
foreach (@perm) {
# next if $_ eq 'c'; # skip creation perms for per-share acls
return 0 if index($acl, $_) == -1;
}
}
return 1;
}
# save_samba_acl($permissions_string, \%access, $share_name)
sub save_samba_acl
{
local ($p, $a, $s)=@_;
defined(%share) || &get_share($s); # use global %share
local $t=&istrue('printable') ? 'ps' : 'fs';
$a->{'ACL'. $t .'_'. $s} = $p;
#undef($can_cache);
return &save_module_acl($a);
}
# drop_samba_acl(\%access, $share_name)
sub drop_samba_acl
{
local ($a, $s)=@_;
defined(%share) || &get_share($s); # use global %share
local $t=&istrue('printable') ? 'ps' : 'fs';
delete($a->{'ACL'. $t .'_' . $s});
#undef($can_cache);
return &save_module_acl($a);
}
1;

View File

@@ -35,8 +35,7 @@ else {
}
@locks = &list_locks();
@rightlinks = ( "<a href='view_users.cgi?$in'>".
$text{'viewu_refresh'}."</a>" );
@rightlinks = ( &ui_link("view_users.cgi?$in",$text{'viewu_refresh'}) );
if (@cons) {
print &ui_form_start("kill_users.cgi");
print &ui_hidden("share", $in{'share'});

View File

@@ -25,7 +25,7 @@ $odir = &find_value("output_dir", $conf);
$odir ||= &find_value("output_dir", $conf, 1);
if ($rv && -r "$odir/index.html") {
print "<b>$text{'gen_done'}</b><p>\n";
print "<a href='view.cgi/index.html'>$text{'gen_view'}</a><p>\n";
print &ui_link("view.cgi/index.html","$text{'gen_view'}")."<p>\n";
}
elsif ($rv) {
print "<b>$text{'gen_nothing'}</b><p>\n";

View File

@@ -74,8 +74,7 @@ if (@accs) {
print &ui_links_row(\@links);
print &ui_form_end([ [ "delete", $text{'access_delete'} ] ]);
}
print "<a href='edit_file.cgi?mode=access'>",
&text('file_edit', "<tt>$afile</tt>"),"</a><p>\n"
print &ui_link("edit_file.cgi?mode=access",&text('file_edit', "<tt>$afile</tt>"))."<p>\n"
if ($access{'manual'});
print $text{'access_desc1'},"<p>\n";

View File

@@ -53,8 +53,7 @@ if (@doms) {
print &ui_links_row(\@links);
print &ui_form_end([ [ "delete", $text{'domains_delete'} ] ]);
}
print "<a href='edit_file.cgi?mode=domains'>",
&text('file_edit', "<tt>$dfile</tt>"),"</a><p>\n"
print &ui_link("edit_file.cgi?mode=domains",&text('file_edit', "<tt>$dfile</tt>"))<p>\n"
if ($access{'manual'});
print $text{'domains_desc'},"<p>\n";

View File

@@ -75,8 +75,7 @@ if (@gens) {
print &ui_form_end([ [ "delete", $text{'generics_delete'} ] ]);
}
if ($access{'omode'} == 1 && $access{'manual'}) {
print "<a href='edit_file.cgi?mode=generics'>",
&text('file_edit', "<tt>$gfile</tt>"),"</a><p>\n";
print &ui_link("edit_file.cgi?mode=generics",&text('file_edit', "<tt>$gfile</tt>"))."<p>\n";
}
print $text{'generics_desc1'},"<p>\n";

View File

@@ -54,8 +54,7 @@ if (@mailers) {
print &ui_links_row(\@links);
print &ui_form_end([ [ "delete", $text{'mailers_delete'} ] ]);
}
print "<a href='edit_file.cgi?mode=mailers'>",
&text('file_edit', "<tt>$mfile</tt>"),"</a><p>\n"
print &ui_link("edit_file.cgi?mode=mailers",&text('file_edit', "<tt>$mfile</tt>"))."<p>\n"
if ($access{'manual'});
print $text{'mailers_desc1'},"<p>\n";
print &text('mailers_desc2', 'list_cws.cgi')," ",

View File

@@ -81,8 +81,7 @@ if (@virts) {
}
if ($access{'vmode'} == 1 && $access{'vedit_0'} && $access{'vedit_1'} &&
$access{'vedit_2'} && $access{'vmax'} == 0 && $access{'manual'}) {
print "<a href='edit_file.cgi?mode=virtusers'>",
&text('file_edit', "<tt>$vfile</tt>"),"</a><p>\n";
print &ui_link("edit_file.cgi?mode=virtusers",&text('file_edit', "<tt>$vfile</tt>"))."<p>\n";
}
print &text('virtusers_desc1', 'list_aliases.cgi'),"<p>\n"

View File

@@ -114,7 +114,7 @@ if (@attach) {
}
else {
print &ui_columns_row([
"<a href='qdetach.cgi/$a->{'filename'}?file=$qfile&attach=$a->{'idx'}$subs'>$a->{'filename'}</a>",
&ui_link("qdetach.cgi/$a->{'filename'}?file=$qfile&attach=$a->{'idx'}$subs","$a->{'filename'}"),
$a->{'type'},
&nice_size(length($a->{'data'})),
]);

View File

@@ -1,35 +0,0 @@
index_title=NFS Exports
index_add=Add a new NFS export
index_dir=Directory
index_hosts=Allowed hosts
index_all=All hosts
index_none=No NFS exports have been defined yet.
index_apply=Apply Configuration
index_applydesc=Click this button to make all the exports listed above active, with their configured options.
index_return=exports list
edit_title1=Create Export
edit_title2=Edit Export
edit_header=Export details
edit_dir=Directory to export
edit_hosts=Export to hosts/netgroups
edit_ro=Read-only?
edit_wsync=Sync after writes?
edit_anon=Root user permissions
edit_anon1=Default (treat as <tt>nobody</tt>)
edit_anon2=Deny access
edit_anon0=Treat as user
edit_rw=Read-write access
edit_root=Root file access
edit_access=Mount access
edit_all=All hosts
edit_sel=Listed hosts..
edit_none=No hosts
save_err=Failed to save export
save_edir=Missing or non-existant directory to export
save_eanon=Missing or invalid root user
save_erw=No read-write hosts entered
save_eroot=No root file access hosts entered
save_eaccess=No mount access hosts entered

View File

@@ -31,11 +31,9 @@ else {
# Work out select/create links
@links = ( &select_all_link("d"),
&select_invert_link("d"),
"<a href='edit.cgi?table=$in{'table'}&new=1'>".
$text{$in{'tableclean'}."_add"}."</a>" );
&ui_link("edit.cgi?table=$in{'table'}&new=1","$text{$in{'tableclean'}."_add"}") );
if (&version_atleast(3, 3, 3) && &indexof($in{'table'}, @comment_tables) >= 0) {
push(@links, "<a href='editcmt.cgi?table=$in{'table'}&new=1'>".
$text{"comment_add"}."</a>");
push(@links, &ui_link("editcmt.cgi?table=$in{'table'}&new=1","$text{"comment_add"}"));
}
# Show the table
@@ -84,13 +82,13 @@ if (@table) {
$mover .= "<img src=images/gap.gif>";
}
else {
$mover .= "<a href='up.cgi?table=$in{'table'}&idx=$i'><img src=images/up.gif border=0></a>\n";
$mover .= &ui_link("up.cgi?table=$in{'table'}&idx=$i","<img src=images/up.gif border=0>")."\n";
}
if ($i == $#table) {
$mover .= "<img src=images/gap.gif>";
}
else {
$mover .= "<a href='down.cgi?table=$in{'table'}&idx=$i'><img src=images/down.gif border=0></a>\n";
$mover .= &ui_link("down.cgi?table=$in{'table'}&idx=$i","<img src=images/down.gif border=0>")."\n";
}
push(@cols, $mover);
}

View File

@@ -31,11 +31,9 @@ else {
# Work out select/create links
@links = ( &select_all_link("d"),
&select_invert_link("d"),
"<a href='edit.cgi?table=$in{'table'}&new=1'>".
$text{$in{'tableclean'}."_add"}."</a>" );
&ui_link("edit.cgi?table=$in{'table'}&new=1","$text{$in{'tableclean'}."_add"}") );
if (&version_atleast(3, 3, 3) && &indexof($in{'table'}, @comment_tables) >= 0) {
push(@links, "<a href='editcmt.cgi?table=$in{'table'}&new=1'>".
$text{"comment_add"}."</a>");
push(@links, &ui_link("editcmt.cgi?table=$in{'table'}&new=1","$text{"comment_add"}"));
}
# Show the table
@@ -84,13 +82,13 @@ if (@table) {
$mover .= "<img src=images/gap.gif>";
}
else {
$mover .= "<a href='up.cgi?table=$in{'table'}&idx=$i'><img src=images/up.gif border=0></a>\n";
$mover .= &ui_link("up.cgi?table=$in{'table'}&idx=$i","<img src=images/up.gif border=0>")."\n";
}
if ($i == $#table) {
$mover .= "<img src=images/gap.gif>";
}
else {
$mover .= "<a href='down.cgi?table=$in{'table'}&idx=$i'><img src=images/down.gif border=0></a>\n";
$mover .= &ui_link("down.cgi?table=$in{'table'}&idx=$i","<img src=images/down.gif border=0>")."\n";
}
push(@cols, $mover);
}

Some files were not shown because too many files have changed in this diff Show More