Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.1379 and 1.1380

version 1.1379, 2018/07/18 13:45:03 version 1.1380, 2018/08/07 17:12:25
Line 13629  sub fetch_crl_pemfile { Line 13629  sub fetch_crl_pemfile {
   
 sub save_crl_pem {  sub save_crl_pem {
     my ($response) = @_;      my ($response) = @_;
     my $msg;      my ($msg,$hadchanges);
     if (ref($response)) {      if (ref($response)) {
         my $now = time;          my $now = time;
         my $lonca = $perlvar{'lonCertificateDirectory'}.'/'.$perlvar{'lonnetCertificateAuthority'};          my $lonca = $perlvar{'lonCertificateDirectory'}.'/'.$perlvar{'lonnetCertificateAuthority'};
Line 13644  sub save_crl_pem { Line 13644  sub save_crl_pem {
                     chomp($check);                      chomp($check);
                     if ($check eq 'verify OK') {                      if ($check eq 'verify OK') {
                         my $dest = "$perlvar{'lonCertificateDirectory'}/$perlvar{'lonnetCertRevocationList'}";                          my $dest = "$perlvar{'lonCertificateDirectory'}/$perlvar{'lonnetCertRevocationList'}";
                           my $backup;
                         if (-e $dest) {                          if (-e $dest) {
                             &File::Copy::move($dest,"$dest.bak");                              if (&File::Copy::move($dest,"$dest.bak")) {
                                   $backup = 'ok';
                               }
                         }                          }
                         if (&File::Copy::move($tmpcrl,$dest)) {                          if (&File::Copy::move($tmpcrl,$dest)) {
                             $msg = 'ok';                              $msg = 'ok';
                               if ($backup) {
                                   my (%oldnums,%newnums);
                                   if (open(PIPE, "openssl crl -inform PEM -text -noout -in $dest.bak |grep 'Serial Number' |")) {
                                       while (<PIPE>) {
                                           $oldnums{(split(/:/))[1]} = 1;
                                       }
                                       close(PIPE);
                                   }
                                   if (open(PIPE, "openssl crl -inform PEM -text -noout -in $dest |grep 'Serial Number' |")) {
                                       while(<PIPE>) {
                                           $newnums{(split(/:/))[1]} = 1;
                                       }
                                       close(PIPE);
                                   }
                                   foreach my $key (sort {$b <=> $a } (keys(%newnums))) {
                                       unless (exists($oldnums{$key})) {
                                           $hadchanges = 1;
                                           last;
                                       }
                                   }
                                   unless ($hadchanges) {
                                       foreach my $key (sort {$b <=> $a } (keys(%oldnums))) {
                                           unless (exists($newnums{$key})) {
                                               $hadchanges = 1;
                                               last;
                                           }
                                       }
                                   }
                               }
                         }                          }
                     } else {                      } else {
                         unlink($tmpcrl);                          unlink($tmpcrl);
Line 13661  sub save_crl_pem { Line 13693  sub save_crl_pem {
             }              }
         }          }
     }      }
     return $msg;      return ($msg,$hadchanges);
 }  }
   
 # ------------------------------------------------------------ Read domain file  # ------------------------------------------------------------ Read domain file

Removed from v.1.1379  
changed lines
  Added in v.1.1380


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>