[ Avaa Bypassed ]




Upload:

Command:

www-data@3.133.149.165: ~ $
#!/usr/bin/perl
# rollback.cgi
# Revert all changed config files, after asking for confirmation

use strict;
use warnings;
no warnings 'redefine';
no warnings 'uninitialized';
require './webminlog-lib.pl';
our (%text, %in, %access);
&ReadParse();
my $act = &get_action($in{'id'});

if ($in{'annosave'}) {
	# Just saving an annotation
	$in{'anno'} =~ s/\r//g;
	&save_annotation($act, $in{'anno'});
	&redirect("view.cgi?id=$in{'id'}&search=".&urlize($in{'search'}));
	exit;
	}

$access{'rollback'} ||  &error($text{'rollback_ecannot'});
&can_user($act->{'user'}) || &error($text{'view_ecannot'});
&can_mod($act->{'module'}) || &error($text{'view_ecannot'});
my %r = map { $_, 1 } split(/\0/, $in{'r'});
%r || &error($text{'rollback_enone'});
my @files = grep { $r{$_->{'file'}} } &list_files($act);

&ui_print_header(undef, $text{'rollback_title'}, "");
if ($in{'confirm'}) {
	# Do it!
	my %done;
	foreach my $f (@files) {
		next if ($done{$f->{'file'}});
		if (-d $f->{'file'} || $f->{'type'} == 1) {
			# Skip directory
			print &text('rollback_skipdir',"<tt>$f->{'file'}</tt>");
			}
		elsif (-l $f->{'file'} && $f->{'type'} == 2 ||
		       !-e $f->{'file'} && $f->{'type'} == 2 ||
		       !-l $f->{'file'} && $f->{'type'} == 2) {
			# Modify or create link
			&lock_file($f->{'file'});
			&unlink_file($f->{'file'});
			&symlink_file($f->{'data'}, $f->{'file'});
			&unlock_file($f->{'file'});
			print &text('rollback_madelink',
				    "<tt>$f->{'file'}</tt>",
				    "<tt>$f->{'data'}</tt>");
			}
		elsif (-e $f->{'file'} && -l $f->{'file'} &&
		       $f->{'type'} == 0) {
			# Remove link and create file
			&lock_file($f->{'file'});
			&unlink_file($f->{'file'});
			my $fh;
			&open_tempfile($fh, ">$f->{'file'}");
			&print_tempfile($fh, $f->{'data'});
			&close_tempfile($fh);
			&unlock_file($f->{'file'});
			print &text('rollback_madefile',
				    "<tt>$f->{'file'}</tt>");
			}
		elsif ($f->{'type'} == -1) {
			if (-e $f->{'file'}) {
				# Remove file
				&unlink_logged($f->{'file'});
				print &text('rollback_deleted',
					    "<tt>$f->{'file'}</tt>");
				}
			else {
				print &text('rollback_nodeleted',
					    "<tt>$f->{'file'}</tt>");
				}
			}
		else {
			# Replace file with old contents
			my $fh;
			&open_lock_tempfile($fh, ">$f->{'file'}");
			&print_tempfile($fh, $f->{'data'});
			&close_tempfile($fh);
			print &text('rollback_modfile',
				    "<tt>$f->{'file'}</tt>");
			}
		print "<br>\n";
		$done{$f->{'file'}}++;
		}
	my %minfo = &get_module_info($act->{'module'});
	&webmin_log("rollback", undef, $in{'id'},
		    { 'desc' => &get_action_description($act),
		      'mdesc' => $minfo{'desc'} });
	}
else {
	# Show the user what will be done
	print &ui_form_start("rollback.cgi");
	print &ui_hidden("id", $in{'id'});
	print &ui_hidden("search", $in{'search'});
	foreach my $r (keys %r) {
		print &ui_hidden("r", $r);
		}
	print $text{'rollback_rusure'},"<p>\n";
	my %done;
	my $count = 0;
	foreach my $f (@files) {
		next if ($done{$f->{'file'}});
		print &ui_table_start("<tt>$f->{'file'}</tt>", "width=100%", 2);
		print "<tr> <td colspan=2>";
		if (-d $f->{'file'} || $f->{'type'} == 1) {
			# Is a directory
			print &text('rollback_isdir');
			}
		elsif (-l $f->{'file'} && $f->{'type'} == 2 ||
		       !-e $f->{'file'} && $f->{'type'} == 2) {
			# Was a link, and is one now
			my $lnk = readlink($f->{'file'});
			if (!-e $f->{'file'}) {
				print &text('rollback_clink', "<tt>$f->{'data'}</tt>");
				$count++;
				}
			elsif ($lnk ne $f->{'data'}) {
				print &text('rollback_link', "<tt>$f->{'data'}</tt>", "<tt>$lnk</tt>");
				$count++;
				}
			else {
				print &text('rollback_nolink');
				}
			}
		elsif (-e $f->{'file'} && -l $f->{'file'} &&
		       $f->{'type'} == 0) {
			# Was a file, but is now a link
			my $lnk = readlink($f->{'file'});
			print &text('rollback_makefile', "<tt>$lnk</tt>");
			print "<pre>$f->{'data'}</pre>";
			$count++;
			}
		elsif (!-l $f->{'file'} && $f->{'type'} == 2) {
			# Was a link, but is now a file
			print &text('rollback_makelink', "<tt>$f->{'data'}</tt>");
			$count++;
			}
		elsif ($f->{'type'} == -1) {
			# Was created
			if (-e $f->{'file'}) {
				print &text('rollback_delete',
					    "<tt>$f->{'file'}</tt>");
				$count++;
				}
			else {
				print &text('rollback_nodelete',
					    "<tt>$f->{'file'}</tt>");
				}
			}
		elsif (!-e $f->{'file'}) {
			# No longer exists
			print $text{'rollback_fillfile'};
			print "<pre>$f->{'data'}</pre>";
			$count++;
			}
		else {
			# Was a file, and is one now
			my $qnew = quotemeta($f->{'file'});
			my $temp = &transname();
			open(TEMP, ">$temp");
			print TEMP $f->{'data'};
			close(TEMP);
			my $out = &backquote_command("diff $qnew $temp");
			if ($out) {
				print $text{'rollback_changes'};
				print "<pre>$out</pre>";
				$count++;
				}
			else {
				print $text{'rollback_nochanges'};
				}
			}
		$done{$f->{'file'}}++;
		print "</td> </tr>\n";
		print &ui_table_end();
		print "<br>\n";
		}
	if ($count) {
		print &ui_form_end([ [ "confirm", $text{'rollback_ok'} ] ]);
		}
	else {
		print "<b>$text{'rollback_none'}</b>\n";
		print &ui_form_end();
		}
	}
&ui_print_footer("view.cgi?id=$in{'id'}&search=".&urlize($in{'search'}),
		  $text{'view_return'},
		 "", $text{'index_return'});



Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
CHANGELOG File 2.01 KB 0644
acl_security.pl File 1.49 KB 0755
config File 14 B 0644
config.info File 70 B 0644
config.info.ar File 88 B 0644
config.info.ca File 89 B 0644
config.info.cs File 85 B 0644
config.info.de File 71 B 0644
config.info.es File 92 B 0644
config.info.hr File 0 B 0644
config.info.hu File 95 B 0644
config.info.ja File 102 B 0644
config.info.ko File 93 B 0644
config.info.ms File 77 B 0644
config.info.nl File 86 B 0644
config.info.no File 65 B 0644
config.info.pl File 89 B 0644
config.info.ru File 128 B 0644
config.info.sk File 87 B 0644
config.info.tr File 89 B 0644
defaultacl File 35 B 0644
index.cgi File 5.29 KB 0755
log_parser.pl File 508 B 0755
module.info File 150 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 120 B 0644
module.info.ar File 137 B 0644
module.info.ar.auto File 18 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 192 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 214 B 0644
module.info.ca File 119 B 0644
module.info.ca.auto File 17 B 0644
module.info.cs File 38 B 0644
module.info.cs.auto File 85 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 118 B 0644
module.info.de File 96 B 0644
module.info.de.auto File 18 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 192 B 0644
module.info.es File 41 B 0644
module.info.es.auto File 94 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 124 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 185 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 123 B 0644
module.info.fr File 38 B 0644
module.info.fr.auto File 101 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 141 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 117 B 0644
module.info.hu File 23 B 0644
module.info.hu.auto File 115 B 0644
module.info.it File 31 B 0644
module.info.it.auto File 105 B 0644
module.info.ja File 151 B 0644
module.info.ko File 29 B 0644
module.info.ko.auto File 88 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 146 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 124 B 0644
module.info.ms File 86 B 0644
module.info.ms.auto File 18 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 129 B 0644
module.info.nl File 25 B 0644
module.info.nl.auto File 97 B 0644
module.info.no File 23 B 0644
module.info.no.auto File 87 B 0644
module.info.pl File 98 B 0644
module.info.pl.auto File 18 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 125 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 134 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 136 B 0644
module.info.ru File 45 B 0644
module.info.ru.auto File 135 B 0644
module.info.sk File 32 B 0644
module.info.sk.auto File 91 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 116 B 0644
module.info.sv File 24 B 0644
module.info.sv.auto File 96 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 222 B 0644
module.info.tr File 27 B 0644
module.info.tr.auto File 110 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 160 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 193 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 144 B 0644
module.info.zh File 28 B 0644
module.info.zh.auto File 73 B 0644
module.info.zh_TW File 30 B 0644
module.info.zh_TW.auto File 79 B 0644
negativeacl File 9 B 0644
rollback.cgi File 5.14 KB 0755
safeacl File 19 B 0644
save_notify.cgi File 1.04 KB 0755
search.cgi File 7.55 KB 0755
view.cgi File 5.35 KB 0755
webminlog-lib.pl File 10.48 KB 0755