Switch all calls to open() to explicitly open for read

This commit is contained in:
Jamie Cameron 2020-03-14 17:20:54 -07:00
parent 3093838b5b
commit a2dc3f7124
248 changed files with 548 additions and 552 deletions

View File

@ -12,7 +12,7 @@ sub get_config
{
local @rv;
local $lnum = 0;
open(FILE, $config{'pppoe_conf'}) || return undef;
open(FILE, "<".$config{'pppoe_conf'}) || return undef;
while(<FILE>) {
s/\r|\n//g;
s/^\s*#.*$//;

View File

@ -1599,7 +1599,7 @@ local @st = stat($errorlog);
my $start = time();
while(time() - $start < $timeout) {
sleep(1);
open(ERRORLOG, $errorlog);
open(ERRORLOG, "<".$errorlog);
seek(ERRORLOG, $st[7], 0);
local $/ = undef;
local $rest = <ERRORLOG>;
@ -1634,7 +1634,7 @@ elsif (-x $config{'apachectl_path'}) {
else {
# kill the process
$pidfile = &get_pid_file();
open(PID, $pidfile) || return &text('stop_epid', $pidfile);
open(PID, "<".$pidfile) || return &text('stop_epid', $pidfile);
<PID> =~ /(\d+)/ || return &text('stop_epid2', $pidfile);
close(PID);
&kill_logged('TERM', $1) || return &text('stop_esig', $1);

View File

@ -33,7 +33,7 @@ if ($in{'type'} == 6) {
print &ui_links_row(\@links);
print &ui_columns_start([ $text{'global_type'},
$text{'global_ext'} ]);
open(MIME, $mfile);
open(MIME, "<$mfile");
$line = 0;
while(<MIME>) {
chop;

View File

@ -7,7 +7,7 @@ require './apache-lib.pl';
$access{'global'}==1 || &error($text{'mime_ecannot'});
if (defined($in{'line'})) {
&ui_print_header(undef, $text{'mime_edit'}, "");
open(MIME, $in{'file'});
open(MIME, "<$in{'file'}");
for($i=0; $i<=$in{'line'}; $i++) {
$line = <MIME>;
}

View File

@ -34,7 +34,8 @@ foreach $v (&find_directive_struct("VirtualHost", $conf)) {
if ($in{'from'} == 0) {
# search under all directories
for($i=0; $i<@dirs; $i++) {
open(FIND, "find $dirs[$i] -name $files[$i] -print |");
open(FIND, "find ".quotemeta($dirs[$i]).
" -name ".quotemeta($files[$i])." -print |");
while(<FIND>) {
s/\r|\n//g;
push(@rv, $_);
@ -44,7 +45,9 @@ if ($in{'from'} == 0) {
}
else {
# search under the given directory only
foreach $f (&unique(@files)) { push(@args, "-name $f"); }
foreach $f (&unique(@files)) {
push(@args, "-name ".quotemeta($f));
}
$args = join(' -o ', @args);
open(FIND, "find ".quotemeta($in{'dir'})." $args -print |");
while(<FIND>) {

View File

@ -41,7 +41,7 @@ if (!$config{'httpd_conf'} && !(-e "$conf/httpd.conf") &&
opendir(CONF, $conf);
foreach $f (readdir(CONF)) {
if ($f =~ /^(.*)-dist$/) {
open(DIST, "$conf/$f");
open(DIST, "<$conf/$f");
@dist = <DIST>;
close(DIST);
&open_tempfile(REAL, ">$conf/$1");

View File

@ -12,7 +12,7 @@ if ($in{'type'} !~ /^(\S+)\/(\S+)$/) {
}
&lock_file($in{'file'});
open(MIME, $in{'file'});
open(MIME, "<$in{'file'}");
@mime = <MIME>;
close(MIME);
$line = "$in{'type'} ".join(" ", split(/\s+/, $in{'exts'}))."\n";

View File

@ -15,7 +15,7 @@ while(my $f = readdir($DIR)) {
'date' => hex($2) * 60,
'user' => scalar(getpwuid($st[4])),
'created' => $st[9] };
open(my $FILE, $p);
open(my $FILE, "<".$p);
while(<$FILE>) {
$job->{'cmd'} .= $_;
}

View File

@ -14,7 +14,7 @@ while($f = readdir(DIR)) {
'date' => $1,
'user' => scalar(getpwuid($st[4])),
'created' => $st[9] };
open(FILE, $p);
open(FILE, "<".$p);
while(<FILE>) {
$job->{'cmd'} .= $_;
}

View File

@ -14,7 +14,7 @@ while($f = readdir(DIR)) {
'date' => $1,
'user' => scalar(getpwuid($st[4])),
'created' => $st[9] };
open(FILE, $p);
open(FILE, "<".$p);
while(<FILE>) {
$job->{'cmd'} .= $_;
}

View File

@ -495,7 +495,7 @@ else {
}
# Validate archive
open(FILE, $file);
open(FILE, "<".$file);
my $two;
read(FILE, $two, 2);
close(FILE);
@ -537,7 +537,7 @@ my %mfiles;
my @files;
while($m = readdir(DIR)) {
next if ($m eq "." || $m eq ".." || !$hasmod{$m});
open(MAN, "$manifests_dir/$m");
open(MAN, "<$manifests_dir/$m");
my @mfiles;
while(<MAN>) {
s/\r|\n//g;

View File

@ -49,7 +49,7 @@ else {
}
print "Content-type: application/x-gzip\n\n";
my $buf;
open(TEMP, $temp);
open(TEMP, "<$temp");
while(read(TEMP, $buf, 1024)) {
print $buf;
}

View File

@ -66,7 +66,7 @@ if (!defined($config_file_cache{$file})) {
local @rv = ( );
local $parent = { 'members' => \@rv };
local $lnum = 0;
open(CONF, $_[0]) || return undef;
open(CONF, "<".$_[0]) || return undef;
local @lines = <CONF>;
close(CONF);
for(my $i=0; $i<@lines; $i++) {
@ -813,7 +813,7 @@ return undef;
sub get_bacula_version_cached
{
open(CACHE, "$module_config_directory/version");
open(CACHE, "<$module_config_directory/version");
chop($version = <CACHE>);
close(CACHE);
return $version || &get_bacula_version();

View File

@ -32,7 +32,7 @@ $time_now = time();
# Scan the entries in the log file
&pre_process();
open(LOG, $bandwidth_log);
open(LOG, "<".$bandwidth_log);
while(<LOG>) {
if (&process_line($_, \@hours, $time_now)) {
# Found a valid line
@ -57,7 +57,7 @@ foreach $hour (@hours) {
# Truncate the file (if it exists) and notify syslog
if (-r $bandwidth_log) {
open(LOG, ">$bandwidth_log");
open(LOG, ">".$bandwidth_log);
close(LOG);
}
&foreign_call($syslog_module, "signal_syslog");

View File

@ -27,7 +27,7 @@ else {
sub list_exports
{
local(@rv, $lnum, $_);
open(EXP, $config{'exports_file'});
open(EXP, "<".$config{'exports_file'});
$lnum = -1; $index = 0;
while(<EXP>) {
$lnum++;

View File

@ -97,7 +97,7 @@ foreach my $dev (glob("/dev/ada[0-9]"),
}
# Get disk model from dmesg
open(DMESG, "/var/run/dmesg.boot");
open(DMESG, "</var/run/dmesg.boot");
while(<DMESG>) {
if (/^(\S+):\s+(\S+\s+)?<(.*)>/ && $1 eq $disk->{'short'}) {
$disk->{'model'} = $3;

View File

@ -9,7 +9,7 @@ if (!-d $config) {
print STDERR "The config directory $config does not exist\n";
exit 2;
}
if (!open(CONF, "$config/miniserv.conf")) {
if (!open(CONF, "<$config/miniserv.conf")) {
print STDERR "Failed to open $config/miniserv.conf : $!\n";
print STDERR "Maybe $config is not the Webmin config directory.\n";
exit 3;
@ -20,7 +20,7 @@ while(<CONF>) {
close(CONF);
# Update the users file
if (!open(USERS, $config{'userfile'})) {
if (!open(USERS, "<".$config{'userfile'})) {
print STDERR "Failed to open Webmin users file $config{'userfile'} : $!\n";
exit 4;
}
@ -43,7 +43,7 @@ srand(time() ^ $$);
$salt = chr(int(rand(26))+65).chr(int(rand(26))+65);
$uinfo->[1] = crypt($pass, $salt);
$uinfo->[6] = time();
if (!open(USERS, "> $config{'userfile'}")) {
if (!open(USERS, ">$config{'userfile'}")) {
print STDERR "Failed to open Webmin users file $config{'userfile'} : $!\n";
exit 6;
}
@ -54,7 +54,7 @@ close(USERS);
print "Updated password of Webmin user $user\n";
# Send a signal to have miniserv reload it's config
if (open(PID, $config{'pidfile'})) {
if (open(PID, "<".$config{'pidfile'})) {
$pid = <PID>;
$pid =~ s/\r|\n//;
close(PID);

View File

@ -12,7 +12,7 @@ print &ui_table_start(undef, undef, 2);
print &ui_table_row($text{'index_cmd'},
&ui_textbox("cmd", undef, 60));
open(COMMANDS, $commands_file);
open(COMMANDS, "<$commands_file");
chop(@commands = <COMMANDS>);
close(COMMANDS);
if (@commands) {

View File

@ -97,7 +97,7 @@ return $_[0]->{'desc'} || $_[0]->{'realhost'} || $_[0]->{'host'};
# Returns an array of open categories
sub get_heiropen
{
open(HEIROPEN, "$module_config_directory/heiropen.$_[0]");
open(HEIROPEN, "<$module_config_directory/heiropen.$_[0]");
local @heiropen = <HEIROPEN>;
chop(@heiropen);
close(HEIROPEN);

View File

@ -35,7 +35,7 @@ foreach $h (@hosts) {
push(@shlist, $u->{'shell'}) if ($u->{'shell'});
}
}
open(SHELLS, "/etc/shells");
open(SHELLS, "</etc/shells");
while(<SHELLS>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -21,7 +21,7 @@ foreach $h (@hosts) {
push(@glist, $g) if (!$donegroup{$g->{'group'}}++);
}
}
open(SHELLS, "/etc/shells");
open(SHELLS, "</etc/shells");
while(<SHELLS>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -80,7 +80,7 @@ if ($type eq 'mod') {
print $text{'edit_osall'};
}
else {
open(OSLIST, "$root_directory/os_list.txt");
open(OSLIST, "<$root_directory/os_list.txt");
while(<OSLIST>) {
chop;
if (/^([^\t]+)\t+([^\t]+)\t+(\S+)\t+(\S+)\t*(.*)$/) {

View File

@ -63,7 +63,7 @@ elsif ($in{source} == 2) {
$grant = $in{'grant'} ? undef : [ split(/\s+/, $in{'grantto'}) ];
# Check validity
open(MFILE, $pfile);
open(MFILE, "<$pfile");
read(MFILE, $two, 2);
close(MFILE);
if ($two eq "\037\235") {

View File

@ -37,7 +37,7 @@ elsif ($in{'source'} == 2) {
$file = &tempname();
&http_download($usermin::update_host, $usermin::update_port, '/index6.html', $file, \$error);
$error && &inst_error($error);
open(FILE, $file);
open(FILE, "<$file");
while(<FILE>) {
if (/usermin-([0-9\.]+)\.tar\.gz/) {
$site_version = $1;
@ -138,7 +138,7 @@ else {
}
# gunzip the file if needed
open(FILE, $file);
open(FILE, "<$file");
read(FILE, $two, 2);
close(FILE);
if ($two eq "\037\213") {

View File

@ -85,7 +85,7 @@ if ($type eq 'mod') {
print $text{'edit_osall'};
}
else {
open(OSLIST, "$root_directory/os_list.txt");
open(OSLIST, "<$root_directory/os_list.txt");
while(<OSLIST>) {
chop;
if (/^([^\t]+)\t+([^\t]+)\t+(\S+)\t+(\S+)\t*(.*)$/) {

View File

@ -63,7 +63,7 @@ elsif ($in{source} == 2) {
$grant = $in{'grant'} ? undef : [ split(/\s+/, $in{'grantto'}) ];
# Check validity
open(MFILE, $pfile);
open(MFILE, "<$pfile");
read(MFILE, $two, 2);
close(MFILE);
if ($two eq "\037\235") {

View File

@ -200,7 +200,7 @@ else {
}
# gunzip the file if needed
open(FILE, $file);
open(FILE, "<$file");
read(FILE, $two, 2);
close(FILE);
if ($two eq "\037\213") {

View File

@ -119,7 +119,7 @@ sub read_file
{
local($arr);
$arr = $_[1];
open(ARFILE, $_[0]) || return 0;
open(ARFILE, "<".$_[0]) || return 0;
while(<ARFILE>) {
s/\r|\n//g;
if (!/^#/ && /^([^=]+)=(.*)$/) { $$arr{$1} = $2; }
@ -134,7 +134,7 @@ sub write_file
{
local($arr);
$arr = $_[1];
open(ARFILE, "> $_[0]");
open(ARFILE, ">".$_[0]);
foreach $k (keys %$arr) {
print ARFILE "$k=$$arr{$k}\n";
}

View File

@ -65,7 +65,7 @@ foreach $d (&expand_usr64($Config{'privlib'}),
# Add the files in the .packlist
local (%donefile, $l);
open(FILE, $f);
open(FILE, "<".$f);
while($l = <FILE>) {
chop($l);
$l =~ s/^\/tmp\/[^\/]+//;
@ -239,7 +239,7 @@ local $pf = $f;
local $ver = $_[0]->{'version'};
$pf =~ s/\.pm$/\.pod/;
local ($got_version, $got_name);
open(MOD, $pf) || open(MOD, $f);
open(MOD, "<".$pf) || open(MOD, "<".$f);
while(<MOD>) {
if (/^=head1\s+name/i && !$got_name) {
$in_name = 1;

View File

@ -125,7 +125,7 @@ elsif ($in{'source'} == 3) {
print "<p>\n";
# Make sure it is valid
open(PFILE, $packages_file);
open(PFILE, "<$packages_file");
read(PFILE, $two, 2);
close(PFILE);
if ($two ne "\037\213") {
@ -273,7 +273,7 @@ foreach $d (@dirs) {
system("$cmd >/dev/null 2>&1 </dev/null");
}
local @prereqs;
open(MAKEFILE, "$mtemp/$d/Makefile");
open(MAKEFILE, "<$mtemp/$d/Makefile");
while(<MAKEFILE>) {
last if /MakeMaker post_initialize section/;
if (/^#\s+PREREQ_PM\s+=>\s+(.+)/) {

View File

@ -105,7 +105,7 @@ if ($createsig) {
# Fill an associative array with name=value pairs from a file
sub read_file
{
open(ARFILE, $_[0]) || return 0;
open(ARFILE, "<".$_[0]) || return 0;
while(<ARFILE>) {
s/\r|\n//g;
if (!/^#/ && /^([^=]*)=(.*)$/) {
@ -123,7 +123,7 @@ sub write_file
{
local(%old, @order);
&read_file($_[0], \%old, \@order);
open(ARFILE, ">$_[0]");
open(ARFILE, ">".$_[0]);
foreach $k (@order) {
print ARFILE $k,"=",$_[1]->{$k},"\n" if (exists($_[1]->{$k}));
}

View File

@ -701,7 +701,7 @@ sub save_envs
{
local($i, @tab, $line);
@tab = &read_crontab($_[0]);
open(TAB, ">$cron_temp_file");
open(TAB, ">".$cron_temp_file);
for($i=1; $i<@_; $i+=2) {
print TAB "$_[$i]=$_[$i+1]\n";
}
@ -1231,7 +1231,7 @@ local $perl_path = &get_perl_path();
&open_tempfile(CMD, ">$_[0]");
&print_tempfile(CMD, <<EOF
#!$perl_path
open(CONF, "$config_directory/miniserv.conf") || die "Failed to open $config_directory/miniserv.conf : \$!";
open(CONF, "<$config_directory/miniserv.conf") || die "Failed to open $config_directory/miniserv.conf : \$!";
while(<CONF>) {
\$root = \$1 if (/^root=(.*)/);
}

View File

@ -5,8 +5,8 @@
sleep(1); # This is needed because the stupid crontab -e command
# checks the mtime before and after editing, and if they are
# the same it assumes no change has been made!!
open(SRC, $ENV{"CRON_EDITOR_COPY"});
open(DST, ">$ARGV[0]") || die "Failed to open $ARGV[0] : $!";
open(SRC, "<".$ENV{"CRON_EDITOR_COPY"});
open(DST, ">".$ARGV[0]) || die "Failed to open $ARGV[0] : $!";
while(<SRC>) {
if (!/^#.*DO NOT EDIT/i && !/^#.*installed on/i &&
!/^#.*Cron version/i) {

View File

@ -20,7 +20,7 @@ while($f = readdir(DIR)) {
# Read custom-command file
$cmd{'file'} = "$mcd/$f";
$cmd{'id'} = $1;
open(FILE, $cmd{'file'});
open(FILE, "<".$cmd{'file'});
chop($cmd{'cmd'} = <FILE>);
chop($cmd{'desc'} = <FILE>);
local @o = split(/\s+/, <FILE>);
@ -38,7 +38,7 @@ while($f = readdir(DIR)) {
# Read file-editor file
$cmd{'file'} = "$mcd/$f";
$cmd{'id'} = $1;
open(FILE, $cmd{'file'});
open(FILE, "<".$cmd{'file'});
chop($cmd{'edit'} = <FILE>);
chop($cmd{'desc'} = <FILE>);
chop($cmd{'user'} = <FILE>);
@ -56,7 +56,7 @@ while($f = readdir(DIR)) {
# Read SQL file
$cmd{'file'} = "$mcd/$f";
$cmd{'id'} = $1;
open(FILE, $cmd{'file'});
open(FILE, "<".$cmd{'file'});
chop($cmd{'desc'} = <FILE>);
chop($cmd{'type'} = <FILE>);
chop($cmd{'db'} = <FILE>);
@ -82,14 +82,14 @@ while($f = readdir(DIR)) {
}
close(FILE);
$cmd{'index'} = scalar(@rv);
open(HTML, "$mcd/$cmd{'id'}.html");
open(HTML, "<$mcd/$cmd{'id'}.html");
while(<HTML>) {
$cmd{'html'} .= $_;
}
close(HTML);
# Read cluster hosts file
open(CLUSTER, "$mcd/$cmd{'id'}.hosts");
open(CLUSTER, "<$mcd/$cmd{'id'}.hosts");
while(<CLUSTER>) {
s/\r|\n//g;
push(@{$cmd{'hosts'}}, $_);
@ -308,7 +308,7 @@ if ($file !~ /^\// && $file !~ /\|\s*$/) {
$file = "$uinfo[7]/$file";
}
}
open(FILE, $file);
open(FILE, "<".$file);
while(<FILE>) {
s/\r|\n//g;
next if (/^#/);

View File

@ -7,7 +7,7 @@ use WebminCore;
%access = &get_module_acl();
$default_type = 'nfs';
if ($config{'fstypes_file'} && open(TYPES, $config{'fstypes_file'})) {
if ($config{'fstypes_file'} && open(TYPES, "<".$config{'fstypes_file'})) {
if (<TYPES> =~ /^(\S+)/) {
$default_type = $1;
}
@ -21,7 +21,7 @@ sub list_shares
{
local $lnum = 0;
local @rv;
open(DFS, $config{'dfstab_file'});
open(DFS, "<".$config{'dfstab_file'});
while(<DFS>) {
s/\r|\n//g; s/#.*$//;
if (/^\s*\S*share\s+(.*)/) {

View File

@ -70,7 +70,7 @@ sub tokenize_file
{
local $lines = 0;
local ($line, $cmode);
open(FILE, $_[0]);
open(FILE, "<".$_[0]);
while($line = <FILE>) {
# strip comments
$line =~ s/\r|\n//g;

View File

@ -10,7 +10,7 @@ $access{'noconfig'} && &error($text{'iface_ecannot'});
if ($config{'interfaces_type'} eq 'mandrake') {
if (-r "/etc/conf.linuxconf") {
# Older mandrake's init script uses a linuxconf setting
open(FILE, "/etc/conf.linuxconf");
open(FILE, "</etc/conf.linuxconf");
while(<FILE>) {
if (/DHCP.interface\s+(.*)/) {
$iface = $1;

View File

@ -12,14 +12,14 @@ $display_max = $config{'display_max'} || 1000000000;
&ReadParse();
$horder = $in{'horder'};
$norder = $in{'norder'};
if ($horder eq "" && open(INDEX, "$module_config_directory/hindex.".$remote_user)) {
if ($horder eq "" && open(INDEX, "<$module_config_directory/hindex.".$remote_user)) {
chop($horder = <INDEX>);
close(INDEX);
}
if (!$horder) {
$horder = 0;
}
if ($norder eq "" && open(INDEX, "$module_config_directory/nindex.".$remote_user)) {
if ($norder eq "" && open(INDEX, "<$module_config_directory/nindex.".$remote_user)) {
chop($norder = <INDEX>);
close(INDEX);
}

View File

@ -37,7 +37,7 @@ local $filedir = $file;
$filedir =~ s/\/[^\/]+$//;
local $lnum = 0;
local ($section, @sections);
open(CONF, $file);
open(CONF, "<".$file);
local @lines = <CONF>;
close(CONF);
local $_;

View File

@ -82,7 +82,7 @@ sub create_aliases_file($)
if ( ! -e $file )
{
open(CONF,"> $file");
open(CONF, ">$file");
print CONF <<EOF;
*: :fail: That user does not exist.
@ -189,7 +189,7 @@ sub list_virtusers
$file =~ /^(.*)$config{'exim_aliasfileextre'}/;
$domain = $1;
$file_line = 1;
open(FILE,"$exim_virt_dir/$file") || die("Could not find $file. $!");
open(FILE, "<$exim_virt_dir/$file") || die("Could not find $file. $!");
while ( <FILE> )
{
if ( /^([^\*\#\s:]+):?\s+(.*)$/ )

View File

@ -17,7 +17,7 @@ sub list_exports
{
my (@rv, $pos, $h, $o, $line);
return @list_exports_cache if (@list_exports_cache);
open(EXP, $config{'exports_file'});
open(EXP, "<".$config{'exports_file'});
my $lnum = 0;
while(my $line = <EXP>) {
my $slnum = $lnum;

View File

@ -51,7 +51,7 @@ if (scalar(@list_disks_partitions_cache)) {
local (@pscsi, @dscsi, $dscsi_mode);
if (-r "/proc/scsi/sg/devices" && -r "/proc/scsi/sg/device_strs") {
# Get device info from various /proc/scsi files
open(DEVICES, "/proc/scsi/sg/devices");
open(DEVICES, "</proc/scsi/sg/devices");
while(<DEVICES>) {
s/\r|\n//g;
local @l = split(/\t+/, $_);
@ -63,7 +63,7 @@ if (-r "/proc/scsi/sg/devices" && -r "/proc/scsi/sg/device_strs") {
}
close(DEVICES);
local $i = 0;
open(DEVNAMES, "/proc/scsi/sg/device_strs");
open(DEVNAMES, "</proc/scsi/sg/device_strs");
while(<DEVNAMES>) {
s/\r|\n//g;
local @l = split(/\t+/, $_);
@ -77,7 +77,7 @@ if (-r "/proc/scsi/sg/devices" && -r "/proc/scsi/sg/device_strs") {
}
else {
# Check /proc/scsi/scsi for SCSI disk models
open(SCSI, "/proc/scsi/scsi");
open(SCSI, "</proc/scsi/scsi");
local @lines = <SCSI>;
close(SCSI);
if ($lines[0] =~ /^Attached\s+domains/i) {
@ -122,7 +122,7 @@ else {
}
local (@disks, @devs, $d);
if (open(PARTS, "/proc/partitions")) {
if (open(PARTS, "</proc/partitions")) {
# The list of all disks can come from the kernel
local $sc = 0;
while(<PARTS>) {
@ -154,7 +154,7 @@ if (open(PARTS, "/proc/partitions")) {
elsif (/\d+\s+\d+\s+\d+\s+hd([a-z]+)\s/) {
# IDE disk (but skip CDs)
local $n = $1;
if (open(MEDIA, "/proc/ide/hd$n/media")) {
if (open(MEDIA, "</proc/ide/hd$n/media")) {
local $media = <MEDIA>;
close(MEDIA);
if ($media =~ /^disk/ && !$_[0]) {
@ -368,7 +368,7 @@ while(<FDISK>) {
# Mylex raid device
local ($mc, $md) = ($2, $3);
$disk->{'desc'} = &text('select_mylex', $mc, $md);
open(RD, "/proc/rd/c$mc/current_status");
open(RD, "</proc/rd/c$mc/current_status");
while(<RD>) {
if (/^Configuring\s+(.*)/i) {
$disk->{'model'} = $1;
@ -386,7 +386,7 @@ while(<FDISK>) {
# Compaq RAID device
local ($ic, $id) = ($2, $3);
$disk->{'desc'} = &text('select_cpq', $ic, $id);
open(IDA, -d "/proc/driver/array" ? "/proc/driver/array/ida$ic" : "/proc/driver/cpqarray/ida$ic");
open(IDA, -d "/proc/driver/array" ? "</proc/driver/array/ida$ic" : "</proc/driver/cpqarray/ida$ic");
while(<IDA>) {
if (/^(\S+):\s+(.*)/ && $1 eq "ida$ic") {
$disk->{'model'} = $2;
@ -400,7 +400,7 @@ while(<FDISK>) {
# Compaq Smart Array RAID
local ($ic, $id) = ($2, $3);
$disk->{'desc'} = &text('select_smart', $ic, $id);
open(CCI, "/proc/driver/cciss/cciss$ic");
open(CCI, "</proc/driver/cciss/cciss$ic");
while(<CCI>) {
if (/^\s*(\S+):\s*(.*)/ && $1 eq "cciss$ic") {
$disk->{'model'} = $2;

View File

@ -37,7 +37,7 @@ local $lnum = 0;
local ($line, @rv, @toks);
# Tokenize the file
open(FILE, $_[0]);
open(FILE, "<".$_[0]);
while($line = <FILE>) {
$line =~ s/\r|\n//g;
$line =~ s/^\s*#.*$//;

View File

@ -44,7 +44,7 @@ if ($config{'config_file'}) {
# Show the fetchmail daemon form
foreach $pf ($config{'pid_file'},
"$uinfo[7]/.fetchmail.pid", "$uinfo[7]/.fetchmail") {
if (open(PID, $pf) && ($line=<PID>) &&
if (open(PID, "<$pf") && ($line=<PID>) &&
(($pid,$interval) = split(/\s+/, $line)) && $pid &&
kill(0, $pid)) {
$running++;

View File

@ -6,7 +6,7 @@ sub read_autoreply
{
local ($file, $simple) = @_;
local @lines;
open(FILE, $file);
open(FILE, "<".$file);
while(<FILE>) {
if (/^Reply-Tracking:\s*(.*)/) {
$simple->{'replies'} = $1;

View File

@ -456,7 +456,7 @@ local ($name, $value) = @_;
local @stdprotos = ( 'tcp', 'udp', "icmp${ipvx_icmp}", undef );
$value ||= "tcp";
local @otherprotos;
open(PROTOS, "/etc/protocols");
open(PROTOS, "</etc/protocols");
while(<PROTOS>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -66,7 +66,7 @@ elsif ($file eq "direct") {
# Read active rules
$file = $direct;
}
open(FILE, $file);
open(FILE, "<".$file);
local $cmt;
LINE:
while(<FILE>) {

View File

@ -85,7 +85,7 @@ else {
if ($temp) {
# Read output
open(OUT, $temp);
open(OUT, "<".$temp);
while(<OUT>) {
s/\r//g;
$out .= $_;

View File

@ -18,7 +18,7 @@ sub get_menu_config
{
local $lnum = 0;
local (@rv, $title);
open(CONF, $config{'menu_file'});
open(CONF, "<".$config{'menu_file'});
while(<CONF>) {
s/#.*$//;
s/\r|\n//g;
@ -216,7 +216,7 @@ else {
# Just use the existing file
$dm = $config{'device_map'};
}
open(MAP, $dm);
open(MAP, "<".$dm);
while(<MAP>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -13,7 +13,7 @@ $authkeys = $config{'authkeys'} ? $config{'authkeys'}
$resource_d = $config{'resource_d'} ? $config{'resource_d'}
: "$config{'ha_dir'}/resource.d";
open(VERSION, "$module_config_directory/version");
open(VERSION, "<$module_config_directory/version");
chop($heartbeat_version = <VERSION>);
close(VERSION);
@ -21,7 +21,7 @@ sub get_ha_config
{
local @rv;
local $lnum = 0;
open(CONF, $ha_cf);
open(CONF, "<".$ha_cf);
while(<CONF>) {
s/\s+$//;
s/#.*$//;
@ -101,7 +101,7 @@ sub list_resources()
{
local @rv;
local $lnum = 0;
open(RES, $haresources);
open(RES, "<".$haresources);
while(<RES>) {
s/\s+$//;
s/#.*$//;
@ -160,7 +160,7 @@ return join(" ", @l);
sub get_auth_config
{
local $rv;
open(AUTH, $authkeys);
open(AUTH, "<".$authkeys);
while(<AUTH>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -7,7 +7,7 @@ sub list_exports
{
local (@rv, $pos, $lnum, $h, $o, $line);
return @list_exports_cache if (@list_exports_cache);
open(EXP, $config{'exports_file'});
open(EXP, "<".$config{'exports_file'});
$lnum = 0;
while($line = <EXP>) {
local $slnum = $lnum;

View File

@ -11,7 +11,7 @@ use Socket;
sub list_exports
{
local(@rv);
open(EXP, $config{exports_file});
open(EXP, "<".$config{exports_file});
while(<EXP>) {
chop; s/#.*//g;
if (!/\S/) { next; }
@ -28,7 +28,7 @@ return @rv;
sub get_exports
{
local(@rv);
open(EXP, $config{exports_file});
open(EXP, "<".$config{exports_file});
while(<EXP>) {
chop; s/#.*//g;
if (!/\S/) { next; }
@ -64,7 +64,7 @@ if ($_[1]) { &print_tempfile(EXP, "-$_[1]\n"); };
sub modify_export
{
local(@exp);
open(EXP, $config{exports_file});
open(EXP, "<".$config{exports_file});
@exp = <EXP>;
close(EXP);
&open_tempfile(EXP, "> $config{exports_file}");
@ -90,7 +90,7 @@ foreach (@exp) {
sub delete_export
{
local(@exp);
open(EXP, $config{exports_file});
open(EXP, "<".$config{exports_file});
@exp = <EXP>;
close(EXP);
&open_tempfile(EXP, "> $config{exports_file}");

View File

@ -61,7 +61,7 @@ sub list_directories
{
my @rv;
my $fh;
open($fh, $directories_file) || return ();
open($fh, "<".$directories_file) || return ();
while(<$fh>) {
s/\r|\n//g;
my @dir = split(/\t+/, $_);

View File

@ -26,7 +26,7 @@ if (!defined($list_authusers_cache{$file})) {
local $_;
my $lnum = 0;
my $count = 0;
if (open(HTPASSWD, $file)) {
if (open(HTPASSWD, "<".$file)) {
while(<HTPASSWD>) {
if (/^(#?)\s*([^:]+):(\S*)/) {
push(@{$list_authusers_cache{$file}},
@ -56,7 +56,7 @@ if (!defined($list_authusers_cache{$file})) {
local $_;
my $lnum = 0;
my $count = 0;
if (open(HTPASSWD, $file)) {
if (open(HTPASSWD, "<".$file)) {
while(<HTPASSWD>) {
if (/^(#?)\s*(\S+):(\S+):(\S*)/) {
push(@{$list_authusers_cache{$file}},
@ -201,7 +201,7 @@ if (!defined($list_authgroups_cache{$file})) {
local $_;
my $lnum = 0;
my $count = 0;
open(HTPASSWD, $file);
open(HTPASSWD, "<".$file);
while(<HTPASSWD>) {
if (/^(#?)\s*(\S+):\s*(.*)/) {
push(@{$list_authgroups_cache{$file}},

View File

@ -9,7 +9,7 @@ use WebminCore;
# Returns the idmapd config
sub get_config {
local %conf;
open(FILE, $config{'idmapd_conf'});
open(FILE, "<".$config{'idmapd_conf'});
while(<FILE>) {
chomp;
s/#.*//;

View File

@ -12,7 +12,7 @@ require './idmapd-lib.pl';
# Write the config file
&lock_file($config{'idmapd_conf'});
open(FILE, "> $config{'idmapd_conf'}");
open(FILE, ">$config{'idmapd_conf'}");
print FILE "[General]\n";
print FILE "Pipefs-Directory = $in{'pipefsdir'}\n";
print FILE "Domain = $in{'domain'}\n";

View File

@ -7,7 +7,7 @@ sub list_services
local(@rv, $l);
$l = 0;
system("$config{'get_services_command'}") if ($config{'get_services_command'});
open(SERVICES, $config{services_file});
open(SERVICES, "<".$config{services_file});
while(<SERVICES>) {
chop; s/#.*$//g;
if (/^(\S+)\s+([0-9]+)\/(\S+)\s*(.*)$/) {
@ -47,7 +47,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
sub modify_service
{
local(@serv);
open(SERVICES, $config{services_file});
open(SERVICES, "<".$config{services_file});
@serv = <SERVICES>;
close(SERVICES);
$serv[$_[0]] = "$_[1]\t$_[2]/$_[3]".($_[4] ? "\t$_[4]\n" : "\n");
@ -61,7 +61,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
sub delete_service
{
local(@serv);
open(SERVICES, $config{services_file});
open(SERVICES, "<".$config{services_file});
@serv = <SERVICES>;
close(SERVICES);
splice(@serv, $_[0], 1);
@ -76,7 +76,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
sub list_protocols
{
local(@rv);
open(PROT, $config{protocols_file});
open(PROT, "<".$config{protocols_file});
while(<PROT>) {
chop; s/#.*$//g;
if (!/\S/) { next; }
@ -111,7 +111,7 @@ closedir(DIR);
# parse each file
foreach $f (@files) {
$l = 0;
open(INET, $f);
open(INET, "<".$f);
while(<INET>) {
chop;
if (/^(#+|#<off>#)?\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\??\/\S+|internal)\s*(.*)$/) {
@ -144,7 +144,7 @@ sub create_inet
sub modify_inet
{
local(@inet);
open(INET, $_[9]);
open(INET, "<".$_[9]);
@inet = <INET>;
close(INET);
$inet[$_[0]] = ($_[1] ? "" : "#")."$_[2]\t$_[3]\t$_[4]\t$_[5]\t$_[6]\t$_[7]".
@ -160,7 +160,7 @@ $inet[$_[0]] = ($_[1] ? "" : "#")."$_[2]\t$_[3]\t$_[4]\t$_[5]\t$_[6]\t$_[7]".
sub delete_inet
{
local(@inet);
open(INET, $_[1]);
open(INET, "<".$_[1]);
@inet = <INET>;
close(INET);
splice(@inet, $_[0], 1);

View File

@ -34,7 +34,7 @@ sub list_rpcs
{
local(@rv, $l);
$l = 0;
open(RPC, $config{rpc_file});
open(RPC, "<".$config{rpc_file});
while(<RPC>) {
chop; s/#.*$//g;
if (/^(\S+)\s+(\d+)\s*(.*)$/) {
@ -61,7 +61,7 @@ sub create_rpc
sub modify_rpc
{
local(@rpcs);
open(RPC, $config{rpc_file});
open(RPC, "<".$config{rpc_file});
@rpcs = <RPC>;
close(RPC);
$rpcs[$_[0]] = "$_[1]\t$_[2]".($_[3] ? "\t$_[3]\n" : "\n");
@ -76,7 +76,7 @@ $rpcs[$_[0]] = "$_[1]\t$_[2]".($_[3] ? "\t$_[3]\n" : "\n");
sub delete_rpc
{
local(@rpcs);
open(RPC, $config{rpc_file});
open(RPC, "<".$config{rpc_file});
@rpcs = <RPC>;
close(RPC);
splice(@rpcs, $_[0], 1);

View File

@ -6,7 +6,7 @@ sub list_services
local(@rv, $l);
$l = 0;
system("$config{'get_services_command'}") if ($config{'get_services_command'});
open(SERVICES, $config{services_file});
open(SERVICES, "<".$config{services_file});
while(<SERVICES>) {
chop; s/#.*$//g;
if (/^(\S+)\s+([0-9]+)\/(\S+)\s*(.*)$/) {
@ -53,7 +53,7 @@ sub modify_service
local(@serv, $p);
$p = $_[3];
$p =~ s/6.*$//;
open(SERVICES, $config{services_file});
open(SERVICES, "<".$config{services_file});
@serv = <SERVICES>;
close(SERVICES);
$serv[$_[0]] = "$_[1]\t$_[2]/$p".($_[4] ? "\t$_[4]\n" : "\n");
@ -67,7 +67,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
sub delete_service
{
local(@serv);
open(SERVICES, $config{services_file});
open(SERVICES, "<".$config{services_file});
@serv = <SERVICES>;
close(SERVICES);
splice(@serv, $_[0], 1);
@ -82,7 +82,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
sub list_protocols
{
local(@rv);
open(PROT, $config{protocols_file});
open(PROT, "<".$config{protocols_file});
while(<PROT>) {
chop; s/#.*$//g;
if (!/\S/) { next; }

View File

@ -9,7 +9,7 @@ $ucproduct = ucfirst($product);
if ($init_mode eq "local") {
# Remove from /etc/webmin/start from boot time rc script
open(LOCAL, $config{'local_script'});
open(LOCAL, "<".$config{'local_script'});
@local = <LOCAL>;
close(LOCAL);
$start = "$config_directory/start";

View File

@ -46,7 +46,7 @@ if ($ty == 0) {
# }
print "<form action=save_startscript.cgi method=post>\n";
print "<textarea name=startup rows=20 cols=80>";
open(STARTSCRIPT, $startscript);
open(STARTSCRIPT, "<$startscript");
while(<STARTSCRIPT>) { print; }
close(STARTSCRIPT);
print "</textarea><br>\n";
@ -60,7 +60,7 @@ if ($ty == 0) {
# }
print "<form action=save_startscript.cgi method=post>\n";
print "<textarea name=plist rows=20 cols=80>";
open(PLIST, $plistedit);
open(PLIST, "<$plistedit");
while(<PLIST>) { print; }
close(PLIST);
print "</textarea><br>\n";
@ -148,7 +148,7 @@ if ($ty == 2) {
"<tt>$config{'hostconfig'}</tt>"),"<br>\n";
print "<form action=save_startscript.cgi method=post>\n";
print "<textarea name=hostconfig rows=20 cols=80>";
open(LOCAL, $config{'hostconfig'});
open(LOCAL, "<$config{'hostconfig'}");
while(<LOCAL>) { print; }
close(LOCAL);
print "</textarea><br>\n";

View File

@ -17,7 +17,7 @@ sub hostconfig_settings
####
local($conffile, @hconf);
$conffile = "$config{'hostconfig'}";
open(LOCAL, $conffile);
open(LOCAL, "<".$conffile);
@conf = <LOCAL>;
close(LOCAL);
@conf = grep /^\w/, @conf;
@ -210,7 +210,7 @@ my($action_item, $startupfile) = @_;
# get current setting
$line = "$config{'hostconfig'}";
open(HCONF, $line);
open(HCONF, "<".$line);
@sconf = <HCONF>;
close(HCONF);
@sconf = grep /^$action_item=/, @sconf;
@ -229,7 +229,7 @@ $option_selected = "";
# get possible settings
if ( $startupfile ne "" ) {
open(LOCAL, $startupfile);
open(LOCAL, "<".$startupfile);
@sfile = <LOCAL>;
close(LOCAL);
#

View File

@ -373,7 +373,7 @@ sub get_inittab_runlevel
local %iconfig = &foreign_config("inittab");
local @rv;
local $id = $config{'inittab_id'};
if (open(TAB, $iconfig{'inittab_file'})) {
if (open(TAB, "<".$iconfig{'inittab_file'})) {
# Read the inittab file
while(<TAB>) {
if (/^$id:(\d+):/ && $1) { @rv = ( $1 ); }
@ -419,7 +419,7 @@ in with supported parameters to the action, like 'start' and 'stop'.
sub init_description
{
# Read contents of script, extract start/stop commands
open(FILE, $_[0]);
open(FILE, "<".$_[0]);
local @lines = <FILE>;
close(FILE);
local $data = join("", @lines);
@ -495,7 +495,7 @@ sub chkconfig_info
{
local @rv;
local $desc;
open(FILE, $_[0]);
open(FILE, "<".$_[0]);
while(<FILE>) {
if (/^#\s*chkconfig:\s+(\S+)\s+(\d+)\s+(\d+)/) {
@rv = ( $1 eq '-' ? [ ] : [ split(//, $1) ], $2, $3 );
@ -525,7 +525,7 @@ if ($init_mode eq "upstart") {
quotemeta($name)." 2>&1");
if (!$?) {
my $cfile = "/etc/init/$name.conf";
open(CONF, $cfile);
open(CONF, "<".$cfile);
while(<CONF>) {
if (/^(#*)\s*start/) {
return $1 ? 1 : 2;
@ -572,7 +572,7 @@ elsif ($init_mode eq "local") {
# Look for entry in rc.local
local $fn = "$module_config_directory/$name.sh";
local $cmd = "$fn start";
open(LOCAL, $config{'local_script'});
open(LOCAL, "<".$config{'local_script'});
while(<LOCAL>) {
s/\r|\n//g;
$found++ if ($_ eq $cmd);
@ -1207,7 +1207,7 @@ elsif ($mode eq "rc") {
}
elsif ($mode eq "osx") {
# Delete OSX hostconfig entry
open(LOCAL, $config{'hostconfig'});
open(LOCAL, "<".$config{'hostconfig'});
my @local = <LOCAL>;
close(LOCAL);
my $start = $name."=-";
@ -1912,7 +1912,7 @@ foreach my $l (split(/\r?\n/, $out)) {
if ($l =~ /process\s+(\d+)/) {
$s->{'pid'} = $1;
}
open(CONF, "/etc/init/$s->{'name'}.conf");
open(CONF, "</etc/init/$s->{'name'}.conf");
while(<CONF>) {
if (/^description\s+"([^"]+)"/ && !$s->{'desc'}) {
$s->{'desc'} = $1;
@ -2378,7 +2378,7 @@ sub get_action_args
{
my ($file) = @_;
my %hasarg;
open(FILE, $file);
open(FILE, "<".$file);
while(<FILE>) {
if (/^\s*(['"]?)([a-z]+)\1\)/i) {
$hasarg{$2}++;

View File

@ -34,7 +34,7 @@ $hostc = $config{'hostconfig'};
# modify and write the hostconfig file
@new = ();
&lock_file($config{'hostconfig'});
open(LOCAL, "$hostc");
open(LOCAL, "<$hostc");
@old = <LOCAL>;
close(LOCAL);
foreach $line (@old) {

View File

@ -28,7 +28,7 @@ if (not $in{'action_name'}=~ /^[A-Z][A-Z0-9_]*$/ ) {
}
else {
#make sure action name is not in use
open(LOCAL, $config{'hostconfig'});
open(LOCAL, "<$config{'hostconfig'}");
@temp = <LOCAL>;
close(LOCAL);
foreach $element (@temp) {

View File

@ -14,7 +14,7 @@ local $ucproduct = ucfirst($product);
if ($init_mode eq "osx") {
# Remove from hostconfig file
open(LOCAL, $config{'hostconfig'});
open(LOCAL, "<".$config{'hostconfig'});
@local = <LOCAL>;
close(LOCAL);
$start = "WEBMIN=-";
@ -32,7 +32,7 @@ if ($init_mode eq "osx") {
}
elsif ($init_mode eq "local") {
# Remove from boot time rc script
open(LOCAL, $config{'local_script'});
open(LOCAL, "<".$config{'local_script'});
@local = <LOCAL>;
close(LOCAL);
$start = "$config_directory/start";

View File

@ -10,7 +10,7 @@ sub parse_inittab
{
local @rv;
local $lnum = 0;
open(INITTAB, $config{'inittab_file'});
open(INITTAB, "<".$config{'inittab_file'});
while(<INITTAB>) {
s/\r|\n//g;
#s/#.*$//g;

View File

@ -18,7 +18,7 @@ if (@ARGV > 2 || !@ARGV) {
$file = $ARGV[0];
$config = $ARGV[1] ? $ARGV[1] : "/etc/webmin";
-r $file || die "$file does not exist";
open(CONF, "$config/miniserv.conf") ||
open(CONF, "<$config/miniserv.conf") ||
die "Failed to read $config/miniserv.conf - maybe $config is not a Webmin config directory";
while(<CONF>) {
s/\r|\n//g;

View File

@ -6,7 +6,7 @@ use WebminCore;
&foreign_require("net", "net-lib.pl");
# Get the detected ipf version
if (open(VERSION, "$module_config_directory/version")) {
if (open(VERSION, "<$module_config_directory/version")) {
chop($ipf_version = <VERSION>);
close(VERSION);
}
@ -47,7 +47,7 @@ local $file = $_[0] || $config{'ipf_conf'};
return $get_config_cache{$file} if ($get_config_cache{$file});
local @rv;
local $lnum = 0;
open(FILE, $file);
open(FILE, "<".$file);
while(<FILE>) {
# Read each line, splitting into words
s/\r|\n//g;
@ -951,7 +951,7 @@ sub get_ipnat_config
{
local $file = $_[0] || $config{'ipnat_conf'};
return $get_ipnat_config_cache{$file} if ($get_ipnat_config_cache{$file});
open(FILE, $file);
open(FILE, "<".$file);
while(<FILE>) {
# Read each line, splitting into words
s/\r|\n//g;
@ -1191,7 +1191,7 @@ sub list_protocols
{
local @stdprotos = ( 'tcp', 'udp', 'icmp' );
local @otherprotos;
open(PROTOS, "/etc/protocols");
open(PROTOS, "</etc/protocols");
while(<PROTOS>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -54,7 +54,7 @@ elsif ($has_net_lib) {
@tcpflags = ( "fin", "syn", "rst", "psh", "ack", "urg" );
# Get the detected ipfw version
if (open(VERSION, "$module_config_directory/version")) {
if (open(VERSION, "<$module_config_directory/version")) {
chop($ipfw_version = <VERSION>);
close(VERSION);
}
@ -72,7 +72,7 @@ if ($_[0] =~ /\|$/) {
local @rv;
local $cmt;
local $lnum = -1;
open(LIST, $file);
open(LIST, "<".$file);
while(<LIST>) {
${$_[1]} .= $_ if ($_[1]);
$lnum++;
@ -460,7 +460,7 @@ sub list_protocols
{
local @stdprotos = ( 'tcp', 'udp', 'icmp' );
local @otherprotos;
open(PROTOS, "/etc/protocols");
open(PROTOS, "</etc/protocols");
while(<PROTOS>) {
s/\r|\n//g;
s/#.*$//;
@ -687,7 +687,7 @@ if (defined($get_ipfw_format_cache)) {
return $get_ipfw_format_cache;
}
local $fmt;
if (open(FILE, $ipfw_file)) {
if (open(FILE, "<".$ipfw_file)) {
# Check existing format
while(<FILE>) {
if (/^(\d+)\s/) {

View File

@ -14,7 +14,7 @@ if ($in{'mode'} == 0) {
}
else {
$in{'file'} || &error($text{'import_efile'});
open(FILE, $in{'file'}) || &error($text{'import_eopen'});
open(FILE, "<$in{'file'}") || &error($text{'import_eopen'});
while(<FILE>) {
s/\r|\n//g;
push(@data, $_);

View File

@ -16,7 +16,7 @@ local $file = $_[0] || $config{'file'};
local (@rv, $sect);
local $lnum = 0;
local $fh = "CONF".$get_config_fh++;
open($fh, $file);
open($fh, "<".$file);
while(<$fh>) {
s/\r|\n//g;
s/#.*$//;
@ -182,7 +182,7 @@ return @rv;
sub read_policy
{
local @rv;
open(FILE, "$config{'policies_dir'}/$_[0]");
open(FILE, "<$config{'policies_dir'}/$_[0]");
while(<FILE>) {
push(@rv, "$1/$2") if (/^\s*([0-9\.]+)\/(\d+)/);
}
@ -261,7 +261,7 @@ sleep(5);
# Look for new error messages
local $i;
for($i=0; $i<@ipsec_logfiles; $i++) {
open(LOG, $ipsec_logfiles[$i]) || next;
open(LOG, "<".$ipsec_logfiles[$i]) || next;
seek(LOG, $ipsec_logfile_sizes[$i], 0);
while(<LOG>) {
s/\r|\n//g;
@ -292,7 +292,7 @@ return $out =~ /(FreeS\/WAN|Openswan|StrongSWAN|Libreswan)\s+([^ \n\(]+)/i ? ($2
sub got_secret
{
local $gotkey;
open(SEC, $config{'secrets'}) || return 0;
open(SEC, "<".$config{'secrets'}) || return 0;
while(<SEC>) {
s/\r|\n//g;
s/#.*$//;
@ -356,7 +356,7 @@ sub list_secrets
if (!scalar(@list_secrets_cache)) {
local (@lines);
local $lnum = 0;
open(SEC, $config{'secrets'});
open(SEC, "<".$config{'secrets'});
while(<SEC>) {
s/\r|\n//g;
s/^\s*#.*$//;

View File

@ -11,7 +11,7 @@ print "<form action=save_file.cgi method=post enctype=multipart/form-data>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'file_header'}</b></td> </tr>\n";
print "<tr $cb> <td><textarea name=file rows=15 cols=80>";
open(FILE, $config{'jabber_config'});
open(FILE, "<$config{'jabber_config'}");
while(<FILE>) {
print &html_escape($_);
}

View File

@ -85,7 +85,7 @@ if (!ref($conf)) {
&icons_table(\@links, \@titles, \@icons);
# Show warning about config file
open(CONFIG, $config{'jabber_config'});
open(CONFIG, "<$config{'jabber_config'}");
while(<CONFIG>) {
if (/\s+<!--/) {
$has_comment++;

View File

@ -10,7 +10,7 @@ use WebminCore;
sub get_config {
local (%conf, $section, $realm);
$section = $realm = "";
open(FILE, $config{'krb5_conf'});
open(FILE, "<".$config{'krb5_conf'});
while(<FILE>) {
chomp;
s/#.*//;

View File

@ -9,7 +9,7 @@ require './krb5-lib.pl';
# Write the config file
&lock_file($config{'krb5_conf'});
open(FILE, "> $config{'krb5_conf'}");
open(FILE, ">$config{'krb5_conf'}");
print FILE "[logging]\n";
print FILE "default = FILE:$in{'default_log'}\n";
print FILE "kdc = FILE:$in{'kdc_log'}\n";

View File

@ -9,7 +9,7 @@ sub get_nsswitch_config
if (!scalar(@get_nsswitch_cache)) {
@get_nsswitch_cache = ( );
local $lnum = 0;
open(CONF, $nsswitch_config_file);
open(CONF, "<".$nsswitch_config_file);
while(<CONF>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -185,7 +185,7 @@ if (defined($get_config_cache{$file})) {
}
local @rv;
local $lnum = 0;
open(CONF, $file);
open(CONF, "<".$file);
while(<CONF>) {
s/\r|\n//g;
s/^\s*#.*$//;
@ -267,7 +267,7 @@ foreach my $file (&recursive_find_ldif($config{'config_file'})) {
$cls =~ s/^\Q$config{'config_file'}\/\E//;
$cls =~ s/\.ldif$//;
$cls = join(",", reverse(split(/\//, $cls)));
open(CONFIG, $file);
open(CONFIG, "<".$file);
while(<CONFIG>) {
s/\r|\n//g;
s/^#.*$//;

View File

@ -15,7 +15,7 @@ if ($in{'source'} == 0) {
$data =~ /\S/ || &error($text{'batch_efile'});
}
elsif ($in{'source'} == 1) {
open(LOCAL, $in{'local'}) || &error($text{'batch_elocal'});
open(LOCAL, "<$in{'local'}") || &error($text{'batch_elocal'});
while(<LOCAL>) {
$data .= $_;
}

View File

@ -73,7 +73,7 @@ if ($shells{'passwd'}) {
&build_user_used(undef, \@shlist);
}
if ($shells{'shells'}) {
open(SHELLS, "/etc/shells");
open(SHELLS, "</etc/shells");
while(<SHELLS>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -5,7 +5,7 @@ BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
if (open(VERSION, "$module_config_directory/version")) {
if (open(VERSION, "<$module_config_directory/version")) {
chop($logrotate_version = <VERSION>);
close(VERSION);
}
@ -45,7 +45,7 @@ local $addto = \@rv;
local $section = undef;
local $lnum = 0;
local $fh = "FILE".$file_count++;
open($fh, $file);
open($fh, "<".$file);
while(<$fh>) {
s/\r|\n//g;
s/#.*$//;

View File

@ -7,7 +7,7 @@ sub get_qconfig
local @rv;
local $prn;
local $lnum = 0;
open(CONF, $config{'printcap_file'});
open(CONF, "<".$config{'printcap_file'});
while(<CONF>) {
s/\r|\n//g;
s/^\s*#.*$//;

View File

@ -9,7 +9,7 @@
'ledger', 'Ledger' );
$driver_dir = "/etc/sysconfig/printers";
$base_driver = "/usr/libexec/printers/genericfilter";
open(BASE, $base_driver);
open(BASE, "<".$base_driver);
$base_driver_text = join(<BASE>);
close(BASE);
$webmin_windows_driver = 1;
@ -30,7 +30,7 @@ if (!$_[0]) {
return { 'mode' => 0,
'desc' => "$text{'caldera_none'}" };
}
open(DRV, $_[0]);
open(DRV, "<".$_[0]);
local @lines = <DRV>;
close(DRV);
local %conf;
@ -57,7 +57,7 @@ if ($lines[1] =~ /^source ($driver_dir\/\S+)/) {
}
else {
# A caldera printer driver
open(COAS, $config{'coas_printers'});
open(COAS, "<".$config{'coas_printers'});
local $plist = &parse_coas(COAS);
close(COAS);
local ($prn, $p);
@ -89,7 +89,7 @@ elsif (join(@lines) eq $base_driver_text) {
}
else {
# A new caldera printer driver
open(COAS, $config{'coas_printers'});
open(COAS, "<".$config{'coas_printers'});
local $plist = &parse_coas(COAS);
close(COAS);
local ($prn, $p, $type);
@ -178,7 +178,7 @@ else {
}
else {
# Create the 2.3 driver program
open(DRIVER, $base_driver);
open(DRIVER, "<".$base_driver);
local @lines = <DRIVER>;
close(DRIVER);
&open_tempfile(DRV, ">$drv");
@ -221,7 +221,7 @@ print "<td><table width=100%>\n";
local $sels = $gconfig{'os_version'} < 2.4 ? 5 : 10;
print "<tr> <td valign=top><b>$text{'caldera_printer'}</b></td>\n";
print "<td colspan=3><select size=$sels name=gsdevice onChange='setres(0)'>\n";
open(COAS, $config{'coas_printers'});
open(COAS, "<".$config{'coas_printers'});
local $plist = &parse_coas(COAS);
close(COAS);
local ($i, $j, $p, $k, $found, $select_res);
@ -362,7 +362,7 @@ elsif ($in{'mode'} == 2) {
}
elsif ($in{'mode'} == 1) {
# Normal ghostscript driver
open(COAS, $config{'coas_printers'});
open(COAS, "<".$config{'coas_printers'});
local $plist = &parse_coas(COAS);
close(COAS);
$in{'gsdevice'} || &error($text{'caldera_edriver'});

View File

@ -181,7 +181,7 @@ return @list_printcap_cache if (scalar(@list_printcap_cache));
local(@rv, @line, $line, $cont, $lnum, $i, %done, $capfile);
foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
next if (!$capfile || $done{$capfile}++);
open(CAP, $capfile);
open(CAP, "<".$capfile);
$lnum = 0;
while($line = <CAP>) {
$line =~ s/^#.*$//g; # remove comments

View File

@ -217,7 +217,7 @@ local(@rv, @line, @comment, @eline, @sline, $line, $cont, $lnum, $i,
%done, $capfile);
foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
next if (!$capfile || $done{$capfile}++);
open(CAP, $capfile);
open(CAP, "<".$capfile);
$lnum = 0;
while($line = <CAP>) {
$line =~ s/\s+$//g; # remove trailing spaces/newline

View File

@ -236,7 +236,7 @@ if (!$_[0]) {
'desc' => 'None' };
}
if (&has_ghostscript()) {
open(DRV, $_[0]);
open(DRV, "<".$_[0]);
for($i=0; $i<4; $i++) { $l .= <DRV>; }
close(DRV);
if ($l =~ /# Name: (.*)\n# Type: (.*)\n# DPI: (.*)\n/) {
@ -271,7 +271,7 @@ sub is_webmin_windows_driver
{
local($i, $l);
if (!&has_smbclient()) { return undef; }
open(DRV, $_[0]);
open(DRV, "<".$_[0]);
for($i=0; $i<8; $i++) { $l .= <DRV>; }
close(DRV);
if ($l =~ /# Name: (.*)\n# Server: (.*)\n# Share: (.*)\n# User: (.*)\n# Password: (.*)\n# Workgroup: (.*)\n# Program: (.*)\n/) {
@ -313,7 +313,7 @@ sub is_hpnp_driver
{
local($i, $l);
if (!&has_hpnp()) { return undef; }
open(DRV, $_[0]);
open(DRV, "<".$_[0]);
for($i=0; $i<5; $i++) { $l .= <DRV>; }
close(DRV);
if ($l =~ /# Name: (.*)\n# Server: (.*)\n# Port: (.*)\n# Program: (.*)\n/) {
@ -424,7 +424,7 @@ elsif ($in{'drv'} == 3) {
sub list_webmin_drivers
{
local(@rv, $_);
open(DRIVERS, "$module_root_directory/drivers");
open(DRIVERS, "<$module_root_directory/drivers");
while(<DRIVERS>) {
/^(\S+)\s+(.*)/;
push(@rv, [ $1, $2 ]);
@ -484,7 +484,7 @@ if ($out =~ /Search path:\n((\s+.*\n)+)/i) {
while($f = readdir(DIR)) {
next if ($f !~ /^(.*)\.upp$/);
local $upp = $1;
open(UPP, "$d/$f");
open(UPP, "<$d/$f");
local $line = <UPP>;
close(UPP);
next if ($line !~ /upModel="(.*)"/i);
@ -533,7 +533,7 @@ if ($file =~ /\.gz$/) {
open(PPD, "gunzip -c ".quotemeta($file)." |");
}
else {
open(PPD, $file);
open(PPD, "<".$file);
}
while(<PPD>) {
if (/^\s*\*(\S+):\s*"(.*)"/ || /^\s*\*(\S+):\s*(\S+)/) {

View File

@ -259,7 +259,7 @@ return @list_printcap_cache if (scalar(@list_printcap_cache));
local(@rv, @line, @comment, $line, $cont, $lnum, $i, %done, $capfile);
foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
next if (!$capfile || $done{$capfile}++);
open(CAP, $capfile);
open(CAP, "<".$capfile);
$lnum = 0;
while($line = <CAP>) {
$line =~ s/\s+$//g; # remove trailing spaces

View File

@ -27,7 +27,7 @@ if (!$_[0]) {
return { 'mode' => 0,
'desc' => 'None' };
}
open(DRV, $_[0]);
open(DRV, "<".$_[0]);
local @lines = <DRV>;
close(DRV);
if ($lines[1] =~ /^source ($driver_dir\/\S+)/) {
@ -54,7 +54,7 @@ if ($lines[1] =~ /^source ($driver_dir\/\S+)/) {
}
else {
# A caldera printer driver
open(COAS, $config{'coas_printers'});
open(COAS, "<".$config{'coas_printers'});
local $plist = &parse_coas(COAS);
close(COAS);
local ($desc, $p);
@ -114,7 +114,7 @@ else {
&write_env_file("$driver_dir/$_[0]->{'name'}", \%conf);
# Create the standard driver program
open(DRIVER, $base_driver);
open(DRIVER, "<".$base_driver);
local @lines = <DRIVER>;
close(DRIVER);
$lines[1] = "source $driver_dir/$_[0]->{'name'}\n";
@ -153,7 +153,7 @@ print "<td><table width=100%>\n";
print "<tr> <td valign=top><b>$text{'caldera_printer'}</b></td>\n";
print "<td colspan=3><select size=5 name=gsdevice onChange='setres(0)'>\n";
open(COAS, $config{'coas_printers'});
open(COAS, "<".$config{'coas_printers'});
local $plist = &parse_coas(COAS);
close(COAS);
local ($i, $j, $p, $k, $found, $select_res);
@ -285,7 +285,7 @@ elsif ($in{'mode'} == 2) {
}
elsif ($in{'mode'} == 1) {
# Normal ghostscript driver
open(COAS, $config{'coas_printers'});
open(COAS, "<".$config{'coas_printers'});
local $plist = &parse_coas(COAS);
close(COAS);
$in{'gsdevice'} || &error($text{'caldera_edriver'});

View File

@ -84,7 +84,7 @@ return { 'mode' => 2,
# read_m4_file(file, &hash)
sub read_m4_file
{
open(CFG, $_[0]);
open(CFG, "<".$_[0]);
while(<CFG>) {
s/#.*$//; s/\r|\n//g;
if (/^\s*define\(([A-Za-z0-9\_]+)\s*,\s*`([^']*)'\)/) {

View File

@ -388,7 +388,7 @@ elsif ($in{'mode'} == 1) {
sub read_rhs_drivers
{
local (@rv, $drv);
open(DRV, $rhs_drivers_file);
open(DRV, "<".$rhs_drivers_file);
while(<DRV>) {
s/#.*$//g;
s/\r|\n//g;

View File

@ -90,7 +90,7 @@ printf "<tr> <td valign=top><input type=radio name=mode value=1 %s> %s</td>\n",
$_[1]->{'mode'} == 1 ? 'checked' : '', $text{'cups_driver'};
print "<td><select name=ppd size=10>\n";
local (@ppds, $d, $f, $ppd, %cache, $outofdate, @files, %donefile);
open(FIND, "find '$config{'model_path'}' -type f -print |");
open(FIND, "find ".quotemeta($config{'model_path'})." -type f -print |");
while(<FIND>) {
chop;
/([^\/]+)$/;

View File

@ -20,7 +20,7 @@ sub list_printers
{
return () if (!&sched_running());
local(@rv, $_);
if (open(CONF, "/etc/printers.conf")) {
if (open(CONF, "</etc/printers.conf")) {
# Printers can be read from a file
while(<CONF>) {
s/\r|\n//g;

View File

@ -40,14 +40,14 @@ $apsfilter_base = "/etc/apsfilterrc";
$driver_dir = "/etc/gs.upp";
$webmin_windows_driver = 1;
open(DRIVERS, "$module_root_directory/drivers");
open(DRIVERS, "<$module_root_directory/drivers");
while(<DRIVERS>) {
if (/^(\S+)\s+(.*)/) {
$driver{$1} = $2 if (!$driver{$1});
}
}
close(DRIVERS);
open(STP, "stp");
open(STP, "<stp");
while(<STP>) {
if (/^(\S+)\s+(.*)/) {
$stp{$1} = $2 if (!$stp{$1});

View File

@ -31,7 +31,7 @@ if ($job) {
print "Content-length: $total\n";
print "\n";
foreach $pf (@pf) {
open(FILE, $pf);
open(FILE, "<$pf");
while(<FILE>) { print; }
close(FILE);
}

View File

@ -755,7 +755,7 @@ else {
sub parse_colon_file
{
local %rv;
open(FILE, $_[0]);
open(FILE, "<".$_[0]);
while(<FILE>) {
if (/^([^:]+):\s*(.*)/) {
$rv{$1} = $2;
@ -824,7 +824,7 @@ else {
sub list_lvmtab
{
local @rv;
open(TAB, $lvm_tab);
open(TAB, "<".$lvm_tab);
local $/ = "\0";
while(<TAB>) {
chop;

View File

@ -508,7 +508,7 @@ if ($ct =~ /multipart\/(\S+)/i && ($ct =~ /boundary="([^"]+)"/i ||
print HEXBIN $attach->{'data'};
close(HEXBIN);
if (!$?) {
open(HEXBIN, "$temp/attach.data");
open(HEXBIN, "<$temp/attach.data");
local $/ = undef;
$attach->{'data'} = <HEXBIN>;
close(HEXBIN);
@ -562,7 +562,7 @@ if ($ct =~ /multipart\/(\S+)/i && ($ct =~ /boundary="([^"]+)"/i ||
while($f = readdir(DIR)) {
next if ($f eq '.' || $f eq '..');
local $data;
open(FILE, "$tempdir/$f");
open(FILE, "<$tempdir/$f");
while(<FILE>) {
$data .= $_;
}

View File

@ -98,7 +98,7 @@ else {
sub dump_erroricon
{
print "Content-type: image/gif\n\n";
open(ICON, "images/error.gif");
open(ICON, "<images/error.gif");
while(<ICON>) { print; }
close(ICON);
exit;

View File

@ -54,7 +54,7 @@ if ($?) {
# Output the ZIP
print "Content-type: application/zip\n\n";
open(ZIP, $zip);
open(ZIP, "<$zip");
while(read(ZIP, $buf, 32768) > 0) {
print $buf;
}

View File

@ -1048,7 +1048,7 @@ sub get_signature
local $sf = &get_signature_file($_[0]);
$sf || return undef;
local $sig;
open(SIG, $sf) || return undef;
open(SIG, "<".$sf) || return undef;
while(<SIG>) {
$sig .= $_;
}

View File

@ -32,7 +32,7 @@ foreach $k (@eorder) {
sub read_file
{
local $_;
open(ARFILE, $_[0]) || return 0;
open(ARFILE, "<".$_[0]) || return 0;
while(<ARFILE>) {
chomp;
local $hash = index($_, "#");

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