📄 misc-tools.lib
字号:
## Subroutines Section : main subroutines are the createTable wich ## creates the base Table with the main row ( with Descriptions ),## the addFile wich adds a Row with the File description and date of## creations and so on, and the subVars ehich substitutes the variables## name contained in the $page var with their correct values.sub configError { my @keys = @_; my $err = $keys[0]; print $query->start_html(-title=>"Administration Error", -BGCOLOR=>"#FFFFFF"); print "<CENTER><BR><HR WIDTH=80%><BR></CENTER>"; print "<OL><OL><H1><FONT COLOR=red>Error 690 </FONT></H1>"; print "<OL> <B>Configuration Error</B>. $err.</OL></OL></OL>"; closePage(); die "Error Trapped: $err";}sub printCopyRight { my @keys = @_; my $ret; ## Close the Table $ret .= "<BR><CENTER>"; $ret .= "© 1999 by Massimiliano Pala and the OpenCA Group."; $ret .= "</CENTER>\n"; return $ret;}sub closePage { print "\n\n"; print "</PRE><CENTER><HR WIDTH=80%></CENTER>\n"; print "<FONT SIZE=\"+0\">"; print "<CENTER>© 1998/1999 by Massimiliano Pala"; print " and the OpenCA Group</CENTER></FONT>\n"; return;}sub getRequired { ## Returns required parameter SINGLE STRING VALUE ## this function simplifies the parameter access ## but returns only the first parameter my $name = $_[0]; my $tmp; if( ($tmp = $config->getParam($name)) == undef ) { ## If there is an Error, just send the missing ## parameter error to the browser configError( "Missing Configuration Keyword : $name" ); } ## If all gone well we should have the value string in ## $ret and return it to the calling funcion; $ret = $tmp->{VALUES}->[0]; return $ret;}sub getCertStatusCRL { ## Get certificat Status. Please install the ## needed patch if you are using OpenSSL 0.9.3+ ## Refer to documentation for more info. my @keys = @_; return undef unless $keys[0]; my $serial = $keys[0]; my $status = "Valid"; ## Get Required Parameter my $openssl = getRequired( 'openssl' ); my $crlDir = getRequired( 'CRLDir' ); ## Build command for OpenSSL my $crlCMD = "$openssl crl -noout -text -in $crlDir/cacrl.pem 2>&1"; open( CMD, "$crlCMD|" ) or configError( "CRL checking Error!" ); while( $l = <CMD> ) { if ($l =~ /Serial Number\:/) { ($serialno) = ( $l =~ /Serial Number:[\s]+([0-9A-Fa-f]+)/i ); if ($serialno eq $serialn) { my $tmpDate = <CMD>; $tmpDate =~ s/Revocation Date: //i; $status = "Revoked on $tmpDate"; break; } } } close(CMD); return $status;}sub addEntry { my $key = shift @_; my $val = shift @_; my $ret; $ret = '<TR VALIGN=TOP BGCOLOR="#FFFFFF">'."\n"; $ret .= "<TD><B>$key</B></TD>"; $ret .= '<TD>'. "$val" . '</TD>'; $ret .= "</TR>";}1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -