Commit 9e298622 authored by Kirk Webb's avatar Kirk Webb

Merge branch 'realpath-fix'

parents 361c7d7f 3f167217
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Create a new user from a XML description.
......@@ -168,7 +169,7 @@ if (! defined($this_user)) {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......@@ -310,7 +311,7 @@ if (exists($newproj_args{'newuser_xml'})) {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $newuser_xml`;
my $translated = realpath($newuser_xml);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$newuser_xml = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Create a new user from a XML description.
......@@ -148,7 +149,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Back-end script to change experiment info from an XML description.
......@@ -119,7 +120,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Back-end script to edit group membership.
......@@ -117,7 +118,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Back-end script to edit image descriptor.
......@@ -120,7 +121,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Back-end script to create or edit a nodetype.
......@@ -125,7 +126,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Back-end script to edit site variables.
......@@ -119,7 +120,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Change the user profile from a XML description.
......@@ -129,7 +130,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Back-end script to create a Project Group.
......@@ -123,7 +124,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Back-end script to create new Image descriptors (Long Form.)
......@@ -127,7 +128,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -27,6 +27,7 @@ use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use URI::Escape;
use Cwd qw(realpath);
#
# Back-end script to create new Image descriptors (EZ Form.)
......@@ -139,7 +140,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Back-end script to create a new Mailman list.
......@@ -120,7 +121,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -26,6 +26,7 @@ use strict;
use Getopt::Std;
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Create a new osid from a XML description.
......@@ -119,7 +120,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -28,6 +28,7 @@ use XML::Simple;
use Data::Dumper;
use IO::Handle;
use URI::Escape;
use Cwd qw(realpath);
#
# Create a new node from a XML description.
......@@ -140,7 +141,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -158,6 +158,7 @@ use lib '@srcdir@';
use English;
use libinstall;
use Getopt::Std;
use Cwd qw(realpath);
#
# Handle command-line options
......@@ -329,7 +330,7 @@ Phase "patches", "Applying patches", sub {
};
Phase "Mysql.pm.patch", "Patching Mysql.pm", sub {
my $patchfile = $MYSQL_PM_PATCH;
$patchfile = `realpath $patchfile`;
$patchfile = realpath($patchfile);
chomp $patchfile;
my $dir;
......
......@@ -369,6 +369,7 @@ use lib '@srcdir@';
use English;
use libinstall;
use Getopt::Std;
use Cwd qw(realpath);
#
# Handle command-line options
......@@ -799,7 +800,7 @@ Phase "patches", "Applying patches", sub {
if ($FBSD_MAJOR < 8) {
Phase "Mysql.pm.patch", "Patching Mysql.pm", sub {
my $patchfile = $MYSQL_PM_PATCH;
$patchfile = `realpath $patchfile`;
$patchfile = realpath($patchfile);
chomp $patchfile;
my $dir;
......@@ -1291,7 +1292,7 @@ Phase "exports", "Setting up exports", sub {
else {
@dirs = @EXPORTDIRS;
}
@dirs = map {`realpath $_`} @dirs;
@dirs = map {realpath($_)} @dirs;
chomp @dirs;
my %filesystems;
foreach my $dir (@dirs) {
......@@ -1315,7 +1316,7 @@ Phase "exports", "Setting up exports", sub {
# /share is special. We want to export to boss read-write,
# but to the control network read-only.
#
my $realdir = `realpath $SHAREROOT`;
my $realdir = realpath($SHAREROOT);
chomp($realdir);
push(@exports_lines,
"$realdir\t$BOSSNODE -maproot=root");
......
......@@ -73,6 +73,7 @@ use lib '@srcdir@';
use English;
use libinstall;
use Getopt::Std;
use Cwd qw(realpath);
#
# Handle command-line options
......@@ -261,7 +262,7 @@ Phase "dirs", "Setting directory permissions", sub {
PhaseFail("Directory $dir does not exist");
}
# Use the real path, to avoid symlink problems
my $realdir = `realpath $dir`;
my $realdir = realpath($dir);
chomp $realdir;
my ($mode,$group) = (stat($realdir))[2,5];
# Fix up the mode (strip file type)
......@@ -378,7 +379,7 @@ Phase "exports", "Setting up exports", sub {
my %filesystems;
foreach my $dir (@MOUNTPOINTS) {
if ($dir ne $SHAREROOT) {
my $dir = `realpath $dir`;
my $dir = realpath($dir);
chomp($dir);
my $dev = (stat($dir))[0];
push @{$filesystems{$dev}}, $dir;
......@@ -399,7 +400,7 @@ Phase "exports", "Setting up exports", sub {
# /share is special. We want to export to boss/ops read-write,
# but to the control network read-only.
#
my $realdir = `realpath $SHAREROOT`;
my $realdir = realpath($SHAREROOT);
chomp($realdir);
push(@exports_lines,
"$realdir\t$BOSSNODE $USERNODE -maproot=root");
......
......@@ -99,6 +99,7 @@ use lib '@srcdir@';
use English;
use libinstall;
use Getopt::Std;
use Cwd qw(realpath);
#
# Handle command-line options
......@@ -377,7 +378,7 @@ Phase "dirs", "Setting directory permissions", sub {
PhaseFail("Directory $dir does not exist");
}
# Use the real path, to avoid symlink problems
my $realdir = `realpath $dir`;
my $realdir = realpath($dir);
chomp $realdir;
my ($mode,$group) = (stat($realdir))[2,5];
# Fix up the mode (strip file type)
......@@ -789,7 +790,7 @@ Phase "exports", "Setting up exports", sub {
if ($ISFS) {
@dirs = (grep(!/^$SHAREROOT$/, @MOUNTPOINTS), @dirs);
}
@dirs = map {`realpath $_`} @dirs;
@dirs = map {realpath($_)} @dirs;
chomp @dirs;
my %filesystems;
foreach my $dir (@dirs) {
......@@ -812,7 +813,7 @@ Phase "exports", "Setting up exports", sub {
# /share is special. We want to export to boss read-write,
# but to the control network read-only.
#
my $realdir = `realpath $SHAREROOT`;
my $realdir = realpath($SHAREROOT);
chomp($realdir);
push(@exports_lines,
"$realdir\t$BOSSNODE -maproot=root");
......
......@@ -4,6 +4,7 @@
use strict;
use libinstall;
use installvars;
use Cwd qw(realpath);
sub Install($$$)
{
......@@ -42,7 +43,7 @@ sub Install($$$)
if ($FBSD_MAJOR < 8) {
Phase "Mysql.pm.patch", "Patching Mysql.pm", sub {
my $patchfile = $MYSQL_PM_PATCH;
$patchfile = `realpath $patchfile`;
$patchfile = realpath($patchfile);
chomp $patchfile;
my $dir;
......
......@@ -4,6 +4,7 @@
use strict;
use libinstall;
use installvars;
use Cwd qw(realpath);
sub Install($$$)
{
......@@ -40,7 +41,7 @@ sub Install($$$)
PhaseFail("Directory $dir does not exist");
}
# Use the real path, to avoid symlink problems
my $realdir = `realpath $dir`;
my $realdir = realpath($dir);
chomp $realdir;
my ($mode,$group) = (stat($realdir))[2,5];
# Fix up the mode (strip file type)
......
......@@ -4,6 +4,7 @@
use strict;
use libinstall;
use installvars;
use Cwd qw(realpath);
sub Install($$$)
{
......@@ -54,7 +55,7 @@ sub Install($$$)
}
foreach my $dir (@dirs) {
if ($dir ne $SHAREROOT) {
my $dir = `realpath $dir`;
my $dir = realpath($dir);
chomp($dir);
my $dev = (stat($dir))[0];
push @{$filesystems{$dev}}, $dir;
......@@ -82,7 +83,7 @@ sub Install($$$)
# but to the control network read-only.
#
if ($SHAREDIR && ISFS($server)) {
my $realdir = `realpath $SHAREROOT`;
my $realdir = realpath($SHAREROOT);
chomp($realdir);
push(@exports_lines,
"$realdir\t$BOSSNODE -maproot=root");
......
......@@ -33,6 +33,7 @@ use Getopt::Std;
use XML::Simple;
use File::Temp qw(tempfile);
use Data::Dumper;
use Cwd qw(realpath);
#
# Create a quick VM.
......@@ -192,7 +193,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -34,6 +34,7 @@ use XML::LibXML;
use Data::Dumper;
use Date::Parse;
use Time::Local;
use Cwd qw(realpath);
#
# Verify a GENI credential.
......@@ -148,7 +149,7 @@ else {
fatal("Tainted filename: $xmlfile");
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -30,6 +30,7 @@
use strict;
use English;
use Getopt::Std;
use Cwd qw(realpath);
#
# Update a certificate using the existing private key.
......@@ -116,9 +117,9 @@ sub UpdateCert($$)
{
my ($certfile, $keyfile) = @_;
$keyfile = `realpath $keyfile`;
$keyfile = realpath($keyfile);
chomp($keyfile);
$certfile = `realpath $certfile`;
$certfile = realpath($certfile);
chomp($certfile);
#
......
......@@ -27,6 +27,7 @@ use POSIX qw(isatty setsid);
use POSIX qw(strftime);
use Errno qw(EDQUOT);
use RPC::XML;
use Cwd qw(realpath);
#
# Create an experiment. The experiment is either run immediately, or
......@@ -1006,7 +1007,7 @@ sub ParseArgs()
#
# Use realpath to resolve any symlinks.
#
my $translated = `realpath $tempnsfile`;
my $translated = realpath($tempnsfile);
if ($translated =~ /^([-\w\.\/]+)$/) {
$tempnsfile = $1;
}
......
......@@ -25,6 +25,7 @@
use English;
use Getopt::Std;
use Cwd qw(realpath);
#
# Syntax check an NS file.
......@@ -103,7 +104,7 @@ else {
#
# Use realpath to resolve any symlinks.
#
my $translated = `realpath $tempfile`;
my $translated = realpath($tempfile);
if ($translated =~ /^([-\w\.\/]+)$/) {
$tempfile = $1;
}
......
......@@ -25,6 +25,7 @@ use strict;
use English;
use Getopt::Std;
use POSIX qw(mktime);
use Cwd qw(realpath);
#
# Spew a tar/rpm file to stdout.
......@@ -222,7 +223,7 @@ sub VerifyFile()
# Use realpath to remove any symlinks to make sure we are not going
# to hand out a file outside the appropriate files systems.
#
my $translated = `realpath $file`;
my $translated = realpath($file);
if ($translated =~ /^([-\@\w\.\/]+)$/) {
$translated = $1;
}
......
......@@ -25,6 +25,7 @@ use strict;
use English;
use Getopt::Std;
use POSIX qw(mktime);
use Cwd qw(realpath);
#
# Spew a tar/rpm file to stdout.
......@@ -148,7 +149,7 @@ sub VerifyFile()
# Use realpath to remove any symlinks to make sure we are not going
# to hand out a file outside the appropriate files systems.
#
my $translated = `realpath $file`;
my $translated = realpath($file);
if ($translated =~ /^([-\@\w\.\/]+)$/) {
$translated = $1;
}
......
......@@ -27,6 +27,7 @@ use English;
use Getopt::Std;
use POSIX qw(isatty setsid);
use RPC::XML;
use Cwd qw(realpath);
#
# This gets invoked from the Web interface.
......@@ -286,7 +287,7 @@ if ($inout eq "modify" && @ARGV > 2) {
#
# Use realpath to resolve any symlinks.
#
my $translated = `realpath $tempnsfile`;
my $translated = realpath($tempnsfile);
if ($translated =~ /^([-\w\.\/]+)$/) {
$tempnsfile = $1;
}
......
......@@ -27,6 +27,7 @@ use Getopt::Std;
use POSIX qw(isatty setsid);
use POSIX qw(strftime);
use Errno qw(EDQUOT);
use Cwd qw(realpath);
#
# Create a new experiment template.
......@@ -956,7 +957,7 @@ sub ParseArgs()
#
# Use realpath to resolve any symlinks.
#
my $translated = `realpath $inputfile`;
my $translated = realpath($inputfile);
if ($translated =~ /^([-\w\.\/]+)$/) {
$inputfile = $1;
}
......
......@@ -31,6 +31,7 @@ use XML::Simple;
use File::Find;
use File::stat;
use Data::Dumper;
use Cwd qw(realpath);
#
# Start/Stop/Pause experiment runs ...
......@@ -995,7 +996,7 @@ sub ParseArgs()
#
# Use realpath to resolve any symlinks.
#
my $translated = `realpath $inputfile`;
my $translated = realpath($inputfile);
if ($translated =~ /^([-\w\.\/]+)$/) {
$inputfile = $1;
}
......
......@@ -29,6 +29,7 @@ use POSIX qw(strftime);
use Errno qw(EDQUOT);
use XML::Simple;
use Data::Dumper;
use Cwd qw(realpath);
#
# Create a new experiment template.
......@@ -739,7 +740,7 @@ sub ParseArgs()
#
# Use realpath to resolve any symlinks.
#
my $translated = `realpath $inputfile`;
my $translated = realpath($inputfile);
if ($translated =~ /^([-\w\.\/]+)$/) {
$inputfile = $1;
}
......
......@@ -24,6 +24,7 @@
use English;
use strict;
use Getopt::Std;
use Cwd qw(realpath);
#
# Add metadata to a template.
......@@ -238,7 +239,7 @@ sub ParseArgs()
#
# Use realpath to resolve any symlinks.
#
my $translated = `realpath $inputfile`;
my $translated = realpath($inputfile);
if ($translated =~ /^([-\w\.\/]+)$/) {
$inputfile = $1;
}
......
......@@ -26,6 +26,7 @@ use English;
use Getopt::Std;
use POSIX qw(setsid :sys_wait_h);
use File::Basename;
use Cwd qw(realpath);
#
# Image Creation Tuneables.
......@@ -391,7 +392,7 @@ if ($isglobal && ($filename =~ /^\/usr\/testbed/)) {
#
# Use realpath to resolve any symlinks.
#
my $translated = `realpath $filename`;
my $translated = realpath($filename);
if ($translated =~ /^([-\w\.\/\+]+)$/) {
$filename = $1;
}
......
......@@ -28,6 +28,7 @@ use XML::Simple;
use Data::Dumper;
use Date::Parse;
use Time::Local;
use Cwd qw(realpath);
#
# Add (or update) an emulab site record.
......@@ -117,7 +118,7 @@ else {
}
# Use realpath to resolve any symlinks.
my $translated = `realpath $xmlfile`;
my $translated = realpath($xmlfile);
if ($translated =~ /^(\/tmp\/[-\w\.\/]+)$/) {
$xmlfile = $1;
}
......
......@@ -23,6 +23,7 @@
#
use English;
use File::Basename;
use Cwd qw(realpath);
#
# Forceably chown a directory hierarchy to the real uid of the invoker.
......@@ -88,7 +89,7 @@ else {
die("*** Tainted source: $pathname\n");
}
$pathname = `realpath $pathname`;
$pathname = realpath($pathname);
if ($pathname =~ /^([-\w\/.]+)$/) {
$pathname = $1;
......
......@@ -24,6 +24,7 @@
#
use English;
use Cwd qw(realpath);
#
# Configure variables
......@@ -56,14 +57,14 @@ if (@ARGV != 2) {
usage();
}
$src = `realpath $ARGV[0]`;
$src = realpath($ARGV[0]);
if ($src =~ /^([-\w\/.]+)$/) {
$src = $1;
} else {
die("*** Tainted source: $src\n");
}
$dst = `realpath $ARGV[1]`;
$dst = realpath($ARGV[1]);
if ($dst =~ /^([-\w\/.]+)$/) {
$dst = $1;
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment