Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
esaracco committed Jun 7, 2019
1 parent 59ca85e commit 70d33ef
Show file tree
Hide file tree
Showing 72 changed files with 11,660 additions and 0 deletions.
1,356 changes: 1,356 additions & 0 deletions ChangeLog

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions acl_security.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright (C) 2003-2008
# Emmanuel Saracco <esaracco@users.labs.libre-entreprise.org>
# Easter-eggs <http://www.easter-eggs.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.

require 'clamav-lib.pl';

sub acl_security_form ( $ )
{
$o = $_[0];

print qq(<tr><td colspan="4" $tb><b>$text{"BACKUP_RESTORE"}</b></td></tr>);
&clamav_print_line ($text{'CONTROL'}, "backup_restore_manage", $o);

print qq(<tr><td colspan="4" $tb><b>ClamAV</b></td></tr>);
&clamav_print_line ($text{'START_STOP'}, "clamav_start_stop",$o);
&clamav_print_line ($text{'REMOTE_CONTROL'}, "clamav_remote_control",$o);

print qq(<tr><td colspan="4" $tb><b>$text{'QUARANTINE'}</b></td></tr>);
&clamav_print_line ($text{'VIEW'}, "quarantine_view",$o);
&clamav_print_line ($text{'DELETE'}, "quarantine_delete",$o);
&clamav_print_line ($text{'RESEND'}, "quarantine_resend",$o);
&clamav_print_line ($text{'EXPORT'}, "quarantine_export",$o);

print qq(<tr><td colspan="4" $tb><b>$text{'DATABASE_UPDATE'}</b></td></tr>);
&clamav_print_line ($text{'VIEW'}, "database_update_view",$o);
&clamav_print_line ($text{'UPDATE'}, "database_update_update",$o);

print qq(<tr><td colspan="4" $tb><b>$text{'DIRECTORIES_CHECK'}</b></td></tr>);
&clamav_print_line ($text{'CHECK'}, "directories_check_view",$o);
&clamav_print_line ($text{'DELETE'}, "directories_check_delete",$o);

print qq(<tr><td colspan="4" $tb><b>$text{'GLOBAL_SETTINGS'}</b></td></tr>);
&clamav_print_line ($text{'VIEW'}, "global_settings_view",$o);
&clamav_print_line ($text{'WRITE_DELETE'}, "global_settings_write",$o);

print qq(<tr><td colspan="4" $tb><b>$text{'LOGS_VIEWER'}</b></td></tr>);
&clamav_print_line ($text{'VIEW'}, "logs_viewer_view",$o);

print qq(<tr><td colspan="4" $tb><b>$text{'VIRUSES_SEARCH'}</b></td></tr>);
&clamav_print_line ($text{'SEARCH'}, "database_search_search",$o);

print qq(<tr><td colspan="4" $tb><b>$text{'SIGNATURES_EXTRACTION'}</b></td></tr>);
&clamav_print_line ($text{'USE'}, "signature_use",$o);
}

sub acl_security_save
{
foreach ((
'clamav_remote_control', 'clamav_start_stop', 'quarantine_view',
'quarantine_delete', 'quarantine_resend', 'quarantine_purge',
'quarantine_export', 'database_update_view', 'database_update_update',
'directories_check_view', 'directories_check_delete',
'global_settings_view', 'global_settings_write', 'logs_viewer_view',
'database_search_search', 'signature_use', 'backup_restore_manage'
)) {$_[0]->{$_} = $in{$_}}
}

sub clamav_print_line ( $ $ $ )
{
my ($title, $var, $o) = @_;

printf ("
<tr>
<td><b>$title</b></td>
<td nowrap><input type=radio name=$var value=1%s>&nbsp;Yes&nbsp;<input type=radio name=$var value=0%s>&nbsp;No</td>
<td colspan=2>&nbsp;</td>
</tr>
",
$o->{$var} == 1 ? ' checked' : '',
$o->{$var} == 0 ? ' checked' : '');
}
97 changes: 97 additions & 0 deletions backup_restore.cgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/perl

# Copyright (C) 2003-2015
# Emmanuel Saracco <esaracco@users.labs.libre-entreprise.org>
# Easter-eggs <http://www.easter-eggs.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.

require './clamav-lib.pl';
&clamav_check_acl ('backup_restore_manage');
&ReadParse ();

my $msg = "";
my $i = 0;
my @files = ();
my $restore_enabled = 0;

&header($text{'FORM_TITLE'}, "", undef, 1, 0);
print "<hr>\n";

&clamav_main_check_config ();
&clamav_check_perl_deps ();

if ($in{"init"})
{
&clamav_system_backup ();
$msg = qq(<b>$text{"MSG_SUCCESS_BACKUP"}</b>);
}
elsif ($in{"restore"})
{
while (my ($k, $v) = each (%in))
{
push (@files, $v) if ($k =~ /^file/);
}

&clamav_system_restore (\@files, 0);
$msg = qq(<b>$text{"MSG_SUCCESS_RESTORE"}</b>);
}

$restore_enabled = &clamav_system_ok ("restore");

print qq(<form method="POST" action="$scriptname">);

print qq(<h1>$text{"BACKUP_RESTORE_TITLE"}</h1>\n);

print qq(<b>$msg</b>) if ($msg);

printf qq(<p>$text{'BACKUP_RESTORE_DESCRIPTION'}</p>), $module_name;

print qq(<table width="80%" border=1>);
print qq(<tr><td valign="center" align="center" width="50%">);
printf qq(<input type="submit" name="init" value="$text{"BACKUP"}"%s></td>),
($restore_enabled) ? " disabled" : "";
if (!&clamav_first_backup ())
{
print qq(<td valign="top" align="right" width="50%">);
print "<table border=1>";
print qq(<tr $tb><th>$text{"FILE"}</th><th>$text{"RESTORE"}</th></tr>);
foreach my $path (keys %{&clamav_get_system_files ()})
{
my $checked = 1;
next if (! -f "$path");
next if (! &clamav_backup_item_exists ($path));

$checked = grep (/$path/, @files) if (@files);

print qq(<tr><td><code>$path</code></td>);
printf qq(<td><input type="checkbox" name="file%i" value="%s" %s%s></td></tr>), $i++, $path, " checked", " disabled";
# FIXME Must we let the user choose the files to restore?
#printf qq(<td><input type="checkbox" name="file%i" value="%s" %s%s></td></tr>), $i++, $path, ($checked) ? " checked" : "", ($restore_enabled) ? "" : " disabled";
}
print "</table>";
printf
qq(<input type="submit" name="restore" value="$text{'RESTORE'}"%s></td>),
($restore_enabled) ? "" : " disabled";
}
print qq(</tr></table>);

print qq(</form>);

print qq(<p>);

print qq(<hr>);
&footer("", $text{'RETURN_INDEX_MODULE'});
6 changes: 6 additions & 0 deletions bin/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

- amavis-inject: used only when it is not found on the webmin server.
- gunzip: used to bypass gunzip error when file is not gziped.
- purge_quarantine: used to delete quarantine directory content.

All those scripts must have the execute flag on.
Loading

0 comments on commit 70d33ef

Please sign in to comment.