Commit 1feeef0c authored by Leigh Stoller's avatar Leigh Stoller

Swap rmprojdir for rmproj, which also removes the group from the

group file so that we do not get gid reuse (the DB will reuse numbers
that have been deallocated).
parent 2d04d705
......@@ -929,7 +929,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
security/GNUmakefile security/paperbag \
tbsetup/GNUmakefile tbsetup/console_setup tbsetup/mkacct-ctrl \
tbsetup/os_load tbsetup/os_setup tbsetup/mkprojdir tbsetup/power \
tbsetup/resetvlans tbsetup/rmacct-ctrl tbsetup/rmprojdir \
tbsetup/resetvlans tbsetup/rmacct-ctrl tbsetup/rmproj \
tbsetup/sched_reload tbsetup/tbdoit tbsetup/tbstopit \
tbsetup/ir/GNUmakefile tbsetup/ir/postassign tbsetup/snmpit \
tbsetup/ir/assign_wrapper tbsetup/ns2ir/GNUmakefile \
......
......@@ -95,7 +95,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
security/GNUmakefile security/paperbag \
tbsetup/GNUmakefile tbsetup/console_setup tbsetup/mkacct-ctrl \
tbsetup/os_load tbsetup/os_setup tbsetup/mkprojdir tbsetup/power \
tbsetup/resetvlans tbsetup/rmacct-ctrl tbsetup/rmprojdir \
tbsetup/resetvlans tbsetup/rmacct-ctrl tbsetup/rmproj \
tbsetup/sched_reload tbsetup/tbdoit tbsetup/tbstopit \
tbsetup/ir/GNUmakefile tbsetup/ir/postassign tbsetup/snmpit \
tbsetup/ir/assign_wrapper tbsetup/ns2ir/GNUmakefile \
......
......@@ -15,7 +15,7 @@ BIN_STUFF = power snmpit tbend tbrun tbprerun tbreport \
SBIN_STUFF = resetvlans savevlans console_setup.proxy sched_reload
LIBEXEC_STUFF = mkprojdir rmprojdir mkacct-ctrl rmacct-ctrl \
LIBEXEC_STUFF = mkprojdir rmproj mkacct-ctrl rmacct-ctrl \
os_setup mkexpdir tbdoit tbstopit console_setup
LIB_STUFF = libtbsetup.pm
......@@ -59,8 +59,8 @@ post-install:
chmod 775 $(INSTALL_LIBEXECDIR)
chown root $(INSTALL_LIBEXECDIR)/mkprojdir
chmod u+s $(INSTALL_LIBEXECDIR)/mkprojdir
chown root $(INSTALL_LIBEXECDIR)/rmprojdir
chmod u+s $(INSTALL_LIBEXECDIR)/rmprojdir
chown root $(INSTALL_LIBEXECDIR)/rmproj
chmod u+s $(INSTALL_LIBEXECDIR)/rmproj
chown root $(INSTALL_LIBEXECDIR)/mkacct-ctrl
chmod u+s $(INSTALL_LIBEXECDIR)/mkacct-ctrl
chown root $(INSTALL_LIBEXECDIR)/rmacct-ctrl
......
......@@ -3,13 +3,14 @@ use Mysql;
use English;
#
# Remove a project directory hierarchy. Actually, the project directory
# Remove a project. We delete the project directory hierarchy and the
# we remove the group from /etc/group. Actually, the project directory
# is *renamed* from $pid to $pid-`date +20%y%m%d-%H.%M.%S` since we do
# not want to be so destructive.
#
# usage: rmprojdir <pid>
#
# TODO: Allow for the head of a project delete it.
# TODO: Allow for the head of a project to delete it.
#
#
......@@ -25,6 +26,7 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
my $PROJROOT = "/proj";
my $dbh = Mysql->connect("localhost",$DBNAME,"script","none");
my $db_result= "";
my $control_node = "plastic";
#
# Check args.
......@@ -96,5 +98,36 @@ if (! rename($pid, $newname)) {
exit(-1);
}
#
# Chown the owner/group to root and set the permissions so no one is
# allowed to look inside.
#
if (! chmod(0700, $newname)) {
print STDOUT "Could not chmod directory $newname to 0700: $!\n";
exit(-1);
}
if (! chown(0, 0, $newname)) {
print STDOUT "Could not chown directory $newname to 0/0: $!\n";
exit(-1);
}
#
# Now remove the group from the group file on both plastic and paper.
#
if (system("/usr/sbin/pw groupdel $pid")) {
print STDOUT "Could not remove group $pid fron operatons node (paper)\n";
exit(-1);
}
#
# Be real root for ssh.
#
$UID = 0;
if (system("/usr/local/bin/sshtb $control_node /usr/sbin/pw groupdel $pid")) {
print STDOUT "Could not remove group $pid fron control node (plastic)\n";
exit(-1);
}
exit(0);
......@@ -115,8 +115,8 @@ if (system("$tbdir/tbrun $project $eid $irfile") != 0) {
fatal();
}
print STDOUT "Running tbreport with arguments: -v $irfile 2>&1 > $repfile\n";
if (system("$tbdir/tbreport -v $irfile 2>&1 > $repfile") != 0) {
print STDOUT "Running tbreport with arguments: -v $project $eid $irfile 2>&1 > $repfile\n";
if (system("$tbdir/tbreport -v $project $eid $irfile 2>&1 > $repfile") != 0) {
print STDOUT "tbreport failed!\n";
dumplog();
tbendit();
......
......@@ -28,8 +28,4 @@ FILES += $(wildcard $(SRCDIR)/*.php3)
#
ALLFILES = $(notdir $(FILES))
#
# Do not install by default
#
install:
real-install: $(addprefix $(INSTALL_WWWDIR)/, $(ALLFILES))
install: $(addprefix $(INSTALL_WWWDIR)/, $(ALLFILES))
......@@ -133,7 +133,7 @@ if (! $query_result) {
#
# Remove the project directory.
#
SUEXEC($uid, "flux", "rmprojdir $pid", 0);
SUEXEC($uid, "flux", "rmproj $pid", 0);
#
# Warm fuzzies.
......
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