version 1.533, 2017/03/13 18:30:02
|
version 1.536, 2017/05/09 03:04:21
|
Line 229 my %trust = (
|
Line 229 my %trust = (
|
dump => {remote => 1, enroll => 1, domroles => 1}, |
dump => {remote => 1, enroll => 1, domroles => 1}, |
edit => {institutiononly => 1}, #not used currently |
edit => {institutiononly => 1}, #not used currently |
eget => {remote => 1, domroles => 1, enroll => 1}, #not used currently |
eget => {remote => 1, domroles => 1, enroll => 1}, #not used currently |
|
egetdom => {remote => 1, domroles => 1, enroll => 1, }, |
ekey => {}, #not used currently |
ekey => {}, #not used currently |
exit => {anywhere => 1}, |
exit => {anywhere => 1}, |
fetchuserfile => {remote => 1, enroll => 1}, |
fetchuserfile => {remote => 1, enroll => 1}, |
Line 265 my %trust = (
|
Line 266 my %trust = (
|
putstore => {remote => 1, enroll => 1}, |
putstore => {remote => 1, enroll => 1}, |
queryreply => {anywhere => 1}, |
queryreply => {anywhere => 1}, |
querysend => {anywhere => 1}, |
querysend => {anywhere => 1}, |
|
querysend_activitylog => {remote => 1}, |
|
querysend_allusers => {remote => 1, domroles => 1}, |
|
querysend_courselog => {remote => 1}, |
|
querysend_fetchenrollment => {remote => 1}, |
|
querysend_getinstuser => {remote => 1}, |
|
querysend_getmultinstusers => {remote => 1}, |
|
querysend_instdirsearch => {remote => 1, domroles => 1, coaurem => 1}, |
|
querysend_institutionalphotos => {remote => 1}, |
|
querysend_portfolio_metadata => {remote => 1, content => 1}, |
|
querysend_userlog => {remote => 1, domroles => 1}, |
|
querysend_usersearch => {remote => 1, enroll => 1, coaurem => 1}, |
quit => {anywhere => 1}, |
quit => {anywhere => 1}, |
readlonnetglobal => {institutiononly => 1}, |
readlonnetglobal => {institutiononly => 1}, |
reinit => {manageronly => 1}, #not used currently |
reinit => {manageronly => 1}, #not used currently |
Line 3382 sub get_profile_entry {
|
Line 3394 sub get_profile_entry {
|
# |
# |
# Parameters: |
# Parameters: |
# $cmd - Command keyword of request (eget). |
# $cmd - Command keyword of request (eget). |
# $tail - Tail of the command. See GetProfileEntry
# for more information about this. |
# $tail - Tail of the command. See GetProfileEntry |
|
# for more information about this. |
# $client - File open on the client. |
# $client - File open on the client. |
# Returns: |
# Returns: |
# 1 - Continue processing |
# 1 - Continue processing |
Line 3954 sub retrieve_chat_handler {
|
Line 3967 sub retrieve_chat_handler {
|
# serviced. |
# serviced. |
# |
# |
# Parameters: |
# Parameters: |
# $cmd - COmmand keyword that initiated the request. |
# $cmd - Command keyword that initiated the request. |
# $tail - Remainder of the command after the keyword. |
# $tail - Remainder of the command after the keyword. |
# For this function, this consists of a query and |
# For this function, this consists of a query and |
# 3 arguments that are self-documentingly labelled |
# 3 arguments that are self-documentingly labelled |
Line 3968 sub retrieve_chat_handler {
|
Line 3981 sub retrieve_chat_handler {
|
sub send_query_handler { |
sub send_query_handler { |
my ($cmd, $tail, $client) = @_; |
my ($cmd, $tail, $client) = @_; |
|
|
|
|
my $userinput = "$cmd:$tail"; |
my $userinput = "$cmd:$tail"; |
|
|
my ($query,$arg1,$arg2,$arg3)=split(/\:/,$tail); |
my ($query,$arg1,$arg2,$arg3)=split(/\:/,$tail); |
$query=~s/\n*$//g; |
$query=~s/\n*$//g; |
|
if (($query eq 'usersearch') || ($query eq 'instdirsearch')) { |
|
my $usersearchconf = &get_usersearch_config($currentdomainid,'directorysrch'); |
|
my $earlyout; |
|
if (ref($usersearchconf) eq 'HASH') { |
|
if ($currentdomainid eq $clienthomedom) { |
|
if ($query eq 'usersearch') { |
|
if ($usersearchconf->{'lcavailable'} eq '0') { |
|
$earlyout = 1; |
|
} |
|
} else { |
|
if ($usersearchconf->{'available'} eq '0') { |
|
$earlyout = 1; |
|
} |
|
} |
|
} else { |
|
if ($query eq 'usersearch') { |
|
if ($usersearchconf->{'lclocalonly'}) { |
|
$earlyout = 1; |
|
} |
|
} else { |
|
if ($usersearchconf->{'localonly'}) { |
|
$earlyout = 1; |
|
} |
|
} |
|
} |
|
} |
|
if ($earlyout) { |
|
&Reply($client, "query_not_authorized\n"); |
|
return 1; |
|
} |
|
} |
&Reply($client, "". &sql_reply("$clientname\&$query". |
&Reply($client, "". &sql_reply("$clientname\&$query". |
"\&$arg1"."\&$arg2"."\&$arg3")."\n", |
"\&$arg1"."\&$arg2"."\&$arg3")."\n", |
$userinput); |
$userinput); |
Line 4835 sub get_domain_handler {
|
Line 4878 sub get_domain_handler {
|
my ($cmd, $tail, $client) = @_; |
my ($cmd, $tail, $client) = @_; |
|
|
|
|
my $userinput = "$client:$tail"; |
my $userinput = "$cmd:$tail"; |
|
|
|
my ($udom,$namespace,$what)=split(/:/,$tail,3); |
|
chomp($what); |
|
if ($namespace =~ /^enc/) { |
|
&Failure( $client, "refused\n", $userinput); |
|
} else { |
|
my @queries=split(/\&/,$what); |
|
my $qresult=''; |
|
my $hashref = &tie_domain_hash($udom, "$namespace", &GDBM_READER()); |
|
if ($hashref) { |
|
for (my $i=0;$i<=$#queries;$i++) { |
|
$qresult.="$hashref->{$queries[$i]}&"; |
|
} |
|
if (&untie_domain_hash($hashref)) { |
|
$qresult=~s/\&$//; |
|
&Reply($client, \$qresult, $userinput); |
|
} else { |
|
&Failure( $client, "error: ".($!+0)." untie(GDBM) Failed ". |
|
"while attempting getdom\n",$userinput); |
|
} |
|
} else { |
|
&Failure($client, "error: ".($!+0)." tie(GDBM) Failed ". |
|
"while attempting getdom\n",$userinput); |
|
} |
|
} |
|
|
|
return 1; |
|
} |
|
®ister_handler("getdom", \&get_domain_handler, 0, 1, 0); |
|
|
|
sub encrypted_get_domain_handler { |
|
my ($cmd, $tail, $client) = @_; |
|
|
|
my $userinput = "$cmd:$tail"; |
|
|
my ($udom,$namespace,$what)=split(/:/,$tail,3); |
my ($udom,$namespace,$what)=split(/:/,$tail,3); |
chomp($what); |
chomp($what); |
Line 4848 sub get_domain_handler {
|
Line 4925 sub get_domain_handler {
|
} |
} |
if (&untie_domain_hash($hashref)) { |
if (&untie_domain_hash($hashref)) { |
$qresult=~s/\&$//; |
$qresult=~s/\&$//; |
&Reply($client, \$qresult, $userinput); |
if ($cipher) { |
|
my $cmdlength=length($qresult); |
|
$qresult.=" "; |
|
my $encqresult=''; |
|
for (my $encidx=0;$encidx<=$cmdlength;$encidx+=8) { |
|
$encqresult.= unpack("H16", |
|
$cipher->encrypt(substr($qresult, |
|
$encidx, |
|
8))); |
|
} |
|
&Reply( $client, "enc:$cmdlength:$encqresult\n", $userinput); |
|
} else { |
|
&Failure( $client, "error:no_key\n", $userinput); |
|
} |
} else { |
} else { |
&Failure( $client, "error: ".($!+0)." untie(GDBM) Failed ". |
&Failure( $client, "error: ".($!+0)." untie(GDBM) Failed ". |
"while attempting getdom\n",$userinput); |
"while attempting egetdom\n",$userinput); |
} |
} |
} else { |
} else { |
&Failure($client, "error: ".($!+0)." tie(GDBM) Failed ". |
&Failure($client, "error: ".($!+0)." tie(GDBM) Failed ". |
"while attempting getdom\n",$userinput); |
"while attempting egetdom\n",$userinput); |
} |
} |
|
|
return 1; |
return 1; |
} |
} |
®ister_handler("getdom", \&get_domain_handler, 0, 1, 0); |
®ister_handler("egetdom", \&encrypted_get_domain_handler, 1, 1, 0); |
|
|
# |
# |
# Puts an id to a domains id database. |
# Puts an id to a domains id database. |
Line 5760 sub auto_export_grades_handler {
|
Line 5849 sub auto_export_grades_handler {
|
return 1; |
return 1; |
} |
} |
®ister_handler("autoexportgrades", \&auto_export_grades_handler, |
®ister_handler("autoexportgrades", \&auto_export_grades_handler, |
0, 1, 0); |
1, 1, 0); |
|
|
# Retrieve and remove temporary files created by/during autoenrollment. |
# Retrieve and remove temporary files created by/during autoenrollment. |
# |
# |
Line 6511 sub process_request {
|
Line 6600 sub process_request {
|
$ok = 0; |
$ok = 0; |
} |
} |
if ($ok) { |
if ($ok) { |
|
my $realcommand = $command; |
|
if ($command eq 'querysend') { |
|
my ($query,$rest)=split(/\:/,$tail,2); |
|
$query=~s/\n*$//g; |
|
my @possqueries = |
|
qw(userlog courselog fetchenrollment institutionalphotos usersearch instdirsearch getinstuser getmultinstusers); |
|
if (grep(/^\Q$query\E$/,@possqueries)) { |
|
$command .= '_'.$query; |
|
} elsif ($query eq 'prepare activity log') { |
|
$command .= '_activitylog'; |
|
} |
|
} |
if (ref($trust{$command}) eq 'HASH') { |
if (ref($trust{$command}) eq 'HASH') { |
my $donechecks; |
my $donechecks; |
if ($trust{$command}{'anywhere'}) { |
if ($trust{$command}{'anywhere'}) { |
Line 6552 sub process_request {
|
Line 6653 sub process_request {
|
} |
} |
} |
} |
} |
} |
|
$command = $realcommand; |
} |
} |
|
|
if($ok) { |
if($ok) { |
Line 8266 sub get_usersession_config {
|
Line 8368 sub get_usersession_config {
|
} |
} |
return; |
return; |
} |
} |
|
|
|
sub get_usersearch_config { |
|
my ($dom,$name) = @_; |
|
my ($usersearchconf,$cached)=&Apache::lonnet::is_cached_new($name,$dom); |
|
if (defined($cached)) { |
|
return $usersearchconf; |
|
} else { |
|
my %domconfig = &Apache::lonnet::get_dom('configuration',['directorysrch'],$dom); |
|
&Apache::lonnet::do_cache_new($name,$dom,$domconfig{'directorysrch'},600); |
|
return $domconfig{'directorysrch'}; |
|
} |
|
return; |
|
} |
|
|
sub get_prohibited { |
sub get_prohibited { |
my ($dom) = @_; |
my ($dom) = @_; |