[ Avaa Bypassed ]




Upload:

Command:

www-data@3.19.255.50: ~ $
# pap-lib.pl
# Functions for managing the mgetty configuration files

BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
%access = &get_module_acl();

do 'secrets-lib.pl';

# mgetty_inittabs()
# Returns a list of inittab entries for mgetty, with options parsed
sub mgetty_inittabs
{
local @rv;
foreach $i (&inittab::parse_inittab()) {
	if ($i->{'process'} =~ /^(\S*mgetty)\s*(.*)\s+((\/.*)?(tty|term|cua)\S+)(\s+(\S+))?$/) {
		$i->{'mgetty'} = $1;
		$i->{'args'} = $2;
		$i->{'tty'} = $3;
		$i->{'ttydefs'} = $7;
		if ($i->{'args'} =~ s/\s*-s\s+(\d+)//) {
			$i->{'speed'} = $1;
			}
		if ($i->{'args'} =~ s/\s*-r//) {
			$i->{'direct'} = 1;
			}
		if ($i->{'args'} =~ s/\s*-n\s+(\d+)//) {
			$i->{'rings'} = $1;
			}
		if ($i->{'args'} =~ s/\s*-D//) {
			$i->{'data'} = 1;
			}
		if ($i->{'args'} =~ s/\s*-F//) {
			$i->{'fax'} = 1;
			}
		if ($i->{'args'} =~ s/\s*-R\s+(\d+)//) {
			$i->{'back'} = $1;
			}
		if ($i->{'args'} =~ s/\s*-p\s+'([^']+)'// ||
		    $i->{'args'} =~ s/\s*-p\s+"([^"]+)"// ||
		    $i->{'args'} =~ s/\s*-p\s+(\S+)//) {
			$i->{'prompt'} = $1;
			}
		push(@rv, $i);
		}
	elsif ($i->{'process'} =~ /^(\S*vgetty)\s*(.*)\s+((\/.*)?tty\S+)/) {
		$i->{'vgetty'} = $1;
		$i->{'args'} = $2;
		$i->{'tty'} = $3;
		push(@rv, $i);
		}
	}
return @rv;
}

# parse_ppp_options(file)
sub parse_ppp_options
{
local @rv;
local $lnum = 0;
open(OPTS, "<".$_[0]);
while(<OPTS>) {
	s/\r|\n//g;
	s/#.*$//g;
	if (/^([0-9\.]+):([0-9\.]+)/) {
		push(@rv, { 'local' => $1,
			    'remote' => $2,
			    'file' => $_[0],
			    'line' => $lnum,
			    'index' => scalar(@rv) });
		}
	elsif (/^(\S+)\s*(.*)/) {
		push(@rv, { 'name' => $1,
			    'value' => $2,
			    'file' => $_[0],
			    'line' => $lnum,
			    'index' => scalar(@rv) });
		}
	$lnum++;
	}
close(OPTS);
return @rv;
}

# find(name, &config)
sub find
{
local @rv = grep { lc($_->{'name'}) eq lc($_[0]) } @{$_[1]};
return wantarray ? @rv : $rv[0];
}

# save_ppp_option(&config, file, &old|name, &new)
sub save_ppp_option
{
local $ol = ref($_[2]) || !defined($_[2]) ? $_[2] : &find($_[2], $_[0]);
local $nw = $_[3];
local $lref = &read_file_lines($_[1]);
local $line;
if ($nw) {
	if ($nw->{'local'}) {
		$line = $nw->{'local'}.":".$nw->{'remote'};
		}
	else {
		$line = $nw->{'name'};
		$line .= " $nw->{'value'}" if ($nw->{'value'} ne "");
		}
	}
if ($ol && $nw) {
	$lref->[$ol->{'line'}] = $line;
	}
elsif ($ol) {
	splice(@$lref, $ol->{'line'}, 1);
	local $c;
	foreach $c (@{$_[0]}) {
		$c->{'line'}-- if ($c->{'line'} > $ol->{'line'});
		}
	}
elsif ($nw) {
	push(@$lref, $line);
	}
}

# parse_login_config()
# Parses the mgetty login options file into a list of users
sub parse_login_config
{
local @rv;
local $lnum = 0;
open(LOGIN, "<".$config{'login_config'});
while(<LOGIN>) {
	s/\r|\n//g;
	s/#.*$//g;
	if (/^(\S+)\s+(\S+)\s+(\S+)\s+(.*)/) {
		push(@rv, { 'user' => $1,
			    'userid' => $2,
			    'utmp' => $3,
			    'program' => $4,
			    'line' => $lnum });
		}
	$lnum++;
	}
close(LOGIN);
return @rv;
}

# delete_login_config(&config, &login)
sub delete_login_config
{
local $lref = &read_file_lines($config{'login_config'});
splice(@$lref, $_[1]->{'line'}, 1);
}

# create_login_config(&config, &login)
sub create_login_config
{
local ($star) = grep { $_->{'user'} eq '*' } @{$_[0]};
local $line = join("\t", $_[1]->{'user'}, $_[1]->{'userid'},
			 $_[1]->{'utmp'}, $_[1]->{'program'});
local $lref = &read_file_lines($config{'login_config'});
if ($star) {
	splice(@$lref, $star->{'line'}, 0, $line);
	}
else {
	push(@$lref, $line);
	}
}

# parse_dialin_config()
# Parses the mgetty dialin file
sub parse_dialin_config
{
local @rv;
local $lnum = 0;
open(DIALIN, "<".$config{'dialin_config'});
while(<DIALIN>) {
	s/\r|\n//g;
	s/#.*$//g;
	s/^\s+//;
	local $t;
	foreach $t (split(/[ \t,]+/, $_)) {
		local ($not) = ($t =~ s/^\!//);
		push(@rv, { 'number' => $t,
			    'not' => $not,
			    'index' => scalar(@rv),
			    'line' => $lnum });
		}
	$lnum++;
	}
close(DIALIN);
return @rv;
}

# create_dialin(&dialin)
sub create_dialin
{
&open_tempfile(DIALIN, ">>$config{'dialin_config'}");
&print_tempfile(DIALIN, &dialin_line($_[0])."\n");
&close_tempfile(DIALIN);
}

# delete_dialin(&dialin, &config)
sub delete_dialin
{
local @same = grep { $_->{'line'} == $_[0]->{'line'} && $_ ne $_[0] }
		   @{$_[1]};
if (@same) {
	&replace_file_line($config{'dialin_config'}, $_[0]->{'line'},
			   join(" ", map { &dialin_line($_) } @same)."\n");
	}
else {
	&replace_file_line($config{'dialin_config'}, $_[0]->{'line'});
	}
}

# modify_dialin(&dialin, &config)
sub modify_dialin
{
local @same = grep { $_->{'line'} == $_[0]->{'line'} } @{$_[1]};
&replace_file_line($config{'dialin_config'}, $_[0]->{'line'},
		   join(" ", map { &dialin_line($_) } @same)."\n");
}

# swap_dialins(&dialin1, &dialin2, &config)
sub swap_dialins
{
local $lref = &read_file_lines($config{'dialin_config'});
local @same1 = grep { $_->{'line'} == $_[0]->{'line'} } @{$_[2]};
local @same2 = grep { $_->{'line'} == $_[1]->{'line'} } @{$_[2]};
local $idx1 = &indexof($_[0], @same1);
local $idx2 = &indexof($_[1], @same2);
if ($_[0]->{'line'} == $_[1]->{'line'}) {
	($same1[$idx1], $same1[$idx2]) = ($same1[$idx2], $same1[$idx1]);
	&replace_file_line($config{'dialin_config'}, $_[0]->{'line'},
			   join(" ", map { &dialin_line($_) } @same1)."\n");
	}
else {
	($same1[$idx1], $same2[$idx2]) = ($same2[$idx2], $same1[$idx1]);
	&replace_file_line($config{'dialin_config'}, $_[0]->{'line'},
			   join(" ", map { &dialin_line($_) } @same1)."\n");
	&replace_file_line($config{'dialin_config'}, $_[1]->{'line'},
			   join(" ", map { &dialin_line($_) } @same2)."\n");
	}
}

# dialin_line(&dialin)
sub dialin_line
{
return ($_[0]->{'not'} ? "!" : "").$_[0]->{'number'};
}

# apply_mgetty()
# Apply the current serial port and mgetty configuration, or return an
# error message
sub apply_mgetty
{
local %iconfig = &foreign_config("inittab");
local $out = &backquote_logged("$iconfig{'telinit'} q 2>&1 </dev/null");
if ($?) {
	return "<tt>$out</tt>";
	}
&kill_byname_logged("mgetty", 'TERM');
return undef;
}

1;


Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
CHANGELOG File 104 B 0644
acl_security.pl File 925 B 0755
backup_config.pl File 793 B 0755
config-cobalt-linux File 216 B 0644
config-coherent-linux File 216 B 0644
config-corel-linux File 216 B 0644
config-debian-linux File 216 B 0644
config-generic-linux File 216 B 0644
config-gentoo-linux File 216 B 0644
config-mandrake-linux File 216 B 0644
config-msc-linux File 216 B 0644
config-open-linux File 216 B 0644
config-openSUSE-Linux-15.0-ALL File 216 B 0644
config-openmamba-linux File 216 B 0644
config-pardus-linux File 216 B 0644
config-redhat-linux File 216 B 0644
config-slackware-linux File 216 B 0644
config-solaris File 263 B 0644
config-suse-linux File 216 B 0644
config-trustix-linux File 216 B 0644
config-turbo-linux File 216 B 0644
config-united-linux File 216 B 0644
config.info File 336 B 0644
config.info.ca File 406 B 0644
config.info.cs File 371 B 0644
config.info.de File 358 B 0644
config.info.es File 113 B 0644
config.info.fa File 475 B 0644
config.info.fr File 103 B 0644
config.info.nl File 348 B 0644
config.info.no File 339 B 0644
config.info.pl File 86 B 0644
config.info.ru File 383 B 0644
config.info.sv File 106 B 0644
config.info.tr File 108 B 0644
config.info.uk File 413 B 0644
config.info.zh File 92 B 0644
config.info.zh_TW File 92 B 0644
defaultacl File 65 B 0644
delete_secrets.cgi File 516 B 0755
edit_dialin.cgi File 1.84 KB 0755
edit_mgetty.cgi File 3.84 KB 0755
edit_options.cgi File 5.61 KB 0755
edit_secret.cgi File 3.31 KB 0755
index.cgi File 695 B 0755
install_check.pl File 336 B 0755
list_dialin.cgi File 1.77 KB 0755
list_mgetty.cgi File 2.39 KB 0755
list_secrets.cgi File 2.13 KB 0755
log_parser.pl File 947 B 0755
mgetty_apply.cgi File 294 B 0755
module.info File 378 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 96 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 128 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 156 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 133 B 0644
module.info.ca File 98 B 0644
module.info.ca.auto File 12 B 0644
module.info.cs File 26 B 0644
module.info.cs.auto File 69 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 106 B 0644
module.info.de File 91 B 0644
module.info.de.auto File 12 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 180 B 0644
module.info.es File 51 B 0644
module.info.es.auto File 93 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 111 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 149 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 114 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 118 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 116 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 112 B 0644
module.info.hu File 0 B 0644
module.info.hu.auto File 133 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 111 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 157 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 132 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 116 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 113 B 0644
module.info.ms File 98 B 0644
module.info.ms.auto File 12 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 98 B 0644
module.info.nl File 25 B 0644
module.info.nl.auto File 79 B 0644
module.info.no File 31 B 0644
module.info.no.auto File 76 B 0644
module.info.pl File 0 B 0644
module.info.pl.auto File 101 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 112 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 121 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 105 B 0644
module.info.ru File 25 B 0644
module.info.ru.auto File 98 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 95 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 98 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 96 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 221 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 104 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 195 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 112 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 106 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 115 B 0644
move.cgi File 565 B 0755
pap-lib.pl File 5.91 KB 0755
save_dialin.cgi File 1012 B 0755
save_mgetty.cgi File 2.51 KB 0755
save_options.cgi File 3.06 KB 0755
save_secret.cgi File 1.46 KB 0755
save_sync.cgi File 593 B 0755
secrets-lib.pl File 1.64 KB 0755
useradmin_update.pl File 1.44 KB 0755