[vhffs-dev] [2048] add chmod() to ensure file permissions whatever the umask is, reordered svn modification so that add_history is added when everything is really done

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2048
Author:   gradator
Date:     2012-02-25 01:27:28 +0100 (Sat, 25 Feb 2012)
Log Message:
-----------
add chmod() to ensure file permissions whatever the umask is, reordered svn modification so that add_history is added when everything is really done

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm
    trunk/vhffs-api/src/Vhffs/Robots/Svn.pm

Modified: trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm	2012-02-25 00:14:43 UTC (rev 2047)
+++ trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm	2012-02-25 00:27:28 UTC (rev 2048)
@@ -146,11 +146,13 @@
 		print $readers 'anonymous'."\n";
 		close( $readers );
 		chown $cvs->get_owner_uid, $cvs->get_owner_gid, $readers_file;
+		chmod 0664, $readers_file;
 
 		# Write passwd file
 		print $passwd 'anonymous::'.$cvs->get_owner->get_username."\n";
 		close( $passwd );
 		chown $cvs->get_owner_uid, $cvs->get_owner_gid, $passwd_file;
+		chmod 0664, $passwd_file;
 
 		Vhffs::Robots::vhffs_log( $vhffs, 'Cvs repository '.$cvs->get_reponame.' is now public' );
 		$cvs->add_history( 'Is now public');
@@ -200,6 +202,7 @@
 	my $template = new Template( { INCLUDE_PATH => '/usr/lib/vhffs/bots/misc/' } );
 	$template->process( 'cvs_viewvc.conf.tt', { cvsroots => $cvsroots }, $tmppath );
 
+	chmod 0644, $tmppath;
 	File::Copy::move( $tmppath, $confdir.'/viewvc.conf' );
 
 	return 1;

Modified: trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Svn.pm	2012-02-25 00:14:43 UTC (rev 2047)
+++ trunk/vhffs-api/src/Vhffs/Robots/Svn.pm	2012-02-25 00:27:28 UTC (rev 2048)
@@ -134,19 +134,6 @@
 	my $vhffs = $svn->get_main;
 	my $dir = $svn->get_dir;
 
-	if( $svn->is_public ) {
-		chmod 02775, $dir;
-
-		Vhffs::Robots::vhffs_log( $vhffs, 'Svn repository '.$svn->get_reponame.' is now public' );
-		$svn->add_history( 'Is now public');
-	}
-	else {
-		chmod 02770, $dir;
-
-		Vhffs::Robots::vhffs_log( $vhffs, 'Svn repository '.$svn->get_reponame.' is now private' );
-		$svn->add_history( 'Is now private');
-	}
-
 	my $confpath = $dir.'/conf/svnserve.conf';
 
 	# Read configuration file
@@ -185,7 +172,21 @@
 		print $conffile $_;
 	}
 	close( $conffile );
+	chmod 0664, $conffile;
 
+	if( $svn->is_public ) {
+		chmod 02775, $dir;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Svn repository '.$svn->get_reponame.' is now public' );
+		$svn->add_history( 'Is now public');
+	}
+	else {
+		chmod 02770, $dir;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Svn repository '.$svn->get_reponame.' is now private' );
+		$svn->add_history( 'Is now private');
+	}
+
 	# Commit mail
 	my $svnconf = $svn->{'main'}->get_config->get_service('svn');
 	my $mailfrom = $svnconf->{'notify_from'};
@@ -270,6 +271,7 @@
 	my $template = new Template( { INCLUDE_PATH => '/usr/lib/vhffs/bots/misc/' } );
 	$template->process( 'svn_viewvc.conf.tt', { svnroots => $svnroots }, $tmppath );
 
+	chmod 0644, $tmppath;
 	File::Copy::move( $tmppath, $confdir.'/viewvc.conf' );
 
 	return 1;
@@ -297,6 +299,7 @@
 	print $tmpfile '?>'."\n";
 	close( $tmpfile );
 
+	chmod 0644, $tmppath;
 	File::Copy::move( $tmppath, $confdir.'/websvn.inc' );
 	return 1;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/