version 1.289, 2005/06/27 22:32:37
|
version 1.297, 2005/09/08 17:14:41
|
Line 48 use localauth;
|
Line 48 use localauth;
|
use localenroll; |
use localenroll; |
use localstudentphoto; |
use localstudentphoto; |
use File::Copy; |
use File::Copy; |
|
use File::Find; |
use LONCAPA::ConfigFileEdit; |
use LONCAPA::ConfigFileEdit; |
use LONCAPA::lonlocal; |
use LONCAPA::lonlocal; |
use LONCAPA::lonssl; |
use LONCAPA::lonssl; |
Line 1363 sub du_handler {
|
Line 1364 sub du_handler {
|
# etc. |
# etc. |
# |
# |
if (-d $ududir) { |
if (-d $ududir) { |
# And as Shakespeare would say to make |
my $total_size=0; |
# assurance double sure, |
my $code=sub { |
# use execute_command to ensure that the command is not executed in |
if ($_=~/\.\d+\./) { return;} |
# a shell that can screw us up. |
if ($_=~/\.meta$/) { return;} |
|
$total_size+=(stat($_))[7]; |
my $duout = execute_command("du -ks $ududir"); |
}; |
$duout=~s/[^\d]//g; #preserve only the numbers |
chdir($ududir); |
&Reply($client,"$duout\n","$cmd:$ududir"); |
find($code,$ududir); |
|
$total_size=int($total_size/1024); |
|
&Reply($client,"$total_size\n","$cmd:$ududir"); |
} else { |
} else { |
|
|
&Failure($client, "bad_directory:$ududir\n","$cmd:$ududir"); |
&Failure($client, "bad_directory:$ududir\n","$cmd:$ududir"); |
|
|
} |
} |
return 1; |
return 1; |
} |
} |
Line 1413 sub ls_handler {
|
Line 1414 sub ls_handler {
|
if(-d $ulsdir) { |
if(-d $ulsdir) { |
if (opendir(LSDIR,$ulsdir)) { |
if (opendir(LSDIR,$ulsdir)) { |
while ($ulsfn=readdir(LSDIR)) { |
while ($ulsfn=readdir(LSDIR)) { |
undef $obs, $rights; |
undef($obs); |
|
undef($rights); |
my @ulsstats=stat($ulsdir.'/'.$ulsfn); |
my @ulsstats=stat($ulsdir.'/'.$ulsfn); |
#We do some obsolete checking here |
#We do some obsolete checking here |
if(-e $ulsdir.'/'.$ulsfn.".meta") { |
if(-e $ulsdir.'/'.$ulsfn.".meta") { |
Line 1480 sub ls2_handler {
|
Line 1482 sub ls2_handler {
|
if(-d $ulsdir) { |
if(-d $ulsdir) { |
if (opendir(LSDIR,$ulsdir)) { |
if (opendir(LSDIR,$ulsdir)) { |
while ($ulsfn=readdir(LSDIR)) { |
while ($ulsfn=readdir(LSDIR)) { |
undef $obs, $rights; |
undef($obs); |
|
undef($rights); |
my @ulsstats=stat($ulsdir.'/'.$ulsfn); |
my @ulsstats=stat($ulsdir.'/'.$ulsfn); |
#We do some obsolete checking here |
#We do some obsolete checking here |
if(-e $ulsdir.'/'.$ulsfn.".meta") { |
if(-e $ulsdir.'/'.$ulsfn.".meta") { |
Line 4402 sub ReadHostTable {
|
Line 4405 sub ReadHostTable {
|
open (CONFIG,"$perlvar{'lonTabDir'}/hosts.tab") || die "Can't read host file"; |
open (CONFIG,"$perlvar{'lonTabDir'}/hosts.tab") || die "Can't read host file"; |
my $myloncapaname = $perlvar{'lonHostID'}; |
my $myloncapaname = $perlvar{'lonHostID'}; |
Debug("My loncapa name is : $myloncapaname"); |
Debug("My loncapa name is : $myloncapaname"); |
|
my %name_to_ip; |
while (my $configline=<CONFIG>) { |
while (my $configline=<CONFIG>) { |
if ($configline !~ /^\s*\#/ && $configline !~ /^\s*$/ ) { |
if ($configline !~ /^\s*\#/ && $configline !~ /^\s*$/ ) { |
my ($id,$domain,$role,$name)=split(/:/,$configline); |
my ($id,$domain,$role,$name)=split(/:/,$configline); |
$name=~s/\s//g; |
$name=~s/\s//g; |
my $ip = gethostbyname($name); |
my $ip; |
if (length($ip) ne 4) { |
if (!exists($name_to_ip{$name})) { |
&logthis("Skipping host $id name $name no IP $ip found\n"); |
$ip = gethostbyname($name); |
next; |
if (!$ip || length($ip) ne 4) { |
|
&logthis("Skipping host $id name $name no IP found\n"); |
|
next; |
|
} |
|
$ip=inet_ntoa($ip); |
|
$name_to_ip{$name} = $ip; |
|
} else { |
|
$ip = $name_to_ip{$name}; |
} |
} |
$ip=inet_ntoa($ip); |
|
$hostid{$ip}=$id; # LonCAPA name of host by IP. |
$hostid{$ip}=$id; # LonCAPA name of host by IP. |
$hostdom{$id}=$domain; # LonCAPA domain name of host. |
$hostdom{$id}=$domain; # LonCAPA domain name of host. |
$hostip{$id}=$ip; # IP address of host. |
$hostip{$id}=$ip; # IP address of host. |
Line 4855 sub make_new_child {
|
Line 4865 sub make_new_child {
|
# my $tmpsnum=0; # Now global |
# my $tmpsnum=0; # Now global |
#---------------------------------------------------- kerberos 5 initialization |
#---------------------------------------------------- kerberos 5 initialization |
&Authen::Krb5::init_context(); |
&Authen::Krb5::init_context(); |
if ($dist ne 'fedora4') { |
unless (($dist eq 'fedora4') || ($dist eq 'suse9.3')) { |
&Authen::Krb5::init_ets(); |
&Authen::Krb5::init_ets(); |
} |
} |
|
|
Line 5466 sub thisversion {
|
Line 5476 sub thisversion {
|
sub subscribe { |
sub subscribe { |
my ($userinput,$clientip)=@_; |
my ($userinput,$clientip)=@_; |
my $result; |
my $result; |
my ($cmd,$fname)=split(/:/,$userinput); |
my ($cmd,$fname)=split(/:/,$userinput,2); |
my $ownership=&ishome($fname); |
my $ownership=&ishome($fname); |
if ($ownership eq 'owner') { |
if ($ownership eq 'owner') { |
# explitly asking for the current version? |
# explitly asking for the current version? |