mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
More work on new package system
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -52,8 +52,8 @@ else {
|
||||
print &ui_form_start("save_dump.cgi", "post");
|
||||
print &ui_hidden("id", $in{'id'}),"\n";
|
||||
print &ui_hidden("fs", $dump->{'fs'}),"\n";
|
||||
print &ui_table_start(&text('edit_header', uc($dump->{'fs'})),
|
||||
"width=100%", 2);
|
||||
print &ui_hidden_table_start(&text('edit_header', uc($dump->{'fs'})),
|
||||
"width=100%", 2, "source", 1);
|
||||
|
||||
print &ui_table_row($text{'dump_format'},
|
||||
$dump->{'fs'} eq 'tar' ? $text{'dump_tar'}
|
||||
@@ -76,9 +76,9 @@ else {
|
||||
}
|
||||
|
||||
&dump_form($dump, \@tds);
|
||||
print &ui_table_end();
|
||||
print &ui_hidden_table_end();
|
||||
|
||||
print &ui_table_start($text{'edit_header3'}, "width=100%", 4);
|
||||
print &ui_hidden_table_start($text{'edit_header3'}, "width=100%", 4, "opts", 0);
|
||||
if (defined(&dump_options_form)) {
|
||||
&dump_options_form($dump, \@tds);
|
||||
}
|
||||
@@ -112,9 +112,10 @@ if ($access{'cmds'}) {
|
||||
!$dump->{'afterfok'}),
|
||||
3, \@tds);
|
||||
}
|
||||
print &ui_table_end();
|
||||
print &ui_hidden_table_end();
|
||||
|
||||
print &ui_table_start($text{'edit_header2'}, "width=100%", 4);
|
||||
print &ui_hidden_table_start($text{'edit_header2'}, "width=100%", 4,
|
||||
"sched", 0);
|
||||
|
||||
# Show input for selecting when to run a dump, which can be never, on schedule
|
||||
# or after some other dump
|
||||
@@ -157,7 +158,7 @@ else {
|
||||
('hourly', 'daily', 'weekly', 'monthly', 'yearly') ]),
|
||||
3, \@tds);
|
||||
}
|
||||
print &ui_table_end();
|
||||
print &ui_hidden_table_end();
|
||||
|
||||
if ($in{'id'}) {
|
||||
print &ui_form_end([ [ "save", $text{'save'} ],
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/usr/local/bin/perl
|
||||
# fsdump-lib.pl
|
||||
# Common functions for doing filesystem backups with dump
|
||||
# XXX multi-volume tar restore
|
||||
|
||||
do '../web-lib.pl';
|
||||
BEGIN { push(@INC, ".."); };
|
||||
use WebminCore;
|
||||
#do '../web-lib.pl';
|
||||
#do '../ui-lib.pl';
|
||||
&init_config();
|
||||
do '../ui-lib.pl';
|
||||
if ($gconfig{'os_type'} =~ /^\S+\-linux$/) {
|
||||
do "linux-lib.pl";
|
||||
}
|
||||
@@ -241,6 +242,7 @@ local ($cmd, $fh, $fhmode, $pass) = @_;
|
||||
local ($cfh, $fpid) = &proc::pty_process_exec_logged($cmd);
|
||||
local ($wrong_password, $got_login, $connect_failed);
|
||||
local $out;
|
||||
$main::wait_for_debug = 1;
|
||||
while(1) {
|
||||
local $rv = &wait_for($cfh, "password:", "yes\\/no", "(^|\\n)\\s*Permission denied.*\n", "ssh: connect.*\n", ".*\n");
|
||||
if ($wait_for_input !~ /^\s*DUMP:\s+ACLs\s+in\s+inode/i) {
|
||||
|
||||
@@ -69,11 +69,11 @@ while(1) {
|
||||
}
|
||||
elsif ($line =~ /^W(\d+)/) {
|
||||
# Write to FTP server
|
||||
$len = $1;
|
||||
if ($opened != 1) {
|
||||
&open_ftp_file($mode);
|
||||
}
|
||||
#$opened || &error_exit("FTP connection not opened yet");
|
||||
$len = $1;
|
||||
read(STDIN, $buf, $len);
|
||||
$wrote = (print CON $buf);
|
||||
print "A".($wrote ? $len : 0)."\n";
|
||||
@@ -148,7 +148,7 @@ $pasv || &error_exit("FTP port failed : $err");
|
||||
$pasv =~ /\(([0-9,]+)\)/;
|
||||
local @n = split(/,/ , $1);
|
||||
&open_socket("$n[0].$n[1].$n[2].$n[3]", $n[4]*256 + $n[5],
|
||||
"CON", \$err) ||
|
||||
CON, \$err) ||
|
||||
&error_exit("FTP port failed : $err");
|
||||
|
||||
if ($mode == 0) {
|
||||
|
||||
@@ -2405,7 +2405,14 @@ parameters are :
|
||||
=cut
|
||||
sub open_socket
|
||||
{
|
||||
my ($addr, $h); $h = $_[2];
|
||||
|
||||
# Force file handle into caller's package
|
||||
my $h = $_[2];
|
||||
my $callpkg = (caller(0))[0];
|
||||
if ($callpkg ne __PACKAGE__ && __PACKAGE__ eq 'WebminCore') {
|
||||
$h = $callpkg."::".$h;
|
||||
}
|
||||
|
||||
if ($gconfig{'debug_what_net'}) {
|
||||
&webmin_debug_log('TCP', "host=$_[0] port=$_[1]");
|
||||
}
|
||||
@@ -2413,6 +2420,7 @@ if (!socket($h, PF_INET, SOCK_STREAM, getprotobyname("tcp"))) {
|
||||
if ($_[3]) { ${$_[3]} = "Failed to create socket : $!"; return 0; }
|
||||
else { &error("Failed to create socket : $!"); }
|
||||
}
|
||||
my $addr;
|
||||
if (!($addr = inet_aton($_[0]))) {
|
||||
if ($_[3]) { ${$_[3]} = "Failed to lookup IP address for $_[0]"; return 0; }
|
||||
else { &error("Failed to lookup IP address for $_[0]"); }
|
||||
@@ -2451,21 +2459,30 @@ for internal use by the ftp_download and ftp_upload functions.
|
||||
=cut
|
||||
sub ftp_command
|
||||
{
|
||||
my ($line, $rcode, $reply, $c);
|
||||
$what = $_[0] ne "" ? "<i>$_[0]</i>" : "initial connection";
|
||||
if ($_[0] ne "") {
|
||||
print SOCK "$_[0]\r\n";
|
||||
my ($cmd, $expect, $err, $fh) = @_;
|
||||
|
||||
# Work out file handle, and force into caller's package
|
||||
$fh ||= "SOCK";
|
||||
my $callpkg = (caller(0))[0];
|
||||
if ($callpkg ne __PACKAGE__ && __PACKAGE__ eq 'WebminCore') {
|
||||
$fh = $callpkg."::".$fh;
|
||||
}
|
||||
|
||||
my $line;
|
||||
my $what = $cmd ne "" ? "<i>$cmd/i>" : "initial connection";
|
||||
if ($cmd ne "") {
|
||||
print $fh "$cmd\r\n";
|
||||
}
|
||||
alarm(60);
|
||||
if (!($line = <SOCK>)) {
|
||||
if (!($line = <$fh>)) {
|
||||
alarm(0);
|
||||
if ($_[2]) { ${$_[2]} = "Failed to read reply to $what"; return undef; }
|
||||
if ($err) { $$err = "Failed to read reply to $what"; return undef; }
|
||||
else { &error("Failed to read reply to $what"); }
|
||||
}
|
||||
$line =~ /^(...)(.)(.*)$/;
|
||||
my $found = 0;
|
||||
if (ref($_[1])) {
|
||||
foreach $c (@{$_[1]}) {
|
||||
if (ref($expect)) {
|
||||
foreach my $c (@$expect) {
|
||||
$found++ if (int($1/100) == $c);
|
||||
}
|
||||
}
|
||||
@@ -2474,16 +2491,17 @@ else {
|
||||
}
|
||||
if (!$found) {
|
||||
alarm(0);
|
||||
if ($_[2]) { ${$_[2]} = "$what failed : $3"; return undef; }
|
||||
if ($err) { $$err = "$what failed : $3"; return undef; }
|
||||
else { &error("$what failed : $3"); }
|
||||
}
|
||||
$rcode = $1; $reply = $3;
|
||||
my $rcode = $1;
|
||||
my $reply = $3;
|
||||
if ($2 eq "-") {
|
||||
# Need to skip extra stuff..
|
||||
while(1) {
|
||||
if (!($line = <SOCK>)) {
|
||||
if (!($line = <$fh>)) {
|
||||
alarm(0);
|
||||
if ($_[2]) { ${$_[2]} = "Failed to read reply to $what";
|
||||
if ($$err) { $$err = "Failed to read reply to $what";
|
||||
return undef; }
|
||||
else { &error("Failed to read reply to $what"); }
|
||||
}
|
||||
@@ -7121,6 +7139,13 @@ if (@_ == 1) {
|
||||
else {
|
||||
# Actually opening
|
||||
my ($fh, $file, $noerror, $notemp, $safe) = @_;
|
||||
|
||||
# Force file handler into caller's package
|
||||
my $callpkg = (caller(0))[0];
|
||||
if ($callpkg ne __PACKAGE__ && __PACKAGE__ eq 'WebminCore') {
|
||||
$fh = $callpkg."::".$fh;
|
||||
}
|
||||
|
||||
my %gaccess = &get_module_acl(undef, "");
|
||||
my $db = $gconfig{'debug_what_write'};
|
||||
if ($file =~ /\r|\n|\0/) {
|
||||
@@ -7230,10 +7255,18 @@ successful. The handle must have been one passed to open_tempfile.
|
||||
sub close_tempfile
|
||||
{
|
||||
my $file;
|
||||
if (defined($file = $main::open_temphandles{$_[0]})) {
|
||||
|
||||
# Force file handle into caller's package
|
||||
my $fh = $_[0];
|
||||
my $callpkg = (caller(0))[0];
|
||||
if ($callpkg ne __PACKAGE__ && __PACKAGE__ eq 'WebminCore') {
|
||||
$fh = $callpkg."::".$fh;
|
||||
}
|
||||
|
||||
if (defined($file = $main::open_temphandles{$fh})) {
|
||||
# Closing a handle
|
||||
close($_[0]) || &error(&text("efileclose", $file, $!));
|
||||
delete($main::open_temphandles{$_[0]});
|
||||
close($fh) || &error(&text("efileclose", $file, $!));
|
||||
delete($main::open_temphandles{$fh});
|
||||
return &close_tempfile($file);
|
||||
}
|
||||
elsif (defined($main::open_tempfiles{$_[0]})) {
|
||||
@@ -7279,6 +7312,10 @@ only partially written.
|
||||
sub print_tempfile
|
||||
{
|
||||
my ($fh, @args) = @_;
|
||||
my $callpkg = (caller(0))[0];
|
||||
if ($callpkg ne __PACKAGE__ && __PACKAGE__ eq 'WebminCore') {
|
||||
$fh = $callpkg."::".$fh;
|
||||
}
|
||||
(print $fh @args) || &error(&text("efilewrite",
|
||||
$main::open_temphandles{$fh} || $fh, $!));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user