## OpenCA - CA Command
## (c) 1998-2001 by OpenCA Group
##
##   File Name: nodeDownloadCRL
##     Version: $Revision: 1.3 $
##       Brief: imports CRL
## Description: imports from a removable media

require "$common_libs/export-import.lib";

sub cmdNodeDownloadCRL {

	print startLogPage ( gettext("Importing all CRLs from a higher level of the hierarchy ...") );

	my $tmp = createDirectory ();
	if (not eximIODownload ( $tmp )) {
		print addPreLogSection ("<FONT COLOR=#FF0000>".
			gettext ("Cannot extract archive from import device!").
			"</FONT>");
		print closeLogSection ();
		print closeLogPage ();
		return undef;
	}
	if (withLDAPsupport() and withLDAPautomatic()) {
		eximDownloadCRLs          ( TMP => $tmp, LDAP => "1" );
	} else {
		eximDownloadCRLs          ( TMP => $tmp, LDAP => "0" );
	}
	eximDownloadCommit ( $tmp );
	removeDirectory    ( $tmp );

	closePage ();

	return 1;
}

1;
