LibreOffice Module onlineupdate (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ArchiveReader Class Reference

#include <archivereader.h>

Collaboration diagram for ArchiveReader:
[legend]

Public Member Functions

 ArchiveReader ()
 
 ~ArchiveReader ()
 
int Open (const NS_tchar *path)
 
int VerifySignature ()
 Performs a verification on the opened MAR file. More...
 
int VerifyProductInformation (const char *MARChannelID, const char *appVersion)
 Verifies that the MAR file matches the current product, channel, and version. More...
 
void Close ()
 
int ExtractFile (const char *item, const NS_tchar *destination)
 
int ExtractFileToStream (const char *item, FILE *fp)
 

Private Member Functions

int ExtractItemToStream (const MarItem *item, FILE *fp)
 

Private Attributes

MarFilemArchive
 

Detailed Description

Definition at line 15 of file archivereader.h.

Constructor & Destructor Documentation

◆ ArchiveReader()

ArchiveReader::ArchiveReader ( )
inline

Definition at line 18 of file archivereader.h.

◆ ~ArchiveReader()

ArchiveReader::~ArchiveReader ( )
inline

Definition at line 19 of file archivereader.h.

References Close().

Member Function Documentation

◆ Close()

void ArchiveReader::Close ( )

Definition at line 233 of file archivereader.cxx.

References inbuf, mar_close(), mArchive, and outbuf.

Referenced by Open(), and ~ArchiveReader().

◆ ExtractFile()

int ArchiveReader::ExtractFile ( const char *  item,
const NS_tchar destination 
)

◆ ExtractFileToStream()

int ArchiveReader::ExtractFileToStream ( const char *  item,
FILE fp 
)

Definition at line 280 of file archivereader.cxx.

References ExtractItemToStream(), mar_find_item(), mArchive, name, and READ_ERROR.

Referenced by PatchFile::Prepare().

◆ ExtractItemToStream()

int ArchiveReader::ExtractItemToStream ( const MarItem item,
FILE fp 
)
private

◆ Open()

int ArchiveReader::Open ( const NS_tchar path)

◆ VerifyProductInformation()

int ArchiveReader::VerifyProductInformation ( const char *  MARChannelID,
const char *  appVersion 
)

Verifies that the MAR file matches the current product, channel, and version.

Parameters
MARChannelIDThe MAR channel name to use, only updates from MARs with a matching MAR channel name will succeed. If an empty string is passed, no check will be done for the channel name in the product information block. If a comma separated list of values is passed then one value must match.
appVersionThe application version to use, only MARs with an application version >= to appVersion will be applied.
Returns
OK on success COULD_NOT_READ_PRODUCT_INFO_BLOCK if the product info block could not be read. MARCHANNEL_MISMATCH_ERROR if update-settings.ini's MAR channel ID doesn't match the MAR file's MAR channel ID. VERSION_DOWNGRADE_ERROR if the application version for this updater is newer than the one in the MAR.

Definition at line 126 of file archivereader.cxx.

References ARCHIVE_NOT_OPEN, mozilla::CompareVersions(), COULD_NOT_READ_PRODUCT_INFO_BLOCK_ERROR, MAR_CHANNEL_MISMATCH_ERROR, mar_read_product_info_block(), ProductInformationBlock::MARChannelID, mArchive, OK, ProductInformationBlock::productVersion, and VERSION_DOWNGRADE_ERROR.

Referenced by CheckSignature().

◆ VerifySignature()

int ArchiveReader::VerifySignature ( )

Performs a verification on the opened MAR file.

Both the primary and backup keys stored are stored in the current process and at least the primary key will be tried. Success will be returned as long as one of the two signatures verify.

Returns
OK on success

Definition at line 81 of file archivereader.cxx.

References ARCHIVE_NOT_OPEN, mArchive, OK, and VerifyLoadedCert().

Referenced by CheckSignature().

Member Data Documentation

◆ mArchive

MarFile* ArchiveReader::mArchive
private

The documentation for this class was generated from the following files: