version 1.951, 2008/03/24 04:55:54
|
version 1.953, 2008/03/28 14:52:57
|
Line 705 sub queryauthenticate {
|
Line 705 sub queryauthenticate {
|
# --------- Try to authenticate user from domain's lib servers (first this one) |
# --------- Try to authenticate user from domain's lib servers (first this one) |
|
|
sub authenticate { |
sub authenticate { |
my ($uname,$upass,$udom)=@_; |
my ($uname,$upass,$udom,$checkdefauth)=@_; |
$upass=&escape($upass); |
$upass=&escape($upass); |
$uname= &LONCAPA::clean_username($uname); |
$uname= &LONCAPA::clean_username($uname); |
my $uhome=&homeserver($uname,$udom,1); |
my $uhome=&homeserver($uname,$udom,1); |
|
my $newhome; |
if ((!$uhome) || ($uhome eq 'no_host')) { |
if ((!$uhome) || ($uhome eq 'no_host')) { |
# Maybe the machine was offline and only re-appeared again recently? |
# Maybe the machine was offline and only re-appeared again recently? |
&reconlonc(); |
&reconlonc(); |
# One more |
# One more |
my $uhome=&homeserver($uname,$udom,1); |
$uhome=&homeserver($uname,$udom,1); |
|
if (($uhome eq 'no_host') && $checkdefauth) { |
|
if (defined(&domain($udom,'primary'))) { |
|
$newhome=&domain($udom,'primary'); |
|
} |
|
if ($newhome ne '') { |
|
$uhome = $newhome; |
|
} |
|
} |
if ((!$uhome) || ($uhome eq 'no_host')) { |
if ((!$uhome) || ($uhome eq 'no_host')) { |
&logthis("User $uname at $udom is unknown in authenticate"); |
&logthis("User $uname at $udom is unknown in authenticate"); |
} |
return 'no_host'; |
return 'no_host'; |
} |
} |
} |
my $answer=reply("encrypt:auth:$udom:$uname:$upass",$uhome); |
my $answer=reply("encrypt:auth:$udom:$uname:$upass:$checkdefauth",$uhome); |
if ($answer eq 'authorized') { |
if ($answer eq 'authorized') { |
&logthis("User $uname at $udom authorized by $uhome"); |
if ($newhome) { |
return $uhome; |
&logthis("User $uname at $udom authorized by $uhome, but needs account"); |
|
return 'no_account_on_host'; |
|
} else { |
|
&logthis("User $uname at $udom authorized by $uhome"); |
|
return $uhome; |
|
} |
} |
} |
if ($answer eq 'non_authorized') { |
if ($answer eq 'non_authorized') { |
&logthis("User $uname at $udom rejected by $uhome"); |
&logthis("User $uname at $udom rejected by $uhome"); |
Line 1679 sub ssi_body {
|
Line 1693 sub ssi_body {
|
if (! exists($form{'LONCAPA_INTERNAL_no_discussion'})) { |
if (! exists($form{'LONCAPA_INTERNAL_no_discussion'})) { |
$form{'LONCAPA_INTERNAL_no_discussion'}='true'; |
$form{'LONCAPA_INTERNAL_no_discussion'}='true'; |
} |
} |
my $output=($filelink=~/^http\:/?&externalssi($filelink): |
my $output=''; |
&ssi($filelink,%form)); |
my $response; |
|
if ($filelink=~/^http\:/) { |
|
$output=&externalssi($filelink); |
|
} else { |
|
($output,$response)=&ssi($filelink,%form); |
|
} |
$output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs; |
$output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs; |
$output=~s/^.*?\<body[^\>]*\>//si; |
$output=~s/^.*?\<body[^\>]*\>//si; |
$output=~s/\<\/body\s*\>.*?$//si; |
$output=~s/\<\/body\s*\>.*?$//si; |
return $output; |
if (wantarray) { |
|
return ($output, $response); |
|
} else { |
|
return $output; |
|
} |
} |
} |
|
|
# --------------------------------------------------------- Server Side Include |
# --------------------------------------------------------- Server Side Include |