[LON-CAPA-dev] Re: cron job auto enrollment

Stuart Peter Raeburn lon-capa-dev@mail.lon-capa.org
Wed, 17 Mar 2004 18:49:18 -0500


Hon-Kie, 

Thank you for your e-mail. 

The message you are seeing
"Authentication mismatch for xxxxxx - localauth: in system, localauth based 
on information in classlist or default for this course." is being generated 
because line 348 in /home/httpd/lib/perl/LONCAPA/Enrollment.pm needs 
modification. 


if ($currentauth=~/^krb(4|5):/) {
   $currentauth=~/^krb(4|5):(.*)/;
   $krbdefdom=$1;
}
if ($currentauth=~/^krb(4|5):/ ||      <--- line 348
   $currentauth=~/^unix:/ ||
   $currentauth=~/^internal:/ ||
   $currentauth=~/^localauth:/) {

} else {
   $$logmsg .= "Invalid authentication method $currentauth for 
$uname.".$linefeed;
} 

should be REPLACED with: 

if ($currentauth=~/^krb(4|5):/) {
   $currentauth=~/^krb(4|5):(.*)/;
   $krbdefdom=$1;
}
elsif ($currentauth=~ /^(unix|internal|localauth):/   <-- line 348
   $currentauth = $1;
} else {
   $$logmsg .= "Invalid authentication method $currentauth for 
$uname.".$linefeed;
} 


************************ 

Five other changes are also required in Enrollment.pm that affect LON-CAPA 
domains that are employing either internal authentication or local 
authentication. 

line 266:
if ($authtype eq "int") {
CHANGE TO
if ($auth eq "internal") { 

line 275:
} elsif ($authtype eq "local") {
CHANGE TO
} elsif ($auth eq "localauth") { 

line 277:
} elsif ($authtype =~ m/^krb/) {
CHANGE TO
} elsif ($auth =~ m/^krb/) { 

Add a new line (273) after line 272
} else {
   $create_passwd = 1;   <--- line 272
   $authchk = 'ok';      <--- NEW LINE 

line 542
   my @letts = 
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s", 
"t","u","v","w","x","y","z";
CHANGE TO
   my @letts = 
("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s" 
,"t","u","v","w","x","y","z"); 

These changes will be committed to CVS in a few minutes once final testing 
is complete.  It would be my hope that the updated version of 
LONCAPA::Enrollment.pm could be included in maintenance release 1.1.3. 

Stuart 

Stuart Raeburn
MSU LON-CAPA support/development 


P. S.
Guy, 

Thank you for your note about line 247 (below).  However, the suggested 
switch for this particular line will not address the issue reported by 
Hon-Kie, as its cause lies elsewhere (line 348).

Line 247:
Replace
if ($auth =~ m/^krb/) {
   $auth .= ":".$authparam;  <--- line 247
} 

with 

if ($auth =~ m/^krb/) {
   $auth.=':'.$authparam;   <---  line 247
} 

As you suggest, it is probably better to use single quotes here rather than 
double quotes as we are not interpolating anything, but this code will work 
fine with either type of quote. 


Guy Albertelli II writes: 

> Hi Hon-Kie, 
> 
>> Authentication mismatch for xxxxxx - localauth: in system, localauth based 
>> on information in classlist or default for this course.
> 
> Autoenroll.pl has a bug. 
> 
> Stuart, 
> 
> Enrollment.pm  line 247 does 
> 
>                     if ($auth =~ m/^krb/) {
>                         $auth .= ":".$authparam;
>                     } 
> 
> It should do: 
> 
>                     $auth.=':'.$authparm; 
> 
> 
> -- 
> guy@albertelli.com  LON-CAPA Developer  0-7-4-7-
> _______________________________________________
> LON-CAPA-dev mailing list
> LON-CAPA-dev@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev 
>