From 7536fc6fb283f8fffb2231c806eb565436059874 Mon Sep 17 00:00:00 2001 From: cphillip Date: Thu, 17 Jan 2002 21:49:28 +0000 Subject: [PATCH] Fix file mode/uid/gid after they've been 'translated' by gsi-ssh setup script. --- setup/setup-openssh.pl | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/setup/setup-openssh.pl b/setup/setup-openssh.pl index 7789b64..ddb7b81 100644 --- a/setup/setup-openssh.pl +++ b/setup/setup-openssh.pl @@ -93,8 +93,22 @@ sub fixpaths for $f (@files) { $f =~ /(.*\/)*(.*)$/; + + # + # we really should create a random filename and make sure that it + # doesn't already exist (based off current time_t or something) + # + $g = "$f.tmp"; + # + # Grab the current mode/uid/gid for use later + # + + $mode = (stat($f))[2]; + $uid = (stat($f))[4]; + $gid = (stat($f))[5]; + $result = system("mv $f $g"); if ($result != 0) { @@ -121,16 +135,19 @@ sub fixpaths { die "Failed to remove $g\n"; } + + # + # An attempt to revert the new file back to the original file's + # mode/uid/gid + # + + chmod($mode, $f); + chown($uid, $gid, $f); } # for $f return 0; } -sub setperms() -{ - $result = system("chmod 755 $bindir/scp"); -} - sub runkeygen { print "Generating ssh keys (if necessary)...\n"; @@ -168,7 +185,6 @@ sub runkeygen } fixpaths(); -#setperms(); runkeygen(); my $metadata = new Grid::GPT::Setup(package_name => "gsi-openssh-setup"); -- 2.45.1