version 1.489.2.42, 2021/12/14 14:16:13
|
version 1.489.2.47, 2024/12/29 16:44:03
|
Line 1795 sub read_lonnet_global {
|
Line 1795 sub read_lonnet_global {
|
} |
} |
if ($what eq 'perlvar') { |
if ($what eq 'perlvar') { |
if (!exists($packagevars{$what}{'lonBalancer'})) { |
if (!exists($packagevars{$what}{'lonBalancer'})) { |
if ($dist =~ /^(centos|rhes|fedora|scientific|oracle)/) { |
if ($dist =~ /^(centos|rhes|fedora|scientific|oracle|rocky|alma)/) { |
my $othervarref=LONCAPA::Configuration::read_conf('httpd.conf'); |
my $othervarref=LONCAPA::Configuration::read_conf('httpd.conf'); |
if (ref($othervarref) eq 'HASH') { |
if (ref($othervarref) eq 'HASH') { |
$items->{'lonBalancer'} = $othervarref->{'lonBalancer'}; |
$items->{'lonBalancer'} = $othervarref->{'lonBalancer'}; |
Line 2407 sub update_passwd_history {
|
Line 2407 sub update_passwd_history {
|
return; |
return; |
} |
} |
|
|
|
sub inst_unamemap_check { |
|
my ($cmd, $tail, $client) = @_; |
|
my $userinput = "$cmd:$tail"; |
|
my %rulecheck; |
|
my $outcome; |
|
my ($udom,$uname,@rules) = split(/:/,$tail); |
|
$udom = &unescape($udom); |
|
$uname = &unescape($uname); |
|
@rules = map {&unescape($_);} (@rules); |
|
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
$outcome = &localenroll::unamemap_check($udom,$uname,\@rules,\%rulecheck); |
|
}; |
|
if (!$@) { |
|
if ($outcome eq 'ok') { |
|
my $result=''; |
|
foreach my $key (keys(%rulecheck)) { |
|
$result.=&escape($key).'='.&Apache::lonnet::freeze_escape($rulecheck{$key}).'&'; |
|
} |
|
&Reply($client,\$result,$userinput); |
|
} else { |
|
&Reply($client,"error\n", $userinput); |
|
} |
|
} else { |
|
&Failure($client,"unknown_cmd\n",$userinput); |
|
} |
|
} |
|
®ister_handler("instunamemapcheck",\&inst_unamemap_check,0,1,0); |
|
|
|
|
# |
# |
# Determines if this is the home server for a user. The home server |
# Determines if this is the home server for a user. The home server |
# for a user will have his/her lon-capa passwd file. Therefore all we need |
# for a user will have his/her lon-capa passwd file. Therefore all we need |
Line 5461 sub enrollment_enabled_handler {
|
Line 5491 sub enrollment_enabled_handler {
|
my ($cmd, $tail, $client) = @_; |
my ($cmd, $tail, $client) = @_; |
my $userinput = $cmd.":".$tail; # For logging purposes. |
my $userinput = $cmd.":".$tail; # For logging purposes. |
|
|
|
|
my ($cdom) = split(/:/, $tail, 2); # Domain we're asking about. |
my ($cdom) = split(/:/, $tail, 2); # Domain we're asking about. |
|
my $outcome; |
my $outcome = &localenroll::run($cdom); |
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
$outcome = &localenroll::run($cdom); |
|
}; |
&Reply($client, \$outcome, $userinput); |
&Reply($client, \$outcome, $userinput); |
|
|
return 1; |
return 1; |
} |
} |
®ister_handler("autorun", \&enrollment_enabled_handler, 0, 1, 0); |
®ister_handler("autorun", \&enrollment_enabled_handler, 0, 1, 0); |
Line 5499 sub validate_instcode_handler {
|
Line 5530 sub validate_instcode_handler {
|
my ($dom,$instcode,$owner) = split(/:/, $tail); |
my ($dom,$instcode,$owner) = split(/:/, $tail); |
$instcode = &unescape($instcode); |
$instcode = &unescape($instcode); |
$owner = &unescape($owner); |
$owner = &unescape($owner); |
my ($outcome,$description,$credits) = |
my ($outcome,$description,$credits); |
&localenroll::validate_instcode($dom,$instcode,$owner); |
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
($outcome,$description,$credits) = |
|
&localenroll::validate_instcode($dom,$instcode,$owner); |
|
}; |
my $result = &escape($outcome).'&'.&escape($description).'&'. |
my $result = &escape($outcome).'&'.&escape($description).'&'. |
&escape($credits); |
&escape($credits); |
&Reply($client, \$result, $userinput); |
&Reply($client, \$result, $userinput); |
Line 5534 sub validate_instcrosslist_handler {
|
Line 5569 sub validate_instcrosslist_handler {
|
$instcode = &unescape($instcode); |
$instcode = &unescape($instcode); |
$inst_xlist = &unescape($inst_xlist); |
$inst_xlist = &unescape($inst_xlist); |
$coowner = &unescape($coowner); |
$coowner = &unescape($coowner); |
my $outcome = &localenroll::validate_crosslist_access($dom,$instcode, |
my $outcome; |
$inst_xlist,$coowner); |
eval { |
&Reply($client, \$outcome, $userinput); |
local($SIG{__DIE__})='DEFAULT'; |
|
$outcome = &localenroll::validate_crosslist_access($dom,$instcode, |
|
$inst_xlist,$coowner); |
|
}; |
|
|
|
&Reply($client, \$outcome, $userinput); |
return 1; |
return 1; |
} |
} |
®ister_handler("autovalidateinstcrosslist", \&validate_instcrosslist_handler, 0, 1, 0); |
®ister_handler("autovalidateinstcrosslist", \&validate_instcrosslist_handler, 0, 1, 0); |
Line 5560 sub get_sections_handler {
|
Line 5599 sub get_sections_handler {
|
my $userinput = "$cmd:$tail"; |
my $userinput = "$cmd:$tail"; |
|
|
my ($coursecode, $cdom) = split(/:/, $tail); |
my ($coursecode, $cdom) = split(/:/, $tail); |
my @secs = &localenroll::get_sections($coursecode,$cdom); |
my $seclist; |
my $seclist = &escape(join(':',@secs)); |
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
my @secs = &localenroll::get_sections($coursecode,$cdom); |
|
$seclist = &escape(join(':',@secs)); |
|
}; |
&Reply($client, \$seclist, $userinput); |
&Reply($client, \$seclist, $userinput); |
|
|
|
|
return 1; |
return 1; |
} |
} |
®ister_handler("autogetsections", \&get_sections_handler, 0, 1, 0); |
®ister_handler("autogetsections", \&get_sections_handler, 0, 1, 0); |
Line 5585 sub get_sections_handler {
|
Line 5625 sub get_sections_handler {
|
# Returns: |
# Returns: |
# 1 - Processing should continue. |
# 1 - Processing should continue. |
# |
# |
|
|
sub validate_course_owner_handler { |
sub validate_course_owner_handler { |
my ($cmd, $tail, $client) = @_; |
my ($cmd, $tail, $client) = @_; |
my $userinput = "$cmd:$tail"; |
my $userinput = "$cmd:$tail"; |
Line 5592 sub validate_course_owner_handler {
|
Line 5633 sub validate_course_owner_handler {
|
|
|
$owner = &unescape($owner); |
$owner = &unescape($owner); |
$coowners = &unescape($coowners); |
$coowners = &unescape($coowners); |
my $outcome = &localenroll::new_course($inst_course_id,$owner,$cdom,$coowners); |
my $outcome; |
|
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
$outcome = &localenroll::new_course($inst_course_id,$owner,$cdom,$coowners); |
|
}; |
&Reply($client, \$outcome, $userinput); |
&Reply($client, \$outcome, $userinput); |
|
|
|
|
|
|
return 1; |
return 1; |
} |
} |
®ister_handler("autonewcourse", \&validate_course_owner_handler, 0, 1, 0); |
®ister_handler("autonewcourse", \&validate_course_owner_handler, 0, 1, 0); |
Line 5622 sub validate_course_section_handler {
|
Line 5664 sub validate_course_section_handler {
|
my ($cmd, $tail, $client) = @_; |
my ($cmd, $tail, $client) = @_; |
my $userinput = "$cmd:$tail"; |
my $userinput = "$cmd:$tail"; |
my ($inst_course_id, $cdom) = split(/:/, $tail); |
my ($inst_course_id, $cdom) = split(/:/, $tail); |
|
my $outcome; |
my $outcome=&localenroll::validate_courseID($inst_course_id,$cdom); |
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
$outcome=&localenroll::validate_courseID($inst_course_id,$cdom); |
|
}; |
&Reply($client, \$outcome, $userinput); |
&Reply($client, \$outcome, $userinput); |
|
|
|
|
return 1; |
return 1; |
} |
} |
®ister_handler("autovalidatecourse", \&validate_course_section_handler, 0, 1, 0); |
®ister_handler("autovalidatecourse", \&validate_course_section_handler, 0, 1, 0); |
Line 5793 sub create_auto_enroll_password_handler
|
Line 5836 sub create_auto_enroll_password_handler
|
my ($authparam, $cdom) = split(/:/, $userinput); |
my ($authparam, $cdom) = split(/:/, $userinput); |
|
|
my ($create_passwd,$authchk); |
my ($create_passwd,$authchk); |
($authparam, |
eval { |
$create_passwd, |
local($SIG{__DIE__})='DEFAULT'; |
$authchk) = &localenroll::create_password($authparam,$cdom); |
($authparam, |
|
$create_passwd, |
|
$authchk) = &localenroll::create_password($authparam,$cdom); |
|
}; |
&Reply($client, &escape($authparam.':'.$create_passwd.':'.$authchk)."\n", |
&Reply($client, &escape($authparam.':'.$create_passwd.':'.$authchk)."\n", |
$userinput); |
$userinput); |
|
|
Line 6032 sub get_institutional_code_format_handle
|
Line 6077 sub get_institutional_code_format_handle
|
my ($key,$value) = split/=/,$_; |
my ($key,$value) = split/=/,$_; |
$instcodes{&unescape($key)} = &unescape($value); |
$instcodes{&unescape($key)} = &unescape($value); |
} |
} |
my $formatreply = &localenroll::instcode_format($cdom, |
my $formatreply; |
\%instcodes, |
eval { |
\%codes, |
local($SIG{__DIE__})='DEFAULT'; |
\@codetitles, |
$formatreply = &localenroll::instcode_format($cdom, |
\%cat_titles, |
\%instcodes, |
\%cat_order); |
\%codes, |
|
\@codetitles, |
|
\%cat_titles, |
|
\%cat_order); |
|
}; |
if ($formatreply eq 'ok') { |
if ($formatreply eq 'ok') { |
my $codes_str = &Apache::lonnet::hash2str(%codes); |
my $codes_str = &Apache::lonnet::hash2str(%codes); |
my $codetitles_str = &Apache::lonnet::array2str(@codetitles); |
my $codetitles_str = &Apache::lonnet::array2str(@codetitles); |
Line 6097 sub get_possible_instcodes_handler {
|
Line 6146 sub get_possible_instcodes_handler {
|
my $reply; |
my $reply; |
my $cdom = $tail; |
my $cdom = $tail; |
my (@codetitles,%cat_titles,%cat_order,@code_order); |
my (@codetitles,%cat_titles,%cat_order,@code_order); |
my $formatreply = &localenroll::possible_instcodes($cdom, |
my $formatreply; |
\@codetitles, |
eval { |
\%cat_titles, |
local($SIG{__DIE__})='DEFAULT'; |
\%cat_order, |
$formatreply = &localenroll::possible_instcodes($cdom, |
\@code_order); |
\@codetitles, |
|
\%cat_titles, |
|
\%cat_order, |
|
\@code_order); |
|
}; |
if ($formatreply eq 'ok') { |
if ($formatreply eq 'ok') { |
my $result = join('&',map {&escape($_);} (@codetitles)).':'; |
my $result = join('&',map {&escape($_);} (@codetitles)).':'; |
$result .= join('&',map {&escape($_);} (@code_order)).':'; |
$result .= join('&',map {&escape($_);} (@code_order)).':'; |
Line 6225 sub get_institutional_selfcreate_rules {
|
Line 6278 sub get_institutional_selfcreate_rules {
|
} |
} |
®ister_handler("instemailrules",\&get_institutional_selfcreate_rules,0,1,0); |
®ister_handler("instemailrules",\&get_institutional_selfcreate_rules,0,1,0); |
|
|
|
sub get_unamemap_rules { |
|
my ($cmd, $tail, $client) = @_; |
|
my $userinput = "$cmd:$tail"; |
|
my $dom = &unescape($tail); |
|
my (%rules_hash,@rules_order); |
|
my $outcome; |
|
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
$outcome = &localenroll::unamemap_rules($dom,\%rules_hash,\@rules_order); |
|
}; |
|
if (!$@) { |
|
if ($outcome eq 'ok') { |
|
my $result; |
|
foreach my $key (keys(%rules_hash)) { |
|
$result .= &escape($key).'='.&Apache::lonnet::freeze_escape($rules_hash{$key}).'&'; |
|
} |
|
$result =~ s/\&$//; |
|
$result .= ':'; |
|
if (@rules_order > 0) { |
|
foreach my $item (@rules_order) { |
|
$result .= &escape($item).'&'; |
|
} |
|
} |
|
$result =~ s/\&$//; |
|
&Reply($client,\$result,$userinput); |
|
} else { |
|
&Reply($client,"error\n", $userinput); |
|
} |
|
} else { |
|
&Failure($client,"unknown_cmd\n",$userinput); |
|
} |
|
} |
|
®ister_handler("unamemaprules",\&get_unamemap_rules,0,1,0); |
|
|
sub institutional_username_check { |
sub institutional_username_check { |
my ($cmd, $tail, $client) = @_; |
my ($cmd, $tail, $client) = @_; |
Line 6747 undef $perlvarref;
|
Line 6833 undef $perlvarref;
|
# ----------------------------- Make sure this process is running from user=www |
# ----------------------------- Make sure this process is running from user=www |
my $wwwid=getpwnam('www'); |
my $wwwid=getpwnam('www'); |
if ($wwwid!=$<) { |
if ($wwwid!=$<) { |
my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
my $emailto="$perlvar{'lonAdmEMail'} $perlvar{'lonSysEMail'}"; |
my $subj="LON: $currenthostid User ID mismatch"; |
my $subj="LON: $currenthostid User ID mismatch"; |
system("echo 'User ID mismatch. lond must be run as user www.' |". |
system("echo 'User ID mismatch. lond must be run as user www.' |". |
" mail -s '$subj' $emailto > /dev/null"); |
" mail -s '$subj' $emailto > /dev/null"); |
Line 7200 sub make_new_child {
|
Line 7286 sub make_new_child {
|
&Authen::Krb5::init_context(); |
&Authen::Krb5::init_context(); |
|
|
my $no_ets; |
my $no_ets; |
if ($dist =~ /^(?:centos|rhes|scientific|oracle)(\d+)$/) { |
if ($dist =~ /^(?:centos|rhes|scientific|oracle|rocky|alma)(\d+)/) { |
if ($1 >= 7) { |
if ($1 >= 7) { |
$no_ets = 1; |
$no_ets = 1; |
} |
} |
Line 7603 sub validate_user {
|
Line 7689 sub validate_user {
|
} elsif ((($domdefaults{'auth_def'} eq 'krb4') || |
} elsif ((($domdefaults{'auth_def'} eq 'krb4') || |
($domdefaults{'auth_def'} eq 'krb5')) && |
($domdefaults{'auth_def'} eq 'krb5')) && |
($domdefaults{'auth_arg_def'} ne '')) { |
($domdefaults{'auth_arg_def'} ne '')) { |
$howpwd = $domdefaults{'auth_def'}; |
# |
$contentpwd = $domdefaults{'auth_arg_def'}; |
# Don't attempt authentication for username and password supplied |
|
# for user without an account if uername contains @ to avoid |
|
# call to &Authen::Krb5::parse_name() which will result in con_lost |
|
# |
|
unless ($user =~ /\@/) { |
|
$howpwd = $domdefaults{'auth_def'}; |
|
$contentpwd = $domdefaults{'auth_arg_def'}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 7948 sub currentversion {
|
Line 8041 sub currentversion {
|
if (-e $ulsdir) { |
if (-e $ulsdir) { |
if(-d $ulsdir) { |
if(-d $ulsdir) { |
if (opendir(LSDIR,$ulsdir)) { |
if (opendir(LSDIR,$ulsdir)) { |
|
if (-e $fname) { |
|
$version=0; |
|
} |
my $ulsfn; |
my $ulsfn; |
while ($ulsfn=readdir(LSDIR)) { |
while ($ulsfn=readdir(LSDIR)) { |
# see if this is a regular file (ignore links produced earlier) |
# see if this is a regular file (ignore links produced earlier) |