[vhffs-dev] [1619] home directories mode is now 700, group directories mode is now 770, fixed vhffscron so that it changes its uid/gid before chdir(), deleted useless fix-home-perms.sh script

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


Revision: 1619
Author:   gradator
Date:     2010-08-29 19:09:55 +0200 (Sun, 29 Aug 2010)
Log Message:
-----------
home directories mode is now 700, group directories mode is now 770, fixed vhffscron so that it changes its uid/gid before chdir(), deleted useless fix-home-perms.sh script

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Robots/Group.pm
    trunk/vhffs-api/src/Vhffs/Robots/User.pm
    trunk/vhffs-cron/src/vhffscron.pl

Removed Paths:
-------------
    trunk/vhffs-compat/fix-home-perms.sh

Modified: trunk/vhffs-api/src/Vhffs/Robots/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Group.pm	2010-08-22 18:39:02 UTC (rev 1618)
+++ trunk/vhffs-api/src/Vhffs/Robots/Group.pm	2010-08-29 17:09:55 UTC (rev 1619)
@@ -52,7 +52,7 @@
 	Vhffs::Functions::create_dir( $hash );
 	$group->add_history('Ok, Robots finished the creation of the directory');
 	chown( $group->get_owner_uid , $group->get_gid , $hash );
-	chmod( 0555 , $hash );
+	chmod( 0770 , $hash );
 	add_user( $user , $group , $main );
 	$group->set_status( Vhffs::Constants::ACTIVATED );
 	$group->commit;
@@ -71,11 +71,8 @@
 	my $hash = Vhffs::Functions::hash_groupname( $group->get_groupname , $main );	
 	if( -d $hash )
 	{
-		my $cmd = "rm -f $hash/* ";
+		my $cmd = "rm -rf $hash";
 		system( $cmd );
-
-		$cmd = "rmdir  $hash ";
-		system( $cmd );
 	}
 	return 0;
 }

Modified: trunk/vhffs-api/src/Vhffs/Robots/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/User.pm	2010-08-22 18:39:02 UTC (rev 1618)
+++ trunk/vhffs-api/src/Vhffs/Robots/User.pm	2010-08-29 17:09:55 UTC (rev 1619)
@@ -87,7 +87,7 @@
 	
 	unless( Vhffs::Functions::create_dir( $homedir ) )  {
 		chown $user->get_uid , $user->get_gid , $homedir;
-		chmod oct('1755'), $homedir;
+		chmod 0700, $homedir;
 		
 		$user->add_history( 'homedir created' );
 		$user->set_status( Vhffs::Constants::ACTIVATED );

Deleted: trunk/vhffs-compat/fix-home-perms.sh
===================================================================
--- trunk/vhffs-compat/fix-home-perms.sh	2010-08-22 18:39:02 UTC (rev 1618)
+++ trunk/vhffs-compat/fix-home-perms.sh	2010-08-29 17:09:55 UTC (rev 1619)
@@ -1,27 +0,0 @@
-#!%BASH%
-function help()
-{
-    echo "Usage: $0 /path/to/homes/base [--perform]" >&2
-    echo "    --perform : really fix permissions"
-    echo "Example:" >&2
-    echo "  $0 /data/home" >&2
-    exit
-}
-
-if [ $# -lt 1 ]; then
-    echo "*** Error *** $0 takes at least 1 argument" >&2
-    help
-fi
-
-if [ `echo $1 | grep /$` ]; then
-    regex="$1././[^/]+$"
-else
-    regex="$1/././[^/]+$"
-fi
-if [ "$2" = "--perform" ]; then
-    find $1 -type d  | egrep $regex | xargs chmod +t
-else
-    echo "Here are the files that would be chmod'ed +t :"
-    echo ""
-    find $1 -type d  | egrep $regex
-fi

Modified: trunk/vhffs-cron/src/vhffscron.pl
===================================================================
--- trunk/vhffs-cron/src/vhffscron.pl	2010-08-22 18:39:02 UTC (rev 1618)
+++ trunk/vhffs-cron/src/vhffscron.pl	2010-08-29 17:09:55 UTC (rev 1619)
@@ -293,28 +293,28 @@
 
 		chroot $chroot if defined $chroot;
 
+		$GID = $EGID = $cron->get_owner_gid.' '.$cron->get_owner_gid;
+		$UID = $EUID = $cron->get_owner_uid;
+		unless( POSIX::getuid() == $cron->get_owner_uid && POSIX::getgid() == $cron->get_owner_gid ) {
+			print $son "CRITICAL: Error while setting UID and GID\n";
+			_exit(FAIL_TO_RUN_PROCESS_EXIT_CODE);
+		}
+
 		my ($username,undef,undef,undef,undef,undef,undef,$homedir,undef,undef) = getpwuid( $cron->get_owner_uid );
 		$ENV{'PATH'} = '/usr/bin:/bin';
 		$ENV{'HOME'} = $homedir;
 		$ENV{'LOGNAME'} = $username;
 		chdir $homedir;
 
-		foreach (sort keys(%ENV)) {
-			print $son 'ENV:'.$_.'='.$ENV{$_}."\n";
-		}
-		print $son "\n";
-
 		if( $ENV{'PWD'} ne $homedir ) {
 			print $son "CRITICAL: Cannot chdir() to home directory\n";
 			_exit(FAIL_TO_RUN_PROCESS_EXIT_CODE);
 		}
 
-		$GID = $EGID = $cron->get_owner_gid.' '.$cron->get_owner_gid;
-		$UID = $EUID = $cron->get_owner_uid;
-		unless( POSIX::getuid() == $cron->get_owner_uid && POSIX::getgid() == $cron->get_owner_gid ) {
-			print $son "CRITICAL: Error while setting UID and GID\n";
-			_exit(FAIL_TO_RUN_PROCESS_EXIT_CODE);
+		foreach (sort keys(%ENV)) {
+			print $son 'ENV:'.$_.'='.$ENV{$_}."\n";
 		}
+		print $son "\n";
 
 		my $cronpath = $cron->get_cronpath;
 


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