⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exportreqs

📁 Perl写的CA认证程序
💻
字号:
## OpenCA - RA Server Command## (c) 1998-2001 by Massimiliano Pala and OpenCA Group####   File Name: exportReqs##       Brief: Export Approved Requests## Description: Exports to removable media Approved Requests waiting##              to be approved by the CA##  Parameters: if ( $cmd !~ /exportReqs/i ) {        configError( "Wrong Command Usage ($cmd/importReqs)!" );        exit 1;}## GNU Tar suggested for exporting Certification Request## to the CA. We use the GNU tar because of its availability## for all the platforms and its stability.my $tmpdir = getRequired( 'TempDir' );print $query->start_html(-title=>"Requests Exporting Page",                                 -BGCOLOR=>"#FFFFFF");## Get required parameters from the configuration filemy $cmd  = getRequired( 'CreateArchive' );my $test = getRequired( 'TestArchive' );my $dev  = getRequired( 'ExportDev' );my $bak  = getRequired( 'ExportBackup' );my $dir  = "$tmpdir/${$}_exp.dir";## my $curDir = cwd();umask( 0077 );mkdir ( "$dir" );if( $? != 0 ) {	configError( "Error while creating temp exporting dir ($dir)!");};my @reqList = $db->listItems( DATATYPE=>"APPROVED_REQUEST" );foreach $req (@reqList) {	my $key = $req->getParsed->{DBKEY};	my $fileName = "${dir}/${key}.req";	open( FD, ">$fileName" ) or die ("Cannot write to $fileName!");		print FD $req->{req};	close( FD );}## Subtitute $orig and $dest$cmd = $query->subVar( $cmd, '$dest', $dev );$test = $query->subVar( $test, '$dest', $dev );print startLogPage("Approved Requests Exporting");print addLogSection("Requests Exporting .... ");if( not chdir( "$dir" )) {	addErrorLog( "Failed changing dir to $dir." );	closePage();	exit 1;} $ret = `$cmd . 2>&1`;if( $? != 0 ) {	print addErrorLog( "Archiving Failed on $dev!", "$ret" );	closePage();	exit;} print addLogLine( "Ok." );print addPreLogLine( $ret );print closeLogSection();print addLogSection("Testing Created Archive ... ");$ret = `$test 2>&1`;if( $? != 0 ) {	print addErrorLog( "Check Failed on $dev!" );	closePage();	exit;}print addLogLine( "Ok." );print addPreLogLine( $ret );print closeLogSection();print addLogSection("Deleting temporary files .... ");$tools->deleteFiles( DIR=>$dir, FILTER=>"*.req" );print addLogLine("Ok.");print closeLogSection();print addLogSection("Removing temporary dir .... ");rmdir( "$dir" );if( $? != 0 ) {	print addErrorLog( "Removing Failed!" );	closePage();	exit;}print addLogLine("Ok.");print closeLogSection();print addLogSection( "Archiving Exported Request(s) ... " );my @reqList = $db->listItems( DATATYPE=>"APPROVED_REQUEST" );foreach $req (@reqList) {	my $key = $req->getParsed->{DBKEY};	## Store reqs in the archivied reqs dB	if ( not $db->updateStatus( DATATYPE=>"APPROVED_REQUEST", 			NEWTYPE=>"ARCHIVIED_REQUEST", OBJECT=>$req)) {		print addErrorLog("Error archiving request $key!");		closePage();		exit 1;	}	}print addLogLine("Ok.");print closeLogSection();closePage();1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -