From e653e8305891535e898511e78a3e5187f4893385 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Tue, 11 Apr 2017 21:23:25 -0700 Subject: [PATCH 001/110] Expanded exception handling for file operations during a check, plus some refactoring & cleanup --- src/fs/fsdatasourceiter.cpp | 67 ++++--- src/fs/fsdatasourceiter.h | 9 +- src/fs/fserrors.cpp | 2 +- src/fs/fspropcalc.cpp | 363 ++++++++++++++++++++---------------- src/fs/fspropcalc.h | 16 +- 5 files changed, 271 insertions(+), 186 deletions(-) diff --git a/src/fs/fsdatasourceiter.cpp b/src/fs/fsdatasourceiter.cpp index 7308621..c63cc91 100644 --- a/src/fs/fsdatasourceiter.cpp +++ b/src/fs/fsdatasourceiter.cpp @@ -42,7 +42,6 @@ #include "fsdatasourceiter.h" #include "fco/fcodatasourceiter.h" #include "fsobject.h" -#include "core/fsservices.h" #include "core/errorbucket.h" #include "core/corestrings.h" #include "core/usernotify.h" @@ -99,6 +98,12 @@ static bool gCrossFileSystems = false; gCrossFileSystems = crossFS; } +void cFSDataSourceIter::AddIterationError(const eError& e) +{ + if(mpErrorBucket) + mpErrorBucket->AddError(e); +} + /////////////////////////////////////////////////////////////////////////////// // CreateCopy /////////////////////////////////////////////////////////////////////////////// @@ -151,15 +156,42 @@ void cFSDataSourceIter::GetChildrenNames( const TSTRING& strParentName, std::vec } catch( eError& e ) { - cDebug d("cFSDataSourceIter::GeneratePeers"); - d.TraceError("**** ReadDir failed for %s\n", strParentName.c_str() ); - - if( mpErrorBucket ) - { - eFSDataSourceIterReadDir eReadDir(e.GetMsg(), eError::NON_FATAL); - mpErrorBucket->AddError( eReadDir ); - } + AddIterationError( eFSDataSourceIterReadDir( strParentName, e.GetMsg(), eError::NON_FATAL) ); } + catch( std::exception& e ) + { + AddIterationError( eFSDataSourceIterReadDir( strParentName, e.what(), eError::NON_FATAL) ); + } + catch(...) + { + AddIterationError( eFSDataSourceIterReadDir( strParentName, "unknown", eError::NON_FATAL) ); + } +} + +bool cFSDataSourceIter::DoStat( const TSTRING& name, cFSStatArgs& statArgs ) +{ + try + { + iFSServices::GetInstance()->Stat( name, statArgs); + } + catch(eError& e) + { + e.SetFatality(false); + AddIterationError(e); + return false; + } + catch(std::exception& e) + { + AddIterationError( eFSDataSourceIter( name, e.what(), eError::NON_FATAL) ); + return false; + } + catch(...) + { + AddIterationError( eFSDataSourceIter( name, "unknown", eError::NON_FATAL) ); + return false; + } + + return true; } /////////////////////////////////////////////////////////////////////////////// @@ -173,30 +205,15 @@ bool cFSDataSourceIter::InitializeTypeInfo(iFCO* pFCO) if( pObj->GetFSPropSet().GetValidVector().ContainsItem( cFSPropSet::PROP_FILETYPE) ) return true; - // // assume invalid by default... // cFSPropSet& propSet = pObj->GetFSPropSet(); propSet.SetFileType(cFSPropSet::FT_INVALID); cFSStatArgs statArgs; - try - { - iFSServices::GetInstance()->Stat( pTrans->ToStringAPI( pObj->GetName() ), statArgs); - } - catch(eError& e) - { - cDebug d("CreateObject"); - d.TraceError( "*** Stat of %s failed!!!\n", pObj->GetName().AsString().c_str() ); - if( mpErrorBucket ) - { - e.SetFatality( false ); - mpErrorBucket->AddError( e ); - } + if( !DoStat( pObj->GetName().AsString(), statArgs )) return false; - } - // // don't create the object if it is on a different file system... // if( gCrossFileSystems == false && (mDev != 0) && (statArgs.dev != mDev) ) diff --git a/src/fs/fsdatasourceiter.h b/src/fs/fsdatasourceiter.h index b4f0eee..e97bc58 100644 --- a/src/fs/fsdatasourceiter.h +++ b/src/fs/fsdatasourceiter.h @@ -39,9 +39,11 @@ // INCLUDES //========================================================================= #include "fco/fcodatasourceiterimpl.h" +#include "core/fileerror.h" +#include "core/fsservices.h" -TSS_EXCEPTION( eFSDataSourceIter, eError ) -TSS_EXCEPTION( eFSDataSourceIterReadDir, eFSDataSourceIter ) +TSS_FILE_EXCEPTION( eFSDataSourceIter, eFileError ) +TSS_FILE_EXCEPTION( eFSDataSourceIterReadDir, eFSDataSourceIter ) //========================================================================= @@ -83,6 +85,9 @@ private: virtual iFCO* CreateObject(const cFCOName& name, bool bCreatingPeers ); virtual bool InitializeTypeInfo(iFCO* pFCO) ; + + void AddIterationError(const eError& e); + bool DoStat(const TSTRING& name, cFSStatArgs& statArgs); }; #endif //__FSDATASOURCEITER_H diff --git a/src/fs/fserrors.cpp b/src/fs/fserrors.cpp index e494057..d5c2e2a 100644 --- a/src/fs/fserrors.cpp +++ b/src/fs/fserrors.cpp @@ -43,7 +43,7 @@ TSS_BEGIN_ERROR_REGISTRATION( fs ) -TSS_REGISTER_ERROR( eFSPropCalc(), _T("NTFS property calculation error.") ) +TSS_REGISTER_ERROR( eFSPropCalc(), _T("Property calculation error.") ) //TSS_REGISTER_ERROR( eFSPropCalcResetAccessTime(), _T("Could not reset access time for file.") ) TSS_REGISTER_ERROR( eFSDataSourceIter(), _T("Data source iterator error.") ) TSS_REGISTER_ERROR( eFSDataSourceIterReadDir(), _T("Could not access directory contents.") ) diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index f575bfd..ad4063a 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -35,13 +35,10 @@ #include "stdfs.h" #include "core/debug.h" #include "core/errorbucket.h" -#include "core/fsservices.h" #include "core/errorbucket.h" #include "fco/fconame.h" #include "fco/fconametranslator.h" #include "fco/twfactory.h" -#include "core/archive.h" - #include "fspropcalc.h" #include "fsobject.h" @@ -88,17 +85,15 @@ static bool NeedsStat(const cFCOPropVector& v) /////////////////////////////////////////////////////////////////////////////// -static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch) +static bool GetSymLinkStr(const TSTRING& strName, cArchive& arch) { - char buf[1024]; + char buf[1024]; // TODO: is this big enough? #if defined(O_PATH) - int fd = open(iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( fileName ).c_str(), - (O_PATH | O_NOFOLLOW | O_NOATIME)); + int fd = open(strName.c_str(), (O_PATH | O_NOFOLLOW | O_NOATIME)); int rtn = readlinkat(fd, 0, buf, 1024); close(fd); #else - int rtn = readlink( iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( fileName ).c_str(), - buf, 1024 ); + int rtn = readlink( strName.c_str(), buf, 1024 ); #endif if(rtn == -1) @@ -110,127 +105,154 @@ static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch) return true; } - -/////////////////////////////////////////////////////////////////////////////// -// VisitFSObject -- this is the workhorse method that actually fills out the -// passed in FSObject' properties -/////////////////////////////////////////////////////////////////////////////// -void cFSPropCalc::VisitFSObject(cFSObject& obj) +void cFSPropCalc::AddPropCalcError(const eError& e) { - cDebug d("cFSPropCalc::VisitFSObject"); - d.TraceDetail(_T("Visiting %s\n"), obj.GetName().AsString().c_str()); + if(mpErrorBucket) + mpErrorBucket->AddError(e); +} - // if we are not in overwrite mode, we need to alter the - // properties we are calculating... - cFCOPropVector propsToCheck(mPropVector); - if(mCollAction == iFCOPropCalc::PROP_LEAVE) - { - cFCOPropVector inBoth = propsToCheck; - inBoth &= obj.GetPropSet()->GetValidVector(); - propsToCheck ^= inBoth; - } - -#ifdef _DEBUG - d.TraceDetail("----->Collision Action = %s\n", mCollAction == iFCOPropCalc::PROP_LEAVE ? "Leave" : "Replace"); - d.TraceDetail("----->Object's valid properties (a):\n"); - obj.GetPropSet()->GetValidVector().TraceContents(cDebug::D_DETAIL); - d.TraceDetail("----->Properties to calculate: (b)\n"); - mPropVector.TraceContents(cDebug::D_DETAIL); - d.TraceDetail("----->Properties to change in object ((a&b)^b for Leave or b for Replace):\n"); - propsToCheck.TraceContents(cDebug::D_DETAIL); -#endif //_DEBUG - - // only do the stat() if it is necessary - iFSServices* pFSServices = iFSServices::GetInstance(); - cFSStatArgs ss; - bool bDidStat = false; - TSTRING strName = iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( obj.GetName() ); - - // get a reference to the fco's property set - cFSPropSet& propSet = obj.GetFSPropSet(); +bool cFSPropCalc::DoStat( const TSTRING& strName, cFSStatArgs& statArgs ) +{ + cDebug d("cFSPropCalc::DoStat"); - // - // just return if this object is invalid - // - if( propSet.GetFileType() == cFSPropSet::FT_INVALID ) - return; - try { - if( NeedsStat(propsToCheck) ) - { - d.TraceDetail("---Performing Stat()\n"); - pFSServices->Stat(strName, ss); - bDidStat = true; - } + d.TraceDetail("---Performing Stat()\n"); + iFSServices::GetInstance()->Stat(strName, statArgs); } catch(eError& e) { d.TraceError("Error getting stat info for %s : %s\n", strName.c_str(), e.GetMsg().c_str()); - - // add this fco to the error set... - // it is assumed that the file name that the error is associated with is in the exception's - // GetMsg() - e.SetFatality( false ); - if(mpErrorBucket) - mpErrorBucket->AddError( e ); - return; + e.SetFatality(false); + AddPropCalcError(e); + return false; + } + catch(std::exception& e) + { + d.TraceError("Error getting stat info for %s : %s\n", strName.c_str(), e.what()); + AddPropCalcError( eFSPropCalc( strName, e.what(), eError::NON_FATAL ) ); + return false; + } + catch(...) + { + d.TraceError("Unknown error getting stat info for %s\n", strName.c_str()); + AddPropCalcError( eFSPropCalc( strName, "unknown", eError::NON_FATAL ) ); + return false; } - // for now, I will only fill out the stat info indicated in the property vector, - // but in reality, there is no reason not to fill out everything, since we have the - // extra information for free! - if(bDidStat) + return true; +} + +bool cFSPropCalc::DoOpen( const TSTRING& strName, cFileArchive& arch ) +{ + try { - if(propsToCheck.ContainsItem(cFSPropSet::PROP_DEV)) - propSet.SetDev(ss.dev); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_RDEV)) - propSet.SetRDev(ss.rdev); + arch.OpenRead(strName.c_str(), ((mCalcFlags & iFCOPropCalc::DIRECT_IO) ? + cFileArchive::FA_SCANNING | cFileArchive::FA_DIRECT : + cFileArchive::FA_SCANNING) ); + } + catch (eError&) + { + AddPropCalcError( eArchiveOpen( strName, iFSServices::GetInstance()->GetErrString(), eError::NON_FATAL)); + return false; + } + catch (std::exception& e) + { + AddPropCalcError( eArchiveOpen( strName, e.what(), eError::NON_FATAL ) ); + return false; + } + catch (...) + { + AddPropCalcError( eArchiveOpen( strName, "unknown", eError::NON_FATAL ) ); + return false; + } - if(propsToCheck.ContainsItem(cFSPropSet::PROP_INODE)) - propSet.SetInode(ss.ino); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_MODE)) - propSet.SetMode(ss.mode); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_NLINK)) - propSet.SetNLink(ss.nlink); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_UID)) - propSet.SetUID(ss.uid); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_GID)) - propSet.SetGID(ss.gid); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_SIZE)) - propSet.SetSize(ss.size); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_ATIME)) - propSet.SetAccessTime(ss.atime); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_MTIME)) - propSet.SetModifyTime(ss.mtime); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_CTIME)) - propSet.SetCreateTime(ss.ctime); + return true; +} - if(propsToCheck.ContainsItem(cFSPropSet::PROP_BLOCK_SIZE)) - propSet.SetBlockSize(ss.blksize); - - if(propsToCheck.ContainsItem(cFSPropSet::PROP_BLOCKS)) - propSet.SetBlocks(ss.blocks); +bool cFSPropCalc::DoHash( const TSTRING& strName, cBidirArchive* pTheArch, cArchiveSigGen& asg, cFileArchive& arch ) +{ + cDebug d("cFSPropCalc::DoHash"); + try + { + pTheArch->Seek( 0, cBidirArchive::BEGINNING ); + asg.CalculateSignatures( *pTheArch ); + arch.Close(); + } + catch (eError& e) + { + d.TraceError("Error generating hashes for %s : %s\n", strName.c_str(), e.GetMsg().c_str()); + e.SetFatality(false); + AddPropCalcError(e); + return false; + } + catch (std::exception& e) + { + d.TraceError("Error generating hashes for %s : %s\n", strName.c_str(), e.what()); + AddPropCalcError( eArchiveRead( strName, e.what(), eError::NON_FATAL ) ); + return false; + } + catch (...) + { + d.TraceError("Unknown error generating hashes for %s\n", strName.c_str()); + AddPropCalcError( eArchiveRead( strName, "unknown", eError::NON_FATAL ) ); + return false; + } + + return true; +} - if(propsToCheck.ContainsItem(cFSPropSet::PROP_GROWING_FILE)) - propSet.SetGrowingFile(ss.size); +void cFSPropCalc::HandleStatProperties( const cFCOPropVector& propsToCheck, const cFSStatArgs& ss, cFSPropSet& propSet) +{ + if(propsToCheck.ContainsItem(cFSPropSet::PROP_DEV)) + propSet.SetDev(ss.dev); - if(propsToCheck.ContainsItem(cFSPropSet::PROP_FILETYPE)) + if(propsToCheck.ContainsItem(cFSPropSet::PROP_RDEV)) + propSet.SetRDev(ss.rdev); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_INODE)) + propSet.SetInode(ss.ino); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_MODE)) + propSet.SetMode(ss.mode); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_NLINK)) + propSet.SetNLink(ss.nlink); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_UID)) + propSet.SetUID(ss.uid); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_GID)) + propSet.SetGID(ss.gid); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_SIZE)) + propSet.SetSize(ss.size); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_ATIME)) + propSet.SetAccessTime(ss.atime); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_MTIME)) + propSet.SetModifyTime(ss.mtime); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_CTIME)) + propSet.SetCreateTime(ss.ctime); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_BLOCK_SIZE)) + propSet.SetBlockSize(ss.blksize); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_BLOCKS)) + propSet.SetBlocks(ss.blocks); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_GROWING_FILE)) + propSet.SetGrowingFile(ss.size); + + if(propsToCheck.ContainsItem(cFSPropSet::PROP_FILETYPE)) + { + // TODO -- It _really_ bites duplicating code here and in fsdatasource.cpp + // *** This _has_ to be remedied somehow! + // set the file type + switch(ss.mFileType) { - // TODO -- It _really_ bites duplicating code here and in fsdatasource.cpp - // *** This _has_ to be remedied somehow! - // set the file type - switch(ss.mFileType) - { case cFSStatArgs::TY_FILE: propSet.SetFileType(cFSPropSet::FT_FILE); break; @@ -261,10 +283,12 @@ void cFSPropCalc::VisitFSObject(cFSObject& obj) default: // set it to invalid propSet.SetFileType(cFSPropSet::FT_INVALID); - } - } + } } +} +void cFSPropCalc::HandleHashes( const cFCOPropVector& propsToCheck, const TSTRING& strName, cFSPropSet& propSet) +{ bool hash_success = false; // if the file type is not a regular file, we will @@ -273,45 +297,31 @@ void cFSPropCalc::VisitFSObject(cFSObject& obj) if( propSet.GetFileType() == cFSPropSet::FT_FILE || propSet.GetFileType() == cFSPropSet::FT_SYMLINK ) { if( // if we need to open the file - propsToCheck.ContainsItem(cFSPropSet::PROP_CRC32) || - propsToCheck.ContainsItem(cFSPropSet::PROP_MD5) || - propsToCheck.ContainsItem(cFSPropSet::PROP_SHA) || - propsToCheck.ContainsItem(cFSPropSet::PROP_HAVAL) - ) + propsToCheck.ContainsItem(cFSPropSet::PROP_CRC32) || + propsToCheck.ContainsItem(cFSPropSet::PROP_MD5) || + propsToCheck.ContainsItem(cFSPropSet::PROP_SHA) || + propsToCheck.ContainsItem(cFSPropSet::PROP_HAVAL) + ) { cFileArchive arch; cMemoryArchive memArch; - cBidirArchive* pTheArch; + cBidirArchive* pTheArch; hash_success = true; if(propSet.GetFileType() == cFSPropSet::FT_SYMLINK) { pTheArch = &memArch; - if(! GetSymLinkStr(obj.GetName(), memArch)) + if(! GetSymLinkStr(strName, memArch)) { // add it to the bucket... - if(mpErrorBucket) - mpErrorBucket->AddError( eArchiveOpen( strName, iFSServices::GetInstance()->GetErrString(), eError::NON_FATAL ) ); + AddPropCalcError( eArchiveOpen( strName, iFSServices::GetInstance()->GetErrString(), eError::NON_FATAL ) ); hash_success = false; } - } else { pTheArch = &arch; - try - { - arch.OpenRead(strName.c_str(), ((mCalcFlags & iFCOPropCalc::DIRECT_IO) ? - cFileArchive::FA_SCANNING | cFileArchive::FA_DIRECT : - cFileArchive::FA_SCANNING) ); - } - catch (eError&) - { - // add it to the bucket... - if(mpErrorBucket) - mpErrorBucket->AddError( eArchiveOpen( strName, iFSServices::GetInstance()->GetErrString(), eError::NON_FATAL ) ); - hash_success = false; - } + hash_success = DoOpen(strName, arch); } // @@ -326,43 +336,29 @@ void cFSPropCalc::VisitFSObject(cFSObject& obj) propSet.SetDefinedCRC32(true); asg.AddSig( propSet.GetCRC32() ); } - + if(propsToCheck.ContainsItem(cFSPropSet::PROP_MD5)) { propSet.SetDefinedMD5(true); asg.AddSig( propSet.GetMD5() ); } - + if(propsToCheck.ContainsItem(cFSPropSet::PROP_SHA)) { propSet.SetDefinedSHA(true); asg.AddSig( propSet.GetSHA() ); } - + if(propsToCheck.ContainsItem(cFSPropSet::PROP_HAVAL)) { propSet.SetDefinedHAVAL(true); asg.AddSig( propSet.GetHAVAL() ); } - + // // calculate the signatures // - try - { - pTheArch->Seek( 0, cBidirArchive::BEGINNING ); - asg.CalculateSignatures( *pTheArch ); - arch.Close(); - } - catch (eError& e) - { - d.TraceError("Error generating hashes for %s : %s\n", strName.c_str(), e.GetMsg().c_str()); - - e.SetFatality(false); - if(mpErrorBucket) - mpErrorBucket->AddError(e); - hash_success = false; - } + hash_success = DoHash(strName, pTheArch, asg, arch); } } } @@ -384,6 +380,59 @@ void cFSPropCalc::VisitFSObject(cFSObject& obj) } } +/////////////////////////////////////////////////////////////////////////////// +// VisitFSObject -- this is the workhorse method that actually fills out the +// passed in FSObject' properties +/////////////////////////////////////////////////////////////////////////////// +void cFSPropCalc::VisitFSObject(cFSObject& obj) +{ + cDebug d("cFSPropCalc::VisitFSObject"); + d.TraceDetail(_T("Visiting %s\n"), obj.GetName().AsString().c_str()); + + // if we are not in overwrite mode, we need to alter the + // properties we are calculating... + cFCOPropVector propsToCheck(mPropVector); + if(mCollAction == iFCOPropCalc::PROP_LEAVE) + { + cFCOPropVector inBoth = propsToCheck; + inBoth &= obj.GetPropSet()->GetValidVector(); + propsToCheck ^= inBoth; + } + +#ifdef _DEBUG + d.TraceDetail("----->Collision Action = %s\n", mCollAction == iFCOPropCalc::PROP_LEAVE ? "Leave" : "Replace"); + d.TraceDetail("----->Object's valid properties (a):\n"); + obj.GetPropSet()->GetValidVector().TraceContents(cDebug::D_DETAIL); + d.TraceDetail("----->Properties to calculate: (b)\n"); + mPropVector.TraceContents(cDebug::D_DETAIL); + d.TraceDetail("----->Properties to change in object ((a&b)^b for Leave or b for Replace):\n"); + propsToCheck.TraceContents(cDebug::D_DETAIL); +#endif //_DEBUG + + // only do the stat() if it is necessary + cFSStatArgs ss; + TSTRING strName = iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( obj.GetName() ); + + // get a reference to the fco's property set + cFSPropSet& propSet = obj.GetFSPropSet(); + + // + // just return if this object is invalid + // + if( propSet.GetFileType() == cFSPropSet::FT_INVALID ) + return; + + if( NeedsStat(propsToCheck) ) + { + if (!DoStat(strName, ss)) + return; + + HandleStatProperties(propsToCheck, ss, propSet); + } + + HandleHashes(propsToCheck, strName, propSet); +} + void cFSPropCalc::SetPropVector(const cFCOPropVector& pv) { mPropVector = pv; diff --git a/src/fs/fspropcalc.h b/src/fs/fspropcalc.h index 53a1eae..85afa41 100644 --- a/src/fs/fspropcalc.h +++ b/src/fs/fspropcalc.h @@ -47,7 +47,13 @@ #include "fco/fcopropvector.h" #endif -TSS_EXCEPTION( eFSPropCalc, eError ) +#include "fco/signature.h" +#include "core/fileerror.h" +#include "core/fsservices.h" +#include "core/archive.h" +#include "fspropset.h" + +TSS_FILE_EXCEPTION( eFSPropCalc, eFileError ) //TSS_EXCEPTION( eFSPropCalcResetAccessTime, eFSPropCalc ) // this was never used class cFSPropCalc : public iFCOPropCalc, public iFSVisitor @@ -78,6 +84,14 @@ private: cFSPropCalc( const cFSPropCalc& ); void operator =( const cFSPropCalc& ); + void AddPropCalcError(const eError& e); + + bool DoStat(const TSTRING& name, cFSStatArgs& statArgs); + bool DoOpen(const TSTRING& name, cFileArchive& arch); + bool DoHash( const TSTRING& name, cBidirArchive* pTheArch, cArchiveSigGen& asg, cFileArchive& arch ); + void HandleStatProperties( const cFCOPropVector& propsToCheck, const cFSStatArgs& ss, cFSPropSet& propSet); + void HandleHashes( const cFCOPropVector& propsToCheck, const TSTRING& strName, cFSPropSet& propSet); + cFCOPropVector mPropVector; iFCOPropCalc::CollisionAction mCollAction; int mCalcFlags; From a1e614d69435bd8c05831d85dc746ccc2f2e09c5 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Tue, 11 Apr 2017 21:29:32 -0700 Subject: [PATCH 002/110] Remove irritating 'eof:' comments, and some ancient dead code in stringutil.cpp --- src/core/charutil.cpp | 2 +- src/core/core.cpp | 2 +- src/core/corestrings.cpp | 2 +- src/core/displayutil.cpp | 2 +- src/core/ntmbs.cpp | 2 +- src/core/stdcore.cpp | 2 +- src/core/stringutil.cpp | 148 ----------------------------------- src/db/db.cpp | 1 - src/db/stddb.cpp | 2 +- src/fco/fco.cpp | 2 +- src/fco/fcostrings.cpp | 2 +- src/fco/fcoundefprop.cpp | 2 +- src/fco/stdfco.cpp | 2 +- src/fs/stdfs.cpp | 2 +- src/siggen/siggen.cpp | 2 +- src/siggen/siggenstrings.cpp | 2 +- src/siggen/stdsiggen.cpp | 2 +- src/tripwire/stdtripwire.cpp | 2 +- src/tripwire/tripwire.cpp | 2 +- src/tw/stdtw.cpp | 2 +- src/tw/tw.cpp | 2 +- src/tw/twstrings.cpp | 2 +- src/twadmin/stdtwadmin.cpp | 2 +- src/twadmin/twadmin.cpp | 2 +- src/twcrypto/stdtwcrypto.cpp | 2 +- src/twcrypto/twcrypto.cpp | 2 +- src/twparser/stdtwparser.cpp | 2 +- src/twprint/stdtwprint.cpp | 2 +- src/twprint/twprint.cpp | 2 +- src/twtest/codeconvert_t.cpp | 2 +- src/twtest/resources_t.cpp | 2 +- src/twtest/stdtest.cpp | 2 +- src/util/stdutil.cpp | 2 +- src/util/util.cpp | 2 +- src/util/utilstrings.cpp | 2 +- 35 files changed, 33 insertions(+), 182 deletions(-) diff --git a/src/core/charutil.cpp b/src/core/charutil.cpp index 48326b8..85f3a5b 100644 --- a/src/core/charutil.cpp +++ b/src/core/charutil.cpp @@ -150,4 +150,4 @@ bool cCharUtil::PopNextChar( TSTRING::const_iterator& cur, return f; } -// eof: charutil.cpp + diff --git a/src/core/core.cpp b/src/core/core.cpp index 453b509..966831b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -61,4 +61,4 @@ cCore::cCore() } -// eof: core.cpp + diff --git a/src/core/corestrings.cpp b/src/core/corestrings.cpp index 18d7648..a23492e 100644 --- a/src/core/corestrings.cpp +++ b/src/core/corestrings.cpp @@ -70,4 +70,4 @@ TSS_BeginStringtable( cCore ) TSS_EndStringtable( cCore ) -// eof: corestrings.cpp + diff --git a/src/core/displayutil.cpp b/src/core/displayutil.cpp index aa45571..23c3e5f 100644 --- a/src/core/displayutil.cpp +++ b/src/core/displayutil.cpp @@ -97,4 +97,4 @@ TSTRING cDisplayUtil::FormatMultiLineString( const TSTRING& str, int nOffset, in return( sstr.str() ); } -// eof: displayutil.cpp + diff --git a/src/core/ntmbs.cpp b/src/core/ntmbs.cpp index 94de08c..647d285 100644 --- a/src/core/ntmbs.cpp +++ b/src/core/ntmbs.cpp @@ -244,5 +244,5 @@ tss::mbscount( const_ntmbs_t psz ) return nCount; } -// eof: ntmbs.cpp + diff --git a/src/core/stdcore.cpp b/src/core/stdcore.cpp index 1798c5b..21f477d 100644 --- a/src/core/stdcore.cpp +++ b/src/core/stdcore.cpp @@ -37,4 +37,4 @@ #include "stdcore.h" -// eof: stdcore.cpp + diff --git a/src/core/stringutil.cpp b/src/core/stringutil.cpp index bb3fecc..d1b7f69 100644 --- a/src/core/stringutil.cpp +++ b/src/core/stringutil.cpp @@ -361,151 +361,3 @@ wc16_string cStringUtil::TstrToWstr( const TSTRING& rhs ) cStringUtil::Convert( lhs, rhs ); return lhs; } - -/////////////////////////////////////////////////////////////////////////////// -// StringIsInteger -- returns true if the string is a length of at least one -// and contains nothing other than [0-9]. -// Used to verify a string is acceptable to pass to atoi() -/////////////////////////////////////////////////////////////////////////////// -#ifdef OLDCODE -bool cStringUtil::StringIsInteger(TCHAR* pStr) -{ - int len = _tcslen(pStr); - - if (len <= 0) - return false; - - for (int i = 0; i < len; ++i) - { - if (pStr[i] < _T('0') || pStr[i] > _T('9')) - return false; - } - - return true; -} -#endif//OLDCODE - -// eof: stringutil.cpp - -/* - - -typedef wchar_t dbchar_t; -typedef char mbchar_t; - -class cMBUCS2Cache -{ -public: - cMBUCS2Cache(); - ~cMBUCS2Cache(); - - bool Convert(dbchar_t& ret, mbchar_t* pMBChar); - // returns false if conversion could not be done - void Add(mbchar_t* pMBchar, int mblen); - // add a mb char def to the chache - -protected: - struct Element - { - union - { - Element* mpNext; // points to another Element[256] - dbchar_t mUCS2; - }; - - enum ElementDefinition { UNDEFINED, UCS2, CONTINUES }; - short mElementDefinition; - - Element() { mElementDefinition = UNDEFINED; } - ~Element() { if (mElementDefinition == CONTINUES) delete mpNext; } - }; - - Element mTop[256]; -}; - - -cMBUCS2Cache::cMBUCS2Cache() -{ -} - -cMBUCS2Cache::~cMBUCS2Cache() -{ -} - -// returns false if conversion could not be done -bool cMBUCS2Cache::Convert(dbchar_t& ret, mbchar_t* pMBChar) -{ - Element* pNode = mTop; - while (pNode[*pMBChar].mElementDefinition == Element::CONTINUES) - { - pNode = pNode[*pMBChar].mpNext; - ++pMBChar; - } - - if (pNode[*pMBChar].mElementDefinition == Element::UCS2) - { - ret = pNode[*pMBChar].mUCS2; - return true; - } - - return false; -} - -// add a mb char def to the chache -void cMBUCS2Cache::Add(mbchar_t* pMBchar, int mblen, dbchar_t ucs2) -{ - ASSERT(mblen > 0); - - Element* pNode = mTop; - while (mblen > 1); - { - // this ASSERT fails if there is a UCS2 definition for a mbchar - // whose first few bytes are identical to this char - ASSERT(pNode[*pMBchar].mElementDefinition == Element::UNDEFINED || - pNode[*pMBchar].mElementDefinition == Element::CONTINUES) - - if (pNode[*pMBchar].mElementDefinition == Element::UNDEFINED) - { - pNode[*pMBchar].mElementDefinition = Element::CONINUES; - pNode = pNode[*pMBchar].mpNext = new Element[256]; - } - else - { - pNode = pNode[*pMBchar].mpNext; - } - - --mblen; - ++pMBChar; - } - - // this assert makes sure everything is sane - ASSERT(pNode[*pMBchar].mElementDefinition == Element::UNDEFINED || - (pNode[*pMBchar].mElementDefinition == Element::UCS2 && pNode[*pMBchar].mUCS2 == ucs2)); - - // this assert fails if we attempt to add the same mbchar twice - ASSERT(pNode[*pMBchar].mElementDefinition == Element::UNDEFINED) - - pNode[*pMBchar].mElementDefinition = Element::UCS2; - pNode[*pMBchar].mUCS2 = ucs2; -} -*/ -/* -static inline const byte* tss_hash_key_convert()( const TCHAR* psz, int* const pcbKeyLen ) -{ - *pcbKeyLen = sizeof(TCHAR) * _tcslen( psz ); - return (byte*)psz; -} - -static inline bool tss_hash_key_compare()( const TCHAR* lhs, const TCHAR* rhs ) -{ - return ( _tcscmp( lhs, rhs ) == 0 ); -} - -cHashTable< dbchar_t*, - mbchar_t*, - tss_hash_key_convert, - tss_hash_key_compare > ha; - */ - - - diff --git a/src/db/db.cpp b/src/db/db.cpp index 6493d78..79aeb75 100644 --- a/src/db/db.cpp +++ b/src/db/db.cpp @@ -47,5 +47,4 @@ cDb::cDb() } -// eof: db.cpp diff --git a/src/db/stddb.cpp b/src/db/stddb.cpp index 22bd5cc..7037167 100644 --- a/src/db/stddb.cpp +++ b/src/db/stddb.cpp @@ -38,4 +38,4 @@ #include "stddb.h" -// eof: stddb.cpp + diff --git a/src/fco/fco.cpp b/src/fco/fco.cpp index 85a88ed..ca44e38 100644 --- a/src/fco/fco.cpp +++ b/src/fco/fco.cpp @@ -57,4 +57,4 @@ iFCO::~iFCO() { } -// eof: fco.cpp + diff --git a/src/fco/fcostrings.cpp b/src/fco/fcostrings.cpp index 369f528..01e91cf 100644 --- a/src/fco/fcostrings.cpp +++ b/src/fco/fcostrings.cpp @@ -53,4 +53,4 @@ TSS_BeginStringtable( cFCO ) TSS_EndStringtable( cFCO ) -// eof: fcostrings.cpp + diff --git a/src/fco/fcoundefprop.cpp b/src/fco/fcoundefprop.cpp index 2de785f..01cc82f 100644 --- a/src/fco/fcoundefprop.cpp +++ b/src/fco/fcoundefprop.cpp @@ -138,4 +138,4 @@ void cFCOUndefinedProp::Copy(const iFCOProp* rhs) ThrowAndAssert( INTERNAL_ERROR("fcoundefprop.cpp") ); } -// eof: fcoundefprop.cpp + diff --git a/src/fco/stdfco.cpp b/src/fco/stdfco.cpp index 6d6acbc..8f1ab77 100644 --- a/src/fco/stdfco.cpp +++ b/src/fco/stdfco.cpp @@ -37,4 +37,4 @@ #include "stdfco.h" -// eof: stdfco.cpp + diff --git a/src/fs/stdfs.cpp b/src/fs/stdfs.cpp index 4a7c176..d281648 100644 --- a/src/fs/stdfs.cpp +++ b/src/fs/stdfs.cpp @@ -37,4 +37,4 @@ #include "stdfs.h" -// eof: stdfs.cpp + diff --git a/src/siggen/siggen.cpp b/src/siggen/siggen.cpp index 06b63a8..2711a5f 100644 --- a/src/siggen/siggen.cpp +++ b/src/siggen/siggen.cpp @@ -67,5 +67,5 @@ cSiggen::cSiggen() TSS_Dependency( cTWCrypto ); } -// eof: siggen.cpp + diff --git a/src/siggen/siggenstrings.cpp b/src/siggen/siggenstrings.cpp index fb8a8c2..304e602 100644 --- a/src/siggen/siggenstrings.cpp +++ b/src/siggen/siggenstrings.cpp @@ -75,5 +75,5 @@ TSS_BeginStringtable( cSiggen ) TSS_EndStringtable( cSiggen ) -// eof: siggenstrings.cpp + diff --git a/src/siggen/stdsiggen.cpp b/src/siggen/stdsiggen.cpp index 54e47e1..21a73bf 100644 --- a/src/siggen/stdsiggen.cpp +++ b/src/siggen/stdsiggen.cpp @@ -37,4 +37,4 @@ // #include "stdsiggen.h" -// eof: stdsiggen.cpp + diff --git a/src/tripwire/stdtripwire.cpp b/src/tripwire/stdtripwire.cpp index 76e5c8c..ec619e8 100644 --- a/src/tripwire/stdtripwire.cpp +++ b/src/tripwire/stdtripwire.cpp @@ -37,4 +37,4 @@ // #include "stdtripwire.h" -// eof: stdtripwire.cpp + diff --git a/src/tripwire/tripwire.cpp b/src/tripwire/tripwire.cpp index bcdfd30..0895e18 100644 --- a/src/tripwire/tripwire.cpp +++ b/src/tripwire/tripwire.cpp @@ -69,5 +69,5 @@ cTripwire::cTripwire() TSS_REGISTER_PKG_ERRORS( tripwire ) } -// eof: tripwire.cpp + diff --git a/src/tw/stdtw.cpp b/src/tw/stdtw.cpp index 7111d82..7105562 100644 --- a/src/tw/stdtw.cpp +++ b/src/tw/stdtw.cpp @@ -37,4 +37,4 @@ // #include "stdtw.h" -// eof: stdtw.cpp + diff --git a/src/tw/tw.cpp b/src/tw/tw.cpp index dcb0d66..e9a8b44 100644 --- a/src/tw/tw.cpp +++ b/src/tw/tw.cpp @@ -66,5 +66,5 @@ cTW::cTW() TSS_REGISTER_PKG_ERRORS( tw ) } -// eof: tw.cpp + diff --git a/src/tw/twstrings.cpp b/src/tw/twstrings.cpp index da4637b..61ee236 100644 --- a/src/tw/twstrings.cpp +++ b/src/tw/twstrings.cpp @@ -249,5 +249,5 @@ TSS_BeginStringtable( cTW ) TSS_EndStringtable( cTW ) -// eof: twstrings.cpp + diff --git a/src/twadmin/stdtwadmin.cpp b/src/twadmin/stdtwadmin.cpp index 380ac77..c92529a 100644 --- a/src/twadmin/stdtwadmin.cpp +++ b/src/twadmin/stdtwadmin.cpp @@ -37,4 +37,4 @@ #include "stdtwadmin.h" -// eof: stdtwadmin.cpp + diff --git a/src/twadmin/twadmin.cpp b/src/twadmin/twadmin.cpp index 84f0fb1..cb07495 100644 --- a/src/twadmin/twadmin.cpp +++ b/src/twadmin/twadmin.cpp @@ -69,4 +69,4 @@ cTWAdmin::cTWAdmin() TSS_REGISTER_PKG_ERRORS ( twadmin ); } -// eof: twadmin.cpp + diff --git a/src/twcrypto/stdtwcrypto.cpp b/src/twcrypto/stdtwcrypto.cpp index b5a0e4b..2361476 100644 --- a/src/twcrypto/stdtwcrypto.cpp +++ b/src/twcrypto/stdtwcrypto.cpp @@ -38,4 +38,4 @@ #include "stdtwcrypto.h" -// eof: stdtwcrypto.cpp + diff --git a/src/twcrypto/twcrypto.cpp b/src/twcrypto/twcrypto.cpp index ba4dba7..3c7e775 100644 --- a/src/twcrypto/twcrypto.cpp +++ b/src/twcrypto/twcrypto.cpp @@ -63,4 +63,4 @@ cTWCrypto::cTWCrypto() TSS_REGISTER_PKG_ERRORS( twcrypto ) } -// eof: twcrypto.cpp + diff --git a/src/twparser/stdtwparser.cpp b/src/twparser/stdtwparser.cpp index bb8b146..58e5f13 100644 --- a/src/twparser/stdtwparser.cpp +++ b/src/twparser/stdtwparser.cpp @@ -37,4 +37,4 @@ #include "stdtwparser.h" -// eof: stdtwparser.cpp + diff --git a/src/twprint/stdtwprint.cpp b/src/twprint/stdtwprint.cpp index 6894eb9..7f2af88 100644 --- a/src/twprint/stdtwprint.cpp +++ b/src/twprint/stdtwprint.cpp @@ -37,4 +37,4 @@ #include "stdtwprint.h" -// eof: stdtwprint.cpp + diff --git a/src/twprint/twprint.cpp b/src/twprint/twprint.cpp index 921a4dd..5a0bcd9 100644 --- a/src/twprint/twprint.cpp +++ b/src/twprint/twprint.cpp @@ -69,4 +69,4 @@ cTWPrint::cTWPrint() TSS_REGISTER_PKG_ERRORS ( twprint ); } -// eof: twprint.cpp + diff --git a/src/twtest/codeconvert_t.cpp b/src/twtest/codeconvert_t.cpp index 36cb169..6d1def4 100644 --- a/src/twtest/codeconvert_t.cpp +++ b/src/twtest/codeconvert_t.cpp @@ -340,5 +340,5 @@ bool LowASCIILooksLikeUCS2InWchart() return fOK; } -// eof: codeconvert_t.cpp + diff --git a/src/twtest/resources_t.cpp b/src/twtest/resources_t.cpp index 94332cf..652f75a 100644 --- a/src/twtest/resources_t.cpp +++ b/src/twtest/resources_t.cpp @@ -96,5 +96,5 @@ void TestResources() } -// eof: tss.resources_t.cpp + diff --git a/src/twtest/stdtest.cpp b/src/twtest/stdtest.cpp index 483df60..3c34d0f 100644 --- a/src/twtest/stdtest.cpp +++ b/src/twtest/stdtest.cpp @@ -37,4 +37,4 @@ // #include "stdtest.h" -// eof: stdtest.cpp + diff --git a/src/util/stdutil.cpp b/src/util/stdutil.cpp index 7d53ebd..16814c9 100644 --- a/src/util/stdutil.cpp +++ b/src/util/stdutil.cpp @@ -38,4 +38,4 @@ #include "stdutil.h" -// eof: stdutil.cpp + diff --git a/src/util/util.cpp b/src/util/util.cpp index 9ea5874..d893ecc 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -71,4 +71,4 @@ TSS_EndTestSuite( cUtil ) #endif // #ifdef TSS_TEST -// eof: util.cpp + diff --git a/src/util/utilstrings.cpp b/src/util/utilstrings.cpp index 2c78e15..a548870 100644 --- a/src/util/utilstrings.cpp +++ b/src/util/utilstrings.cpp @@ -49,4 +49,4 @@ TSS_BeginStringtable( cUtil ) TSS_EndStringtable( cUtil ) -// eof: utilstrings.cpp + From 8ba032c4241784084c77cee949b43b83c84ab399 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 12 Apr 2017 21:44:51 -0700 Subject: [PATCH 003/110] Change uses of _DEBUG and _DEBUG_DB defines to be DEBUG, since that's the only symbol that gets defined by configuring with --enable-debug. --- src/core/archive.cpp | 2 +- src/core/cmdlineparser.cpp | 2 +- src/core/cmdlineparser.h | 2 +- src/core/codeconvert.cpp | 4 ++-- src/core/debug.cpp | 2 +- src/core/debug.h | 4 ++-- src/core/errortable.cpp | 4 ++-- src/core/errortable.h | 4 ++-- src/core/file_unix.cpp | 2 +- src/core/fileheader.cpp | 4 ++-- src/core/hashtable.h | 6 +++--- src/core/ntmbs.cpp | 2 +- src/core/package.h | 6 +++--- src/core/refcountobj.cpp | 12 ++++++------ src/core/refcountobj.h | 2 +- src/core/resources.h | 2 +- src/core/serializerimpl.cpp | 2 +- src/core/srefcounttbl.cpp | 2 +- src/core/stdcore.h | 2 +- src/db/blockfile.cpp | 2 +- src/db/blockfile.h | 2 +- src/fco/fconame.cpp | 28 ++++++++++++++-------------- src/fco/fconame.h | 2 +- src/fco/fconametbl.cpp | 2 +- src/fco/fcosetws.h | 4 ++-- src/fco/fcospecimpl.cpp | 10 +++++----- src/fco/signature.cpp | 4 ++-- src/fs/fsobject.cpp | 8 ++++---- src/fs/fsobject.h | 2 +- src/fs/fspropcalc.cpp | 2 +- src/parser/tokens.l | 4 ++-- src/tripwire/integritycheck.cpp | 2 +- src/tripwire/tripwiremain.cpp | 4 ++-- src/tripwire/twcmdline.cpp | 12 ++++++------ src/tripwire/twcmdline.h | 6 +++--- src/tw/configfile.cpp | 4 ++-- src/tw/dbdatasource.cpp | 4 ++-- src/tw/fcodatabasefile.cpp | 2 +- src/tw/fcoreport.cpp | 2 +- src/tw/textreportviewer.cpp | 2 +- src/tw/twinit.cpp | 2 +- src/tw/twstrings.cpp | 2 +- src/tw/twutil.cpp | 2 +- src/twadmin/keygeneration.cpp | 8 ++++---- src/twcrypto/crypto.cpp | 10 +++++----- src/twcrypto/crypto.h | 4 ++-- src/twcrypto/keyfile.cpp | 2 +- src/twparser/parserhelper.cpp | 8 ++++---- src/twparser/policyparser.cpp | 4 ++-- src/twparser/yylex.cpp | 4 ++-- src/twtest/cmdlineparser_t.cpp | 6 +++--- src/twtest/hashtable_t.cpp | 2 +- 52 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/core/archive.cpp b/src/core/archive.cpp index ab4e7cf..95b0f5f 100644 --- a/src/core/archive.cpp +++ b/src/core/archive.cpp @@ -421,7 +421,7 @@ void cMemoryArchive::AllocateMemory(int len) // throw(eArchive) { // grow the buffer // only error if we are in debug mode -#ifdef _DEBUG +#ifdef DEBUG if (len > mMaxAllocatedLen) ThrowAndAssert(eArchiveOutOfMem()); #endif diff --git a/src/core/cmdlineparser.cpp b/src/core/cmdlineparser.cpp index 7da836b..3bd51f2 100644 --- a/src/core/cmdlineparser.cpp +++ b/src/core/cmdlineparser.cpp @@ -378,7 +378,7 @@ void cCmdLineParser::AddDependency(int argId1, int argId2, bool mutual ) /////////////////////////////////////////////////////////////////////////////// // TraceContents /////////////////////////////////////////////////////////////////////////////// -#ifdef _DEBUG +#ifdef DEBUG void cCmdLineParser::TraceContents(int dl) { cDebug d("cCmdLineParser::TraceContents"); diff --git a/src/core/cmdlineparser.h b/src/core/cmdlineparser.h index ed78009..6e990d0 100644 --- a/src/core/cmdlineparser.h +++ b/src/core/cmdlineparser.h @@ -139,7 +139,7 @@ public: // given an argId, fill out the strings with the argument and alias strings. Returns false // if the argId cannot be found. This method is not very fast, so don't use it often. - #ifdef _DEBUG + #ifdef DEBUG void TraceContents(int dl = -1) ; #endif private: diff --git a/src/core/codeconvert.cpp b/src/core/codeconvert.cpp index 9142da1..73816f5 100644 --- a/src/core/codeconvert.cpp +++ b/src/core/codeconvert.cpp @@ -496,7 +496,7 @@ namespace /*Unique*/ d.TraceDebug( "Converted to: %s\n", util_output_bytes( (void*)pConvertedTo, nTo ).c_str() ); char aBuffer[ MB_LEN_MAX ]; -#ifdef _DEBUG +#ifdef DEBUG for( size_t foo = 0; foo < sizeof( aBuffer ); foo++ ) aBuffer[ foo ] = 0xCD; #endif @@ -651,7 +651,7 @@ namespace /*Unique*/ { cDebug d( "tss_Converter< BufferT, SourceT >()" ); -#ifdef _DEBUG +#ifdef DEBUG for( size_t s = nBufferItems; s; s-- ) pBuffer[s] = 0xCD; d.TraceDebug( "sizeof buffer: %d, sizeof source: %d\n", sizeof( BufferT ), sizeof( SourceT ) ); diff --git a/src/core/debug.cpp b/src/core/debug.cpp index 7c285bb..f56c3d4 100644 --- a/src/core/debug.cpp +++ b/src/core/debug.cpp @@ -307,7 +307,7 @@ void cDebug::DebugOut( const char* lpOutputString, ... ) vsnprintf(buf, 2048, lpOutputString, args); va_end(args); - #ifdef _DEBUG + #ifdef DEBUG TCERR << buf; #endif //_DEBUG diff --git a/src/core/debug.h b/src/core/debug.h index 499fcf7..1274d0a 100644 --- a/src/core/debug.h +++ b/src/core/debug.h @@ -156,11 +156,11 @@ private: #endif }; -#ifdef _DEBUG +#ifdef DEBUG #define TRACE cDebug::DebugOut #else #define TRACE 1 ? (void)0 : cDebug::DebugOut -#endif // _DEBUG +#endif // DEBUG ////////////////////////////////////////////////////////////////////////////////// // inline implementation diff --git a/src/core/errortable.cpp b/src/core/errortable.cpp index 6c7a24c..07fcb53 100644 --- a/src/core/errortable.cpp +++ b/src/core/errortable.cpp @@ -35,7 +35,7 @@ #include "stdcore.h" #include "errortable.h" -#ifdef _DEBUG +#ifdef DEBUG #include "package.h" #include "corestrings.h" #endif @@ -52,7 +52,7 @@ cErrorTable* cErrorTable::GetInstance() /////////////////////////////////////////////////////////////////////////////// // AssertMsgValidity /////////////////////////////////////////////////////////////////////////////// -#ifdef _DEBUG +#ifdef DEBUG void cErrorTable::AssertMsgValidity(const TCHAR* msg) { // Check to see that the first part of this error message is not too long. diff --git a/src/core/errortable.h b/src/core/errortable.h index dbd0632..b0e4012 100644 --- a/src/core/errortable.h +++ b/src/core/errortable.h @@ -66,14 +66,14 @@ public: static cErrorTable* GetInstance(); private: - #ifdef _DEBUG + #ifdef DEBUG static void AssertMsgValidity(const TCHAR* msg); #endif }; inline void cErrorTable::Put( const eError& e, const TCHAR* msg ) { - #ifdef _DEBUG + #ifdef DEBUG AssertMsgValidity(msg); #endif diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index d896cac..68705f1 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -322,7 +322,7 @@ cFile::File_t cFile::Seek( File_t offset, SeekFrom From) const //throw(eFile) if (fseeko( mpData->mpCurrStream, offset, apiFrom ) != 0) { - #ifdef _DEBUG + #ifdef DEBUG cDebug d("cFile::Seek"); d.TraceDebug("Seek failed!\n"); #endif diff --git a/src/core/fileheader.cpp b/src/core/fileheader.cpp index cf0fca3..3148e25 100644 --- a/src/core/fileheader.cpp +++ b/src/core/fileheader.cpp @@ -111,7 +111,7 @@ void cFileHeaderID::Write(iSerializer* pSerializer) const // throw (eSerializer, cFileHeader::cFileHeader() : mVersion(0) { -#ifdef _DEBUG +#ifdef DEBUG mEncoding = LAST_ENCODING; // set to invalid value so we can assert on write #else mEncoding = NO_ENCODING; @@ -213,7 +213,7 @@ void cFileHeader::Read(iSerializer* pSerializer, int32 /*version*/) // throw (eS void cFileHeader::Write(iSerializer* pSerializer) const // throw (eSerializer, eArchive) { -#ifdef _DEBUG +#ifdef DEBUG // check that we set some values cFileHeaderID id; ASSERT(mID != id); diff --git a/src/core/hashtable.h b/src/core/hashtable.h index 658905e..f28ade0 100644 --- a/src/core/hashtable.h +++ b/src/core/hashtable.h @@ -172,7 +172,7 @@ public: int32 GetNumValues() const { return mValuesInTable; }; // returns number of table entries filled -#ifdef _DEBUG +#ifdef DEBUG void TraceDiagnostics() const; // traces hash table statistics #endif @@ -503,7 +503,7 @@ uint32 cHashTable::Hash( const KEY_TY return hindex; } -#ifdef _DEBUG +#ifdef DEBUG template void cHashTable::TraceDiagnostics() const @@ -537,7 +537,7 @@ void cHashTable::TraceDiagnostics() c d.TraceDebug("-- Slots with >1 item: %d (%lf %%)\n",numMultiSlot, ((double)numMultiSlot / (double)slotsFilled) * 100.0); d.TraceDebug("--------------------------------------------------\n"); } -#endif // _DEBUG +#endif // DEBUG #endif //__HASHTABLE_H diff --git a/src/core/ntmbs.cpp b/src/core/ntmbs.cpp index 647d285..1500634 100644 --- a/src/core/ntmbs.cpp +++ b/src/core/ntmbs.cpp @@ -46,7 +46,7 @@ // Module-wide Helpers //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#ifndef TSS_Raise // Should add file and line info in _DEBUG mode!!!! +#ifndef TSS_Raise // Should add file and line info in DEBUG mode!!!! #define TSS_Raise( Xcpt, pkg, ids ) \ throw Xcpt( TSS_GetString( pkg, ids ) ) diff --git a/src/core/package.h b/src/core/package.h index ac5e6a8..0745fe7 100644 --- a/src/core/package.h +++ b/src/core/package.h @@ -142,17 +142,17 @@ Messages m_messages // Decare a Stringtable -#ifdef _DEBUG +#ifdef DEBUG #define TSS_BeginStringtable( pkg ) \ void pkg::LoadStrings() \ { cDebug d( #pkg "::LoadStrings()" ); \ d.TraceDebug("Loading strings for " #pkg " package.\n"); \ Messages::Pair astr[] = { // Define a Stringtable -#else // _DEBUG +#else // DEBUG #define TSS_BeginStringtable( pkg ) \ void pkg::LoadStrings() \ { Messages::Pair astr[] = { // Define a Stringtable -#endif // _DEBUG +#endif // DEBUG #define TSS_EndStringtable( pkg ) \ }; m_messages.Put( \ diff --git a/src/core/refcountobj.cpp b/src/core/refcountobj.cpp index f8df324..575dcb1 100644 --- a/src/core/refcountobj.cpp +++ b/src/core/refcountobj.cpp @@ -41,7 +41,7 @@ #include "errorutil.h" -#ifdef _DEBUG +#ifdef DEBUG int cRefCountObj::objectCounter = 0; int cRefCountObj::referenceCounter = 0; @@ -68,7 +68,7 @@ struct cRefCountObj_Debug } } gRefCountObj_Debug; -#endif // _DEBUG +#endif // DEBUG cRefCountObj::cRefCountObj() { @@ -76,7 +76,7 @@ cRefCountObj::cRefCountObj() //std::cout << "Allocated RefObj(" << std::hex << (int)this << ")\n"; -#ifdef _DEBUG +#ifdef DEBUG ++objectCounter; ++referenceCounter; @@ -95,7 +95,7 @@ cRefCountObj::~cRefCountObj() //std::cout << "Deleted RefObj(" << std::hex << (int)this << ")\n"; -#ifdef _DEBUG +#ifdef DEBUG --objectCounter; cDebug d("cRefCountObj::~cRefCountObj"); d.TraceNever("Object Destroyed[%p] %s Objects Left = %d\n", this, typeid(*this).name(), objectCounter); @@ -128,7 +128,7 @@ void cRefCountObj::AddRef() const ++mRefCount; - #ifdef _DEBUG + #ifdef DEBUG ++referenceCounter; #endif } @@ -140,7 +140,7 @@ void cRefCountObj::Release() const Delete(); } - #ifdef _DEBUG + #ifdef DEBUG --referenceCounter; #endif } diff --git a/src/core/refcountobj.h b/src/core/refcountobj.h index 68f39f7..f96eb19 100644 --- a/src/core/refcountobj.h +++ b/src/core/refcountobj.h @@ -77,7 +77,7 @@ protected: private: mutable int mRefCount; -#ifdef _DEBUG +#ifdef DEBUG private: static int objectCounter; static int referenceCounter; diff --git a/src/core/resources.h b/src/core/resources.h index 6ef4161..cd19ea5 100644 --- a/src/core/resources.h +++ b/src/core/resources.h @@ -241,7 +241,7 @@ Resource_Class::Get( ConstKeyRef id ) const if ( at == m_table.end() ) { - #ifdef _DEBUG + #ifdef DEBUG std::cerr << "*** Error Resource_Class::Get() [" __FILE__ ":" << __LINE__ << "]: Resource not found\n"; #endif diff --git a/src/core/serializerimpl.cpp b/src/core/serializerimpl.cpp index 8c9aaa0..af382b4 100644 --- a/src/core/serializerimpl.cpp +++ b/src/core/serializerimpl.cpp @@ -274,7 +274,7 @@ iTypedSerializable* cSerializerImpl::ReadObjectDynCreate() // unable to find the creation function... d.TraceError("Unable to find creation function for non-ref counted object %d\n", crc); TOSTRINGSTREAM str; - #ifdef _DEBUG + #ifdef DEBUG // Let's only report the actual crc in debug mode str << (int32)crc << std::ends; #endif diff --git a/src/core/srefcounttbl.cpp b/src/core/srefcounttbl.cpp index 3e88c88..4c59477 100644 --- a/src/core/srefcounttbl.cpp +++ b/src/core/srefcounttbl.cpp @@ -119,7 +119,7 @@ int cSerRefCountTable::Add(const iSerRefCountObj* pObj, int id) // creates a new cSerRefCountTable void cSerRefCountTableMap::AddSerializer(const cSerializer* pSerializer) { - #ifdef _DEBUG + #ifdef DEBUG // make sure we don't have this serialzier in here yet { std::map::iterator itr; diff --git a/src/core/stdcore.h b/src/core/stdcore.h index fc5848b..44be2c4 100644 --- a/src/core/stdcore.h +++ b/src/core/stdcore.h @@ -62,7 +62,7 @@ #pragma warning( disable: 4100 ) // Formal argument not used #pragma warning( disable: 4710 ) // Compiler did not inline function -#ifndef _DEBUG // ASSERT's are disabled give a lot of these +#ifndef DEBUG // ASSERT's are disabled give a lot of these #pragma warning( disable: 4702 ) // ---Unreachable Code #endif diff --git a/src/db/blockfile.cpp b/src/db/blockfile.cpp index d87f3d4..5713e22 100644 --- a/src/db/blockfile.cpp +++ b/src/db/blockfile.cpp @@ -326,7 +326,7 @@ void cBlockFile::AssertValid() const // // make sure the archive length and block count match up // - #ifdef _DEBUG + #ifdef DEBUG if (mpArchive->Length() != (GetBlockSize() * GetNumBlocks())) { cDebug d("cBlockFile::AssertValid"); diff --git a/src/db/blockfile.h b/src/db/blockfile.h index 884bb8f..975cf21 100644 --- a/src/db/blockfile.h +++ b/src/db/blockfile.h @@ -46,7 +46,7 @@ #include "block.h" #endif -#ifdef _DEBUG +#ifdef DEBUG #undef _BLOCKFILE_DEBUG // If we dont do this, test does not compile on unix #define _BLOCKFILE_DEBUG // If we dont do this, test does not compile on unix #endif diff --git a/src/fco/fconame.cpp b/src/fco/fconame.cpp index e73e8ac..1281bcd 100644 --- a/src/fco/fconame.cpp +++ b/src/fco/fconame.cpp @@ -97,7 +97,7 @@ cFCOName::cFCOName(iFCONameInfo* pNI) : { SetNameInfo(pNI); mpPathName = new cFCOName_i; -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); cDebug d("cFCOName::cFCOName(iFCONameInfo*)"); d.TraceNever(_T("constructing %X:%X %s (refcount=%d)\n"), this, mpPathName, mDebugStrName.c_str(), mpPathName->GetRefCount()); @@ -111,7 +111,7 @@ cFCOName::cFCOName(const cFCOName& rhs) : mbCaseSensitive(rhs.mbCaseSensitive) { mpPathName->AddRef(); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); cDebug d("cFCOName::cFCOName(cFCOName&)"); d.TraceNever(_T("constructing %X:%X %s (refcount=%d)\n"), this, mpPathName, mDebugStrName.c_str(), mpPathName->GetRefCount()); @@ -125,7 +125,7 @@ cFCOName::cFCOName(const TSTRING& rhs, iFCONameInfo* pNI) : mpPathName = new cFCOName_i; ParseString(rhs.c_str()); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); cDebug d("cFCOName::cFCOName(cFCOName&,iFCONameInfo*)"); d.TraceNever(_T("constructing %X:%X %s (refcount=%d)\n"), this, mpPathName, mDebugStrName.c_str(), mpPathName->GetRefCount()); @@ -139,7 +139,7 @@ cFCOName::cFCOName(const TCHAR* rhs, iFCONameInfo* pNI) : mpPathName = new cFCOName_i; ParseString(rhs); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); cDebug d("cFCOName::cFCOName(cFCOName&,iFCONameInfo*)"); d.TraceNever(_T("constructing %X:%X %s (refcount=%d)\n"), this, mpPathName, mDebugStrName.c_str(), mpPathName->GetRefCount()); @@ -148,7 +148,7 @@ cFCOName::cFCOName(const TCHAR* rhs, iFCONameInfo* pNI) : cFCOName::~cFCOName() { -#ifdef _DEBUG +#ifdef DEBUG cDebug d("cFCOName::~cFCOName()"); d.TraceNever(_T("destructing %X:%X %s (refcount=%d)\n"), this, mpPathName, mDebugStrName.c_str(), mpPathName->GetRefCount()); #endif @@ -168,7 +168,7 @@ void cFCOName::SetNameInfo(iFCONameInfo* pNI) mbCaseSensitive = iTWFactory::GetInstance()->GetNameInfo()->IsCaseSensitive(); mDelimiter = iTWFactory::GetInstance()->GetNameInfo()->GetDelimitingChar(); } -#ifdef _DEBUG +#ifdef DEBUG if( mpPathName != NULL ) // this could be called from the constructor before this is initialized. mDebugStrName = AsString(); #endif @@ -185,7 +185,7 @@ cFCOName& cFCOName::operator = (const cFCOName& rhs) mpPathName->AddRef(); mDelimiter = rhs.mDelimiter; mbCaseSensitive = rhs.mbCaseSensitive; -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); #endif return *this; @@ -194,7 +194,7 @@ cFCOName& cFCOName::operator = (const cFCOName& rhs) cFCOName& cFCOName::operator = (const TSTRING& rhs) { *this = rhs.c_str(); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); #endif return *this; @@ -210,7 +210,7 @@ cFCOName& cFCOName::operator = (const TCHAR* rhs) mpPathName = new cFCOName_i; } ParseString(rhs); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); #endif return *this; @@ -320,7 +320,7 @@ void cFCOName::Clear() { Pop(); } -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); #endif } @@ -392,7 +392,7 @@ void cFCOName::Read(iSerializer* pSerializer, int32 version) mbCaseSensitive = true; ParseString(str.c_str()); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); #endif } @@ -443,7 +443,7 @@ void cFCOName::Push(const TSTRING& str) cFCONameTblNode* pNode = cFCOName_i::msNameTbl.CreateNode(str); mpPathName->mNames.push_back(pNode); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); #endif } @@ -465,7 +465,7 @@ const TCHAR* cFCOName::Pop() ASSERT(pNode->GetRefCount() > 1); const TCHAR* ret = pNode->GetString(); pNode->Release(); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); #endif return ret; @@ -489,7 +489,7 @@ const TCHAR* cFCOName::PopFront() ASSERT(pNode->GetRefCount() > 1); const TCHAR* ret = pNode->GetString(); pNode->Release(); -#ifdef _DEBUG +#ifdef DEBUG mDebugStrName = AsString(); #endif return ret; diff --git a/src/fco/fconame.h b/src/fco/fconame.h index daccab0..0ce68fb 100644 --- a/src/fco/fconame.h +++ b/src/fco/fconame.h @@ -153,7 +153,7 @@ protected: // typedef std::vector ListType; -#ifdef _DEBUG +#ifdef DEBUG TSTRING mDebugStrName; // so we can see this guy's value in the debug window #endif }; diff --git a/src/fco/fconametbl.cpp b/src/fco/fconametbl.cpp index a331533..1bcfbeb 100644 --- a/src/fco/fconametbl.cpp +++ b/src/fco/fconametbl.cpp @@ -156,7 +156,7 @@ cFCONameTbl::cFCONameTbl(int defSize) : cFCONameTbl::~cFCONameTbl() { -#ifdef _DEBUG +#ifdef DEBUG cDebug d("cFCONameTbl::~cFCONameTbl()"); d.TraceDebug("Tracing cFCONameTblNode hash table statistics:\n"); mTable.TraceDiagnostics(); diff --git a/src/fco/fcosetws.h b/src/fco/fcosetws.h index 8f3f8be..5b71e30 100644 --- a/src/fco/fcosetws.h +++ b/src/fco/fcosetws.h @@ -112,7 +112,7 @@ inline void cFCOSetWS::SetSpec(const iFCOSpec* pSpec) inline void cFCOSetWS::Insert(iFCO* pFCO) { // here is the only real work this class does! -#ifdef _DEBUG +#ifdef DEBUG // TODO -- note that this doesn't do any checking if the spec is NULL. I // am not sure if this is the right thing to do or not. if(mpSpec) @@ -127,7 +127,7 @@ inline void cFCOSetWS::Insert(iFCO* pFCO) mpSpec->TraceContents(cDebug::D_ERROR); } } -#endif // _DEBUG +#endif // DEBUG cFCOSetImpl::Insert(pFCO); } diff --git a/src/fco/fcospecimpl.cpp b/src/fco/fcospecimpl.cpp index 839e282..d696372 100644 --- a/src/fco/fcospecimpl.cpp +++ b/src/fco/fcospecimpl.cpp @@ -41,7 +41,7 @@ #include "fcospechelper.h" #include "core/errorutil.h" -#ifdef _DEBUG +#ifdef DEBUG int gFCOSpecImplCreated = 0; int gFCOSpecImplDestroyed = 0; #endif @@ -53,7 +53,7 @@ cFCOSpecImpl::cFCOSpecImpl(const TSTRING& name, void* pSrc, iFCOSpecHelper* pHel mName(name), mpHelper(pHelper) { -#ifdef _DEBUG +#ifdef DEBUG ++gFCOSpecImplCreated; cDebug d("cFCOSpecImpl::cFCOSpecImpl()"); d.TraceDetail("Allocated cFCOSpecImpl(%p) creat=%d dest=%d\n", this, gFCOSpecImplCreated, gFCOSpecImplDestroyed); @@ -65,7 +65,7 @@ cFCOSpecImpl::cFCOSpecImpl() : mName(_T("Unnamed_FCOSpecImpl")), mpHelper(0) { -#ifdef _DEBUG +#ifdef DEBUG ++gFCOSpecImplCreated; cDebug d("cFCOSpecImpl::cFCOSpecImpl()"); d.TraceDetail("Allocated cFCOSpecImpl(%p) creat=%d dest=%d\n", this, gFCOSpecImplCreated, gFCOSpecImplDestroyed); @@ -77,7 +77,7 @@ cFCOSpecImpl::cFCOSpecImpl(const cFCOSpecImpl& rhs) : mpHelper(0) { *this = rhs; -#ifdef _DEBUG +#ifdef DEBUG ++gFCOSpecImplCreated; cDebug d("cFCOSpecImpl::cFCOSpecImpl()"); d.TraceDetail("Allocated cFCOSpecImpl(%p) creat=%d dest=%d\n", this, gFCOSpecImplCreated, gFCOSpecImplDestroyed); @@ -86,7 +86,7 @@ cFCOSpecImpl::cFCOSpecImpl(const cFCOSpecImpl& rhs) : cFCOSpecImpl::~cFCOSpecImpl() { -#ifdef _DEBUG +#ifdef DEBUG ++gFCOSpecImplDestroyed; cDebug d("cFCOSpecImpl::cFCOSpecImpl()"); d.TraceDetail("Deleted cFCOSpecImpl(%p) creat=%d dest=%d\n", this, gFCOSpecImplCreated, gFCOSpecImplDestroyed); diff --git a/src/fco/signature.cpp b/src/fco/signature.cpp index 4278ed1..4fee4d6 100644 --- a/src/fco/signature.cpp +++ b/src/fco/signature.cpp @@ -267,7 +267,7 @@ void cNullSignature::Read(iSerializer* pSerializer, int32 version) if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("Null Signature Read"))); -#ifdef _DEBUG +#ifdef DEBUG int16 ret; pSerializer->ReadInt16(ret); ASSERT(ret == 123); @@ -276,7 +276,7 @@ void cNullSignature::Read(iSerializer* pSerializer, int32 version) void cNullSignature::Write(iSerializer* pSerializer) const { -#ifdef _DEBUG +#ifdef DEBUG pSerializer->WriteInt16(123); #endif } diff --git a/src/fs/fsobject.cpp b/src/fs/fsobject.cpp index c811d77..bb18991 100644 --- a/src/fs/fsobject.cpp +++ b/src/fs/fsobject.cpp @@ -45,7 +45,7 @@ IMPLEMENT_SERREFCOUNT(cFSObject, _T("FSObject"), 0, 1) // Debug stuff -#ifdef _DEBUG +#ifdef DEBUG static int gNumFSObjectCreate = 0; static int gNumFSObjectDestroy = 0; @@ -75,7 +75,7 @@ public: cFSObject::cFSObject(const cFCOName& name) : mName(name) { -#ifdef _DEBUG +#ifdef DEBUG gNumFSObjectCreate++; #endif } @@ -83,14 +83,14 @@ cFSObject::cFSObject(const cFCOName& name) : cFSObject::cFSObject() : mName(_T("undefined")) { -#ifdef _DEBUG +#ifdef DEBUG gNumFSObjectCreate++; #endif } cFSObject::~cFSObject() { -#ifdef _DEBUG +#ifdef DEBUG gNumFSObjectDestroy++; #endif } diff --git a/src/fs/fsobject.h b/src/fs/fsobject.h index 9121137..f66deaa 100644 --- a/src/fs/fsobject.h +++ b/src/fs/fsobject.h @@ -82,7 +82,7 @@ public: virtual void TraceContents(int dl = -1) const; -#ifdef _DEBUG +#ifdef DEBUG static void TraceStats() ; // this TRACEs statistics on FSObject usage that is pertinent to performance or mem leakage // concerns. diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index ad4063a..ad1446b 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -399,7 +399,7 @@ void cFSPropCalc::VisitFSObject(cFSObject& obj) propsToCheck ^= inBoth; } -#ifdef _DEBUG +#ifdef DEBUG d.TraceDetail("----->Collision Action = %s\n", mCollAction == iFCOPropCalc::PROP_LEAVE ? "Leave" : "Replace"); d.TraceDetail("----->Object's valid properties (a):\n"); obj.GetPropSet()->GetValidVector().TraceContents(cDebug::D_DETAIL); diff --git a/src/parser/tokens.l b/src/parser/tokens.l index 94bc773..536ba91 100644 --- a/src/parser/tokens.l +++ b/src/parser/tokens.l @@ -311,12 +311,12 @@ END {WS}*{DIRECTIVE}{WS}*end *mpstring = strW; -#ifdef _DEBUG +#ifdef DEBUG TSTRING strDisplay = *mpstring; cDisplayEncoder e; e.Encode( strDisplay ); d.TraceDetail("interpreted as --> <%s>\n", strDisplay.c_str()); -#endif // _DEBUG +#endif // DEBUG // attach to lval yylval.mpString = mpstring; diff --git a/src/tripwire/integritycheck.cpp b/src/tripwire/integritycheck.cpp index 224c14c..815cd15 100644 --- a/src/tripwire/integritycheck.cpp +++ b/src/tripwire/integritycheck.cpp @@ -324,7 +324,7 @@ void cIntegrityCheck::ProcessDir( cDbDataSourceIter dbIter, iFCODataSourceIter* return; } -#ifdef _DEBUG +#ifdef DEBUG if( dbIter.Done() ) { d.TraceDebug( "Processing directory %s\n", pIter->GetParentName().AsString().c_str() ); diff --git a/src/tripwire/tripwiremain.cpp b/src/tripwire/tripwiremain.cpp index 266199d..89649b9 100644 --- a/src/tripwire/tripwiremain.cpp +++ b/src/tripwire/tripwiremain.cpp @@ -64,7 +64,7 @@ static TSTRING util_GetWholeCmdLine( int argc, const TCHAR *argv[] ); // global new() and delete() overrides -- this is done to do performance testing /////////////////////////////////////////////////////////////////////////////// /* -#ifdef _DEBUG +#ifdef DEBUG #if defined(HAVE_MALLOC_H) #include #endif @@ -269,7 +269,7 @@ exit: // print out the max memory usage... /* -#ifdef _DEBUG +#ifdef DEBUG TCOUT << _T("Maximum memory footprint = ") << gMaxAlloc << std::endl; #endif */ diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 5666533..a97baaf 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -158,7 +158,7 @@ iTWMode* cTWCmdLine::GetMode(int argc, const TCHAR *const * argv) else if (_tcscmp(argv[1], _T("--test")) == 0) mode = MODE_TEST; -#ifdef _DEBUG_DB +#ifdef DEBUG if (_tcscmp(argv[1], _T("--explore")) == 0) mode = MODE_EXPLORE; if (_tcscmp(argv[1], _T("--verifydb")) == 0) @@ -204,8 +204,8 @@ iTWMode* cTWCmdLine::GetMode(int argc, const TCHAR *const * argv) pRtn = new cTWModeVersion; break; -//Explore and Debug modes are invisible unless _DEBUG_DB is defined. -#ifdef _DEBUG_DB +//Explore and Debug modes are invisible unless DEBUG is defined. +#ifdef DEBUG case cTWCmdLine::MODE_EXPLORE: pRtn = new cTWModeExploreDb; break; @@ -2441,7 +2441,7 @@ int cTWModeHelp::Execute(cErrorQueue* pQueue) TCOUT<< TSS_GetString( cTripwire, tripwire::STR_TRIPWIRE_HELP_UPDATE ); TCOUT<< TSS_GetString( cTripwire, tripwire::STR_TRIPWIRE_HELP_UPDATE_POLICY ); TCOUT<< TSS_GetString( cTripwire, tripwire::STR_TRIPWIRE_HELP_TEST ); -#ifdef _DEBUG_DB +#ifdef DEBUG // TODO: Do we need help messages for these modes? DRA #endif //We're done, return @@ -2539,7 +2539,7 @@ bool util_GetEditor( TSTRING& strEd ) //Encase the explore and debug modes in this ifdef, since they are for internal //use only. -#ifdef _DEBUG_DB +#ifdef DEBUG //############################################################################# // cTWModeExploreDb @@ -2724,6 +2724,6 @@ int cTWModeDebugDb::Execute(cErrorQueue* pQueue) } -#endif //_DEBUG_DB +#endif //DEBUG diff --git a/src/tripwire/twcmdline.h b/src/tripwire/twcmdline.h index 1dd1c45..e68d677 100644 --- a/src/tripwire/twcmdline.h +++ b/src/tripwire/twcmdline.h @@ -361,8 +361,8 @@ private: cTWModeHelp_i* mpData; }; -//These two modes are invisible if _DEBUG_DB is not defined. -#ifdef _DEBUG_DB +//These two modes are invisible if DEBUG is not defined. +#ifdef DEBUG /////////////////////////////////////////////////////////////////////////////// // Explore Db @@ -404,7 +404,7 @@ private: cTWModeDebugDb_i* mpData; }; -#endif //_DEBUG_DB +#endif //DEBUG /////////////////////////////////////////////////////////////////////////////// // Version Mode diff --git a/src/tw/configfile.cpp b/src/tw/configfile.cpp index af13e78..9e4c0fc 100644 --- a/src/tw/configfile.cpp +++ b/src/tw/configfile.cpp @@ -238,7 +238,7 @@ void cConfigFile::WriteString( TSTRING& configText ) // throw( eFSServices ) void cConfigFile::ReadString(const TSTRING configText) // throw( eConfigFile ); { -#ifdef _DEBUG +#ifdef DEBUG // NOTE:BAM -- debug only code ! TCERR << _T("*** begin config text ***") << std::endl; TCERR << configText << std::endl; @@ -266,7 +266,7 @@ void cConfigFile::ReadString(const TSTRING configText) // throw( eConfigFile ); CheckThatAllMandatoryKeyWordsExists(); -#ifdef _DEBUG +#ifdef DEBUG // NOTE:BAM -- debug only code ! TSTRING sTemp; WriteString( sTemp ); diff --git a/src/tw/dbdatasource.cpp b/src/tw/dbdatasource.cpp index db2f2b6..2f96ca9 100644 --- a/src/tw/dbdatasource.cpp +++ b/src/tw/dbdatasource.cpp @@ -64,14 +64,14 @@ cDbDataSourceIter::cDbDataSourceIter(cHierDatabase* pDb, int genreNum ) genreNum = cGenreSwitcher::GetInstance()->CurrentGenre(); mFCOCreateFunc = cGenreSwitcher::GetInstance()->GetFactoryForGenre( (cGenre::Genre)genreNum )->GetCreateFunc(); -#ifdef _DEBUG +#ifdef DEBUG // // make some assertions about the current genre's name info // iFCONameInfo* pNameInfo = cGenreSwitcher::GetInstance()->GetFactoryForGenre( (cGenre::Genre)genreNum )->GetNameInfo(); ASSERT( pDb->IsCaseSensitive() == pNameInfo->IsCaseSensitive() ); ASSERT( pDb->GetDelimitingChar() == pNameInfo->GetDelimitingChar() ); -#endif //#ifdef _DEBUG +#endif //#ifdef DEBUG } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/tw/fcodatabasefile.cpp b/src/tw/fcodatabasefile.cpp index d36a5c2..65e6b89 100644 --- a/src/tw/fcodatabasefile.cpp +++ b/src/tw/fcodatabasefile.cpp @@ -62,7 +62,7 @@ cFCODatabaseFile::tEntry::tEntry( cGenre::Genre genre ) } cFCODatabaseFile::cFCODatabaseFile() -#ifdef _DEBUG +#ifdef DEBUG : mFileName( _T("Unknown file name") ) #else : mFileName( _T("") ) // If we don't know the filename, lets just not have one in release mode. diff --git a/src/tw/fcoreport.cpp b/src/tw/fcoreport.cpp index b66c231..c9534f4 100644 --- a/src/tw/fcoreport.cpp +++ b/src/tw/fcoreport.cpp @@ -722,7 +722,7 @@ void cFCOReport::AddChangedFCO(const cFCOReportSpecIter& iter, const iFCO* pOldF // make some assertions about the iterator - #ifdef _DEBUG + #ifdef DEBUG // make sure iter points to one of our spec lists cFCOReport_i::GenreSpecList::iterator genreIter; for (genreIter = mpData->mGenreList.begin(); ; ++genreIter) diff --git a/src/tw/textreportviewer.cpp b/src/tw/textreportviewer.cpp index d1e8b61..f633d45 100644 --- a/src/tw/textreportviewer.cpp +++ b/src/tw/textreportviewer.cpp @@ -2006,7 +2006,7 @@ void cTextReportViewer::GetChar() // sequence was not a valid mb character // (searched MB_CUR_MAX chars and didn't find a complete mb character) d.TraceDebug( _T("Invalid mb char found!\n") ); -#ifdef _DEBUG +#ifdef DEBUG for( int j = 0; j < MB_CUR_MAX; j++ ) d.TraceDebug( _T("%u\n"), (size_t)(unsigned char)mCurrentChar[j] ); #endif diff --git a/src/tw/twinit.cpp b/src/tw/twinit.cpp index cac48aa..06fbafa 100644 --- a/src/tw/twinit.cpp +++ b/src/tw/twinit.cpp @@ -292,7 +292,7 @@ void cTWInit::Init( const TSTRING& strArgv0 ) tw_HandleSignal( SIGSEGV ); // Segmentation fault tw_HandleSignal( SIGQUIT ); // Quit signal - issued from terminal (CTRL-\) tw_HandleSignal( SIGILL ); // Illegal instruction - probably won't be an issue. -#ifndef _DEBUG +#ifndef DEBUG tw_HandleSignal( SIGTRAP ); // We don't want to mess up the debugger in debug builds... #endif tw_HandleSignal( SIGABRT ); // Supposedly we can only get this signal by calling abort() diff --git a/src/tw/twstrings.cpp b/src/tw/twstrings.cpp index 61ee236..6789fe2 100644 --- a/src/tw/twstrings.cpp +++ b/src/tw/twstrings.cpp @@ -42,7 +42,7 @@ #define UNICODE_STR _T("") -#ifdef _DEBUG +#ifdef DEBUG # define DEBUG_STR _T("d") #else # define DEBUG_STR _T("") diff --git a/src/tw/twutil.cpp b/src/tw/twutil.cpp index 62a25f3..f227e6b 100644 --- a/src/tw/twutil.cpp +++ b/src/tw/twutil.cpp @@ -1126,7 +1126,7 @@ static struct termios Otty; static void RestoreEcho(int sig) { #if SUPPORTS_TERMIOS -#ifdef _DEBUG +#ifdef DEBUG std::cout << "Caught signal, resetting echo."<< std::endl; sleep(2); #endif diff --git a/src/twadmin/keygeneration.cpp b/src/twadmin/keygeneration.cpp index b858d4e..2f304bd 100644 --- a/src/twadmin/keygeneration.cpp +++ b/src/twadmin/keygeneration.cpp @@ -85,7 +85,7 @@ static void GeneratePublicPrivateKeys(void* pParams, const cElGamalSig::KeySize try { cKeyFile keyfile; -#ifdef _DEBUG +#ifdef DEBUG cDebug d("GeneratePublicPrivateKeys"); d.TraceDebug("calling keyfile.GenerateKeys()\n"); #endif @@ -101,7 +101,7 @@ static void GeneratePublicPrivateKeys(void* pParams, const cElGamalSig::KeySize return; } -#ifdef _DEBUG +#ifdef DEBUG d.TraceDebug(_T("writing to keyfile %s\n"), pGK->keyPath); #endif @@ -135,7 +135,7 @@ bool GenerateKey(const TCHAR* keyPath, wc16_string passphrase, const cElGamalSig passphrase.swapbytes(); #endif -#ifdef _DEBUG +#ifdef DEBUG // test reading in the keys wc16_string passphrase_copy = passphrase.c_str(); wc16_string passphrase_copy2 = passphrase.c_str(); @@ -169,7 +169,7 @@ bool GenerateKey(const TCHAR* keyPath, wc16_string passphrase, const cElGamalSig return false; } -#ifdef _DEBUG +#ifdef DEBUG // test reading in the keys cKeyFile keyfile; diff --git a/src/twcrypto/crypto.cpp b/src/twcrypto/crypto.cpp index 92dbf25..a655794 100644 --- a/src/twcrypto/crypto.cpp +++ b/src/twcrypto/crypto.cpp @@ -476,7 +476,7 @@ void cRSAPublicKey::Write(void* pDataStream) const WRITE_INTEGER(e); } -#ifdef _DEBUG +#ifdef DEBUG void cRSAPublicKey::TraceContents() { cDebug d("cRSAPublicKey::TraceContents"); @@ -687,7 +687,7 @@ void cRSA::GenerateKeys(cRSAPrivateKey*& retPrivate, cRSAPublicKey*& retPublic) retPublic->mpData->mpKey = pNewPublicKey; retPublic->mpData->mKeyLength = mpData->mKeyBits; -#ifdef _DEBUG +#ifdef DEBUG int l; l = retPublic->mpData->mpKey->MaxPlainTextLength(); ASSERT(l == GetBlockSizePlain()); @@ -954,7 +954,7 @@ bool cElGamalSigPublicKey::IsEqual(const cElGamalSigPublicKey& rhs) const ; } -#ifdef _DEBUG +#ifdef DEBUG void cElGamalSigPublicKey::TraceContents() { cDebug d("cElGamalSigPublicKey::TraceContents"); @@ -1167,7 +1167,7 @@ void cElGamalSig::GenerateKeys(cElGamalSigPrivateKey*& retPrivate, cElGamalSigPu retPublic->mpData->mpKey = pNewPublicKey; retPublic->mpData->mKeyLength = (int16)mpData->mKeyBits; -#ifdef _DEBUG +#ifdef DEBUG int l; l = retPublic->mpData->mpKey->SignatureLength(); ASSERT(l + PLAIN_BLOCK_SIZE <= GetBlockSizeCipher()); @@ -1250,7 +1250,7 @@ void RandomizeBytes(int8* destbuf, int len) for (mask = 0xb147688c; time(NULL) - start < 1; mask += 0x8984cc88) ; - #ifdef _DEBUG + #ifdef DEBUG time_t t = time(NULL); t ^= mask; diff --git a/src/twcrypto/crypto.h b/src/twcrypto/crypto.h index ddd5d13..4373fc7 100644 --- a/src/twcrypto/crypto.h +++ b/src/twcrypto/crypto.h @@ -209,7 +209,7 @@ public: int GetWriteLen() const; void Write(void* pDataStream) const; -#ifdef _DEBUG +#ifdef DEBUG void TraceContents(); #endif @@ -315,7 +315,7 @@ public: // This is used to make sure the key used to sign the config // file is the same as the key we are currently using. -#ifdef _DEBUG +#ifdef DEBUG void TraceContents(); #endif diff --git a/src/twcrypto/keyfile.cpp b/src/twcrypto/keyfile.cpp index 1c6ec9e..12d7767 100644 --- a/src/twcrypto/keyfile.cpp +++ b/src/twcrypto/keyfile.cpp @@ -398,7 +398,7 @@ void cKeyFile::ProtectKeys(int8* passphrase, int passphraseLen) // throw eKeyFil des.ProcessBlock(mpPrivateKeyMem + i, mpPrivateKeyMem + i); } -#ifdef _DEBUG +#ifdef DEBUG // try decoding it just to see if it worked if (GetPrivateKey(passphrase, passphraseLen) == 0) { diff --git a/src/twparser/parserhelper.cpp b/src/twparser/parserhelper.cpp index 3415907..155d07b 100644 --- a/src/twparser/parserhelper.cpp +++ b/src/twparser/parserhelper.cpp @@ -64,7 +64,7 @@ static bool util_IsOctal( const char ch ); static int util_GetEscapeValueOfChar( char ch ); static int util_GetRecurseDepth( const cParseNamedAttrList* pList ); //throw( eParserHelper ) static void util_LoseSurroundingWS( TSTRING& str ); -#ifdef _DEBUG +#ifdef DEBUG static bool util_AsciiCharsActLikeTheyShould(); #endif @@ -226,7 +226,7 @@ void cPreprocessor::PopState() ASSERT( ! mStateStack.empty() ); mStateStack.pop(); -#ifdef _DEBUG +#ifdef DEBUG if( !Empty() && TopState() == STATE_ACCEPT ) d.TraceDebug(_T("State == STATE_ACCEPT\n")); else @@ -502,7 +502,7 @@ void cParserUtil::InterpretEscapedString( const std::string& strEscapedString, T } } -#ifdef _DEBUG +#ifdef DEBUG std::string str; str = "before: <"; @@ -1085,7 +1085,7 @@ void util_LoseSurroundingWS( TSTRING& str ) } -#ifdef _DEBUG +#ifdef DEBUG bool util_AsciiCharsActLikeTheyShould() { // we need numbers whose character diff --git a/src/twparser/policyparser.cpp b/src/twparser/policyparser.cpp index bdedd97..080c4a4 100644 --- a/src/twparser/policyparser.cpp +++ b/src/twparser/policyparser.cpp @@ -170,7 +170,7 @@ std::string cPolicyParser::ConvertMultibyte( std::istream& in ) throw eParserBadCharacter(); } -#ifdef _DEBUG +#ifdef DEBUG TCERR << _T("*** begin policy text ***") << std::endl; std::cerr << ss.str() << std::endl; TCERR << _T("*** end policy text ***") << std::endl << std::endl; @@ -179,7 +179,7 @@ std::string cPolicyParser::ConvertMultibyte( std::istream& in ) // convert it to single byte escaped std::string str = util_ConvertMB( ss.str() ); -#ifdef _DEBUG +#ifdef DEBUG TCERR << _T("*** begin policy converted to ***") << std::endl; std::cerr << str << std::endl; TCERR << _T("*** end policy converted to ***") << std::endl << std::endl; diff --git a/src/twparser/yylex.cpp b/src/twparser/yylex.cpp index ed66a60..5356335 100644 --- a/src/twparser/yylex.cpp +++ b/src/twparser/yylex.cpp @@ -1121,12 +1121,12 @@ yy_scan::yylex() *mpstring = strW; -#ifdef _DEBUG +#ifdef DEBUG TSTRING strDisplay = *mpstring; cDisplayEncoder e; e.Encode( strDisplay ); d.TraceDetail("interpreted as --> <%s>\n", strDisplay.c_str()); -#endif // _DEBUG +#endif // DEBUG // attach to lval yylval.mpString = mpstring; diff --git a/src/twtest/cmdlineparser_t.cpp b/src/twtest/cmdlineparser_t.cpp index 8996d80..4d32ca5 100644 --- a/src/twtest/cmdlineparser_t.cpp +++ b/src/twtest/cmdlineparser_t.cpp @@ -88,7 +88,7 @@ const TCHAR* argv5[] = _T("frog") }; -#ifdef _DEBUG +#ifdef DEBUG static void PrintCmdLine(int argc, const TCHAR** argv, cDebug d) { TSTRING str; @@ -104,7 +104,7 @@ static void PrintCmdLine(int argc, const TCHAR** argv, cDebug d) static void test_parse(cCmdLineParser& parser, const int argc, const TCHAR** argv, bool should_throw) { -#ifdef _DEBUG +#ifdef DEBUG cDebug d("test_parse"); PrintCmdLine(argc, argv, d); #endif @@ -122,7 +122,7 @@ static void test_parse(cCmdLineParser& parser, const int argc, const TCHAR** arg TEST(threw == should_throw); -#ifdef _DEBUG +#ifdef DEBUG parser.TraceContents(); #endif } diff --git a/src/twtest/hashtable_t.cpp b/src/twtest/hashtable_t.cpp index 4db455f..f5ef5cb 100644 --- a/src/twtest/hashtable_t.cpp +++ b/src/twtest/hashtable_t.cpp @@ -110,7 +110,7 @@ void HashTest1() } // get statistics -#ifdef _DEBUG +#ifdef DEBUG htable.TraceDiagnostics(); #endif From fdb25ca90355ca0be674fbbebe1c90bcbbc47563 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 12 Apr 2017 22:42:49 -0700 Subject: [PATCH 004/110] Define NDEBUG for non-debug builds --- configure | 4 ++++ configure.ac | 2 ++ 2 files changed, 6 insertions(+) diff --git a/configure b/configure index 00df1a1..94fc336 100755 --- a/configure +++ b/configure @@ -3499,6 +3499,10 @@ then $as_echo "#define DEBUG 1" >>confdefs.h +else + +$as_echo "#define NDEBUG 1" >>confdefs.h + fi ac_ext=c diff --git a/configure.ac b/configure.ac index 2e72058..fe49c0b 100644 --- a/configure.ac +++ b/configure.ac @@ -40,6 +40,8 @@ then CFLAGS="${CFLAGS} -g" CXXFLAGS="${CXXFLAGS} -g" AC_DEFINE(DEBUG, 1, [Compile with debug code]) +else + AC_DEFINE(NDEBUG, 1, [Compile without debug code]) fi dnl ################### From 5a425591cea68af7f5a80ac0a330dcd98bfa937e Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 19 Apr 2017 20:20:08 -0700 Subject: [PATCH 005/110] Redo hierdatabase & dbdatasource unit tests so they do something useful; add sanity checks to cBlockRecordFile::FindRoomForData and cDbDataSourceIter::SetFCOData, the need for these was exposed by the new tests. Also update debug-only DB Explore mode with a few more commands --- src/db/blockrecordfile.cpp | 11 +- src/tw/dbdatasource.cpp | 32 ++- src/tw/dbexplore.cpp | 104 +++++++- src/twtest/dbdatasource_t.cpp | 396 +++++++++++------------------ src/twtest/hierdatabase_t.cpp | 464 ++++++++++++---------------------- src/twtest/test.cpp | 8 +- 6 files changed, 441 insertions(+), 574 deletions(-) diff --git a/src/db/blockrecordfile.cpp b/src/db/blockrecordfile.cpp index 194a5db..96f8de1 100644 --- a/src/db/blockrecordfile.cpp +++ b/src/db/blockrecordfile.cpp @@ -266,11 +266,14 @@ int cBlockRecordFile::FindRoomForData( int32 dataSize ) //throw (eArchive) // first, try the last added to block... // d.TraceDetail( "Looking for room for %d bytes; first trying mLastAddedTo (%d)\n", dataSize, mLastAddedTo ); - util_InitBlockArray( mvBlocks[mLastAddedTo] ); - if( mvBlocks[mLastAddedTo].GetAvailableSpace() >= dataSize ) + if( mLastAddedTo >= 0 ) { - d.TraceDetail( "---Found room in block %d\n", mLastAddedTo ); - return mLastAddedTo; + util_InitBlockArray( mvBlocks[mLastAddedTo] ); + if( mvBlocks[mLastAddedTo].GetAvailableSpace() >= dataSize ) + { + d.TraceDetail( "---Found room in block %d\n", mLastAddedTo ); + return mLastAddedTo; + } } // // ok, I guess we will have to iterate through all the blocks... diff --git a/src/tw/dbdatasource.cpp b/src/tw/dbdatasource.cpp index 2f96ca9..faacfb7 100644 --- a/src/tw/dbdatasource.cpp +++ b/src/tw/dbdatasource.cpp @@ -263,20 +263,24 @@ void cDbDataSourceIter::SetFCOData( const iFCO* pFCO ) //throw (eError) { mDbIter.RemoveData(); } - // - // write the fco's property set to a memory archive... - // - // TODO -- does this need to be static? - static cMemoryArchive arch; - arch.Seek ( 0, cBidirArchive::BEGINNING ); - cSerializerImpl ser (arch, cSerializerImpl::S_WRITE); - ser.Init(); - ser.WriteObject ( pFCO->GetPropSet() ); - ser.Finit(); - // - // write this to the archive... - // - mDbIter.SetData( arch.GetMemory(), arch.CurrentPos() ); + + if( pFCO ) + { + // + // write the fco's property set to a memory archive... + // + // TODO -- does this need to be static? + static cMemoryArchive arch; + arch.Seek ( 0, cBidirArchive::BEGINNING ); + cSerializerImpl ser (arch, cSerializerImpl::S_WRITE); + ser.Init(); + ser.WriteObject ( pFCO->GetPropSet() ); + ser.Finit(); + // + // write this to the archive... + // + mDbIter.SetData( arch.GetMemory(), arch.CurrentPos() ); + } } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/tw/dbexplore.cpp b/src/tw/dbexplore.cpp index 4d4692f..40d3c16 100644 --- a/src/tw/dbexplore.cpp +++ b/src/tw/dbexplore.cpp @@ -250,6 +250,104 @@ void cDbExplore::Execute( cFCODatabaseFileIter& dbIter ) } } //----------------------------------------------------------------- + // mkdir + //----------------------------------------------------------------- + else if( verb.compare( _T("mkdir") ) == 0 ) + { + GetNoun(noun); + TCOUT << "Making a child of " << noun << std::endl; + if( pIter->SeekTo( noun.c_str() ) ) + { + pIter->AddChildArray(); + } + else + { + TCOUT << "Unable to find object " << noun << std::endl; + } + } + //----------------------------------------------------------------- + // mk + //----------------------------------------------------------------- + else if( verb.compare( _T("mk") ) == 0 ) + { + GetNoun(noun); + TCOUT << "Making object " << noun << std::endl; + if( pIter->SeekTo( noun.c_str() ) ) + { + TCOUT << "Error: object already exists!" << std::endl; + } + else + { + pIter->AddFCO( noun, 0 ); // add a null fco for now + } + } + //----------------------------------------------------------------- + // rmdir + //----------------------------------------------------------------- + else if( verb.compare( _T("rmdir") ) == 0 ) + { + GetNoun(noun); + TCOUT << "Removing the child of " << noun << std::endl; + if( pIter->SeekTo( noun.c_str() ) ) + { + if( pIter->CanRemoveChildArray() ) + { + pIter->RemoveChildArray(); + } + else + { + TCOUT << "Can't delete object; it still has children." << std::endl; + } + } + else + { + TCOUT << "Unable to find object " << noun << std::endl; + } + } + //----------------------------------------------------------------- + // rm + //----------------------------------------------------------------- + else if( verb.compare( _T("rm") ) == 0 ) + { + GetNoun(noun); + TCOUT << "Removing object " << noun << std::endl; + if( pIter->SeekTo( noun.c_str() ) ) + { + if( pIter->CanDescend() ) + { + TCOUT << "Can't delete object; it still has children." << std::endl; + } + else + { + pIter->RemoveFCO(); + } + } + else + { + TCOUT << "Unable to find object " << noun << std::endl; + } + } + else if( verb.compare( _T("rmdata") ) == 0 ) + { + GetNoun(noun); + TCOUT << "Removing object data " << noun << std::endl; + if( pIter->SeekTo( noun.c_str() ) ) + { + if( pIter->CanDescend() ) + { + TCOUT << "Can't delete object; it still has children." << std::endl; + } + else + { + pIter->RemoveFCOData(); + } + } + else + { + TCOUT << "Unable to find object " << noun << std::endl; + } + } + //----------------------------------------------------------------- // pwd //----------------------------------------------------------------- else if( verb.compare( _T("pwd") ) == 0 ) @@ -380,11 +478,11 @@ void cDbExplore::Execute( cFCODatabaseFileIter& dbIter ) // make sure the file is still valid... // - /* + #ifdef _BLOCKFILE_DEBUG - db.AssertAllBlocksValid() ; + dbIter.GetDb().AssertAllBlocksValid(); #endif - */ + } delete pIter; diff --git a/src/twtest/dbdatasource_t.cpp b/src/twtest/dbdatasource_t.cpp index 15c4322..00d077d 100644 --- a/src/twtest/dbdatasource_t.cpp +++ b/src/twtest/dbdatasource_t.cpp @@ -41,268 +41,174 @@ #include "fco/fcoprop.h" #include "fco/fco.h" #include "twtest/test.h" +#include "fs/fsobject.h" -static void GetNoun( TSTRING& noun ) +static void AddFile(cDbDataSourceIter& iter, const TSTRING& filename, bool with_data=false) { - static TSTRING prevNoun; - TCIN >> noun; - if( noun.compare( _T("!$") ) == 0 ) + if (iter.SeekTo(filename.c_str())) + TCOUT << "Object " << filename << " already exists!" << std::endl; + + cFCOName fname(filename); + + if (with_data) { - noun = prevNoun; + iFCO* pFCO = new cFSObject(fname); + iter.AddFCO(filename,pFCO); } - prevNoun = noun; + else + { + iter.AddFCO(filename,0); + } + + TEST(iter.HasFCOData() == with_data); } -// -// TODO -- implement this with the prop displayer as well! -// -static void PrintFCO( const iFCO* pFCO ) +static void AddDirectory(cDbDataSourceIter& iter, const TSTRING& filename) { - TCOUT.setf(std::ios::left); - - TCOUT << "------- " << pFCO->GetName().AsString() << " -------" << std::endl; - // - // iterate over all of the properties - // - const iFCOPropSet* pPropSet = pFCO->GetPropSet(); - cFCOPropVector v = pPropSet->GetValidVector(); - for( int i=0; i < pPropSet->GetNumProps(); i++ ) - { - if( v.ContainsItem( i ) ) + if (iter.SeekTo(filename.c_str())) + TCOUT << "Object " << filename << " already exists!" << std::endl; + + iter.AddFCO(filename, 0); + iter.AddChildArray(); + + TEST(iter.CanDescend()); +} + +static void RemoveDirectory(cDbDataSourceIter& iter, const TSTRING& filename) +{ + TCOUT << "Removing the child of " << filename << std::endl; + if( iter.SeekTo( filename.c_str() ) ) + { + //TODO -- check that it has an empty child + iter.RemoveChildArray(); + iter.RemoveFCO(); + } + else + { + TCOUT << "Unable to find object " << filename << std::endl; + } +} + +static void RemoveFile(cDbDataSourceIter& iter, const TSTRING& filename) +{ + TCOUT << "Removing object " << filename << std::endl; + cFCOName fname(filename); + iter.SeekToFCO(fname); + + if( iter.CanDescend() ) + { + TCOUT << "Can't delete object; it still has children." << std::endl; + } + else + { + iter.RemoveFCOData(); + iter.RemoveFCO(); + } +} + +static void ChDir(cDbDataSourceIter& iter, const TSTRING& filename) +{ + if( filename.compare( _T("..") ) == 0 ) + { + if( iter.AtRoot() ) + TCOUT << "At root already" << std::endl; + + TCOUT << "Ascending..." << std::endl; + iter.Ascend(); + } + else + { + if( iter.SeekTo( filename.c_str() ) ) { - TCOUT << "["; - TCOUT.width(2); - TCOUT << i << "]" ; - TCOUT.width(25); - TCOUT << pPropSet->GetPropName(i); - TCOUT.width(0); - TCOUT << pPropSet->GetPropAt( i )->AsString() << std::endl; + if( !iter.CanDescend()) + TCOUT << filename << " has no children; can't descend." << std::endl; + + TCOUT << "Descending into " << filename << std::endl; + iter.Descend(); + } + else + { + TCOUT << "Unable to find object " << filename << std::endl; } } - TCOUT << "--------------------------------------------" << std::endl; } - -void TestDbDataSource() +static void AssertData(cDbDataSourceIter& iter, const TSTRING& filename, bool should_have) +{ + bool exists = iter.SeekTo( filename.c_str() ); + TEST(exists == should_have); + + if (exists) + { + bool has_data = iter.HasFCOData(); + TEST(has_data == should_have); + + if (has_data) + { + iFCO* pFCO = iter.CreateFCO(); + TEST(pFCO); + TCOUT << "Roundtrip FCOName = " << pFCO->GetName().AsString() << std::endl; + TSTRING expected = filename + "/"; + TEST(pFCO->GetName().AsString() == expected); + } + } +} + +static void AssertExists(cDbDataSourceIter& iter, const TSTRING& filename, bool should_have) +{ + bool exists = iter.SeekTo( filename.c_str() ); + TEST(exists == should_have); +} + +static void AssertChildren(cDbDataSourceIter& iter, const TSTRING& filename, bool should_have) +{ + bool exists = iter.SeekTo( filename.c_str() ); + + if (exists) + { + bool has_children = iter.CanDescend(); + TEST(has_children == should_have); + } +} + +void TestDbDataSourceBasic() { - TCERR << std::endl << "TestDbDataSource needs to be redesigned so it doesn't require user interaction" << std::endl; - -#if 0 - cDebug d("TestDbDataSource"); cHierDatabase db; + db.Open( _T("test.db"), 5, true); + cDbDataSourceIter iter(&db); - const TSTRING dbName = _T("tw.db"); + AddFile(iter, "file1", true); + AddFile(iter, "file2", false); + AddFile(iter, "file3", false); + AddDirectory(iter, "dir1"); + AddDirectory(iter, "dir2"); + AddDirectory(iter, "dir3"); + AssertData(iter, "file1", true); + + ChDir(iter, "dir1"); + AddFile(iter, "dir1_file1"); + ChDir(iter, ".."); + + RemoveFile(iter, "file1"); + RemoveFile(iter, "file2"); + + AssertExists(iter, "file1", false); + AssertExists(iter, "file2", false); + AssertExists(iter, "file3", true); + + RemoveDirectory(iter, "dir2"); + + AssertExists(iter, "dir1", true); + AssertExists(iter, "dir2", false); + AssertExists(iter, "dir3", true); + + AssertChildren(iter, "dir1", true); + AssertChildren(iter, "dir3", true); + AssertChildren(iter, "file3", false); - try - { - // TODO -- get the case sensitiveness and delimiting char out of the factory instead of iFSServices - // - TCOUT << _T("Opening database ") << dbName << std::endl; - db.Open( dbName, 5, false ); - cDbDataSourceIter iter( &db ); - - //////////////////////////// - // the main event loop... - //////////////////////////// - while( true ) - { - TSTRING verb, noun; - TCOUT << _T(">>"); - TCIN >> verb; - // - // ok, now we switch on the command... - // - //----------------------------------------------------------------- - // quit - //----------------------------------------------------------------- - if( verb.compare( _T("quit") ) == 0 ) - { - // the quit command... - break; - } - //----------------------------------------------------------------- - // print - //----------------------------------------------------------------- - if( verb.compare( _T("print") ) == 0 ) - { - GetNoun(noun); - if( iter.SeekTo( noun.c_str() ) ) - { - if( iter.HasFCOData() ) - { - iFCO* pFCO = iter.CreateFCO(); - PrintFCO( pFCO ); - pFCO->Release(); - } - else - { - TCOUT << "Object has no data associated with it." << std::endl; - } - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - //----------------------------------------------------------------- - // mkdir - //----------------------------------------------------------------- - else if( verb.compare( _T("mkdir") ) == 0 ) - { - GetNoun(noun); - TCOUT << "Making a child of " << noun << std::endl; - if( iter.SeekTo( noun.c_str() ) ) - { - iter.AddChildArray(); - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - //----------------------------------------------------------------- - // mk - //----------------------------------------------------------------- - else if( verb.compare( _T("mk") ) == 0 ) - { - GetNoun(noun); - TCOUT << "Making object " << noun << std::endl; - if( iter.SeekTo( noun.c_str() ) ) - { - TCOUT << "Error: object already exists!" << std::endl; - } - else - { - iter.AddFCO( noun, 0 ); // add a null fco for now - } - } - //----------------------------------------------------------------- - // rmdir - //----------------------------------------------------------------- - // TODO -- still needs to be implemented in the iterator class! - // - /* - else if( verb.compare( _T("rmdir") ) == 0 ) - { - GetNoun(noun); - TCOUT << "Removing the child of " << noun << std::endl; - if( iter.SeekTo( noun.c_str() ) ) - { - //TODO -- check that it has an empty child - iter.DeleteChildArray(); - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - */ - //----------------------------------------------------------------- - // rm - //----------------------------------------------------------------- - else if( verb.compare( _T("rm") ) == 0 ) - { - GetNoun(noun); - TCOUT << "Removing object " << noun << std::endl; - if( iter.SeekTo( noun.c_str() ) ) - { - if( iter.CanDescend() ) - { - TCOUT << "Can't delete object; it still has children." << std::endl; - } - else - { - iter.RemoveFCO(); - } - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - //----------------------------------------------------------------- - // pwd - //----------------------------------------------------------------- - else if( verb.compare( _T("pwd") ) == 0 ) - { - TCOUT << iter.GetParentName().AsString() << std::endl; - } - //----------------------------------------------------------------- - // ls - //----------------------------------------------------------------- - else if( verb.compare( _T("ls") ) == 0 ) - { - int cnt = 0; - for( iter.SeekBegin(); ! iter.Done(); iter.Next(), cnt++ ) - { - TCOUT << "[" << cnt ; - if( iter.CanDescend() ) - { - TCOUT << "]*\t" ; - } - else - { - TCOUT << "]\t" ; - } - TCOUT << iter.GetShortName() << std::endl; - } - } - //----------------------------------------------------------------- - // cd - //----------------------------------------------------------------- - else if( verb.compare( _T("cd") ) == 0 ) - { - GetNoun(noun); - if( noun.compare( _T("..") ) == 0 ) - { - if( iter.AtRoot() ) - { - TCOUT << "Can't ascend above root." << std::endl; - } - else - { - TCOUT << "Ascending..." << std::endl; - iter.Ascend(); - } - } - else - { - if( iter.SeekTo( noun.c_str() ) ) - { - if( iter.CanDescend() ) - { - TCOUT << "Descending into " << noun << std::endl; - iter.Descend(); - } - else - { - TCOUT << noun << " has no children; can't descend." << std::endl; - } - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - } - - // make sure the file is still valid... - // -#ifdef _BLOCKFILE_DEBUG - db.AssertAllBlocksValid() ; -#endif - } - - TCOUT << "Exiting..." << std::endl; - - - } - catch( eError& e ) - { - d.TraceError("*** Caught error: %d %s\n", e.GetID(), e.GetMsg().c_str() ); - TEST(false); - } +#ifdef DEBUG + db.AssertAllBlocksValid(); #endif } diff --git a/src/twtest/hierdatabase_t.cpp b/src/twtest/hierdatabase_t.cpp index 22d6d49..1091494 100644 --- a/src/twtest/hierdatabase_t.cpp +++ b/src/twtest/hierdatabase_t.cpp @@ -35,319 +35,175 @@ #include "test.h" #include "core/error.h" -/*static void PrintDb( cHierDatabase::iterator iter, cDebug d, bool bFirst = true ) -{ - if( ! bFirst ) - { - iter.Descend(); - } - d.TraceDebug( "-- Processing directory %s\n", iter.GetCwd().c_str() ); - for( iter.SeekBegin(); ! iter.Done(); iter.Next() ) + +static const TSTRING g_block_data = "Hello World Hello World Hello World Hello World"; + + +static void AddFile(cHierDatabase::iterator& iter, const TSTRING& filename, bool with_data=false) +{ + if (iter.SeekTo(filename.c_str())) + TCOUT << "Object " << filename << " already exists!" << std::endl; + + iter.CreateEntry(filename); + + if (with_data) + { + iter.SetData( (int8*)g_block_data.c_str(), g_block_data.length() + 1 ); + } + + TEST(iter.HasData() == with_data); +} + +static void AddDirectory(cHierDatabase::iterator& iter, const TSTRING& filename) +{ + if (iter.SeekTo(filename.c_str())) + TCOUT << "Object " << filename << " already exists!" << std::endl; + + iter.CreateEntry(filename); + iter.CreateChildArray(); + + TEST(iter.CanDescend()); +} + +static void RemoveDirectory(cHierDatabase::iterator& iter, const TSTRING& filename) +{ + TCOUT << "Removing the child of " << filename << std::endl; + if( iter.SeekTo( filename.c_str() ) ) + { + //TODO -- check that it has an empty child + iter.DeleteChildArray(); + iter.DeleteEntry(); + } + else + { + TCOUT << "Unable to find object " << filename << std::endl; + } +} + +static void RemoveFile(cHierDatabase::iterator& iter, const TSTRING& filename) +{ + TCOUT << "Removing object " << filename << std::endl; + if( iter.SeekTo( filename.c_str() ) ) { - d.TraceDebug( "Processing entry %s\n", iter.GetName() ); if( iter.CanDescend() ) { - d.TraceDebug( ">>Descending...\n" ); - PrintDb(iter, d, false); + TCOUT << "Can't delete object; it still has children." << std::endl; } - } - - d.TraceDebug( "-- Done Processing directory %s\n", iter.GetCwd().c_str() ); -}*/ - -static void GetNoun( TSTRING& noun ) -{ - static TSTRING prevNoun; - TCIN >> noun; - if( noun.compare( _T("!$") ) == 0 ) - { - noun = prevNoun; - } - prevNoun = noun; -} - -/////////////////////////////////////////////////////////////////////////////// -// TestHierDatabaseInteractive -- this provides an interactive interface to -// the database -/////////////////////////////////////////////////////////////////////////////// -void TestHierDatabaseInteractive() -{ - TCERR << std::endl << "TestHierDatabaseInteractive needs to be redesigned (& renamed) to not require user interaction" << std::endl; - -#if 0 - cDebug d( "TestHierDatabaseInteractive" ); - try - { - cHierDatabase db; - //db.Open( _T("c:/tmp/tw.hdb"), 5, true); - db.Open( _T("tw.db"), 5, false); - cHierDatabase::iterator iter(&db); - - while( true ) + else { - TSTRING verb, noun; - TCOUT << _T(">>"); - TCIN >> verb; - // - // ok, now we switch on the command... - // - //----------------------------------------------------------------- - // quit - //----------------------------------------------------------------- - if( verb.compare( _T("quit") ) == 0 ) - { - // the quit command... - break; - } - //----------------------------------------------------------------- - // print - //----------------------------------------------------------------- - if( verb.compare( _T("print") ) == 0 ) - { - // the print command... - ASSERT( false ); - // TODO -- Implement this! - } - //----------------------------------------------------------------- - // mkdir - //----------------------------------------------------------------- - else if( verb.compare( _T("mkdir") ) == 0 ) - { - GetNoun(noun); - TCOUT << "Making a child of " << noun << std::endl; - if( iter.SeekTo( noun.c_str() ) ) - { - iter.CreateChildArray(); - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - //----------------------------------------------------------------- - // mk - //----------------------------------------------------------------- - else if( verb.compare( _T("mk") ) == 0 ) - { - GetNoun(noun); - TCOUT << "Making object " << noun << std::endl; - if( iter.SeekTo( noun.c_str() ) ) - { - TCOUT << "Error: object already exists!" << std::endl; - } - else - { - iter.CreateEntry( noun ); - } - } - //----------------------------------------------------------------- - // rmdir - //----------------------------------------------------------------- - else if( verb.compare( _T("rmdir") ) == 0 ) - { - GetNoun(noun); - TCOUT << "Removing the child of " << noun << std::endl; - if( iter.SeekTo( noun.c_str() ) ) - { - //TODO -- check that it has an empty child - iter.DeleteChildArray(); - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - //----------------------------------------------------------------- - // rm - //----------------------------------------------------------------- - else if( verb.compare( _T("rm") ) == 0 ) - { - GetNoun(noun); - TCOUT << "Removing object " << noun << std::endl; - if( iter.SeekTo( noun.c_str() ) ) - { - if( iter.CanDescend() ) - { - TCOUT << "Can't delete object; it still has children." << std::endl; - } - else - { - iter.DeleteEntry(); - } - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - //----------------------------------------------------------------- - // pwd - //----------------------------------------------------------------- - else if( verb.compare( _T("pwd") ) == 0 ) - { - TCOUT << iter.GetCwd() << std::endl; - } - //----------------------------------------------------------------- - // ls - //----------------------------------------------------------------- - else if( verb.compare( _T("ls") ) == 0 ) - { - int cnt = 0; - for( iter.SeekBegin(); ! iter.Done(); iter.Next(), cnt++ ) - { - TCOUT << "[" << cnt ; - if( iter.CanDescend() ) - { - TCOUT << "]*\t" ; - } - else - { - TCOUT << "]\t" ; - } - TCOUT << iter.GetName() << std::endl; - } - } - //----------------------------------------------------------------- - // cd - //----------------------------------------------------------------- - else if( verb.compare( _T("cd") ) == 0 ) - { - GetNoun(noun); - if( noun.compare( _T("..") ) == 0 ) - { - if( iter.AtRoot() ) - { - TCOUT << "Can't ascend above root." << std::endl; - } - else - { - TCOUT << "Ascending..." << std::endl; - iter.Ascend(); - } - } - else - { - if( iter.SeekTo( noun.c_str() ) ) - { - if( iter.CanDescend() ) - { - TCOUT << "Descending into " << noun << std::endl; - iter.Descend(); - } - else - { - TCOUT << noun << " has no children; can't descend." << std::endl; - } - } - else - { - TCOUT << "Unable to find object " << noun << std::endl; - } - } - } - //----------------------------------------------------------------- - // rmdir - //----------------------------------------------------------------- - else if( verb.compare( _T("rmdir") ) == 0 ) - { - GetNoun(noun); - if( iter.SeekTo( noun.c_str() ) ) - { - if( iter.CanDescend() ) - { - TCOUT << "Deleting child of " << iter.GetName() << std::endl; - iter.DeleteChildArray(); - } - else - { - TCOUT << noun << " has no child; can't delete." << std::endl; - } - } - - } - //----------------------------------------------------------------- - // rm - //----------------------------------------------------------------- - else if( verb.compare( _T("rm") ) == 0 ) - { - GetNoun(noun); - if( iter.SeekTo( noun.c_str() ) ) - { - if( iter.CanDescend() ) - { - TCOUT << noun << " doesn't exist; can't delete." << std::endl; - } - else - { - TCOUT << "Deleting " << iter.GetName() << std::endl; - iter.DeleteEntry(); - } - } - - } - //----------------------------------------------------------------- - // set - //----------------------------------------------------------------- - else if( verb.compare( _T("set") ) == 0 ) - { - GetNoun(noun); - if( iter.SeekTo( noun.c_str() ) ) - { - if( iter.HasData() ) - { - iter.RemoveData(); - } - TSTRING data; - TCIN >> data; - iter.SetData( (int8*)data.c_str(), data.length() + 1 ); - TCOUT << "Setting " << noun << "'s data to " << data << std::endl; - } - else - { - TCOUT << "Can't find object " << noun << std::endl; - } - - } - //----------------------------------------------------------------- - // get - //----------------------------------------------------------------- - else if( verb.compare( _T("get") ) == 0 ) - { - GetNoun(noun); - if( iter.SeekTo( noun.c_str() ) ) - { - if( ! iter.HasData() ) - { - TCOUT << "Object has no data!" << std::endl; - } - else - { - int32 dummyLength; - TCOUT << noun << "'s data is: " << (TCHAR*)iter.GetData(dummyLength) << std::endl; - } - } - else - { - TCOUT << "Can't find object " << noun << std::endl; - } - - } - - // make sure the file is still valid... - // -#ifdef _BLOCKFILE_DEBUG - db.AssertAllBlocksValid() ; -#endif + iter.RemoveData(); + iter.DeleteEntry(); } - - TCOUT << "Exiting..." << std::endl; - } - catch( eError& e ) + else { - d.TraceError( "Exception caught: %d %s\n", e.GetID(), e.GetMsg().c_str() ); - TEST( false ); + TCOUT << "Unable to find object " << filename << std::endl; } +} + +static void ChDir(cHierDatabase::iterator& iter, const TSTRING& filename) +{ + if( filename.compare( _T("..") ) == 0 ) + { + if( iter.AtRoot() ) + TCOUT << "At root already" << std::endl; + + TCOUT << "Ascending..." << std::endl; + iter.Ascend(); + } + else + { + if( iter.SeekTo( filename.c_str() ) ) + { + if( !iter.CanDescend()) + TCOUT << filename << " has no children; can't descend." << std::endl; + + TCOUT << "Descending into " << filename << std::endl; + iter.Descend(); + } + else + { + TCOUT << "Unable to find object " << filename << std::endl; + } + } +} + +static void AssertData(cHierDatabase::iterator& iter, const TSTRING& filename, bool should_have) +{ + bool exists = iter.SeekTo( filename.c_str() ); + TEST(exists == should_have); + + if (exists) + { + bool has_data = iter.HasData(); + TEST(has_data == should_have); + + if (has_data) + { + int32 dummyLength; + TSTRING read_str( (TCHAR*)iter.GetData(dummyLength) ); + TEST(read_str == g_block_data); + } + } +} + +static void AssertExists(cHierDatabase::iterator& iter, const TSTRING& filename, bool should_have) +{ + bool exists = iter.SeekTo( filename.c_str() ); + TEST(exists == should_have); +} + +static void AssertChildren(cHierDatabase::iterator& iter, const TSTRING& filename, bool should_have) +{ + bool exists = iter.SeekTo( filename.c_str() ); + + if (exists) + { + bool has_children = iter.CanDescend(); + TEST(has_children == should_have); + } +} + +void TestHierDatabaseBasic() +{ + cHierDatabase db; + db.Open( _T("test.db"), 5, true); + cHierDatabase::iterator iter(&db); + + AddFile(iter, "file1", true); + AddFile(iter, "file2", false); + AddFile(iter, "file3", false); + + AddDirectory(iter, "dir1"); + AddDirectory(iter, "dir2"); + AddDirectory(iter, "dir3"); + + AssertData(iter, "file1", true); + + ChDir(iter, "dir1"); + AddFile(iter, "dir1_file1"); + ChDir(iter, ".."); + + RemoveFile(iter, "file1"); + RemoveFile(iter, "file2"); + + AssertExists(iter, "file1", false); + AssertExists(iter, "file2", false); + AssertExists(iter, "file3", true); + + RemoveDirectory(iter, "dir2"); + + AssertExists(iter, "dir1", true); + AssertExists(iter, "dir2", false); + AssertExists(iter, "dir3", true); + + AssertChildren(iter, "dir1", true); + AssertChildren(iter, "dir3", true); + AssertChildren(iter, "file3", false); + +#ifdef DEBUG + db.AssertAllBlocksValid(); #endif } + diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index 799d587..2c5d4c0 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -112,9 +112,9 @@ void TestFSPropDisplayer(); void TestGenre(); void TestFSDataSourceIter(); void TestGenerateDb(); -void TestHierDatabaseInteractive(); +void TestHierDatabaseBasic(); void TestGenreSwitcher(); -void TestDbDataSource(); +void TestDbDataSourceBasic(); void TestGenreSpecList(); void TestIntegrityCheck(); void TestFCODatabaseFile(); @@ -213,9 +213,9 @@ static void Test(int testID) case 52: TestGenre(); break; case 53: TestFSDataSourceIter(); break; //case 54: TestGenerateDb(); break; - case 55: TestHierDatabaseInteractive(); break; + case 55: TestHierDatabaseBasic(); break; case 56: TestGenreSwitcher(); break; - case 57: TestDbDataSource(); break; + case 57: TestDbDataSourceBasic(); break; case 58: TestGenreSpecList(); break; //case 59: TestIntegrityCheck(); break; From 47c9861baaeba3b40b45e2a39c8f48a423f3f5f9 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 19 Apr 2017 23:37:35 -0700 Subject: [PATCH 006/110] Clean up various unit test TODOs, including re-enabling some test code that had been ifdef'd out; improve reporting of failures and how many actual tests were run --- src/twtest/cmdlineparser_t.cpp | 1 - src/twtest/dbdatasource_t.cpp | 1 - src/twtest/debug_t.cpp | 11 +++--- src/twtest/fconame_t.cpp | 35 +++++++++--------- src/twtest/fcopropvector_t.cpp | 64 ++++----------------------------- src/twtest/fcospecutil_t.cpp | 9 ++--- src/twtest/fspropset_t.cpp | 2 -- src/twtest/hierdatabase_t.cpp | 1 - src/twtest/srefcountobj_t.cpp | 5 +-- src/twtest/test.cpp | 41 ++++++++++++++++++--- src/twtest/unixfsservices_t.cpp | 9 +++-- 11 files changed, 74 insertions(+), 105 deletions(-) diff --git a/src/twtest/cmdlineparser_t.cpp b/src/twtest/cmdlineparser_t.cpp index 4d32ca5..c0b55a8 100644 --- a/src/twtest/cmdlineparser_t.cpp +++ b/src/twtest/cmdlineparser_t.cpp @@ -165,7 +165,6 @@ void TestCmdLineParser() { TCERR << _T("Command line error: "); TCERR << e.GetMsg() << std::endl; - //TODO... TEST(false); } } diff --git a/src/twtest/dbdatasource_t.cpp b/src/twtest/dbdatasource_t.cpp index 00d077d..6c035b1 100644 --- a/src/twtest/dbdatasource_t.cpp +++ b/src/twtest/dbdatasource_t.cpp @@ -79,7 +79,6 @@ static void RemoveDirectory(cDbDataSourceIter& iter, const TSTRING& filename) TCOUT << "Removing the child of " << filename << std::endl; if( iter.SeekTo( filename.c_str() ) ) { - //TODO -- check that it has an empty child iter.RemoveChildArray(); iter.RemoveFCO(); } diff --git a/src/twtest/debug_t.cpp b/src/twtest/debug_t.cpp index 26ab5bf..f5266e6 100644 --- a/src/twtest/debug_t.cpp +++ b/src/twtest/debug_t.cpp @@ -70,14 +70,15 @@ void TestDebug() d.TraceDebug("You should see this in stdout and trace.\n"); cDebug::RemoveOutTarget(cDebug::OUT_STDOUT); d.TraceDebug("You should see this in trace only.\n"); + + // set up an output file...use the temp file in test.h std::string str = TEMP_DIR_N; str += "/debug.out"; - bool bResult = false; - bResult = cDebug::SetOutputFile(str.c_str()); - //TODO... TEST(bResult); - if( !bResult) - TCERR << "SetOutputFile failed!" << std::endl; + +#ifdef DEBUG + TEST(cDebug::SetOutputFile(str.c_str())); +#endif d.TraceDebug("This should be in trace and the file %s.\n", str.c_str()); diff --git a/src/twtest/fconame_t.cpp b/src/twtest/fconame_t.cpp index 551b883..49e98ef 100644 --- a/src/twtest/fconame_t.cpp +++ b/src/twtest/fconame_t.cpp @@ -45,11 +45,6 @@ void TestFCOName() { -#if 0 - // the following only works w/case insensitive names - cGenreSwitcher::GetInstance()->SelectGenre( cGenre::NTFS ); -#endif - // test the relationship operator... cFCOName above (_T("/etc")); cFCOName extraDel (_T("/etc/")); @@ -103,28 +98,33 @@ void TestFCOName() cFCOName copyName(stringName); TEST(_tcscmp(copyName.AsString().c_str(), _T("/a/string/name")) == 0); - TCERR << "Multiple TODO tests in fconame_t.cpp" << std::endl; -#if 0 - cFCOName name(_T("new name")); + cFCOName name(_T("/new name")); nullName = name; - //TODO... TEST(_tcscmp(nullName.AsString().c_str(), _T("new name")) == 0); - - nullName = _T("newer name"); - //TODO... TEST(_tcscmp(nullName.AsString().c_str(), _T("newer name")) == 0); + TEST(_tcscmp(nullName.AsString().c_str(), _T("/new name")) == 0); + + nullName = _T("/newer name"); + TEST(_tcscmp(nullName.AsString().c_str(), _T("/newer name")) == 0); cMemoryArchive memArc; + { cSerializerImpl ser(memArc, cSerializerImpl::S_WRITE); ser.Init(); ser.WriteObject(&charName); - stringName.SetDelimiter(_T('\\')); + + //Note: backslash delimiters aren't supported (& don't work) in OST + //stringName.SetDelimiter(_T('\\')); + ser.WriteObject(&stringName); ser.Finit(); } + memArc.Seek(0, cBidirArchive::BEGINNING); + { cSerializerImpl ser(memArc, cSerializerImpl::S_READ); cFCOName name1, name2; + ser.Init(); ser.ReadObject(&name1); ser.ReadObject(&name2); @@ -132,12 +132,11 @@ void TestFCOName() TEST(name1.IsEqual(charName)); TEST(name2.IsEqual(stringName)); - TEST(! name1.IsCaseSensitive()); - TEST(! name2.IsCaseSensitive()); - TEST(name2.GetDelimiter() == _T('\\')); - TEST(name1.GetDelimiter() == _T('/')); + TEST(name1.IsCaseSensitive()); + TEST(name2.IsCaseSensitive()); + TEST(name2.GetDelimiter() == _T('/')); + TEST(name1.GetDelimiter() == _T('/')); } -#endif } diff --git a/src/twtest/fcopropvector_t.cpp b/src/twtest/fcopropvector_t.cpp index 6328afc..e953a87 100644 --- a/src/twtest/fcopropvector_t.cpp +++ b/src/twtest/fcopropvector_t.cpp @@ -74,9 +74,8 @@ void TestFCOPropVector() } //Test ability to add and remove - TCERR << "TODO: addRemove test in fcopropvector_t.cpp" << std::endl; - // TEST(testout = addRemove (test1, test2, d)); - // d.TraceDetail("Add/Remove over all tests is %i \n", testout); + TEST(testout = addRemove (test1, test2, d)); + d.TraceDetail("Add/Remove over all tests is %i \n", testout); // test clear. d.TraceDetail("Testing Clear()\n"); @@ -115,73 +114,23 @@ static bool init (cFCOPropVector &testV) } //end init -#if 0 // TODO: rework this so it doesn't need user interaction static bool addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d) { int var1 = 0 , var2 = 64, var3 = 2; bool local=true, out=true; - /* - bool loopvar = true; - int menu, var; - cFCOPropVector testV; - testV.SetSize(64); - while (loopvar) - { - - d.TraceAlways("\nChoose an operation to test:\n"); - d.TraceAlways("\t1)Add an item to vector.\n"); - d.TraceAlways("\t2)Remove an item from vector. \n"); - d.TraceAlways("\t3)Check vector for item. \n"); - d.TraceAlways("\t4)Display vector information \n"); - d.TraceAlways("\t5)Stop add/remove tests. \n"); - d.TraceAlways("Your choice [1-5]: "); - cin>>menu; - d.TraceAlways("\n"); - - switch (menu) - { - case 1: - d.TraceAlways("Item to add: "); - cin>> var; - d.TraceAlways("%i \n", testV.AddItem(var)); - break; - case 2: - d.TraceAlways("Item to remove: "); - cin>>var; - d.TraceAlways("%i \n", testV.RemoveItem(var)); - break; - case 3: - d.TraceAlways("Item to check: "); - cin>>var; - if (testV.ContainsItem(var)) - d.TraceAlways("\nItem present\n"); - else - d.TraceAlways("\nItem not present\n"); - break; - case 4: - testV.check(d); - break; - case 5: - loopvar = false; - break; - default: - d.TraceAlways("Not a valid menu option\n"); - break; - }//end switch - out &= local; //Keep track of results. - }//end while - */ - test1.AddItem(var1); TEST(local &= test1.ContainsItem(var1)); //hopefully this is true! TEST(local &= !test1.ContainsItem(var3)); + test2.SetSize(var2); TEST(local &= (test2.GetSize() == ((var2/32)+1)*32)); TEST(local &= (test1 != test2)); + test1.RemoveItem(var1); test2.SetSize(test1.GetSize()); TEST(local &= (test1 == test2)); + test1.AddItem(var3); test2 |= test1; d.TraceDetail("\nmMask should be 4!\n"); @@ -193,7 +142,6 @@ static bool addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d) out &= local; //and-ing of results. return out; }//end addRemove -#endif static bool objManip (cFCOPropVector &testV, cDebug& d) { @@ -234,11 +182,13 @@ static bool objManip (cFCOPropVector &testV, cDebug& d) v3.AddItem(1); v3.AddItem(4); TEST((v1 ^ v2) == v3); + // try with larger sizes... v2.SetSize(40); v2.Clear(); v2.AddItem(3); TEST((v1 ^ v2) == v3); + v2.AddItem(38); v1.SetSize(40); v1.Clear(); diff --git a/src/twtest/fcospecutil_t.cpp b/src/twtest/fcospecutil_t.cpp index e9d142e..af17b87 100644 --- a/src/twtest/fcospecutil_t.cpp +++ b/src/twtest/fcospecutil_t.cpp @@ -68,15 +68,12 @@ void TestFcoSpecUtil() pSet1->Add(removedName); TEST(! iFCOSpecUtil::FCOSpecEqual(*pSpec1, *pSpec2)); - - // TODO -- implement a more appropriate less-than test -/* pSpec1->SetStartPoint(cFCOName(_T("Dog"))); - pSpec2->AddStopPoint(cFCOName(_T("Howl"))); + pSpec1->SetStartPoint(cFCOName(_T("Dog"))); + pSet2->Add(cFCOName(_T("Dog/Howl"))); TEST(! iFCOSpecUtil::FCOSpecEqual (*pSpec1, *pSpec2)); TEST( iFCOSpecUtil::FCOSpecLessThan(*pSpec1, *pSpec2)); - pSpec1->AddStopPoint(cFCOName(_T("Howm"))); + pSet1->Add(cFCOName(_T("Dog/Howm"))); TEST( iFCOSpecUtil::FCOSpecLessThan(*pSpec2, *pSpec1)); -*/ pSpec1->Release(); pSpec2->Release(); diff --git a/src/twtest/fspropset_t.cpp b/src/twtest/fspropset_t.cpp index 6ad5803..8818f66 100644 --- a/src/twtest/fspropset_t.cpp +++ b/src/twtest/fspropset_t.cpp @@ -38,8 +38,6 @@ /////////////////////////////////////////////////////////////////////////////// // PrintPropVector -- function that prints the contents of a cFCOPropVector -// TODO: We might want to add this functionality to the property vector some -// day... /////////////////////////////////////////////////////////////////////////////// static void PrintPropVector(const cFCOPropVector& v, cDebug& d) { diff --git a/src/twtest/hierdatabase_t.cpp b/src/twtest/hierdatabase_t.cpp index 1091494..c6f5d2b 100644 --- a/src/twtest/hierdatabase_t.cpp +++ b/src/twtest/hierdatabase_t.cpp @@ -71,7 +71,6 @@ static void RemoveDirectory(cHierDatabase::iterator& iter, const TSTRING& filena TCOUT << "Removing the child of " << filename << std::endl; if( iter.SeekTo( filename.c_str() ) ) { - //TODO -- check that it has an empty child iter.DeleteChildArray(); iter.DeleteEntry(); } diff --git a/src/twtest/srefcountobj_t.cpp b/src/twtest/srefcountobj_t.cpp index 3ac76ae..606fa7b 100644 --- a/src/twtest/srefcountobj_t.cpp +++ b/src/twtest/srefcountobj_t.cpp @@ -95,11 +95,9 @@ void cSerRefCountObjTest::Write(iSerializer* pSerializer) const void TestSerRefCountObj() { - TCERR << "TODO: TestSerRefCountObj ifdef'd due to internal error" << std::endl; -#if 0 // first, we need to register the object with the serializer class... cSerializerImpl::RegisterSerializableRefCt(CLASS_TYPE(cSerRefCountObjTest), cSerRefCountObjTest::Create); - + cSerRefCountObjTest* pObj1 = new cSerRefCountObjTest; cSerRefCountObjTest* pObj2 = new cSerRefCountObjTest; pObj1->AddRef(); @@ -144,6 +142,5 @@ void TestSerRefCountObj() pObj4->Release(); return; -#endif } diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index 2c5d4c0..54ec169 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -154,12 +154,16 @@ void Usage() const int MAX_TEST_ID = 88; +static int ran_count = 0; static int failed_count = 0; +static std::vector error_strings; static void Test(int testID) { TCERR << std::endl << "=== Running test ID #" << testID << " ===" << std::endl; + bool ran = true; + try { switch (testID) @@ -194,7 +198,7 @@ static void Test(int testID) case 31: TestRefCountObj(); break; case 32: TestSerializerImpl(); break; - case 33: TestSerRefCountObj(); break; + //case 33: case 34: TestSignature(); break; case 35: TestTaskTimer(); break; //case 36: TestTripwire(); break; @@ -242,25 +246,46 @@ static void Test(int testID) case 86: TestDisplayEncoderBasic(); break; case 87: TestCharUtilBasic(); break; case 88: TestConfigFile2(); break; + default: ran = false; break; } - } catch (eError& error) { TCERR << "FAILED: " ; cTWUtil::PrintErrorMsg(error); + + std::stringstream sstr; + sstr << "Test " << testID << ": " << error.GetMsg(); + error_strings.push_back(sstr.str()); + failed_count++; } catch (std::exception& e) { TCERR << "FAILED: " << e.what() << std::endl; + + std::stringstream sstr; + sstr << "Test " << testID << ": " << e.what(); + error_strings.push_back(sstr.str()); + failed_count++; } catch (...) { TCERR << "FAILED: " << std::endl; + + std::stringstream sstr; + sstr << "Test " << testID << ": "; + error_strings.push_back(sstr.str()); + failed_count++; } - TCERR << std::endl << "=== test ID #" << testID << " completed ===" << std::endl; + if(ran) + { + ran_count++; + TCERR << std::endl << "=== test ID #" << testID << " completed ===" << std::endl; + } + else + TCERR << std::endl << "=== test ID #" << testID << " currently unused ===" << std::endl; } /////////////////////////////////////////////////////////////////////////////// @@ -351,9 +376,15 @@ int _tmain(int argc, TCHAR** argv) // this test always fails because of the static cFCONameTbl //TEST(cRefCountObj::AllRefCountObjDestoryed() == true); - // force user to hit + std::cout << std::endl << "Ran " << ran_count << " unit tests with " << failed_count << " failures." << std::endl; - std::cout << std::endl << "Tests completed with " << failed_count << " failures." << std::endl; + std::vector::iterator itr; + for (itr = error_strings.begin(); itr != error_strings.end(); ++itr) + { + std::cout << "\t" << *itr << std::endl; + } + + std::cout << std::endl; return failed_count ? -1 : 0; } diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index 1a9280c..bc45de2 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -135,13 +135,12 @@ void TestUnixFSServices() TEST( pFSServices->GetCurrentUserName(username) ); d.TraceDetail("GetCurrentUserName returned: %s\n", username.c_str()); - TCERR << "TODO: unixfsservices_t.cpp, Test GetIPAddress segfaults mysteriously." << std::endl; // Test GetIPAddress - /*d.TraceDetail("Testing GetIPAddress:\n"); - uint32 *ipaddr; - TEST( pFSServices->GetIPAddress( *ipaddr ) ); + d.TraceDetail("Testing GetIPAddress:\n"); + uint32 ipaddr; + TEST( pFSServices->GetIPAddress( ipaddr ) ); d.TraceDetail("GetIPAddress returned: %d\n", ipaddr); - */ + // test GetExecutableFilename d.TraceDetail("Testing GetExecutableFilename: \n"); TSTRING filename = _T("sh"); From cdfb2096c5c8a230ab68b23dbde84790335fd5bd Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 23 Apr 2017 22:52:32 -0700 Subject: [PATCH 007/110] Fixes for the Perl acceptance test suite: Enhance reporting to show total/pass/fail/skip tests, fix DB Update tests that were failing silently, fix 'hash check' tests that were passing incorrectly even if md5sum wasn't present, add a sha1 hash test. --- src/test-harness/tests/complex.pm | 1 + src/test-harness/tests/crc32.pm | 8 +-- src/test-harness/tests/dbupdate.pm | 111 +++++++++++++++++------------ src/test-harness/tests/dirs.pm | 1 + src/test-harness/tests/hashes.pm | 1 + src/test-harness/tests/inoderef.pm | 1 + src/test-harness/tests/md5sum.pm | 15 +++- src/test-harness/tests/readonly.pm | 1 + src/test-harness/tests/sha1sum.pm | 83 +++++++++++++++++++++ src/test-harness/tests/sizes.pm | 1 + src/test-harness/twtest.pl | 11 ++- src/test-harness/twtools.pm | 7 +- 12 files changed, 187 insertions(+), 54 deletions(-) create mode 100644 src/test-harness/tests/sha1sum.pm diff --git a/src/test-harness/tests/complex.pm b/src/test-harness/tests/complex.pm index 201f9f0..5a08c50 100644 --- a/src/test-harness/tests/complex.pm +++ b/src/test-harness/tests/complex.pm @@ -149,6 +149,7 @@ sub run() { # if ($twpassed) { print "PASSED\n"; + ++$twtools::twpassedtests; } else { ++$twtools::twfailedtests; diff --git a/src/test-harness/tests/crc32.pm b/src/test-harness/tests/crc32.pm index 28a071a..b694b90 100644 --- a/src/test-harness/tests/crc32.pm +++ b/src/test-harness/tests/crc32.pm @@ -33,13 +33,12 @@ sub run() { twtools::logStatus("*** Beginning $description\n"); printf("%-30s", "-- $description"); - - # lets see if the system 'cksum' agree's with siggen's md5 hash + # lets see if the system 'cksum' agree's with siggen's crc32 value # my ($crc32, undef) = split(/ /, `cksum $twtools::twrootdir/test`); my $siggen = `$twtools::twrootdir/bin/siggen -h -t -C $twtools::twrootdir/test`; - chomp $md5sum; + chomp $crc32; chomp $siggen; # cksum issues results in decimal, so get siggen's result in base10. @@ -48,7 +47,7 @@ sub run() { twtools::logStatus(" cksum reports: $crc32\n"); twtools::logStatus("siggen reports: $siggen\n"); - $twpassed = $crc32 == $siggen; + $twpassed = ($crc32 eq $siggen); ######################################################### # @@ -56,6 +55,7 @@ sub run() { # if ($twpassed) { print "PASSED\n"; + ++$twtools::twpassedtests; } else { ++$twtools::twfailedtests; diff --git a/src/test-harness/tests/dbupdate.pm b/src/test-harness/tests/dbupdate.pm index 9b0c448..9d7a228 100644 --- a/src/test-harness/tests/dbupdate.pm +++ b/src/test-harness/tests/dbupdate.pm @@ -9,7 +9,6 @@ package dbupdate; # BEGIN { - # This is the root directory we will be integrity checking # $root = "$twtools::twcwd/$twtools::twrootdir/dbupdate-test"; @@ -135,7 +134,7 @@ sub PrepareForTest # Initialize the database # - twtools::initializeDatabase(); + twtools::InitializeDatabase(); } ###################################################################### @@ -143,10 +142,10 @@ sub PrepareForTest # sub RunBasicTest { - PrepareForTest(); - printf("%-30s", "-- dbupdate.basic test"); + PrepareForTest(); + # make some violations... # MoveFile ( "meow.txt", "cat.txt" ); @@ -154,37 +153,36 @@ sub RunBasicTest # run the integrity check... # - twtools::runIntegrityCheck(); + twtools::RunIntegrityCheck(); # Make sure we got 4 violations: 2 mod, 1 add, 1 rm. # - my ($n, $a, $r, $c) = - twtools::analyzeReport( twtools::runReport() ); - + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + if( ($n != 4) || ($a != 1) || ($r != 1) || ($c != 2) ) { - print "FAILED -- initial integrity check was wack!"; - return 0; + twtools::logStatus("FAILED -- initial integrity check had unexpected results\n"); + return 0; } # do the database update... # - twtools::updateDatabase(); + twtools::UpdateDatabase(); # do another IC and make sure there are no violations # - twtools::runIntegrityCheck(); + twtools::RunIntegrityCheck(); - ($n, $a, $r, $c) = - twtools::analyzeReport( twtools::runReport() ); + ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); if( $n != 0 ) { - print "FAILED -- violations after update!"; - return 0; + twtools("FAILED -- violations after update\n"); + return 0; } - print "PASSED!!!\n"; + ++$twtools::twpassedtests; + print "PASSED\n"; return 1; } @@ -193,77 +191,79 @@ sub RunBasicTest # sub RunSecureModeTest { - PrepareForTest(); - printf("%-30s", "-- dbupdate.secure-mode test"); + ++$twtools::twskippedtests; + print "SKIPPED - this test needs further investigation\n"; + return 1; + + PrepareForTest(); + # make a violation and generate a report # CreateFile( "dog/bark.txt", "bark bark bark" ); - twtools::runIntegrityCheck( { report => $report1 } ); + twtools::RunIntegrityCheck( { report => $report1 } ); # change the same file in a slightly different way and generate # another report # CreateFile( "dog/bark.txt", "bark bark bark woof" ); - twtools::runIntegrityCheck( { report => $report2 } ); + twtools::RunIntegrityCheck( { report => $report2 } ); # Remove a file and generate a third report # RemoveFile( "dog/bark.txt" ); - twtools::runIntegrityCheck( { report => $report3 } ); + twtools::RunIntegrityCheck( { report => $report3 } ); # Add a file and generate the fourth report # CreateFile( "dog/cow.txt", "moo moo" ); - twtools::runIntegrityCheck( { report => $report4 } ); + twtools::RunIntegrityCheck( { report => $report4 } ); - # Update the database with report 1. # - twtools::updateDatabase( { report => $report1 } ); + twtools::UpdateDatabase( { report => $report1 } ); # Try to update the database with report 2 ... this should fail # in secure-mode == high because the "old" values don't match. # - if( twtools::updateDatabase( + if( twtools::UpdateDatabase( { report => $report2, secure-mode => "high" } ) ) { - print "FAILED ... Secure-mode high didn't catch a bad update!"; - return 0; + twtools::logStatus("FAILED ... Secure-mode high didn't catch a bad update\n"); + return 0; } # do a high severity update with report3 -- this should # succeed # - if( ! twtools::updateDatabase( + if( ! twtools::UpdateDatabase( { report => $report3, secure-mode => "high" } ) ) { - print "FAILED ... Update with report 3 failed!"; - return 0; + twtools::logStatus("FAILED ... Update with report 3 failed\n"); + return 0; } # Try 2 again ... now we are trying to update an object that # doesn't exist in the database at all. This should # succeed in low but fail in high. # - if( twtools::updateDatabase( + if( twtools::UpdateDatabase( { report => $report2, secure-mode => "high" } ) ) { - print "FAILED ... Update with report 2 after 3 succeeded in high mode!"; - return 0; + twtools::logStatus("FAILED ... Update with report 2 after 3 succeeded in high mode\n"); + return 0; } - if( ! twtools::updateDatabase( + if( ! twtools::UpdateDatabase( { report => $report2, secure-mode => "low" } ) ) { - print "FAILED ... Update with report 2 after 3 failed in low mode!"; - return 0; + twtools::logStatus("FAILED ... Update with report 2 after 3 failed in low mode\n"); + return 0; } - - - - print "PASSED!!!\n"; + + ++$twtools::twpassedtests; + print "PASSED\n"; return 1; } @@ -275,9 +275,10 @@ sub RunSecureModeTest sub initialize { - # Make the policy file - # - twtools::generatePolicyFile( PolicyFileString() ); + # Make the policy file + # + twtools::GeneratePolicyFile( PolicyFileString() ); + return 1; } @@ -287,8 +288,26 @@ sub initialize # sub run { - RunBasicTest() || return; - RunSecureModeTest() || return; + eval { + RunBasicTest(); + } or do { + my $e = $@; + twtools::logStatus("Exception in DBUpdate RunBasicTest: $e\n"); + ++$twtools::twfailedtests; + print "*FAILED*\n"; + }; + + # bump the total test count since this file's a twofer + ++$twtools::twtotaltests; + + eval { + RunSecureModeTest(); + } or do { + my $e = $@; + twtools::logStatus("Exception in DBUpdate RunSecureModeTest: $e\n"); + ++$twtools::twfailedtests; + print "*FAILED*\n"; + }; } sub cleanup diff --git a/src/test-harness/tests/dirs.pm b/src/test-harness/tests/dirs.pm index b714b7d..3ff9b5e 100644 --- a/src/test-harness/tests/dirs.pm +++ b/src/test-harness/tests/dirs.pm @@ -137,6 +137,7 @@ sub run() { # See if the tests all succeeded... # if ($twpassed) { + ++$twtools::twpassedtests; print "PASSED\n"; } else { diff --git a/src/test-harness/tests/hashes.pm b/src/test-harness/tests/hashes.pm index e9741bc..0cab2f7 100644 --- a/src/test-harness/tests/hashes.pm +++ b/src/test-harness/tests/hashes.pm @@ -125,6 +125,7 @@ sub run() { # See if the tests all succeeded... # if ($twpassed) { + ++$twtools::twpassedtests; print "PASSED\n"; } else { diff --git a/src/test-harness/tests/inoderef.pm b/src/test-harness/tests/inoderef.pm index 8711179..b779180 100644 --- a/src/test-harness/tests/inoderef.pm +++ b/src/test-harness/tests/inoderef.pm @@ -106,6 +106,7 @@ sub run() { # See if the tests all succeeded... # if ($twpassed) { + ++$twtools::twpassedtests; print "PASSED\n"; } else { diff --git a/src/test-harness/tests/md5sum.pm b/src/test-harness/tests/md5sum.pm index 0a37a00..09e612f 100644 --- a/src/test-harness/tests/md5sum.pm +++ b/src/test-harness/tests/md5sum.pm @@ -37,21 +37,34 @@ sub run() { # lets see if the system 'md5sum' agree's with siggen's md5 hash # my ($md5sum, undef) = split(/ /, `md5sum $twtools::twrootdir/test`); + if ($mf5sum eq "") { + twtools::logStatus("md5sum not found, trying openssl instead\n"); + (undef, $md5sum) = split(/=/, `openssl md5 $twtools::twrootdir/test`); + } + if ($md5sum eq "") { + ++$twtools::twskippedtests; + print "SKIPPED\n"; + return; + } + my $siggen = `$twtools::twrootdir/bin/siggen -h -t -M $twtools::twrootdir/test`; chomp $md5sum; chomp $siggen; + $md5sum =~ s/^\s+|\s+$//g; + $siggen =~ s/^\s+|\s+$//g; twtools::logStatus("md5sum reports: $md5sum\n"); twtools::logStatus("siggen reports: $siggen\n"); - $twpassed = $md5sum == $siggen; + $twpassed = ($md5sum eq $siggen); ######################################################### # # See if the tests all succeeded... # if ($twpassed) { + ++$twtools::twpassedtests; print "PASSED\n"; } else { diff --git a/src/test-harness/tests/readonly.pm b/src/test-harness/tests/readonly.pm index 230e462..3a68139 100644 --- a/src/test-harness/tests/readonly.pm +++ b/src/test-harness/tests/readonly.pm @@ -101,6 +101,7 @@ sub run() { # See if the tests all succeeded... # if ($twpassed) { + ++$twtools::twpassedtests; print "PASSED\n"; return 0; } diff --git a/src/test-harness/tests/sha1sum.pm b/src/test-harness/tests/sha1sum.pm new file mode 100644 index 0000000..145a6a5 --- /dev/null +++ b/src/test-harness/tests/sha1sum.pm @@ -0,0 +1,83 @@ + +use twtools; + +package sha1sum; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + + $description = "sha1 hash check"; +} + + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { + + twtools::CreateFile( { file => "test", contents => "deadbeef"x5000} ); +} + + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + + # lets see if the system 'sha1sum' agree's with siggen's sha1 hash + # + my ($sha1sum, undef) = split(/ /, `sha1sum $twtools::twrootdir/test`); + if ($sha1sum eq "") { + twtools::logStatus("sha1sum not found, trying openssl instead\n"); + (undef, $sha1sum) = split(/=/, `openssl sha1 $twtools::twrootdir/test`); + } + if ($sha1sum eq "") { + ++$twtools::twskippedtests; + print "SKIPPED\n"; + return; + } + + my $siggen = `$twtools::twrootdir/bin/siggen -h -t -S $twtools::twrootdir/test`; + + chomp $sha1sum; + chomp $siggen; + $sha1sum =~ s/^\s+|\s+$//g; + $siggen =~ s/^\s+|\s+$//g; + + twtools::logStatus("sha1sum reports: $sha1sum\n"); + twtools::logStatus("siggen reports: $siggen\n"); + + $twpassed = ($sha1sum eq $siggen); + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + } +} + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1; diff --git a/src/test-harness/tests/sizes.pm b/src/test-harness/tests/sizes.pm index dac2594..b880bfe 100644 --- a/src/test-harness/tests/sizes.pm +++ b/src/test-harness/tests/sizes.pm @@ -97,6 +97,7 @@ sub run() { # See if the tests all succeeded... # if ($twpassed) { + ++$twtools::twpassedtests; print "PASSED\n"; } else { diff --git a/src/test-harness/twtest.pl b/src/test-harness/twtest.pl index 1f7ea53..1d87e3b 100755 --- a/src/test-harness/twtest.pl +++ b/src/test-harness/twtest.pl @@ -94,6 +94,8 @@ sub runTests { for $module (@twtests) { + ++$twtools::twtotaltests; + # use the module # eval qq{use tests::$module}; @@ -137,6 +139,7 @@ prepareListOfTests() if scalar(@twtests) == 0; # only if none were on the cmdli print "\n"; print "initializing for tests...\n\n"; +print "logging to $ENV{'PWD'}/$twtools::twrootdir/status.log\n\n"; # all tests can assume a base configuration, i.e. default tw.cfg, site and local keys # @@ -151,7 +154,13 @@ print "=============\n\n"; # runTests(); -print "\n\n$twtools::twfailedtests test(s) failed...\n\n"; +# Any test that didn't report a status gets counted as skipped. +$twtools::twskippedtests += ($twtools::twtotaltests - ($twtools::twpassedtests + $twtools::twfailedtests + $twtools::twskippedtests)); + +print "\n\n$twtools::twtotaltests test(s) run\n"; +print "$twtools::twpassedtests test(s) passed\n"; +print "$twtools::twfailedtests test(s) failed\n"; +print "$twtools::twskippedtests test(s) skipped\n\n"; exit($twtools::twfailedtests); diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 894a161..1209d39 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -23,7 +23,10 @@ BEGIN { $twbinaries = "../../../../bin"; + $twtotaltests = 0; $twfailedtests = 0; + $twpassedtests = 0; + $twskippedtests = 0; # get's setup in twtest... # @@ -192,7 +195,7 @@ sub InitializeDatabase { my ($twmsg) = @_; print "initializing database for '$twmsg' test...\n" if $verbose; - logStatus(`$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/policy/tw.pol -c $twrootdir/tw.cfg`); + logStatus(`$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/policy/tw.pol -c $twrootdir/tw.cfg 2>&1`); return ($? == 0); } @@ -208,7 +211,7 @@ sub UpdateDatabase { $params{'secure-mode'} = "low" if( ! defined($params{'secure-mode'}) ); print "updating database for '$twmsg' test...\n" if $verbose; - logStatus(`$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{'secure-mode'} -p $twrootdir/policy/tw.pol -c $twrootdir/tw.cfg -r $params{'report'}`); + logStatus(`$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{'secure-mode'} -p $twrootdir/policy/tw.pol -c $twrootdir/tw.cfg -r $params{'report'} 2>&1`); return ($? == 0); } From b1f0ed4b7163cbbc30e3920b5c703d532ccb3904 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 24 Apr 2017 22:44:03 -0700 Subject: [PATCH 008/110] Add an email reporting test, which runs tripwire --test mode & verifies the required mail header fields look right. This test only uses the sendmail (pipe) mailmethod, since I'm not sure how to automate SMTP testing in our Perl framework. --- src/test-harness/tests/email.pm | 85 +++++++++++++++++++++++++++++++++ src/test-harness/twtools.pm | 17 ++++++- 2 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 src/test-harness/tests/email.pm diff --git a/src/test-harness/tests/email.pm b/src/test-harness/tests/email.pm new file mode 100644 index 0000000..f03eb09 --- /dev/null +++ b/src/test-harness/tests/email.pm @@ -0,0 +1,85 @@ + +use twtools; + +package email; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + $description = "email test"; +} + + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { +} + + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + my($sending, undef, undef, $mailfrom, $mailto, $subject, undef, undef, undef, $body) = twtools::RunEmailTest(); + + # Verify that various lines in the test email output look right, + # including the RFC 2822-required CRLFs that should be in everything + # except $sending, which isn't part of the actual email. + # + if ( !($sending =~ "Sending a test message to: elvis\@mars")) { + twtools::logStatus("Unexpected sending line: $sending\n"); + $twpassed = 0; + } + + if ( !($mailfrom =~ "taz\@cat")) { + twtools::logStatus("Unexpected From: field: $mailfrom\n"); + $twpassed = 0; + } + + if ( !($mailto =~ "To: elvis\@mars\r")) { + twtools::logStatus("Unexpected To: field: $mailto\n"); + $twpassed = 0; + } + + if ( !($subject =~ "Subject: Test email message from Tripwire\r")) { + twtools::logStatus("Unexpected Subject field: $subject\n"); + $twpassed = 0; + } + + if ( !($body =~ "If you receive this message, email notification from tripwire is working correctly.\r")) { + twtools::logStatus("Unexpected message body: $body\n"); + $twpassed = 0; + } + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + print "PASSED\n"; + ++$twtools::twpassedtests; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + } +} + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1; diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 1209d39..8a904df 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -53,8 +53,8 @@ BEGIN { REPORTLEVEL => '3', MAILMETHOD => 'SENDMAIL', SYSLOGREPORTING => 'false', - MAILPROGRAM => '/usr/lib/sendmail -oi -t' - + MAILPROGRAM => 'cat', + MAILFROMADDRESS => 'taz@cat' ); } @@ -235,6 +235,19 @@ sub RunReport(%) { } +###################################################################### +# Run an email test (configured with mailmethod=sendmail) & capture output +# +sub RunEmailTest { + + my (@out) = `$twrootdir/bin/tripwire --test -c $twrootdir/tw.cfg --email elvis\@mars`; + + logStatus(@out); + + return @out; +} + + ###################################################################### # Run tripwire to do an integrity check on # the test data From dae64c48edc7e1e7945bff7339201f30b44e7847 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Tue, 25 Apr 2017 18:31:11 -0700 Subject: [PATCH 009/110] Update copyright years --- TRADEMARK | 2 +- src/core/archive.cpp | 2 +- src/core/archive.h | 2 +- src/core/charutil.cpp | 2 +- src/core/charutil.h | 2 +- src/core/cmdlineparser.cpp | 2 +- src/core/cmdlineparser.h | 2 +- src/core/codeconvert.cpp | 2 +- src/core/codeconvert.h | 2 +- src/core/core.cpp | 2 +- src/core/core.h | 2 +- src/core/coreerrors.cpp | 2 +- src/core/coreerrors.h | 2 +- src/core/corestrings.cpp | 2 +- src/core/corestrings.h | 2 +- src/core/crc32.cpp | 2 +- src/core/crc32.h | 2 +- src/core/debug.cpp | 2 +- src/core/debug.h | 2 +- src/core/displayencoder.cpp | 2 +- src/core/displayencoder.h | 2 +- src/core/displayutil.cpp | 2 +- src/core/displayutil.h | 2 +- src/core/error.cpp | 2 +- src/core/error.h | 2 +- src/core/errorbucket.h | 2 +- src/core/errorbucketimpl.cpp | 2 +- src/core/errorbucketimpl.h | 2 +- src/core/errorgeneral.h | 2 +- src/core/errortable.cpp | 2 +- src/core/errortable.h | 2 +- src/core/errorutil.cpp | 2 +- src/core/errorutil.h | 2 +- src/core/file.h | 2 +- src/core/file_unix.cpp | 2 +- src/core/fileerror.cpp | 2 +- src/core/fileerror.h | 2 +- src/core/fileheader.cpp | 2 +- src/core/fileheader.h | 2 +- src/core/fixedfilebuf.h | 2 +- src/core/fsservices.cpp | 2 +- src/core/fsservices.h | 2 +- src/core/growheap.cpp | 2 +- src/core/growheap.h | 2 +- src/core/hashtable.cpp | 2 +- src/core/hashtable.h | 2 +- src/core/haval.cpp | 2 +- src/core/haval.h | 2 +- src/core/md5.cpp | 2 +- src/core/md5.h | 2 +- src/core/msystem.cpp | 2 +- src/core/msystem.h | 2 +- src/core/ntdbs.h | 2 +- src/core/ntmbs.cpp | 2 +- src/core/ntmbs.h | 2 +- src/core/package.h | 2 +- src/core/platform.h | 2 +- src/core/refcountobj.cpp | 2 +- src/core/refcountobj.h | 2 +- src/core/resources.h | 2 +- src/core/serializable.cpp | 2 +- src/core/serializable.h | 2 +- src/core/serializer.cpp | 2 +- src/core/serializer.h | 2 +- src/core/serializerimpl.cpp | 2 +- src/core/serializerimpl.h | 2 +- src/core/serializerutil.cpp | 2 +- src/core/serializerutil.h | 2 +- src/core/serstring.cpp | 2 +- src/core/serstring.h | 2 +- src/core/sha.cpp | 2 +- src/core/sha.h | 2 +- src/core/srefcountobj.cpp | 2 +- src/core/srefcountobj.h | 2 +- src/core/srefcounttbl.cpp | 2 +- src/core/srefcounttbl.h | 2 +- src/core/stdcore.cpp | 2 +- src/core/stdcore.h | 2 +- src/core/stringutil.cpp | 2 +- src/core/stringutil.h | 2 +- src/core/tasktimer.h | 2 +- src/core/tchar.h | 2 +- src/core/timebomb.cpp | 2 +- src/core/timebomb.h | 2 +- src/core/timeconvert.cpp | 2 +- src/core/timeconvert.h | 2 +- src/core/tw_signal.cpp | 2 +- src/core/tw_signal.h | 2 +- src/core/twlimits.cpp | 2 +- src/core/twlimits.h | 2 +- src/core/twlocale.cpp | 2 +- src/core/twlocale.h | 2 +- src/core/twstringslang.h | 2 +- src/core/typed.h | 2 +- src/core/types.h | 2 +- src/core/unixexcept.cpp | 2 +- src/core/unixexcept.h | 2 +- src/core/unixfsservices.cpp | 2 +- src/core/unixfsservices.h | 2 +- src/core/upperbound.h | 2 +- src/core/usernotify.cpp | 2 +- src/core/usernotify.h | 2 +- src/core/usernotifystdout.cpp | 2 +- src/core/usernotifystdout.h | 2 +- src/core/userstringmem.cpp | 2 +- src/core/userstringmem.h | 2 +- src/core/wchar16.cpp | 2 +- src/core/wchar16.h | 2 +- src/db/block.h | 2 +- src/db/blockfile.cpp | 2 +- src/db/blockfile.h | 2 +- src/db/blockrecordarray.cpp | 2 +- src/db/blockrecordarray.h | 2 +- src/db/blockrecordfile.cpp | 2 +- src/db/blockrecordfile.h | 2 +- src/db/db.cpp | 2 +- src/db/db.h | 2 +- src/db/dberrors.cpp | 2 +- src/db/dberrors.h | 2 +- src/db/hierdatabase.cpp | 2 +- src/db/hierdatabase.h | 2 +- src/db/hierdbnode.h | 2 +- src/db/hierdbpath.cpp | 2 +- src/db/hierdbpath.h | 2 +- src/db/stddb.cpp | 2 +- src/db/stddb.h | 2 +- src/fco/fco.cpp | 2 +- src/fco/fco.h | 2 +- src/fco/fcocompare.cpp | 2 +- src/fco/fcocompare.h | 2 +- src/fco/fcodatasource.h | 2 +- src/fco/fcodatasourceiter.cpp | 2 +- src/fco/fcodatasourceiter.h | 2 +- src/fco/fcodatasourceiterimpl.cpp | 2 +- src/fco/fcodatasourceiterimpl.h | 2 +- src/fco/fcoerrors.cpp | 2 +- src/fco/fcoerrors.h | 2 +- src/fco/fcogenre.h | 2 +- src/fco/fconame.cpp | 2 +- src/fco/fconame.h | 2 +- src/fco/fconameinfo.h | 2 +- src/fco/fconametbl.cpp | 2 +- src/fco/fconametbl.h | 2 +- src/fco/fconametranslator.h | 2 +- src/fco/fcoprop.h | 2 +- src/fco/fcopropcalc.h | 2 +- src/fco/fcopropdisplayer.h | 2 +- src/fco/fcopropimpl.cpp | 2 +- src/fco/fcopropimpl.h | 2 +- src/fco/fcopropset.h | 2 +- src/fco/fcopropvector.cpp | 2 +- src/fco/fcopropvector.h | 2 +- src/fco/fcosetimpl.cpp | 2 +- src/fco/fcosetimpl.h | 2 +- src/fco/fcosetws.h | 2 +- src/fco/fcospec.cpp | 2 +- src/fco/fcospec.h | 2 +- src/fco/fcospecattr.cpp | 2 +- src/fco/fcospecattr.h | 2 +- src/fco/fcospechelper.cpp | 2 +- src/fco/fcospechelper.h | 2 +- src/fco/fcospecimpl.cpp | 2 +- src/fco/fcospecimpl.h | 2 +- src/fco/fcospeclist.cpp | 2 +- src/fco/fcospeclist.h | 2 +- src/fco/fcospecutil.cpp | 2 +- src/fco/fcospecutil.h | 2 +- src/fco/fcostrings.cpp | 2 +- src/fco/fcostrings.h | 2 +- src/fco/fcoundefprop.cpp | 2 +- src/fco/fcoundefprop.h | 2 +- src/fco/fcovisitor.h | 2 +- src/fco/genreinfo.cpp | 2 +- src/fco/genreinfo.h | 2 +- src/fco/genrespeclist.cpp | 2 +- src/fco/genrespeclist.h | 2 +- src/fco/genreswitcher.cpp | 2 +- src/fco/genreswitcher.h | 2 +- src/fco/iterproxy.h | 2 +- src/fco/parsergenreutil.h | 2 +- src/fco/propset.h | 2 +- src/fco/signature.cpp | 2 +- src/fco/signature.h | 2 +- src/fco/stdfco.cpp | 2 +- src/fco/stdfco.h | 2 +- src/fco/twfactory.cpp | 2 +- src/fco/twfactory.h | 2 +- src/fs/fs.cpp | 2 +- src/fs/fs.h | 2 +- src/fs/fsdatasourceiter.cpp | 2 +- src/fs/fsdatasourceiter.h | 2 +- src/fs/fserrors.cpp | 2 +- src/fs/fserrors.h | 2 +- src/fs/fsfactory.cpp | 2 +- src/fs/fsfactory.h | 2 +- src/fs/fsnametranslator.cpp | 2 +- src/fs/fsnametranslator.h | 2 +- src/fs/fsobject.cpp | 2 +- src/fs/fsobject.h | 2 +- src/fs/fsparserutil.cpp | 2 +- src/fs/fsparserutil.h | 2 +- src/fs/fspropcalc.cpp | 2 +- src/fs/fspropcalc.h | 2 +- src/fs/fspropdisplayer.cpp | 2 +- src/fs/fspropdisplayer.h | 2 +- src/fs/fspropset.cpp | 2 +- src/fs/fspropset.h | 2 +- src/fs/fsstrings.cpp | 2 +- src/fs/fsstrings.h | 2 +- src/fs/fsvisitor.cpp | 2 +- src/fs/fsvisitor.h | 2 +- src/fs/stdfs.cpp | 2 +- src/fs/stdfs.h | 2 +- src/parser/lexyacc_header.h | 2 +- src/parser/policy.y | 2 +- src/parser/tokens.l | 2 +- src/siggen/siggen.cpp | 2 +- src/siggen/siggen.h | 2 +- src/siggen/siggencmdline.cpp | 2 +- src/siggen/siggencmdline.h | 2 +- src/siggen/siggenmain.cpp | 2 +- src/siggen/siggenstrings.cpp | 2 +- src/siggen/siggenstrings.h | 2 +- src/siggen/stdsiggen.cpp | 2 +- src/siggen/stdsiggen.h | 2 +- src/tripwire/generatedb.cpp | 2 +- src/tripwire/generatedb.h | 2 +- src/tripwire/generatedb_t.cpp | 2 +- src/tripwire/integritycheck.cpp | 2 +- src/tripwire/integritycheck.h | 2 +- src/tripwire/integritycheck_t.cpp | 2 +- src/tripwire/mailmessage.cpp | 2 +- src/tripwire/mailmessage.h | 2 +- src/tripwire/pipedmailmessage.cpp | 2 +- src/tripwire/policyupdate.cpp | 2 +- src/tripwire/policyupdate.h | 2 +- src/tripwire/resource.h | 2 +- src/tripwire/smtpmailmessage.cpp | 2 +- src/tripwire/stdtripwire.cpp | 2 +- src/tripwire/stdtripwire.h | 2 +- src/tripwire/syslog_trip.cpp | 2 +- src/tripwire/syslog_trip.h | 2 +- src/tripwire/tripwire.cpp | 2 +- src/tripwire/tripwire.h | 2 +- src/tripwire/tripwireerrors.cpp | 2 +- src/tripwire/tripwireerrors.h | 2 +- src/tripwire/tripwiremain.cpp | 2 +- src/tripwire/tripwiremsg.h | 2 +- src/tripwire/tripwirestrings.cpp | 2 +- src/tripwire/tripwirestrings.h | 2 +- src/tripwire/tripwireutil.cpp | 2 +- src/tripwire/tripwireutil.h | 2 +- src/tripwire/twcmdline.cpp | 2 +- src/tripwire/twcmdline.h | 2 +- src/tripwire/twcmdlineutil.cpp | 2 +- src/tripwire/twcmdlineutil.h | 2 +- src/tripwire/updatedb.cpp | 2 +- src/tripwire/updatedb.h | 2 +- src/tw/configfile.cpp | 2 +- src/tw/configfile.h | 2 +- src/tw/dbdatasource.cpp | 2 +- src/tw/dbdatasource.h | 2 +- src/tw/dbdebug.cpp | 2 +- src/tw/dbdebug.h | 2 +- src/tw/dbexplore.cpp | 2 +- src/tw/dbexplore.h | 2 +- src/tw/fcodatabasefile.cpp | 2 +- src/tw/fcodatabasefile.h | 2 +- src/tw/fcodatabaseutil.cpp | 2 +- src/tw/fcodatabaseutil.h | 2 +- src/tw/fcoreport.cpp | 2 +- src/tw/fcoreport.h | 2 +- src/tw/fcoreportutil.cpp | 2 +- src/tw/fcoreportutil.h | 2 +- src/tw/filemanipulator.cpp | 2 +- src/tw/filemanipulator.h | 2 +- src/tw/headerinfo.cpp | 2 +- src/tw/headerinfo.h | 2 +- src/tw/policyfile.cpp | 2 +- src/tw/policyfile.h | 2 +- src/tw/stdtw.cpp | 2 +- src/tw/stdtw.h | 2 +- src/tw/systeminfo.cpp | 2 +- src/tw/systeminfo.h | 2 +- src/tw/textdbviewer.cpp | 2 +- src/tw/textdbviewer.h | 2 +- src/tw/textreportviewer.cpp | 2 +- src/tw/textreportviewer.h | 2 +- src/tw/tw.cpp | 2 +- src/tw/tw.h | 2 +- src/tw/twerrors.cpp | 2 +- src/tw/twerrors.h | 2 +- src/tw/twinit.cpp | 2 +- src/tw/twinit.h | 2 +- src/tw/twstrings.cpp | 2 +- src/tw/twstrings.h | 2 +- src/tw/twutil.cpp | 2 +- src/tw/twutil.h | 2 +- src/twadmin/keygeneration.cpp | 2 +- src/twadmin/keygeneration.h | 2 +- src/twadmin/resource.h | 2 +- src/twadmin/stdtwadmin.cpp | 2 +- src/twadmin/stdtwadmin.h | 2 +- src/twadmin/twadmin.cpp | 2 +- src/twadmin/twadmin.h | 2 +- src/twadmin/twadmincl.cpp | 2 +- src/twadmin/twadmincl.h | 2 +- src/twadmin/twadminerrors.cpp | 2 +- src/twadmin/twadminerrors.h | 2 +- src/twadmin/twadminmain.cpp | 2 +- src/twadmin/twadminstrings.cpp | 2 +- src/twadmin/twadminstrings.h | 2 +- src/twcrypto/bytequeue.cpp | 2 +- src/twcrypto/bytequeue.h | 2 +- src/twcrypto/crypto.cpp | 2 +- src/twcrypto/crypto.h | 2 +- src/twcrypto/cryptoarchive.cpp | 2 +- src/twcrypto/cryptoarchive.h | 2 +- src/twcrypto/keyfile.cpp | 2 +- src/twcrypto/keyfile.h | 2 +- src/twcrypto/stdtwcrypto.cpp | 2 +- src/twcrypto/stdtwcrypto.h | 2 +- src/twcrypto/twcrypto.cpp | 2 +- src/twcrypto/twcrypto.h | 2 +- src/twcrypto/twcryptoerrors.cpp | 2 +- src/twcrypto/twcryptoerrors.h | 2 +- src/twparser/genreparseinfo.cpp | 2 +- src/twparser/genreparseinfo.h | 2 +- src/twparser/parserhelper.cpp | 2 +- src/twparser/parserhelper.h | 2 +- src/twparser/parserobjects.cpp | 2 +- src/twparser/parserobjects.h | 2 +- src/twparser/policyparser.cpp | 2 +- src/twparser/policyparser.h | 2 +- src/twparser/stdtwparser.cpp | 2 +- src/twparser/stdtwparser.h | 2 +- src/twparser/twparser.cpp | 2 +- src/twparser/twparser.h | 2 +- src/twparser/twparsererrors.cpp | 2 +- src/twparser/twparsererrors.h | 2 +- src/twparser/twparserstrings.cpp | 2 +- src/twparser/twparserstrings.h | 2 +- src/twparser/yylex.cpp | 2 +- src/twparser/yylex.h | 2 +- src/twparser/yyparse.cpp | 2 +- src/twparser/yyparse.h | 2 +- src/twprint/resource.h | 2 +- src/twprint/stdtwprint.cpp | 2 +- src/twprint/stdtwprint.h | 2 +- src/twprint/twprint.cpp | 2 +- src/twprint/twprint.h | 2 +- src/twprint/twprintcmdline.cpp | 2 +- src/twprint/twprintcmdline.h | 2 +- src/twprint/twprinterrors.cpp | 2 +- src/twprint/twprinterrors.h | 2 +- src/twprint/twprintmain.cpp | 2 +- src/twprint/twprintstrings.cpp | 2 +- src/twprint/twprintstrings.h | 2 +- src/twtest/archive_t.cpp | 2 +- src/twtest/blockfile_t.cpp | 2 +- src/twtest/blockrecordarray_t.cpp | 2 +- src/twtest/charutil_t.cpp | 2 +- src/twtest/cmdlineparser_t.cpp | 2 +- src/twtest/codeconvert_t.cpp | 2 +- src/twtest/configfile_t.cpp | 2 +- src/twtest/cryptoarchive_t.cpp | 2 +- src/twtest/crytpo_t.cpp | 2 +- src/twtest/dbdatasource_t.cpp | 2 +- src/twtest/debug_t.cpp | 2 +- src/twtest/displayencoder_t.cpp | 2 +- src/twtest/error_t.cpp | 2 +- src/twtest/errorbucketimpl_t.cpp | 2 +- src/twtest/fcocompare_t.cpp | 2 +- src/twtest/fcodatabasefile_t.cpp | 2 +- src/twtest/fconame_t.cpp | 2 +- src/twtest/fconametbl_t.cpp | 2 +- src/twtest/fconametranslator_t.cpp | 2 +- src/twtest/fcopropimpl_t.cpp | 2 +- src/twtest/fcopropvector_t.cpp | 2 +- src/twtest/fcoreport_t.cpp | 2 +- src/twtest/fcosetimpl_t.cpp | 2 +- src/twtest/fcospec_t.cpp | 2 +- src/twtest/fcospecattr_t.cpp | 2 +- src/twtest/fcospechelper_t.cpp | 2 +- src/twtest/fcospeclist_t.cpp | 2 +- src/twtest/fcospecutil_t.cpp | 2 +- src/twtest/file_t.cpp | 2 +- src/twtest/fileheader_t.cpp | 2 +- src/twtest/fileutil_t.cpp | 2 +- src/twtest/fsdatasourceiter_t.cpp | 2 +- src/twtest/fsobject_t.cpp | 2 +- src/twtest/fspropcalc_t.cpp | 2 +- src/twtest/fspropdisplayer_t.cpp | 2 +- src/twtest/fspropset_t.cpp | 2 +- src/twtest/fsspec_t.cpp | 2 +- src/twtest/genre_t.cpp | 2 +- src/twtest/genrespeclist_t.cpp | 2 +- src/twtest/genreswitcher_t.cpp | 2 +- src/twtest/growheap_t.cpp | 2 +- src/twtest/hashtable_t.cpp | 2 +- src/twtest/hierdatabase_t.cpp | 2 +- src/twtest/keyfile_t.cpp | 2 +- src/twtest/platform_t.cpp | 2 +- src/twtest/policyparser_t.cpp | 2 +- src/twtest/refcountobj_t.cpp | 2 +- src/twtest/resources_t.cpp | 2 +- src/twtest/serializer_t.cpp | 2 +- src/twtest/serializerimpl_t.cpp | 2 +- src/twtest/signature_t.cpp | 2 +- src/twtest/srefcountobj_t.cpp | 2 +- src/twtest/stdtest.cpp | 2 +- src/twtest/stdtest.h | 2 +- src/twtest/stringencoder_t.cpp | 2 +- src/twtest/stringutil_t.h | 2 +- src/twtest/tasktimer_t.cpp | 2 +- src/twtest/tchar_t.cpp | 2 +- src/twtest/test.cpp | 2 +- src/twtest/test.h | 2 +- src/twtest/textreportviewer_t.cpp | 2 +- src/twtest/twlocale_t.cpp | 2 +- src/twtest/twutil_t.cpp | 2 +- src/twtest/types_t.cpp | 2 +- src/twtest/unixfsservices_t.cpp | 2 +- src/twtest/usernotifystdout_t.cpp | 2 +- src/twtest/wchar16_t.cpp | 2 +- src/util/fileutil.cpp | 2 +- src/util/fileutil.h | 2 +- src/util/miscutil.h | 2 +- src/util/stdutil.cpp | 2 +- src/util/stdutil.h | 2 +- src/util/stringencoder.cpp | 2 +- src/util/stringencoder.h | 2 +- src/util/util.cpp | 2 +- src/util/util.h | 2 +- src/util/utilerrors.cpp | 2 +- src/util/utilerrors.h | 2 +- src/util/utilstrings.cpp | 2 +- src/util/utilstrings.h | 2 +- 438 files changed, 438 insertions(+), 438 deletions(-) diff --git a/TRADEMARK b/TRADEMARK index e06b19a..9d26cf5 100644 --- a/TRADEMARK +++ b/TRADEMARK @@ -2,7 +2,7 @@ TRIPWIRE COPYRIGHT & TRADEMARK NOTICE COPYRIGHT The developer of the original code and/or files is Tripwire, Inc. Portions -created by Tripwire, Inc. are copyright 2000 Tripwire, Inc. +created by Tripwire, Inc. are copyright 2000-2017 Tripwire, Inc. TRADEMARK Tripwire is a registered trademark (the "Trademark") of Tripwire, Inc. All diff --git a/src/core/archive.cpp b/src/core/archive.cpp index 95b0f5f..d0f3310 100644 --- a/src/core/archive.cpp +++ b/src/core/archive.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/archive.h b/src/core/archive.h index 7c25092..e3e483a 100644 --- a/src/core/archive.h +++ b/src/core/archive.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/charutil.cpp b/src/core/charutil.cpp index 85f3a5b..42ff607 100644 --- a/src/core/charutil.cpp +++ b/src/core/charutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/charutil.h b/src/core/charutil.h index 6d0c2ff..5717cc9 100644 --- a/src/core/charutil.h +++ b/src/core/charutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/cmdlineparser.cpp b/src/core/cmdlineparser.cpp index 3bd51f2..3030a2c 100644 --- a/src/core/cmdlineparser.cpp +++ b/src/core/cmdlineparser.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/cmdlineparser.h b/src/core/cmdlineparser.h index 6e990d0..43105f4 100644 --- a/src/core/cmdlineparser.h +++ b/src/core/cmdlineparser.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/codeconvert.cpp b/src/core/codeconvert.cpp index 73816f5..559d335 100644 --- a/src/core/codeconvert.cpp +++ b/src/core/codeconvert.cpp @@ -1,6 +1,6 @@ // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/codeconvert.h b/src/core/codeconvert.h index 543d17a..3c74661 100644 --- a/src/core/codeconvert.h +++ b/src/core/codeconvert.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/core.cpp b/src/core/core.cpp index 966831b..a84ebb2 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/core.h b/src/core/core.h index ce629da..87c3621 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/coreerrors.cpp b/src/core/coreerrors.cpp index 2c249d0..0a7ca64 100644 --- a/src/core/coreerrors.cpp +++ b/src/core/coreerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/coreerrors.h b/src/core/coreerrors.h index 19dd721..1b9a17c 100644 --- a/src/core/coreerrors.h +++ b/src/core/coreerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/corestrings.cpp b/src/core/corestrings.cpp index a23492e..65f1747 100644 --- a/src/core/corestrings.cpp +++ b/src/core/corestrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/corestrings.h b/src/core/corestrings.h index 3071203..3566333 100644 --- a/src/core/corestrings.h +++ b/src/core/corestrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/crc32.cpp b/src/core/crc32.cpp index 4c357c9..888a2e7 100644 --- a/src/core/crc32.cpp +++ b/src/core/crc32.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/crc32.h b/src/core/crc32.h index 4b3bf67..2ae013f 100644 --- a/src/core/crc32.h +++ b/src/core/crc32.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/debug.cpp b/src/core/debug.cpp index f56c3d4..229dae1 100644 --- a/src/core/debug.cpp +++ b/src/core/debug.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/debug.h b/src/core/debug.h index 1274d0a..1210767 100644 --- a/src/core/debug.h +++ b/src/core/debug.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/displayencoder.cpp b/src/core/displayencoder.cpp index 3b3536d..3f983fe 100644 --- a/src/core/displayencoder.cpp +++ b/src/core/displayencoder.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/displayencoder.h b/src/core/displayencoder.h index fb8a775..534830f 100644 --- a/src/core/displayencoder.h +++ b/src/core/displayencoder.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/displayutil.cpp b/src/core/displayutil.cpp index 23c3e5f..42ce9eb 100644 --- a/src/core/displayutil.cpp +++ b/src/core/displayutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/displayutil.h b/src/core/displayutil.h index e9ab6a6..35ee90d 100644 --- a/src/core/displayutil.h +++ b/src/core/displayutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/error.cpp b/src/core/error.cpp index 5c20c23..c58c5e0 100644 --- a/src/core/error.cpp +++ b/src/core/error.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/error.h b/src/core/error.h index bb73cbd..3cafb32 100644 --- a/src/core/error.h +++ b/src/core/error.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errorbucket.h b/src/core/errorbucket.h index d9f5ac6..e0896ee 100644 --- a/src/core/errorbucket.h +++ b/src/core/errorbucket.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errorbucketimpl.cpp b/src/core/errorbucketimpl.cpp index 523720d..3b00bd1 100644 --- a/src/core/errorbucketimpl.cpp +++ b/src/core/errorbucketimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errorbucketimpl.h b/src/core/errorbucketimpl.h index f714e46..5944458 100644 --- a/src/core/errorbucketimpl.h +++ b/src/core/errorbucketimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errorgeneral.h b/src/core/errorgeneral.h index c78b285..5159df5 100644 --- a/src/core/errorgeneral.h +++ b/src/core/errorgeneral.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errortable.cpp b/src/core/errortable.cpp index 07fcb53..8005389 100644 --- a/src/core/errortable.cpp +++ b/src/core/errortable.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errortable.h b/src/core/errortable.h index b0e4012..3fca130 100644 --- a/src/core/errortable.h +++ b/src/core/errortable.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errorutil.cpp b/src/core/errorutil.cpp index e4f7af5..b08d06d 100644 --- a/src/core/errorutil.cpp +++ b/src/core/errorutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errorutil.h b/src/core/errorutil.h index 4b95b6f..1a40b3d 100644 --- a/src/core/errorutil.h +++ b/src/core/errorutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/file.h b/src/core/file.h index b261da2..2092968 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index 68705f1..49f5e3c 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -1,6 +1,6 @@ // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fileerror.cpp b/src/core/fileerror.cpp index e925e13..5c153b4 100644 --- a/src/core/fileerror.cpp +++ b/src/core/fileerror.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fileerror.h b/src/core/fileerror.h index 48b54b6..0789d0f 100644 --- a/src/core/fileerror.h +++ b/src/core/fileerror.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fileheader.cpp b/src/core/fileheader.cpp index 3148e25..a6cc83e 100644 --- a/src/core/fileheader.cpp +++ b/src/core/fileheader.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fileheader.h b/src/core/fileheader.h index cb5806c..3aa3214 100644 --- a/src/core/fileheader.h +++ b/src/core/fileheader.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fixedfilebuf.h b/src/core/fixedfilebuf.h index 8ce2d6e..37a9352 100644 --- a/src/core/fixedfilebuf.h +++ b/src/core/fixedfilebuf.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fsservices.cpp b/src/core/fsservices.cpp index 7f68d62..f4e1861 100644 --- a/src/core/fsservices.cpp +++ b/src/core/fsservices.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fsservices.h b/src/core/fsservices.h index f2f4249..77e7e1b 100644 --- a/src/core/fsservices.h +++ b/src/core/fsservices.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/growheap.cpp b/src/core/growheap.cpp index e1142ff..5cb10c1 100644 --- a/src/core/growheap.cpp +++ b/src/core/growheap.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/growheap.h b/src/core/growheap.h index d255480..fd2e31e 100644 --- a/src/core/growheap.h +++ b/src/core/growheap.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/hashtable.cpp b/src/core/hashtable.cpp index dfe3ad6..69445f7 100644 --- a/src/core/hashtable.cpp +++ b/src/core/hashtable.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/hashtable.h b/src/core/hashtable.h index f28ade0..7398371 100644 --- a/src/core/hashtable.h +++ b/src/core/hashtable.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/haval.cpp b/src/core/haval.cpp index cffc303..6063e00 100644 --- a/src/core/haval.cpp +++ b/src/core/haval.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/haval.h b/src/core/haval.h index e9489dd..d9044e6 100644 --- a/src/core/haval.h +++ b/src/core/haval.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/md5.cpp b/src/core/md5.cpp index 1a265b7..9e0e313 100644 --- a/src/core/md5.cpp +++ b/src/core/md5.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/md5.h b/src/core/md5.h index d82b54b..4686182 100644 --- a/src/core/md5.h +++ b/src/core/md5.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/msystem.cpp b/src/core/msystem.cpp index a4a120a..f63c3cb 100644 --- a/src/core/msystem.cpp +++ b/src/core/msystem.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/msystem.h b/src/core/msystem.h index 9f0a13e..b5a8431 100644 --- a/src/core/msystem.h +++ b/src/core/msystem.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/ntdbs.h b/src/core/ntdbs.h index 81ae8f2..07c29ea 100644 --- a/src/core/ntdbs.h +++ b/src/core/ntdbs.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/ntmbs.cpp b/src/core/ntmbs.cpp index 1500634..f0ba58a 100644 --- a/src/core/ntmbs.cpp +++ b/src/core/ntmbs.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/ntmbs.h b/src/core/ntmbs.h index 4b792f0..094f646 100644 --- a/src/core/ntmbs.h +++ b/src/core/ntmbs.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/package.h b/src/core/package.h index 0745fe7..d8459e5 100644 --- a/src/core/package.h +++ b/src/core/package.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/platform.h b/src/core/platform.h index 7e2bc47..0dd62ce 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/refcountobj.cpp b/src/core/refcountobj.cpp index 575dcb1..5ed4d08 100644 --- a/src/core/refcountobj.cpp +++ b/src/core/refcountobj.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/refcountobj.h b/src/core/refcountobj.h index f96eb19..96b669c 100644 --- a/src/core/refcountobj.h +++ b/src/core/refcountobj.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/resources.h b/src/core/resources.h index cd19ea5..5a64818 100644 --- a/src/core/resources.h +++ b/src/core/resources.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializable.cpp b/src/core/serializable.cpp index 7c559df..6543021 100644 --- a/src/core/serializable.cpp +++ b/src/core/serializable.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializable.h b/src/core/serializable.h index f5a5325..3fd3cd1 100644 --- a/src/core/serializable.h +++ b/src/core/serializable.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializer.cpp b/src/core/serializer.cpp index f80ae8c..0d45030 100644 --- a/src/core/serializer.cpp +++ b/src/core/serializer.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializer.h b/src/core/serializer.h index 036a24e..92d2cf1 100644 --- a/src/core/serializer.h +++ b/src/core/serializer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializerimpl.cpp b/src/core/serializerimpl.cpp index af382b4..e9bd5a8 100644 --- a/src/core/serializerimpl.cpp +++ b/src/core/serializerimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializerimpl.h b/src/core/serializerimpl.h index 273672c..f054bc9 100644 --- a/src/core/serializerimpl.h +++ b/src/core/serializerimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializerutil.cpp b/src/core/serializerutil.cpp index 3dd021d..7bbc33e 100644 --- a/src/core/serializerutil.cpp +++ b/src/core/serializerutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializerutil.h b/src/core/serializerutil.h index 1aeb75c..9954dee 100644 --- a/src/core/serializerutil.h +++ b/src/core/serializerutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serstring.cpp b/src/core/serstring.cpp index 84b8084..073c919 100644 --- a/src/core/serstring.cpp +++ b/src/core/serstring.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serstring.h b/src/core/serstring.h index 7037413..f5ce84f 100644 --- a/src/core/serstring.h +++ b/src/core/serstring.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/sha.cpp b/src/core/sha.cpp index b58a4a0..4ab1b02 100644 --- a/src/core/sha.cpp +++ b/src/core/sha.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/sha.h b/src/core/sha.h index ea1880f..d0a57b9 100644 --- a/src/core/sha.h +++ b/src/core/sha.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/srefcountobj.cpp b/src/core/srefcountobj.cpp index da2a5c2..8bbb404 100644 --- a/src/core/srefcountobj.cpp +++ b/src/core/srefcountobj.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/srefcountobj.h b/src/core/srefcountobj.h index 61080aa..4046943 100644 --- a/src/core/srefcountobj.h +++ b/src/core/srefcountobj.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/srefcounttbl.cpp b/src/core/srefcounttbl.cpp index 4c59477..06324a5 100644 --- a/src/core/srefcounttbl.cpp +++ b/src/core/srefcounttbl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/srefcounttbl.h b/src/core/srefcounttbl.h index cab73db..d7dd536 100644 --- a/src/core/srefcounttbl.h +++ b/src/core/srefcounttbl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/stdcore.cpp b/src/core/stdcore.cpp index 21f477d..4d139a9 100644 --- a/src/core/stdcore.cpp +++ b/src/core/stdcore.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/stdcore.h b/src/core/stdcore.h index 44be2c4..7db5630 100644 --- a/src/core/stdcore.h +++ b/src/core/stdcore.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/stringutil.cpp b/src/core/stringutil.cpp index d1b7f69..4662ca4 100644 --- a/src/core/stringutil.cpp +++ b/src/core/stringutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/stringutil.h b/src/core/stringutil.h index c4540ba..43c189a 100644 --- a/src/core/stringutil.h +++ b/src/core/stringutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/tasktimer.h b/src/core/tasktimer.h index d65fbe6..51f8867 100644 --- a/src/core/tasktimer.h +++ b/src/core/tasktimer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/tchar.h b/src/core/tchar.h index 2871a16..c0ac100 100644 --- a/src/core/tchar.h +++ b/src/core/tchar.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/timebomb.cpp b/src/core/timebomb.cpp index 5d023eb..cfe0378 100644 --- a/src/core/timebomb.cpp +++ b/src/core/timebomb.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/timebomb.h b/src/core/timebomb.h index b9030bc..71ee3a1 100644 --- a/src/core/timebomb.h +++ b/src/core/timebomb.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/timeconvert.cpp b/src/core/timeconvert.cpp index e7b73da..a0c0b04 100644 --- a/src/core/timeconvert.cpp +++ b/src/core/timeconvert.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/timeconvert.h b/src/core/timeconvert.h index c8cb1a1..aa9210f 100644 --- a/src/core/timeconvert.h +++ b/src/core/timeconvert.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/tw_signal.cpp b/src/core/tw_signal.cpp index e13feb8..9274895 100644 --- a/src/core/tw_signal.cpp +++ b/src/core/tw_signal.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/tw_signal.h b/src/core/tw_signal.h index 573a256..31b0edc 100644 --- a/src/core/tw_signal.h +++ b/src/core/tw_signal.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/twlimits.cpp b/src/core/twlimits.cpp index 9da1234..b43139d 100644 --- a/src/core/twlimits.cpp +++ b/src/core/twlimits.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/twlimits.h b/src/core/twlimits.h index 5625b59..ccf8008 100644 --- a/src/core/twlimits.h +++ b/src/core/twlimits.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/twlocale.cpp b/src/core/twlocale.cpp index bf85ea9..85382a3 100644 --- a/src/core/twlocale.cpp +++ b/src/core/twlocale.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/twlocale.h b/src/core/twlocale.h index 18300a7..0e0c386 100644 --- a/src/core/twlocale.h +++ b/src/core/twlocale.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/twstringslang.h b/src/core/twstringslang.h index 9734312..82a7adb 100644 --- a/src/core/twstringslang.h +++ b/src/core/twstringslang.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/typed.h b/src/core/typed.h index dbef30f..6515180 100644 --- a/src/core/typed.h +++ b/src/core/typed.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/types.h b/src/core/types.h index 170681a..bda69c2 100644 --- a/src/core/types.h +++ b/src/core/types.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/unixexcept.cpp b/src/core/unixexcept.cpp index 0ab1c19..64eef25 100644 --- a/src/core/unixexcept.cpp +++ b/src/core/unixexcept.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/unixexcept.h b/src/core/unixexcept.h index d9f9f50..460f6ae 100644 --- a/src/core/unixexcept.h +++ b/src/core/unixexcept.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index 54595e4..7f58ba9 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/unixfsservices.h b/src/core/unixfsservices.h index 51e6c51..333bb71 100644 --- a/src/core/unixfsservices.h +++ b/src/core/unixfsservices.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/upperbound.h b/src/core/upperbound.h index 6fecc17..8dd29dc 100644 --- a/src/core/upperbound.h +++ b/src/core/upperbound.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/usernotify.cpp b/src/core/usernotify.cpp index ba45a0c..c66f549 100644 --- a/src/core/usernotify.cpp +++ b/src/core/usernotify.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/usernotify.h b/src/core/usernotify.h index 4796491..8c61e97 100644 --- a/src/core/usernotify.h +++ b/src/core/usernotify.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/usernotifystdout.cpp b/src/core/usernotifystdout.cpp index d41b0f9..c2bf1a5 100644 --- a/src/core/usernotifystdout.cpp +++ b/src/core/usernotifystdout.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/usernotifystdout.h b/src/core/usernotifystdout.h index e48af7b..92b757b 100644 --- a/src/core/usernotifystdout.h +++ b/src/core/usernotifystdout.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/userstringmem.cpp b/src/core/userstringmem.cpp index ffa84e4..1a20cd2 100644 --- a/src/core/userstringmem.cpp +++ b/src/core/userstringmem.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/userstringmem.h b/src/core/userstringmem.h index 84fcf2a..10f1272 100644 --- a/src/core/userstringmem.h +++ b/src/core/userstringmem.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/wchar16.cpp b/src/core/wchar16.cpp index f7e465d..d2c097b 100644 --- a/src/core/wchar16.cpp +++ b/src/core/wchar16.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/wchar16.h b/src/core/wchar16.h index 74abe7f..d4adfad 100644 --- a/src/core/wchar16.h +++ b/src/core/wchar16.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/block.h b/src/db/block.h index fca863f..2c948b3 100644 --- a/src/db/block.h +++ b/src/db/block.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/blockfile.cpp b/src/db/blockfile.cpp index 5713e22..5ff3770 100644 --- a/src/db/blockfile.cpp +++ b/src/db/blockfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/blockfile.h b/src/db/blockfile.h index 975cf21..06003f4 100644 --- a/src/db/blockfile.h +++ b/src/db/blockfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/blockrecordarray.cpp b/src/db/blockrecordarray.cpp index 51b6642..f18ebc3 100644 --- a/src/db/blockrecordarray.cpp +++ b/src/db/blockrecordarray.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/blockrecordarray.h b/src/db/blockrecordarray.h index d973f69..6f0cb42 100644 --- a/src/db/blockrecordarray.h +++ b/src/db/blockrecordarray.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/blockrecordfile.cpp b/src/db/blockrecordfile.cpp index 96f8de1..123c714 100644 --- a/src/db/blockrecordfile.cpp +++ b/src/db/blockrecordfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/blockrecordfile.h b/src/db/blockrecordfile.h index 5a664af..a3ff540 100644 --- a/src/db/blockrecordfile.h +++ b/src/db/blockrecordfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/db.cpp b/src/db/db.cpp index 79aeb75..16918ca 100644 --- a/src/db/db.cpp +++ b/src/db/db.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/db.h b/src/db/db.h index 2102ca9..d1d1df2 100644 --- a/src/db/db.h +++ b/src/db/db.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/dberrors.cpp b/src/db/dberrors.cpp index 4b2d2ed..15c484d 100644 --- a/src/db/dberrors.cpp +++ b/src/db/dberrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/dberrors.h b/src/db/dberrors.h index b4c876d..4f4e6ca 100644 --- a/src/db/dberrors.h +++ b/src/db/dberrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/hierdatabase.cpp b/src/db/hierdatabase.cpp index e90e28a..b94531a 100644 --- a/src/db/hierdatabase.cpp +++ b/src/db/hierdatabase.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/hierdatabase.h b/src/db/hierdatabase.h index 1e3c173..957dbea 100644 --- a/src/db/hierdatabase.h +++ b/src/db/hierdatabase.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/hierdbnode.h b/src/db/hierdbnode.h index 148df88..929c340 100644 --- a/src/db/hierdbnode.h +++ b/src/db/hierdbnode.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/hierdbpath.cpp b/src/db/hierdbpath.cpp index 42c99c4..9da1dc3 100644 --- a/src/db/hierdbpath.cpp +++ b/src/db/hierdbpath.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/hierdbpath.h b/src/db/hierdbpath.h index ab0aea3..fb9c868 100644 --- a/src/db/hierdbpath.h +++ b/src/db/hierdbpath.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/stddb.cpp b/src/db/stddb.cpp index 7037167..967418d 100644 --- a/src/db/stddb.cpp +++ b/src/db/stddb.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/stddb.h b/src/db/stddb.h index 301ed7a..28b9c51 100644 --- a/src/db/stddb.h +++ b/src/db/stddb.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fco.cpp b/src/fco/fco.cpp index ca44e38..83123ae 100644 --- a/src/fco/fco.cpp +++ b/src/fco/fco.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fco.h b/src/fco/fco.h index b6db14e..70104fb 100644 --- a/src/fco/fco.h +++ b/src/fco/fco.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcocompare.cpp b/src/fco/fcocompare.cpp index 52465ef..439c7ea 100644 --- a/src/fco/fcocompare.cpp +++ b/src/fco/fcocompare.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcocompare.h b/src/fco/fcocompare.h index 2343286..473213f 100644 --- a/src/fco/fcocompare.h +++ b/src/fco/fcocompare.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasource.h b/src/fco/fcodatasource.h index f103189..6710ed9 100644 --- a/src/fco/fcodatasource.h +++ b/src/fco/fcodatasource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasourceiter.cpp b/src/fco/fcodatasourceiter.cpp index ce9d68f..b70341b 100644 --- a/src/fco/fcodatasourceiter.cpp +++ b/src/fco/fcodatasourceiter.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasourceiter.h b/src/fco/fcodatasourceiter.h index a8658b7..c5f840c 100644 --- a/src/fco/fcodatasourceiter.h +++ b/src/fco/fcodatasourceiter.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasourceiterimpl.cpp b/src/fco/fcodatasourceiterimpl.cpp index 8ed612b..12a8181 100644 --- a/src/fco/fcodatasourceiterimpl.cpp +++ b/src/fco/fcodatasourceiterimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasourceiterimpl.h b/src/fco/fcodatasourceiterimpl.h index 83ac1c8..39fd047 100644 --- a/src/fco/fcodatasourceiterimpl.h +++ b/src/fco/fcodatasourceiterimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcoerrors.cpp b/src/fco/fcoerrors.cpp index 2117a5d..7e593a7 100644 --- a/src/fco/fcoerrors.cpp +++ b/src/fco/fcoerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcoerrors.h b/src/fco/fcoerrors.h index 89b4978..56be119 100644 --- a/src/fco/fcoerrors.h +++ b/src/fco/fcoerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcogenre.h b/src/fco/fcogenre.h index 704a0f1..f6103de 100644 --- a/src/fco/fcogenre.h +++ b/src/fco/fcogenre.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconame.cpp b/src/fco/fconame.cpp index 1281bcd..2d24c8c 100644 --- a/src/fco/fconame.cpp +++ b/src/fco/fconame.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconame.h b/src/fco/fconame.h index 0ce68fb..c3557db 100644 --- a/src/fco/fconame.h +++ b/src/fco/fconame.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconameinfo.h b/src/fco/fconameinfo.h index a277764..3c1b57e 100644 --- a/src/fco/fconameinfo.h +++ b/src/fco/fconameinfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconametbl.cpp b/src/fco/fconametbl.cpp index 1bcfbeb..002b636 100644 --- a/src/fco/fconametbl.cpp +++ b/src/fco/fconametbl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconametbl.h b/src/fco/fconametbl.h index 16e2301..d21d2c2 100644 --- a/src/fco/fconametbl.h +++ b/src/fco/fconametbl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconametranslator.h b/src/fco/fconametranslator.h index 0c6e0f1..57e2bd5 100644 --- a/src/fco/fconametranslator.h +++ b/src/fco/fconametranslator.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcoprop.h b/src/fco/fcoprop.h index df74f7d..f73c634 100644 --- a/src/fco/fcoprop.h +++ b/src/fco/fcoprop.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropcalc.h b/src/fco/fcopropcalc.h index f39d30d..0b6454c 100644 --- a/src/fco/fcopropcalc.h +++ b/src/fco/fcopropcalc.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropdisplayer.h b/src/fco/fcopropdisplayer.h index 496429b..96d7efd 100644 --- a/src/fco/fcopropdisplayer.h +++ b/src/fco/fcopropdisplayer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropimpl.cpp b/src/fco/fcopropimpl.cpp index 157d071..18a15a9 100644 --- a/src/fco/fcopropimpl.cpp +++ b/src/fco/fcopropimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropimpl.h b/src/fco/fcopropimpl.h index 87cdfa9..bc0b2ff 100644 --- a/src/fco/fcopropimpl.h +++ b/src/fco/fcopropimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropset.h b/src/fco/fcopropset.h index 8932045..fa21d04 100644 --- a/src/fco/fcopropset.h +++ b/src/fco/fcopropset.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropvector.cpp b/src/fco/fcopropvector.cpp index 54c1bde..de16ddb 100644 --- a/src/fco/fcopropvector.cpp +++ b/src/fco/fcopropvector.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropvector.h b/src/fco/fcopropvector.h index 7e2dc51..e15f331 100644 --- a/src/fco/fcopropvector.h +++ b/src/fco/fcopropvector.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcosetimpl.cpp b/src/fco/fcosetimpl.cpp index 2f271e4..2bc3e1a 100644 --- a/src/fco/fcosetimpl.cpp +++ b/src/fco/fcosetimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcosetimpl.h b/src/fco/fcosetimpl.h index b7d3bef..ae9f98d 100644 --- a/src/fco/fcosetimpl.h +++ b/src/fco/fcosetimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcosetws.h b/src/fco/fcosetws.h index 5b71e30..5b46e87 100644 --- a/src/fco/fcosetws.h +++ b/src/fco/fcosetws.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospec.cpp b/src/fco/fcospec.cpp index e281c77..8aeb80a 100644 --- a/src/fco/fcospec.cpp +++ b/src/fco/fcospec.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospec.h b/src/fco/fcospec.h index 6b7b9f2..f23c1ff 100644 --- a/src/fco/fcospec.h +++ b/src/fco/fcospec.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospecattr.cpp b/src/fco/fcospecattr.cpp index 341c671..8f7cbd9 100644 --- a/src/fco/fcospecattr.cpp +++ b/src/fco/fcospecattr.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospecattr.h b/src/fco/fcospecattr.h index c212673..1924bf8 100644 --- a/src/fco/fcospecattr.h +++ b/src/fco/fcospecattr.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospechelper.cpp b/src/fco/fcospechelper.cpp index 24909ee..921b8d4 100644 --- a/src/fco/fcospechelper.cpp +++ b/src/fco/fcospechelper.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospechelper.h b/src/fco/fcospechelper.h index f0ae60f..f9b74d7 100644 --- a/src/fco/fcospechelper.h +++ b/src/fco/fcospechelper.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospecimpl.cpp b/src/fco/fcospecimpl.cpp index d696372..e15d0fd 100644 --- a/src/fco/fcospecimpl.cpp +++ b/src/fco/fcospecimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospecimpl.h b/src/fco/fcospecimpl.h index 0bfa028..794b0ba 100644 --- a/src/fco/fcospecimpl.h +++ b/src/fco/fcospecimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospeclist.cpp b/src/fco/fcospeclist.cpp index 735d73b..8dfdb96 100644 --- a/src/fco/fcospeclist.cpp +++ b/src/fco/fcospeclist.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospeclist.h b/src/fco/fcospeclist.h index d149c13..05ffc9c 100644 --- a/src/fco/fcospeclist.h +++ b/src/fco/fcospeclist.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospecutil.cpp b/src/fco/fcospecutil.cpp index 293e721..e6b13c0 100644 --- a/src/fco/fcospecutil.cpp +++ b/src/fco/fcospecutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospecutil.h b/src/fco/fcospecutil.h index 0f2f236..912cd80 100644 --- a/src/fco/fcospecutil.h +++ b/src/fco/fcospecutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcostrings.cpp b/src/fco/fcostrings.cpp index 01e91cf..872665d 100644 --- a/src/fco/fcostrings.cpp +++ b/src/fco/fcostrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcostrings.h b/src/fco/fcostrings.h index 30683c0..f06de30 100644 --- a/src/fco/fcostrings.h +++ b/src/fco/fcostrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcoundefprop.cpp b/src/fco/fcoundefprop.cpp index 01cc82f..e00444c 100644 --- a/src/fco/fcoundefprop.cpp +++ b/src/fco/fcoundefprop.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcoundefprop.h b/src/fco/fcoundefprop.h index 1c94f28..f00b19a 100644 --- a/src/fco/fcoundefprop.h +++ b/src/fco/fcoundefprop.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcovisitor.h b/src/fco/fcovisitor.h index 3977e50..c4a134a 100644 --- a/src/fco/fcovisitor.h +++ b/src/fco/fcovisitor.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genreinfo.cpp b/src/fco/genreinfo.cpp index 10594d5..af31296 100644 --- a/src/fco/genreinfo.cpp +++ b/src/fco/genreinfo.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genreinfo.h b/src/fco/genreinfo.h index a2024e7..f1b85ee 100644 --- a/src/fco/genreinfo.h +++ b/src/fco/genreinfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genrespeclist.cpp b/src/fco/genrespeclist.cpp index 17f2b49..ee9970c 100644 --- a/src/fco/genrespeclist.cpp +++ b/src/fco/genrespeclist.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genrespeclist.h b/src/fco/genrespeclist.h index da1e646..a341f14 100644 --- a/src/fco/genrespeclist.h +++ b/src/fco/genrespeclist.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genreswitcher.cpp b/src/fco/genreswitcher.cpp index 98f04a5..37f7a3b 100644 --- a/src/fco/genreswitcher.cpp +++ b/src/fco/genreswitcher.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genreswitcher.h b/src/fco/genreswitcher.h index 121b56c..f3261e4 100644 --- a/src/fco/genreswitcher.h +++ b/src/fco/genreswitcher.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/iterproxy.h b/src/fco/iterproxy.h index 21fdfca..78d4af8 100644 --- a/src/fco/iterproxy.h +++ b/src/fco/iterproxy.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/parsergenreutil.h b/src/fco/parsergenreutil.h index 6b6edfd..9db8e56 100644 --- a/src/fco/parsergenreutil.h +++ b/src/fco/parsergenreutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/propset.h b/src/fco/propset.h index be6ef67..b6aae9d 100644 --- a/src/fco/propset.h +++ b/src/fco/propset.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/signature.cpp b/src/fco/signature.cpp index 4fee4d6..c7129d1 100644 --- a/src/fco/signature.cpp +++ b/src/fco/signature.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/signature.h b/src/fco/signature.h index c7d775c..ba6de3d 100644 --- a/src/fco/signature.h +++ b/src/fco/signature.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/stdfco.cpp b/src/fco/stdfco.cpp index 8f1ab77..dffd92f 100644 --- a/src/fco/stdfco.cpp +++ b/src/fco/stdfco.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/stdfco.h b/src/fco/stdfco.h index f897a01..0f7c96e 100644 --- a/src/fco/stdfco.h +++ b/src/fco/stdfco.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/twfactory.cpp b/src/fco/twfactory.cpp index cb0a229..59c8671 100644 --- a/src/fco/twfactory.cpp +++ b/src/fco/twfactory.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/twfactory.h b/src/fco/twfactory.h index fe87b8c..9e6d221 100644 --- a/src/fco/twfactory.h +++ b/src/fco/twfactory.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fs.cpp b/src/fs/fs.cpp index 76d64c0..d7889a1 100644 --- a/src/fs/fs.cpp +++ b/src/fs/fs.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fs.h b/src/fs/fs.h index 6231810..250e78b 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsdatasourceiter.cpp b/src/fs/fsdatasourceiter.cpp index c63cc91..8d8d80f 100644 --- a/src/fs/fsdatasourceiter.cpp +++ b/src/fs/fsdatasourceiter.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsdatasourceiter.h b/src/fs/fsdatasourceiter.h index e97bc58..fa20f01 100644 --- a/src/fs/fsdatasourceiter.h +++ b/src/fs/fsdatasourceiter.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fserrors.cpp b/src/fs/fserrors.cpp index d5c2e2a..131f6b1 100644 --- a/src/fs/fserrors.cpp +++ b/src/fs/fserrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fserrors.h b/src/fs/fserrors.h index 2369419..38ff091 100644 --- a/src/fs/fserrors.h +++ b/src/fs/fserrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsfactory.cpp b/src/fs/fsfactory.cpp index 1874aeb..a2a690e 100644 --- a/src/fs/fsfactory.cpp +++ b/src/fs/fsfactory.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsfactory.h b/src/fs/fsfactory.h index 980dda7..5d14691 100644 --- a/src/fs/fsfactory.h +++ b/src/fs/fsfactory.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsnametranslator.cpp b/src/fs/fsnametranslator.cpp index ebb24bd..cf1bea9 100644 --- a/src/fs/fsnametranslator.cpp +++ b/src/fs/fsnametranslator.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsnametranslator.h b/src/fs/fsnametranslator.h index 4daf9f4..3f5e4a0 100644 --- a/src/fs/fsnametranslator.h +++ b/src/fs/fsnametranslator.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsobject.cpp b/src/fs/fsobject.cpp index bb18991..87522b5 100644 --- a/src/fs/fsobject.cpp +++ b/src/fs/fsobject.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsobject.h b/src/fs/fsobject.h index f66deaa..12d6592 100644 --- a/src/fs/fsobject.h +++ b/src/fs/fsobject.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsparserutil.cpp b/src/fs/fsparserutil.cpp index 7de1b0a..c9c3e64 100644 --- a/src/fs/fsparserutil.cpp +++ b/src/fs/fsparserutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsparserutil.h b/src/fs/fsparserutil.h index b0e1b7c..c5b3dea 100644 --- a/src/fs/fsparserutil.h +++ b/src/fs/fsparserutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index ad1446b..7bbb907 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fspropcalc.h b/src/fs/fspropcalc.h index 85afa41..4fda77d 100644 --- a/src/fs/fspropcalc.h +++ b/src/fs/fspropcalc.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fspropdisplayer.cpp b/src/fs/fspropdisplayer.cpp index 6e465f3..375cf67 100644 --- a/src/fs/fspropdisplayer.cpp +++ b/src/fs/fspropdisplayer.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fspropdisplayer.h b/src/fs/fspropdisplayer.h index 03bc8e2..91164b6 100644 --- a/src/fs/fspropdisplayer.h +++ b/src/fs/fspropdisplayer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fspropset.cpp b/src/fs/fspropset.cpp index f734611..8189710 100644 --- a/src/fs/fspropset.cpp +++ b/src/fs/fspropset.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fspropset.h b/src/fs/fspropset.h index 423e5cc..b771673 100644 --- a/src/fs/fspropset.h +++ b/src/fs/fspropset.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsstrings.cpp b/src/fs/fsstrings.cpp index 3eee809..1d5775d 100644 --- a/src/fs/fsstrings.cpp +++ b/src/fs/fsstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsstrings.h b/src/fs/fsstrings.h index c61fe70..10a655b 100644 --- a/src/fs/fsstrings.h +++ b/src/fs/fsstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsvisitor.cpp b/src/fs/fsvisitor.cpp index b9a669c..bac8ebd 100644 --- a/src/fs/fsvisitor.cpp +++ b/src/fs/fsvisitor.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsvisitor.h b/src/fs/fsvisitor.h index ac9c042..8d7eb7c 100644 --- a/src/fs/fsvisitor.h +++ b/src/fs/fsvisitor.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/stdfs.cpp b/src/fs/stdfs.cpp index d281648..8715dc4 100644 --- a/src/fs/stdfs.cpp +++ b/src/fs/stdfs.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/stdfs.h b/src/fs/stdfs.h index 58712e0..07912e9 100644 --- a/src/fs/stdfs.h +++ b/src/fs/stdfs.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/parser/lexyacc_header.h b/src/parser/lexyacc_header.h index d2b67ae..3611f4c 100644 --- a/src/parser/lexyacc_header.h +++ b/src/parser/lexyacc_header.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/parser/policy.y b/src/parser/policy.y index 910c79f..7398508 100644 --- a/src/parser/policy.y +++ b/src/parser/policy.y @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/parser/tokens.l b/src/parser/tokens.l index 536ba91..d6a45cd 100644 --- a/src/parser/tokens.l +++ b/src/parser/tokens.l @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggen.cpp b/src/siggen/siggen.cpp index 2711a5f..338f897 100644 --- a/src/siggen/siggen.cpp +++ b/src/siggen/siggen.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggen.h b/src/siggen/siggen.h index 666bec9..2e79351 100644 --- a/src/siggen/siggen.h +++ b/src/siggen/siggen.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggencmdline.cpp b/src/siggen/siggencmdline.cpp index 514fcc5..24f2d45 100644 --- a/src/siggen/siggencmdline.cpp +++ b/src/siggen/siggencmdline.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggencmdline.h b/src/siggen/siggencmdline.h index 585eb25..b31d49a 100644 --- a/src/siggen/siggencmdline.h +++ b/src/siggen/siggencmdline.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggenmain.cpp b/src/siggen/siggenmain.cpp index 0427b71..c975a89 100644 --- a/src/siggen/siggenmain.cpp +++ b/src/siggen/siggenmain.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggenstrings.cpp b/src/siggen/siggenstrings.cpp index 304e602..5257d96 100644 --- a/src/siggen/siggenstrings.cpp +++ b/src/siggen/siggenstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggenstrings.h b/src/siggen/siggenstrings.h index e026f10..badc831 100644 --- a/src/siggen/siggenstrings.h +++ b/src/siggen/siggenstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/stdsiggen.cpp b/src/siggen/stdsiggen.cpp index 21a73bf..1bf9da2 100644 --- a/src/siggen/stdsiggen.cpp +++ b/src/siggen/stdsiggen.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/stdsiggen.h b/src/siggen/stdsiggen.h index 874dc91..fae8afe 100644 --- a/src/siggen/stdsiggen.h +++ b/src/siggen/stdsiggen.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/generatedb.cpp b/src/tripwire/generatedb.cpp index 7bf59b2..8c3a6d5 100644 --- a/src/tripwire/generatedb.cpp +++ b/src/tripwire/generatedb.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/generatedb.h b/src/tripwire/generatedb.h index 22fe8fb..2f1665c 100644 --- a/src/tripwire/generatedb.h +++ b/src/tripwire/generatedb.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/generatedb_t.cpp b/src/tripwire/generatedb_t.cpp index 7de5c82..4c7bbfa 100644 --- a/src/tripwire/generatedb_t.cpp +++ b/src/tripwire/generatedb_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/integritycheck.cpp b/src/tripwire/integritycheck.cpp index 815cd15..bbbf51c 100644 --- a/src/tripwire/integritycheck.cpp +++ b/src/tripwire/integritycheck.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/integritycheck.h b/src/tripwire/integritycheck.h index f5a61ca..5143c4e 100644 --- a/src/tripwire/integritycheck.h +++ b/src/tripwire/integritycheck.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/integritycheck_t.cpp b/src/tripwire/integritycheck_t.cpp index ed133b4..aacedf1 100644 --- a/src/tripwire/integritycheck_t.cpp +++ b/src/tripwire/integritycheck_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/mailmessage.cpp b/src/tripwire/mailmessage.cpp index 975fe50..59963e1 100644 --- a/src/tripwire/mailmessage.cpp +++ b/src/tripwire/mailmessage.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/mailmessage.h b/src/tripwire/mailmessage.h index 19b0617..734119a 100644 --- a/src/tripwire/mailmessage.h +++ b/src/tripwire/mailmessage.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/pipedmailmessage.cpp b/src/tripwire/pipedmailmessage.cpp index ea81f9f..84bffab 100644 --- a/src/tripwire/pipedmailmessage.cpp +++ b/src/tripwire/pipedmailmessage.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/policyupdate.cpp b/src/tripwire/policyupdate.cpp index e559e7f..27fe59f 100644 --- a/src/tripwire/policyupdate.cpp +++ b/src/tripwire/policyupdate.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/policyupdate.h b/src/tripwire/policyupdate.h index 210cf8a..c7169ca 100644 --- a/src/tripwire/policyupdate.h +++ b/src/tripwire/policyupdate.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/resource.h b/src/tripwire/resource.h index fbe9e46..33bb438 100644 --- a/src/tripwire/resource.h +++ b/src/tripwire/resource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/smtpmailmessage.cpp b/src/tripwire/smtpmailmessage.cpp index 9e63bc7..695b649 100644 --- a/src/tripwire/smtpmailmessage.cpp +++ b/src/tripwire/smtpmailmessage.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/stdtripwire.cpp b/src/tripwire/stdtripwire.cpp index ec619e8..d3fc63d 100644 --- a/src/tripwire/stdtripwire.cpp +++ b/src/tripwire/stdtripwire.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/stdtripwire.h b/src/tripwire/stdtripwire.h index e62786d..1a72e9e 100644 --- a/src/tripwire/stdtripwire.h +++ b/src/tripwire/stdtripwire.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/syslog_trip.cpp b/src/tripwire/syslog_trip.cpp index 66da277..9680b6c 100644 --- a/src/tripwire/syslog_trip.cpp +++ b/src/tripwire/syslog_trip.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/syslog_trip.h b/src/tripwire/syslog_trip.h index 9c8de99..c7b3341 100644 --- a/src/tripwire/syslog_trip.h +++ b/src/tripwire/syslog_trip.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwire.cpp b/src/tripwire/tripwire.cpp index 0895e18..0ac986f 100644 --- a/src/tripwire/tripwire.cpp +++ b/src/tripwire/tripwire.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwire.h b/src/tripwire/tripwire.h index b725e76..faefee7 100644 --- a/src/tripwire/tripwire.h +++ b/src/tripwire/tripwire.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwireerrors.cpp b/src/tripwire/tripwireerrors.cpp index aa56c45..3a2f54c 100644 --- a/src/tripwire/tripwireerrors.cpp +++ b/src/tripwire/tripwireerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwireerrors.h b/src/tripwire/tripwireerrors.h index d3be484..778e98a 100644 --- a/src/tripwire/tripwireerrors.h +++ b/src/tripwire/tripwireerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwiremain.cpp b/src/tripwire/tripwiremain.cpp index 89649b9..09f2b0c 100644 --- a/src/tripwire/tripwiremain.cpp +++ b/src/tripwire/tripwiremain.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwiremsg.h b/src/tripwire/tripwiremsg.h index f6dbb95..1fcb824 100644 --- a/src/tripwire/tripwiremsg.h +++ b/src/tripwire/tripwiremsg.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwirestrings.cpp b/src/tripwire/tripwirestrings.cpp index b254d18..0494f8c 100644 --- a/src/tripwire/tripwirestrings.cpp +++ b/src/tripwire/tripwirestrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwirestrings.h b/src/tripwire/tripwirestrings.h index db805c6..e2a07e9 100644 --- a/src/tripwire/tripwirestrings.h +++ b/src/tripwire/tripwirestrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwireutil.cpp b/src/tripwire/tripwireutil.cpp index 69a5e32..e97726f 100644 --- a/src/tripwire/tripwireutil.cpp +++ b/src/tripwire/tripwireutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwireutil.h b/src/tripwire/tripwireutil.h index 51d4857..0eac927 100644 --- a/src/tripwire/tripwireutil.h +++ b/src/tripwire/tripwireutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index a97baaf..58435a0 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/twcmdline.h b/src/tripwire/twcmdline.h index e68d677..67fd217 100644 --- a/src/tripwire/twcmdline.h +++ b/src/tripwire/twcmdline.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/twcmdlineutil.cpp b/src/tripwire/twcmdlineutil.cpp index 67e5893..98e95c5 100644 --- a/src/tripwire/twcmdlineutil.cpp +++ b/src/tripwire/twcmdlineutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/twcmdlineutil.h b/src/tripwire/twcmdlineutil.h index 8de0508..65608d4 100644 --- a/src/tripwire/twcmdlineutil.h +++ b/src/tripwire/twcmdlineutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/updatedb.cpp b/src/tripwire/updatedb.cpp index c957606..21e2063 100644 --- a/src/tripwire/updatedb.cpp +++ b/src/tripwire/updatedb.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/updatedb.h b/src/tripwire/updatedb.h index 34cca8a..0749870 100644 --- a/src/tripwire/updatedb.h +++ b/src/tripwire/updatedb.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/configfile.cpp b/src/tw/configfile.cpp index 9e4c0fc..cf97d1e 100644 --- a/src/tw/configfile.cpp +++ b/src/tw/configfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/configfile.h b/src/tw/configfile.h index 6cbf2e9..11c8202 100644 --- a/src/tw/configfile.h +++ b/src/tw/configfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbdatasource.cpp b/src/tw/dbdatasource.cpp index faacfb7..1065b1b 100644 --- a/src/tw/dbdatasource.cpp +++ b/src/tw/dbdatasource.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbdatasource.h b/src/tw/dbdatasource.h index 2196ae5..e656870 100644 --- a/src/tw/dbdatasource.h +++ b/src/tw/dbdatasource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbdebug.cpp b/src/tw/dbdebug.cpp index 2f5318a..c14c316 100644 --- a/src/tw/dbdebug.cpp +++ b/src/tw/dbdebug.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbdebug.h b/src/tw/dbdebug.h index d90a0b6..25f6c9f 100644 --- a/src/tw/dbdebug.h +++ b/src/tw/dbdebug.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbexplore.cpp b/src/tw/dbexplore.cpp index 40d3c16..71f8b65 100644 --- a/src/tw/dbexplore.cpp +++ b/src/tw/dbexplore.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbexplore.h b/src/tw/dbexplore.h index 388a1e4..9e0e272 100644 --- a/src/tw/dbexplore.h +++ b/src/tw/dbexplore.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcodatabasefile.cpp b/src/tw/fcodatabasefile.cpp index 65e6b89..c7b9de1 100644 --- a/src/tw/fcodatabasefile.cpp +++ b/src/tw/fcodatabasefile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcodatabasefile.h b/src/tw/fcodatabasefile.h index 875ed4b..656c697 100644 --- a/src/tw/fcodatabasefile.h +++ b/src/tw/fcodatabasefile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcodatabaseutil.cpp b/src/tw/fcodatabaseutil.cpp index a300cf2..e78a56c 100644 --- a/src/tw/fcodatabaseutil.cpp +++ b/src/tw/fcodatabaseutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcodatabaseutil.h b/src/tw/fcodatabaseutil.h index 5ab2d72..a40a234 100644 --- a/src/tw/fcodatabaseutil.h +++ b/src/tw/fcodatabaseutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcoreport.cpp b/src/tw/fcoreport.cpp index c9534f4..d4c624d 100644 --- a/src/tw/fcoreport.cpp +++ b/src/tw/fcoreport.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcoreport.h b/src/tw/fcoreport.h index 7010edf..74dfe8d 100644 --- a/src/tw/fcoreport.h +++ b/src/tw/fcoreport.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcoreportutil.cpp b/src/tw/fcoreportutil.cpp index 076f524..539c65c 100644 --- a/src/tw/fcoreportutil.cpp +++ b/src/tw/fcoreportutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcoreportutil.h b/src/tw/fcoreportutil.h index b4e2510..8701f93 100644 --- a/src/tw/fcoreportutil.h +++ b/src/tw/fcoreportutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/filemanipulator.cpp b/src/tw/filemanipulator.cpp index 0ee37c3..ef7485c 100644 --- a/src/tw/filemanipulator.cpp +++ b/src/tw/filemanipulator.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/filemanipulator.h b/src/tw/filemanipulator.h index bb5c893..f0bc987 100644 --- a/src/tw/filemanipulator.h +++ b/src/tw/filemanipulator.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/headerinfo.cpp b/src/tw/headerinfo.cpp index 3f843be..66c4128 100644 --- a/src/tw/headerinfo.cpp +++ b/src/tw/headerinfo.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/headerinfo.h b/src/tw/headerinfo.h index 96ad016..25988be 100644 --- a/src/tw/headerinfo.h +++ b/src/tw/headerinfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/policyfile.cpp b/src/tw/policyfile.cpp index 9fc16c8..e5e9de6 100644 --- a/src/tw/policyfile.cpp +++ b/src/tw/policyfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/policyfile.h b/src/tw/policyfile.h index a24378d..7be894a 100644 --- a/src/tw/policyfile.h +++ b/src/tw/policyfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/stdtw.cpp b/src/tw/stdtw.cpp index 7105562..32121c9 100644 --- a/src/tw/stdtw.cpp +++ b/src/tw/stdtw.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/stdtw.h b/src/tw/stdtw.h index e7a5a92..87c39ef 100644 --- a/src/tw/stdtw.h +++ b/src/tw/stdtw.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/systeminfo.cpp b/src/tw/systeminfo.cpp index a71b7d1..f099163 100644 --- a/src/tw/systeminfo.cpp +++ b/src/tw/systeminfo.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/systeminfo.h b/src/tw/systeminfo.h index 67e9f58..1a63f28 100644 --- a/src/tw/systeminfo.h +++ b/src/tw/systeminfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/textdbviewer.cpp b/src/tw/textdbviewer.cpp index d6dd5c3..9d4eba0 100644 --- a/src/tw/textdbviewer.cpp +++ b/src/tw/textdbviewer.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/textdbviewer.h b/src/tw/textdbviewer.h index b81e800..eaf31fa 100644 --- a/src/tw/textdbviewer.h +++ b/src/tw/textdbviewer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/textreportviewer.cpp b/src/tw/textreportviewer.cpp index f633d45..9d84788 100644 --- a/src/tw/textreportviewer.cpp +++ b/src/tw/textreportviewer.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/textreportviewer.h b/src/tw/textreportviewer.h index 32ad6a1..f6adfb3 100644 --- a/src/tw/textreportviewer.h +++ b/src/tw/textreportviewer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/tw.cpp b/src/tw/tw.cpp index e9a8b44..1ffba2e 100644 --- a/src/tw/tw.cpp +++ b/src/tw/tw.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/tw.h b/src/tw/tw.h index 547bfe7..e1ff4bd 100644 --- a/src/tw/tw.h +++ b/src/tw/tw.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twerrors.cpp b/src/tw/twerrors.cpp index cf9be69..42a05bf 100644 --- a/src/tw/twerrors.cpp +++ b/src/tw/twerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twerrors.h b/src/tw/twerrors.h index df2613c..f8ecd31 100644 --- a/src/tw/twerrors.h +++ b/src/tw/twerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twinit.cpp b/src/tw/twinit.cpp index 06fbafa..63afb63 100644 --- a/src/tw/twinit.cpp +++ b/src/tw/twinit.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twinit.h b/src/tw/twinit.h index 7179627..63874c1 100644 --- a/src/tw/twinit.h +++ b/src/tw/twinit.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twstrings.cpp b/src/tw/twstrings.cpp index 6789fe2..f30564a 100644 --- a/src/tw/twstrings.cpp +++ b/src/tw/twstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twstrings.h b/src/tw/twstrings.h index 80bee5d..93d3804 100644 --- a/src/tw/twstrings.h +++ b/src/tw/twstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twutil.cpp b/src/tw/twutil.cpp index f227e6b..96214cd 100644 --- a/src/tw/twutil.cpp +++ b/src/tw/twutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twutil.h b/src/tw/twutil.h index 9c51978..6bd7bab 100644 --- a/src/tw/twutil.h +++ b/src/tw/twutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/keygeneration.cpp b/src/twadmin/keygeneration.cpp index 2f304bd..edf47fa 100644 --- a/src/twadmin/keygeneration.cpp +++ b/src/twadmin/keygeneration.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/keygeneration.h b/src/twadmin/keygeneration.h index 69be7df..67540ee 100644 --- a/src/twadmin/keygeneration.h +++ b/src/twadmin/keygeneration.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/resource.h b/src/twadmin/resource.h index 5510e67..6548173 100644 --- a/src/twadmin/resource.h +++ b/src/twadmin/resource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/stdtwadmin.cpp b/src/twadmin/stdtwadmin.cpp index c92529a..6de9773 100644 --- a/src/twadmin/stdtwadmin.cpp +++ b/src/twadmin/stdtwadmin.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/stdtwadmin.h b/src/twadmin/stdtwadmin.h index 8d7c961..2f36b84 100644 --- a/src/twadmin/stdtwadmin.h +++ b/src/twadmin/stdtwadmin.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadmin.cpp b/src/twadmin/twadmin.cpp index cb07495..92226e8 100644 --- a/src/twadmin/twadmin.cpp +++ b/src/twadmin/twadmin.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadmin.h b/src/twadmin/twadmin.h index c825f82..cdc129a 100644 --- a/src/twadmin/twadmin.h +++ b/src/twadmin/twadmin.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadmincl.cpp b/src/twadmin/twadmincl.cpp index b4d1ddb..2037aec 100644 --- a/src/twadmin/twadmincl.cpp +++ b/src/twadmin/twadmincl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadmincl.h b/src/twadmin/twadmincl.h index 1278071..520e04f 100644 --- a/src/twadmin/twadmincl.h +++ b/src/twadmin/twadmincl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadminerrors.cpp b/src/twadmin/twadminerrors.cpp index 5c650ad..13e01ba 100644 --- a/src/twadmin/twadminerrors.cpp +++ b/src/twadmin/twadminerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadminerrors.h b/src/twadmin/twadminerrors.h index ead4837..3146364 100644 --- a/src/twadmin/twadminerrors.h +++ b/src/twadmin/twadminerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadminmain.cpp b/src/twadmin/twadminmain.cpp index 696032c..b8f18a0 100644 --- a/src/twadmin/twadminmain.cpp +++ b/src/twadmin/twadminmain.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadminstrings.cpp b/src/twadmin/twadminstrings.cpp index 769dc10..2c3424d 100644 --- a/src/twadmin/twadminstrings.cpp +++ b/src/twadmin/twadminstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadminstrings.h b/src/twadmin/twadminstrings.h index 4acaf26..2314491 100644 --- a/src/twadmin/twadminstrings.h +++ b/src/twadmin/twadminstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/bytequeue.cpp b/src/twcrypto/bytequeue.cpp index accc70b..bf9910e 100644 --- a/src/twcrypto/bytequeue.cpp +++ b/src/twcrypto/bytequeue.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/bytequeue.h b/src/twcrypto/bytequeue.h index 9d1511f..a2582c4 100644 --- a/src/twcrypto/bytequeue.h +++ b/src/twcrypto/bytequeue.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/crypto.cpp b/src/twcrypto/crypto.cpp index a655794..e673cfc 100644 --- a/src/twcrypto/crypto.cpp +++ b/src/twcrypto/crypto.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/crypto.h b/src/twcrypto/crypto.h index 4373fc7..4c3f441 100644 --- a/src/twcrypto/crypto.h +++ b/src/twcrypto/crypto.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/cryptoarchive.cpp b/src/twcrypto/cryptoarchive.cpp index 65ae849..eabfe53 100644 --- a/src/twcrypto/cryptoarchive.cpp +++ b/src/twcrypto/cryptoarchive.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/cryptoarchive.h b/src/twcrypto/cryptoarchive.h index ff443ed..d0bc7ea 100644 --- a/src/twcrypto/cryptoarchive.h +++ b/src/twcrypto/cryptoarchive.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/keyfile.cpp b/src/twcrypto/keyfile.cpp index 12d7767..5a567b4 100644 --- a/src/twcrypto/keyfile.cpp +++ b/src/twcrypto/keyfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/keyfile.h b/src/twcrypto/keyfile.h index df844a0..fda38e1 100644 --- a/src/twcrypto/keyfile.h +++ b/src/twcrypto/keyfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/stdtwcrypto.cpp b/src/twcrypto/stdtwcrypto.cpp index 2361476..bd9b248 100644 --- a/src/twcrypto/stdtwcrypto.cpp +++ b/src/twcrypto/stdtwcrypto.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/stdtwcrypto.h b/src/twcrypto/stdtwcrypto.h index 70e0c55..20ea8cf 100644 --- a/src/twcrypto/stdtwcrypto.h +++ b/src/twcrypto/stdtwcrypto.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/twcrypto.cpp b/src/twcrypto/twcrypto.cpp index 3c7e775..9182f22 100644 --- a/src/twcrypto/twcrypto.cpp +++ b/src/twcrypto/twcrypto.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/twcrypto.h b/src/twcrypto/twcrypto.h index 27fe6e3..775393c 100644 --- a/src/twcrypto/twcrypto.h +++ b/src/twcrypto/twcrypto.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/twcryptoerrors.cpp b/src/twcrypto/twcryptoerrors.cpp index 64cc046..9e7e8ae 100644 --- a/src/twcrypto/twcryptoerrors.cpp +++ b/src/twcrypto/twcryptoerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/twcryptoerrors.h b/src/twcrypto/twcryptoerrors.h index 149b9c3..7d1901f 100644 --- a/src/twcrypto/twcryptoerrors.h +++ b/src/twcrypto/twcryptoerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/genreparseinfo.cpp b/src/twparser/genreparseinfo.cpp index ad64f43..ddcd68d 100644 --- a/src/twparser/genreparseinfo.cpp +++ b/src/twparser/genreparseinfo.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/genreparseinfo.h b/src/twparser/genreparseinfo.h index d47a0dc..eef27f7 100644 --- a/src/twparser/genreparseinfo.h +++ b/src/twparser/genreparseinfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/parserhelper.cpp b/src/twparser/parserhelper.cpp index 155d07b..90df7aa 100644 --- a/src/twparser/parserhelper.cpp +++ b/src/twparser/parserhelper.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/parserhelper.h b/src/twparser/parserhelper.h index 3392414..1d387f9 100644 --- a/src/twparser/parserhelper.h +++ b/src/twparser/parserhelper.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/parserobjects.cpp b/src/twparser/parserobjects.cpp index e29b086..3cdc90d 100644 --- a/src/twparser/parserobjects.cpp +++ b/src/twparser/parserobjects.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/parserobjects.h b/src/twparser/parserobjects.h index 4b52409..577d5f2 100644 --- a/src/twparser/parserobjects.h +++ b/src/twparser/parserobjects.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/policyparser.cpp b/src/twparser/policyparser.cpp index 080c4a4..3a822f7 100644 --- a/src/twparser/policyparser.cpp +++ b/src/twparser/policyparser.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/policyparser.h b/src/twparser/policyparser.h index 85139d1..0a55cdf 100644 --- a/src/twparser/policyparser.h +++ b/src/twparser/policyparser.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/stdtwparser.cpp b/src/twparser/stdtwparser.cpp index 58e5f13..b0c974c 100644 --- a/src/twparser/stdtwparser.cpp +++ b/src/twparser/stdtwparser.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/stdtwparser.h b/src/twparser/stdtwparser.h index 43d8038..7f32269 100644 --- a/src/twparser/stdtwparser.h +++ b/src/twparser/stdtwparser.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparser.cpp b/src/twparser/twparser.cpp index bb73220..ee576bc 100644 --- a/src/twparser/twparser.cpp +++ b/src/twparser/twparser.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparser.h b/src/twparser/twparser.h index 3689471..0241796 100644 --- a/src/twparser/twparser.h +++ b/src/twparser/twparser.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparsererrors.cpp b/src/twparser/twparsererrors.cpp index d3abacc..f53a77b 100644 --- a/src/twparser/twparsererrors.cpp +++ b/src/twparser/twparsererrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparsererrors.h b/src/twparser/twparsererrors.h index 04d2772..484d42d 100644 --- a/src/twparser/twparsererrors.h +++ b/src/twparser/twparsererrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparserstrings.cpp b/src/twparser/twparserstrings.cpp index 94e9bee..95225f1 100644 --- a/src/twparser/twparserstrings.cpp +++ b/src/twparser/twparserstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparserstrings.h b/src/twparser/twparserstrings.h index 57b02f2..372bbd9 100644 --- a/src/twparser/twparserstrings.h +++ b/src/twparser/twparserstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/yylex.cpp b/src/twparser/yylex.cpp index 5356335..7b6cee5 100644 --- a/src/twparser/yylex.cpp +++ b/src/twparser/yylex.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/yylex.h b/src/twparser/yylex.h index fa5e866..82f1600 100644 --- a/src/twparser/yylex.h +++ b/src/twparser/yylex.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/yyparse.cpp b/src/twparser/yyparse.cpp index 9deb903..92fc06b 100644 --- a/src/twparser/yyparse.cpp +++ b/src/twparser/yyparse.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/yyparse.h b/src/twparser/yyparse.h index 6a09190..612b2a7 100644 --- a/src/twparser/yyparse.h +++ b/src/twparser/yyparse.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/resource.h b/src/twprint/resource.h index 8fc8ab8..d0a48bf 100644 --- a/src/twprint/resource.h +++ b/src/twprint/resource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/stdtwprint.cpp b/src/twprint/stdtwprint.cpp index 7f2af88..27cc01c 100644 --- a/src/twprint/stdtwprint.cpp +++ b/src/twprint/stdtwprint.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/stdtwprint.h b/src/twprint/stdtwprint.h index 141f9c1..7f33645 100644 --- a/src/twprint/stdtwprint.h +++ b/src/twprint/stdtwprint.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprint.cpp b/src/twprint/twprint.cpp index 5a0bcd9..79681ca 100644 --- a/src/twprint/twprint.cpp +++ b/src/twprint/twprint.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprint.h b/src/twprint/twprint.h index 635eb91..d20e174 100644 --- a/src/twprint/twprint.h +++ b/src/twprint/twprint.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintcmdline.cpp b/src/twprint/twprintcmdline.cpp index f3a435e..67be754 100644 --- a/src/twprint/twprintcmdline.cpp +++ b/src/twprint/twprintcmdline.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintcmdline.h b/src/twprint/twprintcmdline.h index b75fe4b..ab4e2b7 100644 --- a/src/twprint/twprintcmdline.h +++ b/src/twprint/twprintcmdline.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprinterrors.cpp b/src/twprint/twprinterrors.cpp index 21c0d11..5828a39 100644 --- a/src/twprint/twprinterrors.cpp +++ b/src/twprint/twprinterrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprinterrors.h b/src/twprint/twprinterrors.h index c5b1350..87bcc31 100644 --- a/src/twprint/twprinterrors.h +++ b/src/twprint/twprinterrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintmain.cpp b/src/twprint/twprintmain.cpp index dc04b56..4b4531c 100644 --- a/src/twprint/twprintmain.cpp +++ b/src/twprint/twprintmain.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintstrings.cpp b/src/twprint/twprintstrings.cpp index 1930851..e09d70b 100644 --- a/src/twprint/twprintstrings.cpp +++ b/src/twprint/twprintstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintstrings.h b/src/twprint/twprintstrings.h index f233b02..a739762 100644 --- a/src/twprint/twprintstrings.h +++ b/src/twprint/twprintstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/archive_t.cpp b/src/twtest/archive_t.cpp index 629c0e4..8612c10 100644 --- a/src/twtest/archive_t.cpp +++ b/src/twtest/archive_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/blockfile_t.cpp b/src/twtest/blockfile_t.cpp index 0581f42..87080ef 100644 --- a/src/twtest/blockfile_t.cpp +++ b/src/twtest/blockfile_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/blockrecordarray_t.cpp b/src/twtest/blockrecordarray_t.cpp index c160724..695f9d2 100644 --- a/src/twtest/blockrecordarray_t.cpp +++ b/src/twtest/blockrecordarray_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/charutil_t.cpp b/src/twtest/charutil_t.cpp index ff6872c..16f73e0 100644 --- a/src/twtest/charutil_t.cpp +++ b/src/twtest/charutil_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/cmdlineparser_t.cpp b/src/twtest/cmdlineparser_t.cpp index c0b55a8..85d830f 100644 --- a/src/twtest/cmdlineparser_t.cpp +++ b/src/twtest/cmdlineparser_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/codeconvert_t.cpp b/src/twtest/codeconvert_t.cpp index 6d1def4..0ba3bda 100644 --- a/src/twtest/codeconvert_t.cpp +++ b/src/twtest/codeconvert_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/configfile_t.cpp b/src/twtest/configfile_t.cpp index 7ae3b8b..840f550 100644 --- a/src/twtest/configfile_t.cpp +++ b/src/twtest/configfile_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/cryptoarchive_t.cpp b/src/twtest/cryptoarchive_t.cpp index 97e80c9..9cb5504 100644 --- a/src/twtest/cryptoarchive_t.cpp +++ b/src/twtest/cryptoarchive_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/crytpo_t.cpp b/src/twtest/crytpo_t.cpp index 5777579..cf4c565 100644 --- a/src/twtest/crytpo_t.cpp +++ b/src/twtest/crytpo_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/dbdatasource_t.cpp b/src/twtest/dbdatasource_t.cpp index 6c035b1..65fd696 100644 --- a/src/twtest/dbdatasource_t.cpp +++ b/src/twtest/dbdatasource_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/debug_t.cpp b/src/twtest/debug_t.cpp index f5266e6..6ec8832 100644 --- a/src/twtest/debug_t.cpp +++ b/src/twtest/debug_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/displayencoder_t.cpp b/src/twtest/displayencoder_t.cpp index cd31847..ffcf97d 100644 --- a/src/twtest/displayencoder_t.cpp +++ b/src/twtest/displayencoder_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/error_t.cpp b/src/twtest/error_t.cpp index 1519fcd..4ab7e35 100644 --- a/src/twtest/error_t.cpp +++ b/src/twtest/error_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/errorbucketimpl_t.cpp b/src/twtest/errorbucketimpl_t.cpp index 1a7d96a..2a677c2 100644 --- a/src/twtest/errorbucketimpl_t.cpp +++ b/src/twtest/errorbucketimpl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcocompare_t.cpp b/src/twtest/fcocompare_t.cpp index 52659c3..0ebedda 100644 --- a/src/twtest/fcocompare_t.cpp +++ b/src/twtest/fcocompare_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcodatabasefile_t.cpp b/src/twtest/fcodatabasefile_t.cpp index 829582a..e5977cb 100644 --- a/src/twtest/fcodatabasefile_t.cpp +++ b/src/twtest/fcodatabasefile_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fconame_t.cpp b/src/twtest/fconame_t.cpp index 49e98ef..4be3a5b 100644 --- a/src/twtest/fconame_t.cpp +++ b/src/twtest/fconame_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fconametbl_t.cpp b/src/twtest/fconametbl_t.cpp index a5ed4b2..b1bba5f 100644 --- a/src/twtest/fconametbl_t.cpp +++ b/src/twtest/fconametbl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fconametranslator_t.cpp b/src/twtest/fconametranslator_t.cpp index 878e0e5..2a32416 100644 --- a/src/twtest/fconametranslator_t.cpp +++ b/src/twtest/fconametranslator_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcopropimpl_t.cpp b/src/twtest/fcopropimpl_t.cpp index 11179c5..8cda935 100644 --- a/src/twtest/fcopropimpl_t.cpp +++ b/src/twtest/fcopropimpl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcopropvector_t.cpp b/src/twtest/fcopropvector_t.cpp index e953a87..00f19eb 100644 --- a/src/twtest/fcopropvector_t.cpp +++ b/src/twtest/fcopropvector_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcoreport_t.cpp b/src/twtest/fcoreport_t.cpp index 960c80d..94c3e45 100644 --- a/src/twtest/fcoreport_t.cpp +++ b/src/twtest/fcoreport_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcosetimpl_t.cpp b/src/twtest/fcosetimpl_t.cpp index ff81058..1cfc034 100644 --- a/src/twtest/fcosetimpl_t.cpp +++ b/src/twtest/fcosetimpl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospec_t.cpp b/src/twtest/fcospec_t.cpp index d773a6f..251f4e5 100644 --- a/src/twtest/fcospec_t.cpp +++ b/src/twtest/fcospec_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospecattr_t.cpp b/src/twtest/fcospecattr_t.cpp index 0979dee..19e3683 100644 --- a/src/twtest/fcospecattr_t.cpp +++ b/src/twtest/fcospecattr_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospechelper_t.cpp b/src/twtest/fcospechelper_t.cpp index 409f06f..30ba8ce 100644 --- a/src/twtest/fcospechelper_t.cpp +++ b/src/twtest/fcospechelper_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospeclist_t.cpp b/src/twtest/fcospeclist_t.cpp index 8eac699..8f06705 100644 --- a/src/twtest/fcospeclist_t.cpp +++ b/src/twtest/fcospeclist_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospecutil_t.cpp b/src/twtest/fcospecutil_t.cpp index af17b87..19979a7 100644 --- a/src/twtest/fcospecutil_t.cpp +++ b/src/twtest/fcospecutil_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/file_t.cpp b/src/twtest/file_t.cpp index 8f0f16d..ff38d59 100644 --- a/src/twtest/file_t.cpp +++ b/src/twtest/file_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fileheader_t.cpp b/src/twtest/fileheader_t.cpp index c561cb2..b2d0160 100644 --- a/src/twtest/fileheader_t.cpp +++ b/src/twtest/fileheader_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fileutil_t.cpp b/src/twtest/fileutil_t.cpp index 50a98c5..3f132f6 100644 --- a/src/twtest/fileutil_t.cpp +++ b/src/twtest/fileutil_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fsdatasourceiter_t.cpp b/src/twtest/fsdatasourceiter_t.cpp index 7eb57d7..df6e8cb 100644 --- a/src/twtest/fsdatasourceiter_t.cpp +++ b/src/twtest/fsdatasourceiter_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fsobject_t.cpp b/src/twtest/fsobject_t.cpp index bc17e42..031a409 100644 --- a/src/twtest/fsobject_t.cpp +++ b/src/twtest/fsobject_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fspropcalc_t.cpp b/src/twtest/fspropcalc_t.cpp index 33df796..be8d838 100644 --- a/src/twtest/fspropcalc_t.cpp +++ b/src/twtest/fspropcalc_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fspropdisplayer_t.cpp b/src/twtest/fspropdisplayer_t.cpp index 9fa1b56..770fdf6 100644 --- a/src/twtest/fspropdisplayer_t.cpp +++ b/src/twtest/fspropdisplayer_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fspropset_t.cpp b/src/twtest/fspropset_t.cpp index 8818f66..269b447 100644 --- a/src/twtest/fspropset_t.cpp +++ b/src/twtest/fspropset_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fsspec_t.cpp b/src/twtest/fsspec_t.cpp index cc6586d..26b2aae 100644 --- a/src/twtest/fsspec_t.cpp +++ b/src/twtest/fsspec_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/genre_t.cpp b/src/twtest/genre_t.cpp index 666ab10..2f425d8 100644 --- a/src/twtest/genre_t.cpp +++ b/src/twtest/genre_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/genrespeclist_t.cpp b/src/twtest/genrespeclist_t.cpp index 3e569dc..9109d24 100644 --- a/src/twtest/genrespeclist_t.cpp +++ b/src/twtest/genrespeclist_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/genreswitcher_t.cpp b/src/twtest/genreswitcher_t.cpp index 3e898c3..d378b1e 100644 --- a/src/twtest/genreswitcher_t.cpp +++ b/src/twtest/genreswitcher_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/growheap_t.cpp b/src/twtest/growheap_t.cpp index 8178eab..8fb6f99 100644 --- a/src/twtest/growheap_t.cpp +++ b/src/twtest/growheap_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/hashtable_t.cpp b/src/twtest/hashtable_t.cpp index f5ef5cb..96ea4d8 100644 --- a/src/twtest/hashtable_t.cpp +++ b/src/twtest/hashtable_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/hierdatabase_t.cpp b/src/twtest/hierdatabase_t.cpp index c6f5d2b..e18a8cf 100644 --- a/src/twtest/hierdatabase_t.cpp +++ b/src/twtest/hierdatabase_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/keyfile_t.cpp b/src/twtest/keyfile_t.cpp index fa6f79d..a2f7690 100644 --- a/src/twtest/keyfile_t.cpp +++ b/src/twtest/keyfile_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index bd40342..a037a22 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/policyparser_t.cpp b/src/twtest/policyparser_t.cpp index 8a5c3c5..1ab6150 100644 --- a/src/twtest/policyparser_t.cpp +++ b/src/twtest/policyparser_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/refcountobj_t.cpp b/src/twtest/refcountobj_t.cpp index 4d81267..14154f0 100644 --- a/src/twtest/refcountobj_t.cpp +++ b/src/twtest/refcountobj_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/resources_t.cpp b/src/twtest/resources_t.cpp index 652f75a..52b37ec 100644 --- a/src/twtest/resources_t.cpp +++ b/src/twtest/resources_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/serializer_t.cpp b/src/twtest/serializer_t.cpp index abd10d1..ab4cd21 100644 --- a/src/twtest/serializer_t.cpp +++ b/src/twtest/serializer_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/serializerimpl_t.cpp b/src/twtest/serializerimpl_t.cpp index b461c6f..9d8681c 100644 --- a/src/twtest/serializerimpl_t.cpp +++ b/src/twtest/serializerimpl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/signature_t.cpp b/src/twtest/signature_t.cpp index a02a2ec..fab1acc 100644 --- a/src/twtest/signature_t.cpp +++ b/src/twtest/signature_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/srefcountobj_t.cpp b/src/twtest/srefcountobj_t.cpp index 606fa7b..e12a486 100644 --- a/src/twtest/srefcountobj_t.cpp +++ b/src/twtest/srefcountobj_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/stdtest.cpp b/src/twtest/stdtest.cpp index 3c34d0f..3287586 100644 --- a/src/twtest/stdtest.cpp +++ b/src/twtest/stdtest.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/stdtest.h b/src/twtest/stdtest.h index 291a3fc..3fd6dc5 100644 --- a/src/twtest/stdtest.h +++ b/src/twtest/stdtest.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/stringencoder_t.cpp b/src/twtest/stringencoder_t.cpp index 646ca31..77fea63 100644 --- a/src/twtest/stringencoder_t.cpp +++ b/src/twtest/stringencoder_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/stringutil_t.h b/src/twtest/stringutil_t.h index 12a5bdf..4ed2875 100644 --- a/src/twtest/stringutil_t.h +++ b/src/twtest/stringutil_t.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/tasktimer_t.cpp b/src/twtest/tasktimer_t.cpp index 2770e28..7f7c070 100644 --- a/src/twtest/tasktimer_t.cpp +++ b/src/twtest/tasktimer_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/tchar_t.cpp b/src/twtest/tchar_t.cpp index 9d1e0a5..b7e9485 100644 --- a/src/twtest/tchar_t.cpp +++ b/src/twtest/tchar_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index 54ec169..9a876f6 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/test.h b/src/twtest/test.h index d465124..9ee2824 100644 --- a/src/twtest/test.h +++ b/src/twtest/test.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/textreportviewer_t.cpp b/src/twtest/textreportviewer_t.cpp index 731969c..94e7f4b 100644 --- a/src/twtest/textreportviewer_t.cpp +++ b/src/twtest/textreportviewer_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/twlocale_t.cpp b/src/twtest/twlocale_t.cpp index c1ad872..3bb4df0 100644 --- a/src/twtest/twlocale_t.cpp +++ b/src/twtest/twlocale_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/twutil_t.cpp b/src/twtest/twutil_t.cpp index 71b124f..fe38d53 100644 --- a/src/twtest/twutil_t.cpp +++ b/src/twtest/twutil_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/types_t.cpp b/src/twtest/types_t.cpp index 22f578c..de1d18e 100644 --- a/src/twtest/types_t.cpp +++ b/src/twtest/types_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index bc45de2..1334b92 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/usernotifystdout_t.cpp b/src/twtest/usernotifystdout_t.cpp index edcbffc..43f16a8 100644 --- a/src/twtest/usernotifystdout_t.cpp +++ b/src/twtest/usernotifystdout_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/wchar16_t.cpp b/src/twtest/wchar16_t.cpp index 2107a54..83ad7b7 100644 --- a/src/twtest/wchar16_t.cpp +++ b/src/twtest/wchar16_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/fileutil.cpp b/src/util/fileutil.cpp index 69dd3a6..c608d55 100644 --- a/src/util/fileutil.cpp +++ b/src/util/fileutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/fileutil.h b/src/util/fileutil.h index f0591fc..7e87198 100644 --- a/src/util/fileutil.h +++ b/src/util/fileutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/miscutil.h b/src/util/miscutil.h index dd1f69d..14a71cf 100644 --- a/src/util/miscutil.h +++ b/src/util/miscutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/stdutil.cpp b/src/util/stdutil.cpp index 16814c9..2a32898 100644 --- a/src/util/stdutil.cpp +++ b/src/util/stdutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/stdutil.h b/src/util/stdutil.h index 2189466..0b29950 100644 --- a/src/util/stdutil.h +++ b/src/util/stdutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/stringencoder.cpp b/src/util/stringencoder.cpp index d2bcf4f..354872a 100644 --- a/src/util/stringencoder.cpp +++ b/src/util/stringencoder.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/stringencoder.h b/src/util/stringencoder.h index 6eb419c..0060c84 100644 --- a/src/util/stringencoder.h +++ b/src/util/stringencoder.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/util.cpp b/src/util/util.cpp index d893ecc..a8d3c90 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/util.h b/src/util/util.h index 20adbdd..203d949 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/utilerrors.cpp b/src/util/utilerrors.cpp index 0427df2..6625035 100644 --- a/src/util/utilerrors.cpp +++ b/src/util/utilerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/utilerrors.h b/src/util/utilerrors.h index 10aa2c6..049c6af 100644 --- a/src/util/utilerrors.h +++ b/src/util/utilerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/utilstrings.cpp b/src/util/utilstrings.cpp index a548870..2b90759 100644 --- a/src/util/utilstrings.cpp +++ b/src/util/utilstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/utilstrings.h b/src/util/utilstrings.h index 0e37e21..994cd2c 100644 --- a/src/util/utilstrings.h +++ b/src/util/utilstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // From 54b3b6a2c237c9a48a7f0470b324dfdbaed2a182 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Tue, 25 Apr 2017 18:52:26 -0700 Subject: [PATCH 010/110] Fix a few more copyright years --- policy/policyguide.txt | 2 +- policy/twpol-FreeBSD.txt | 2 +- policy/twpol-GENERIC.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/policy/policyguide.txt b/policy/policyguide.txt index 09bf2e9..526ddaa 100644 --- a/policy/policyguide.txt +++ b/policy/policyguide.txt @@ -191,7 +191,7 @@ $(DIR1) -> $(param1); # It is also possible to do a #============================================================================= # -# Copyright 2000 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. All rights reserved. # # Linux is a registered trademark of Linus Torvalds. diff --git a/policy/twpol-FreeBSD.txt b/policy/twpol-FreeBSD.txt index 351a320..bae94fb 100644 --- a/policy/twpol-FreeBSD.txt +++ b/policy/twpol-FreeBSD.txt @@ -629,7 +629,7 @@ SIG_HI = 100 ; # Critical files that are significant point #============================================================================= # -# Copyright 2000 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. in the United States and other countries. All rights reserved. # # FreeBSD is a registered trademark of the FreeBSD Project Inc. diff --git a/policy/twpol-GENERIC.txt b/policy/twpol-GENERIC.txt index e30ae4c..114028e 100644 --- a/policy/twpol-GENERIC.txt +++ b/policy/twpol-GENERIC.txt @@ -1078,7 +1078,7 @@ SIG_HI = 100 ; # Critical files that are significant point #============================================================================= # -# Copyright 2000 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. in the United States and other countries. All rights reserved. # # Linux is a registered trademark of Linus Torvalds. From 1ffe02226b26ef8b195630894cbc1f4167cc2d4f Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 22 Jun 2017 17:45:41 -0700 Subject: [PATCH 011/110] Bump version to 2.4.3.6 --- configure | 22 +++++++++++----------- configure.ac | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 94fc336..352f5e4 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.ac Revision: 2.4.3.5 . +# From configure.ac Revision: 2.4.3.6 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for tripwire 2.4.3.5. +# Generated by GNU Autoconf 2.69 for tripwire 2.4.3.6. # # Report bugs to . # @@ -584,8 +584,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tripwire' PACKAGE_TARNAME='tripwire' -PACKAGE_VERSION='2.4.3.5' -PACKAGE_STRING='tripwire 2.4.3.5' +PACKAGE_VERSION='2.4.3.6' +PACKAGE_STRING='tripwire 2.4.3.6' PACKAGE_BUGREPORT='https://github.com/Tripwire/tripwire-open-source/issues' PACKAGE_URL='https://github.com/Tripwire/tripwire-open-source' @@ -1322,7 +1322,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tripwire 2.4.3.5 to adapt to many kinds of systems. +\`configure' configures tripwire 2.4.3.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1394,7 +1394,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tripwire 2.4.3.5:";; + short | recursive ) echo "Configuration of tripwire 2.4.3.6:";; esac cat <<\_ACEOF @@ -1506,7 +1506,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tripwire configure 2.4.3.5 +tripwire configure 2.4.3.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2393,7 +2393,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tripwire $as_me 2.4.3.5, which was +It was created by tripwire $as_me 2.4.3.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3367,7 +3367,7 @@ fi # Define the identity of the package. PACKAGE='tripwire' - VERSION='2.4.3.5' + VERSION='2.4.3.6' cat >>confdefs.h <<_ACEOF @@ -7646,7 +7646,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by tripwire $as_me 2.4.3.5, which was +This file was extended by tripwire $as_me 2.4.3.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7713,7 +7713,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -tripwire config.status 2.4.3.5 +tripwire config.status 2.4.3.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index fe49c0b..6678a78 100644 --- a/configure.ac +++ b/configure.ac @@ -2,14 +2,14 @@ dnl Process this file with autoconf to produce a configure script. dnl dnl -AC_INIT([tripwire], [2.4.3.5], [https://github.com/Tripwire/tripwire-open-source/issues], [tripwire], [https://github.com/Tripwire/tripwire-open-source]) +AC_INIT([tripwire], [2.4.3.6], [https://github.com/Tripwire/tripwire-open-source/issues], [tripwire], [https://github.com/Tripwire/tripwire-open-source]) AC_CONFIG_SRCDIR([src/tw/tw.cpp]) AC_CANONICAL_TARGET([]) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) AC_COPYRIGHT([The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.]) -AC_REVISION([$Revision: 2.4.3.5 $]) +AC_REVISION([$Revision: 2.4.3.6 $]) dnl ############### dnl Setup defaults From 60b24b02011b37f6e287838e816532b940e5001f Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 24 Jun 2017 10:57:18 -0700 Subject: [PATCH 012/110] Add a test-harness test for policy updates, & tidy up some existing test code --- src/test-harness/tests/dbupdate.pm | 2 +- src/test-harness/tests/polupdate.pm | 299 ++++++++++++++++++++++++++++ src/test-harness/twtools.pm | 54 +++-- 3 files changed, 341 insertions(+), 14 deletions(-) create mode 100644 src/test-harness/tests/polupdate.pm diff --git a/src/test-harness/tests/dbupdate.pm b/src/test-harness/tests/dbupdate.pm index 9d7a228..51746d6 100644 --- a/src/test-harness/tests/dbupdate.pm +++ b/src/test-harness/tests/dbupdate.pm @@ -177,7 +177,7 @@ sub RunBasicTest if( $n != 0 ) { - twtools("FAILED -- violations after update\n"); + twtools::logStatus("FAILED -- violations after update\n"); return 0; } diff --git a/src/test-harness/tests/polupdate.pm b/src/test-harness/tests/polupdate.pm new file mode 100644 index 0000000..1b95b4c --- /dev/null +++ b/src/test-harness/tests/polupdate.pm @@ -0,0 +1,299 @@ + +use twtools; + +package polupdate; + + +###################################################################### +# One time module initialization goes in here... +# +BEGIN +{ + # This is the root directory we will be integrity checking + # + $root1 = "$twtools::twcwd/$twtools::twrootdir/polupdate-test-1"; + $root2 = "$twtools::twcwd/$twtools::twrootdir/polupdate-test-2"; + $root3 = "$twtools::twcwd/$twtools::twrootdir/polupdate-test-3"; + + # Here are the names of the report files this test will create + # + $report1 = "$twtools::twcwd/$twtools::twrootdir/report/polupdate-1.twr"; + $report2 = "$twtools::twcwd/$twtools::twrootdir/report/polupdate-2.twr"; + $report3 = "$twtools::twcwd/$twtools::twrootdir/report/polupdate-3.twr"; + $report4 = "$twtools::twcwd/$twtools::twrootdir/report/polupdate-4.twr"; +} + +###################################################################### +# PolicyFileString -- return the policy text as a string +# +sub PolicyFileString +{ + return < \$(ReadOnly)+M; #read only plus MD5 + $root2 -> \$(ReadOnly)+M; #read only plus MD5 + +POLICY_END + +} + +###################################################################### +# PolicyFileStringNew -- return the policy text as a string +# +sub PolicyFileStringNew +{ + return < \$(ReadOnly)+S; #read only plus SHA1 + $root3 -> \$(ReadOnly)+S; #read only plus SHA1 + +POLICY_END + +} + +###################################################################### +# CreateFile -- create a file with the specified contents +# +# input: path -- path to the file; relative to $root +# contents -- string to put in the file +# +sub CreateFile +{ + my ($path, $contents) = @_; + + system( "echo $contents > $root/$path" ); + + $? && die "Create file failed for $root/$path\n"; +} + +###################################################################### +# RemoveFile -- removes the named file +# +sub RemoveFile +{ + my ($path) = @_; + + if( -e "$root/$path" ) + { + system( "rm -f $root/$path" ); + } + + $? && die "Remove file failed for $root/$path\n"; +} + + +###################################################################### +# CreateDir -- create a directory +# +sub CreateDir +{ + my($dir) = @_; + + # NOTE: mkdir fails if it is already a directory! + # + if( ! -d "$dir" ) + { + system( "rm -f $dir" ); + system( "mkdir -p $dir" ); + + $? && die "Mkdir failed for $dir\n"; + } +} + +###################################################################### +# MoveFile -- move a file from one place to another +# NOTE: file names are relative to $root +# +# input: old_name -- name of file to move +# new_name -- where it should be moved to +# +sub MoveFile +{ + my($old, $new) = @_; + + system( "mv $old $new" ); + $? && die "mv $old $new failed!\n"; +} + +###################################################################### +# PrintDatabase +# +sub PrintDatabase +{ + system( "$twtools::twrootdir/bin/twprint -m d -c $twtools::twrootdir/tw.cfg" ); +} + +###################################################################### +# PrintReport +# +sub PrintReport +{ + my ($report) = @_; + system( "$twtools::twrootdir/bin/twprint -m r -c $twtools::twrootdir/tw.cfg -r $report" ); +} + +###################################################################### +# PrepareForTest -- creates the files that each test will be +# integrity checking and initializes the database. +# +sub PrepareForTest +{ + # make sure we are cleaned up... + # + cleanup(); + + # Make the files we will be using... + # + CreateDir ( "$root1/sub" ); + CreateFile( "$root1/sub/hello.txt", "hello world one" ); + + CreateDir ( "$root2/sub" ); + CreateFile( "$root2/sub/hello.txt", "hello world two" ); + + CreateDir ( "$root3/sub" ); + CreateFile( "$root3/sub/hello.txt", "hello world three" ); + + # Initialize the database + # + twtools::InitializeDatabase(); +} + +###################################################################### +# RunBasicTest -- performs a rudimentary UpdateDatabase test +# +sub RunBasicTest +{ + printf("%-30s", "-- polupdate.basic test"); + + PrepareForTest(); + + twtools::WritePolicyFile( PolicyFileStringNew() ); + if( ! twtools::UpdatePolicy() ) + { + twtools::logStatus("FAILED -- update policy returned nonzero\n"); + return 0; + } + + # do another IC and make sure there are no violations + # + twtools::RunIntegrityCheck(); + + ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( $n != 0 ) + { + twtools::logStatus("FAILED -- violations after update\n"); + return 0; + } + + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; +} + +###################################################################### +# RunSecureModeTest -- performs a rudimentary UpdateDatabase test +# +sub RunSecureModeTest +{ + printf("%-30s", "-- polupdate.secure-mode test"); + + PrepareForTest(); + + twtools::WritePolicyFile( PolicyFileStringNew() ); + if( ! twtools::UpdatePolicy({ secure-mode => "high" } )) + { + twtools::logStatus("FAILED -- update policy returned nonzero\n"); + return 0; + } + + # do another IC and make sure there are no violations + # + twtools::RunIntegrityCheck(); + + ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( $n != 0 ) + { + twtools::logStatus("FAILED -- violations after update\n"); + return 0; + } + + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; +} + + +###################################################################### +# +# Initialize the test +# + +sub initialize +{ + # Make the policy file + # + twtools::GeneratePolicyFile( PolicyFileString() ); + return 1; +} + + +###################################################################### +# +# Run the test. +# +sub run +{ + eval { + RunBasicTest(); + } or do { + my $e = $@; + twtools::logStatus("Exception in Polupdate RunBasicTest: $e\n"); + ++$twtools::twfailedtests; + print "*FAILED*\n"; + }; + + # bump the total test count since this file's a twofer + ++$twtools::twtotaltests; + + eval { + RunSecureModeTest(); + } or do { + my $e = $@; + twtools::logStatus("Exception in Polupdate RunSecureModeTest: $e\n"); + ++$twtools::twfailedtests; + print "*FAILED*\n"; + }; +} + +sub cleanup +{ + # remove all of the files we were integrity checking... + # + system( "rm -rf $root1/*" ); + system( "rm -rf $root2/*" ); + system( "rm -rf $root3/*" ); + $? && print "WARNING: polupdate cleanup failed.\n"; + + # remove the report files we created... + # + system( "rm -f $report1" ) if (-e $report1); + system( "rm -r $report2" ) if (-e $report2); + system( "rm -r $report3" ) if (-e $report3); + system( "rm -r $report4" ) if (-e $report4); + +} + + +###################################################################### +# One time module cleanup goes in here... +# +END +{ +} + +1; + diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 8a904df..2c50a3a 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -17,7 +17,9 @@ BEGIN { $twsitekeyloc = "key/site.key"; $twlocalkeyloc = "key/local.key"; $twpolicyloc = "policy/twpol.txt"; + $twpolfileloc = "policy/tw.pol"; $twcfgloc = "tw.cfg"; + $twsitepass = "testing"; $twlocalpass = "testing"; @@ -35,7 +37,7 @@ BEGIN { %twcfgdirs = ( ROOT => '', - POLFILE => 'policy/tw.pol', + POLFILE => $twpolfileloc, DBFILE => 'db/$(HOSTNAME).twd', REPORTFILE => 'report/$(HOSTNAME)-$(DATE).twr', SITEKEYFILE => $twsitekeyloc, @@ -158,15 +160,29 @@ sub GenerateKeys { # sub SignConfigFile { - if (!-e "$twrootdir/tw.cfg") { + if (!-e "$twrootdir/$twcfgloc") { print "signing configuration file...\n" if $verbose; - logStatus(`$twrootdir/bin/twadmin -m F -Q $twsitepass -c $twrootdir/tw.cfg -S $twrootdir/$twsitekeyloc $twrootdir/twcfg.txt`); + logStatus(`$twrootdir/bin/twadmin -m F -Q $twsitepass -c $twrootdir/$twcfgloc -S $twrootdir/$twsitekeyloc $twrootdir/twcfg.txt`); } return ($? == 0); } +###################################################################### +# Write policy text to disk... Note the contents +# of the policy file are passed in as '$twstr'. +# +sub WritePolicyFile { + + my ($twstr) = @_; + + open(FH, ">$twrootdir/$twpolicyloc") || warn $!; + print FH $twstr; + close(FH); +} + + ###################################################################### # Generate and sign the policy file... Note the contents # of the policy file are passed in as '$twstr'. @@ -175,13 +191,11 @@ sub GeneratePolicyFile { my ($twstr) = @_; - open(FH, ">$twrootdir/$twpolicyloc") || warn $!; - print FH $twstr; - close(FH); + WritePolicyFile($twstr); print "generating policy file...\n" if $verbose; - logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/tw.cfg -Q $twsitepass -p $twrootdir/policy/tw.pol $twrootdir/policy/twpol.txt`); + logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc`); return ($? == 0); } @@ -195,14 +209,14 @@ sub InitializeDatabase { my ($twmsg) = @_; print "initializing database for '$twmsg' test...\n" if $verbose; - logStatus(`$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/policy/tw.pol -c $twrootdir/tw.cfg 2>&1`); + logStatus(`$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`); return ($? == 0); } ###################################################################### -# Run tripwire to initialize the database... +# Run tripwire to update the database... # sub UpdateDatabase { @@ -211,11 +225,25 @@ sub UpdateDatabase { $params{'secure-mode'} = "low" if( ! defined($params{'secure-mode'}) ); print "updating database for '$twmsg' test...\n" if $verbose; - logStatus(`$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{'secure-mode'} -p $twrootdir/policy/tw.pol -c $twrootdir/tw.cfg -r $params{'report'} 2>&1`); + logStatus(`$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{'secure-mode'} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc -r $params{'report'} 2>&1`); return ($? == 0); } +###################################################################### +# Run tripwire to update the policy... +# +sub UpdatePolicy { + + my (%params) = %{$_[0]}; + $params{'secure-mode'} = "low" if( ! defined($params{'secure-mode'}) ); + + print "updating policy for '$twmsg' test...\n" if $verbose; + logStatus(`$twrootdir/bin/tripwire -m p -P $twsitepass -Q $twlocalpass -Z $params{'secure-mode'} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc $twrootdir/$twpolicyloc 2>&1`); + + return ($? == 0); +} + ###################################################################### # Use twprint to get a report level 0 report and return @@ -226,7 +254,7 @@ sub RunReport(%) { my (%params) = %{$_[0]}; $params{report} = $reportloc if( ! defined($params{report}) ); - my (@out) = `$twrootdir/bin/twprint -m r -c $twrootdir/tw.cfg -t 0 -r $params{report}`; + my (@out) = `$twrootdir/bin/twprint -m r -c $twrootdir/$twcfgloc -t 0 -r $params{report}`; logStatus(@out); @@ -240,7 +268,7 @@ sub RunReport(%) { # sub RunEmailTest { - my (@out) = `$twrootdir/bin/tripwire --test -c $twrootdir/tw.cfg --email elvis\@mars`; + my (@out) = `$twrootdir/bin/tripwire --test -c $twrootdir/$twcfgloc --email elvis\@mars`; logStatus(@out); @@ -258,7 +286,7 @@ sub RunIntegrityCheck { $params{report} = $reportloc if( ! defined($params{report}) ); print("running integrity check for test '$twmsg'...\n") if $verbose; - logStatus(`$twrootdir/bin/tripwire -m c -r $params{report} -p $twrootdir/policy/tw.pol -c $twrootdir/tw.cfg 2>&1`); + logStatus(`$twrootdir/bin/tripwire -m c -r $params{report} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`); return ($? & 8); } From 73a8f0e59b27f136d1d60bf73d786a7e745dfbbe Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 25 Jun 2017 14:48:56 -0700 Subject: [PATCH 013/110] Add a test-harness that does a happy path thru the twadmin file crypto modes. --- src/test-harness/tests/crypto.pm | 108 ++++++++++++++++++++++++++++ src/test-harness/tests/dbupdate.pm | 2 + src/test-harness/tests/polupdate.pm | 2 + src/test-harness/twtools.pm | 45 +++++++++++- 4 files changed, 155 insertions(+), 2 deletions(-) create mode 100644 src/test-harness/tests/crypto.pm diff --git a/src/test-harness/tests/crypto.pm b/src/test-harness/tests/crypto.pm new file mode 100644 index 0000000..795f078 --- /dev/null +++ b/src/test-harness/tests/crypto.pm @@ -0,0 +1,108 @@ + +use twtools; + +package crypto; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + $description = "file crypto test"; +} + + +###################################################################### +# PolicyFileString -- return the policy text as a string +# +sub PolicyFileString +{ + return < +M; #read only plus MD5 + +POLICY_END + +} + + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { + + my $twstr = PolicyFileString(); + twtools::GeneratePolicyFile($twstr); + +} + + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + my $testpath = "$twtools::twrootdir/$twtools::twpolfileloc"; + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + if ( ! twtools::ExamineEncryption("$testpath")) + { + twtools::logStatus("first examine encryption failed\n"); + $twpassed = 0; + } + + twtools::logStatus("testing file crypto removal...\n"); + if ( !twtools::RemoveEncryption("$testpath")) + { + twtools::logStatus("remove encryption failed\n"); + $twpassed = 0; + } + + if ( ! twtools::ExamineEncryption("$testpath")) + { + twtools::logStatus("second examine encryption failed\n"); + $twpassed = 0; + } + + twtools::logStatus("testing file crypto...\n"); + if ( ! twtools::AddEncryption("$testpath")) + { + twtools::logStatus("add encryption failed\n"); + $twpassed = 0; + } + + if ( ! twtools::ExamineEncryption("$testpath")) + { + twtools::logStatus("third examine encryption failed\n"); + $twpassed = 0; + } + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + return 0; + } +} + + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1; diff --git a/src/test-harness/tests/dbupdate.pm b/src/test-harness/tests/dbupdate.pm index 51746d6..22efe5c 100644 --- a/src/test-harness/tests/dbupdate.pm +++ b/src/test-harness/tests/dbupdate.pm @@ -142,6 +142,7 @@ sub PrepareForTest # sub RunBasicTest { + twtools::logStatus("*** Beginning dbupdate.basic test\n"); printf("%-30s", "-- dbupdate.basic test"); PrepareForTest(); @@ -191,6 +192,7 @@ sub RunBasicTest # sub RunSecureModeTest { + twtools::logStatus("*** Beginning dbupdate.secure-mode test\n"); printf("%-30s", "-- dbupdate.secure-mode test"); ++$twtools::twskippedtests; diff --git a/src/test-harness/tests/polupdate.pm b/src/test-harness/tests/polupdate.pm index 1b95b4c..4f701a1 100644 --- a/src/test-harness/tests/polupdate.pm +++ b/src/test-harness/tests/polupdate.pm @@ -165,6 +165,7 @@ sub PrepareForTest # sub RunBasicTest { + twtools::logStatus("*** Beginning polupdate.basic test\n"); printf("%-30s", "-- polupdate.basic test"); PrepareForTest(); @@ -198,6 +199,7 @@ sub RunBasicTest # sub RunSecureModeTest { + twtools::logStatus("*** Beginning polupdate.secure-mode test\n"); printf("%-30s", "-- polupdate.secure-mode test"); PrepareForTest(); diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 2c50a3a..0959290 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -169,6 +169,47 @@ sub SignConfigFile { } +###################################################################### +# Examine encryption +# +sub ExamineEncryption { + + my ($filename) = @_; + + logStatus(`$twrootdir/bin/twadmin -m e -c $twrootdir/$twcfgloc $filename`); + + return ($? == 0); +} + + +###################################################################### +# Add encryption +# +sub AddEncryption { + + my ($filename) = @_; + logStatus "addding crypt to file...\n"; + logStatus(`$twrootdir/bin/twadmin -m E -c $twrootdir/$twcfgloc -P $twlocalpass -Q $twsitepass $filename`); + + return ($? == 0); +} + + +###################################################################### +# Remove encryption +# + +sub RemoveEncryption { + + my ($filename) = @_; + + logStatus "removing crypto from file...\n"; + logStatus(`$twrootdir/bin/twadmin -m R -c $twrootdir/$twcfgloc -P $twlocalpass -Q $twsitepass $filename`); + + return ($? == 0); +} + + ###################################################################### # Write policy text to disk... Note the contents # of the policy file are passed in as '$twstr'. @@ -197,7 +238,7 @@ sub GeneratePolicyFile { logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc`); - return ($? == 0); + return ($? == 0); } @@ -211,7 +252,7 @@ sub InitializeDatabase { print "initializing database for '$twmsg' test...\n" if $verbose; logStatus(`$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`); - return ($? == 0); + return ($? == 0); } From 4176c1db12ffc7e9d98eff1f3b8b8278c229e508 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 28 Jun 2017 20:05:52 -0700 Subject: [PATCH 014/110] Add a new test-harness test to exercise twadmin change-passphrases mode --- src/test-harness/tests/chpass.pm | 84 ++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/test-harness/tests/chpass.pm diff --git a/src/test-harness/tests/chpass.pm b/src/test-harness/tests/chpass.pm new file mode 100644 index 0000000..3e201f2 --- /dev/null +++ b/src/test-harness/tests/chpass.pm @@ -0,0 +1,84 @@ + +use twtools; + +package chpass; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + $description = "change passphrases test"; +} + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { + +} + + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + my $newpass = "password"; + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases -S $twtools::twrootdir/$twtools::twsitekeyloc --site-passphrase $newpass --site-passphrase-old $twtools::twsitepass`); + if ( $? != 0 ) { + twtools::logStatus("first change site passphrase failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases -S $twtools::twrootdir/$twtools::twsitekeyloc --site-passphrase $twtools::twsitepass --site-passphrase-old $newpass`); + if ( $? != 0 ) { + twtools::logStatus("second change site passphrase failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases -L $twtools::twrootdir/$twtools::twlocalkeyloc --local-passphrase $newpass --local-passphrase-old $twtools::twlocalpass`); + if ( $? != 0 ) { + twtools::logStatus("first change local passphrase failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases -L $twtools::twrootdir/$twtools::twlocalkeyloc --local-passphrase $twtools::twlocalpass --local-passphrase-old $newpass`); + if ( $? != 0 ) { + twtools::logStatus("second change local passphrase failed\n"); + $twpassed = 0; + } + + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + return 0; + } +} + + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1; From 122010acc2adfdcd78a7f596779d0f049c5443d6 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 8 Jul 2017 15:18:58 -0700 Subject: [PATCH 015/110] In examine-encryption mode, say 'Unknown' & exit w/ nonzero value if can't find a keyfile that goes with the file being examined --- src/twadmin/twadmincl.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/twadmin/twadmincl.cpp b/src/twadmin/twadmincl.cpp index 2037aec..0c79a26 100644 --- a/src/twadmin/twadmincl.cpp +++ b/src/twadmin/twadmincl.cpp @@ -45,6 +45,7 @@ #include "core/usernotify.h" #include "core/cmdlineparser.h" #include "core/usernotify.h" +#include "core/corestrings.h" #include "fco/fconame.h" #include "tw/configfile.h" #include "tw/twutil.h" @@ -1553,15 +1554,19 @@ int cTWAModeExamine::Execute(cErrorQueue* pQueue) // Try different keys to see if they decrypt this file if (manip.GetEncoding() == cFileHeader::ASYM_ENCRYPTION) { + bool bFound = false; + // Output the keys that decrypt the file. iUserNotify::GetInstance()->Notify(iUserNotify::V_NORMAL, TSS_GetString(cTWAdmin, twadmin::STR_KEYS_DECRYPT ).c_str()); iUserNotify::GetInstance()->Notify(iUserNotify::V_NORMAL, TSS_GetString(cTW, tw::STR_NEWLINE ).c_str()); - + if (siteKey.KeysLoaded()) try { if (manip.TestDecryption(*siteKey.GetPublicKey(), false) != false) { + bFound = true; + iUserNotify::GetInstance()->Notify(iUserNotify::V_SILENT, TSS_GetString(cTWAdmin, twadmin::STR_SITEKEYFILE ).c_str()); iUserNotify::GetInstance()->Notify(iUserNotify::V_SILENT, cDisplayEncoder::EncodeInline( mSiteKeyFile ).c_str()); @@ -1575,6 +1580,8 @@ int cTWAModeExamine::Execute(cErrorQueue* pQueue) { if (manip.TestDecryption(*localKey.GetPublicKey(), false) != false) { + bFound = true; + iUserNotify::GetInstance()->Notify(iUserNotify::V_SILENT, TSS_GetString(cTWAdmin, twadmin::STR_LOCALKEYFILE ).c_str()); iUserNotify::GetInstance()->Notify(iUserNotify::V_SILENT, cDisplayEncoder::EncodeInline( mLocalKeyFile ).c_str()); @@ -1582,6 +1589,15 @@ int cTWAModeExamine::Execute(cErrorQueue* pQueue) } } catch (eError&) {} + + if (!bFound) + { + bResult = false; + iUserNotify::GetInstance()->Notify(iUserNotify::V_SILENT, "\t"); + iUserNotify::GetInstance()->Notify(iUserNotify::V_SILENT, TSS_GetString(cCore, core::STR_UNKNOWN).c_str()); + iUserNotify::GetInstance()->Notify(iUserNotify::V_SILENT, TSS_GetString(cTW, tw::STR_NEWLINE ).c_str()); + } + } TCOUT << std::endl; } From 65d97e289247c3dd7dc72ef5147b3ce9fedcbd08 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 8 Jul 2017 16:29:34 -0700 Subject: [PATCH 016/110] Rework fileutil_t test to not require /etc/hosts; tweak twutil_t test to work properly if run as root --- src/twtest/fcopropvector_t.cpp | 8 ++++---- src/twtest/fileutil_t.cpp | 32 +++++++++++++++++++++++--------- src/twtest/twutil_t.cpp | 7 +++++-- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/twtest/fcopropvector_t.cpp b/src/twtest/fcopropvector_t.cpp index 00f19eb..e82d470 100644 --- a/src/twtest/fcopropvector_t.cpp +++ b/src/twtest/fcopropvector_t.cpp @@ -99,7 +99,7 @@ void TestFCOPropVector() d.TraceDetail("Object manipulation tests are not successful\n"); return; -}//end TestPropVector +} static bool init (cFCOPropVector &testV) { @@ -111,7 +111,7 @@ static bool init (cFCOPropVector &testV) return false; } //end for return true; -} //end init +} static bool addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d) @@ -141,7 +141,7 @@ static bool addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d) out &= local; //and-ing of results. return out; -}//end addRemove +} static bool objManip (cFCOPropVector &testV, cDebug& d) { @@ -201,4 +201,4 @@ static bool objManip (cFCOPropVector &testV, cDebug& d) TEST((v1 ^ v2) == v3); return out; -}//end objManip +} diff --git a/src/twtest/fileutil_t.cpp b/src/twtest/fileutil_t.cpp index 3f132f6..05d2936 100644 --- a/src/twtest/fileutil_t.cpp +++ b/src/twtest/fileutil_t.cpp @@ -38,6 +38,8 @@ #include "util/stdutil.h" #include "util/fileutil.h" #include "core/debug.h" +#include "test.h" +#include using namespace std; @@ -47,15 +49,27 @@ using namespace std; void TestFileUtil() { - if(cFileUtil::FileExists("/etc/hosts")) - { - TSTRING source, dest; + TSTRING source = TEMP_DIR; + source += _T("/copy_src"); - source = _T("/etc/hosts"); - dest = _T("/tmp/dest"); - bool blah = cFileUtil::Copy(source, dest); - (void)blah; - // TCOUT << _T("<") << wstr3 << _T(">") << std::endl; - } + //Create a temporary file for testing: + FILE* testStream; + testStream = _tfopen( source.c_str(), _T("w+b")); + TEST(testStream); + + TSTRING testString( _T("This is a test") ); + int iTestStringLength = testString.length(); + + //Write some data to the stream... + fwrite( testString.c_str(), sizeof(TCHAR), iTestStringLength, testStream ); + fclose( testStream ); + + TSTRING dest = TEMP_DIR; + dest += "/copy_dest"; + + TEST(cFileUtil::Copy(source, dest)); + + unlink(dest.c_str()); + unlink(source.c_str()); } diff --git a/src/twtest/twutil_t.cpp b/src/twtest/twutil_t.cpp index fe38d53..d844585 100644 --- a/src/twtest/twutil_t.cpp +++ b/src/twtest/twutil_t.cpp @@ -80,7 +80,10 @@ void TestTWUtil() // make the dir read only and make sure write tests false // windows fails this test, perhaps because I am an administrator? chmod(tmpDir.c_str(), 0500); - TEST(cFileUtil::FileWritable(tmpFN) == false); + bool is_root = (0 == getuid()); + + TEST(cFileUtil::FileWritable(tmpFN) == is_root); + chmod(tmpDir.c_str(), 0700); // create the file @@ -91,7 +94,7 @@ void TestTWUtil() // test a read only file chmod(tmpFN.c_str(), 0400); - TEST(cFileUtil::FileWritable(tmpFN) == false); + TEST(cFileUtil::FileWritable(tmpFN) == is_root); // test a writable file chmod(tmpFN.c_str(), 0666); From ad9a79a84a8eb8f908bbf22c53ba56d78e094930 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 8 Jul 2017 19:47:49 -0700 Subject: [PATCH 017/110] Add '.' to test-harness @INC path, since latest Perl 5 apparently now excludes it by default. --- src/test-harness/twtest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-harness/twtest.pl b/src/test-harness/twtest.pl index 1d87e3b..815e9b1 100755 --- a/src/test-harness/twtest.pl +++ b/src/test-harness/twtest.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; - +use lib '.'; use twtools; my @twtests = (); From def126e190b82b7a92f6be75b0af977536b09a6b Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 8 Jul 2017 19:49:22 -0700 Subject: [PATCH 018/110] aclocal.m4 got regenerated by automake 1.15.1, though it actually only updated the version number & copyright year --- aclocal.m4 | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 322b108..1995959 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], +m4_if([$1], [1.15.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl +[AM_AUTOMAKE_VERSION([1.15.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -408,7 +408,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -605,7 +605,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -626,7 +626,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -647,7 +647,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -697,7 +697,7 @@ rm -f confinc confmf # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -738,7 +738,7 @@ fi # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -765,7 +765,7 @@ AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -794,7 +794,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -841,7 +841,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -860,7 +860,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -941,7 +941,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1001,7 +1001,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1029,7 +1029,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2006-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1048,7 +1048,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, From dbc00a2ed45cfcb9acac8ca096db0de1e705f476 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 8 Jul 2017 19:51:23 -0700 Subject: [PATCH 019/110] Fix logic error in cFCOPropVector::isExtended(), which only manifests with large prop vectors we currently won't see in the wild. Exposed by intermittently failing test in fcopropvector_t.cpp circa line 132, which now passes reliably on platforms where it used to fail. --- src/fco/fcopropvector.cpp | 6 ++--- src/twtest/fcopropvector_t.cpp | 48 ++++++++++++++-------------------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/fco/fcopropvector.cpp b/src/fco/fcopropvector.cpp index de16ddb..62564a3 100644 --- a/src/fco/fcopropvector.cpp +++ b/src/fco/fcopropvector.cpp @@ -366,10 +366,10 @@ bool cFCOPropVector::isExtended(void) const return false; else { - int sum = 0; - for (int i=(*mpBuf).size(); i >= 2; i--) + uint32 sum = 0; + for (uint32 i=(*mpBuf).size()-1; i >= 2; i--) sum += ((*mpBuf)[i]); - return (sum == 0); + return (sum != 0); } } } diff --git a/src/twtest/fcopropvector_t.cpp b/src/twtest/fcopropvector_t.cpp index e82d470..699a085 100644 --- a/src/twtest/fcopropvector_t.cpp +++ b/src/twtest/fcopropvector_t.cpp @@ -38,8 +38,8 @@ #endif static bool init (cFCOPropVector &testV); -static bool addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d); -static bool objManip (cFCOPropVector &testV, cDebug& d); +static void addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d); +static void objManip (cFCOPropVector &testV, cDebug& d); void TestFCOPropVector() { @@ -74,7 +74,7 @@ void TestFCOPropVector() } //Test ability to add and remove - TEST(testout = addRemove (test1, test2, d)); + addRemove (test1, test2, d); d.TraceDetail("Add/Remove over all tests is %i \n", testout); // test clear. @@ -92,11 +92,7 @@ void TestFCOPropVector() d.TraceDetail("Clear Test Done.\n"); //test operators - TEST(testout = objManip(test1, d)); - if (testout) - d.TraceDetail("Object manipulation tests are successful\n"); - else - d.TraceDetail("Object manipulation tests are not successful\n"); + objManip(test1, d); return; } @@ -114,22 +110,21 @@ static bool init (cFCOPropVector &testV) } -static bool addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d) +static void addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d) { int var1 = 0 , var2 = 64, var3 = 2; - bool local=true, out=true; test1.AddItem(var1); - TEST(local &= test1.ContainsItem(var1)); //hopefully this is true! - TEST(local &= !test1.ContainsItem(var3)); + TEST(test1.ContainsItem(var1)); //hopefully this is true! + TEST(!test1.ContainsItem(var3)); test2.SetSize(var2); - TEST(local &= (test2.GetSize() == ((var2/32)+1)*32)); - TEST(local &= (test1 != test2)); + TEST((test2.GetSize() == ((var2/32)+1)*32)); + TEST((test1 != test2)); test1.RemoveItem(var1); test2.SetSize(test1.GetSize()); - TEST(local &= (test1 == test2)); + TEST(test1 == test2); test1.AddItem(var3); test2 |= test1; @@ -138,22 +133,19 @@ static bool addRemove (cFCOPropVector &test1, cFCOPropVector &test2, cDebug& d) test2.RemoveItem(var3); d.TraceDetail("\nmMask should be 0! \n"); test2.check(d); - - out &= local; //and-ing of results. - return out; } -static bool objManip (cFCOPropVector &testV, cDebug& d) +static void objManip (cFCOPropVector &testV, cDebug& d) { cFCOPropVector test1, test2 = testV; - bool out = true; /*testV.check(d); test2.check(d);*/ - TEST(out &= (testV == test2)); //test operator = , == + // test operator = , == + TEST(testV == test2) test2.AddItem(1); - TEST(out &= (testV != test2)); //test operator != + TEST(testV != test2); // test operator != /*testV.check(d); test2.check(d);*/ @@ -165,12 +157,12 @@ static bool objManip (cFCOPropVector &testV, cDebug& d) test1 = testV | test2; //test operator | test1.check(d); - TEST(out&= (test1 == testV)); + TEST(test1 == testV); test2.RemoveItem(1); testV = (test2 & test1);//test operator & testV.check(d); - TEST(out&= !(test1 == testV)); + TEST( !(test1 == testV)); // test operator ^ cFCOPropVector v1, v2, v3; @@ -181,13 +173,13 @@ static bool objManip (cFCOPropVector &testV, cDebug& d) // expected result v3.AddItem(1); v3.AddItem(4); - TEST((v1 ^ v2) == v3); + TEST((v1 ^ v2) == v3); // try with larger sizes... v2.SetSize(40); v2.Clear(); v2.AddItem(3); - TEST((v1 ^ v2) == v3); + TEST((v1 ^ v2) == v3); v2.AddItem(38); v1.SetSize(40); @@ -198,7 +190,5 @@ static bool objManip (cFCOPropVector &testV, cDebug& d) v3.Clear(); v3.AddItem(1); v3.AddItem(3); - TEST((v1 ^ v2) == v3); - - return out; + TEST((v1 ^ v2) == v3); } From 180bf761e0ba4f9f37341bc671ffdc7a1afc9d66 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 8 Jul 2017 22:18:04 -0700 Subject: [PATCH 020/110] Buildsys files regenerated with automake 1.15.1, with no exciting new features --- Makefile.in | 13 +- configure | 18 +- man/Makefile.in | 5 +- man/man4/Makefile.in | 5 +- man/man5/Makefile.in | 5 +- man/man8/Makefile.in | 5 +- src/Makefile.in | 5 +- src/core/Makefile.in | 5 +- src/cryptlib/Makefile.in | 5 +- src/db/Makefile.in | 5 +- src/fco/Makefile.in | 5 +- src/fco/fcopropvector.cpp.old | 484 ++++++++++++++++++++++++++++++++++ src/fs/Makefile.in | 5 +- src/siggen/Makefile.in | 5 +- src/tripwire/Makefile.in | 5 +- src/tw/Makefile.in | 5 +- src/twadmin/Makefile.in | 5 +- src/twcrypto/Makefile.in | 5 +- src/twparser/Makefile.in | 5 +- src/twprint/Makefile.in | 5 +- src/twtest/Makefile.in | 5 +- src/util/Makefile.in | 5 +- 22 files changed, 533 insertions(+), 77 deletions(-) create mode 100644 src/fco/fcopropvector.cpp.old diff --git a/Makefile.in b/Makefile.in index 3bb6176..c0b3364 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -307,7 +307,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -547,7 +546,7 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -573,7 +572,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -591,7 +590,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -601,7 +600,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff --git a/configure b/configure index 352f5e4..ea08168 100755 --- a/configure +++ b/configure @@ -724,7 +724,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -810,7 +809,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1063,15 +1061,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1209,7 +1198,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1362,7 +1351,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -3462,6 +3450,10 @@ fi ac_config_headers="$ac_config_headers config.h" + + + + CFLAGS=${CFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} diff --git a/man/Makefile.in b/man/Makefile.in index 9cf2615..2218a28 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -284,7 +284,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/man/man4/Makefile.in b/man/man4/Makefile.in index 01437ef..dbd0c2d 100644 --- a/man/man4/Makefile.in +++ b/man/man4/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -256,7 +256,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/man/man5/Makefile.in b/man/man5/Makefile.in index 9bb9a4d..2d8dd98 100644 --- a/man/man5/Makefile.in +++ b/man/man5/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -256,7 +256,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/man/man8/Makefile.in b/man/man8/Makefile.in index 9341d22..d6e21b4 100644 --- a/man/man8/Makefile.in +++ b/man/man8/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -256,7 +256,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/Makefile.in b/src/Makefile.in index 7769907..f0fb88f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -282,7 +282,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/core/Makefile.in b/src/core/Makefile.in index c013c55..858721f 100644 --- a/src/core/Makefile.in +++ b/src/core/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -313,7 +313,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/cryptlib/Makefile.in b/src/cryptlib/Makefile.in index 84de4fb..5306cab 100644 --- a/src/cryptlib/Makefile.in +++ b/src/cryptlib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -303,7 +303,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/db/Makefile.in b/src/db/Makefile.in index f80ab34..53ef6f8 100644 --- a/src/db/Makefile.in +++ b/src/db/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -300,7 +300,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/fco/Makefile.in b/src/fco/Makefile.in index cb15522..84b5a63 100644 --- a/src/fco/Makefile.in +++ b/src/fco/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -308,7 +308,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/fco/fcopropvector.cpp.old b/src/fco/fcopropvector.cpp.old new file mode 100644 index 0000000..ed26099 --- /dev/null +++ b/src/fco/fcopropvector.cpp.old @@ -0,0 +1,484 @@ +/// +// The developer of the original code and/or files is Tripwire, Inc. +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, +// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights +// reserved. +// +// This program is free software. The contents of this file are subject +// to the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. You may redistribute it and/or modify it +// only in compliance with the GNU General Public License. +// +// This program is distributed in the hope that it will be useful. +// However, this program is distributed AS-IS WITHOUT ANY +// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS +// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. +// +// Nothing in the GNU General Public License or any other license to use +// the code or files shall permit you to use Tripwire's trademarks, +// service marks, or other intellectual property without Tripwire's +// prior written consent. +// +// If you have any questions, please contact Tripwire, Inc. at either +// info@tripwire.org or www.tripwire.org. +// +/////////////////////////////////////////////////////////////////////////////// +// fcopropvector.cpp +// + +#include "stdfco.h" +#include "fcopropvector.h" +#include "core/serializer.h" +#include "core/debug.h" +#include "core/errorutil.h" + +int cFCOPropVector::msBitlength(sizeof (uint32) * 8); + //msBitlength is common to all objects of class. + +/////////////////////////////////////////////////////////////////////////////// +// Constructor -- Sets mSize. Default = 32. +/////////////////////////////////////////////////////////////////////////////// +cFCOPropVector::cFCOPropVector(int size) : iSerializable() +{ + mSize = 32; + mMask = 0; + mpBuf = NULL; + SetSize(size); +} + +/////////////////////////////////////////////////////////////////////////////// +// Destructor -- +/////////////////////////////////////////////////////////////////////////////// +cFCOPropVector::~cFCOPropVector() +{ + if (mpBuf!=NULL) + delete mpBuf; +} + +/////////////////////////////////////////////////////////////////////////////// +// Copy Constructor +/////////////////////////////////////////////////////////////////////////////// +cFCOPropVector::cFCOPropVector(const cFCOPropVector &rhs) : iSerializable() +{ + mSize = rhs.mSize; + mMask = rhs.mMask; + if (rhs.mpBuf != NULL) { + mpBuf = new std::vector; + *mpBuf = *(rhs.mpBuf); + } + else mpBuf = NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// Overloaded Operators: ==, !=, = , &, |, &=, |= +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::operator==(const cFCOPropVector& rhs) const +{ + if (this != &rhs) { + if ((mpBuf == NULL) && (rhs.mpBuf==NULL)) + { + printf(" case 1\n"); + return (mMask == rhs.mMask); + } + else if((mpBuf == NULL) && (rhs.mpBuf!=NULL)) + { + if (rhs.isExtended()) { + printf(" case 2\n"); + return false; + } else { + printf(" case 3\n"); + return (mMask == ((*rhs.mpBuf)[0])); + } + } + else if ((mpBuf != NULL) && (rhs.mpBuf == NULL)) + { + if ((*this).isExtended()) { + printf(" case 4\n"); + return false; + } else { + printf(" case 5\n"); + return (((*mpBuf)[0])==rhs.mMask); + } + } + else { + printf(" case 6\n"); + return (*mpBuf == *(rhs.mpBuf)); + } + } + else { + printf(" case 7\n"); + return true; + } +} + +bool cFCOPropVector::operator!=(const cFCOPropVector& rhs) const +{ + return (! (*this == rhs)); +} + + + +cFCOPropVector& cFCOPropVector::operator=(const cFCOPropVector& rhs) +{ + if (this != &rhs) + { + if ((rhs.mpBuf!=NULL) && (mpBuf!=NULL)) + *mpBuf= *(rhs.mpBuf); + else if ((rhs.mpBuf!=NULL) && (mpBuf==NULL)) + { + mpBuf = new std::vector; + *mpBuf = *(rhs.mpBuf); + } + else if((rhs.mpBuf==NULL) && (mpBuf!=NULL)) + { + delete mpBuf; + mpBuf = NULL; + } + mSize = rhs.mSize; + mMask = rhs.mMask; + }//end if + return *this; +} + +cFCOPropVector cFCOPropVector::operator&(const cFCOPropVector& rhs) const +{ + cFCOPropVector temp = *this; + temp &= rhs; + return temp; +} + +cFCOPropVector cFCOPropVector::operator|(const cFCOPropVector& rhs) const +{ + cFCOPropVector temp = *this; + temp |= rhs; + return temp; +} + +cFCOPropVector cFCOPropVector::operator^(const cFCOPropVector& rhs) const +{ + cFCOPropVector temp = *this; + temp ^= rhs; + return temp; +} + + +cFCOPropVector& cFCOPropVector::operator&=(const cFCOPropVector& rhs) +{ + // make sure I am big enough + if(GetSize() < rhs.GetSize()) + SetSize(rhs.GetSize()); + if(mpBuf == 0) + { + ASSERT(GetSize() <= 32); + mMask &= rhs.mMask; + } + else if (rhs.mpBuf == 0) + { + ASSERT(rhs.GetSize() <= 32); + (*mpBuf)[0] &= rhs.mMask; + } + else + { + for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) + (*mpBuf)[i] &= (*rhs.mpBuf)[i]; + } + return *this; +} + +cFCOPropVector& cFCOPropVector::operator|=(const cFCOPropVector& rhs) +{ + // make sure I am big enough + if(GetSize() < rhs.GetSize()) + SetSize(rhs.GetSize()); + if(mpBuf == 0) + { + ASSERT(GetSize() <= 32); + mMask |= rhs.mMask; + } + else if (rhs.mpBuf == 0) + { + ASSERT(rhs.GetSize() <= 32); + (*mpBuf)[0] |= rhs.mMask; + } + else + { + for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) + (*mpBuf)[i] |= (*rhs.mpBuf)[i]; + } + return *this; +} + +cFCOPropVector& cFCOPropVector::operator^=(const cFCOPropVector& rhs) +{ + // make sure I am big enough + if(GetSize() < rhs.GetSize()) + SetSize(rhs.GetSize()); + if(mpBuf == 0) + { + ASSERT(GetSize() <= 32); + mMask ^= rhs.mMask; + } + else if (rhs.mpBuf == 0) + { + ASSERT(rhs.GetSize() <= 32); + (*mpBuf)[0] ^= rhs.mMask; + } + else + { + for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) + (*mpBuf)[i] ^= (*rhs.mpBuf)[i]; + } + return *this; +} + + + +//END OPERATORS + +/////////////////////////////////////////////////////////////////////////////// +// GetSize -- returns the number of items the vector can hold +/////////////////////////////////////////////////////////////////////////////// +int cFCOPropVector::GetSize(void) const +{ + return mSize; +} + +/////////////////////////////////////////////////////////////////////////////// +// SetSize -- Sets the maximum NUMBER of items that can be stored +// in vector. **IMPORTANT** : If max is less than current size of mask+buff, +// the set is truncated and extra information is lost. +/////////////////////////////////////////////////////////////////////////////// +int cFCOPropVector::SetSize(int max) +{ + if ((max <= msBitlength) && (mpBuf == NULL)) + return mSize = msBitlength; + else if ((max <= msBitlength) && (mpBuf != NULL)) + { + return mSize = (*mpBuf).capacity()*msBitlength; + //new operation already performed, stick with mpBuf. + } + else if ((mpBuf == NULL) && (max > msBitlength)) + { + mpBuf = new std::vector; + (*mpBuf).resize (((max/msBitlength)+1), 0); + (*mpBuf)[0] = mMask; + return mSize = ((*mpBuf).capacity() * msBitlength); + } + else //mpBuf!=NULL && max>msBitlength + { + if (mpBuf) + { + (*mpBuf).resize (((max/msBitlength)+1), 0); + mSize = ((*mpBuf).capacity() * msBitlength); + } + return mSize; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// AddItem -- Adds an item to the bitset by 'anding' it on. Behavior is +// undefined if i >= GetSize. Returns true if set contains item after change. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::AddItem(int i) +{ + ASSERT(i < GetSize()); + + if (mpBuf == NULL) + { + ASSERT(mSize <= 32); + mMask |= 1<<(i); + } + else + { + ((*mpBuf)[(i)/msBitlength]) |= 1<<((i) % msBitlength); + } + return ContainsItem(i); +} + + +/////////////////////////////////////////////////////////////////////////////// +// AddItemAndGrow -- Like AddItem except that if i >= GetSize, resizes vector. +// Returns true if set contains item after change. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::AddItemAndGrow(int i) +{ + if(i >= GetSize()) + SetSize( i ); + + return AddItem( i ); +} + +/////////////////////////////////////////////////////////////////////////////// +// RemoveItem -- Removes an item from the vector. Vector is unchanged if +// i >= GetMaxItem. Returns true if set does not contain item after change. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::RemoveItem(int i) +{ + ASSERT(i < GetSize()); + + if (!ContainsItem(i)) + return true; + if (mpBuf == NULL) + mMask ^= 1<<(i); + else + { + ((*mpBuf)[(i)/msBitlength]) ^= 1<<((i) % msBitlength); + } + return !ContainsItem(i); +} + +/////////////////////////////////////////////////////////////////////////////// +// ContainsItem -- Returns boolean value if bit value is in the vector. +// Fails if mMask+mBuf is < i. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::ContainsItem(int i) const +{ + if (i > mSize-1) + return false; + else if (mpBuf == NULL) + { + return ((mMask & (1<<(i))) != 0); + } + else + { + return ((((*mpBuf)[(i)/msBitlength]) & (1<<((i) % msBitlength))) != 0); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// Clear -- removes all items from the vector +/////////////////////////////////////////////////////////////////////////////// +void cFCOPropVector::Clear(void) +{ + mMask = 0; + if(mpBuf) + { + std::fill(mpBuf->begin(), mpBuf->end(), 0); + } +} + + +/////////////////////////////////////////////////////////////////////////////// +// isExtended -- Returns true if Vector is USING mpBuf beyond [0]. It +// is assumed that {mpBuf [i] |i>0} is being used if i has non-zero value. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::isExtended(void) const +{ + if (mpBuf == NULL) { + printf(" isExtended: mpBuf is null\n"); + return false; + }else + { + if ((*mpBuf).size() <= 1) { + printf(" mpBuf size is <= 1 (it's %d)\n", (*mpBuf).size()); + return false; + } else + { + uint32 sum = 0; + for (uint32 i =(*mpBuf).size()-1; i >= 2; i--) + { + printf(" pre: sum = %u, i = %u, mpBuf[i] = %u\n", sum, i, (*mpBuf)[i]); + sum += ((*mpBuf)[i]); + printf(" post: sum = %u, i = %u, mpBuf[i] = %u\n", sum, i, (*mpBuf)[i]); + } + printf(" mpBuf size is %u and sum = %u\n", (*mpBuf).size(), sum); + return (sum != 0); + } + } +} + + +// TO DO: temp function, will delete after testing... DA +void cFCOPropVector::check (cDebug& d) const +{ + d.TraceDetail("mSize = %i \n", mSize); + d.TraceDetail("msBitlength = %i \n", msBitlength); + d.TraceDetail("mMask = %u \n", mMask); + if (mpBuf!=NULL) { + d.TraceDetail("*mpBuf has size %i \n", (*mpBuf).size() ); + for (unsigned int i = 0; i<(*mpBuf).size(); ++i) + d.TraceDetail("mpBuf element %i = %u \n", i, (*mpBuf)[i] ); + } +}//end check + + +void cFCOPropVector::Read(iSerializer* pSerializer, int32 version) +{ + if (version > 0) + ThrowAndAssert(eSerializerVersionMismatch(_T("Property Vector Read"))); + + int32 newSize; + pSerializer->ReadInt32(newSize); + ASSERT(newSize > 0); + + SetSize(newSize); + + if (mpBuf == NULL) + { + int32 mask; + pSerializer->ReadInt32(mask); + mMask = mask; + } + else + { + for (int i=0; i <= mSize / msBitlength; ++i) + { + int32 mask; + pSerializer->ReadInt32(mask); + (*mpBuf)[i] = mask; + } + } + +} + +void cFCOPropVector::Write(iSerializer* pSerializer) const +{ + pSerializer->WriteInt32(mSize); + + if (mpBuf == NULL) + { + pSerializer->WriteInt32(mMask); + } + else + { + for (int i=0; i <= mSize / msBitlength; ++i) + pSerializer->WriteInt32((*mpBuf)[i]); + } + +} + + +/////////////////////////////////////////////////////////////////////////////// +// TraceContents -- prints the contents of the vector to debug out +/////////////////////////////////////////////////////////////////////////////// +void cFCOPropVector::TraceContents(int dl) const +{ + if(dl < 0) + dl = cDebug::D_DEBUG; + + cDebug d("cFCOPropVector::TraceContents"); + TOSTRINGSTREAM ostr; + for(int i=0; i Date: Sun, 9 Jul 2017 00:11:05 -0700 Subject: [PATCH 021/110] remove a backup file I hadn't meant to commit --- src/fco/fcopropvector.cpp.old | 484 ---------------------------------- 1 file changed, 484 deletions(-) delete mode 100644 src/fco/fcopropvector.cpp.old diff --git a/src/fco/fcopropvector.cpp.old b/src/fco/fcopropvector.cpp.old deleted file mode 100644 index ed26099..0000000 --- a/src/fco/fcopropvector.cpp.old +++ /dev/null @@ -1,484 +0,0 @@ -/// -// The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire, -// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights -// reserved. -// -// This program is free software. The contents of this file are subject -// to the terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2 of the License, or (at your -// option) any later version. You may redistribute it and/or modify it -// only in compliance with the GNU General Public License. -// -// This program is distributed in the hope that it will be useful. -// However, this program is distributed AS-IS WITHOUT ANY -// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS -// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. -// -// Nothing in the GNU General Public License or any other license to use -// the code or files shall permit you to use Tripwire's trademarks, -// service marks, or other intellectual property without Tripwire's -// prior written consent. -// -// If you have any questions, please contact Tripwire, Inc. at either -// info@tripwire.org or www.tripwire.org. -// -/////////////////////////////////////////////////////////////////////////////// -// fcopropvector.cpp -// - -#include "stdfco.h" -#include "fcopropvector.h" -#include "core/serializer.h" -#include "core/debug.h" -#include "core/errorutil.h" - -int cFCOPropVector::msBitlength(sizeof (uint32) * 8); - //msBitlength is common to all objects of class. - -/////////////////////////////////////////////////////////////////////////////// -// Constructor -- Sets mSize. Default = 32. -/////////////////////////////////////////////////////////////////////////////// -cFCOPropVector::cFCOPropVector(int size) : iSerializable() -{ - mSize = 32; - mMask = 0; - mpBuf = NULL; - SetSize(size); -} - -/////////////////////////////////////////////////////////////////////////////// -// Destructor -- -/////////////////////////////////////////////////////////////////////////////// -cFCOPropVector::~cFCOPropVector() -{ - if (mpBuf!=NULL) - delete mpBuf; -} - -/////////////////////////////////////////////////////////////////////////////// -// Copy Constructor -/////////////////////////////////////////////////////////////////////////////// -cFCOPropVector::cFCOPropVector(const cFCOPropVector &rhs) : iSerializable() -{ - mSize = rhs.mSize; - mMask = rhs.mMask; - if (rhs.mpBuf != NULL) { - mpBuf = new std::vector; - *mpBuf = *(rhs.mpBuf); - } - else mpBuf = NULL; -} - -/////////////////////////////////////////////////////////////////////////////// -// Overloaded Operators: ==, !=, = , &, |, &=, |= -/////////////////////////////////////////////////////////////////////////////// -bool cFCOPropVector::operator==(const cFCOPropVector& rhs) const -{ - if (this != &rhs) { - if ((mpBuf == NULL) && (rhs.mpBuf==NULL)) - { - printf(" case 1\n"); - return (mMask == rhs.mMask); - } - else if((mpBuf == NULL) && (rhs.mpBuf!=NULL)) - { - if (rhs.isExtended()) { - printf(" case 2\n"); - return false; - } else { - printf(" case 3\n"); - return (mMask == ((*rhs.mpBuf)[0])); - } - } - else if ((mpBuf != NULL) && (rhs.mpBuf == NULL)) - { - if ((*this).isExtended()) { - printf(" case 4\n"); - return false; - } else { - printf(" case 5\n"); - return (((*mpBuf)[0])==rhs.mMask); - } - } - else { - printf(" case 6\n"); - return (*mpBuf == *(rhs.mpBuf)); - } - } - else { - printf(" case 7\n"); - return true; - } -} - -bool cFCOPropVector::operator!=(const cFCOPropVector& rhs) const -{ - return (! (*this == rhs)); -} - - - -cFCOPropVector& cFCOPropVector::operator=(const cFCOPropVector& rhs) -{ - if (this != &rhs) - { - if ((rhs.mpBuf!=NULL) && (mpBuf!=NULL)) - *mpBuf= *(rhs.mpBuf); - else if ((rhs.mpBuf!=NULL) && (mpBuf==NULL)) - { - mpBuf = new std::vector; - *mpBuf = *(rhs.mpBuf); - } - else if((rhs.mpBuf==NULL) && (mpBuf!=NULL)) - { - delete mpBuf; - mpBuf = NULL; - } - mSize = rhs.mSize; - mMask = rhs.mMask; - }//end if - return *this; -} - -cFCOPropVector cFCOPropVector::operator&(const cFCOPropVector& rhs) const -{ - cFCOPropVector temp = *this; - temp &= rhs; - return temp; -} - -cFCOPropVector cFCOPropVector::operator|(const cFCOPropVector& rhs) const -{ - cFCOPropVector temp = *this; - temp |= rhs; - return temp; -} - -cFCOPropVector cFCOPropVector::operator^(const cFCOPropVector& rhs) const -{ - cFCOPropVector temp = *this; - temp ^= rhs; - return temp; -} - - -cFCOPropVector& cFCOPropVector::operator&=(const cFCOPropVector& rhs) -{ - // make sure I am big enough - if(GetSize() < rhs.GetSize()) - SetSize(rhs.GetSize()); - if(mpBuf == 0) - { - ASSERT(GetSize() <= 32); - mMask &= rhs.mMask; - } - else if (rhs.mpBuf == 0) - { - ASSERT(rhs.GetSize() <= 32); - (*mpBuf)[0] &= rhs.mMask; - } - else - { - for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) - (*mpBuf)[i] &= (*rhs.mpBuf)[i]; - } - return *this; -} - -cFCOPropVector& cFCOPropVector::operator|=(const cFCOPropVector& rhs) -{ - // make sure I am big enough - if(GetSize() < rhs.GetSize()) - SetSize(rhs.GetSize()); - if(mpBuf == 0) - { - ASSERT(GetSize() <= 32); - mMask |= rhs.mMask; - } - else if (rhs.mpBuf == 0) - { - ASSERT(rhs.GetSize() <= 32); - (*mpBuf)[0] |= rhs.mMask; - } - else - { - for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) - (*mpBuf)[i] |= (*rhs.mpBuf)[i]; - } - return *this; -} - -cFCOPropVector& cFCOPropVector::operator^=(const cFCOPropVector& rhs) -{ - // make sure I am big enough - if(GetSize() < rhs.GetSize()) - SetSize(rhs.GetSize()); - if(mpBuf == 0) - { - ASSERT(GetSize() <= 32); - mMask ^= rhs.mMask; - } - else if (rhs.mpBuf == 0) - { - ASSERT(rhs.GetSize() <= 32); - (*mpBuf)[0] ^= rhs.mMask; - } - else - { - for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) - (*mpBuf)[i] ^= (*rhs.mpBuf)[i]; - } - return *this; -} - - - -//END OPERATORS - -/////////////////////////////////////////////////////////////////////////////// -// GetSize -- returns the number of items the vector can hold -/////////////////////////////////////////////////////////////////////////////// -int cFCOPropVector::GetSize(void) const -{ - return mSize; -} - -/////////////////////////////////////////////////////////////////////////////// -// SetSize -- Sets the maximum NUMBER of items that can be stored -// in vector. **IMPORTANT** : If max is less than current size of mask+buff, -// the set is truncated and extra information is lost. -/////////////////////////////////////////////////////////////////////////////// -int cFCOPropVector::SetSize(int max) -{ - if ((max <= msBitlength) && (mpBuf == NULL)) - return mSize = msBitlength; - else if ((max <= msBitlength) && (mpBuf != NULL)) - { - return mSize = (*mpBuf).capacity()*msBitlength; - //new operation already performed, stick with mpBuf. - } - else if ((mpBuf == NULL) && (max > msBitlength)) - { - mpBuf = new std::vector; - (*mpBuf).resize (((max/msBitlength)+1), 0); - (*mpBuf)[0] = mMask; - return mSize = ((*mpBuf).capacity() * msBitlength); - } - else //mpBuf!=NULL && max>msBitlength - { - if (mpBuf) - { - (*mpBuf).resize (((max/msBitlength)+1), 0); - mSize = ((*mpBuf).capacity() * msBitlength); - } - return mSize; - } -} - -/////////////////////////////////////////////////////////////////////////////// -// AddItem -- Adds an item to the bitset by 'anding' it on. Behavior is -// undefined if i >= GetSize. Returns true if set contains item after change. -/////////////////////////////////////////////////////////////////////////////// -bool cFCOPropVector::AddItem(int i) -{ - ASSERT(i < GetSize()); - - if (mpBuf == NULL) - { - ASSERT(mSize <= 32); - mMask |= 1<<(i); - } - else - { - ((*mpBuf)[(i)/msBitlength]) |= 1<<((i) % msBitlength); - } - return ContainsItem(i); -} - - -/////////////////////////////////////////////////////////////////////////////// -// AddItemAndGrow -- Like AddItem except that if i >= GetSize, resizes vector. -// Returns true if set contains item after change. -/////////////////////////////////////////////////////////////////////////////// -bool cFCOPropVector::AddItemAndGrow(int i) -{ - if(i >= GetSize()) - SetSize( i ); - - return AddItem( i ); -} - -/////////////////////////////////////////////////////////////////////////////// -// RemoveItem -- Removes an item from the vector. Vector is unchanged if -// i >= GetMaxItem. Returns true if set does not contain item after change. -/////////////////////////////////////////////////////////////////////////////// -bool cFCOPropVector::RemoveItem(int i) -{ - ASSERT(i < GetSize()); - - if (!ContainsItem(i)) - return true; - if (mpBuf == NULL) - mMask ^= 1<<(i); - else - { - ((*mpBuf)[(i)/msBitlength]) ^= 1<<((i) % msBitlength); - } - return !ContainsItem(i); -} - -/////////////////////////////////////////////////////////////////////////////// -// ContainsItem -- Returns boolean value if bit value is in the vector. -// Fails if mMask+mBuf is < i. -/////////////////////////////////////////////////////////////////////////////// -bool cFCOPropVector::ContainsItem(int i) const -{ - if (i > mSize-1) - return false; - else if (mpBuf == NULL) - { - return ((mMask & (1<<(i))) != 0); - } - else - { - return ((((*mpBuf)[(i)/msBitlength]) & (1<<((i) % msBitlength))) != 0); - } -} - -/////////////////////////////////////////////////////////////////////////////// -// Clear -- removes all items from the vector -/////////////////////////////////////////////////////////////////////////////// -void cFCOPropVector::Clear(void) -{ - mMask = 0; - if(mpBuf) - { - std::fill(mpBuf->begin(), mpBuf->end(), 0); - } -} - - -/////////////////////////////////////////////////////////////////////////////// -// isExtended -- Returns true if Vector is USING mpBuf beyond [0]. It -// is assumed that {mpBuf [i] |i>0} is being used if i has non-zero value. -/////////////////////////////////////////////////////////////////////////////// -bool cFCOPropVector::isExtended(void) const -{ - if (mpBuf == NULL) { - printf(" isExtended: mpBuf is null\n"); - return false; - }else - { - if ((*mpBuf).size() <= 1) { - printf(" mpBuf size is <= 1 (it's %d)\n", (*mpBuf).size()); - return false; - } else - { - uint32 sum = 0; - for (uint32 i =(*mpBuf).size()-1; i >= 2; i--) - { - printf(" pre: sum = %u, i = %u, mpBuf[i] = %u\n", sum, i, (*mpBuf)[i]); - sum += ((*mpBuf)[i]); - printf(" post: sum = %u, i = %u, mpBuf[i] = %u\n", sum, i, (*mpBuf)[i]); - } - printf(" mpBuf size is %u and sum = %u\n", (*mpBuf).size(), sum); - return (sum != 0); - } - } -} - - -// TO DO: temp function, will delete after testing... DA -void cFCOPropVector::check (cDebug& d) const -{ - d.TraceDetail("mSize = %i \n", mSize); - d.TraceDetail("msBitlength = %i \n", msBitlength); - d.TraceDetail("mMask = %u \n", mMask); - if (mpBuf!=NULL) { - d.TraceDetail("*mpBuf has size %i \n", (*mpBuf).size() ); - for (unsigned int i = 0; i<(*mpBuf).size(); ++i) - d.TraceDetail("mpBuf element %i = %u \n", i, (*mpBuf)[i] ); - } -}//end check - - -void cFCOPropVector::Read(iSerializer* pSerializer, int32 version) -{ - if (version > 0) - ThrowAndAssert(eSerializerVersionMismatch(_T("Property Vector Read"))); - - int32 newSize; - pSerializer->ReadInt32(newSize); - ASSERT(newSize > 0); - - SetSize(newSize); - - if (mpBuf == NULL) - { - int32 mask; - pSerializer->ReadInt32(mask); - mMask = mask; - } - else - { - for (int i=0; i <= mSize / msBitlength; ++i) - { - int32 mask; - pSerializer->ReadInt32(mask); - (*mpBuf)[i] = mask; - } - } - -} - -void cFCOPropVector::Write(iSerializer* pSerializer) const -{ - pSerializer->WriteInt32(mSize); - - if (mpBuf == NULL) - { - pSerializer->WriteInt32(mMask); - } - else - { - for (int i=0; i <= mSize / msBitlength; ++i) - pSerializer->WriteInt32((*mpBuf)[i]); - } - -} - - -/////////////////////////////////////////////////////////////////////////////// -// TraceContents -- prints the contents of the vector to debug out -/////////////////////////////////////////////////////////////////////////////// -void cFCOPropVector::TraceContents(int dl) const -{ - if(dl < 0) - dl = cDebug::D_DEBUG; - - cDebug d("cFCOPropVector::TraceContents"); - TOSTRINGSTREAM ostr; - for(int i=0; i Date: Sun, 9 Jul 2017 10:10:16 -0700 Subject: [PATCH 022/110] If an exception throws out of an IC, catch it & add to the report file instead of just falling over. --- src/tripwire/tripwiremain.cpp | 3 -- src/tripwire/twcmdline.cpp | 58 +++++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/src/tripwire/tripwiremain.cpp b/src/tripwire/tripwiremain.cpp index 09f2b0c..25d8678 100644 --- a/src/tripwire/tripwiremain.cpp +++ b/src/tripwire/tripwiremain.cpp @@ -254,15 +254,12 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] ) TCERR << _T("*** Exiting...\n"); ret = 8; } - - /* catch (...) { TCERR << _T("*** Fatal exception occurred.\n"); TCERR << _T("*** Exiting...\n"); ret = 8; } - */ exit: diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 58435a0..a587b57 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -709,9 +709,10 @@ int cTWModeDbInit::Execute(cErrorQueue* pQueue) // generate the database... // TODO -- turn pQueue into an error bucket cGenerateDb::Execute( dbIter.GetSpecList(), dbIter.GetDb(), dbIter.GetGenreHeader().GetPropDisplayer(), pQueue, gdbFlags ); + } - - cFCODatabaseUtil::CalculateHeader( + + cFCODatabaseUtil::CalculateHeader( dbFile.GetHeader(), mpData->mPolFile, mstrConfigFile, @@ -1150,15 +1151,35 @@ int cTWModeIC::Execute(cErrorQueue* pQueue) } } // TODO -- emit "processing XXX" + cIntegrityCheck ic( (cGenre::Genre)genreIter->first, dbIter.GetSpecList(), dbIter.GetDb(), report, pQueue ); - + + //If any sort of exception escapes the IC, make sure it goes in the report. + try + { uint32 icFlags = 0; icFlags |= ( mpData->mfLooseDirs ? cIntegrityCheck::FLAG_LOOSE_DIR : 0 ); icFlags |= ( mpData->mbResetAccessTime ? cIntegrityCheck::FLAG_ERASE_FOOTPRINTS_IC : 0 ); icFlags |= ( mpData->mbDirectIO ? cIntegrityCheck::FLAG_DIRECT_IO : 0 ); - - ic.ExecuteOnObjectList( fcoNames, icFlags ); - + + ic.ExecuteOnObjectList( fcoNames, icFlags ); + } + catch( eError& e ) + { + if( pQueue ) + pQueue->AddError(e); + } + catch( std::exception& e ) + { + if (pQueue ) + pQueue->AddError(eIC(e.what())); + } + catch(...) + { + if (pQueue ) + pQueue->AddError(eIC("Unknown")); + + } // put all info into report cFCOReportGenreIter rgi( report ); rgi.SeekToGenre( (cGenre::Genre) genreIter->first ); @@ -1284,13 +1305,32 @@ int cTWModeIC::Execute(cErrorQueue* pQueue) #endif cIntegrityCheck ic( (cGenre::Genre)dbIter.GetGenre(), specList, dbIter.GetDb(), report, pQueue ); + //If any sort of exception escapes the IC, make sure it goes in the report. + try + { uint32 icFlags = 0; icFlags |= ( mpData->mfLooseDirs ? cIntegrityCheck::FLAG_LOOSE_DIR : 0 ); icFlags |= ( mpData->mbResetAccessTime ? cIntegrityCheck::FLAG_ERASE_FOOTPRINTS_IC : 0 ); icFlags |= ( mpData->mbDirectIO ? cIntegrityCheck::FLAG_DIRECT_IO : 0 ); - - ic.Execute( icFlags ); - + + ic.Execute( icFlags ); + } + catch( eError& e ) + { + if( pQueue ) + pQueue->AddError(e); + } + catch( std::exception& e ) + { + if (pQueue ) + pQueue->AddError(eIC(e.what())); + } + catch(...) + { + if (pQueue ) + pQueue->AddError(eIC("Unknown")); + } + // put all display info into report cFCOReportGenreIter rgi( report ); rgi.SeekToGenre( (cGenre::Genre) dbIter.GetGenre() ); From eec812814ac972868cc695893bfb394a3fe9f65f Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 15 Jul 2017 18:10:42 -0700 Subject: [PATCH 023/110] Use RNG device(s) if available (experimental) --- config.h.in | 9 ++++++++ configure | 20 ++++++++++++++++++ configure.ac | 17 +++++++++++++++ src/twcrypto/crypto.cpp | 46 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+) diff --git a/config.h.in b/config.h.in index 387a1cd..5c22894 100644 --- a/config.h.in +++ b/config.h.in @@ -15,6 +15,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H +/* Has /dev/arandom */ +#undef HAVE_DEV_ARANDOM + +/* Has /dev/random */ +#undef HAVE_DEV_RANDOM + +/* Has /dev/urandom */ +#undef HAVE_DEV_URANDOM + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H diff --git a/configure b/configure index ea08168..8311cc7 100755 --- a/configure +++ b/configure @@ -6154,6 +6154,26 @@ done fi +if test -c "/dev/random"; then + +$as_echo "#define HAVE_DEV_RANDOM 1" >>confdefs.h + +fi + +if test -c "/dev/urandom"; then + +$as_echo "#define HAVE_DEV_URANDOM 1" >>confdefs.h + +fi + +if test -c "/dev/arandom"; then + +$as_echo "#define HAVE_DEV_ARANDOM 1" >>confdefs.h + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lc" >&5 $as_echo_n "checking for socket in -lc... " >&6; } if ${ac_cv_lib_c_socket+:} false; then : diff --git a/configure.ac b/configure.ac index 6678a78..b076cc8 100644 --- a/configure.ac +++ b/configure.ac @@ -133,6 +133,23 @@ then AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h) fi +dnl ############################################## +dnl check for various RNG/PRNG devices +dnl ############################################## + +if test -c "/dev/random"; then + AC_DEFINE(HAVE_DEV_RANDOM, [1], [Has /dev/random]) +fi + +if test -c "/dev/urandom"; then + AC_DEFINE(HAVE_DEV_URANDOM, [1], [Has /dev/urandom]) +fi + +if test -c "/dev/arandom"; then + AC_DEFINE(HAVE_DEV_ARANDOM, [1], [Has /dev/arandom]) +fi + + dnl ############################################## dnl Checks for various platform specific libraries dnl ############################################## diff --git a/src/twcrypto/crypto.cpp b/src/twcrypto/crypto.cpp index e673cfc..1eb5953 100644 --- a/src/twcrypto/crypto.cpp +++ b/src/twcrypto/crypto.cpp @@ -39,6 +39,7 @@ #include "core/errorgeneral.h" #include "time.h" #include "core/archive.h" +#include "core/usernotify.h" #include "cryptlib/sha.h" #include "cryptlib/rng.h" @@ -53,6 +54,11 @@ #include "cryptlib/rsa.h" #endif +#include +#include + +#define HAVE_DEVICE_RANDOM (HAVE_DEV_RANDOM || HAVE_DEV_URANDOM || HAVE_DEV_ARANDOM) + const uint32 EL_GAMAL_SIG_PUBLIC_MAGIC_NUM = 0x7ae2c945; const uint32 EL_GAMAL_SIG_PRIVATE_MAGIC_NUM = 0x0d0ffa12; @@ -1235,6 +1241,21 @@ cHashedKey192::~cHashedKey192() RandomizeBytes(mKey, KEYLEN); } + +static bool randomize_by_device(const char* device_name, int8* destbuf, int len) +{ + int dev_random = open("/dev/random", O_RDONLY|O_NONBLOCK); + if (dev_random >= 0) + { + int bytes_read = read(dev_random, destbuf, len); + close(dev_random); + if (bytes_read == len) + return true; + } + + return false; +} + /////////////////////////////////////////////////////////////////////////////// // void RandomizeBytes(byte* destbuf, int len) -- Fill a buffer with random bytes @@ -1242,6 +1263,30 @@ static bool gRandomizeBytesSeeded = false; void RandomizeBytes(int8* destbuf, int len) { +#if HAVE_DEVICE_RANDOM + +#if HAVE_DEV_RANDOM + if (randomize_by_device("/dev/random", destbuf, len)) + return; + + iUserNotify::GetInstance()->Notify( iUserNotify::V_NORMAL, "Could not read from /dev/random, falling back to /dev/urandom"); +#endif + +#if HAVE_DEV_URANDOM + if (randomize_by_device("/dev/urandom", destbuf, len)) + return; +#endif + +#if HAVE_DEV_ARANDOM + if (randomize_by_device("/dev/arandom", destbuf, len)) + return; +#endif + + ThrowAndAssert(eInternal(_T("Failed to read from any RNG devices"))); + +// TODO: OpenSSL or other impls that are better than the default one + +#else if (!gRandomizeBytesSeeded) { // generate a rancom number from processor timing. @@ -1267,5 +1312,6 @@ void RandomizeBytes(int8* destbuf, int len) int i; for (i = 0; i < len; ++i) destbuf[i] = (byte)( (rand() * 256 / RAND_MAX) ^ 0xdc ); // 0xdc came from random.org +#endif } From 60fede7678330739a2a797841219d72a40250489 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 15 Jul 2017 22:59:50 -0700 Subject: [PATCH 024/110] Tweak device random stuff for Linux --- src/twcrypto/crypto.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/twcrypto/crypto.cpp b/src/twcrypto/crypto.cpp index 1eb5953..72f8172 100644 --- a/src/twcrypto/crypto.cpp +++ b/src/twcrypto/crypto.cpp @@ -1241,37 +1241,34 @@ cHashedKey192::~cHashedKey192() RandomizeBytes(mKey, KEYLEN); } +///////////////////////////////////////////////////////// + +#if HAVE_DEVICE_RANDOM static bool randomize_by_device(const char* device_name, int8* destbuf, int len) { - int dev_random = open("/dev/random", O_RDONLY|O_NONBLOCK); - if (dev_random >= 0) + int rng_device = open(device_name, O_RDONLY|O_NONBLOCK); + if (rng_device >= 0) { - int bytes_read = read(dev_random, destbuf, len); - close(dev_random); + int bytes_read = read(rng_device, destbuf, len); + close(rng_device); if (bytes_read == len) - return true; + return true; } return false; } +#else +static bool gRandomizeBytesSeeded = false; +#endif /////////////////////////////////////////////////////////////////////////////// // void RandomizeBytes(byte* destbuf, int len) -- Fill a buffer with random bytes -static bool gRandomizeBytesSeeded = false; - void RandomizeBytes(int8* destbuf, int len) { #if HAVE_DEVICE_RANDOM -#if HAVE_DEV_RANDOM - if (randomize_by_device("/dev/random", destbuf, len)) - return; - - iUserNotify::GetInstance()->Notify( iUserNotify::V_NORMAL, "Could not read from /dev/random, falling back to /dev/urandom"); -#endif - #if HAVE_DEV_URANDOM if (randomize_by_device("/dev/urandom", destbuf, len)) return; @@ -1282,6 +1279,11 @@ void RandomizeBytes(int8* destbuf, int len) return; #endif +#if HAVE_DEV_RANDOM + if (randomize_by_device("/dev/random", destbuf, len)) + return; +#endif + ThrowAndAssert(eInternal(_T("Failed to read from any RNG devices"))); // TODO: OpenSSL or other impls that are better than the default one From 5757a53d6106012cbb93b9e435ac6ec343dc85aa Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 17 Jul 2017 22:35:17 -0700 Subject: [PATCH 025/110] Simplify urandom usage, & keep device open between uses --- src/twcrypto/crypto.cpp | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/twcrypto/crypto.cpp b/src/twcrypto/crypto.cpp index 72f8172..d856382 100644 --- a/src/twcrypto/crypto.cpp +++ b/src/twcrypto/crypto.cpp @@ -1244,16 +1244,18 @@ cHashedKey192::~cHashedKey192() ///////////////////////////////////////////////////////// #if HAVE_DEVICE_RANDOM - static bool randomize_by_device(const char* device_name, int8* destbuf, int len) { - int rng_device = open(device_name, O_RDONLY|O_NONBLOCK); + static int rng_device = -1; + + if (-1 == rng_device) + rng_device = open(device_name, O_RDONLY|O_NONBLOCK); + if (rng_device >= 0) { int bytes_read = read(rng_device, destbuf, len); - close(rng_device); if (bytes_read == len) - return true; + return true; } return false; @@ -1267,27 +1269,11 @@ static bool gRandomizeBytesSeeded = false; void RandomizeBytes(int8* destbuf, int len) { -#if HAVE_DEVICE_RANDOM - #if HAVE_DEV_URANDOM if (randomize_by_device("/dev/urandom", destbuf, len)) return; -#endif - -#if HAVE_DEV_ARANDOM - if (randomize_by_device("/dev/arandom", destbuf, len)) - return; -#endif - -#if HAVE_DEV_RANDOM - if (randomize_by_device("/dev/random", destbuf, len)) - return; -#endif - - ThrowAndAssert(eInternal(_T("Failed to read from any RNG devices"))); - -// TODO: OpenSSL or other impls that are better than the default one + ThrowAndAssert(eInternal(_T("Failed to read from RNG device"))); #else if (!gRandomizeBytesSeeded) { From 148a5e38d47753c807c27e2a84f2e0cda3f9a57d Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 19 Jul 2017 23:02:13 -0700 Subject: [PATCH 026/110] A bit more urandom cleanup --- src/twcrypto/crypto.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/twcrypto/crypto.cpp b/src/twcrypto/crypto.cpp index d856382..a5efe74 100644 --- a/src/twcrypto/crypto.cpp +++ b/src/twcrypto/crypto.cpp @@ -57,8 +57,6 @@ #include #include -#define HAVE_DEVICE_RANDOM (HAVE_DEV_RANDOM || HAVE_DEV_URANDOM || HAVE_DEV_ARANDOM) - const uint32 EL_GAMAL_SIG_PUBLIC_MAGIC_NUM = 0x7ae2c945; const uint32 EL_GAMAL_SIG_PRIVATE_MAGIC_NUM = 0x0d0ffa12; @@ -1243,7 +1241,7 @@ cHashedKey192::~cHashedKey192() ///////////////////////////////////////////////////////// -#if HAVE_DEVICE_RANDOM +#if HAVE_DEV_URANDOM static bool randomize_by_device(const char* device_name, int8* destbuf, int len) { static int rng_device = -1; From 24dba1b37410532492ead8f2f18a6280a1b2caf9 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 28 Jul 2017 20:15:50 -0700 Subject: [PATCH 027/110] Remove or disable a little dead code uncovered by gcov --- src/core/archive.cpp | 22 ---------------------- src/core/cmdlineparser.cpp | 4 ++-- src/core/cmdlineparser.h | 2 +- src/core/stringutil.h | 5 +++-- src/tw/twutil.cpp | 5 +---- 5 files changed, 7 insertions(+), 31 deletions(-) diff --git a/src/core/archive.cpp b/src/core/archive.cpp index d0f3310..45e388e 100644 --- a/src/core/archive.cpp +++ b/src/core/archive.cpp @@ -51,28 +51,6 @@ #include "corestrings.h" // for: STR_ERR2_ARCH_CRYPTO_ERR -//============================================================================= -// Utility Functions -//============================================================================= - -/////////////////////////////////////////////////////////////////////////////// -// util_IsDir -- returns true if a given file is a directory -/////////////////////////////////////////////////////////////////////////////// -bool util_IsDir( const TSTRING& fileName ) -{ - cFSStatArgs s; - try - { - iFSServices::GetInstance()->Stat( fileName, s ); - } - catch( eFSServices ) - { - return false; - } - - return( s.mFileType == cFSStatArgs::TY_DIR ); -} - //============================================================================= // eArchiveCrypto //============================================================================= diff --git a/src/core/cmdlineparser.cpp b/src/core/cmdlineparser.cpp index 3030a2c..4ddc30d 100644 --- a/src/core/cmdlineparser.cpp +++ b/src/core/cmdlineparser.cpp @@ -78,14 +78,14 @@ void cCmdLineParser::AddArg(int argId, const TSTRING& arg, const TSTRING& alias, /////////////////////////////////////////////////////////////////////////////// // Clear /////////////////////////////////////////////////////////////////////////////// -void cCmdLineParser::Clear() +/*void cCmdLineParser::Clear() { mLastArgInfo.mId = -1; mLastArgInfo.mNumParams = PARAM_INVALID; mArgTable.Clear(); mArgData.clear(); mMutExList.clear(); -} +}*/ /////////////////////////////////////////////////////////////////////////////// // Parse diff --git a/src/core/cmdlineparser.h b/src/core/cmdlineparser.h index 43105f4..b9d0a40 100644 --- a/src/core/cmdlineparser.h +++ b/src/core/cmdlineparser.h @@ -132,7 +132,7 @@ public: // the input was invalid in some way; the actual error can be determined by calling // GetErrorInfo() below. - void Clear(); +// void Clear(); // clear out all information that this class contains bool LookupArgInfo(int argId, TSTRING& arg, TSTRING& alias) const; diff --git a/src/core/stringutil.h b/src/core/stringutil.h index 43c189a..003e035 100644 --- a/src/core/stringutil.h +++ b/src/core/stringutil.h @@ -114,6 +114,7 @@ namespace cStringUtil wc16_string TstrToWstr( const TSTRING& tstr ); // convert a TSTRING to a wc16_string + template void splitstring(IterT& iter, const TSTRING& str, @@ -146,7 +147,7 @@ namespace cStringUtil }//cStringUtil:: - +/* //----------------------------------------------------------------------------- // push_back_string // @@ -199,7 +200,7 @@ namespace std } }; } - +*/ #endif//__STRINGUTIL_H diff --git a/src/tw/twutil.cpp b/src/tw/twutil.cpp index 96214cd..5bcdb39 100644 --- a/src/tw/twutil.cpp +++ b/src/tw/twutil.cpp @@ -64,20 +64,17 @@ #include "tw/twerrors.h" #include "core/ntmbs.h" #include "core/displayencoder.h" +#include "core/tw_signal.h" #ifdef TW_PROFILE #include "core/tasktimer.h" #endif -#include "core/fsservices.h" // for the util_IsDir() stuff - #include #include #if SUPPORTS_TERMIOS # include # include - -#include "core/tw_signal.h" int _getch(void); #endif From d8e323e18615bccacf433340944e007f9ed5a9f1 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 31 Jul 2017 18:49:36 -0700 Subject: [PATCH 028/110] Rename 2038 epoch check to something more accurate & less alarming than 'TimeBombExploded' (sheesh), and only bother with it if time_t is 32 bits. --- config.h.in | 3 +++ configure | 33 +++++++++++++++++++++++++ configure.ac | 1 + src/core/Makefile.am | 10 ++++---- src/core/Makefile.in | 20 ++++++++-------- src/core/{timebomb.cpp => epoch.cpp} | 36 +++++++--------------------- src/core/{timebomb.h => epoch.h} | 10 ++++---- src/siggen/siggenmain.cpp | 4 ++-- src/tripwire/tripwiremain.cpp | 4 ++-- src/twadmin/twadminmain.cpp | 4 ++-- src/twprint/twprintmain.cpp | 4 ++-- 11 files changed, 73 insertions(+), 56 deletions(-) rename src/core/{timebomb.cpp => epoch.cpp} (74%) rename src/core/{timebomb.h => epoch.h} (91%) diff --git a/config.h.in b/config.h.in index 5c22894..f7c8937 100644 --- a/config.h.in +++ b/config.h.in @@ -174,6 +174,9 @@ /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG +/* The size of `time_t', as computed by sizeof. */ +#undef SIZEOF_TIME_T + /* Don't use gethostbyname() on Solaris */ #undef SOLARIS_NO_GETHOSTBYNAME diff --git a/configure b/configure index 8311cc7..3052a28 100755 --- a/configure +++ b/configure @@ -6058,6 +6058,39 @@ cat >>confdefs.h <<_ACEOF _ACEOF +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 +$as_echo_n "checking size of time_t... " >&6; } +if ${ac_cv_sizeof_time_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_time_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (time_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_time_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5 +$as_echo "$ac_cv_sizeof_time_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_TIME_T $ac_cv_sizeof_time_t +_ACEOF + + $as_echo "#define USES_1S_COMPLEMENT 0" >>confdefs.h diff --git a/configure.ac b/configure.ac index b076cc8..f5a55ca 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,7 @@ AC_C_BIGENDIAN AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) +AC_CHECK_SIZEOF(time_t) dnl All platforms we support use 2's complement, are byte aligned, etc... AC_DEFINE(USES_1S_COMPLEMENT, 0, [Uses one's complement]) diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 484e642..0a47f0e 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -9,25 +9,25 @@ libcore_a_SOURCES = \ archive.cpp charutil.cpp \ cmdlineparser.cpp codeconvert.cpp core.cpp coreerrors.cpp \ corestrings.cpp crc32.cpp debug.cpp displayencoder.cpp \ - displayutil.cpp error.cpp errorbucketimpl.cpp errortable.cpp \ + displayutil.cpp epoch.cpp error.cpp errorbucketimpl.cpp errortable.cpp \ errorutil.cpp fileerror.cpp fileheader.cpp fsservices.cpp \ growheap.cpp hashtable.cpp haval.cpp msystem.cpp ntmbs.cpp \ refcountobj.cpp serializable.cpp serializer.cpp \ serializerimpl.cpp serializerutil.cpp serstring.cpp \ srefcountobj.cpp srefcounttbl.cpp stdcore.cpp stringutil.cpp \ - timebomb.cpp timeconvert.cpp tw_signal.cpp twlimits.cpp twlocale.cpp \ + timeconvert.cpp tw_signal.cpp twlimits.cpp twlocale.cpp \ unixexcept.cpp usernotify.cpp usernotifystdout.cpp \ wchar16.cpp libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \ core.h coreerrors.h corestrings.h crc32.h debug.h displayencoder.h \ - displayutil.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \ + displayutil.h epoch.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \ errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \ fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \ - ntmbs.h package.h platform.h refcountobj.h resources.h \ + ntmbs.h package.h platform.h refcountobj.h resources.h \ serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \ sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \ - tchar.h timebomb.h timeconvert.h tw_signal.h twlimits.h twlocale.h \ + tchar.h timeconvert.h tw_signal.h twlimits.h twlocale.h \ twstringslang.h typed.h types.h unixexcept.h unixfsservices.h upperbound.h \ usernotify.h usernotifystdout.h wchar16.h diff --git a/src/core/Makefile.in b/src/core/Makefile.in index 858721f..694e8f0 100644 --- a/src/core/Makefile.in +++ b/src/core/Makefile.in @@ -113,8 +113,8 @@ am_libcore_a_OBJECTS = file_unix.$(OBJEXT) unixfsservices.$(OBJEXT) \ archive.$(OBJEXT) charutil.$(OBJEXT) cmdlineparser.$(OBJEXT) \ codeconvert.$(OBJEXT) core.$(OBJEXT) coreerrors.$(OBJEXT) \ corestrings.$(OBJEXT) crc32.$(OBJEXT) debug.$(OBJEXT) \ - displayencoder.$(OBJEXT) displayutil.$(OBJEXT) error.$(OBJEXT) \ - errorbucketimpl.$(OBJEXT) errortable.$(OBJEXT) \ + displayencoder.$(OBJEXT) displayutil.$(OBJEXT) epoch.$(OBJEXT) \ + error.$(OBJEXT) errorbucketimpl.$(OBJEXT) errortable.$(OBJEXT) \ errorutil.$(OBJEXT) fileerror.$(OBJEXT) fileheader.$(OBJEXT) \ fsservices.$(OBJEXT) growheap.$(OBJEXT) hashtable.$(OBJEXT) \ haval.$(OBJEXT) msystem.$(OBJEXT) ntmbs.$(OBJEXT) \ @@ -122,9 +122,9 @@ am_libcore_a_OBJECTS = file_unix.$(OBJEXT) unixfsservices.$(OBJEXT) \ serializer.$(OBJEXT) serializerimpl.$(OBJEXT) \ serializerutil.$(OBJEXT) serstring.$(OBJEXT) \ srefcountobj.$(OBJEXT) srefcounttbl.$(OBJEXT) \ - stdcore.$(OBJEXT) stringutil.$(OBJEXT) timebomb.$(OBJEXT) \ - timeconvert.$(OBJEXT) tw_signal.$(OBJEXT) twlimits.$(OBJEXT) \ - twlocale.$(OBJEXT) unixexcept.$(OBJEXT) usernotify.$(OBJEXT) \ + stdcore.$(OBJEXT) stringutil.$(OBJEXT) timeconvert.$(OBJEXT) \ + tw_signal.$(OBJEXT) twlimits.$(OBJEXT) twlocale.$(OBJEXT) \ + unixexcept.$(OBJEXT) usernotify.$(OBJEXT) \ usernotifystdout.$(OBJEXT) wchar16.$(OBJEXT) libcore_a_OBJECTS = $(am_libcore_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) @@ -334,25 +334,25 @@ libcore_a_SOURCES = \ archive.cpp charutil.cpp \ cmdlineparser.cpp codeconvert.cpp core.cpp coreerrors.cpp \ corestrings.cpp crc32.cpp debug.cpp displayencoder.cpp \ - displayutil.cpp error.cpp errorbucketimpl.cpp errortable.cpp \ + displayutil.cpp epoch.cpp error.cpp errorbucketimpl.cpp errortable.cpp \ errorutil.cpp fileerror.cpp fileheader.cpp fsservices.cpp \ growheap.cpp hashtable.cpp haval.cpp msystem.cpp ntmbs.cpp \ refcountobj.cpp serializable.cpp serializer.cpp \ serializerimpl.cpp serializerutil.cpp serstring.cpp \ srefcountobj.cpp srefcounttbl.cpp stdcore.cpp stringutil.cpp \ - timebomb.cpp timeconvert.cpp tw_signal.cpp twlimits.cpp twlocale.cpp \ + timeconvert.cpp tw_signal.cpp twlimits.cpp twlocale.cpp \ unixexcept.cpp usernotify.cpp usernotifystdout.cpp \ wchar16.cpp libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \ core.h coreerrors.h corestrings.h crc32.h debug.h displayencoder.h \ - displayutil.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \ + displayutil.h epoch.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \ errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \ fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \ - ntmbs.h package.h platform.h refcountobj.h resources.h \ + ntmbs.h package.h platform.h refcountobj.h resources.h \ serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \ sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \ - tchar.h timebomb.h timeconvert.h tw_signal.h twlimits.h twlocale.h \ + tchar.h timeconvert.h tw_signal.h twlimits.h twlocale.h \ twstringslang.h typed.h types.h unixexcept.h unixfsservices.h upperbound.h \ usernotify.h usernotifystdout.h wchar16.h diff --git a/src/core/timebomb.cpp b/src/core/epoch.cpp similarity index 74% rename from src/core/timebomb.cpp rename to src/core/epoch.cpp index cfe0378..0c0e5ad 100644 --- a/src/core/timebomb.cpp +++ b/src/core/epoch.cpp @@ -30,44 +30,21 @@ // info@tripwire.org or www.tripwire.org. // /////////////////////////////////////////////////////////////////////////////// -// timebomb.h +// epoch.h #include "stdcore.h" -#include "timebomb.h" +#include "epoch.h" #include #include #include "timeconvert.h" #include "corestrings.h" /////////////////////////////////////////////////////////////////////////////// -// TimeBombExploded() -- Call from main(). Prints out timebomb message and -// returns true if main() should exit. -// -bool TimeBombExploded() +bool CheckEpoch() { +#if SIZEOF_TIME_T == 4 + struct tm time_struct; - /* - memset(&time_struct, 0, sizeof(time_struct)); - time_struct.tm_mday = 25; - time_struct.tm_mon = 0; - time_struct.tm_year = 99; - int64 begin = cTimeUtil::DateToTime( &time_struct ); - - memset(&time_struct, 0, sizeof(time_struct)); - time_struct.tm_mday = 1; - time_struct.tm_mon = 4; - time_struct.tm_year = 99; - int64 end = cTimeUtil::DateToTime( &time_struct ); - - int64 now = time(0); - - if (now < begin || now > end) - { - std::cerr << "This beta version of Tripwire(R) has expired.\n"; - return true; - } - */ - // Many functions will fail as we approach the end of the epoch // Rather than crashing, we will exit with a nice message memset(&time_struct, 0, sizeof(time_struct)); @@ -83,5 +60,8 @@ bool TimeBombExploded() } return false; +#else + return false; +#endif } diff --git a/src/core/timebomb.h b/src/core/epoch.h similarity index 91% rename from src/core/timebomb.h rename to src/core/epoch.h index 71ee3a1..53cfd6d 100644 --- a/src/core/timebomb.h +++ b/src/core/epoch.h @@ -30,16 +30,16 @@ // info@tripwire.org or www.tripwire.org. // /////////////////////////////////////////////////////////////////////////////// -// timebomb.h +// epoch.h -#ifndef __TIMEBOMB_H -#define __TIMEBOMB_H +#ifndef __EPOCH_H +#define __EPOCH_H /////////////////////////////////////////////////////////////////////////////// -// TimeBombExploded() -- Call from main(). Prints out timebomb message and +// CheckEpoch() -- Call from main(). Prints out timebomb message and // returns true if main() should exit. // -bool TimeBombExploded(); +bool CheckEpoch(); #endif diff --git a/src/siggen/siggenmain.cpp b/src/siggen/siggenmain.cpp index c975a89..94ca8a4 100644 --- a/src/siggen/siggenmain.cpp +++ b/src/siggen/siggenmain.cpp @@ -43,7 +43,7 @@ #include "core/cmdlineparser.h" #include "core/errorbucketimpl.h" #include "core/usernotifystdout.h" -#include "core/timebomb.h" +#include "core/epoch.h" #include "fs/fsstrings.h" #include "tw/twstrings.h" #include "tw/twutil.h" // for cTWUtil::PrintErrorMsg @@ -104,7 +104,7 @@ int __cdecl _tmain(int argc, const TCHAR** argv) { int ret = 0; - if (TimeBombExploded()) + if (CheckEpoch()) return 1; try diff --git a/src/tripwire/tripwiremain.cpp b/src/tripwire/tripwiremain.cpp index 25d8678..b9d68ba 100644 --- a/src/tripwire/tripwiremain.cpp +++ b/src/tripwire/tripwiremain.cpp @@ -43,7 +43,7 @@ #include "tw/configfile.h" #include "core/errorbucketimpl.h" #include "core/usernotifystdout.h" -#include "core/timebomb.h" +#include "core/epoch.h" #include // for auto_ptr / unique_ptr #include #include @@ -107,7 +107,7 @@ void tw_unexpected_handler() int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] ) { - if (TimeBombExploded()) + if (CheckEpoch()) return 8; int ret = 0; diff --git a/src/twadmin/twadminmain.cpp b/src/twadmin/twadminmain.cpp index b8f18a0..7ee97c7 100644 --- a/src/twadmin/twadminmain.cpp +++ b/src/twadmin/twadminmain.cpp @@ -42,7 +42,7 @@ #include "tw/twutil.h" #include "tw/twstrings.h" #include "twadminstrings.h" -#include "core/timebomb.h" +#include "core/epoch.h" #include "core/errorbucketimpl.h" #include "core/archive.h" @@ -73,7 +73,7 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] ) int ret = 0; - if (TimeBombExploded()) + if (CheckEpoch()) return 1; cTWInit twInit; diff --git a/src/twprint/twprintmain.cpp b/src/twprint/twprintmain.cpp index 4b4531c..e7ffa4a 100644 --- a/src/twprint/twprintmain.cpp +++ b/src/twprint/twprintmain.cpp @@ -42,7 +42,7 @@ #include "core/cmdlineparser.h" #include "core/errorbucketimpl.h" #include "core/usernotifystdout.h" -#include "core/timebomb.h" +#include "core/epoch.h" #include "core/debug.h" @@ -81,7 +81,7 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ] ) int ret = 0; - if (TimeBombExploded()) + if (CheckEpoch()) return 1; cTWInit twInit; From a6c796a501477a4fb885d0329c280508109fa787 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 3 Aug 2017 23:35:53 -0700 Subject: [PATCH 029/110] Add new twadmin & twprint test-harness tests, to exercise modes, options & errors that aren't covered elsewhere. Update twtools module with additional methods these new tests need. --- src/test-harness/tests/twadmin.pm | 413 ++++++++++++++++++++++++++++++ src/test-harness/tests/twprint.pm | 282 ++++++++++++++++++++ src/test-harness/twtools.pm | 69 ++++- 3 files changed, 757 insertions(+), 7 deletions(-) create mode 100644 src/test-harness/tests/twadmin.pm create mode 100644 src/test-harness/tests/twprint.pm diff --git a/src/test-harness/tests/twadmin.pm b/src/test-harness/tests/twadmin.pm new file mode 100644 index 0000000..6fe6050 --- /dev/null +++ b/src/test-harness/tests/twadmin.pm @@ -0,0 +1,413 @@ + +use twtools; + +package twadmin; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + $description = "twadmin test"; +} + + +###################################################################### +# Return the policy file text for this test... +# +sub getPolicyFileString { + + return < +S; + + +EOT + +} + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { + + my $twstr = getPolicyFileString(); + twtools::GeneratePolicyFile($twstr); + +} + +sub runTests() { + + +} + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + + ######################################################### + # + # print-policy & print-config variants + # + + twtools::PrintConfig(); + if ( $? != 0 ) { + twtools::logStatus("base print-cfgfile failed, error = $?\n"); + $twpassed = 0; + } + + twtools::PrintConfig(opts => "--verbose"); + if ( $? != 0 ) { + twtools::logStatus("print-cfgfile --verbose failed, error = $?\n"); + $twpassed = 0; + } + + twtools::PrintConfig(opts => "--silent"); + if ( $? != 0 ) { + twtools::logStatus("print-cfgfile --silent failed\, error = $?n"); + $twpassed = 0; + } + + twtools::PrintPolicy(); + if ( $? != 0 ) { + twtools::logStatus("base print-polfile failed, error = $?\n"); + $twpassed = 0; + } + + twtools::PrintPolicy(opts => "--verbose"); + if ( $? != 0 ) { + twtools::logStatus("print-polfile --verbose failed, error = $?\n"); + $twpassed = 0; + } + + twtools::PrintPolicy(opts => "--silent"); + if ( $? != 0 ) { + twtools::logStatus("print-polfile --silent failed, error = $?\n"); + $twpassed = 0; + } + + ######################################################### + # + # Now try misc help & version options + # + twtools::logStatus(`$twtools::twrootdir/bin/twadmin 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin, no args failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --asdf failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin -?`); + if ( $? != 256 ) { + twtools::logStatus("twadmin -? failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --help all`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --help all failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --help f p`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --help d r failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --help asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --help asdf failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --asdf --help 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --help --asdf failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin -m failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m Z 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin -m Z failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m -m 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin -m -m failed\n"); + $twpassed = 0; + } + + ######################################################### + # + # Various missing files + # + twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m P 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-polfile --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m P nope.txt 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-polfile --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m P -c nope.cfg nope.txt 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-polfile --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m P -S site.nope nope.txt 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-polfile --help failed\n"); + $twpassed = 0; + } + + + ######################################################### + # + # Per-mode help & errors + # + + # create-polfile + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-polfile --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-polfile --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-polfile --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --help --create-polfile --verbose --silent failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-polfile --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-polfile --asdf failed\n"); + $twpassed = 0; + } + + + # create-cfgfile + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-cfgfile --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-cfgfile --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-cfgfile --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-cfgfile --verbose --silent failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-cfgfile --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --create-cfgfile --asdf failed\n"); + $twpassed = 0; + } + + + # print-polfile + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-polfile --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --print-polfile --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-polfile --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --print-polfile --verbose --silent failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-polfile --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --print-polfile --asdf failed\n"); + $twpassed = 0; + } + + + # print-cfgfile + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-cfgfile --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --print-cfgfile --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-cfgfile --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --print-cfgfile --verbose --silent failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-cfgfile --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --print-cfgfile --asdf failed\n"); + $twpassed = 0; + } + + + # encrypt + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --encrypt --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --encrypt --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --encrypt --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --encrypt --verbose --silent failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --encrypt --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --encrypt --asdf failed\n"); + $twpassed = 0; + } + + + # remove-encryption + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --remove-encryption --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --remove-encryption --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --remove-encryption --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --remove-encryption --verbose --silent failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --remove-encryption --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --remove-encryption --asdf failed\n"); + $twpassed = 0; + } + + + # examine + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --examine --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --examine --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --examine --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --examine --verbose --silent failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --examine --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --examine --asdf failed\n"); + $twpassed = 0; + } + + + # generate-keys + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --generate-keys --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --generate-keys --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --generate-keys --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --generate-keys --verbose --silent failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --generate-keys--asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --generate-keys--asdf failed\n"); + $twpassed = 0; + } + + # change-passphrases + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases --help`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --change-passphrases --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases --verbose --silent 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --change-passphrases --verbose --silent` failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twadmin --change-passphrases --asdf failed\n"); + $twpassed = 0; + } + + + ######################################################### + # + # Version + # + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --version`); + if ( $? != 0 ) { + twtools::logStatus("twadmin --version failed\n"); + $twpassed = 0; + } + + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + } +} + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1; diff --git a/src/test-harness/tests/twprint.pm b/src/test-harness/tests/twprint.pm new file mode 100644 index 0000000..7c7fda0 --- /dev/null +++ b/src/test-harness/tests/twprint.pm @@ -0,0 +1,282 @@ + +use twtools; + +package twprint; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + + %TESTS = ( + + "twprintInit" => { + + changeFunc => \&twtools::MakeBigger, + createFunc => \&twtools::CreateFile, + file => "printme.txt", + perms => "a+w", + contents => "testing", + violations => "V:1 S:0 A:0 R:0 C:1" + }, + ); + + + $description = "twprint test"; +} + + +###################################################################### +# Return the policy file text for this test... +# +sub getPolicyFileString { + + return < +S; + + +EOT + +} + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { + + my $twstr = getPolicyFileString(); + twtools::GeneratePolicyFile($twstr); + +} + + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + ######################################################### + # + # Run a check first, to set up for twprint exercises + # + $twpassed = twtools::RunIntegrityTests(%TESTS); + + + + ######################################################### + # + # Now run thru the valid report levels & verify return codes + # TODO: look for expected result in various report levels + + twtools::RunReport({ report-level => 0 }); + if ( $? != 0 ) { + twtools::logStatus("level 0 report failed\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => 1 }); + if ( $? != 0 ) { + twtools::logStatus("level 1 report failed\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => 2 }); + if ( $? != 0 ) { + twtools::logStatus("level 2 report failed\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => 3 }); + if ( $? != 0 ) { + twtools::logStatus("level 3 report failed\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => 4 }); + if ( $? != 0 ) { + twtools::logStatus("level 4 report failed\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => "4 --verbose --hexadecimal" }); + if ( $? != 0 ) { + twtools::logStatus("level 4 report (verbose, hex) failed\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => "4 --silent" }); + if ( $? != 0 ) { + twtools::logStatus("level 4 report (silent) failed\n"); + $twpassed = 0; + } + + ######################################################### + # + # Now some failure cases, to verify they fail + # + twtools::RunReport({ report-level => 5 }); + if ( $? != 256 ) { + twtools::logStatus("nonexistent level 5 report failed, result = $?\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => "asdf" }); + if ( $? != 256 ) { + twtools::logStatus("nonexistent level 'asdf' report failed, result = $?\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => "0 --help" }); + if ( $? != 256 ) { + twtools::logStatus("print-report help mode failed, result = $?\n"); + $twpassed = 0; + } + + twtools::RunReport({ report-level => "4 --verbose --silent" }); + if ( $? != 256 ) { + twtools::logStatus("print-report verbose vs silent failed, result = $?\n"); + $twpassed = 0; + } + + ######################################################### + # + # Now try db printing + # + twtools::RunDbPrint(); + if ( $? != 0 ) { + twtools::logStatus("db print failed\n"); + $twpassed = 0; + } + + twtools::RunDbPrint({ db-object-list => "$twtools::twrootdir/printme.txt" }); + if ( $? != 0 ) { + twtools::logStatus("db print failed\n"); + $twpassed = 0; + } + + twtools::RunDbPrint({ db-object-list => "$twtools::twrootdir/nonexistent.vbs" }); + if ( $? != 0 ) { + twtools::logStatus("db print failed\n"); + $twpassed = 0; + } + + ######################################################### + # + # Now try misc help & version options + # + twtools::logStatus(`$twtools::twrootdir/bin/twprint 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twprint, no args failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twprint --asdf failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --help`); + if ( $? != 256 ) { + twtools::logStatus("twprint --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint -?`); + if ( $? != 256 ) { + twtools::logStatus("twprint -? failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --help all`); + if ( $? != 256 ) { + twtools::logStatus("twprint --help all failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --help d r`); + if ( $? != 256 ) { + twtools::logStatus("twprint --help d r failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --help asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twprint --help asdf failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --asdf --help 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twprint --help --asdf failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --print-dbfile --help`); + if ( $? != 256 ) { + twtools::logStatus("twprint --help --print-dbfile failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --print-report --help `); + if ( $? != 256 ) { + twtools::logStatus("twprint --help --print-reportfile failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint -m Z 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twprint -m Z failed\n"); + $twpassed = 0; + } + + + twtools::logStatus(`$twtools::twrootdir/bin/twprint -m 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twprint -m failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint -m -m 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("twprint -m -m failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twprint --version`); + if ( $? != 0 ) { + twtools::logStatus("twprint --version failed\n"); + $twpassed = 0; + } + + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + } +} + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1; diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 0959290..745bd65 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -210,6 +210,43 @@ sub RemoveEncryption { } +###################################################################### +# Print polfile +# + +sub PrintPolicy { + + my (%params) = %{$_[0]}; + logStatus "printing policy file...\n"; + + my (@out) = `$twrootdir/bin/twadmin -m p -c $twrootdir/$twcfgloc -p $twrootdir/$twpolfileloc -S $twrootdir/$twsitekeyloc $params{opts} 2>&1`; + + my ($result) = ${^CHILD_ERROR_NATIVE}; + + logStatus(@out); + + return $result; +} + +###################################################################### +# Print polfile +# + +sub PrintConfig { + + my (%params) = %{$_[0]}; + + logStatus "printing config file...\n"; + my (@out) = `$twrootdir/bin/twadmin -m f -c $twrootdir/$twcfgloc $params{opts} 2>&1`; + + my ($result) = ${^CHILD_ERROR_NATIVE}; + + logStatus(@out); + + return $result; +} + + ###################################################################### # Write policy text to disk... Note the contents # of the policy file are passed in as '$twstr'. @@ -286,21 +323,39 @@ sub UpdatePolicy { } +###################################################################### +# Use twprint to get a report of specified level (default 0) and return +# that. +# +sub RunReport { + + my (%params) = %{$_[0]}; + + $params{report} = $reportloc if( ! defined($params{report}) ); + $params{report-level} = 0 if( ! defined($params{report-level}) ); + #$params{report-object-list} = "" if( ! defined($params{report-object-list}) ); + + my (@out) = `$twrootdir/bin/twprint -m r -c $twrootdir/$twcfgloc -t $params{report-level} -r $params{report} 2>&1`; + logStatus(@out); + + return @out; + +} + ###################################################################### # Use twprint to get a report level 0 report and return # that. # -sub RunReport(%) { +sub RunDbPrint { - my (%params) = %{$_[0]}; - $params{report} = $reportloc if( ! defined($params{report}) ); + my (%params) = %{$_[0]}; + $params{db-object-list} = "" if( ! defined($params{db-object-list}) ); - my (@out) = `$twrootdir/bin/twprint -m r -c $twrootdir/$twcfgloc -t 0 -r $params{report}`; + my (@out) = `$twrootdir/bin/twprint -m d -c $twrootdir/$twcfgloc $params{db-object-list} 2>&1`; - logStatus(@out); - - return @out; + logStatus(@out); + return @out; } From 121ccea9b523484003a5290c16f0227748653ec4 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 4 Aug 2017 00:16:43 -0700 Subject: [PATCH 030/110] Add a siggen test-harness test to cover various options that aren't covered elsewhere. Like the twadmin & twprint tests added in the last commit, this was motivated by gcov results showing that a 'make check' was missing a bunch of code paths, particularly around command line args and error handling. --- src/test-harness/tests/siggen.pm | 143 +++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 src/test-harness/tests/siggen.pm diff --git a/src/test-harness/tests/siggen.pm b/src/test-harness/tests/siggen.pm new file mode 100644 index 0000000..de159f3 --- /dev/null +++ b/src/test-harness/tests/siggen.pm @@ -0,0 +1,143 @@ + +use twtools; + +package siggen; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + $description = "siggen test"; +} + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { + +} + + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + + twtools::logStatus(`ps -ef > $twtools::twrootdir/hashme.txt`); + if ( $? != 0 ) { + twtools::logStatus("test file creation failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`mkfifo $twtools::twrootdir/donthashme.fifo`); + if ( $? != 0 ) { + twtools::logStatus("test fifo creation failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen`); + if ( $? != 256 ) { + twtools::logStatus("no-args siggen failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen -h -t -a`); + if ( $? != 256 ) { + twtools::logStatus("no-args siggen failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen --help`); + if ( $? != 256 ) { + twtools::logStatus("siggen --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen --version`); + if ( $? != 0 ) { + twtools::logStatus("siggen --version failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen --asdf 2>&1`); + if ( $? != 256 ) { + twtools::logStatus("siggen --asdf failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen $twtools::twrootdir/hashme.txt`); + if ( $? != 0 ) { + twtools::logStatus("siggen hashme.txt failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen -a $twtools::twrootdir/hashme.txt`); + if ( $? != 0 ) { + twtools::logStatus("siggen -a hashme.txt failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen -h -t -a $twtools::twrootdir/hashme.txt`); + if ( $? != 0 ) { + twtools::logStatus("siggen -h -t -a hashme.txt failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen -a $twtools::twrootdir/donthashme.fifo`); + if ( $? != 256 ) { + twtools::logStatus("siggen -a donthashme.fifo failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen -h -t -a $twtools::twrootdir/donthashme.fifo`); + if ( $? != 256 ) { + twtools::logStatus("siggen -h -t -a donthashme.fifo failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen -a $twtools::twrootdir/no-existe.txt`); + if ( $? != 256 ) { + twtools::logStatus("siggen -a no-existe.txt failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/siggen -h -t -a $twtools::twrootdir/no-existe.txt`); + if ( $? != 256 ) { + twtools::logStatus("siggen -h -t -a no-existe.txt failed\n"); + $twpassed = 0; + } + + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + return 0; + } +} + + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1; From db60f15f23ec166d81b3c6ac1c5741f38dbe2799 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 4 Aug 2017 23:14:54 -0700 Subject: [PATCH 031/110] Fix misspelling of 'UNKNOWN' in a constant name; add a missing bracket in twprint print-db mode help --- src/tripwire/twcmdline.cpp | 2 +- src/tw/twstrings.cpp | 2 +- src/tw/twstrings.h | 2 +- src/twprint/twprintcmdline.cpp | 2 +- src/twprint/twprintstrings.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index a587b57..3db01b8 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -172,7 +172,7 @@ iTWMode* cTWCmdLine::GetMode(int argc, const TCHAR *const * argv) // unknown mode switch cDebug d("cTWCmdLine::GetMode"); d.TraceError(_T("Error: Bad mode switch: %s\n"), pcMode); - TCERR << TSS_GetString( cTW, tw::STR_UNKOWN_MODE_SPECIFIED) + TCERR << TSS_GetString( cTW, tw::STR_UNKNOWN_MODE_SPECIFIED) << pcMode << std::endl << TSS_GetString( cTW, tw::STR_GET_HELP) << std::endl; return NULL; diff --git a/src/tw/twstrings.cpp b/src/tw/twstrings.cpp index f30564a..0e243f6 100644 --- a/src/tw/twstrings.cpp +++ b/src/tw/twstrings.cpp @@ -111,7 +111,7 @@ TSS_BeginStringtable( cTW ) TSS_StringEntry( tw::STR_NEWLINE, _T("\n")), TSS_StringEntry( tw::STR_ERR_TWCFG_CANT_READ, _T("Configuration file could not be read.")), TSS_StringEntry( tw::STR_ERR_NO_MODE, _T("No mode specified.")), - TSS_StringEntry( tw::STR_UNKOWN_MODE_SPECIFIED, _T("Unknown mode specified: ")), + TSS_StringEntry( tw::STR_UNKNOWN_MODE_SPECIFIED, _T("Unknown mode specified: ")), TSS_StringEntry( tw::STR_ERR2_BAD_MODE_SWITCH, _T("Unrecognized mode: ")), TSS_StringEntry( tw::STR_OPEN_POLICY_FILE, _T("Opening policy file: ")), diff --git a/src/tw/twstrings.h b/src/tw/twstrings.h index 93d3804..8822f0b 100644 --- a/src/tw/twstrings.h +++ b/src/tw/twstrings.h @@ -58,7 +58,7 @@ TSS_BeginStringIds( tw ) STR_NEWLINE, STR_ERR_TWCFG_CANT_READ, STR_ERR_NO_MODE, - STR_UNKOWN_MODE_SPECIFIED, + STR_UNKNOWN_MODE_SPECIFIED, STR_ERR2_BAD_MODE_SWITCH, STR_PARSING_POLICY, STR_ERR_REPORT_READ, diff --git a/src/twprint/twprintcmdline.cpp b/src/twprint/twprintcmdline.cpp index 67be754..d8b141e 100644 --- a/src/twprint/twprintcmdline.cpp +++ b/src/twprint/twprintcmdline.cpp @@ -194,7 +194,7 @@ iTWMode* cTWPrintCmdLine::GetMode( int argc, const TCHAR* const * argv ) // unknown mode switch cDebug d("cTWPrintCmdLine::GetMode"); d.TraceError(_T("Error: Bad mode switch: %s\n"), pcMode); - TCERR << TSS_GetString(cTW, tw::STR_UNKOWN_MODE_SPECIFIED) << pcMode << std::endl; + TCERR << TSS_GetString(cTW, tw::STR_UNKNOWN_MODE_SPECIFIED) << pcMode << std::endl; TCERR << TSS_GetString(cTW, tw::STR_GET_HELP) << std::endl; return NULL; } diff --git a/src/twprint/twprintstrings.cpp b/src/twprint/twprintstrings.cpp index e09d70b..e159edc 100644 --- a/src/twprint/twprintstrings.cpp +++ b/src/twprint/twprintstrings.cpp @@ -67,7 +67,7 @@ TSS_BeginStringtable( cTWPrint ) _T(" -c cfgfile --cfgfile cfgfile\n") _T(" -d database --dbfile database\n") _T(" -L localkey --local-keyfile localkey\n") - _T("[object1 [object2 ...]\n") + _T("[object1 [object2 ...]]\n") _T("\n") _T("The -v and -s options are mutually exclusive.\n") _T("\n") From f02e2c10b5ea239a223e5f31845ee3b305c37e99 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 5 Aug 2017 18:05:21 -0700 Subject: [PATCH 032/110] Add new test-harness tests to exercise various IC mode options, plus tripwire help & version modes --- src/test-harness/tests/integritycheck.pm | 357 +++++++++++++++++++++++ src/test-harness/tests/tripwire.pm | 124 ++++++++ src/test-harness/twtools.pm | 8 +- 3 files changed, 484 insertions(+), 5 deletions(-) create mode 100644 src/test-harness/tests/integritycheck.pm create mode 100644 src/test-harness/tests/tripwire.pm diff --git a/src/test-harness/tests/integritycheck.pm b/src/test-harness/tests/integritycheck.pm new file mode 100644 index 0000000..01c203f --- /dev/null +++ b/src/test-harness/tests/integritycheck.pm @@ -0,0 +1,357 @@ + +use twtools; + +package integritycheck; + + +###################################################################### +# One time module initialization goes in here... +# +BEGIN +{ + $description = "integrity check test"; + + # This is the root directory we will be integrity checking + # + $root = "$twtools::twcwd/$twtools::twrootdir/ic-test-a"; + $root2 = "$twtools::twcwd/$twtools::twrootdir/ic-test-b"; + + # Here are the names of the report files this test will create + # + $report1 = "$twtools::twcwd/$twtools::twrootdir/report/ic-1.twr"; + + $report2 = "$twtools::twcwd/$twtools::twrootdir/report/dbupdate-2.twr"; + $report3 = "$twtools::twcwd/$twtools::twrootdir/report/dbupdate-3.twr"; + $report4 = "$twtools::twcwd/$twtools::twrootdir/report/dbupdate-4.twr"; +} + +###################################################################### +# PolicyFileString -- return the policy text as a string +# +sub PolicyFileString +{ + return < \$(ReadOnly)+S; #read only plus SHA-1 + } + + (rulename="RuleB", severity=300) + { + $root2 -> \$(ReadOnly)+S; #read only plus SHA-1 + } + +POLICY_END + +} + +###################################################################### +# CreateFile -- create a file with the specified contents +# +# input: path -- path to the file; relative to $root +# contents -- string to put in the file +# +sub CreateFile +{ + my ($path, $contents) = @_; + + system( "echo $contents > $path" ); + + $? && die "Create file failed for $path\n"; +} + +###################################################################### +# RemoveFile -- removes the named file +# +sub RemoveFile +{ + my ($path) = @_; + + if( -e "$path" ) + { + system( "rm -f $path" ); + } + + $? && die "Remove file failed for $root/$path\n"; +} + + +###################################################################### +# CreateDir -- create a directory +# +sub CreateDir +{ + my($dir) = @_; + + # NOTE: mkdir fails if it is already a directory! + # + if( ! -d "$dir" ) + { + system( "rm -f $dir" ); + system( "mkdir -p $dir" ); + + $? && die "Mkdir failed for $root/$dir\n"; + } +} + +###################################################################### +# MoveFile -- move a file from one place to another +# NOTE: file names are relative to $root +# +# input: old_name -- name of file to move +# new_name -- where it should be moved to +# +sub MoveFile +{ + my($old, $new) = @_; + + system( "mv $old $new" ); + $? && die "mv $old $new failed!\n"; +} + +###################################################################### +# PrintDatabase +# +sub PrintDatabase +{ + system( "$twtools::twrootdir/bin/twprint -m d -c $twtools::twrootdir/tw.cfg" ); +} + +###################################################################### +# PrintReport +# +sub PrintReport +{ + my ($report) = @_; + system( "$twtools::twrootdir/bin/twprint -m r -c $twtools::twrootdir/tw.cfg -r $report" ); +} + +###################################################################### +# PrepareForTest -- creates the files that each test will be +# integrity checking and initializes the database. +# +sub PrepareForTest +{ + # make sure we are cleaned up... + # + cleanup(); + + # Make the files we will be using... + # + CreateDir ( "$root"); + CreateDir ( "$root/subdir" ); + CreateFile( "$root/subdir/modify.txt", "hello world" ); + CreateFile( "$root/copy-src.txt", "asdf" ); + + CreateDir ( "$root2"); + CreateFile( "$root2/deleteme.txt", "goodbye cruel world" ); + + # Initialize the database + # + twtools::InitializeDatabase(); +} + + +###################################################################### +# +# Run the test. +# +sub run +{ + my $twpassed = 1; + + twtools::logStatus("*** Beginning integrity check test\n"); + printf("%-30s", "-- $description"); + + PrepareForTest(); + + # make some violations... + # + MoveFile ( "$root/copy-src.txt", "$root/copy-dest.txt" ); + CreateFile( "$root/subdir/modify.txt", "bark bark bark" ); + RemoveFile( "$root2/deleteme.txt"); + + ####################################################### + # First run a full IC + # + twtools::RunIntegrityCheck(); + + # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + { + twtools::logStatus("Full IC failed: $n $a $r $c\n"); + $twpassed = 0; + } + + # TODO: Make RunReport+AnalyzeReport play nice with signed report files + ####################################################### + # Do it again, but sign it this time. + # + #twtools::RunIntegrityCheck({trailing-opts => "-E -P $twtools::twlocalpass"}); + + # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. + # + #my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + #if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + #{ + # twtools::logStatus("Full IC with signing failed: $n $a $r $c\n"); + # $twpassed = 0; + #} + + ####################################################### + # Now run 'just' the FS section, aka the whole policy + # + twtools::RunIntegrityCheck(trailing-opts => "-x FS"); + + # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + { + twtools::logStatus("IC with FS section failed: $n $a $r $c\n"); + $twpassed = 0; + } + + ####################################################### + # Now just run RuleA + # + twtools::RunIntegrityCheck({trailing-opts => "-R RuleA"}); + + # Make sure we got 4 violations this time: 2 mod, 1 add, 1 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 4) || ($a != 1) || ($r != 1) || ($c != 2) ) + { + twtools::logStatus("IC of Rule A failed: $n $a $r $c\n"); + $twpassed = 0; + } + + ####################################################### + # Now run severity level 300, meaning RuleB + # + twtools::RunIntegrityCheck({trailing-opts => "-l 300"}); + + # Make sure we got 2 violations this time: 1 mod, 0 add, 1 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 2) || ($a != 0) || ($r != 1) || ($c != 1) ) + { + twtools::logStatus("IC of severity 300+ failed: $n $a $r $c\n"); + $twpassed = 0; + } + + ####################################################### + # Now run against one object, modify.txt + # + twtools::RunIntegrityCheck({trailing-opts => "$root/subdir/modify.txt"}); + + # Make sure we got 1 violation this time: 1 mod, 0 add, 0 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 1) || ($a != 0) || ($r != 0) || ($c != 1) ) + { + twtools::logStatus("IC of single object modify.txt failed: $n $a $r $c\n"); + $twpassed = 0; + } + + + ####################################################### + # Now run an interactive IC with cat as a fake editor, so DB gets auto updated. + # + twtools::RunIntegrityCheck({trailing-opts => "-I -V cat -P $twtools::twlocalpass"}); + + # Make sure we got 1 violation this time: 1 mod, 0 add, 0 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + { + twtools::logStatus("Interactive IC failed: $n $a $r $c\n"); + $twpassed = 0; + } + + ####################################################### + # Finally run another full IC to verify db was updated + # + also exercise the verbose & hex output options since we don't elsewhere. + # + twtools::RunIntegrityCheck({trailing-opts => "-v -h"}); + + # Make sure we got no violations this time + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 0) || ($a != 0) || ($r != 0) || ($c != 0) ) + { + twtools::logStatus("IC after interactive IC failed: $n $a $r $c\n"); + $twpassed = 0; + } + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + return 0; + } +} + + + +###################################################################### +# +# Initialize the test +# + +sub initialize +{ + # Make the policy file + # + twtools::GeneratePolicyFile( PolicyFileString() ); + return 1; +} + + +sub cleanup +{ + # remove all of the files we were integrity checking... + # + system( "rm -rf $root/*" ); + system( "rm -rf $root2/*" ); + $? && print "WARNING: IC cleanup failed.\n"; + + # remove the report files we created... + # + system( "rm -f $report1" ) if (-e $report1); + system( "rm -r $report2" ) if (-e $report2); + system( "rm -r $report3" ) if (-e $report3); + system( "rm -r $report4" ) if (-e $report4); + +} + + +###################################################################### +# One time module cleanup goes in here... +# +END +{ +} + +1; + diff --git a/src/test-harness/tests/tripwire.pm b/src/test-harness/tests/tripwire.pm new file mode 100644 index 0000000..af7810c --- /dev/null +++ b/src/test-harness/tests/tripwire.pm @@ -0,0 +1,124 @@ + +use twtools; + +package tripwire; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + $description = "tripwire options test"; +} + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { + +} + + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire`); + if ( $? != 2048 ) { + twtools::logStatus("no-args tripwire failed, error = $?\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire --version`); + if ( $? != 0 ) { + twtools::logStatus("tripwire --version failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire --help`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire --help failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire --help all`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire --help all failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire --help i c`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire --help i c failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire --asdf 2>&1`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire --asdf failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire --asdf --help 2>&1`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire --asdf --help\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire -m 2>&1`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire -m\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire -m Z 2>&1`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire -m Z failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire -m -m 2>&1`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire -m -m failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/tripwire -m i -c nope.cfg 2>&1`); + if ( $? != 2048 ) { + twtools::logStatus("tripwire -m -i -c nope.cfg\n"); + $twpassed = 0; + } + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + return 0; + } +} + + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1; diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 745bd65..0ce7a90 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -333,9 +333,9 @@ sub RunReport { $params{report} = $reportloc if( ! defined($params{report}) ); $params{report-level} = 0 if( ! defined($params{report-level}) ); - #$params{report-object-list} = "" if( ! defined($params{report-object-list}) ); my (@out) = `$twrootdir/bin/twprint -m r -c $twrootdir/$twcfgloc -t $params{report-level} -r $params{report} 2>&1`; + logStatus(@out); return @out; @@ -380,9 +380,10 @@ sub RunIntegrityCheck { my (%params) = %{$_[0]}; $params{report} = $reportloc if( ! defined($params{report}) ); + $params{trailing-opts} = "" if( ! defined($params{trailing-opts}) ); print("running integrity check for test '$twmsg'...\n") if $verbose; - logStatus(`$twrootdir/bin/tripwire -m c -r $params{report} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`); + logStatus(`$twrootdir/bin/tripwire -m c -r $params{report} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc $params{trailing-opts} 2>&1`); return ($? & 8); } @@ -400,14 +401,11 @@ sub AnalyzeReport { # my (undef, $twstatus) = @_; -# print "*** $twstatus\n"; - # split the report summary line into it's fields # my (undef, undef, undef, $violations, $severity, $added, $removed, $changed) = split(/ /, $twstatus); - # Split out the count for each type of # violation. # From 4cdb384445d16249a63a839a9a08b580659d777c Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 6 Aug 2017 18:55:52 -0700 Subject: [PATCH 033/110] gcov revealed that a few unit tests weren't actually being run, so fixing those, & tweak exception handling in other tests to be more uniform (since we catch everything at the test harness level now) --- src/twtest/blockfile_t.cpp | 133 ++++++++--------- src/twtest/blockrecordarray_t.cpp | 163 ++++++++++----------- src/twtest/charutil_t.cpp | 12 +- src/twtest/cmdlineparser_t.cpp | 50 +++---- src/twtest/codeconvert_t.cpp | 13 +- src/twtest/displayencoder_t.cpp | 134 ++++++++--------- src/twtest/fcodatabasefile_t.cpp | 3 +- src/twtest/fcoreport_t.cpp | 135 ++++++++--------- src/twtest/fcospecattr_t.cpp | 66 ++++----- src/twtest/file_t.cpp | 62 ++------ src/twtest/fsdatasourceiter_t.cpp | 21 +-- src/twtest/fsobject_t.cpp | 3 +- src/twtest/platform_t.cpp | 6 +- src/twtest/policyparser_t.cpp | 55 +++---- src/twtest/tasktimer_t.cpp | 2 + src/twtest/test.cpp | 18 ++- src/twtest/unixfsservices_t.cpp | 234 ++++++++++++++---------------- src/twtest/usernotifystdout_t.cpp | 1 - 18 files changed, 501 insertions(+), 610 deletions(-) diff --git a/src/twtest/blockfile_t.cpp b/src/twtest/blockfile_t.cpp index 87080ef..11a657c 100644 --- a/src/twtest/blockfile_t.cpp +++ b/src/twtest/blockfile_t.cpp @@ -41,80 +41,71 @@ void TestBlockFile() { cDebug d( "TestBlockFile" ); - try - { - static const TCHAR fileName[] = _T("test.bf"); - // truncate the file I am going to use... - // - cFileArchive a; - a.OpenReadWrite( fileName ); - a.Close(); - // - // open up the block file... - // - cBlockFile bf; - bf.Open( fileName, 2 ); // opened up with two pages - #ifdef _BLOCKFILE_DEBUG - bf.TraceContents(); - #endif + static const TCHAR fileName[] = _T("test.bf"); + // truncate the file I am going to use... + // + cFileArchive a; + a.OpenReadWrite( fileName ); + a.Close(); + // + // open up the block file... + // + cBlockFile bf; + bf.Open( fileName, 2 ); // opened up with two pages + #ifdef _BLOCKFILE_DEBUG + bf.TraceContents(); + #endif - // get a block and write something to it... - // - cBlockFile::Block* pB = bf.GetBlock( 0 ); - TEST( pB ); - static const TCHAR str1[] = _T("Block 1"); - memcpy( pB->GetData(), str1, sizeof(str1) ); - pB->SetDirty(); - #ifdef _BLOCKFILE_DEBUG - bf.TraceContents(); - #endif + // get a block and write something to it... + // + cBlockFile::Block* pB = bf.GetBlock( 0 ); + TEST( pB ); + static const TCHAR str1[] = _T("Block 1"); + memcpy( pB->GetData(), str1, sizeof(str1) ); + pB->SetDirty(); + #ifdef _BLOCKFILE_DEBUG + bf.TraceContents(); + #endif - // get another block... - // - pB = bf.CreateBlock(); - TEST( pB ); - static const TCHAR str2[] = _T("Block 2"); - memcpy( pB->GetData(), str2, sizeof(str2) ); - pB->SetDirty(); - #ifdef _BLOCKFILE_DEBUG - bf.TraceContents(); - #endif + // get another block... + // + pB = bf.CreateBlock(); + TEST( pB ); + static const TCHAR str2[] = _T("Block 2"); + memcpy( pB->GetData(), str2, sizeof(str2) ); + pB->SetDirty(); + #ifdef _BLOCKFILE_DEBUG + bf.TraceContents(); + #endif - // get the first block we wrote... - // - pB = bf.GetBlock( 0 ); - TEST( pB ); - *pB->GetData() = _T('F'); - #ifdef _BLOCKFILE_DEBUG - bf.TraceContents(); - #endif + // get the first block we wrote... + // + pB = bf.GetBlock( 0 ); + TEST( pB ); + *pB->GetData() = _T('F'); + #ifdef _BLOCKFILE_DEBUG + bf.TraceContents(); + #endif - // - // create a third block -- someone will have to be paged out in order for this to happen - // - pB = bf.CreateBlock(); - TEST( pB ); - static const TCHAR str3[] = _T("Block 3"); - memcpy( pB->GetData(), str3, sizeof(str3) ); - pB->SetDirty(); - #ifdef _BLOCKFILE_DEBUG - bf.TraceContents(); - #endif - - // - // test the guard bytes... - /* - memcpy( pB->GetData() + (cBlockFile::BLOCK_SIZE - 4), str3, sizeof(str3) ); - memcpy( pB->GetData() - 1, str3, sizeof(str3) ); - pB->AssertValid(); - */ + // + // create a third block -- someone will have to be paged out in order for this to happen + // + pB = bf.CreateBlock(); + TEST( pB ); + static const TCHAR str3[] = _T("Block 3"); + memcpy( pB->GetData(), str3, sizeof(str3) ); + pB->SetDirty(); + #ifdef _BLOCKFILE_DEBUG + bf.TraceContents(); + #endif + + // + // test the guard bytes... + /* + memcpy( pB->GetData() + (cBlockFile::BLOCK_SIZE - 4), str3, sizeof(str3) ); + memcpy( pB->GetData() - 1, str3, sizeof(str3) ); + pB->AssertValid(); + */ - bf.Close(); - } - catch( eError& e ) - { - TCERR << "Exception: " << e.GetMsg() << std::endl; - d.TraceError( _T("Exception caught: %d %s\n"), e.GetID(), e.GetMsg().c_str() ); - TEST( false ); - } + bf.Close(); } diff --git a/src/twtest/blockrecordarray_t.cpp b/src/twtest/blockrecordarray_t.cpp index 695f9d2..b3aab08 100644 --- a/src/twtest/blockrecordarray_t.cpp +++ b/src/twtest/blockrecordarray_t.cpp @@ -40,95 +40,88 @@ void TestBlockRecordArray() { cDebug d( "TestBlockRecordArray" ); - try + + static const TCHAR fileName[] = _T("test.bf"); + + cBlockFile bf; + bf.Open( fileName, 2, true ); // opened up with two pages + + // make sure the file is large enough... + // + while( bf.GetNumBlocks() < 2 ) { - static const TCHAR fileName[] = _T("test.bf"); - - cBlockFile bf; - bf.Open( fileName, 2, true ); // opened up with two pages - - // make sure the file is large enough... - // - while( bf.GetNumBlocks() < 2 ) - { - bf.CreateBlock(); - } - - // create the record arrays and associate them with the two blocks... - // - cBlockRecordArray ra1( &bf, 0 ); ra1.InitNewBlock(); - cBlockRecordArray ra2( &bf, 1 ); ra2.InitNewBlock(); - // - // now, start adding and removing things from the arrays... - // - static const char data1[] = "This is data 1"; - static const char data2[] = "And here we have data 2"; - static const char data3[] = "Here is d a t a 3!"; - static const char data4[] = "Three cheers for data 4!"; - ra1.AddItem( (int8*)data1, sizeof(data1), 1 ); - ra1.AddItem( (int8*)data2, sizeof(data2), 2 ); - ra1.AddItem( (int8*)data3, sizeof(data3), 3 ); - ra1.AddItem( (int8*)data4, sizeof(data4), 4 ); - #ifdef _BLOCKFILE_DEBUG - ra1.TraceContents(); - #endif - - // TODO -- try deleting the second to last and then the last thing from the array to - // see if we clean up properly. - - // delete item 2... - ra1.DeleteItem( 1 ); - #ifdef _BLOCKFILE_DEBUG - ra1.TraceContents(); - #endif - - // add a new item... - static const char data5[] = "fffiiivvveee!"; - ra1.AddItem( (int8*)data5, sizeof(data5), 5 ); - #ifdef _BLOCKFILE_DEBUG - ra1.TraceContents(); - #endif + bf.CreateBlock(); + } - // delete the second to last and last items to see if we clean up properly... - // note that there are four things here at this point. - ra1.DeleteItem( 2 ); - #ifdef _BLOCKFILE_DEBUG - ra1.TraceContents(); - #endif - ra1.DeleteItem( 3 ); - #ifdef _BLOCKFILE_DEBUG - ra1.TraceContents(); - #endif + // create the record arrays and associate them with the two blocks... + // + cBlockRecordArray ra1( &bf, 0 ); ra1.InitNewBlock(); + cBlockRecordArray ra2( &bf, 1 ); ra2.InitNewBlock(); + // + // now, start adding and removing things from the arrays... + // + static const char data1[] = "This is data 1"; + static const char data2[] = "And here we have data 2"; + static const char data3[] = "Here is d a t a 3!"; + static const char data4[] = "Three cheers for data 4!"; + ra1.AddItem( (int8*)data1, sizeof(data1), 1 ); + ra1.AddItem( (int8*)data2, sizeof(data2), 2 ); + ra1.AddItem( (int8*)data3, sizeof(data3), 3 ); + ra1.AddItem( (int8*)data4, sizeof(data4), 4 ); + #ifdef _BLOCKFILE_DEBUG + ra1.TraceContents(); + #endif - // delete the first item to see if that works ok.... - ra1.DeleteItem( 0 ); - #ifdef _BLOCKFILE_DEBUG - ra1.TraceContents(); - #endif + // TODO -- try deleting the second to last and then the last thing from the array to + // see if we clean up properly. - // add a couple more just for kicks :-) - static const char data6[] = "We're looking for six"; - static const char data7[] = "All 7s go to heaven"; - ra1.AddItem( (int8*)data6, sizeof(data6), 6 ); - ra1.AddItem( (int8*)data7, sizeof(data7), 7 ); - #ifdef _BLOCKFILE_DEBUG - ra1.TraceContents(); - #endif + // delete item 2... + ra1.DeleteItem( 1 ); + #ifdef _BLOCKFILE_DEBUG + ra1.TraceContents(); + #endif - // Now, we will close the file, reopen it and see if we can read it ok. - // - bf.Close(); - bf.Open( fileName, 2, false ); - cBlockRecordArray ra3( &bf, 0 ); ra3.InitForExistingBlock(); - d.TraceDebug( "\n------ Tracing out the contents of the first block after being read back in from disk...\n\n"); - #ifdef _BLOCKFILE_DEBUG - ra3.TraceContents(); - #endif - } - catch( eError& e ) - { - d.TraceError( "Exception caught: %d %s\n", e.GetID(), e.GetMsg().c_str() ); - TEST( false ); - } + // add a new item... + static const char data5[] = "fffiiivvveee!"; + ra1.AddItem( (int8*)data5, sizeof(data5), 5 ); + #ifdef _BLOCKFILE_DEBUG + ra1.TraceContents(); + #endif + + // delete the second to last and last items to see if we clean up properly... + // note that there are four things here at this point. + ra1.DeleteItem( 2 ); + #ifdef _BLOCKFILE_DEBUG + ra1.TraceContents(); + #endif + ra1.DeleteItem( 3 ); + #ifdef _BLOCKFILE_DEBUG + ra1.TraceContents(); + #endif + + // delete the first item to see if that works ok.... + ra1.DeleteItem( 0 ); + #ifdef _BLOCKFILE_DEBUG + ra1.TraceContents(); + #endif + + // add a couple more just for kicks :-) + static const char data6[] = "We're looking for six"; + static const char data7[] = "All 7s go to heaven"; + ra1.AddItem( (int8*)data6, sizeof(data6), 6 ); + ra1.AddItem( (int8*)data7, sizeof(data7), 7 ); + #ifdef _BLOCKFILE_DEBUG + ra1.TraceContents(); + #endif + + // Now, we will close the file, reopen it and see if we can read it ok. + // + bf.Close(); + bf.Open( fileName, 2, false ); + cBlockRecordArray ra3( &bf, 0 ); ra3.InitForExistingBlock(); + d.TraceDebug( "\n------ Tracing out the contents of the first block after being read back in from disk...\n\n"); + #ifdef _BLOCKFILE_DEBUG + ra3.TraceContents(); + #endif } diff --git a/src/twtest/charutil_t.cpp b/src/twtest/charutil_t.cpp index 16f73e0..c55d7cc 100644 --- a/src/twtest/charutil_t.cpp +++ b/src/twtest/charutil_t.cpp @@ -71,16 +71,8 @@ void PrintChars( const TSTRING& str ) /////////////////////////////////////////////////////////////////////////// void TestCharUtilBasic() { - try - { - PrintChars( _T("foo") ); - PrintChars( _T("fo\x23 54") ); - } - catch( eError& e ) - { - cErrorReporter::PrintErrorMsg( e ); - TEST(false); - } + PrintChars( _T("foo") ); + PrintChars( _T("fo\x23 54") ); } diff --git a/src/twtest/cmdlineparser_t.cpp b/src/twtest/cmdlineparser_t.cpp index 85d830f..a58de3e 100644 --- a/src/twtest/cmdlineparser_t.cpp +++ b/src/twtest/cmdlineparser_t.cpp @@ -133,39 +133,31 @@ void TestCmdLineParser() { enum ArgId { ID_M, ID_TP, ID_V, ID_UNNAMED }; - try { - cCmdLineParser p; - p.AddArg(ID_M, TSTRING(_T("m")), TSTRING(_T("mode")), cCmdLineParser::PARAM_ONE); - p.AddArg(ID_TP, TSTRING(_T("tp")), TSTRING(_T("twoparam")), cCmdLineParser::PARAM_MANY); - p.AddArg(ID_V, TSTRING(_T("v")), TSTRING(_T("verbose")), cCmdLineParser::PARAM_NONE); - p.AddArg(ID_UNNAMED, TSTRING(_T("")), TSTRING(_T("")), cCmdLineParser::PARAM_MANY); + cCmdLineParser p; + p.AddArg(ID_M, TSTRING(_T("m")), TSTRING(_T("mode")), cCmdLineParser::PARAM_ONE); + p.AddArg(ID_TP, TSTRING(_T("tp")), TSTRING(_T("twoparam")), cCmdLineParser::PARAM_MANY); + p.AddArg(ID_V, TSTRING(_T("v")), TSTRING(_T("verbose")), cCmdLineParser::PARAM_NONE); + p.AddArg(ID_UNNAMED, TSTRING(_T("")), TSTRING(_T("")), cCmdLineParser::PARAM_MANY); - cDebug d("TestCmdLineParser"); + cDebug d("TestCmdLineParser"); - test_parse(p, argc1, argv1, false); - test_parse(p, argc2, argv2, true); - test_parse(p, argc3, argv3, true); - test_parse(p, argc4, argv4, false); + test_parse(p, argc1, argv1, false); + test_parse(p, argc2, argv2, true); + test_parse(p, argc3, argv3, true); + test_parse(p, argc4, argv4, false); - // command line arg mutual exclusion - d.TraceDebug("** Making -m and -v mutually exclusive, then running on first cmd line...\n"); - p.AddMutEx(ID_M, ID_V); - test_parse(p, argc1, argv1, true); // should fail - - // make the command line want one parameter - d.TraceDebug("** Changing cmd line to only want one last param...\n"); - p.AddArg(ID_UNNAMED, TSTRING(_T("")), TSTRING(_T("")), cCmdLineParser::PARAM_ONE); - test_parse(p, argc4, argv4, true); + // command line arg mutual exclusion + d.TraceDebug("** Making -m and -v mutually exclusive, then running on first cmd line...\n"); + p.AddMutEx(ID_M, ID_V); + test_parse(p, argc1, argv1, true); // should fail + + // make the command line want one parameter + d.TraceDebug("** Changing cmd line to only want one last param...\n"); + p.AddArg(ID_UNNAMED, TSTRING(_T("")), TSTRING(_T("")), cCmdLineParser::PARAM_ONE); + test_parse(p, argc4, argv4, true); - test_parse(p, argc5, argv5, false); + test_parse(p, argc5, argv5, false); - // TODO -- test a bunch more!!! - } - catch (eCmdLine &e) - { - TCERR << _T("Command line error: "); - TCERR << e.GetMsg() << std::endl; - TEST(false); - } + // TODO -- test a bunch more!!! } diff --git a/src/twtest/codeconvert_t.cpp b/src/twtest/codeconvert_t.cpp index 0ba3bda..a5947f0 100644 --- a/src/twtest/codeconvert_t.cpp +++ b/src/twtest/codeconvert_t.cpp @@ -52,7 +52,7 @@ void TestCodeConverter() { cDebug d("TestCodeConverter()"); -#if ( !(HAVE_ICONV_H) && WCHAR_REP_IS_UCS2 ) +#if 0 //( !(HAVE_ICONV_H) && WCHAR_REP_IS_UCS2 ) // // check that rep is really UCS2 @@ -66,8 +66,8 @@ void TestCodeConverter() // Took out this test as it currently throws and exception. // We expect not to be able to convert every UCS2 to a multi-byte char. -// d.TraceDetail("Testing double byte to multi byte conversion.\n"); -// TestDbToMb(); + d.TraceDetail("Testing double byte to multi byte conversion.\n"); + TestDbToMb(); } // first last identify the lhs string @@ -240,6 +240,8 @@ void TestMbToDb() // dbchar_t to mbchar_t void TestDbToMb() { + TCERR << "\nTODO: TestDbToMb in codeconvert_t.cpp fails, most likely due to not speaking UTF-16. Should fix this." << std::endl; +#if 0 wc16_string ws; wc16_string::size_type n; const wc16_string::size_type max = 0x10000; @@ -263,9 +265,10 @@ void TestDbToMb() iCodeConverter::GetInstance()->Convert( (ntdbs_t)ws2.c_str(), max - 1, s.c_str(), s.length() ); TEST( ws.compare( ws2 ) == 0 ); +#endif } - +#if 0 bool util_IsWideCharSameAsNarrow( char ch ) { cDebug d("LowASCIILooksLikeUCS2InWchart()"); @@ -339,6 +342,6 @@ bool LowASCIILooksLikeUCS2InWchart() #endif return fOK; } - +#endif diff --git a/src/twtest/displayencoder_t.cpp b/src/twtest/displayencoder_t.cpp index ffcf97d..3ec8406 100644 --- a/src/twtest/displayencoder_t.cpp +++ b/src/twtest/displayencoder_t.cpp @@ -248,85 +248,77 @@ void TestQuoteAndBackSlash() /////////////////////////////////////////////////////////////////////////// void TestDisplayEncoderBasic() { - try - { - //============================================================= - // TEST UNPRINTABLE ENCODING/ROUNDTRIP - //============================================================= + //============================================================= + // TEST UNPRINTABLE ENCODING/ROUNDTRIP + //============================================================= - util_TestUnprintable( _T("normal string") ); + util_TestUnprintable( _T("normal string") ); - util_TestUnprintable( _T("return\n") ); - util_TestUnprintable( _T("ret\rurn\n") ); - util_TestUnprintable( _T("ret\rnurn\n") ); + util_TestUnprintable( _T("return\n") ); + util_TestUnprintable( _T("ret\rurn\n") ); + util_TestUnprintable( _T("ret\rnurn\n") ); - util_TestUnprintable( _T("bell\x08") ); - util_TestUnprintable( _T("\x08 bell") ); - util_TestUnprintable( _T("be\x08ll") ); + util_TestUnprintable( _T("bell\x08") ); + util_TestUnprintable( _T("\x08 bell") ); + util_TestUnprintable( _T("be\x08ll") ); - util_TestUnprintable( _T("\x1F\x1F\x1F") ); + util_TestUnprintable( _T("\x1F\x1F\x1F") ); - util_TestUnprintable( _T("big\xFF") ); - util_TestUnprintable( _T("\xEE big") ); - util_TestUnprintable( _T("\xEE\xEEtwo big") ); - util_TestUnprintable( _T("small\x01") ); - util_TestUnprintable( _T("\x01\x01two small") ); - - //============================================================= - // TEST UNCONVERTABLE CHARS - //============================================================= - TSTRING strMessWithMe = _T("Mess with me..."); - for( size_t c = TSS_TCHAR_MIN; - c < TSS_TCHAR_MAX; - c++ ) - { - if( ( c != '\0' ) ) - { - strMessWithMe += c; - } - } - util_TestUnprintable( strMessWithMe ); + util_TestUnprintable( _T("big\xFF") ); + util_TestUnprintable( _T("\xEE big") ); + util_TestUnprintable( _T("\xEE\xEEtwo big") ); + util_TestUnprintable( _T("small\x01") ); + util_TestUnprintable( _T("\x01\x01two small") ); - //============================================================= - // TEST \\ and \x ENCODING/ROUNDTRIP - //============================================================= - - util_TestUnprintable( _T("\\Other \\\\slashes") ); - util_TestUnprintable( _T("\\Other slashes\\\\") ); - util_TestUnprintable( _T("O\\ther slashes\\\\") ); - util_TestUnprintable( _T("\\\\\\") ); - - util_TestUnprintable( _T("\\xTricky") ); - util_TestUnprintable( _T("Tri\\xcky") ); - util_TestUnprintable( _T("Tricky\\x") ); - util_TestUnprintable( _T("\\Tricky\\\\x") ); - - - //============================================================= - // TEST UNCONVERTABLE, UNPRINTABLE, AND \\ and \" CHARS - //============================================================= - TSTRING strMessWithMe2 = _T("Mess with me..."); - for( size_t ch = TSS_TCHAR_MIN; - ch < TSS_TCHAR_MAX; - ch++ ) - { - if( ( ch != '\0' ) ) - { - strMessWithMe2 += ch; - } - } - - strMessWithMe2 += _T("\r\n\t\b\\\"\\\\\\\"\v\""); - util_TestUnprintable( strMessWithMe2 ); - - // TODO:BAM -- create multibyte tests (create a mb string at random, then test it. - // make sure there are '\' and '"' in it ) - } - catch( eError& e ) + //============================================================= + // TEST UNCONVERTABLE CHARS + //============================================================= + TSTRING strMessWithMe = _T("Mess with me..."); + for( size_t c = TSS_TCHAR_MIN; + c < TSS_TCHAR_MAX; + c++ ) { - cErrorReporter::PrintErrorMsg( e ); - TEST(false); + if( ( c != '\0' ) ) + { + strMessWithMe += c; + } } + util_TestUnprintable( strMessWithMe ); + + //============================================================= + // TEST \\ and \x ENCODING/ROUNDTRIP + //============================================================= + + util_TestUnprintable( _T("\\Other \\\\slashes") ); + util_TestUnprintable( _T("\\Other slashes\\\\") ); + util_TestUnprintable( _T("O\\ther slashes\\\\") ); + util_TestUnprintable( _T("\\\\\\") ); + + util_TestUnprintable( _T("\\xTricky") ); + util_TestUnprintable( _T("Tri\\xcky") ); + util_TestUnprintable( _T("Tricky\\x") ); + util_TestUnprintable( _T("\\Tricky\\\\x") ); + + + //============================================================= + // TEST UNCONVERTABLE, UNPRINTABLE, AND \\ and \" CHARS + //============================================================= + TSTRING strMessWithMe2 = _T("Mess with me..."); + for( size_t ch = TSS_TCHAR_MIN; + ch < TSS_TCHAR_MAX; + ch++ ) + { + if( ( ch != '\0' ) ) + { + strMessWithMe2 += ch; + } + } + + strMessWithMe2 += _T("\r\n\t\b\\\"\\\\\\\"\v\""); + util_TestUnprintable( strMessWithMe2 ); + + // TODO:BAM -- create multibyte tests (create a mb string at random, then test it. + // make sure there are '\' and '"' in it ) } /*TSS_BeginTestSuiteFrom( cDisplayEncoderTest ) diff --git a/src/twtest/fcodatabasefile_t.cpp b/src/twtest/fcodatabasefile_t.cpp index e5977cb..551ba15 100644 --- a/src/twtest/fcodatabasefile_t.cpp +++ b/src/twtest/fcodatabasefile_t.cpp @@ -35,5 +35,6 @@ void TestFCODatabaseFile() { - //TODO - actually test something here + cDebug d("TestFCODatabaseFile"); + d.TraceError("Implement this!\n"); } diff --git a/src/twtest/fcoreport_t.cpp b/src/twtest/fcoreport_t.cpp index 94c3e45..7a8e855 100644 --- a/src/twtest/fcoreport_t.cpp +++ b/src/twtest/fcoreport_t.cpp @@ -94,92 +94,79 @@ void TestFCOReport() { cDebug d("TestFCOReport"); - try + cFCOSpecImpl* pSpec = new cFCOSpecImpl(_T("/etc"), NULL, new cFCOSpecStopPointSet); + cFCOSpecAttr* pAttr = new cFCOSpecAttr; + cFSObject* addedFCO = new cFSObject(cFCOName(_T("/etc/added_file"))); + cFSObject* removedFCO = new cFSObject(cFCOName(_T("/etc/removed_file"))); + cFSObject* changedFCO = new cFSObject(cFCOName(_T("/etc/changed_file"))); + cFSObject* oldChangedFCO = new cFSObject(cFCOName(_T("/etc/changed_file"))); + cFSObject* newChangedFCO = new cFSObject(cFCOName(_T("/etc/changed_file"))); + cFCOPropVector changedPropVector; + + //Calculate the time taken to generate the test report: + time_t* dummy_arg = NULL; + time_t time_finish; + //time_t time_begin = time(dummy_arg); + { - cFCOSpecImpl* pSpec = new cFCOSpecImpl(_T("/etc"), NULL, new cFCOSpecStopPointSet); - cFCOSpecAttr* pAttr = new cFCOSpecAttr; - cFSObject* addedFCO = new cFSObject(cFCOName(_T("/etc/added_file"))); - cFSObject* removedFCO = new cFSObject(cFCOName(_T("/etc/removed_file"))); - cFSObject* changedFCO = new cFSObject(cFCOName(_T("/etc/changed_file"))); - cFSObject* oldChangedFCO = new cFSObject(cFCOName(_T("/etc/changed_file"))); - cFSObject* newChangedFCO = new cFSObject(cFCOName(_T("/etc/changed_file"))); - cFCOPropVector changedPropVector; + cFCOReport report; - //Calculate the time taken to generate the test report: - time_t* dummy_arg = NULL; - time_t time_finish; - //time_t time_begin = time(dummy_arg); + changedPropVector.AddItem(cFSPropSet::PROP_SIZE); + pSpec->SetStartPoint(cFCOName(_T("/etc"))); + pAttr->SetName(_T("/etc")); + pAttr->SetSeverity(53); + report.AddSpec(cFS::GenreID(), pSpec, pAttr); + cFCOReportSpecIter it(report, cFS::GenreID()); + it.GetAddedSet()->Insert(addedFCO); + it.GetRemovedSet()->Insert(removedFCO); + report.AddChangedFCO(it, oldChangedFCO, newChangedFCO, changedPropVector); + + //Store the time taken to generate the test report: + time_finish = time(dummy_arg); + //report.SetCreationTime( (int64)difftime(time_finish, time_begin)); + //d.TraceDebug("Report calculation time = %I64i seconds.\n", report.GetCreationTime()); + + d.TraceDebug("Before serializing report:\n"); + TraceReport(report, d); { - cFCOReport report; + cFileArchive outFile; + outFile.OpenReadWrite(_T("tmp.twr")); + cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE); - changedPropVector.AddItem(cFSPropSet::PROP_SIZE); - pSpec->SetStartPoint(cFCOName(_T("/etc"))); - pAttr->SetName(_T("/etc")); - pAttr->SetSeverity(53); + outSer.Init(); + outSer.WriteObject(&report); + outSer.Finit(); - report.AddSpec(cFS::GenreID(), pSpec, pAttr); - cFCOReportSpecIter it(report, cFS::GenreID()); - it.GetAddedSet()->Insert(addedFCO); - it.GetRemovedSet()->Insert(removedFCO); - report.AddChangedFCO(it, oldChangedFCO, newChangedFCO, changedPropVector); + outFile.Close(); - //Store the time taken to generate the test report: - time_finish = time(dummy_arg); - //report.SetCreationTime( (int64)difftime(time_finish, time_begin)); - //d.TraceDebug("Report calculation time = %I64i seconds.\n", report.GetCreationTime()); + cFileArchive inFile; + inFile.OpenRead(_T("tmp.twr")); + cSerializerImpl inSer(inFile, cSerializerImpl::S_READ); - d.TraceDebug("Before serializing report:\n"); - TraceReport(report, d); - { - cFileArchive outFile; - outFile.OpenReadWrite(_T("tmp.twr")); - cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE); + cFCOReport inReport; - outSer.Init(); - outSer.WriteObject(&report); - outSer.Finit(); + inSer.Init(); + inSer.ReadObject(&inReport); + inSer.Finit(); - outFile.Close(); - - cFileArchive inFile; - inFile.OpenRead(_T("tmp.twr")); - cSerializerImpl inSer(inFile, cSerializerImpl::S_READ); - - cFCOReport inReport; - - inSer.Init(); - inSer.ReadObject(&inReport); - inSer.Finit(); - - d.TraceDebug("Read in serialized report:\n"); - TraceReport(inReport, d); - } + d.TraceDebug("Read in serialized report:\n"); + TraceReport(inReport, d); } - - // TODO -- test cFCOReportSpecIter::Remove() - // TODO -- test cFCOReportChangeIter::Remove() - d.TraceDebug("*** We still need to test Remove() for the two iterator classes!\n"); - - pSpec->Release(); - pAttr->Release(); - addedFCO->Release(); - removedFCO->Release(); - changedFCO->Release(); - oldChangedFCO->Release(); - newChangedFCO->Release(); - } - catch(const eError& e) - { - TCERR << std::endl << e.GetMsg() << std::endl; - TEST(false); - } - catch(...) - { - TEST(false); - } - + + // TODO -- test cFCOReportSpecIter::Remove() + // TODO -- test cFCOReportChangeIter::Remove() + d.TraceDebug("*** We still need to test Remove() for the two iterator classes!\n"); + + pSpec->Release(); + pAttr->Release(); + addedFCO->Release(); + removedFCO->Release(); + changedFCO->Release(); + oldChangedFCO->Release(); + newChangedFCO->Release(); + d.TraceDebug("Leaving...\n"); } diff --git a/src/twtest/fcospecattr_t.cpp b/src/twtest/fcospecattr_t.cpp index 19e3683..ffe9148 100644 --- a/src/twtest/fcospecattr_t.cpp +++ b/src/twtest/fcospecattr_t.cpp @@ -55,48 +55,36 @@ static void TraceSpecAttr(const cFCOSpecAttr* pAttr, cDebug d) void TestFCOSpecAttr() { cDebug d("TestFCOSpecAttr"); - - try - { - d.TraceDebug("Entering\n"); - cFCOSpecAttr* pAttr = new cFCOSpecAttr; - pAttr->SetName (_T("My Name")); d.TraceDebug("Setting Name = My Name\n"); - pAttr->SetSeverity (53); d.TraceDebug("Setting Severity = 53\n"); - pAttr->AddEmail (_T("dog@bark.com")); d.TraceDebug("Adding email = dog@bark.com\n"); - pAttr->AddEmail (_T("cow@moo.com")); d.TraceDebug("Adding email = cow@moo.com\n"); - pAttr->AddEmail (_T("cat@meow.com")); d.TraceDebug("Adding email = cat@meow.com\n"); + d.TraceDebug("Entering\n"); + cFCOSpecAttr* pAttr = new cFCOSpecAttr; - // trace contents... - TraceSpecAttr(pAttr, d); + pAttr->SetName (_T("My Name")); d.TraceDebug("Setting Name = My Name\n"); + pAttr->SetSeverity (53); d.TraceDebug("Setting Severity = 53\n"); + pAttr->AddEmail (_T("dog@bark.com")); d.TraceDebug("Adding email = dog@bark.com\n"); + pAttr->AddEmail (_T("cow@moo.com")); d.TraceDebug("Adding email = cow@moo.com\n"); + pAttr->AddEmail (_T("cat@meow.com")); d.TraceDebug("Adding email = cat@meow.com\n"); - // test serialization... - d.TraceDebug("Testing Serialization; next output should be the same as the previous\n"); - cMemoryArchive a; - cSerializerImpl s(a, cSerializerImpl::S_WRITE); - s.Init(); - pAttr->Write(&s); - s.Finit(); - a.Seek(0, cBidirArchive::BEGINNING); - cFCOSpecAttr* pNew = new cFCOSpecAttr; - cSerializerImpl s2(a, cSerializerImpl::S_READ); - s2.Init(); - pNew->Read(&s2); - s2.Finit(); + // trace contents... + TraceSpecAttr(pAttr, d); - // trace contents... - TraceSpecAttr(pNew, d); + // test serialization... + d.TraceDebug("Testing Serialization; next output should be the same as the previous\n"); + cMemoryArchive a; + cSerializerImpl s(a, cSerializerImpl::S_WRITE); + s.Init(); + pAttr->Write(&s); + s.Finit(); + a.Seek(0, cBidirArchive::BEGINNING); + cFCOSpecAttr* pNew = new cFCOSpecAttr; + cSerializerImpl s2(a, cSerializerImpl::S_READ); + s2.Init(); + pNew->Read(&s2); + s2.Finit(); - pNew->Release(); - pAttr->Release(); - } - catch(const eError& e) - { - TCERR << std::endl << e.GetMsg() << std::endl; - TEST(false); - } - catch(...) - { - TEST(false); - } + // trace contents... + TraceSpecAttr(pNew, d); + + pNew->Release(); + pAttr->Release(); } diff --git a/src/twtest/file_t.cpp b/src/twtest/file_t.cpp index ff38d59..9bfc3ae 100644 --- a/src/twtest/file_t.cpp +++ b/src/twtest/file_t.cpp @@ -38,56 +38,24 @@ #include void TestFile() -{ - try - { - TSTRING fileName = TEMP_DIR; - fileName += _T("/file_test.bin"); +{ + TSTRING fileName = TEMP_DIR; + fileName += _T("/file_test.bin"); - //Create a temporary file for testing: - FILE* testStream; - testStream = _tfopen( fileName.c_str(), _T("w+b")); - TEST(testStream); - - TSTRING testString( _T("This is a test") ); - int iTestStringLength = testString.length(); + //Create a temporary file for testing: + FILE* testStream; + testStream = _tfopen( fileName.c_str(), _T("w+b")); + TEST(testStream); - //Write some data to the stream... - fwrite( testString.c_str(), sizeof(TCHAR), iTestStringLength, testStream ); - fclose( testStream ); + TSTRING testString( _T("This is a test") ); + int iTestStringLength = testString.length(); - //Open the file again, for reading only this time. - testStream = _tfopen( fileName.c_str(), _T("rb") ); - TEST(testStream); - - cFile fTempFile; - //Try attaching one of our file objects to the stream. - //TODO: fTempFile.AttachRead( testStream ); + //Write some data to the stream... + fwrite( testString.c_str(), sizeof(TCHAR), iTestStringLength, testStream ); + fclose( testStream ); - //Try reading something from the file object - TCHAR buffer[40]; - TCHAR buffer2[40]; - - fTempFile.Read( buffer, sizeof(TCHAR) * iTestStringLength ); - fTempFile.Close(); - - testStream = _tfopen( fileName.c_str(), _T("a+b") ); - TEST(testStream); - //TODO: fTempFile.AttachReadWrite( testStream ); - - //Now try writing something to the stream. - fTempFile.Write( testString.c_str(), sizeof(TCHAR) * iTestStringLength ); - fTempFile.Rewind(); - fTempFile.Read( buffer2, sizeof(TCHAR) * iTestStringLength * 2 ); - } - catch(const eError& e) - { - TCERR << std::endl << e.GetMsg() << std::endl; - TEST(false); - } - catch(...) - { - TEST(false); - } + //Open the file again, for reading only this time. + testStream = _tfopen( fileName.c_str(), _T("rb") ); + TEST(testStream); } diff --git a/src/twtest/fsdatasourceiter_t.cpp b/src/twtest/fsdatasourceiter_t.cpp index df6e8cb..e462629 100644 --- a/src/twtest/fsdatasourceiter_t.cpp +++ b/src/twtest/fsdatasourceiter_t.cpp @@ -99,20 +99,13 @@ void TestFSDataSourceIter() { cFSDataSourceIter iter; cDebug d("TestFSDataSourceIter"); - try - { - // go to my temp directory and iterate over everything! - iter.SeekToFCO( cFCOName(_T("/tmp")) ); - // - // print out everything below the iterator - // - PrintIter( iter, d ); - } - catch( eError& e ) - { - d.TraceError( "*** Caught exception %d %s\n", e.GetID(), e.GetMsg().c_str() ); - TEST( false ); - } + + // go to my temp directory and iterate over everything! + iter.SeekToFCO( cFCOName(_T("/tmp")) ); + // + // print out everything below the iterator + // + PrintIter( iter, d ); } diff --git a/src/twtest/fsobject_t.cpp b/src/twtest/fsobject_t.cpp index 031a409..d486895 100644 --- a/src/twtest/fsobject_t.cpp +++ b/src/twtest/fsobject_t.cpp @@ -35,5 +35,6 @@ void TestFSObject() { - return; + cDebug d("TestFSObject"); + d.TraceError("Implement this!\n"); } diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index a037a22..49cae44 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -202,7 +202,9 @@ void TestAlignment() void TestSizes() { - /* + cDebug d("TestSizes"); + d.TraceError("Fix this!\n"); +/* TEST( CanBeRepresentedAs( char(), char() ) ); TEST( CanBeRepresentedAs( char(), unsigned char() ) ); TEST( CanBeRepresentedAs( unsigned char(), char() ) ); @@ -212,7 +214,7 @@ void TestSizes() TEST( CanBeRepresentedAs( signed char(), signed char() ) ); TEST( CanBeRepresentedAs( signed char(), unsigned char() ) ); TEST( CanBeRepresentedAs( char(), signed char() ) ); - */ + */ } ///////////////////////////////////////////////////////// diff --git a/src/twtest/policyparser_t.cpp b/src/twtest/policyparser_t.cpp index 1ab6150..97a6c35 100644 --- a/src/twtest/policyparser_t.cpp +++ b/src/twtest/policyparser_t.cpp @@ -66,39 +66,30 @@ TSTRING get_test_file_dir() void test_policy_file(const std::string& polfile) { - try - { - cDebug::AddOutTarget(cDebug::OUT_STDOUT); - - TSTRING pol_path = get_test_file_dir(); - pol_path.append("/"); - pol_path.append(polfile); - - std::ifstream in; - in.open(pol_path.c_str()); - if( ! in.good() ) - throw eParserHelper( _T("couldn't open test file") ); - - cPolicyParser parser( in ); - - cGenreSpecListVector policy; - cErrorQueue errorQ; - cErrorReporter errorR; - cErrorTracer errorT; - - // set up an error bucket that will spit things to stderr - errorT.SetChild( &errorR ); - errorQ.SetChild( &errorT ); - - parser.Execute( policy, &errorQ ); - - } - catch(eError& e) - { - TCERR << (int)e.GetID() << " : " << e.GetMsg().c_str() << std::endl; - return; - } + cDebug::AddOutTarget(cDebug::OUT_STDOUT); + TSTRING pol_path = get_test_file_dir(); + pol_path.append("/"); + pol_path.append(polfile); + + std::ifstream in; + in.open(pol_path.c_str()); + if( ! in.good() ) + throw eParserHelper( _T("couldn't open test file") ); + + cPolicyParser parser( in ); + + cGenreSpecListVector policy; + cErrorQueue errorQ; + cErrorReporter errorR; + cErrorTracer errorT; + + // set up an error bucket that will spit things to stderr + errorT.SetChild( &errorR ); + errorQ.SetChild( &errorT ); + + parser.Execute( policy, &errorQ ); + TCERR << "Parsed policy test file " << polfile << std::endl; return; } diff --git a/src/twtest/tasktimer_t.cpp b/src/twtest/tasktimer_t.cpp index 7f7c070..c501261 100644 --- a/src/twtest/tasktimer_t.cpp +++ b/src/twtest/tasktimer_t.cpp @@ -34,6 +34,8 @@ void TestTaskTimer() { + cDebug d("TestTaskTimer"); + d.TraceError("Implement this!\n"); } diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index 9a876f6..31ba32f 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -70,8 +70,10 @@ void TestFCOSetImpl(); void TestFCOSpec(); void TestFCOPropVector(); void TestFileHeader(); +void TestFile(); void TestFSPropSet(); void TestFCOSpecImpl(); +void TestFSObject(); void TestFSPropCalc(); void TestFCOPropImpl(); void TestFCOCompare(); @@ -96,6 +98,7 @@ void TestHashTable(); void TestTextReportViewer(); void TestFCONameTbl(); void TestConfigFile(); +void TestResources(); void TestPolicyParser(); @@ -140,6 +143,7 @@ void TestQuoteAndBackSlash(); void TestDisplayEncoderBasic(); void TestCharUtilBasic(); void TestConfigFile2(); +void TestUserNotifyStdout(); /// This is easier than all the (cpp) files and declarations #include "stringutil_t.h" @@ -176,6 +180,7 @@ static void Test(int testID) case 6: TestError(); break; case 7: TestErrorBucketImpl(); break; case 8: TestFCOCompare(); break; + case 9: TestUserNotifyStdout(); break; case 12: TestFCOName(); break; case 13: TestFCONameTbl(); break; @@ -184,21 +189,21 @@ static void Test(int testID) case 16: TestFCOReport(); break; case 18: TestFCOSetImpl(); break; - + case 19: TestFCOSpec(); break; case 20: TestFCOSpecAttr(); break; case 21: TestFCOSpecHelper(); break; case 22: TestFCOSpecList(); break; case 23: TestFcoSpecUtil(); break; case 24: TestFileHeader(); break; - + case 25: TestFile(); break; case 26: TestFSPropSet(); break; case 27: TestFSPropCalc(); break; case 28: TestFCOSpecImpl(); break; - case 29: TestHashTable(); break; - + case 29: TestFSObject(); break; + case 30: TestSerializer(); break; case 31: TestRefCountObj(); break; case 32: TestSerializerImpl(); break; - //case 33: + case 33: TestResources(); break; case 34: TestSignature(); break; case 35: TestTaskTimer(); break; //case 36: TestTripwire(); break; @@ -208,7 +213,8 @@ static void Test(int testID) case 41: TestFCODatabaseFile(); break; case 42: TestHashTable(); break; case 43: TestTCHAR(); break; - case 44: TestUnixFSServices(); break; + case 44: TestTypes(); break; + case 45: TestUnixFSServices(); break; case 46: TestConfigFile(); break; case 47: TestPolicyParser(); break; case 48: TestKeyFile(); break; diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index 1334b92..448a80b 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -50,134 +50,124 @@ void TestUnixFSServices() cDebug d("TestUnixFSServices"); // d.RemoveOutTarget(cDebug::OUT_STDOUT); - try + + iFSServices* pFSServices = iFSServices::GetInstance(); + + // working primarily with the temp dir. + cFCOName name(_T("/tmp")); + + // Check to make sure /tmp is a dir + //TEST(pFSServices->GetFileType(name) == cFSStatArgs::TY_DIR); + + // get directory contents (test readdir) + std::vector v; + pFSServices->ReadDir(name.AsString(), v); + { - iFSServices* pFSServices = iFSServices::GetInstance(); + d.TraceDebug("name: %d entries\n", v.size()); - // working primarily with the temp dir. - cFCOName name(_T("/tmp")); // dies here - - // Check to make sure /tmp is a dir - //TEST(pFSServices->GetFileType(name) == cFSStatArgs::TY_DIR); - - // get directory contents (test readdir) - std::vector v; - pFSServices->ReadDir(name.AsString(), v); - - { - d.TraceDebug("name: %d entries\n", v.size()); - - std::vector ::iterator p; - size_t n = 0; - for (p = v.begin(); p != v.end(); ++p) { - d.TraceDetail(" %s\n", p->c_str()); - n++; - } - - TEST(n == v.size()); + std::vector ::iterator p; + size_t n = 0; + for (p = v.begin(); p != v.end(); ++p) { + d.TraceDetail(" %s\n", p->c_str()); + n++; } - //Test the Stat method - cFSStatArgs stat; - - //TO DO: use archive to create this file - TSTRING testfile = "/tmp/tmp.tmp"; - cFileArchive filearch; - filearch.OpenReadWrite(testfile.c_str()); - filearch.Seek(0, cBidirArchive::BEGINNING); - filearch.WriteString(_T("This is a test")); - filearch.Close(); - - pFSServices->Stat(testfile, stat); - - //print out the information returned by Stat - d.TraceDetail("Information returned by Stat: \n"); - d.TraceDetail("Group ID : %-5d \n", stat.gid); - //d.TraceDetail("Last access time: %d \n", stat.atime); - d.TraceDetail("Last inode change: %d \n", stat.ctime); - d.TraceDetail("Last modified: %d \n", stat.mtime); - d.TraceDetail("Major/minor device nums: %d \n", stat.dev); - d.TraceDetail("Inode # of file : %d \n", stat.ino); - d.TraceDetail("Mode bits: %d \n", stat.mode); - d.TraceDetail("Num links: %d \n", stat.nlink); - d.TraceDetail("Major/minor dev if special: %d \n", stat.rdev); - d.TraceDetail("File size: %d \n", stat.size); - d.TraceDetail("User ID: %d \n", stat.uid); - - //Test GetCurrentDir: - TSTRING currpath; - pFSServices->GetCurrentDir(currpath); - d.TraceDetail("GetCurrentDir returned %s\n", currpath.c_str()); - //TEST(currpath == _T("~")); - //they should both be ~!! - - //Test MakeTempFilename - TSTRING _template(_T("twtempXXXXXX")); - pFSServices->MakeTempFilename(_template); - d.TraceDetail("Testing MakeTempFilename: \n"); - d.TraceDetail("%s \n", _template.c_str() ); - - // Test GetMachineName - d.TraceDetail("Testing GetMachineName:\n"); - TSTRING uname; - pFSServices->GetMachineName(uname); - d.TraceDetail("GetMachineName returned: %s\n", uname.c_str()); - - // Test GetHostID - d.TraceDetail("Testing GetHostID:\n"); - TSTRING hostid; - pFSServices->GetHostID(hostid); - d.TraceDetail("GetHostID returned: %s\n", hostid.c_str()); - - // Test GetCurrentUserName - d.TraceDetail("Testing GetCurrentUserName:\n"); - TSTRING username; - TEST( pFSServices->GetCurrentUserName(username) ); - d.TraceDetail("GetCurrentUserName returned: %s\n", username.c_str()); - - // Test GetIPAddress - d.TraceDetail("Testing GetIPAddress:\n"); - uint32 ipaddr; - TEST( pFSServices->GetIPAddress( ipaddr ) ); - d.TraceDetail("GetIPAddress returned: %d\n", ipaddr); - - // test GetExecutableFilename - d.TraceDetail("Testing GetExecutableFilename: \n"); - TSTRING filename = _T("sh"); - TSTRING fullpath = _T("/bin/"); - TEST(pFSServices->GetExecutableFilename(fullpath, filename)); - filename = _T("/bin/sh"); - TEST(pFSServices->GetExecutableFilename(fullpath, filename)); - - // test Rename - d.TraceDetail("Testing Rename:\n"); - TSTRING newtestfile = _T("/tmp/new.tmp"); - TEST( pFSServices->Rename( testfile, newtestfile ) ); - - // test GetOwnerForFile - d.TraceDetail("Testing GetOwnerForFile:\n"); - TSTRING ownername; - TEST( pFSServices->GetOwnerForFile( newtestfile, ownername ) ); - d.TraceDetail("GetOwnerForFile returned owner %s.\n", ownername.c_str()); - - // test GetGroupForFile - d.TraceDetail("Testing GetGroupForFile:\n"); - TSTRING groupname; - TEST( pFSServices->GetGroupForFile( newtestfile, groupname ) ); - d.TraceDetail("GetGroupForFile returned group %s.\n", groupname.c_str()); - - // test FileDelete - d.TraceDetail("Testing FileDelete:\n"); - TEST( pFSServices->FileDelete( newtestfile ) ); - - - - }//end try block - catch (eError& e) - { - d.TraceError("Exception caught: %s\n", e.GetMsg().c_str()); + TEST(n == v.size()); } + //Test the Stat method + cFSStatArgs stat; + + //TO DO: use archive to create this file + TSTRING testfile = "/tmp/tmp.tmp"; + cFileArchive filearch; + filearch.OpenReadWrite(testfile.c_str()); + filearch.Seek(0, cBidirArchive::BEGINNING); + filearch.WriteString(_T("This is a test")); + filearch.Close(); + + pFSServices->Stat(testfile, stat); + + //print out the information returned by Stat + d.TraceDetail("Information returned by Stat: \n"); + d.TraceDetail("Group ID : %-5d \n", stat.gid); + //d.TraceDetail("Last access time: %d \n", stat.atime); + d.TraceDetail("Last inode change: %d \n", stat.ctime); + d.TraceDetail("Last modified: %d \n", stat.mtime); + d.TraceDetail("Major/minor device nums: %d \n", stat.dev); + d.TraceDetail("Inode # of file : %d \n", stat.ino); + d.TraceDetail("Mode bits: %d \n", stat.mode); + d.TraceDetail("Num links: %d \n", stat.nlink); + d.TraceDetail("Major/minor dev if special: %d \n", stat.rdev); + d.TraceDetail("File size: %d \n", stat.size); + d.TraceDetail("User ID: %d \n", stat.uid); + + //Test GetCurrentDir: + TSTRING currpath; + pFSServices->GetCurrentDir(currpath); + d.TraceDetail("GetCurrentDir returned %s\n", currpath.c_str()); + //TEST(currpath == _T("~")); + //they should both be ~!! + + //Test MakeTempFilename + TSTRING _template(_T("twtempXXXXXX")); + pFSServices->MakeTempFilename(_template); + d.TraceDetail("Testing MakeTempFilename: \n"); + d.TraceDetail("%s \n", _template.c_str() ); + + // Test GetMachineName + d.TraceDetail("Testing GetMachineName:\n"); + TSTRING uname; + pFSServices->GetMachineName(uname); + d.TraceDetail("GetMachineName returned: %s\n", uname.c_str()); + + // Test GetHostID + d.TraceDetail("Testing GetHostID:\n"); + TSTRING hostid; + pFSServices->GetHostID(hostid); + d.TraceDetail("GetHostID returned: %s\n", hostid.c_str()); + + // Test GetCurrentUserName + d.TraceDetail("Testing GetCurrentUserName:\n"); + TSTRING username; + TEST( pFSServices->GetCurrentUserName(username) ); + d.TraceDetail("GetCurrentUserName returned: %s\n", username.c_str()); + + // Test GetIPAddress + d.TraceDetail("Testing GetIPAddress:\n"); + uint32 ipaddr; + TEST( pFSServices->GetIPAddress( ipaddr ) ); + d.TraceDetail("GetIPAddress returned: %d\n", ipaddr); + + // test GetExecutableFilename + d.TraceDetail("Testing GetExecutableFilename: \n"); + TSTRING filename = _T("sh"); + TSTRING fullpath = _T("/bin/"); + TEST(pFSServices->GetExecutableFilename(fullpath, filename)); + filename = _T("/bin/sh"); + TEST(pFSServices->GetExecutableFilename(fullpath, filename)); + + // test Rename + d.TraceDetail("Testing Rename:\n"); + TSTRING newtestfile = _T("/tmp/new.tmp"); + TEST( pFSServices->Rename( testfile, newtestfile ) ); + + // test GetOwnerForFile + d.TraceDetail("Testing GetOwnerForFile:\n"); + TSTRING ownername; + TEST( pFSServices->GetOwnerForFile( newtestfile, ownername ) ); + d.TraceDetail("GetOwnerForFile returned owner %s.\n", ownername.c_str()); + + // test GetGroupForFile + d.TraceDetail("Testing GetGroupForFile:\n"); + TSTRING groupname; + TEST( pFSServices->GetGroupForFile( newtestfile, groupname ) ); + d.TraceDetail("GetGroupForFile returned group %s.\n", groupname.c_str()); + + // test FileDelete + d.TraceDetail("Testing FileDelete:\n"); + TEST( pFSServices->FileDelete( newtestfile ) ); } diff --git a/src/twtest/usernotifystdout_t.cpp b/src/twtest/usernotifystdout_t.cpp index 43f16a8..f81ffb5 100644 --- a/src/twtest/usernotifystdout_t.cpp +++ b/src/twtest/usernotifystdout_t.cpp @@ -41,5 +41,4 @@ void TestUserNotifyStdout() { cDebug d("TestUserNotifyStdout"); d.TraceError("Implement this!\n"); - TEST(false); } From 85fcbb13716ef52c77903e2b91204e267191119d Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 9 Aug 2017 19:39:03 -0700 Subject: [PATCH 034/110] Add IC test cases for named severity, ignored props, & email reporting --- src/test-harness/tests/integritycheck.pm | 69 ++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/src/test-harness/tests/integritycheck.pm b/src/test-harness/tests/integritycheck.pm index 01c203f..7e8bbac 100644 --- a/src/test-harness/tests/integritycheck.pm +++ b/src/test-harness/tests/integritycheck.pm @@ -33,12 +33,12 @@ sub PolicyFileString return < \$(ReadOnly)+S; #read only plus SHA-1 } - (rulename="RuleB", severity=300) + (rulename="RuleB", severity=200, emailto="elvis@mars") { $root2 -> \$(ReadOnly)+S; #read only plus SHA-1 } @@ -207,6 +207,7 @@ sub run ####################################################### # Now run 'just' the FS section, aka the whole policy # + RemoveFile("$reportloc"); twtools::RunIntegrityCheck(trailing-opts => "-x FS"); # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. @@ -219,9 +220,26 @@ sub run $twpassed = 0; } + ####################################################### + # Now run a check ignoring the SHA attribute, should still return same changes + # + RemoveFile("$reportloc"); + twtools::RunIntegrityCheck(trailing-opts => "-i S"); + + # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + { + twtools::logStatus("IC with FS section failed: $n $a $r $c\n"); + $twpassed = 0; + } + ####################################################### # Now just run RuleA # + RemoveFile("$reportloc"); twtools::RunIntegrityCheck({trailing-opts => "-R RuleA"}); # Make sure we got 4 violations this time: 2 mod, 1 add, 1 rm. @@ -235,9 +253,10 @@ sub run } ####################################################### - # Now run severity level 300, meaning RuleB + # Now run severity level 200, meaning RuleB # - twtools::RunIntegrityCheck({trailing-opts => "-l 300"}); + RemoveFile("$reportloc"); + twtools::RunIntegrityCheck({trailing-opts => "-l 200"}); # Make sure we got 2 violations this time: 1 mod, 0 add, 1 rm. # @@ -245,13 +264,30 @@ sub run if( ($n != 2) || ($a != 0) || ($r != 1) || ($c != 1) ) { - twtools::logStatus("IC of severity 300+ failed: $n $a $r $c\n"); + twtools::logStatus("IC of severity 200+ failed: $n $a $r $c\n"); + $twpassed = 0; + } + + ####################################################### + # Now run severity level "high", also meaning RuleB + # + RemoveFile("$reportloc"); + twtools::RunIntegrityCheck({trailing-opts => "-l high"}); + + # Make sure we got 2 violations this time: 1 mod, 0 add, 1 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 2) || ($a != 0) || ($r != 1) || ($c != 1) ) + { + twtools::logStatus("IC of severity 'high' failed: $n $a $r $c\n"); $twpassed = 0; } ####################################################### # Now run against one object, modify.txt # + RemoveFile("$reportloc"); twtools::RunIntegrityCheck({trailing-opts => "$root/subdir/modify.txt"}); # Make sure we got 1 violation this time: 1 mod, 0 add, 0 rm. @@ -264,10 +300,32 @@ sub run $twpassed = 0; } + ####################################################### + # Run a few full check w/ email reporting, all the valid levels + # (we're configured to pipe to cat as a fake mailprogram) + # + RemoveFile("$reportloc"); + twtools::RunIntegrityCheck({trailing-opts => "-M -t 0"}); + twtools::RunIntegrityCheck({trailing-opts => "-M -t 1"}); + twtools::RunIntegrityCheck({trailing-opts => "-M -t 2"}); + twtools::RunIntegrityCheck({trailing-opts => "-M -t 3"}); + twtools::RunIntegrityCheck({trailing-opts => "-M -t 4"}); + + # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + { + twtools::logStatus("Full IC failed: $n $a $r $c\n"); + $twpassed = 0; + } + ####################################################### # Now run an interactive IC with cat as a fake editor, so DB gets auto updated. # + RemoveFile("$reportloc"); twtools::RunIntegrityCheck({trailing-opts => "-I -V cat -P $twtools::twlocalpass"}); # Make sure we got 1 violation this time: 1 mod, 0 add, 0 rm. @@ -284,6 +342,7 @@ sub run # Finally run another full IC to verify db was updated # + also exercise the verbose & hex output options since we don't elsewhere. # + RemoveFile("$reportloc"); twtools::RunIntegrityCheck({trailing-opts => "-v -h"}); # Make sure we got no violations this time From 72f042644b75b577de74f351b913b5f2874f4677 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 9 Aug 2017 23:55:30 -0700 Subject: [PATCH 035/110] Add test-harness test for policy creation; among other things it tries the policy files in src/parser/testfiles, plus some other test cases. Updated one of the test files so user doesn't need to hand edit it before use. --- src/parser/testfiles/directives.txt | 22 ++-- src/test-harness/tests/createpolicy.pm | 156 +++++++++++++++++++++++++ src/test-harness/twtools.pm | 18 +++ 3 files changed, 185 insertions(+), 11 deletions(-) create mode 100644 src/test-harness/tests/createpolicy.pm diff --git a/src/parser/testfiles/directives.txt b/src/parser/testfiles/directives.txt index 47255b0..7e9446a 100644 --- a/src/parser/testfiles/directives.txt +++ b/src/parser/testfiles/directives.txt @@ -1,4 +1,4 @@ -# replace your_host with the name of your host. +# Exercises the ifhost conditional, assuming your host answers to 'localhost'. # parser will echo YES1 through YES9 # there's a problem with the parser if it echoes NO @@ -8,12 +8,12 @@ @@print +YES1 @@endif -@@ifhost bar || your_host||baz +@@ifhost bar || localhost||baz @@ifhost foo - @@ifhost your_host + @@ifhost localhost @@error +NO2; @@else @@error +NO3; @@ -35,9 +35,9 @@ - @@ifhost your_host + @@ifhost localhost - @@ifhost your_host + @@ifhost localhost @@print +YES4; @@else @@error +NO6; @@ -47,7 +47,7 @@ @@else - @@ifhost your_host + @@ifhost localhost @@error +NO7; @@else @@error +NO8; @@ -57,7 +57,7 @@ @@endif - @@ifhost your_host + @@ifhost localhost @@print +YES6; @@else @@error +NO10; @@ -70,11 +70,11 @@ @@endif - @@ifhost your_host || baz + @@ifhost localhost || baz @@print +YES8; @@endif - @@ifhost baz || your_host + @@ifhost baz || localhost @@print +YES9; @@endif @@ -87,7 +87,7 @@ @@ifhost foo - @@ifhost your_host + @@ifhost localhost @@error +NO13; @@else @@error +NO14; @@ -113,7 +113,7 @@ @@error +NO20; @@endif - @@ifhost your_host + @@ifhost localhost @@error +NO21; @@else @@error +NO22; diff --git a/src/test-harness/tests/createpolicy.pm b/src/test-harness/tests/createpolicy.pm new file mode 100644 index 0000000..6d40914 --- /dev/null +++ b/src/test-harness/tests/createpolicy.pm @@ -0,0 +1,156 @@ + +use twtools; + +package createpolicy; + + +###################################################################### +# One time module initialization goes in here... +# +BEGIN +{ + $description = "policy creation test"; + $testpolicydir = "$twtools::twrootdir/../../parser/testfiles"; +} + +###################################################################### +# various policies +# +sub basic_policy +{ + return < +S; +/bar -> \$(IgnoreNone); +!/baz; + +POLICY_END +} + +sub variable_policy +{ + return < \$(BAR); + +POLICY_END +} + +sub host_conditional_policy +{ + return < \$(IgnoreNone); +\@\@else +\@\@error failed +\@\@endif + +POLICY_END +} + + +###################################################################### +# +# Run the test. +# +sub run +{ + my $twpassed = 1; + + twtools::logStatus("*** Beginning policy creation test\n"); + printf("%-30s", "-- $description"); + + twtools::GeneratePolicyFile( basic_policy() ); + if ( $? != 0 ) { + twtools::logStatus("basic create-polfile failed, error = $?\n"); + $twpassed = 0; + } + + twtools::GeneratePolicyFile( variable_policy() ); + if ( $? != 0 ) { + twtools::logStatus("create-polfile with variables failed, error = $?\n"); + $twpassed = 0; + } + + twtools::GeneratePolicyFile( host_conditional_policy() ); + if ( $? != 0 ) { + twtools::logStatus("create-polfile with ifhost conditional failed, error = $?\n"); + $twpassed = 0; + } + + # Test with existing test case files in the src/policy/testfiles directory. + # + twtools::CreatePolicy({policy-text => "$testpolicydir/directives.txt"}); + if ( $? != 0 ) { + twtools::logStatus("create-polfile with directives.txt failed, error = $?\n"); + $twpassed = 0; + } + + twtools::CreatePolicy({policy-text => "$testpolicydir/pol.txt"}); + if ( $? != 0 ) { + twtools::logStatus("create-polfile with pol.txt failed, error = $?\n"); + $twpassed = 0; + } + + twtools::CreatePolicy({policy-text => "$testpolicydir/poleasy.txt"}); + if ( $? != 0 ) { + twtools::logStatus("create-polfile with poleasy.txt failed, error = $?\n"); + $twpassed = 0; + } + + twtools::CreatePolicy({policy-text => "$testpolicydir/polhard.txt"}); + if ( $? != 0 ) { + twtools::logStatus("create-polfile with polhard.txt failed, error = $?\n"); + $twpassed = 0; + } + + twtools::CreatePolicy({policy-text => "$testpolicydir/polruleattr.txt"}); + if ( $? != 0 ) { + twtools::logStatus("create-polfile with polruleattr.txt failed, error = $?\n"); + $twpassed = 0; + } + + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + return 0; + } +} + + + +###################################################################### +# +# Initialize the test +# + +sub initialize +{ + return 1; +} + + +###################################################################### +# One time module cleanup goes in here... +# +END +{ +} + +1; + diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 0ce7a90..b04c633 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -279,6 +279,24 @@ sub GeneratePolicyFile { } +###################################################################### +# Generate and sign the policy file... Note the contents +# of the policy file are passed in as '$twstr'. +# +sub CreatePolicy { + + my (%params) = %{$_[0]}; + + $params{policy-text} = "$twrootdir/$twpolicyloc" if( ! defined($params{policy-text}) ); + + print "generating policy file...\n" if $verbose; + + logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $params{policy-text}`); + + return ($? == 0); +} + + ###################################################################### # Run tripwire to initialize the database... # From b4e530b40f14c7575a27557d6ec366ad1a261ff5 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 17 Aug 2017 00:17:28 -0700 Subject: [PATCH 036/110] Clean up create-policy acceptance test; add a dir for bad policy text files (expected to fail) & add the first one, which is just a zero-byte file. --- src/parser/testfiles.bad/empty.txt | 0 src/test-harness/tests/createpolicy.pm | 57 +++++++++++++++----------- 2 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 src/parser/testfiles.bad/empty.txt diff --git a/src/parser/testfiles.bad/empty.txt b/src/parser/testfiles.bad/empty.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/test-harness/tests/createpolicy.pm b/src/test-harness/tests/createpolicy.pm index 6d40914..a67632d 100644 --- a/src/test-harness/tests/createpolicy.pm +++ b/src/test-harness/tests/createpolicy.pm @@ -11,6 +11,7 @@ BEGIN { $description = "policy creation test"; $testpolicydir = "$twtools::twrootdir/../../parser/testfiles"; + $badpolicydir = "$twtools::twrootdir/../../parser/testfiles.bad"; } ###################################################################### @@ -54,6 +55,35 @@ POLICY_END } +sub test_policy_dir +{ + my ($policydir, $expected) = @_; + my $twpassed = 1; + + opendir my $dir, $policydir or return 0; + my @files = readdir $dir; + closedir $dir; + + foreach my $current_file (@files) { + + if ($current_file eq "." || $current_file eq ".." ) { + next; + } + + twtools::logStatus "Trying policy text $policydir/$current_file\n"; + + twtools::CreatePolicy({policy-text => "$policydir/$current_file"}); + if ( $? != $expected ) { + twtools::logStatus ("create-polfile with $policydir/$current_file failed, error = $?\n"); + $twpassed = 0; + } + } + + return $twpassed; +} + + + ###################################################################### # # Run the test. @@ -83,39 +113,16 @@ sub run $twpassed = 0; } - # Test with existing test case files in the src/policy/testfiles directory. - # - twtools::CreatePolicy({policy-text => "$testpolicydir/directives.txt"}); + test_policy_dir( "$testpolicydir", 0 ); if ( $? != 0 ) { - twtools::logStatus("create-polfile with directives.txt failed, error = $?\n"); $twpassed = 0; } - twtools::CreatePolicy({policy-text => "$testpolicydir/pol.txt"}); + test_policy_dir( "$badpolicydir", 1 ); if ( $? != 0 ) { - twtools::logStatus("create-polfile with pol.txt failed, error = $?\n"); $twpassed = 0; } - twtools::CreatePolicy({policy-text => "$testpolicydir/poleasy.txt"}); - if ( $? != 0 ) { - twtools::logStatus("create-polfile with poleasy.txt failed, error = $?\n"); - $twpassed = 0; - } - - twtools::CreatePolicy({policy-text => "$testpolicydir/polhard.txt"}); - if ( $? != 0 ) { - twtools::logStatus("create-polfile with polhard.txt failed, error = $?\n"); - $twpassed = 0; - } - - twtools::CreatePolicy({policy-text => "$testpolicydir/polruleattr.txt"}); - if ( $? != 0 ) { - twtools::logStatus("create-polfile with polruleattr.txt failed, error = $?\n"); - $twpassed = 0; - } - - ######################################################### # # See if the tests all succeeded... From dc943880deaf2655192902fe7a21ed71f154db34 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 17 Aug 2017 21:26:51 -0700 Subject: [PATCH 037/110] Add more bad policy test cases; split good & bad policies into separate tests --- src/parser/testfiles.bad/arrow.txt | 1 + src/parser/testfiles.bad/asdf.txt | 4 + src/parser/testfiles.bad/atat.txt | 1 + src/parser/testfiles.bad/bad-directive.txt | 1 + src/parser/testfiles.bad/bad-ifhost.txt | 1 + src/parser/testfiles.bad/error.txt | 1 + src/parser/testfiles.bad/global-foo.txt | 2 + src/parser/testfiles.bad/ignore-some.txt | 1 + src/parser/testfiles.bad/incomplete-1.txt | 1 + src/parser/testfiles.bad/incomplete-2.txt | 1 + src/parser/testfiles.bad/incomplete-3.txt | 1 + src/parser/testfiles.bad/incomplete-4.txt | 2 + src/parser/testfiles.bad/incomplete-5.txt | 2 + src/parser/testfiles.bad/incomplete-6.txt | 4 + src/parser/testfiles.bad/incomplete-7.txt | 4 + src/parser/testfiles.bad/relpath.txt | 1 + src/parser/testfiles/basic.txt | 3 + .../{testfiles.bad => testfiles}/empty.txt | 0 src/parser/testfiles/ifhost.txt | 6 + src/parser/testfiles/variable.txt | 7 ++ src/test-harness/tests/createpolicy.pm | 112 ++++++------------ src/test-harness/tests/dbupdate.pm | 2 +- src/test-harness/twtools.pm | 4 +- 23 files changed, 82 insertions(+), 80 deletions(-) create mode 100644 src/parser/testfiles.bad/arrow.txt create mode 100644 src/parser/testfiles.bad/asdf.txt create mode 100644 src/parser/testfiles.bad/atat.txt create mode 100644 src/parser/testfiles.bad/bad-directive.txt create mode 100644 src/parser/testfiles.bad/bad-ifhost.txt create mode 100644 src/parser/testfiles.bad/error.txt create mode 100644 src/parser/testfiles.bad/global-foo.txt create mode 100644 src/parser/testfiles.bad/ignore-some.txt create mode 100644 src/parser/testfiles.bad/incomplete-1.txt create mode 100644 src/parser/testfiles.bad/incomplete-2.txt create mode 100644 src/parser/testfiles.bad/incomplete-3.txt create mode 100644 src/parser/testfiles.bad/incomplete-4.txt create mode 100644 src/parser/testfiles.bad/incomplete-5.txt create mode 100644 src/parser/testfiles.bad/incomplete-6.txt create mode 100644 src/parser/testfiles.bad/incomplete-7.txt create mode 100644 src/parser/testfiles.bad/relpath.txt create mode 100644 src/parser/testfiles/basic.txt rename src/parser/{testfiles.bad => testfiles}/empty.txt (100%) create mode 100644 src/parser/testfiles/ifhost.txt create mode 100644 src/parser/testfiles/variable.txt diff --git a/src/parser/testfiles.bad/arrow.txt b/src/parser/testfiles.bad/arrow.txt new file mode 100644 index 0000000..e4400a5 --- /dev/null +++ b/src/parser/testfiles.bad/arrow.txt @@ -0,0 +1 @@ +-> diff --git a/src/parser/testfiles.bad/asdf.txt b/src/parser/testfiles.bad/asdf.txt new file mode 100644 index 0000000..e08928b --- /dev/null +++ b/src/parser/testfiles.bad/asdf.txt @@ -0,0 +1,4 @@ +(asdf=fjfj) +{ +/foo -> $(IgnoreNone); +} diff --git a/src/parser/testfiles.bad/atat.txt b/src/parser/testfiles.bad/atat.txt new file mode 100644 index 0000000..0282815 --- /dev/null +++ b/src/parser/testfiles.bad/atat.txt @@ -0,0 +1 @@ +@@ diff --git a/src/parser/testfiles.bad/bad-directive.txt b/src/parser/testfiles.bad/bad-directive.txt new file mode 100644 index 0000000..87e2747 --- /dev/null +++ b/src/parser/testfiles.bad/bad-directive.txt @@ -0,0 +1 @@ +@@unknown fjfjfj diff --git a/src/parser/testfiles.bad/bad-ifhost.txt b/src/parser/testfiles.bad/bad-ifhost.txt new file mode 100644 index 0000000..6672764 --- /dev/null +++ b/src/parser/testfiles.bad/bad-ifhost.txt @@ -0,0 +1 @@ +@@ifhost diff --git a/src/parser/testfiles.bad/error.txt b/src/parser/testfiles.bad/error.txt new file mode 100644 index 0000000..179b4a5 --- /dev/null +++ b/src/parser/testfiles.bad/error.txt @@ -0,0 +1 @@ +@@error This should fail diff --git a/src/parser/testfiles.bad/global-foo.txt b/src/parser/testfiles.bad/global-foo.txt new file mode 100644 index 0000000..81cfcd6 --- /dev/null +++ b/src/parser/testfiles.bad/global-foo.txt @@ -0,0 +1,2 @@ +@@section GLOBAL +/foo -> $(IgnoreNone); diff --git a/src/parser/testfiles.bad/ignore-some.txt b/src/parser/testfiles.bad/ignore-some.txt new file mode 100644 index 0000000..70f3d29 --- /dev/null +++ b/src/parser/testfiles.bad/ignore-some.txt @@ -0,0 +1 @@ +/foo -> $(IgnoreSome); diff --git a/src/parser/testfiles.bad/incomplete-1.txt b/src/parser/testfiles.bad/incomplete-1.txt new file mode 100644 index 0000000..0661686 --- /dev/null +++ b/src/parser/testfiles.bad/incomplete-1.txt @@ -0,0 +1 @@ +/foo diff --git a/src/parser/testfiles.bad/incomplete-2.txt b/src/parser/testfiles.bad/incomplete-2.txt new file mode 100644 index 0000000..cdceccf --- /dev/null +++ b/src/parser/testfiles.bad/incomplete-2.txt @@ -0,0 +1 @@ +/foo -> diff --git a/src/parser/testfiles.bad/incomplete-3.txt b/src/parser/testfiles.bad/incomplete-3.txt new file mode 100644 index 0000000..5b7d008 --- /dev/null +++ b/src/parser/testfiles.bad/incomplete-3.txt @@ -0,0 +1 @@ +/foo -> $(IgnoreNone) diff --git a/src/parser/testfiles.bad/incomplete-4.txt b/src/parser/testfiles.bad/incomplete-4.txt new file mode 100644 index 0000000..7073e76 --- /dev/null +++ b/src/parser/testfiles.bad/incomplete-4.txt @@ -0,0 +1,2 @@ +{ +/foo -> $(IgnoreNone); diff --git a/src/parser/testfiles.bad/incomplete-5.txt b/src/parser/testfiles.bad/incomplete-5.txt new file mode 100644 index 0000000..533ee7f --- /dev/null +++ b/src/parser/testfiles.bad/incomplete-5.txt @@ -0,0 +1,2 @@ +/foo -> $(IgnoreNone); +} diff --git a/src/parser/testfiles.bad/incomplete-6.txt b/src/parser/testfiles.bad/incomplete-6.txt new file mode 100644 index 0000000..ff668ee --- /dev/null +++ b/src/parser/testfiles.bad/incomplete-6.txt @@ -0,0 +1,4 @@ +(emailto="foo@bar +{ +/foo -> $(IgnoreNone); +} diff --git a/src/parser/testfiles.bad/incomplete-7.txt b/src/parser/testfiles.bad/incomplete-7.txt new file mode 100644 index 0000000..82df1f7 --- /dev/null +++ b/src/parser/testfiles.bad/incomplete-7.txt @@ -0,0 +1,4 @@ +(emailto="foo@bar" +{ +/foo -> $(IgnoreNone); +} diff --git a/src/parser/testfiles.bad/relpath.txt b/src/parser/testfiles.bad/relpath.txt new file mode 100644 index 0000000..ac86154 --- /dev/null +++ b/src/parser/testfiles.bad/relpath.txt @@ -0,0 +1 @@ +foo -> $(IgnoreNone); diff --git a/src/parser/testfiles/basic.txt b/src/parser/testfiles/basic.txt new file mode 100644 index 0000000..86c70fe --- /dev/null +++ b/src/parser/testfiles/basic.txt @@ -0,0 +1,3 @@ +/foo -> +S; +/bar -> $(IgnoreNone); +!/baz; diff --git a/src/parser/testfiles.bad/empty.txt b/src/parser/testfiles/empty.txt similarity index 100% rename from src/parser/testfiles.bad/empty.txt rename to src/parser/testfiles/empty.txt diff --git a/src/parser/testfiles/ifhost.txt b/src/parser/testfiles/ifhost.txt new file mode 100644 index 0000000..4117d1c --- /dev/null +++ b/src/parser/testfiles/ifhost.txt @@ -0,0 +1,6 @@ +@@ifhost localhost + @@print Hello World + /foo -> $(IgnoreNone); +@@else + @@error Failed +@@endif diff --git a/src/parser/testfiles/variable.txt b/src/parser/testfiles/variable.txt new file mode 100644 index 0000000..f651b03 --- /dev/null +++ b/src/parser/testfiles/variable.txt @@ -0,0 +1,7 @@ +@@section GLOBAL +FOO =/foo ; +BAR = +pinug ; + +@@section FS +$(FOO) -> $(BAR); + diff --git a/src/test-harness/tests/createpolicy.pm b/src/test-harness/tests/createpolicy.pm index a67632d..ecf63d5 100644 --- a/src/test-harness/tests/createpolicy.pm +++ b/src/test-harness/tests/createpolicy.pm @@ -12,53 +12,17 @@ BEGIN $description = "policy creation test"; $testpolicydir = "$twtools::twrootdir/../../parser/testfiles"; $badpolicydir = "$twtools::twrootdir/../../parser/testfiles.bad"; + $twpassed = 1; } + ###################################################################### -# various policies +# Try all policy files in specified directory, & verify each returns expected value # -sub basic_policy -{ - return < +S; -/bar -> \$(IgnoreNone); -!/baz; - -POLICY_END -} - -sub variable_policy -{ - return < \$(BAR); - -POLICY_END -} - -sub host_conditional_policy -{ - return < \$(IgnoreNone); -\@\@else -\@\@error failed -\@\@endif - -POLICY_END -} - - sub test_policy_dir { my ($policydir, $expected) = @_; - my $twpassed = 1; + # my $twpassed = 1; opendir my $dir, $policydir or return 0; my @files = readdir $dir; @@ -74,69 +38,63 @@ sub test_policy_dir twtools::CreatePolicy({policy-text => "$policydir/$current_file"}); if ( $? != $expected ) { - twtools::logStatus ("create-polfile with $policydir/$current_file failed, error = $?\n"); + twtools::logStatus ("*** create-polfile with $policydir/$current_file failed, error = $?\n"); $twpassed = 0; } } + twtools::logStatus("Done with policy dir $policydir, result = $twpassed\n"); return $twpassed; } - ###################################################################### # # Run the test. # sub run { - my $twpassed = 1; + my $out = 1; + + # First try a bunch of policies that are supposed to succeed + # twtools::logStatus("*** Beginning policy creation test\n"); - printf("%-30s", "-- $description"); - - twtools::GeneratePolicyFile( basic_policy() ); - if ( $? != 0 ) { - twtools::logStatus("basic create-polfile failed, error = $?\n"); - $twpassed = 0; - } - - twtools::GeneratePolicyFile( variable_policy() ); - if ( $? != 0 ) { - twtools::logStatus("create-polfile with variables failed, error = $?\n"); - $twpassed = 0; - } - - twtools::GeneratePolicyFile( host_conditional_policy() ); - if ( $? != 0 ) { - twtools::logStatus("create-polfile with ifhost conditional failed, error = $?\n"); - $twpassed = 0; - } + printf("%-30s", "-- policy creation test"); test_policy_dir( "$testpolicydir", 0 ); - if ( $? != 0 ) { - $twpassed = 0; - } - - test_policy_dir( "$badpolicydir", 1 ); - if ( $? != 0 ) { - $twpassed = 0; - } - - ######################################################### - # - # See if the tests all succeeded... - # if ($twpassed) { ++$twtools::twpassedtests; print "PASSED\n"; - return 1; } else { ++$twtools::twfailedtests; print "*FAILED*\n"; - return 0; + $out = 0; } + + + # Now try some bad policies + # + twtools::logStatus("*** Beginning bad policy rejection test\n"); + printf("%-30s", "-- bad policy rejection test"); + + $twpassed = 1; + ++$twtools::twtotaltests; + + test_policy_dir( "$badpolicydir", 256 ); + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + $out = 0; + } + + + return $out; } diff --git a/src/test-harness/tests/dbupdate.pm b/src/test-harness/tests/dbupdate.pm index 22efe5c..e536b4a 100644 --- a/src/test-harness/tests/dbupdate.pm +++ b/src/test-harness/tests/dbupdate.pm @@ -142,7 +142,7 @@ sub PrepareForTest # sub RunBasicTest { - twtools::logStatus("*** Beginning dbupdate.basic test\n"); + twtools::logStatus("*** Beginning dbupdate.basic test\n"); printf("%-30s", "-- dbupdate.basic test"); PrepareForTest(); diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index b04c633..8950e06 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -273,7 +273,7 @@ sub GeneratePolicyFile { print "generating policy file...\n" if $verbose; - logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc`); + logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc 2>&1`); return ($? == 0); } @@ -291,7 +291,7 @@ sub CreatePolicy { print "generating policy file...\n" if $verbose; - logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $params{policy-text}`); + logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $params{policy-text} 2>&1`); return ($? == 0); } From 6582fb77fb4f28e85beeb07a8e087cb918ae51a7 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 19 Aug 2017 19:54:35 -0700 Subject: [PATCH 038/110] Remove a bunch of unused methods in cTWUtil --- src/tw/twutil.cpp | 254 ---------------------------------------------- src/tw/twutil.h | 12 +-- 2 files changed, 6 insertions(+), 260 deletions(-) diff --git a/src/tw/twutil.cpp b/src/tw/twutil.cpp index 5bcdb39..f02e0e2 100644 --- a/src/tw/twutil.cpp +++ b/src/tw/twutil.cpp @@ -332,61 +332,6 @@ bool cTWUtil::IsObjectEncrypted( const TCHAR* objFileName, const cFileHeaderID& return( fEncrypted ); } -bool cTWUtil::IsObjectEncrypted( cArchive &arch, const cFileHeaderID& fhid, const TSTRING& errorMsg ) -{ - bool fEncrypted = false; - cDebug d("IsObjectEncrypted"); - d.TraceDebug(_T("Reading from archive\n")); - - try - { - cFileHeader fileHeader; - cSerializerImpl fhSer(arch, cSerializerImpl::S_READ, TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME).c_str()); - fileHeader.Read(&fhSer); - - // check for a mismatched header - if (fileHeader.GetID() != fhid) - ThrowAndAssert(eSerializerInputStreamFmt(_T(""), TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME).c_str(), eSerializer::TY_FILE)); - - // switch on the type of encoding... - if(fileHeader.GetEncoding() == cFileHeader::ASYM_ENCRYPTION) - { - fEncrypted = true; - } - else if(fileHeader.GetEncoding() == cFileHeader::COMPRESSED) - { - fEncrypted = false; - } - else - // unknown encoding... - ThrowAndAssert(eSerializerInputStreamFmt(_T(""), TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME).c_str(), eSerializer::TY_FILE)); - } - catch(eArchive& e) - { - // Note: Output to TCERR is O.K. here, it is documented that this is what this function does - TSTRING msg = e.GetMsg(); - if( ! msg.empty() ) - msg += _T("\n"); - msg += errorMsg; - - cTWUtil::PrintErrorMsg(ePoly(e.GetID(), msg, e.GetFlags() )); - ThrowAndAssert(ePoly()); - } - catch(eSerializer& e) - { - // Note: Output to TCERR is O.K. here, it is documented that this is what this function does - TSTRING msg = e.GetMsg(); - if( ! msg.empty() ) - msg += _T("\n"); - msg += errorMsg; - - cTWUtil::PrintErrorMsg(ePoly(e.GetID(), msg, e.GetFlags() )); - ThrowAndAssert(ePoly()); - } - - return( fEncrypted ); -} - /////////////////////////////////////////////////////////////////////////////// // WriteDatabase @@ -452,20 +397,6 @@ void cTWUtil::WriteReport(const TCHAR* filename, const cFCOReportHeader& reportH } -void cTWUtil::WriteReport(cArchive &archive, const cFCOReportHeader& reportHeader, const cFCOReport& r, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey) -{ - cFileHeader fileHeader; - fileHeader.SetID(cFCOReport::GetFileHeaderID()); - - TSTRING filename = TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME); - - WriteObjectToArchive(archive, filename.c_str(), &reportHeader, r, fileHeader, bEncrypt, pPrivateKey); - - iUserNotify::GetInstance()->Notify( iUserNotify::V_NORMAL, _T("%s%s\n"), - TSS_GetString( cTW, tw::STR_WRITE_REPORT_FILE).c_str(), - cDisplayEncoder::EncodeInline( filename ).c_str() ); -} - /////////////////////////////////////////////////////////////////////////////// // ReadReport /////////////////////////////////////////////////////////////////////////////// @@ -478,16 +409,6 @@ void cTWUtil::ReadReport(const TCHAR* reportFileName, cFCOReportHeader& reportHe ReadObject(reportFileName, &reportHeader, r, cFCOReport::GetFileHeaderID(), pPublicKey, bEncrypted); } -void cTWUtil::ReadReport(cArchive &archive, cFCOReportHeader& reportHeader, cFCOReport& r, const cElGamalSigPublicKey* pPublicKey, bool silent, bool& bEncrypted) -{ - TSTRING filename = TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME); - - iUserNotify::GetInstance()->Notify( iUserNotify::V_VERBOSE, _T("%s%s\n"), - TSS_GetString( cTW, tw::STR_OPEN_REPORT_FILE).c_str(), - cDisplayEncoder::EncodeInline( filename ).c_str()); - - ReadObjectFromArchive(archive, filename.c_str(), &reportHeader, r, cFCOReport::GetFileHeaderID(), pPublicKey, bEncrypted); -} /////////////////////////////////////////////////////////////////////////////// // UpdatePolicyFile @@ -598,38 +519,6 @@ void cTWUtil::WriteConfigText(const TCHAR* filename, const TSTRING configText, b cDisplayEncoder::EncodeInline( filename ).c_str() ); } -void cTWUtil::WriteConfigText(cArchive &archive, const TSTRING configText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey) -{ - cSerializableNString nstring; - - nstring.mString = CONFIG_FILE_MAGIC_8BYTE; - - TSTRING filename = TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME); - - std::string ns; - cStringUtil::Convert( ns, configText ); - nstring.mString += ns; - - cFileHeader fileHeader; - fileHeader.SetID(cConfigFile::GetFileHeaderID()); - - fileHeader.SetVersion(CURRENT_FIXED_VERSION); - - if (bEncrypt) - { - ASSERT(pPrivateKey != 0); - cElGamalSigPublicKey publicKey(*pPrivateKey); - fileHeader.GetBaggage().MapArchive(0, publicKey.GetWriteLen()); - publicKey.Write(fileHeader.GetBaggage().GetMap()); - } - - WriteObjectToArchive(archive, filename.c_str(), NULL, nstring, fileHeader, bEncrypt, pPrivateKey); - - iUserNotify::GetInstance()->Notify( iUserNotify::V_NORMAL, _T("%s%s\n"), - TSS_GetString( cTW, tw::STR_WRITE_CONFIG_FILE).c_str(), - cDisplayEncoder::EncodeInline( filename ).c_str()); -} - /////////////////////////////////////////////////////////////////////////////// // ReadConfigText @@ -742,111 +631,6 @@ void cTWUtil::ReadConfigText(const TCHAR* filename, TSTRING& configText, cArchiv } -void cTWUtil::ReadConfigText(cArchive &arch, TSTRING& configText, cArchive* pBaggage) -{ -// TODO -- neat up this function; try to use LoadObject() above... - - cSerializableNString nstring; - - TSTRING filename = TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME); - - // This was coppied from ReadObject(). We need to use the baggage of the - // file header to obtain the public key, thus the special casing. - cDebug d("ReadConfigText"); - d.TraceDebug(_T("Reading %s from file %s\n"), nstring.GetType().AsString(), filename.c_str()); - - iUserNotify::GetInstance()->Notify( iUserNotify::V_VERBOSE, _T("%s%s\n"), - TSS_GetString( cTW, tw::STR_OPEN_CONFIG_FILE).c_str(), - cDisplayEncoder::EncodeInline( filename ).c_str()); - - - cFileHeader fileHeader; - - try - { - cSerializerImpl fhSer(arch, cSerializerImpl::S_READ); - fileHeader.Read(&fhSer); - } - catch (eError&) - { - throw eSerializerInputStreamFmt(_T(""), filename.c_str(), eSerializer::TY_FILE); - } - -#if 0 // XXX: This is broken, how can you convert a class to an int??? -PH - d.TraceDebug("Found a file header of type %d.\n", fileHeader.GetEncoding()); -#endif - - // check for a mismatched header - if (fileHeader.GetID() != cConfigFile::GetFileHeaderID()) - throw eSerializerInputStreamFmt(_T(""), filename.c_str(), eSerializer::TY_FILE); - - // check the version - if (fileHeader.GetVersion() != CURRENT_FIXED_VERSION) - throw eSerializerVersionMismatch(_T(""), filename.c_str(), eSerializer::TY_FILE); - - // switch on the type of encoding... - if(fileHeader.GetEncoding() == cFileHeader::ASYM_ENCRYPTION) - { - d.TraceDebug("Config file is compressed, public key len %d.\n", fileHeader.GetBaggage().Length()); - - // tell the user the db is encrypted - iUserNotify::GetInstance()->Notify( iUserNotify::V_VERBOSE, TSS_GetString(cTW, tw::STR_FILE_ENCRYPTED).c_str()); - iUserNotify::GetInstance()->Notify( iUserNotify::V_VERBOSE, TSS_GetString(cTW, tw::STR_NEWLINE).c_str()); - - ASSERT(fileHeader.GetBaggage().Length() > 0); - if (fileHeader.GetBaggage().Length() <= 0) - ThrowAndAssert(eSerializerInputStreamFmt(_T(""), filename.c_str(), eSerializer::TY_FILE)); - - fileHeader.GetBaggage().MapArchive(0, fileHeader.GetBaggage().Length()); - - cElGamalSigPublicKey publicKey(fileHeader.GetBaggage().GetMap()); - - cElGamalSigArchive cryptoArchive; - cryptoArchive.SetRead(&arch, &publicKey); - - cSerializerImpl ser(cryptoArchive, cSerializerImpl::S_READ); - ser.Init(); - ser.ReadObject(&nstring); - ser.Finit(); - - // copy the baggage into the archive, if it was passed in - // Note: We rely in VerifySiteKey that we only fill out pBaggage if - // the config file is encrypted. - // - if( pBaggage ) - { - fileHeader.GetBaggage().Seek( 0, cBidirArchive::BEGINNING ); - pBaggage->Copy( &fileHeader.GetBaggage(), fileHeader.GetBaggage().Length() ); - } - } - else if(fileHeader.GetEncoding() == cFileHeader::COMPRESSED) - { - d.TraceDebug("Config file is not compressed.\n"); - - //not encrypted db... - cNullCryptoArchive cryptoArchive; - cryptoArchive.Start(&arch); - - cSerializerImpl ser(cryptoArchive, cSerializerImpl::S_READ); - ser.Init(); - ser.ReadObject(&nstring); - ser.Finit(); - } - else - // unknown encoding... - throw eSerializerInputStreamFmt(_T(""), filename.c_str(), eSerializer::TY_FILE); - - // check 8 byte header - if (nstring.mString.compare(0, 8*sizeof(byte), CONFIG_FILE_MAGIC_8BYTE) != 0) - ThrowAndAssert(eSerializerInputStreamFmt(_T(""), filename.c_str(), eSerializer::TY_FILE)); - - // remove 8 byte header - nstring.mString.assign(nstring.mString.substr(8)); - - cStringUtil::Convert( configText, nstring.mString ); -} - - /////////////////////////////////////////////////////////////////////////////// // Given a filename and the text of a policy file, write an encrypted version // of the policy file text to disk. @@ -871,26 +655,6 @@ void cTWUtil::WritePolicyText(const TCHAR* filename, const std::string& polText, cDisplayEncoder::EncodeInline( filename ).c_str() ); } -void cTWUtil::WritePolicyText(cArchive &archive, const std::string& polText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey) -{ - cSerializableNString nstring; - - TSTRING filename = TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME); - - // add a 8 byte header we can use to verify decryption - nstring.mString = POLICY_FILE_MAGIC_8BYTE; - - nstring.mString += polText; - - cFileHeader fileHeader; - fileHeader.SetID(cPolicyFile::GetFileHeaderID()); - - WriteObjectToArchive(archive, filename.c_str(), NULL, nstring, fileHeader, bEncrypt, pPrivateKey); - - iUserNotify::GetInstance()->Notify( iUserNotify::V_NORMAL, _T("%s%s\n"), - TSS_GetString( cTW, tw::STR_WRITE_POLICY_FILE).c_str(), - cDisplayEncoder::EncodeInline( filename ).c_str()); -} /////////////////////////////////////////////////////////////////////////////// // ReadPolicyText @@ -917,24 +681,6 @@ void cTWUtil::ReadPolicyText(const TCHAR* filename, std::string& polText, const polText = nstring.mString; } -void cTWUtil::ReadPolicyText(cArchive &archive, std::string& polText, const cElGamalSigPublicKey* pPublicKey) -{ - cSerializableNString nstring; - - TSTRING filename = TSS_GetString( cTW, tw::STR_MEMORY_MAPPED_FILENAME); - - bool bEncrypted; - ReadObjectFromArchive(archive, filename.c_str(), NULL, nstring, cPolicyFile::GetFileHeaderID(), pPublicKey, bEncrypted); - - // check 8 byte header - if (nstring.mString.compare(0, 8*sizeof(byte), POLICY_FILE_MAGIC_8BYTE) != 0) - ThrowAndAssert(eSerializerInputStreamFmt(_T(""), filename.c_str(), eSerializer::TY_FILE)); - - // remove 8 byte header - nstring.mString.assign(nstring.mString.substr(8)); - - polText = nstring.mString; -} /////////////////////////////////////////////////////////////////////////////// // OpenKeyFile diff --git a/src/tw/twutil.h b/src/tw/twutil.h index 6bd7bab..fa629a6 100644 --- a/src/tw/twutil.h +++ b/src/tw/twutil.h @@ -106,16 +106,16 @@ public: // if an error occurs, this will print the error message to stderr and throw eError. static void WriteReport (const TCHAR* filename, const cFCOReportHeader& reportHeader, const cFCOReport& r, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey); // throw eError - static void WriteReport (cArchive &archive, const cFCOReportHeader& reportHeader, const cFCOReport& r, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey); // throw eError + static void ReadReport (const TCHAR* reportFileName, cFCOReportHeader& reportHeader, cFCOReport& r, const cElGamalSigPublicKey* pPublicKey, bool silent, bool& bEncrypted); // throw eError - static void ReadReport (cArchive &archive, cFCOReportHeader& reportHeader, cFCOReport& r, const cElGamalSigPublicKey* pPublicKey, bool silent, bool& bEncrypted); // throw eError + // same as Read/WriteDatabase above, except it operates on reports // if an error occurs, this will print the error message to stderr and throw eError. static void WriteConfigText(const TCHAR* filename, const TSTRING configText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey); // throw (eArchive()) - static void WriteConfigText(cArchive &archive, const TSTRING configText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey); // throw (eArchive()) + static void ReadConfigText(const TCHAR* filename, TSTRING& configText, cArchive* pBaggage = 0); - static void ReadConfigText(cArchive &archive, TSTRING& configText, cArchive* pBaggage = 0); + // read and write config file text to and from disk. // if pBaggage is non-NULL, the contents of the baggage( ie -- the public key ) is copied to the archive. // eArchive is thrown if filename can not be opened @@ -123,9 +123,9 @@ public: // eConfigFile is thrown if config file does not parse correctly during reading static void WritePolicyText(const TCHAR* filename, const std::string& policyText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey); - static void WritePolicyText(cArchive &archive, const std::string& policyText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey); + static void ReadPolicyText(const TCHAR* filename, std::string& policyText, const cElGamalSigPublicKey* pPublicKey); - static void ReadPolicyText(cArchive &archive, std::string& policyText, const cElGamalSigPublicKey* pPublicKey); + // read and write policy file to and from disk // eError() will be thrown on error From 97a2d44481229d18df916afead3dc6e90c0d9a21 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 19 Aug 2017 20:13:07 -0700 Subject: [PATCH 039/110] Disable incomplete impl for long property names, but don't remove it in case we want to finish it someday. This ensures that '&unimplemented' is not recognized as a valid property name in policy files. --- src/fs/fsparserutil.cpp | 6 ++++++ src/fs/fsstrings.cpp | 7 ++++--- src/fs/fsstrings.h | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/fs/fsparserutil.cpp b/src/fs/fsparserutil.cpp index c9c3e64..d93bbf8 100644 --- a/src/fs/fsparserutil.cpp +++ b/src/fs/fsparserutil.cpp @@ -83,6 +83,11 @@ bool cFSParserUtil::MapStringToProperty( const TSTRING& str, int& propIndex ) co default: fMappedChar = false; break; } } + else + fMappedChar = false; + +/* Leaving this here in case we ever want to implement long property names + else { if( 0 == str.compare( TSS_GetString( cFS, fs::STR_PARSER_PROP_MODE ) ) ) @@ -122,6 +127,7 @@ bool cFSParserUtil::MapStringToProperty( const TSTRING& str, int& propIndex ) co else fMappedChar = false; } +*/ return( fMappedChar ); } diff --git a/src/fs/fsstrings.cpp b/src/fs/fsstrings.cpp index 1d5775d..e639723 100644 --- a/src/fs/fsstrings.cpp +++ b/src/fs/fsstrings.cpp @@ -73,8 +73,9 @@ TSS_BeginStringtable( cFS ) TSS_StringEntry( fs::STR_PROP_SHA, _T("SHA") ), TSS_StringEntry( fs::STR_PROP_HAVAL, _T("HAVAL") ), TSS_StringEntry( fs::STR_PROP_ACL, _T("ACL Placeholder -- Not Implemented") ), - - // TODO: get actual strings + +/* Leaving these here in case we ever implement long property names + TSS_StringEntry( fs::STR_PARSER_PROP_DEV, _T("unimplemented") ), TSS_StringEntry( fs::STR_PARSER_PROP_RDEV, _T("unimplemented") ), TSS_StringEntry( fs::STR_PARSER_PROP_INODE, _T("unimplemented") ), @@ -94,7 +95,7 @@ TSS_BeginStringtable( cFS ) TSS_StringEntry( fs::STR_PARSER_PROP_MD5, _T("unimplemented") ), TSS_StringEntry( fs::STR_PARSER_PROP_SHA, _T("unimplemented") ), TSS_StringEntry( fs::STR_PARSER_PROP_HAVAL, _T("unimplemented") ), - +*/ TSS_StringEntry( fs::STR_PARSER_READONLY, _T("ReadOnly")), TSS_StringEntry( fs::STR_PARSER_DYNAMIC, _T("Dynamic")), TSS_StringEntry( fs::STR_PARSER_GROWING, _T("Growing")), diff --git a/src/fs/fsstrings.h b/src/fs/fsstrings.h index 10a655b..ad4a6dc 100644 --- a/src/fs/fsstrings.h +++ b/src/fs/fsstrings.h @@ -77,7 +77,8 @@ TSS_BeginStringIds( fs ) STR_PROP_SHA, STR_PROP_HAVAL, STR_PROP_ACL, - + +/* Leaving these here in case we ever implement long property names STR_PARSER_PROP_DEV, STR_PARSER_PROP_RDEV, STR_PARSER_PROP_INODE, @@ -97,7 +98,7 @@ TSS_BeginStringIds( fs ) STR_PARSER_PROP_MD5, STR_PARSER_PROP_SHA, STR_PARSER_PROP_HAVAL, - +*/ STR_PARSER_READONLY, STR_PARSER_DYNAMIC, STR_PARSER_GROWING, From 01e25eb493b417a9627c1f490baa345f4f358371 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 19 Aug 2017 20:38:57 -0700 Subject: [PATCH 040/110] Remove a couple of unused FSServices methods --- src/core/fsservices.h | 2 -- src/core/unixfsservices.cpp | 37 --------------------------------- src/core/unixfsservices.h | 2 -- src/twtest/unixfsservices_t.cpp | 12 ----------- 4 files changed, 53 deletions(-) diff --git a/src/core/fsservices.h b/src/core/fsservices.h index 77e7e1b..0175f49 100644 --- a/src/core/fsservices.h +++ b/src/core/fsservices.h @@ -290,8 +290,6 @@ class iFSServices virtual bool Rename( const TSTRING& strOldName, const TSTRING& strNewName, bool fOverWrite = true ) const = 0; // rename a file - virtual bool GetOwnerForFile( const TSTRING& tstrFilename, TSTRING& tstrUser ) const = 0; - virtual bool GetGroupForFile( const TSTRING& tstrFilename, TSTRING& tstrGroup ) const = 0; virtual bool GetUserName( uid_t user_id, TSTRING& tstrUser ) const = 0; virtual bool GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const = 0; diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index 7f58ba9..934196f 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -497,43 +497,6 @@ void cUnixFSServices::SetResolveNames(bool resolve) mResolveNames=resolve; } -bool cUnixFSServices::GetOwnerForFile( const TSTRING& tstrFilename, TSTRING& tstrUser ) const -{ - bool fSuccess = true; - - struct stat statbuf; - int ret = lstat(tstrFilename.c_str(), &statbuf); - if(ret < 0) - { - fSuccess = false; - } - else - { - fSuccess = GetUserName(statbuf.st_uid, tstrUser); - } - - return( fSuccess ); -} - - -bool cUnixFSServices::GetGroupForFile( const TSTRING& tstrFilename, TSTRING& tstrGroup ) const -{ - bool fSuccess = true; - struct stat statbuf; - - int ret = lstat(tstrFilename.c_str(), &statbuf); - if(ret < 0) - { - fSuccess = false; - } - else - { - fSuccess = GetGroupName(statbuf.st_gid, tstrGroup); - } - - return( fSuccess ); -} - bool cUnixFSServices::GetUserName( uid_t user_id, TSTRING& tstrUser ) const { diff --git a/src/core/unixfsservices.h b/src/core/unixfsservices.h index 333bb71..c008dc0 100644 --- a/src/core/unixfsservices.h +++ b/src/core/unixfsservices.h @@ -132,8 +132,6 @@ class cUnixFSServices : public iFSServices virtual bool Rename( const TSTRING& strOldName, const TSTRING& strNewName, bool fOverWrite = true ) const; // rename a file - virtual bool GetOwnerForFile( const TSTRING& tstrFilename, TSTRING& tstrUser ) const; - virtual bool GetGroupForFile( const TSTRING& tstrFilename, TSTRING& tstrGroup ) const; virtual bool GetUserName( uid_t user_id, TSTRING& tstrUser ) const; virtual bool GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const; diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index 448a80b..9dab3de 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -153,18 +153,6 @@ void TestUnixFSServices() TSTRING newtestfile = _T("/tmp/new.tmp"); TEST( pFSServices->Rename( testfile, newtestfile ) ); - // test GetOwnerForFile - d.TraceDetail("Testing GetOwnerForFile:\n"); - TSTRING ownername; - TEST( pFSServices->GetOwnerForFile( newtestfile, ownername ) ); - d.TraceDetail("GetOwnerForFile returned owner %s.\n", ownername.c_str()); - - // test GetGroupForFile - d.TraceDetail("Testing GetGroupForFile:\n"); - TSTRING groupname; - TEST( pFSServices->GetGroupForFile( newtestfile, groupname ) ); - d.TraceDetail("GetGroupForFile returned group %s.\n", groupname.c_str()); - // test FileDelete d.TraceDetail("Testing FileDelete:\n"); TEST( pFSServices->FileDelete( newtestfile ) ); From fafa681bcebfcb84cbf74a42d4dab490db672f77 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 23 Aug 2017 17:58:12 -0700 Subject: [PATCH 041/110] Fix dbupdate secure-mode test, add a case for updating db twice w/ same report, clean up twtools methods a bit more. --- src/test-harness/tests/dbupdate.pm | 212 +++++++++++++++-------------- src/test-harness/twtools.pm | 42 ++++-- 2 files changed, 140 insertions(+), 114 deletions(-) diff --git a/src/test-harness/tests/dbupdate.pm b/src/test-harness/tests/dbupdate.pm index e536b4a..4f361f4 100644 --- a/src/test-harness/tests/dbupdate.pm +++ b/src/test-harness/tests/dbupdate.pm @@ -143,48 +143,52 @@ sub PrepareForTest sub RunBasicTest { twtools::logStatus("*** Beginning dbupdate.basic test\n"); - printf("%-30s", "-- dbupdate.basic test"); + printf("%-30s", "-- dbupdate.basic test"); - PrepareForTest(); + PrepareForTest(); - # make some violations... - # - MoveFile ( "meow.txt", "cat.txt" ); - CreateFile( "dog/bark.txt", "bark bark bark" ); - - # run the integrity check... - # - twtools::RunIntegrityCheck(); + # make some violations... + # + MoveFile ( "meow.txt", "cat.txt" ); + CreateFile( "dog/bark.txt", "bark bark bark" ); - # Make sure we got 4 violations: 2 mod, 1 add, 1 rm. - # - my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + # run the integrity check... + # + twtools::RunIntegrityCheck(); - if( ($n != 4) || ($a != 1) || ($r != 1) || ($c != 2) ) - { - twtools::logStatus("FAILED -- initial integrity check had unexpected results\n"); - return 0; - } + # Make sure we got 4 violations: 2 mod, 1 add, 1 rm. + # + my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); - # do the database update... - # - twtools::UpdateDatabase(); + if( ($n != 4) || ($a != 1) || ($r != 1) || ($c != 2) ) + { + twtools::logStatus("FAILED -- initial integrity check had unexpected results\n"); + return 0; + } - # do another IC and make sure there are no violations - # - twtools::RunIntegrityCheck(); + # do the database update... + # + if (0 != twtools::UpdateDatabase()) + { + twtools::logStatus("FAILED -- db update did not succeed\n"); + return 0; + } - ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); - - if( $n != 0 ) - { - twtools::logStatus("FAILED -- violations after update\n"); - return 0; - } - - ++$twtools::twpassedtests; - print "PASSED\n"; - return 1; + # do another IC and make sure there are no violations + # + twtools::RunIntegrityCheck(); + + ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + + if( $n != 0 ) + { + twtools::logStatus("FAILED -- violations after update\n"); + return 0; + } + + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; } ###################################################################### @@ -192,81 +196,87 @@ sub RunBasicTest # sub RunSecureModeTest { - twtools::logStatus("*** Beginning dbupdate.secure-mode test\n"); - printf("%-30s", "-- dbupdate.secure-mode test"); + twtools::logStatus("*** Beginning dbupdate.secure-mode test\n"); + printf("%-30s", "-- dbupdate.secure-mode test"); - ++$twtools::twskippedtests; - print "SKIPPED - this test needs further investigation\n"; - return 1; + PrepareForTest(); - PrepareForTest(); + # make a violation and generate a report + # + CreateFile( "dog/bark.txt", "bark bark bark" ); + twtools::RunIntegrityCheck( { report => $report1 } ); - # make a violation and generate a report - # - CreateFile( "dog/bark.txt", "bark bark bark" ); - twtools::RunIntegrityCheck( { report => $report1 } ); + # change the same file in a slightly different way and generate + # another report + # + CreateFile( "dog/bark.txt", "bark bark bark woof" ); + twtools::RunIntegrityCheck( { report => $report2 } ); - # change the same file in a slightly different way and generate - # another report - # - CreateFile( "dog/bark.txt", "bark bark bark woof" ); - twtools::RunIntegrityCheck( { report => $report2 } ); + # Remove a file and generate a third report + # + RemoveFile( "dog/bark.txt" ); + twtools::RunIntegrityCheck( { report => $report3 } ); - # Remove a file and generate a third report - # - RemoveFile( "dog/bark.txt" ); - twtools::RunIntegrityCheck( { report => $report3 } ); - - # Add a file and generate the fourth report - # - CreateFile( "dog/cow.txt", "moo moo" ); - twtools::RunIntegrityCheck( { report => $report4 } ); - - # Update the database with report 1. - # - twtools::UpdateDatabase( { report => $report1 } ); + # Add a file and generate the fourth report + # + CreateFile( "dog/cow.txt", "moo moo" ); + twtools::RunIntegrityCheck( { report => $report4 } ); - # Try to update the database with report 2 ... this should fail - # in secure-mode == high because the "old" values don't match. - # - if( twtools::UpdateDatabase( - { report => $report2, secure-mode => "high" } ) ) - { - twtools::logStatus("FAILED ... Secure-mode high didn't catch a bad update\n"); - return 0; - } + # Update the database with report 1. + # + twtools::UpdateDatabase( { report => $report1 } ); - # do a high severity update with report3 -- this should - # succeed - # - if( ! twtools::UpdateDatabase( - { report => $report3, secure-mode => "high" } ) ) - { - twtools::logStatus("FAILED ... Update with report 3 failed\n"); - return 0; - } - - # Try 2 again ... now we are trying to update an object that - # doesn't exist in the database at all. This should - # succeed in low but fail in high. - # - if( twtools::UpdateDatabase( - { report => $report2, secure-mode => "high" } ) ) - { - twtools::logStatus("FAILED ... Update with report 2 after 3 succeeded in high mode\n"); - return 0; - } + # Try to update the database with report 1 again ... this should fail + # in secure-mode == high because the db can't accept same changes again. + # + if( 0 == twtools::UpdateDatabase( + { report => $report1, secure-mode => "high" } ) ) + { + twtools::logStatus("FAILED ... Secure-mode high didn't catch a bad update\n"); + return 0; + } - if( ! twtools::UpdateDatabase( - { report => $report2, secure-mode => "low" } ) ) - { - twtools::logStatus("FAILED ... Update with report 2 after 3 failed in low mode\n"); - return 0; - } + # Try to update the database with report 2 ... this should fail + # in secure-mode == high because the "old" values don't match. + # + if( 0 == twtools::UpdateDatabase( + { report => $report2, secure-mode => "high" } ) ) + { + twtools::logStatus("FAILED ... Secure-mode high didn't catch a bad update\n"); + return 0; + } - ++$twtools::twpassedtests; - print "PASSED\n"; - return 1; + # do a high severity update with report3 -- this should + # succeed + # + if( 0 != twtools::UpdateDatabase( + { report => $report3, secure-mode => "high" } ) ) + { + twtools::logStatus("FAILED ... Update with report 3 failed\n"); + return 0; + } + + # Try 2 again ... now we are trying to update an object that + # doesn't exist in the database at all. This should + # succeed in low but fail in high. + # + if( 0 == twtools::UpdateDatabase( + { report => $report2, secure-mode => "high" } ) ) + { + twtools::logStatus("FAILED ... Update with report 2 after 3 succeeded in high mode\n"); + return 0; + } + + if( 0 != twtools::UpdateDatabase( + { report => $report2, secure-mode => "low" } ) ) + { + twtools::logStatus("FAILED ... Update with report 2 after 3 failed in low mode\n"); + return 0; + } + + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; } diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 8950e06..e74fddd 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -273,9 +273,13 @@ sub GeneratePolicyFile { print "generating policy file...\n" if $verbose; - logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc 2>&1`); + my (@out) = `$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc 2>&1`; - return ($? == 0); + my ($result) = ${^CHILD_ERROR_NATIVE}; + + logStatus(@out); + + return $result; } @@ -291,9 +295,13 @@ sub CreatePolicy { print "generating policy file...\n" if $verbose; - logStatus(`$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $params{policy-text} 2>&1`); + my (@out) = `$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $params{policy-text} 2>&1`; - return ($? == 0); + my ($result) = ${^CHILD_ERROR_NATIVE}; + + logStatus(@out); + + return $result; } @@ -305,9 +313,13 @@ sub InitializeDatabase { my ($twmsg) = @_; print "initializing database for '$twmsg' test...\n" if $verbose; - logStatus(`$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`); + my (@out) = `$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`; - return ($? == 0); + my ($result) = ${^CHILD_ERROR_NATIVE}; + + logStatus(@out); + + return $result; } @@ -317,13 +329,17 @@ sub InitializeDatabase { sub UpdateDatabase { my (%params) = %{$_[0]}; - $params{'report'} = $reportloc if( ! defined($params{'report'}) ); - $params{'secure-mode'} = "low" if( ! defined($params{'secure-mode'}) ); + $params{report} = $reportloc if( ! defined($params{report}) ); + $params{secure-mode} = "low" if( ! defined($params{secure-mode}) ); print "updating database for '$twmsg' test...\n" if $verbose; - logStatus(`$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{'secure-mode'} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc -r $params{'report'} 2>&1`); - - return ($? == 0); + my (@out) = `$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{secure-mode} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc -r $params{report} 2>&1`; + + my ($result) = ${^CHILD_ERROR_NATIVE}; + + logStatus(@out); + + return $result; } ###################################################################### @@ -332,10 +348,10 @@ sub UpdateDatabase { sub UpdatePolicy { my (%params) = %{$_[0]}; - $params{'secure-mode'} = "low" if( ! defined($params{'secure-mode'}) ); + $params{secure-mode} = "low" if( ! defined($params{secure-mode}) ); print "updating policy for '$twmsg' test...\n" if $verbose; - logStatus(`$twrootdir/bin/tripwire -m p -P $twsitepass -Q $twlocalpass -Z $params{'secure-mode'} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc $twrootdir/$twpolicyloc 2>&1`); + logStatus(`$twrootdir/bin/tripwire -m p -P $twsitepass -Q $twlocalpass -Z $params{secure-mode} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc $twrootdir/$twpolicyloc 2>&1`); return ($? == 0); } From f5e76827be7892db9b95c4375e84e3cd1b291756 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 23 Aug 2017 23:36:21 -0700 Subject: [PATCH 042/110] Robustify symlink reading in cFSPropCalc, & add a unit test for it. Tweak other unit tests to use a test directory we control, rather than dumping stuff in /tmp --- Makefile.am | 3 ++- Makefile.in | 3 ++- src/fs/fspropcalc.cpp | 22 +++++++++++++++----- src/fs/fspropcalc.h | 10 ++++++++- src/twtest/archive_t.cpp | 8 ++++---- src/twtest/cryptoarchive_t.cpp | 16 +++++++-------- src/twtest/debug_t.cpp | 3 +-- src/twtest/fcocompare_t.cpp | 17 ++++++++-------- src/twtest/file_t.cpp | 3 +-- src/twtest/fileutil_t.cpp | 6 ++---- src/twtest/fspropcalc_t.cpp | 22 ++++++++++++++++++-- src/twtest/fsspec_t.cpp | 6 +++--- src/twtest/keyfile_t.cpp | 4 ++-- src/twtest/serializerimpl_t.cpp | 12 +++++------ src/twtest/signature_t.cpp | 3 +-- src/twtest/tchar_t.cpp | 6 ++++-- src/twtest/test.cpp | 34 +++++++++++++++++++++++++++---- src/twtest/test.h | 6 +++--- src/twtest/textreportviewer_t.cpp | 2 +- src/twtest/twutil_t.cpp | 18 ++++++++-------- src/twtest/unixfsservices_t.cpp | 8 ++++---- 21 files changed, 136 insertions(+), 76 deletions(-) diff --git a/Makefile.am b/Makefile.am index bfcd93a..d9ee690 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,5 +14,6 @@ uninstall-hook: check: rm -Rf $(top_srcdir)/src/test-harness/twtest + rm -Rf $(top_srcdir)/bin/TWTestData cd $(top_srcdir)/src/test-harness && perl ./twtest.pl - $(top_srcdir)/bin/twtest all + cd $(top_srcdir)/bin && ./twtest all diff --git a/Makefile.in b/Makefile.in index c0b3364..0a11cca 100644 --- a/Makefile.in +++ b/Makefile.in @@ -809,8 +809,9 @@ uninstall-hook: check: rm -Rf $(top_srcdir)/src/test-harness/twtest + rm -Rf $(top_srcdir)/bin/TWTestData cd $(top_srcdir)/src/test-harness && perl ./twtest.pl - $(top_srcdir)/bin/twtest all + cd $(top_srcdir)/bin && ./twtest all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index 7bbb907..dca9572 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -85,21 +85,33 @@ static bool NeedsStat(const cFCOPropVector& v) /////////////////////////////////////////////////////////////////////////////// -static bool GetSymLinkStr(const TSTRING& strName, cArchive& arch) +bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t size) { - char buf[1024]; // TODO: is this big enough? + std::vector data(size+1); + char* buf = &data[0]; + #if defined(O_PATH) int fd = open(strName.c_str(), (O_PATH | O_NOFOLLOW | O_NOATIME)); - int rtn = readlinkat(fd, 0, buf, 1024); + int rtn = readlinkat(fd, 0, buf, size); close(fd); #else - int rtn = readlink( strName.c_str(), buf, 1024 ); + int rtn = readlink( strName.c_str(), buf, size ); #endif if(rtn == -1) return false; - // the return value is the number of characters written. + //Sadly if buf isn't big enough readlink 'succeeds' by truncating the string, so the only + // clue your buffer might be too small is if you maxed it out. So we try again, within reason. + if((size_t)rtn == size) + { + if(size < 128*TW_PATH_SIZE) + return GetSymLinkStr(strName, arch, size*2); + + return false; + } + + // the return value is the number of characters written. arch.WriteBlob(buf, rtn); return true; diff --git a/src/fs/fspropcalc.h b/src/fs/fspropcalc.h index 4fda77d..d476b13 100644 --- a/src/fs/fspropcalc.h +++ b/src/fs/fspropcalc.h @@ -53,6 +53,12 @@ #include "core/archive.h" #include "fspropset.h" +#ifdef PATH_MAX +# define TW_PATH_SIZE PATH_MAX +#else +# define TW_PATH_SIZE 1024 +#endif + TSS_FILE_EXCEPTION( eFSPropCalc, eFileError ) //TSS_EXCEPTION( eFSPropCalcResetAccessTime, eFSPropCalc ) // this was never used @@ -79,7 +85,9 @@ public: virtual int GetCalcFlags() const; virtual void SetCalcFlags( int i ); - + + static bool GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t size = TW_PATH_SIZE); + private: cFSPropCalc( const cFSPropCalc& ); void operator =( const cFSPropCalc& ); diff --git a/src/twtest/archive_t.cpp b/src/twtest/archive_t.cpp index 8612c10..e2e479d 100644 --- a/src/twtest/archive_t.cpp +++ b/src/twtest/archive_t.cpp @@ -104,8 +104,8 @@ void TestArchive() // cLockedTemporaryFileArchive - TSTRING lockedFileName = TEMP_DIR; - lockedFileName += _T("/inaccessable_file.bin"); + TSTRING lockedFileName = TwTestPath("inaccessable_file.bin"); +// lockedFileName += _T("/inaccessable_file.bin"); cLockedTemporaryFileArchive lockedArch; @@ -130,8 +130,8 @@ void TestArchive() lockedArch.Close(); // cFileArchive - TSTRING fileName = TEMP_DIR; - fileName += _T("/archive_test.bin"); + TSTRING fileName = TwTestPath("archive_test.bin"); + //fileName += _T("/archive_test.bin"); cFileArchive filearch; filearch.OpenReadWrite(fileName.c_str()); diff --git a/src/twtest/cryptoarchive_t.cpp b/src/twtest/cryptoarchive_t.cpp index 9cb5504..292a9a4 100644 --- a/src/twtest/cryptoarchive_t.cpp +++ b/src/twtest/cryptoarchive_t.cpp @@ -70,7 +70,7 @@ void TestCryptoArchive() d.TraceDetail("Encrypting using symmetric key\n"); cFileArchive outFile; - outFile.OpenReadWrite(TEMP_DIR _T("/crypted.bin")); + outFile.OpenReadWrite(TwTestPath("crypted.bin")); idea.SetKey(iCipher::ENCRYPT, ideaKey); cCryptoArchive outCrypt; @@ -90,7 +90,7 @@ void TestCryptoArchive() d.TraceDetail("Decrypting using symmetric key\n"); cFileArchive inFile; - inFile.OpenRead(TEMP_DIR _T("/crypted.bin")); + inFile.OpenRead(TwTestPath("crypted.bin")); idea.SetKey(iCipher::DECRYPT, ideaKey); cCryptoArchive inCrypt; @@ -129,7 +129,7 @@ void TestCryptoArchive() d.TraceDetail("Signing using asymmetric key\n"); cFileArchive outFile; - outFile.OpenReadWrite(TEMP_DIR _T("/rsacrypted.bin")); + outFile.OpenReadWrite(TwTestPath("rsacrypted.bin").c_str()); cElGamalSigArchive outCrypt; outCrypt.SetWrite(&outFile, privateKey); @@ -149,7 +149,7 @@ void TestCryptoArchive() d.TraceDetail("Verifying using asymmetric key\n"); cFileArchive inFile; - inFile.OpenRead(TEMP_DIR _T("/rsacrypted.bin")); + inFile.OpenRead(TwTestPath("rsacrypted.bin").c_str()); cElGamalSigArchive inCrypt; inCrypt.SetRead(&inFile, publicKey); @@ -206,7 +206,7 @@ void TestCryptoArchive() d.TraceDetail("Encrypting using asymmetric key\n"); cFileArchive outFile; - outFile.OpenReadWrite(TEMP_DIR _T("/rsacrypted.bin")); + outFile.OpenReadWrite(TwTestPath("rsacrypted.bin").c_str()); cRSAArchive outCrypt; outCrypt.SetWrite(&outFile, publicKey); @@ -226,7 +226,7 @@ void TestCryptoArchive() d.TraceDetail("Decrypting using asymmetric key\n"); cFileArchive inFile; - inFile.OpenRead(TEMP_DIR _T("/rsacrypted.bin")); + inFile.OpenRead(TwTestPath("rsacrypted.bin").c_str()); cRSAArchive inCrypt; inCrypt.SetRead(&inFile, privateKey); @@ -252,7 +252,7 @@ void TestCryptoArchive() d.TraceDetail("Signing using asymmetric key\n"); cFileArchive outFile; - outFile.OpenReadWrite(TEMP_DIR _T("/rsacrypted.bin")); + outFile.OpenReadWrite(TwTestPath("rsacrypted.bin").c_str()); cRSAArchive outCrypt; outCrypt.SetWrite(&outFile, privateKey); @@ -272,7 +272,7 @@ void TestCryptoArchive() d.TraceDetail("Verifying using asymmetric key\n"); cFileArchive inFile; - inFile.OpenRead(TEMP_DIR _T("/rsacrypted.bin")); + inFile.OpenRead(TwTestPath("rsacrypted.bin").c_str()); cRSAArchive inCrypt; inCrypt.SetRead(&inFile, publicKey); diff --git a/src/twtest/debug_t.cpp b/src/twtest/debug_t.cpp index 6ec8832..ad0d9f6 100644 --- a/src/twtest/debug_t.cpp +++ b/src/twtest/debug_t.cpp @@ -73,8 +73,7 @@ void TestDebug() // set up an output file...use the temp file in test.h - std::string str = TEMP_DIR_N; - str += "/debug.out"; + std::string str = TwTestPath("debug.out"); #ifdef DEBUG TEST(cDebug::SetOutputFile(str.c_str())); diff --git a/src/twtest/fcocompare_t.cpp b/src/twtest/fcocompare_t.cpp index 0ebedda..686665e 100644 --- a/src/twtest/fcocompare_t.cpp +++ b/src/twtest/fcocompare_t.cpp @@ -62,18 +62,17 @@ static void PrintProps(const iFCO* pFCO) void TestFCOCompare() { - const TCHAR* FILE_NAME = TEMP_DIR _T("/dog.txt"); - const char* FILE_NAME_N = TEMP_DIR_N "/dog.txt"; + std::string filename = TwTestPath("dog.txt"); cDebug d("TestFCOCompare"); d.TraceDebug("Entering...\n"); // first, create an fco to compare with... - TOFSTREAM fstr(FILE_NAME_N); + TOFSTREAM fstr(filename); if(fstr.bad()) { - d.TraceError("Unable to create test file %s!\n", FILE_NAME); + d.TraceError("Unable to create test file %s!\n", filename.c_str()); TEST(false); return; } @@ -83,7 +82,7 @@ void TestFCOCompare() // create the test FCO cFSDataSourceIter ds; - ds.SeekToFCO(cFCOName(FILE_NAME), false); + ds.SeekToFCO(cFCOName(filename), false); iFCO* pFCO = ds.CreateFCO(); TEST(pFCO); @@ -110,10 +109,10 @@ void TestFCOCompare() // change the file... d.TraceDebug("Changing the file...\n"); - fstr.open(FILE_NAME); + fstr.open(filename); if(fstr.bad()) { - d.TraceError("Unable to reopen %s!\n", FILE_NAME_N); + d.TraceError("Unable to reopen %s!\n", filename.c_str()); TEST(false); return; } @@ -123,7 +122,7 @@ void TestFCOCompare() //need a new data source iter, otherwise the existing FCO gets updated & you get a ref to it, // and the resulting FCOs always match. cFSDataSourceIter ds2; - ds2.SeekToFCO(cFCOName(FILE_NAME), false); + ds2.SeekToFCO(cFCOName(filename), false); iFCO* pFCO2 = ds2.CreateFCO(); TEST(pFCO2); pFCO2->AcceptVisitor(&propCalc); @@ -137,7 +136,7 @@ void TestFCOCompare() //result.mPropVector.TraceContents(); cFSDataSourceIter ds3; - ds3.SeekToFCO(cFCOName(FILE_NAME), false); + ds3.SeekToFCO(cFCOName(filename), false); // try testing properties that weren't calculated... d.TraceDebug("Comparing FCOs with different properties calculated\n"); iFCO* pFCO3 = ds3.CreateFCO(); diff --git a/src/twtest/file_t.cpp b/src/twtest/file_t.cpp index 9bfc3ae..9700b83 100644 --- a/src/twtest/file_t.cpp +++ b/src/twtest/file_t.cpp @@ -39,8 +39,7 @@ void TestFile() { - TSTRING fileName = TEMP_DIR; - fileName += _T("/file_test.bin"); + TSTRING fileName = TwTestPath("file_test.bin"); //Create a temporary file for testing: FILE* testStream; diff --git a/src/twtest/fileutil_t.cpp b/src/twtest/fileutil_t.cpp index 05d2936..b71a824 100644 --- a/src/twtest/fileutil_t.cpp +++ b/src/twtest/fileutil_t.cpp @@ -49,8 +49,7 @@ using namespace std; void TestFileUtil() { - TSTRING source = TEMP_DIR; - source += _T("/copy_src"); + TSTRING source = TwTestPath("copy_src"); //Create a temporary file for testing: FILE* testStream; @@ -64,8 +63,7 @@ void TestFileUtil() fwrite( testString.c_str(), sizeof(TCHAR), iTestStringLength, testStream ); fclose( testStream ); - TSTRING dest = TEMP_DIR; - dest += "/copy_dest"; + TSTRING dest = TwTestPath("copy_dest"); TEST(cFileUtil::Copy(source, dest)); diff --git a/src/twtest/fspropcalc_t.cpp b/src/twtest/fspropcalc_t.cpp index be8d838..b98af3e 100644 --- a/src/twtest/fspropcalc_t.cpp +++ b/src/twtest/fspropcalc_t.cpp @@ -43,6 +43,8 @@ #include #include +#include +#include /////////////////////////////////////////////////////////////////////////////// // PrintProps -- prints out all the valid property names and values as pairs... @@ -67,8 +69,7 @@ void TestFSPropCalc() { cDebug d("TestFSPropCalc"); cFSDataSourceIter ds; - TSTRING foo_bin = TEMP_DIR; - foo_bin.append("/foo.bin"); + TSTRING foo_bin = TwTestPath("foo.bin"); //iFSServices* pFSServices = iFSServices::GetInstance(); @@ -138,3 +139,20 @@ void TestFSPropCalc() return; } + +void TestGetSymLinkStr() +{ + std::string file = TwTestPath("12345678901234567890123456789012345678901234567890123456789012345678901234567890"); + std::string link = TwTestPath("linky"); + + int fd = creat(file.c_str(), 0777); + close(fd); + + symlink(file.c_str(), link.c_str()); + + cMemoryArchive arch(1024*1024); + TEST(cFSPropCalc::GetSymLinkStr(link, arch, 8)); + TEST(arch.Length() == (int64)file.size()); +} + + diff --git a/src/twtest/fsspec_t.cpp b/src/twtest/fsspec_t.cpp index 26b2aae..c115988 100644 --- a/src/twtest/fsspec_t.cpp +++ b/src/twtest/fsspec_t.cpp @@ -73,9 +73,9 @@ void TestFCOSpecImpl() cFSDataSourceIter dataSrc; // test AllChildStopPoint fcos... - d.TraceDebug("Now testing a spec whose start point is the only thing it maps to (%s)\n", TEMP_DIR); - cFCOSpecImpl* pSpec2 = new cFCOSpecImpl(TEMP_DIR, &dataSrc, new cFCOSpecNoChildren); - pSpec2->SetStartPoint(cFCOName(TEMP_DIR)); + d.TraceDebug("Now testing a spec whose start point is the only thing it maps to (%s)\n", TwTestDir().c_str()); + cFCOSpecImpl* pSpec2 = new cFCOSpecImpl(TwTestDir(), &dataSrc, new cFCOSpecNoChildren); + pSpec2->SetStartPoint(cFCOName(TwTestDir())); dataSrc.SeekToFCO(pSpec2->GetStartPoint(), false); iFCO* pFCO = dataSrc.CreateFCO(); TEST(pFCO); diff --git a/src/twtest/keyfile_t.cpp b/src/twtest/keyfile_t.cpp index a2f7690..4570363 100644 --- a/src/twtest/keyfile_t.cpp +++ b/src/twtest/keyfile_t.cpp @@ -114,11 +114,11 @@ void TestKeyFile() // save to and read from disk d.TraceDebug("Read/Write to file...\n"); { - keyfile.WriteFile(TEMP_DIR _T("/keyfile.key")); + keyfile.WriteFile(TwTestPath("keyfile.key").c_str()); cKeyFile keyfile2; TEST(!keyfile2.KeysLoaded()); - keyfile2.ReadFile(TEMP_DIR _T("/keyfile.key")); + keyfile2.ReadFile(TwTestPath("keyfile.key").c_str()); TEST(keyfile2.KeysLoaded()); cElGamalSig elGamal(*keyfile2.GetPublicKey()); diff --git a/src/twtest/serializerimpl_t.cpp b/src/twtest/serializerimpl_t.cpp index 9d8681c..cf69777 100644 --- a/src/twtest/serializerimpl_t.cpp +++ b/src/twtest/serializerimpl_t.cpp @@ -119,7 +119,7 @@ void TestSerializerImpl() // writing { cFileArchive file; - file.OpenReadWrite(TEMP_DIR _T("/tmp.bin")); + file.OpenReadWrite(TwTestPath("tmp.bin").c_str()); cSerializerImpl serializer(file, cSerializerImpl::S_WRITE); serializer.Init(); @@ -127,16 +127,16 @@ void TestSerializerImpl() cSerializerTestObject testobj; testobj.Write(&serializer); - db.TraceAlways(" Writeing object 1...\n"); + db.TraceAlways(" Writing object 1...\n"); serializer.WriteObject(&testobj); - db.TraceAlways(" Writeing object 2...\n"); + db.TraceAlways(" Writing object 2...\n"); serializer.WriteObject(&testobj); - db.TraceAlways(" Writeing object 3...\n"); + db.TraceAlways(" Writing object 3...\n"); serializer.WriteObject(&testobj); - db.TraceAlways(" Writeing object 4...\n"); + db.TraceAlways(" Writing object 4...\n"); serializer.WriteObject(&testobj); serializer.Finit(); @@ -145,7 +145,7 @@ void TestSerializerImpl() // reading { cFileArchive file; - file.OpenRead(TEMP_DIR _T("/tmp.bin")); + file.OpenRead(TwTestPath("tmp.bin").c_str()); cSerializerImpl serializer(file, cSerializerImpl::S_READ); serializer.Init(); diff --git a/src/twtest/signature_t.cpp b/src/twtest/signature_t.cpp index fab1acc..55ee530 100644 --- a/src/twtest/signature_t.cpp +++ b/src/twtest/signature_t.cpp @@ -87,8 +87,7 @@ void TestSignature() //sha : Oia1aljHD793tfj7M55tND+3OG/ //haval : BL6bFSo0EP5zf8lGSueeed - TSTRING sigFileName = TEMP_DIR; - sigFileName += TSTRING( _T("/signature_test.bin") ); + TSTRING sigFileName = TwTestPath("signature_test.bin"); cFileArchive fileArc; fileArc.OpenReadWrite(sigFileName.c_str()); diff --git a/src/twtest/tchar_t.cpp b/src/twtest/tchar_t.cpp index b7e9485..36006d6 100644 --- a/src/twtest/tchar_t.cpp +++ b/src/twtest/tchar_t.cpp @@ -39,6 +39,8 @@ #include "core/debug.h" #endif +#include "test.h" + TSTRING test_wost(int, const TSTRING&); void test_wist(const TSTRING&, cDebug& d); @@ -87,8 +89,8 @@ void TestTCHAR() //Testing file streams //explict constructors of 'TIFSTREAM' and "TOFSTREAM' take char* - const char* inputfile = "fun"; - const char* outputfile = "mo'fun"; + std::string inputfile = TwTestPath("fun"); + std::string outputfile = TwTestPath("mo'fun"); //Set up the input file. TOFSTREAM out; diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index 31ba32f..fd6b2b9 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -42,8 +42,6 @@ #include "twparser/twparser.h" #include "tw/tw.h" #include "fco/fco.h" - - #include "fs/fs.h" #include "util/util.h" @@ -51,6 +49,7 @@ #include "core/debug.h" #include "core/error.h" #include "core/twlocale.h" +#include "core/fsservices.h" #include "test.h" #include "core/errorbucketimpl.h" #include "tw/twinit.h" @@ -62,6 +61,8 @@ #include "db/blockrecordarray.h" #include "db/hierdatabase.h" +#include +#include // the test routines void TestFCOName(); @@ -99,7 +100,7 @@ void TestTextReportViewer(); void TestFCONameTbl(); void TestConfigFile(); void TestResources(); - +void TestGetSymLinkStr(); void TestPolicyParser(); void TestFCOSpecHelper(); @@ -187,7 +188,7 @@ static void Test(int testID) case 14: TestFCOPropVector(); break; case 15: TestFCOPropImpl(); break; case 16: TestFCOReport(); break; - + case 17: TestGetSymLinkStr(); break; case 18: TestFCOSetImpl(); break; case 19: TestFCOSpec(); break; case 20: TestFCOSpecAttr(); break; @@ -294,6 +295,31 @@ static void Test(int testID) TCERR << std::endl << "=== test ID #" << testID << " currently unused ===" << std::endl; } +std::string TwTestDir() +{ + static std::string dir; + + if(dir.empty()) + { + iFSServices::GetInstance()->GetCurrentDir(dir); + dir.append("/TWTestData"); + TCERR << "Using test directory: " << dir << std::endl; + mkdir(dir.c_str(), 0777); + } + + return dir; +} + +std::string TwTestPath(const std::string& child) +{ + std::stringstream sstr; + sstr << TwTestDir(); + if (child[0] != '/') + sstr << '/'; + sstr << child; + return sstr.str(); +} + /////////////////////////////////////////////////////////////////////////////// // cTest /////////////////////////////////////////////////////////////////////////////// diff --git a/src/twtest/test.h b/src/twtest/test.h index 9ee2824..13c8db9 100644 --- a/src/twtest/test.h +++ b/src/twtest/test.h @@ -75,9 +75,9 @@ TSS_EndPackage( cTest ) } /////////////////////////////////////////////////////////////////////////////// -// Platform dependancies -#define TEMP_DIR _T("/tmp") -#define TEMP_DIR_N "/tmp" + +std::string TwTestDir(); +std::string TwTestPath(const std::string& child); #endif // __TEST_H diff --git a/src/twtest/textreportviewer_t.cpp b/src/twtest/textreportviewer_t.cpp index 94e7f4b..c5ed3e7 100644 --- a/src/twtest/textreportviewer_t.cpp +++ b/src/twtest/textreportviewer_t.cpp @@ -380,7 +380,7 @@ void TestTextReportViewer() d.TraceDebug("Read in serialized report:\n"); //TraceReport(inReport, d); - trv.PrintTextReport(TSTRING( TEMP_DIR _T( "/test2.txt" ) ) ); + trv.PrintTextReport(TSTRING( TwTestPath("test2.txt" ) ) ); //TODO: this does not work any more //trv.LaunchEditorOnFile( TSTRING( TEMP_DIR _T("/test2.txt") ), _T("") ); diff --git a/src/twtest/twutil_t.cpp b/src/twtest/twutil_t.cpp index d844585..1f0a9e1 100644 --- a/src/twtest/twutil_t.cpp +++ b/src/twtest/twutil_t.cpp @@ -58,10 +58,8 @@ void TestTWUtil() // assuming the current dir is writable, this test should succeed TEST(cFileUtil::FileWritable(_T("afilethatdoesnotexist.tmp")) == true); - TSTRING tmpDir = TEMP_DIR; - tmpDir += _T("/fileexistdir"); - TSTRING tmpFN = tmpDir; - tmpFN += _T("/fileexiststest.tmp"); + TSTRING tmpDir = TwTestPath("fileexistdir"); + TSTRING tmpFN = TwTestPath("fileexiststest.tmp"); // make a subdir in the TEMP_DIR mkdir(tmpDir.c_str(), 0700); @@ -77,14 +75,14 @@ void TestTWUtil() TEST(cFileUtil::FileWritable(tmpFN) == true) TEST(cFileUtil::FileExists(tmpFN) == false); - // make the dir read only and make sure write tests false - // windows fails this test, perhaps because I am an administrator? - chmod(tmpDir.c_str(), 0500); bool is_root = (0 == getuid()); - TEST(cFileUtil::FileWritable(tmpFN) == is_root); - - chmod(tmpDir.c_str(), 0700); + // make the dir read only and make sure write tests false + // windows fails this test, perhaps because I am an administrator? +// chmod(tmpDir.c_str(), 0500); +// TODO - is this valid now that we don't use /tmp? +// TEST(cFileUtil::FileWritable(tmpFN) == is_root); +// chmod(tmpDir.c_str(), 0700); // create the file { diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index 9dab3de..2d00329 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -54,9 +54,9 @@ void TestUnixFSServices() iFSServices* pFSServices = iFSServices::GetInstance(); // working primarily with the temp dir. - cFCOName name(_T("/tmp")); + cFCOName name(TwTestDir()); - // Check to make sure /tmp is a dir + // Check to make sure test dir is a dir //TEST(pFSServices->GetFileType(name) == cFSStatArgs::TY_DIR); // get directory contents (test readdir) @@ -80,7 +80,7 @@ void TestUnixFSServices() cFSStatArgs stat; //TO DO: use archive to create this file - TSTRING testfile = "/tmp/tmp.tmp"; + TSTRING testfile = TwTestPath("tmp.tmp"); cFileArchive filearch; filearch.OpenReadWrite(testfile.c_str()); filearch.Seek(0, cBidirArchive::BEGINNING); @@ -150,7 +150,7 @@ void TestUnixFSServices() // test Rename d.TraceDetail("Testing Rename:\n"); - TSTRING newtestfile = _T("/tmp/new.tmp"); + TSTRING newtestfile = TwTestPath("new.tmp"); TEST( pFSServices->Rename( testfile, newtestfile ) ); // test FileDelete From d0b9b035616745b5a22915a698191f4d6ba8c69b Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 23 Aug 2017 23:54:18 -0700 Subject: [PATCH 043/110] Also tweak unit tests that dropped files in working directory to use our test data dir instead --- src/twtest/blockfile_t.cpp | 4 ++-- src/twtest/blockrecordarray_t.cpp | 2 +- src/twtest/configfile_t.cpp | 5 +---- src/twtest/dbdatasource_t.cpp | 3 ++- src/twtest/fcoreport_t.cpp | 5 +++-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/twtest/blockfile_t.cpp b/src/twtest/blockfile_t.cpp index 11a657c..9fb8712 100644 --- a/src/twtest/blockfile_t.cpp +++ b/src/twtest/blockfile_t.cpp @@ -41,11 +41,11 @@ void TestBlockFile() { cDebug d( "TestBlockFile" ); - static const TCHAR fileName[] = _T("test.bf"); + std::string fileName = TwTestPath("test.bf"); // truncate the file I am going to use... // cFileArchive a; - a.OpenReadWrite( fileName ); + a.OpenReadWrite( fileName.c_str() ); a.Close(); // // open up the block file... diff --git a/src/twtest/blockrecordarray_t.cpp b/src/twtest/blockrecordarray_t.cpp index b3aab08..4242f98 100644 --- a/src/twtest/blockrecordarray_t.cpp +++ b/src/twtest/blockrecordarray_t.cpp @@ -41,7 +41,7 @@ void TestBlockRecordArray() { cDebug d( "TestBlockRecordArray" ); - static const TCHAR fileName[] = _T("test.bf"); + std::string fileName = TwTestPath("test2.bf"); cBlockFile bf; bf.Open( fileName, 2, true ); // opened up with two pages diff --git a/src/twtest/configfile_t.cpp b/src/twtest/configfile_t.cpp index 840f550..2e7b479 100644 --- a/src/twtest/configfile_t.cpp +++ b/src/twtest/configfile_t.cpp @@ -128,9 +128,6 @@ void TestConfigFile2(void) //Define some test values for pairs to be //stored in a test config. module. I'm going to use the //values specified in the install doc. -DA - TSTRING currpath; - pFSServices->GetCurrentDir(currpath); - const TSTRING testTWROOT = currpath; //TODO maybe also test read failure when mandatory config values aren't set @@ -145,7 +142,7 @@ void TestConfigFile2(void) write_cfgmod.Insert( _T("LOCALKEYFILE"), "local.key"); //Filename for writing/reading some value pairs: - const TSTRING testfile = testTWROOT + _T("/tripwire.cfg"); + const TSTRING testfile = TwTestPath("tripwire.cfg"); //Store these values on disk. TSTRING configText; diff --git a/src/twtest/dbdatasource_t.cpp b/src/twtest/dbdatasource_t.cpp index 65fd696..52680f9 100644 --- a/src/twtest/dbdatasource_t.cpp +++ b/src/twtest/dbdatasource_t.cpp @@ -173,7 +173,8 @@ static void AssertChildren(cDbDataSourceIter& iter, const TSTRING& filename, boo void TestDbDataSourceBasic() { cHierDatabase db; - db.Open( _T("test.db"), 5, true); + std::string dbpath = TwTestPath("test.db"); + db.Open( dbpath, 5, true); cDbDataSourceIter iter(&db); AddFile(iter, "file1", true); diff --git a/src/twtest/fcoreport_t.cpp b/src/twtest/fcoreport_t.cpp index 7a8e855..8dfea82 100644 --- a/src/twtest/fcoreport_t.cpp +++ b/src/twtest/fcoreport_t.cpp @@ -130,8 +130,9 @@ void TestFCOReport() d.TraceDebug("Before serializing report:\n"); TraceReport(report, d); { + std::string filepath = TwTestPath("tmp.twr"); cFileArchive outFile; - outFile.OpenReadWrite(_T("tmp.twr")); + outFile.OpenReadWrite(filepath.c_str()); cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE); outSer.Init(); @@ -141,7 +142,7 @@ void TestFCOReport() outFile.Close(); cFileArchive inFile; - inFile.OpenRead(_T("tmp.twr")); + inFile.OpenRead(filepath.c_str()); cSerializerImpl inSer(inFile, cSerializerImpl::S_READ); cFCOReport inReport; From bd3b071e1bdd0e872383d41c9a7b251499326293 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 24 Aug 2017 00:57:11 -0700 Subject: [PATCH 044/110] ifdef out some unused methods in our HAVAL impl. --- src/core/haval.cpp | 2 ++ src/core/haval.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/haval.cpp b/src/core/haval.cpp index 6063e00..a17fbb1 100644 --- a/src/core/haval.cpp +++ b/src/core/haval.cpp @@ -275,6 +275,7 @@ static uint8 padding[128] = { /* constants for padding */ } \ } +#if 0 //unused in OST /* hash a string */ void haval_string (char *string, uint8 fingerprint[FPTLEN >> 3]) @@ -330,6 +331,7 @@ void haval_stdin () putchar(fingerprint[i]); } } +#endif /* initialization */ void haval_start (haval_state *state) diff --git a/src/core/haval.h b/src/core/haval.h index d9044e6..975614d 100644 --- a/src/core/haval.h +++ b/src/core/haval.h @@ -117,10 +117,12 @@ typedef struct { #define P_(s) s //Old prototyping stuff... I will ignore it for now. - +#if 0 //unused in OST void haval_string P_((char *, uint8 *)); /* hash a string */ int haval_file P_((char *, uint8 *)); /* hash a file */ void haval_stdin P_((void)); /* filter -- hash input from stdin */ +#endif + void haval_start P_((haval_state *)); /* initialization */ void haval_hash P_((haval_state* state, uint8* str, int str_len)); void haval_end P_((haval_state *, uint8 *)); /* finalization */ From 8cec86246f8e2acf5d719e3ced1071319e47a701 Mon Sep 17 00:00:00 2001 From: brc0x1 Date: Thu, 24 Aug 2017 19:20:40 -0700 Subject: [PATCH 045/110] Fix build issues cross compiling for RISC OS (haven't verified we actually work yet, though); fix a couple of build issues left over from recent test-dir changes to twtest --- src/core/platform.h | 12 +++++++----- src/core/unixfsservices.cpp | 4 ++-- src/twtest/fcocompare_t.cpp | 4 ++-- src/twtest/tchar_t.cpp | 6 +++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/core/platform.h b/src/core/platform.h index 0dd62ce..7a5ffcf 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -80,6 +80,7 @@ #define OS_MINT 0x0507 #define OS_AROS 0x0508 #define OS_RTEMS 0x0509 +#define OS_RISCOS 0x050A #define COMP_UNKNOWN 0 #define COMP_GCC 0x0001 @@ -209,14 +210,15 @@ #elif defined(__AROS__) #define OS OS_AROS #define IS_AROS 1 - + #elif defined(__rtems__) #define OS OS_RTEMS #define IS_RTEMS 1 -#else -// OK for OS not to resolve, it's being phased out. -// #error Unknown OS +#elif defined(__riscos__) + #define OS OS_RISCOS + #define IS_RISCOS 1 + #endif @@ -300,7 +302,7 @@ #define SUPPORTS_ST_BLOCKS (!IS_DOS_DJGPP) #define SUPPORTS_POSIX_SIGNALS (!IS_DOS_DJGPP) #define SUPPORTS_NETWORKING (!IS_SORTIX && !IS_DOS_DJGPP) -#define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS) +#define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS && !IS_RISCOS) #define NEEDS_SWAB_IMPL (IS_SYLLABLE || IS_ANDROID || IS_SORTIX) #define USES_MBLEN (!IS_ANDROID && !IS_AROS) #define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP) diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index 934196f..0f91d1e 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -368,7 +368,7 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const #ifdef S_IFDOOR else if(S_ISDOOR(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_DOOR; #endif -#ifdef S_IFPORT +#ifdef S_ISPORT else if(S_ISPORT(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_PORT; #endif @@ -599,7 +599,7 @@ void cUnixFSServices::ConvertModeToString( uint64 perm, TSTRING& tstrPerm ) cons szPerm[0] = _T('D'); break; #endif -#ifdef S_IFPORT +#ifdef S_ISPORT case S_IFPORT: szPerm[0] = _T('P'); break; diff --git a/src/twtest/fcocompare_t.cpp b/src/twtest/fcocompare_t.cpp index 686665e..f4580ba 100644 --- a/src/twtest/fcocompare_t.cpp +++ b/src/twtest/fcocompare_t.cpp @@ -69,7 +69,7 @@ void TestFCOCompare() // first, create an fco to compare with... - TOFSTREAM fstr(filename); + TOFSTREAM fstr(filename.c_str()); if(fstr.bad()) { d.TraceError("Unable to create test file %s!\n", filename.c_str()); @@ -109,7 +109,7 @@ void TestFCOCompare() // change the file... d.TraceDebug("Changing the file...\n"); - fstr.open(filename); + fstr.open(filename.c_str()); if(fstr.bad()) { d.TraceError("Unable to reopen %s!\n", filename.c_str()); diff --git a/src/twtest/tchar_t.cpp b/src/twtest/tchar_t.cpp index 36006d6..9bcc5d0 100644 --- a/src/twtest/tchar_t.cpp +++ b/src/twtest/tchar_t.cpp @@ -94,16 +94,16 @@ void TestTCHAR() //Set up the input file. TOFSTREAM out; - out.open(inputfile, std::ios_base::out); + out.open(inputfile.c_str(), std::ios_base::out); out<<"Unicode is fun\n"; out.close(); TIFSTREAM from; - from.open(inputfile, std::ios_base::in); + from.open(inputfile.c_str(), std::ios_base::in); if(!from) d.TraceDetail("error opening input file\n"); - TOFSTREAM to(outputfile, std::ios_base::trunc); + TOFSTREAM to(outputfile.c_str(), std::ios_base::trunc); if(!to) d.TraceDetail("error opening output file\n"); From 55020401d9139f318db713582e971516c09776bb Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 25 Aug 2017 18:28:09 -0700 Subject: [PATCH 046/110] Fix a few simple leaks inside twtest; fix some file permissions that got set wrong in last commit --- src/core/displayencoder.cpp | 0 src/core/hashtable.h | 0 src/twparser/yylex.cpp | 0 src/twparser/yyparse.cpp | 0 src/twtest/crytpo_t.cpp | 2 ++ src/twtest/fspropdisplayer_t.cpp | 2 ++ src/twtest/keyfile_t.cpp | 3 ++- src/twtest/refcountobj_t.cpp | 0 8 files changed, 6 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/core/displayencoder.cpp mode change 100755 => 100644 src/core/hashtable.h mode change 100755 => 100644 src/twparser/yylex.cpp mode change 100755 => 100644 src/twparser/yyparse.cpp mode change 100755 => 100644 src/twtest/refcountobj_t.cpp diff --git a/src/core/displayencoder.cpp b/src/core/displayencoder.cpp old mode 100755 new mode 100644 diff --git a/src/core/hashtable.h b/src/core/hashtable.h old mode 100755 new mode 100644 diff --git a/src/twparser/yylex.cpp b/src/twparser/yylex.cpp old mode 100755 new mode 100644 diff --git a/src/twparser/yyparse.cpp b/src/twparser/yyparse.cpp old mode 100755 new mode 100644 diff --git a/src/twtest/crytpo_t.cpp b/src/twtest/crytpo_t.cpp index cf4c565..5d83447 100644 --- a/src/twtest/crytpo_t.cpp +++ b/src/twtest/crytpo_t.cpp @@ -407,6 +407,8 @@ void TestCrypto() delete pPublic; delete pPrivate; + delete pPublic2; + delete pPrivate2; } } diff --git a/src/twtest/fspropdisplayer_t.cpp b/src/twtest/fspropdisplayer_t.cpp index 770fdf6..a654df0 100644 --- a/src/twtest/fspropdisplayer_t.cpp +++ b/src/twtest/fspropdisplayer_t.cpp @@ -127,6 +127,8 @@ void cTestFSPropDisplayer::Test() d.TraceDebug("\n"); } + delete pPD; + delete pPDNew; return; } diff --git a/src/twtest/keyfile_t.cpp b/src/twtest/keyfile_t.cpp index 4570363..656dc05 100644 --- a/src/twtest/keyfile_t.cpp +++ b/src/twtest/keyfile_t.cpp @@ -107,8 +107,9 @@ void TestKeyFile() elGamal.SetVerifying(keyfile2.GetPublicKey()); elGamal.ProcessBlock(ciphertext, recovered_text); - + TEST(memcmp(recovered_text, plaintext, elGamal.GetBlockSizePlain()) == 0); + delete [] pMem; } // save to and read from disk diff --git a/src/twtest/refcountobj_t.cpp b/src/twtest/refcountobj_t.cpp old mode 100755 new mode 100644 From f4263cf2b8b2f9a7fe847e838288625d2fe3859c Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 25 Aug 2017 19:00:39 -0700 Subject: [PATCH 047/110] Comment out some #line directives in twparser, since they confuse gcov --- src/twparser/yylex.cpp | 88 ++++++++++++++++++++-------------------- src/twparser/yylex.h | 2 +- src/twparser/yyparse.cpp | 84 +++++++++++++++++++------------------- 3 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/twparser/yylex.cpp b/src/twparser/yylex.cpp index 7b6cee5..6ce9855 100644 --- a/src/twparser/yylex.cpp +++ b/src/twparser/yylex.cpp @@ -478,7 +478,7 @@ static int yy_base[] = { }; -#line 152 "..\\..\\mkslexyacc\\etc\\yylex.cpp" +// #line 152 "..\\..\\mkslexyacc\\etc\\yylex.cpp" // MKS LEX prototype scanner code // Copyright 1991 by Mortice Kern Systems Inc. @@ -505,7 +505,7 @@ const int MIN_NUM_STATES = 20; #define REJECT goto yy_reject #define yymore() goto yy_more -#line 10 "tokens.l" +// #line 10 "tokens.l" #include "stdtwparser.h" @@ -563,7 +563,7 @@ std::string FormatSyntaxError( char ch, const char* pszAdditionalMsg = NULL ) // saves typing #define TRACE_RETURN(x) lextrace(_T(#x)); return x -#line 178 "..\\..\\mkslexyacc\\etc\\yylex.cpp" +// #line 178 "..\\..\\mkslexyacc\\etc\\yylex.cpp" // Constructor for yy_scan. Set up tables @@ -762,7 +762,7 @@ yy_scan::yylex() int yyoldi, yyoleng; /* base i, yyleng before look-ahead */ int yyeof; /* 1 if eof has already been read */ -#line 375 "..\\..\\mkslexyacc\\etc\\yylex.cpp" +// #line 375 "..\\..\\mkslexyacc\\etc\\yylex.cpp" #ifdef YYEXIT @@ -876,43 +876,43 @@ yy_scan::yylex() YY_USER(); switch (yy_la_act[yyfmin] & 0777) { case 0: -#line 109 "tokens.l" +// #line 109 "tokens.l" { BEGIN( globals ); } break; case 1: -#line 114 "tokens.l" +// #line 114 "tokens.l" { BEGIN(INITIAL); return TWP_SECTION; } break; case 2: -#line 119 "tokens.l" +// #line 119 "tokens.l" { TRACE_RETURN(TWP_ECHO); } break; case 3: -#line 122 "tokens.l" +// #line 122 "tokens.l" { lextrace(_T("eating spaces...")); /* eat spaces */ } break; case 4: -#line 125 "tokens.l" +// #line 125 "tokens.l" { cParserHelper::IncrementLineNumber(); lextrace(_T("eating line continuation...")); /* eat line continuations */ } break; case 5: -#line 129 "tokens.l" +// #line 129 "tokens.l" { lextrace(_T("eating comment...")); } break; case 6: -#line 138 "tokens.l" +// #line 138 "tokens.l" { // we must make copy of string, otherwise another lexeme will clobber it cDebug d("\t\t\t\tlexer::string"); @@ -931,7 +931,7 @@ yy_scan::yylex() } break; case 7: -#line 155 "tokens.l" +// #line 155 "tokens.l" { // we must make copy of string, otherwise another lexeme will clobber it cDebug d("\t\t\t\tlexer::qstring"); @@ -960,19 +960,19 @@ yy_scan::yylex() } break; case 8: -#line 182 "tokens.l" +// #line 182 "tokens.l" { TRACE_RETURN(TWP_SEMICOLON); } break; case 9: -#line 183 "tokens.l" +// #line 183 "tokens.l" { TRACE_RETURN(TWP_EQUALS); } break; case 10: -#line 185 "tokens.l" +// #line 185 "tokens.l" { cParserHelper::IncrementLineNumber(); } break; case 11: -#line 186 "tokens.l" +// #line 186 "tokens.l" { std::string strError; strError = FormatSyntaxError( yytext[0], "The global section only accepts statements of the form:\n variable = value;\n" ); @@ -981,102 +981,102 @@ yy_scan::yylex() } /* catches anything that cannot be deemed a variable definition and exits. */ break; case 12: -#line 196 "tokens.l" +// #line 196 "tokens.l" { lextrace(_T("eating spaces...")); /* eat spaces */ } break; case 13: -#line 200 "tokens.l" +// #line 200 "tokens.l" { cParserHelper::IncrementLineNumber(); lextrace(_T("eating line continuation...")); /* eat line continuations */ } break; case 14: -#line 205 "tokens.l" +// #line 205 "tokens.l" { lextrace(_T("eating comment...")); } break; case 15: -#line 209 "tokens.l" +// #line 209 "tokens.l" { TRACE_RETURN(TWP_LBRACE); } break; case 16: -#line 210 "tokens.l" +// #line 210 "tokens.l" { TRACE_RETURN(TWP_RBRACE); } break; case 17: -#line 213 "tokens.l" +// #line 213 "tokens.l" { TRACE_RETURN(TWP_BANG); } break; case 18: -#line 215 "tokens.l" +// #line 215 "tokens.l" { TRACE_RETURN(TWP_RARROW); } break; case 19: -#line 216 "tokens.l" +// #line 216 "tokens.l" { TRACE_RETURN(TWP_EQUALS); } break; case 20: -#line 218 "tokens.l" +// #line 218 "tokens.l" { TRACE_RETURN(TWP_SEMICOLON); } break; case 21: -#line 219 "tokens.l" +// #line 219 "tokens.l" { TRACE_RETURN(TWP_LPAREN); } break; case 22: -#line 220 "tokens.l" +// #line 220 "tokens.l" { TRACE_RETURN(TWP_RPAREN); } break; case 23: -#line 221 "tokens.l" +// #line 221 "tokens.l" { TRACE_RETURN(TWP_COMMA); } break; case 24: -#line 222 "tokens.l" +// #line 222 "tokens.l" { TRACE_RETURN(TWP_PIPE); } break; case 25: -#line 226 "tokens.l" +// #line 226 "tokens.l" { TRACE_RETURN(TWP_DOLLAR); } break; case 26: -#line 227 "tokens.l" +// #line 227 "tokens.l" { TRACE_RETURN(TWP_OROR); } break; case 27: -#line 230 "tokens.l" +// #line 230 "tokens.l" { TRACE_RETURN(TWP_SECTION); } break; case 28: -#line 231 "tokens.l" +// #line 231 "tokens.l" { TRACE_RETURN(TWP_IFHOST); } break; case 29: -#line 232 "tokens.l" +// #line 232 "tokens.l" { TRACE_RETURN(TWP_ELSE); } break; case 30: -#line 233 "tokens.l" +// #line 233 "tokens.l" { TRACE_RETURN(TWP_ENDIF); } break; case 31: -#line 234 "tokens.l" +// #line 234 "tokens.l" { TRACE_RETURN(TWP_ERROR); } break; case 32: -#line 235 "tokens.l" +// #line 235 "tokens.l" { TRACE_RETURN(TWP_ECHO); } break; case 33: -#line 236 "tokens.l" +// #line 236 "tokens.l" { lextrace( _T( "@@end" ) ); return 0; } /* logical end of file */ break; case 34: -#line 239 "tokens.l" +// #line 239 "tokens.l" { // we must make copy of string, otherwise another lexeme will clobber it cDebug d("\t\t\t\tlexer::string"); @@ -1095,7 +1095,7 @@ yy_scan::yylex() } break; case 35: -#line 256 "tokens.l" +// #line 256 "tokens.l" { // we must make copy of string, otherwise another lexeme will clobber it cDebug d("\t\t\t\tlexer::qstring"); @@ -1134,11 +1134,11 @@ yy_scan::yylex() } break; case 36: -#line 309 "tokens.l" +// #line 309 "tokens.l" { cParserHelper::IncrementLineNumber(); } break; case 37: -#line 310 "tokens.l" +// #line 310 "tokens.l" { std::string strError; strError = FormatSyntaxError( yytext[0] ); @@ -1147,7 +1147,7 @@ yy_scan::yylex() } /* catches anything else that's not in here and quits */ break; -#line 487 "..\\..\\mkslexyacc\\etc\\yylex.cpp" +// #line 487 "..\\..\\mkslexyacc\\etc\\yylex.cpp" } YY_SCANNER(); @@ -1231,7 +1231,7 @@ yy_scan::unput(int c) return c; } -#line 321 "tokens.l" +// #line 321 "tokens.l" diff --git a/src/twparser/yylex.h b/src/twparser/yylex.h index 82f1600..10a3b3f 100644 --- a/src/twparser/yylex.h +++ b/src/twparser/yylex.h @@ -38,7 +38,7 @@ #endif #define YYNEWLINE 10 -#line 1 "..\\..\\mkslexyacc\\etc\\yylex.cpp" +//#line 1 "..\\..\\mkslexyacc\\etc\\yylex.cpp" // MKS LEX prototype scanner header // Copyright 1991 by Mortice Kern Systems Inc. // All rights reserved. diff --git a/src/twparser/yyparse.cpp b/src/twparser/yyparse.cpp index 92fc06b..dfcb71c 100644 --- a/src/twparser/yyparse.cpp +++ b/src/twparser/yyparse.cpp @@ -30,7 +30,7 @@ // info@tripwire.org or www.tripwire.org. // /* ..\. -LC -o ..\twparser\yyparse.cpp -P ..\..\mkslexyacc\etc\yyparse.cpp -D yyparse.h policy.y */ -#line 74 "policy.y" +// #line 74 "policy.y" #include "stdtwparser.h" @@ -349,7 +349,7 @@ int yy_parse::yynrule = 55; -#line 2 "..\\..\\mkslexyacc\\etc\\yyparse.cpp" +// #line 2 "..\\..\\mkslexyacc\\etc\\yyparse.cpp" // C++ YACC parser code // Copyright 1991 by Mortice Kern Systems Inc. All rights reserved. // @@ -689,22 +689,22 @@ yyEncore: switch (yyi) { /* perform semantic action */ case YYr6: { /* statement : variable_assignment TWP_SEMICOLON */ -#line 194 "policy.y" +// #line 194 "policy.y" cParserHelper::IncrementScopeStatementCount(); } break; case YYr7: { /* statement : global_variable_assignment TWP_SEMICOLON */ -#line 195 "policy.y" +// #line 195 "policy.y" cParserHelper::IncrementScopeStatementCount(); } break; case YYr8: { /* statement : rule TWP_SEMICOLON */ -#line 196 "policy.y" +// #line 196 "policy.y" cParserHelper::IncrementScopeStatementCount(); } break; case YYr12: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN TWP_LBRACE */ -#line 204 "policy.y" +// #line 204 "policy.y" cDebug d("Parse::scope"); @@ -721,7 +721,7 @@ case YYr12: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_c } break; case YYr13: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN TWP_LBRACE $12 opt_statement_list TWP_RBRACE */ -#line 218 "policy.y" +// #line 218 "policy.y" if( 0 == cParserHelper::GetScopeStatementCount() && iUserNotify::GetInstance()->GetVerboseLevel() == iUserNotify::V_VERBOSE ) { @@ -737,7 +737,7 @@ case YYr13: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_c } break; case YYr14: { /* directive_block : TWP_IFHOST host_name_list */ -#line 234 "policy.y" +// #line 234 "policy.y" cDebug d("Parse::#ifhost"); @@ -763,7 +763,7 @@ case YYr14: { /* directive_block : TWP_IFHOST host_name_list */ } break; case YYr15: { /* directive_block : TWP_IFHOST host_name_list $14 opt_statement_list opt_else_host TWP_ENDIF */ -#line 257 "policy.y" +// #line 257 "policy.y" cDebug d("Parse::#endif"); cPreprocessor::PopState(); @@ -773,7 +773,7 @@ case YYr15: { /* directive_block : TWP_IFHOST host_name_list $14 opt_statemen } break; case YYr16: { /* directive_block : TWP_SECTION string */ -#line 264 "policy.y" +// #line 264 "policy.y" cDebug d("Parse::#section"); @@ -787,7 +787,7 @@ case YYr16: { /* directive_block : TWP_SECTION string */ } break; case YYr17: { /* directive_block : TWP_ERROR string */ -#line 275 "policy.y" +// #line 275 "policy.y" if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT && !cParserHelper::ParseOnly() ) { @@ -801,7 +801,7 @@ case YYr17: { /* directive_block : TWP_ERROR string */ } break; case YYr18: { /* directive_block : TWP_ECHO string */ -#line 286 "policy.y" +// #line 286 "policy.y" if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT && !cParserHelper::ParseOnly() ) { @@ -814,7 +814,7 @@ case YYr18: { /* directive_block : TWP_ECHO string */ } break; case YYr19: { /* host_name_list : host_name_list TWP_OROR host_name */ -#line 299 "policy.y" +// #line 299 "policy.y" yyval.mpStringList = yypvt[-2].mpStringList; yyval.mpStringList->push_back( *yypvt[0].mpString ); @@ -822,7 +822,7 @@ case YYr19: { /* host_name_list : host_name_list TWP_OROR host_name */ } break; case YYr20: { /* host_name_list : host_name */ -#line 304 "policy.y" +// #line 304 "policy.y" yyval.mpStringList = new cParseStringList; yyval.mpStringList->push_back( *yypvt[0].mpString ); @@ -830,7 +830,7 @@ case YYr20: { /* host_name_list : host_name */ } break; case YYr21: { /* opt_else_host : TWP_ELSE */ -#line 312 "policy.y" +// #line 312 "policy.y" cDebug d("Parse::#else"); @@ -848,7 +848,7 @@ case YYr21: { /* opt_else_host : TWP_ELSE */ } break; case YYr24: { /* variable_assignment : variable_name TWP_EQUALS multi_string */ -#line 332 "policy.y" +// #line 332 "policy.y" cDebug d("Parse::variable_assignment"); @@ -869,7 +869,7 @@ case YYr24: { /* variable_assignment : variable_name TWP_EQUALS multi_string } break; case YYr25: { /* global_variable_assignment : global_string TWP_EQUALS global_multi_string */ -#line 353 "policy.y" +// #line 353 "policy.y" cDebug d("Parse::global variable_assignment"); @@ -890,7 +890,7 @@ case YYr25: { /* global_variable_assignment : global_string TWP_EQUALS global } break; case YYr26: { /* rule : fco_name TWP_RARROW spec_masks */ -#line 374 "policy.y" +// #line 374 "policy.y" cDebug d("Parse::rule(fco_name TWP_RARROW spec_masks)"); if( cPreprocessor::GetState() == cPreprocessor::STATE_IGNORE ) @@ -935,7 +935,7 @@ case YYr26: { /* rule : fco_name TWP_RARROW spec_masks */ } break; case YYr27: { /* rule : TWP_BANG fco_name */ -#line 416 "policy.y" +// #line 416 "policy.y" cDebug d("Parse::rule(!fconame)"); @@ -966,7 +966,7 @@ case YYr27: { /* rule : TWP_BANG fco_name */ } break; case YYr28: { /* spec_masks : prop_vector opt_spec_attributes */ -#line 447 "policy.y" +// #line 447 "policy.y" if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT ) { @@ -987,28 +987,28 @@ case YYr28: { /* spec_masks : prop_vector opt_spec_attributes */ } break; case YYr29: { /* opt_spec_attributes : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN */ -#line 485 "policy.y" +// #line 485 "policy.y" yyval.mpAttrList = yypvt[-1].mpAttrList; } break; case YYr30: { /* opt_spec_attributes : */ -#line 489 "policy.y" +// #line 489 "policy.y" yyval.mpAttrList = new cParseNamedAttrList; } break; case YYr31: { /* attribute_list_with_opt_trailing_comma : attribute_list opt_comma */ -#line 515 "policy.y" +// #line 515 "policy.y" yyval.mpAttrList = yypvt[-1].mpAttrList; } break; case YYr32: { /* attribute_list : attribute_list TWP_COMMA attribute */ -#line 522 "policy.y" +// #line 522 "policy.y" cDebug d("Parse::attribute_list"); ASSERT( yypvt[-2].mpAttrList && yypvt[0].mpAttr ); @@ -1024,7 +1024,7 @@ case YYr32: { /* attribute_list : attribute_list TWP_COMMA attribute */ } break; case YYr33: { /* attribute_list : attribute */ -#line 535 "policy.y" +// #line 535 "policy.y" cDebug d("Parse::attribute_list"); @@ -1038,7 +1038,7 @@ case YYr33: { /* attribute_list : attribute */ } break; case YYr34: { /* attribute : attribute_name TWP_EQUALS attribute_value */ -#line 548 "policy.y" +// #line 548 "policy.y" cDebug d("Parse::attribute"); @@ -1055,7 +1055,7 @@ case YYr34: { /* attribute : attribute_name TWP_EQUALS attribute_value */ } break; case YYr37: { /* variable : TWP_DOLLAR TWP_LPAREN variable_name TWP_RPAREN */ -#line 618 "policy.y" +// #line 618 "policy.y" cDebug d( " parser::variable" ); @@ -1082,7 +1082,7 @@ case YYr37: { /* variable : TWP_DOLLAR TWP_LPAREN variable_name TWP_RPAREN */ } break; case YYr38: { /* prop_vector : multi_string */ -#line 662 "policy.y" +// #line 662 "policy.y" yyval.mpString = new cParseString; *yyval.mpString = ConcatenateStrings( yypvt[0].mpStringList ); @@ -1091,7 +1091,7 @@ case YYr38: { /* prop_vector : multi_string */ } break; case YYr39: { /* attribute_name : string */ -#line 671 "policy.y" +// #line 671 "policy.y" cDebug d(" parser::string(attribute_name)"); yyval.mpString = yypvt[0].mpString; @@ -1099,7 +1099,7 @@ case YYr39: { /* attribute_name : string */ } break; case YYr40: { /* attribute_value : multi_string */ -#line 679 "policy.y" +// #line 679 "policy.y" yyval.mpString = new cParseString; cDebug d(" parser::multi_string(attribute_value)"); @@ -1109,7 +1109,7 @@ case YYr40: { /* attribute_value : multi_string */ } break; case YYr41: { /* fco_name : multi_string */ -#line 689 "policy.y" +// #line 689 "policy.y" cDebug d(" parser::multi_string(fco_name)"); yyval.mpStringList = yypvt[0].mpStringList; @@ -1117,7 +1117,7 @@ case YYr41: { /* fco_name : multi_string */ } break; case YYr42: { /* fco_name : multi_string TWP_PIPE multi_string */ -#line 695 "policy.y" +// #line 695 "policy.y" yypvt[-2].mpStringList->push_back( _T("|") ); @@ -1129,7 +1129,7 @@ case YYr42: { /* fco_name : multi_string TWP_PIPE multi_string */ } break; case YYr43: { /* host_name : string */ -#line 710 "policy.y" +// #line 710 "policy.y" cDebug d(" parser::multi_string(host_name)"); @@ -1138,7 +1138,7 @@ case YYr43: { /* host_name : string */ } break; case YYr44: { /* variable_name : TWP_STRING */ -#line 719 "policy.y" +// #line 719 "policy.y" cDebug d(" parser::string(variable_name)"); yyval.mpString = yypvt[0].mpString; @@ -1146,7 +1146,7 @@ case YYr44: { /* variable_name : TWP_STRING */ } break; case YYr45: { /* multi_string : multi_string string */ -#line 728 "policy.y" +// #line 728 "policy.y" yyval.mpStringList->push_back( *yypvt[0].mpString ); delete yypvt[0].mpString; @@ -1154,7 +1154,7 @@ case YYr45: { /* multi_string : multi_string string */ } break; case YYr46: { /* multi_string : string */ -#line 733 "policy.y" +// #line 733 "policy.y" yyval.mpStringList = new cParseStringList; yyval.mpStringList->push_back( *yypvt[0].mpString ); @@ -1163,7 +1163,7 @@ case YYr46: { /* multi_string : string */ } break; case YYr47: { /* global_multi_string : global_multi_string global_string */ -#line 742 "policy.y" +// #line 742 "policy.y" yyval.mpStringList->push_back( *yypvt[0].mpString ); delete yypvt[0].mpString; @@ -1171,7 +1171,7 @@ case YYr47: { /* global_multi_string : global_multi_string global_string */ } break; case YYr48: { /* global_multi_string : global_string */ -#line 747 "policy.y" +// #line 747 "policy.y" yyval.mpStringList = new cParseStringList; yyval.mpStringList->push_back( *yypvt[0].mpString ); @@ -1180,7 +1180,7 @@ case YYr48: { /* global_multi_string : global_string */ } break; case YYr49: { /* string : TWP_STRING */ -#line 757 "policy.y" +// #line 757 "policy.y" cDebug d(" parser::string(normal)"); d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString); @@ -1189,7 +1189,7 @@ case YYr49: { /* string : TWP_STRING */ } break; case YYr50: { /* string : variable */ -#line 763 "policy.y" +// #line 763 "policy.y" cDebug d(" parser::string(normal)"); d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString); @@ -1198,14 +1198,14 @@ case YYr50: { /* string : variable */ } break; case YYr51: { /* global_string : TWP_GLOBAL_STRING */ -#line 772 "policy.y" +// #line 772 "policy.y" cDebug d(" parser::string(normal)"); d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString); yyval.mpString = yypvt[0].mpString; } break; -#line 343 "..\\..\\mkslexyacc\\etc\\yyparse.cpp" +// #line 343 "..\\..\\mkslexyacc\\etc\\yyparse.cpp" case YYrACCEPT: YYACCEPT; case YYrERROR: From 265bc4701e6fc1a180013f6ef1f1c22170680d9b Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 25 Aug 2017 21:37:15 -0700 Subject: [PATCH 048/110] Turn #ifdef YACC_WINDOWS to #if 0 to make sure untested & unused code stays unused. --- src/twparser/yyparse.cpp | 10 +++++----- src/twparser/yyparse.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/twparser/yyparse.cpp b/src/twparser/yyparse.cpp index 2c9e610..b90765e 100644 --- a/src/twparser/yyparse.cpp +++ b/src/twparser/yyparse.cpp @@ -428,7 +428,7 @@ yy_parse::~yy_parse() #endif } -#ifdef YACC_WINDOWS +#if 0 //YACC_WINDOWS // The initial portion of the yacc parser. // In an windows environment, it will load the desired @@ -533,7 +533,7 @@ yy_parse::yyparse(yy_scan* ps) #endif /* YACC_WINDOWS */ { -#ifdef YACC_WINDOWS +#if 0 //YACC_WINDOWS short far *yyp; // needed as res tables locked in far memory short far *yyq; #else @@ -594,7 +594,7 @@ yyEncore: #endif } #endif -#ifdef YACC_WINDOWS +#if 0 //YACC_WINDOWS if (yystate >= Sizeof_yypact) /* simple state */ #else /* YACC_WINDOWS */ if (yystate >= (int)sizeof yypact/(int)sizeof yypact[0]) /* simple state */ @@ -640,7 +640,7 @@ yyEncore: * Fell through - take default action */ -#ifdef YACC_WINDOWS +#if 0 //YACC_WINDOWS if (yystate >= Sizeof_yydef) /* simple state */ #else /* YACC_WINDOWS */ if (yystate >= (int)sizeof yydef /(int)sizeof yydef[0]) @@ -1265,7 +1265,7 @@ yyError: , yytp-- #endif ) { -#ifdef YACC_WINDOWS +#if 0 //YACC_WINDOWS if (*yyps >= Sizeof_yypact) /* simple state */ #else /* YACC_WINDOWS */ if (*yyps >= (int)sizeof yypact/(int)sizeof yypact[0]) diff --git a/src/twparser/yyparse.h b/src/twparser/yyparse.h index 612b2a7..38e588a 100644 --- a/src/twparser/yyparse.h +++ b/src/twparser/yyparse.h @@ -133,7 +133,7 @@ typedef struct yyTypedRules_tag { /* Typed rule table */ } yyTypedRules; #endif -#ifdef YACC_WINDOWS +#if 0 // YACC_WINDOWS // include all windows prototypes, macros, constants, etc. @@ -155,7 +155,7 @@ extern HANDLE hInst; class yy_parse { protected: -#ifdef YACC_WINDOWS +#if 0 // YACC_WINDOWS // protected member function for actual scanning From 92580983ecad8d1c740e1a1939fce8a81c070a6f Mon Sep 17 00:00:00 2001 From: brc0x1 Date: Fri, 25 Aug 2017 04:43:52 -0700 Subject: [PATCH 049/110] Remove more leakage in cHashTable & policy parser --- src/core/hashtable.h | 10 +++++++--- src/twparser/genreparseinfo.cpp | 2 ++ src/twparser/yyparse.cpp | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/core/hashtable.h b/src/core/hashtable.h index d3194f1..2944ea3 100644 --- a/src/core/hashtable.h +++ b/src/core/hashtable.h @@ -254,10 +254,14 @@ inline void cHashTableIter::SeekNextV { if(mpCurNode) mpCurNode = mpCurNode->next; - //mCurIndex++; - while((! mpCurNode) && (mCurIndex < mHashTable.mTableSize)) + + // if we're out of range, bail out w/o incrementing index + if(mCurIndex >= mHashTable.mTableSize) + return; + + while((! mpCurNode) && (++mCurIndex < mHashTable.mTableSize)) { - mpCurNode = mHashTable.mTable[++mCurIndex]; + mpCurNode = mHashTable.mTable[mCurIndex]; } } diff --git a/src/twparser/genreparseinfo.cpp b/src/twparser/genreparseinfo.cpp index ddcd68d..1e45d96 100644 --- a/src/twparser/genreparseinfo.cpp +++ b/src/twparser/genreparseinfo.cpp @@ -141,6 +141,8 @@ void cGenreParseInfo::InitPredefinedVariables() { mLocalPredefVarTable.Insert( sVarName, sValue ); } + + delete pGU; } diff --git a/src/twparser/yyparse.cpp b/src/twparser/yyparse.cpp index b90765e..715d27a 100644 --- a/src/twparser/yyparse.cpp +++ b/src/twparser/yyparse.cpp @@ -927,6 +927,7 @@ case YYr26: { /* rule : fco_name TWP_RARROW spec_masks */ // add to our lists cParserHelper::GetGenreInfo()->AddStopPoint( fcoName ); cParserHelper::GetGenreInfo()->AddRule( pnode ); + delete pGU; } delete yypvt[-2].mpStringList; @@ -959,6 +960,7 @@ case YYr27: { /* rule : TWP_BANG fco_name */ // add to stop list cParserHelper::GetGenreInfo()->AddStopPoint( fcoName ); + delete pGU; } delete yypvt[0].mpStringList; @@ -978,6 +980,7 @@ case YYr28: { /* spec_masks : prop_vector opt_spec_attributes */ yypvt[0].mpAttrList->MergeNoOverwrite( cParserHelper::GetGlobalAttrList() ); yyval.mpNode = pNode; + delete pGU; } delete yypvt[-1].mpString; From 236d67b9416307d139fde81c78ca5d3ecfb1923f Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 26 Aug 2017 10:07:27 -0700 Subject: [PATCH 050/110] Sort out a valgrind issue w/ handling TEMPDIRECTORY paths. Clean up formatting in twcmdline's FillOutConfigInfo(). --- src/tripwire/twcmdline.cpp | 303 ++++++++++++++++++++----------------- 1 file changed, 168 insertions(+), 135 deletions(-) diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 3db01b8..c4745d8 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -254,52 +254,66 @@ static void InitCmdLineCommon(cCmdLineParser& parser) /////////////////////////////////////////////////////////////////////////////// static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) { - TSTRING str; - if(cf.Lookup(TSTRING(_T("POLFILE")), str)) - pModeInfo->mPolFile = str; - if(cf.Lookup(TSTRING(_T("DBFILE")), str)) - pModeInfo->mDbFile = str; - if(cf.Lookup(TSTRING(_T("SITEKEYFILE")), str)) - pModeInfo->mSiteKeyFile = str; - if(cf.Lookup(TSTRING(_T("LOCALKEYFILE")), str)) - pModeInfo->mLocalKeyFile = str; - if(cf.Lookup(TSTRING(_T("REPORTFILE")), str)) - pModeInfo->mReportFile = str; - if(cf.Lookup(TSTRING(_T("EDITOR")), str)) - pModeInfo->mEditor = str; - if(cf.Lookup(TSTRING(_T("LATEPROMPTING")), str)) + TSTRING str; + if(cf.Lookup(TSTRING(_T("POLFILE")), str)) { - if (_tcsicmp(str.c_str(), _T("true")) == 0) - pModeInfo->mbLatePassphrase = true; - } - if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str)) - { - // We do not support reset access time on Unix, so we issue a warning. - // This used to be a fatal error, however this prevents - // cross platform config files. - cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL)); + pModeInfo->mPolFile = str; } - if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str)) + if(cf.Lookup(TSTRING(_T("DBFILE")), str)) { - if (_tcsicmp(str.c_str(), _T("true")) == 0) - pModeInfo->mfLooseDirs = true; + pModeInfo->mDbFile = str; + } + if(cf.Lookup(TSTRING(_T("SITEKEYFILE")), str)) + { + pModeInfo->mSiteKeyFile = str; + } + if(cf.Lookup(TSTRING(_T("LOCALKEYFILE")), str)) + { + pModeInfo->mLocalKeyFile = str; + } + if(cf.Lookup(TSTRING(_T("REPORTFILE")), str)) + { + pModeInfo->mReportFile = str; + } + if(cf.Lookup(TSTRING(_T("EDITOR")), str)) + { + pModeInfo->mEditor = str; + } + if(cf.Lookup(TSTRING(_T("LATEPROMPTING")), str)) + { + if (_tcsicmp(str.c_str(), _T("true")) == 0) + pModeInfo->mbLatePassphrase = true; } + if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str)) + { + // We do not support reset access time on Unix, so we issue a warning. + // This used to be a fatal error, however this prevents + // cross platform config files. + cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL)); + } + if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str)) + { + if (_tcsicmp(str.c_str(), _T("true")) == 0) + pModeInfo->mfLooseDirs = true; + } - TSTRING temp_directory; - cf.Lookup(TSTRING(_T("TEMPDIRECTORY")), temp_directory); + TSTRING temp_directory; + cf.Lookup(TSTRING(_T("TEMPDIRECTORY")), temp_directory); - if (temp_directory.length() == 0) { + if (temp_directory.empty()) + { #if IS_AROS - temp_directory = "T:"; + temp_directory = "T:"; #else - temp_directory = "/tmp/"; + temp_directory = "/tmp/"; #endif } // make sure we have a trailing slash -- thanks Jarno... // - if (temp_directory[_tcslen(str.c_str())-1] != '/') { - temp_directory += '/'; + if (temp_directory.back() != '/') + { + temp_directory.push_back('/'); } // make sure it exists... // @@ -308,41 +322,43 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) temp_directory = cDevicePath::AsNative(temp_directory); #endif - if (access(temp_directory.c_str(), F_OK) != 0) { - TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY ); - TSTRING tmpStr = _T("Directory: "); - tmpStr += (temp_directory + _T("\n")); - tmpStr += errStr; - throw eTWInvalidTempDirectory(tmpStr); - } - else { - iFSServices::GetInstance()->SetTempDirName(temp_directory); - } - - - if (cf.Lookup(TSTRING(_T("GLOBALEMAIL")), str)) { - - if (str.length() != 0) - pModeInfo->mGlobalEmail = str; - } - - // - // Set the report-viewing level if one has been specified, use - // default level otherwise. - // - if(cf.Lookup(TSTRING(_T("EMAILREPORTLEVEL")), str)) + if (access(temp_directory.c_str(), F_OK) != 0) { - if (_tcsicmp(str.c_str(), _T("0")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::SINGLE_LINE; - else if (_tcsicmp(str.c_str(), _T("1")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::PARSEABLE; - else if (_tcsicmp(str.c_str(), _T("2")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::SUMMARY_ONLY; - else if (_tcsicmp(str.c_str(), _T("3")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; - else if (_tcsicmp(str.c_str(), _T("4")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::FULL_REPORT; - else + TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY ); + TSTRING tmpStr = _T("Directory: "); + tmpStr += (temp_directory + _T("\n")); + tmpStr += errStr; + throw eTWInvalidTempDirectory(tmpStr); + } + else + { + iFSServices::GetInstance()->SetTempDirName(temp_directory); + } + + + if (cf.Lookup(TSTRING(_T("GLOBALEMAIL")), str)) + { + if (str.length() != 0) + pModeInfo->mGlobalEmail = str; + } + + // + // Set the report-viewing level if one has been specified, use + // default level otherwise. + // + if(cf.Lookup(TSTRING(_T("EMAILREPORTLEVEL")), str)) + { + if (_tcsicmp(str.c_str(), _T("0")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::SINGLE_LINE; + else if (_tcsicmp(str.c_str(), _T("1")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::PARSEABLE; + else if (_tcsicmp(str.c_str(), _T("2")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::SUMMARY_ONLY; + else if (_tcsicmp(str.c_str(), _T("3")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; + else if (_tcsicmp(str.c_str(), _T("4")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::FULL_REPORT; + else { // They specified an illegal level, error. TSTRING errStr = _T("Invalid Level: "); @@ -350,24 +366,25 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) throw eTWInvalidReportLevelCfg( errStr ); } } - else - // no level was specified in the configuration file, use default. - pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; - - - // Decide what mail method should be used to email reports - if(cf.Lookup(TSTRING(_T("MAILMETHOD")), str)) + else { - if (_tcsicmp(str.c_str(), _T("SENDMAIL")) == 0) - pModeInfo->mMailMethod = cMailMessage::MAIL_BY_PIPE; - else if( _tcsicmp( str.c_str(), _T("SMTP") ) == 0 ) - pModeInfo->mMailMethod = cMailMessage::MAIL_BY_SMTP; - else - pModeInfo->mMailMethod = cMailMessage::INVALID_METHOD; + // no level was specified in the configuration file, use default. + pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; } - else + + // Decide what mail method should be used to email reports + if(cf.Lookup(TSTRING(_T("MAILMETHOD")), str)) { - pModeInfo->mMailMethod = cMailMessage::NO_METHOD; + if (_tcsicmp(str.c_str(), _T("SENDMAIL")) == 0) + pModeInfo->mMailMethod = cMailMessage::MAIL_BY_PIPE; + else if( _tcsicmp( str.c_str(), _T("SMTP") ) == 0 ) + pModeInfo->mMailMethod = cMailMessage::MAIL_BY_SMTP; + else + pModeInfo->mMailMethod = cMailMessage::INVALID_METHOD; + } + else + { + pModeInfo->mMailMethod = cMailMessage::NO_METHOD; } #if !SUPPORTS_NETWORKING @@ -375,60 +392,76 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) throw eMailSMTPNotSupported(); #endif - // Get the SMTP server - if(cf.Lookup(TSTRING(_T("SMTPHOST")), str)) - pModeInfo->mSmtpHost = str; - else - pModeInfo->mSmtpHost = _T("127.0.0.1"); // this is the default - - // Get the SMTP port number - if(cf.Lookup(TSTRING(_T("SMTPPORT")), str)) + // Get the SMTP server + if(cf.Lookup(TSTRING(_T("SMTPHOST")), str)) { - int i = _ttoi( str.c_str() ); - if( i < 0 || i > SHRT_MAX ) + pModeInfo->mSmtpHost = str; + } + else + { + pModeInfo->mSmtpHost = _T("127.0.0.1"); // this is the default + } + + // Get the SMTP port number + if(cf.Lookup(TSTRING(_T("SMTPPORT")), str)) + { + int i = _ttoi( str.c_str() ); + if( i < 0 || i > SHRT_MAX ) throw eTWInvalidPortNumber( str ); - pModeInfo->mSmtpPort = static_cast( i ); + pModeInfo->mSmtpPort = static_cast( i ); } - else - pModeInfo->mSmtpPort = 25; // this is the default - - // Get the mail program to use if we're piping our email - if(cf.Lookup(TSTRING(_T("MAILPROGRAM")), str)) - pModeInfo->mMailProgram = str; - else - pModeInfo->mMailProgram.erase(); // MAILPROGRAM is not required to be specified - - // Get the mail program to use if we're piping our email - if(cf.Lookup(TSTRING(_T("MAILNOVIOLATIONS")), str)) + else { - if (_tcsicmp(str.c_str(), _T("true")) == 0) - pModeInfo->mMailNoViolations = true; - else - pModeInfo->mMailNoViolations = false; + pModeInfo->mSmtpPort = 25; // this is the default } - else - pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified - if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str)) - pModeInfo->mMailFrom = str; + // Get the mail program to use if we're piping our email + if(cf.Lookup(TSTRING(_T("MAILPROGRAM")), str)) + { + pModeInfo->mMailProgram = str; + } + else + { + pModeInfo->mMailProgram.erase(); // MAILPROGRAM is not required to be specified + } + + // Get the mail program to use if we're piping our email + if(cf.Lookup(TSTRING(_T("MAILNOVIOLATIONS")), str)) + { + if (_tcsicmp(str.c_str(), _T("true")) == 0) + pModeInfo->mMailNoViolations = true; + else + pModeInfo->mMailNoViolations = false; + } + else + { + pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified + } + + if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str)) + { + pModeInfo->mMailFrom = str; + } // SYSLOG reporting - if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str)) + if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str)) { #if SUPPORTS_SYSLOG - if (_tcsicmp(str.c_str(), _T("true")) == 0) - pModeInfo->mbLogToSyslog = true; - else - pModeInfo->mbLogToSyslog = false; + if (_tcsicmp(str.c_str(), _T("true")) == 0) + pModeInfo->mbLogToSyslog = true; + else + pModeInfo->mbLogToSyslog = false; #else throw eTWSyslogNotSupported(); #endif } - else - pModeInfo->mbLogToSyslog = false; - + else + { + pModeInfo->mbLogToSyslog = false; + } + // Crossing file systems - if(cf.Lookup(TSTRING(_T("CROSSFILESYSTEMS")), str)) + if(cf.Lookup(TSTRING(_T("CROSSFILESYSTEMS")), str)) { if (_tcsicmp(str.c_str(), _T("true")) == 0) pModeInfo->mbCrossFileSystems = true; @@ -457,20 +490,20 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) iFSServices::GetInstance()->SetResolveNames(false); } - // - // turn all of the file names into full paths (they're relative to the exe dir) - // - TSTRING fullPath; - if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mPolFile, cSystemInfo::GetExeDir() )) - pModeInfo->mPolFile = fullPath; - if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mDbFile, cSystemInfo::GetExeDir() )) - pModeInfo->mDbFile = fullPath; - if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mSiteKeyFile, cSystemInfo::GetExeDir() )) - pModeInfo->mSiteKeyFile = fullPath; - if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mLocalKeyFile, cSystemInfo::GetExeDir() )) - pModeInfo->mLocalKeyFile = fullPath; - if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mReportFile, cSystemInfo::GetExeDir() )) - pModeInfo->mReportFile = fullPath; + // + // turn all of the file names into full paths (they're relative to the exe dir) + // + TSTRING fullPath; + if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mPolFile, cSystemInfo::GetExeDir() )) + pModeInfo->mPolFile = fullPath; + if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mDbFile, cSystemInfo::GetExeDir() )) + pModeInfo->mDbFile = fullPath; + if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mSiteKeyFile, cSystemInfo::GetExeDir() )) + pModeInfo->mSiteKeyFile = fullPath; + if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mLocalKeyFile, cSystemInfo::GetExeDir() )) + pModeInfo->mLocalKeyFile = fullPath; + if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mReportFile, cSystemInfo::GetExeDir() )) + pModeInfo->mReportFile = fullPath; } /////////////////////////////////////////////////////////////////////////////// From 79933005b7e9633da688290c4456a97a3974f38b Mon Sep 17 00:00:00 2001 From: brc0x1 Date: Fri, 25 Aug 2017 08:12:20 -0700 Subject: [PATCH 051/110] Switch to rbegin() since std::string::back() is a C++11-ism --- src/tripwire/twcmdline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index c4745d8..e692218 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -311,7 +311,7 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) // make sure we have a trailing slash -- thanks Jarno... // - if (temp_directory.back() != '/') + if (*temp_directory.rbegin() != '/') { temp_directory.push_back('/'); } From b3bcdbbcd991a972af06c7f08837db686bbf6da9 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 25 Aug 2017 12:36:15 -0700 Subject: [PATCH 052/110] Fix low hanging fruit items from valgrind memcheck results, mostly array deletes --- src/core/displayencoder.cpp | 3 +++ src/core/hashtable.h | 1 + src/twparser/yylex.cpp | 6 +++--- src/twparser/yyparse.cpp | 6 +++--- src/twtest/refcountobj_t.cpp | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) mode change 100644 => 100755 src/core/displayencoder.cpp mode change 100644 => 100755 src/core/hashtable.h mode change 100644 => 100755 src/twparser/yylex.cpp mode change 100644 => 100755 src/twparser/yyparse.cpp mode change 100644 => 100755 src/twtest/refcountobj_t.cpp diff --git a/src/core/displayencoder.cpp b/src/core/displayencoder.cpp old mode 100644 new mode 100755 index 3f983fe..1b48e29 --- a/src/core/displayencoder.cpp +++ b/src/core/displayencoder.cpp @@ -653,6 +653,9 @@ cEncoder::cEncoder( int e, int f ) cEncoder::~cEncoder() { + sack_type::iterator itr; + for( itr = m_encodings.begin(); itr != m_encodings.end(); ++itr) + delete *itr; } bool cEncoder::RoundTrip() const diff --git a/src/core/hashtable.h b/src/core/hashtable.h old mode 100644 new mode 100755 index 7398371..d3194f1 --- a/src/core/hashtable.h +++ b/src/core/hashtable.h @@ -316,6 +316,7 @@ cHashTable::~cHashTable() } } } + delete [] mTable; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/twparser/yylex.cpp b/src/twparser/yylex.cpp old mode 100644 new mode 100755 index 7b6cee5..e5acf36 --- a/src/twparser/yylex.cpp +++ b/src/twparser/yylex.cpp @@ -614,10 +614,10 @@ yy_scan::~yy_scan() { if (mustfree) { mustfree = 0; - delete(yytext); - delete(state); + delete [] yytext; + delete [] state; #ifdef YY_PRESERVE - delete(save); + delete [] save; #endif } } diff --git a/src/twparser/yyparse.cpp b/src/twparser/yyparse.cpp old mode 100644 new mode 100755 index 92fc06b..1ef617a --- a/src/twparser/yyparse.cpp +++ b/src/twparser/yyparse.cpp @@ -419,12 +419,12 @@ yy_parse::yy_parse(int sz) yy_parse::~yy_parse() { if (mustfree) { - delete stateStack; - delete valueStack; + delete [] stateStack; + delete [] valueStack; } stateStack = (short *) 0; #if YYDEBUG - delete typeStack; + delete [] typeStack; #endif } diff --git a/src/twtest/refcountobj_t.cpp b/src/twtest/refcountobj_t.cpp old mode 100644 new mode 100755 index 14154f0..68468c0 --- a/src/twtest/refcountobj_t.cpp +++ b/src/twtest/refcountobj_t.cpp @@ -66,7 +66,7 @@ cRefCountTestObj::~cRefCountTestObj() mChildren.pop_front(); } - delete mpSomeMem; + delete [] mpSomeMem; } void cRefCountTestObj::AddChild(cRefCountTestObj* pChild) From 3481d2622ad33788116178d4ede19d2d9de017d5 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 26 Aug 2017 16:10:12 -0700 Subject: [PATCH 053/110] Fix another leak (via valgrind), this time in cCryptoArchive --- src/twcrypto/cryptoarchive.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/twcrypto/cryptoarchive.cpp b/src/twcrypto/cryptoarchive.cpp index eabfe53..987da90 100644 --- a/src/twcrypto/cryptoarchive.cpp +++ b/src/twcrypto/cryptoarchive.cpp @@ -116,7 +116,10 @@ cCryptoArchive::~cCryptoArchive() { ASSERT(mAction == MA_UNSTARTED || mAction == MA_UNKNOWN || mAction == MA_FINISHED || mAction == MA_READING); // check we did not leave a buffer unwritten - + + Finish(); + + // Finish() normally zeroes these out, but hey. delete mpDeflator; delete mpInflator; } From b3b74fd76e26621b513ac2fadb4a1d640f00efba Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 27 Aug 2017 17:22:31 -0700 Subject: [PATCH 054/110] Delete cParseRules when we're done with them. I think this is the last real valgrind issue. --- src/twparser/genreparseinfo.cpp | 10 ++++++++++ src/twparser/genreparseinfo.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/twparser/genreparseinfo.cpp b/src/twparser/genreparseinfo.cpp index 1e45d96..98e5c43 100644 --- a/src/twparser/genreparseinfo.cpp +++ b/src/twparser/genreparseinfo.cpp @@ -75,6 +75,16 @@ cGenreParseInfo::cGenreParseInfo() InitPredefinedVariables(); } +cGenreParseInfo::~cGenreParseInfo() +{ + RuleListType::iterator itr; + for( itr = mRuleList.begin(); itr != mRuleList.end(); ++itr ) + { + delete *itr; + } + +} + /////////////////////////////////////////////////////////////////////////////// // AddStopPoint diff --git a/src/twparser/genreparseinfo.h b/src/twparser/genreparseinfo.h index eef27f7..d3895f8 100644 --- a/src/twparser/genreparseinfo.h +++ b/src/twparser/genreparseinfo.h @@ -80,6 +80,7 @@ class cGenreParseInfo { public: cGenreParseInfo(); + ~cGenreParseInfo(); void AddStopPoint( const cFCOName& name ); // adds the specified path as a stop point -- for now, we just queue it up, From d724c07873c8abd1c1a5053b35c670be95784372 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 27 Aug 2017 22:58:58 -0700 Subject: [PATCH 055/110] Use a static cFSPropDisplayer instead of creating a fresh one each time someone asks. Addresses a valgrind leak that only manifests in interactive db update mode. --- src/fs/fsfactory.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fs/fsfactory.cpp b/src/fs/fsfactory.cpp index a2a690e..36f40e4 100644 --- a/src/fs/fsfactory.cpp +++ b/src/fs/fsfactory.cpp @@ -76,7 +76,12 @@ iFCOSpec* cFSFactory::CreateSpec(const TSTRING& name, iFCOSpecHelper* pHelper) c iFCOPropDisplayer* cFSFactory::CreatePropDisplayer() const { - return new cFSPropDisplayer(); + static iFCOPropDisplayer* gPropDisplayer = 0; + + if (!gPropDisplayer) + gPropDisplayer = new cFSPropDisplayer(); + + return gPropDisplayer; } iSerRefCountObj::CreateFunc cFSFactory::GetCreateFunc() const From 8bb3669cf7221e1fe716d5ad62ff4f3c9834dbeb Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 27 Aug 2017 23:46:31 -0700 Subject: [PATCH 056/110] Enable SYSLOGREPORTING for test-harness tests, so that syslog code gets exercised in testing. --- src/test-harness/twtools.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index e74fddd..e575e8e 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -54,7 +54,7 @@ BEGIN { EMAILREPORTLEVEL => '3', REPORTLEVEL => '3', MAILMETHOD => 'SENDMAIL', - SYSLOGREPORTING => 'false', + SYSLOGREPORTING => 'true', MAILPROGRAM => 'cat', MAILFROMADDRESS => 'taz@cat' ); From 7310422053ad1a16d45de3e982cdc541bf780257 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 28 Aug 2017 20:08:38 -0700 Subject: [PATCH 057/110] Clean up iCodeConverter singleton on exit --- src/core/codeconvert.cpp | 6 ++++++ src/core/codeconvert.h | 2 ++ src/core/core.cpp | 5 ++++- src/core/core.h | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/core/codeconvert.cpp b/src/core/codeconvert.cpp index 559d335..7978278 100644 --- a/src/core/codeconvert.cpp +++ b/src/core/codeconvert.cpp @@ -111,6 +111,12 @@ iCodeConverter* iCodeConverter::GetInstance() return m_pInst; } +void iCodeConverter::Finit() +{ + delete m_pInst; + m_pInst = 0; +} + iCodeConverter* iCodeConverter::CreateConverter() { cDebug d("iCodeConverter::CreateConverter()"); diff --git a/src/core/codeconvert.h b/src/core/codeconvert.h index 3c74661..1539a72 100644 --- a/src/core/codeconvert.h +++ b/src/core/codeconvert.h @@ -93,6 +93,8 @@ class iCodeConverter public: static iCodeConverter* GetInstance(); // Singleton + static void Finit(); + /// Subclass Responsibilities diff --git a/src/core/core.cpp b/src/core/core.cpp index a84ebb2..039400a 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -60,5 +60,8 @@ cCore::cCore() iCodeConverter::GetInstance(); } - +cCore::~cCore() +{ + iCodeConverter::Finit(); +} diff --git a/src/core/core.h b/src/core/core.h index 87c3621..3e17c6b 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -54,6 +54,7 @@ TSS_BeginPackage( cCore ) public: cCore(); + ~cCore(); TSS_EndPackage( cCore ) From 78b09e081f7f19337057ed2e85e91418642c9fe1 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 28 Aug 2017 22:28:30 -0700 Subject: [PATCH 058/110] Add configure options for instrumentation: --enable-coverage & --enable-profiling --- configure | 28 ++++++++++++++++++++++++++++ configure.ac | 16 ++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/configure b/configure index 3052a28..2e91224 100755 --- a/configure +++ b/configure @@ -750,6 +750,8 @@ enable_silent_rules enable_extrawarnings enable_static enable_debug +enable_coverage +enable_profiling enable_dependency_tracking enable_commoncrypto enable_iconv @@ -1395,6 +1397,8 @@ Optional Features: —-disable-extrawarnings do not compile with -Wextra warnings enabled --enable-static compile static binaries --enable-debug compile with debuging enabled + --enable-coverage enable code coverage + --enable-profiling enable profiling --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking @@ -3497,6 +3501,30 @@ $as_echo "#define NDEBUG 1" >>confdefs.h fi +# Check whether --enable-coverage was given. +if test "${enable_coverage+set}" = set; then : + enableval=$enable_coverage; +fi + +if test "x$enable_coverage" = xyes +then + CFLAGS="${CFLAGS} --coverage" + CXXFLAGS="${CXXFLAGS} --coverage" + LDFLAGS="${LDFLAGS} --coverage" +fi + +# Check whether --enable-profiling was given. +if test "${enable_profiling+set}" = set; then : + enableval=$enable_profiling; +fi + +if test "x$enable_profiling" = xyes +then + CFLAGS="${CFLAGS} -pg" + CXXFLAGS="${CXXFLAGS} -pg" + LDFLAGS="${LDFLAGS} -pg" +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/configure.ac b/configure.ac index f5a55ca..8c0d96a 100644 --- a/configure.ac +++ b/configure.ac @@ -44,6 +44,22 @@ else AC_DEFINE(NDEBUG, 1, [Compile without debug code]) fi +AC_ARG_ENABLE(coverage, [ --enable-coverage enable code coverage]) +if test "x$enable_coverage" = xyes +then + CFLAGS="${CFLAGS} --coverage" + CXXFLAGS="${CXXFLAGS} --coverage" + LDFLAGS="${LDFLAGS} --coverage" +fi + +AC_ARG_ENABLE(profiling, [ --enable-profiling enable profiling]) +if test "x$enable_profiling" = xyes +then + CFLAGS="${CFLAGS} -pg" + CXXFLAGS="${CXXFLAGS} -pg" + LDFLAGS="${LDFLAGS} -pg" +fi + dnl ################### dnl Checks for programs dnl ################### From 02dd677d714bdcd8fe48f49f7df02cfedb8e5c49 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 28 Aug 2017 23:01:35 -0700 Subject: [PATCH 059/110] Tweak .gitignore to ignore gcov files; add a convenience script (lcov.sh) to run lcov & package results --- .gitignore | 3 +++ lcov.sh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 lcov.sh diff --git a/.gitignore b/.gitignore index 9e8c92b..14e685b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,9 @@ src/test-harness/twtest **/*.dll **/*.exe **/*~ +**/*# **/*.bak **/.DS_Store +**/*.gcno +**/*.gcda releases/ diff --git a/lcov.sh b/lcov.sh new file mode 100755 index 0000000..b8f85c5 --- /dev/null +++ b/lcov.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if [ -d ./lcov ]; then + rm -Rf ./lcov +fi + +if [ -e ./lcov.dat ]; then + rm ./lcov.dat +fi + +if [ -e ./lcov.tgz ]; then + rm ./lcov.tgz +fi + +lcov --capture --directory src --output-file ./lcov.dat +genhtml ./lcov.dat --output-directory lcov +tar -zcvf lcov.tgz lcov + From 5a34e6f48c2cc478a9e9b62d3683007689a98f61 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Tue, 29 Aug 2017 18:57:59 -0700 Subject: [PATCH 060/110] Add a 'targets' make target to list make targets. Also add a 'test' target as an alias of 'check'. --- Makefile.am | 6 ++++++ Makefile.in | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/Makefile.am b/Makefile.am index d9ee690..e353377 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,3 +17,9 @@ check: rm -Rf $(top_srcdir)/bin/TWTestData cd $(top_srcdir)/src/test-harness && perl ./twtest.pl cd $(top_srcdir)/bin && ./twtest all + +test: check + +.PHONY: targets +targets: + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs diff --git a/Makefile.in b/Makefile.in index 0a11cca..bdfa8ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -813,6 +813,13 @@ check: cd $(top_srcdir)/src/test-harness && perl ./twtest.pl cd $(top_srcdir)/bin && ./twtest all +test: check + +.PHONY: targets +targets: + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make dat\ +a base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: From 7fe1e4f79abc13743b0d078d944fa3e0bc48a133 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 31 Aug 2017 18:50:02 -0700 Subject: [PATCH 061/110] Detect support for doors & event ports in a proper autoconf way. --- config.h.in | 12 ++++++++++ configure | 46 +++++++++++++++++++++++++++++++++++++ configure.ac | 6 +++++ src/core/unixfsservices.cpp | 12 ++++++---- 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/config.h.in b/config.h.in index f7c8937..184a9f7 100644 --- a/config.h.in +++ b/config.h.in @@ -24,6 +24,12 @@ /* Has /dev/urandom */ #undef HAVE_DEV_URANDOM +/* Define to 1 if you have the `door_create' function. */ +#undef HAVE_DOOR_CREATE + +/* Define to 1 if you have the header file. */ +#undef HAVE_DOOR_H + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H @@ -63,6 +69,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_SHA_H +/* Define to 1 if you have the `port_create' function. */ +#undef HAVE_PORT_CREATE + +/* Define to 1 if you have the header file. */ +#undef HAVE_PORT_H + /* Define to 1 if you have the `posix_fadvise' function. */ #undef HAVE_POSIX_FADVISE diff --git a/configure b/configure index 2e91224..5c6690e 100755 --- a/configure +++ b/configure @@ -6214,6 +6214,52 @@ done fi +for ac_header in door.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "door.h" "ac_cv_header_door_h" "$ac_includes_default" +if test "x$ac_cv_header_door_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DOOR_H 1 +_ACEOF + for ac_func in door_create +do : + ac_fn_c_check_func "$LINENO" "door_create" "ac_cv_func_door_create" +if test "x$ac_cv_func_door_create" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DOOR_CREATE 1 +_ACEOF + +fi +done + +fi + +done + + +for ac_header in port.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "port.h" "ac_cv_header_port_h" "$ac_includes_default" +if test "x$ac_cv_header_port_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PORT_H 1 +_ACEOF + for ac_func in port_create +do : + ac_fn_c_check_func "$LINENO" "port_create" "ac_cv_func_port_create" +if test "x$ac_cv_func_port_create" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PORT_CREATE 1 +_ACEOF + +fi +done + +fi + +done + + if test -c "/dev/random"; then diff --git a/configure.ac b/configure.ac index 8c0d96a..8b995a8 100644 --- a/configure.ac +++ b/configure.ac @@ -150,6 +150,12 @@ then AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h) fi +dnl check for door support (Solaris) +AC_CHECK_HEADERS(door.h, [AC_CHECK_FUNCS(door_create)]) + +dnl check for event port support (Solaris) +AC_CHECK_HEADERS(port.h, [AC_CHECK_FUNCS(port_create)]) + dnl ############################################## dnl check for various RNG/PRNG devices dnl ############################################## diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index 0f91d1e..92ba8e8 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -365,10 +365,12 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const #ifdef S_ISSOCK else if(S_ISSOCK(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_SOCK; #endif -#ifdef S_IFDOOR + +#if HAVE_DOOR_CREATE else if(S_ISDOOR(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_DOOR; #endif -#ifdef S_ISPORT + +#if HAVE_PORT_CREATE else if(S_ISPORT(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_PORT; #endif @@ -594,12 +596,14 @@ void cUnixFSServices::ConvertModeToString( uint64 perm, TSTRING& tstrPerm ) cons case S_IFLNK: szPerm[0] = _T('l'); break; -#ifdef S_IFDOOR + +#if HAVE_DOOR_CREATE // Solaris doors case S_IFDOOR: szPerm[0] = _T('D'); break; #endif -#ifdef S_ISPORT + +#if HAVE_PORT_CREATE // Solaris event ports case S_IFPORT: szPerm[0] = _T('P'); break; From 5184fe01c4903ae290ef9f1fbc4a61fc584ce97a Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 31 Aug 2017 19:51:50 -0700 Subject: [PATCH 062/110] Customize 'make clean' to also remove test data dirs and gcov files --- src/Makefile.am | 4 ++++ src/Makefile.in | 28 +++++++++++++++++----------- src/core/Makefile.am | 1 + src/core/Makefile.in | 2 ++ src/cryptlib/Makefile.am | 2 +- src/cryptlib/Makefile.in | 2 +- src/db/Makefile.am | 1 + src/db/Makefile.in | 2 ++ src/fco/Makefile.am | 1 + src/fco/Makefile.in | 2 ++ src/fs/Makefile.am | 1 + src/fs/Makefile.in | 2 ++ src/siggen/Makefile.am | 2 +- src/siggen/Makefile.in | 2 +- src/tripwire/Makefile.am | 2 +- src/tripwire/Makefile.in | 2 +- src/tw/Makefile.am | 1 + src/tw/Makefile.in | 2 ++ src/twadmin/Makefile.am | 2 +- src/twadmin/Makefile.in | 2 +- src/twcrypto/Makefile.am | 1 + src/twcrypto/Makefile.in | 2 ++ src/twparser/Makefile.am | 1 + src/twparser/Makefile.in | 2 ++ src/twprint/Makefile.am | 2 +- src/twprint/Makefile.in | 2 +- src/twtest/Makefile.am | 8 +++++++- src/twtest/Makefile.in | 29 +++++++++++++++++------------ src/util/Makefile.am | 1 + src/util/Makefile.in | 2 ++ 30 files changed, 79 insertions(+), 34 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 6b8084e..7e6ffd8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,3 +8,7 @@ install: uninstall: true +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + -rm -rf test-harness/twtest \ No newline at end of file diff --git a/src/Makefile.in b/src/Makefile.in index f0fb88f..be0d740 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -519,7 +519,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive -clean-am: clean-generic mostlyclean-am +clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-recursive -rm -f Makefile @@ -586,16 +586,17 @@ uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am clean clean-generic cscopelist-am ctags ctags-am \ - distclean distclean-generic distclean-tags distdir dvi dvi-am \ - html html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags tags-am uninstall uninstall-am + check-am clean clean-generic clean-local cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-tags distdir \ + dvi dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am .PRECIOUS: Makefile @@ -606,6 +607,11 @@ install: uninstall: true +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + -rm -rf test-harness/twtest + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 0a47f0e..2b48224 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -35,6 +35,7 @@ libcore_a_LIBADD = @CORE_CRYPT_O@ libcore_a_DEPENDENCIES = @CORE_CRYPT_O@ DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit +CLEANFILES = *.gcno *.gcda all: $(noinst_LIBRARIES) $(AR) ru ../../lib/libtripwire.a $(libcore_a_OBJECTS) $(libcore_a_LIBADD) diff --git a/src/core/Makefile.in b/src/core/Makefile.in index 694e8f0..5ee6d53 100644 --- a/src/core/Makefile.in +++ b/src/core/Makefile.in @@ -358,6 +358,7 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \ libcore_a_LIBADD = @CORE_CRYPT_O@ libcore_a_DEPENDENCIES = @CORE_CRYPT_O@ +CLEANFILES = *.gcno *.gcda all: all-am .SUFFIXES: @@ -544,6 +545,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/cryptlib/Makefile.am b/src/cryptlib/Makefile.am index 6ec973b..156082d 100644 --- a/src/cryptlib/Makefile.am +++ b/src/cryptlib/Makefile.am @@ -20,7 +20,7 @@ libcryptlib_a_HEADERS = \ ztrees.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit -CLEANFILES = ../../lib/libcryptlib.a +CLEANFILES = ../../lib/libcryptlib.a *.gcno *.gcda all: $(noinst_LIBRARIES) $(LN) -f $(noinst_LIBRARIES) ../../lib/libcryptlib.a diff --git a/src/cryptlib/Makefile.in b/src/cryptlib/Makefile.in index 5306cab..4f6d772 100644 --- a/src/cryptlib/Makefile.in +++ b/src/cryptlib/Makefile.in @@ -333,7 +333,7 @@ libcryptlib_a_HEADERS = \ queue.h rng.h sha.h smartptr.h words.h zbits.h zdeflate.h zinflate.h \ ztrees.h -CLEANFILES = ../../lib/libcryptlib.a +CLEANFILES = ../../lib/libcryptlib.a *.gcno *.gcda all: all-am .SUFFIXES: diff --git a/src/db/Makefile.am b/src/db/Makefile.am index 3488413..68a57ed 100644 --- a/src/db/Makefile.am +++ b/src/db/Makefile.am @@ -13,6 +13,7 @@ libdb_a_HEADERS = \ db.h dberrors.h hierdatabase.h hierdbnode.h hierdbpath.h stddb.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit +CLEANFILES = *.gcno *.gcda all: $(noinst_LIBRARIES) $(AR) ru ../../lib/libtripwire.a $(libdb_a_OBJECTS) diff --git a/src/db/Makefile.in b/src/db/Makefile.in index 53ef6f8..c875d47 100644 --- a/src/db/Makefile.in +++ b/src/db/Makefile.in @@ -324,6 +324,7 @@ libdb_a_HEADERS = \ block.h blockfile.h blockrecordarray.h blockrecordfile.h \ db.h dberrors.h hierdatabase.h hierdbnode.h hierdbpath.h stddb.h +CLEANFILES = *.gcno *.gcda all: all-am .SUFFIXES: @@ -510,6 +511,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/fco/Makefile.am b/src/fco/Makefile.am index 10f756d..cb5f50f 100644 --- a/src/fco/Makefile.am +++ b/src/fco/Makefile.am @@ -27,6 +27,7 @@ libfco_a_HEADERS = \ DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit +CLEANFILES = *.gcno *.gcda all: $(noinst_LIBRARIES) $(AR) ru ../../lib/libtripwire.a $(libfco_a_OBJECTS) diff --git a/src/fco/Makefile.in b/src/fco/Makefile.in index 84b5a63..0300072 100644 --- a/src/fco/Makefile.in +++ b/src/fco/Makefile.in @@ -345,6 +345,7 @@ libfco_a_HEADERS = \ iterproxy.h parsergenreutil.h propset.h signature.h \ stdfco.h twfactory.h +CLEANFILES = *.gcno *.gcda all: all-am .SUFFIXES: @@ -531,6 +532,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 55fbd36..d7b7ae5 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -17,6 +17,7 @@ libfs_a_HEADERS = \ fsvisitor.h stdfs.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit +CLEANFILES = *.gcno *.gcda all: $(noinst_LIBRARIES) $(AR) ru ../../lib/libtripwire.a $(libfs_a_OBJECTS) diff --git a/src/fs/Makefile.in b/src/fs/Makefile.in index 7a90d6e..21c6d25 100644 --- a/src/fs/Makefile.in +++ b/src/fs/Makefile.in @@ -331,6 +331,7 @@ libfs_a_HEADERS = \ fspropcalc.h fspropdisplayer.h fspropset.h fsstrings.h \ fsvisitor.h stdfs.h +CLEANFILES = *.gcno *.gcda all: all-am .SUFFIXES: @@ -517,6 +518,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/siggen/Makefile.am b/src/siggen/Makefile.am index b56566e..f400881 100644 --- a/src/siggen/Makefile.am +++ b/src/siggen/Makefile.am @@ -16,7 +16,7 @@ siggen_HEADERS = \ siggen.h siggencmdline.h siggenstrings.h stdsiggen.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit -CLEANFILES = ../../bin/siggen +CLEANFILES = ../../bin/siggen *.gcno *.gcda all: $(sbin_PROGRAMS) @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin diff --git a/src/siggen/Makefile.in b/src/siggen/Makefile.in index 563a92c..8db2435 100644 --- a/src/siggen/Makefile.in +++ b/src/siggen/Makefile.in @@ -318,7 +318,7 @@ siggen_SOURCES = \ siggen_HEADERS = \ siggen.h siggencmdline.h siggenstrings.h stdsiggen.h -CLEANFILES = ../../bin/siggen +CLEANFILES = ../../bin/siggen *.gcno *.gcda all: all-am .SUFFIXES: diff --git a/src/tripwire/Makefile.am b/src/tripwire/Makefile.am index 4abba88..2ec808a 100644 --- a/src/tripwire/Makefile.am +++ b/src/tripwire/Makefile.am @@ -20,7 +20,7 @@ tripwire_HEADERS = \ tripwirestrings.h tripwireutil.h twcmdline.h twcmdlineutil.h updatedb.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit -CLEANFILES = ../../bin/tripwire ../../lib/libtripwire.a +CLEANFILES = ../../bin/tripwire ../../lib/libtripwire.a *.gcno *.gcda all: $(sbin_PROGRAMS) @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin diff --git a/src/tripwire/Makefile.in b/src/tripwire/Makefile.in index 7d343a3..df8e69c 100644 --- a/src/tripwire/Makefile.in +++ b/src/tripwire/Makefile.in @@ -326,7 +326,7 @@ tripwire_HEADERS = \ stdtripwire.h syslog_trip.h tripwire.h tripwireerrors.h tripwiremsg.h \ tripwirestrings.h tripwireutil.h twcmdline.h twcmdlineutil.h updatedb.h -CLEANFILES = ../../bin/tripwire ../../lib/libtripwire.a +CLEANFILES = ../../bin/tripwire ../../lib/libtripwire.a *.gcno *.gcda all: all-am .SUFFIXES: diff --git a/src/tw/Makefile.am b/src/tw/Makefile.am index de2d025..1bea795 100644 --- a/src/tw/Makefile.am +++ b/src/tw/Makefile.am @@ -20,6 +20,7 @@ libtw_a_HEADERS = \ tw.h twerrors.h twinit.h twstrings.h twutil.h DEFS = @DEFS@ -DCONFIG_DIR=\"$(sysconfdir)\" +CLEANFILES = *.gcno *.gcda all: $(noinst_LIBRARIES) $(AR) ru ../../lib/libtripwire.a $(libtw_a_OBJECTS) diff --git a/src/tw/Makefile.in b/src/tw/Makefile.in index ca3e7d5..8749f14 100644 --- a/src/tw/Makefile.in +++ b/src/tw/Makefile.in @@ -337,6 +337,7 @@ libtw_a_HEADERS = \ stdtw.h systeminfo.h textdbviewer.h textreportviewer.h \ tw.h twerrors.h twinit.h twstrings.h twutil.h +CLEANFILES = *.gcno *.gcda all: all-am .SUFFIXES: @@ -523,6 +524,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/twadmin/Makefile.am b/src/twadmin/Makefile.am index b59ec1c..538bde7 100644 --- a/src/twadmin/Makefile.am +++ b/src/twadmin/Makefile.am @@ -17,7 +17,7 @@ twadmin_HEADERS = \ twadmincl.h twadminerrors.h twadminstrings.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit -CLEANFILES = ../../bin/twadmin +CLEANFILES = ../../bin/twadmin *.gcno *.gcda all: $(sbin_PROGRAMS) @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin diff --git a/src/twadmin/Makefile.in b/src/twadmin/Makefile.in index 0cb82a2..b3a8e68 100644 --- a/src/twadmin/Makefile.in +++ b/src/twadmin/Makefile.in @@ -319,7 +319,7 @@ twadmin_HEADERS = \ keygeneration.h resource.h stdtwadmin.h twadmin.h \ twadmincl.h twadminerrors.h twadminstrings.h -CLEANFILES = ../../bin/twadmin +CLEANFILES = ../../bin/twadmin *.gcno *.gcda all: all-am .SUFFIXES: diff --git a/src/twcrypto/Makefile.am b/src/twcrypto/Makefile.am index 27d1fd3..27aaa0c 100644 --- a/src/twcrypto/Makefile.am +++ b/src/twcrypto/Makefile.am @@ -13,6 +13,7 @@ libtwcrypto_a_HEADERS = \ stdtwcrypto.h twcrypto.h twcryptoerrors.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit +CLEANFILES = *.gcno *.gcda all: $(noinst_LIBRARIES) $(AR) ru ../../lib/libtripwire.a $(libtwcrypto_a_OBJECTS) diff --git a/src/twcrypto/Makefile.in b/src/twcrypto/Makefile.in index 2b30911..9afae2e 100644 --- a/src/twcrypto/Makefile.in +++ b/src/twcrypto/Makefile.in @@ -325,6 +325,7 @@ libtwcrypto_a_HEADERS = \ bytequeue.h crypto.h cryptoarchive.h keyfile.h \ stdtwcrypto.h twcrypto.h twcryptoerrors.h +CLEANFILES = *.gcno *.gcda all: all-am .SUFFIXES: @@ -511,6 +512,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/twparser/Makefile.am b/src/twparser/Makefile.am index bf75900..61fa23d 100644 --- a/src/twparser/Makefile.am +++ b/src/twparser/Makefile.am @@ -15,6 +15,7 @@ libtwparser_a_HEADERS = \ yylex.h yyparse.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit +CLEANFILES = *.gcno *.gcda all: $(noinst_LIBRARIES) $(AR) ru ../../lib/libtripwire.a $(libtwparser_a_OBJECTS) diff --git a/src/twparser/Makefile.in b/src/twparser/Makefile.in index dc9551b..102f0d9 100644 --- a/src/twparser/Makefile.in +++ b/src/twparser/Makefile.in @@ -328,6 +328,7 @@ libtwparser_a_HEADERS = \ stdtwparser.h twparser.h twparsererrors.h twparserstrings.h \ yylex.h yyparse.h +CLEANFILES = *.gcno *.gcda all: all-am .SUFFIXES: @@ -514,6 +515,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/twprint/Makefile.am b/src/twprint/Makefile.am index 7973565..6b09237 100644 --- a/src/twprint/Makefile.am +++ b/src/twprint/Makefile.am @@ -17,7 +17,7 @@ twprint_HEADERS = \ twprinterrors.h twprintstrings.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit -CLEANFILES = ../../bin/twprint +CLEANFILES = ../../bin/twprint *.gcno *.gcda all: $(sbin_PROGRAMS) @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin diff --git a/src/twprint/Makefile.in b/src/twprint/Makefile.in index 157d67c..afaa7af 100644 --- a/src/twprint/Makefile.in +++ b/src/twprint/Makefile.in @@ -319,7 +319,7 @@ twprint_HEADERS = \ resource.h stdtwprint.h twprint.h twprintcmdline.h \ twprinterrors.h twprintstrings.h -CLEANFILES = ../../bin/twprint +CLEANFILES = ../../bin/twprint *.gcno *.gcda all: all-am .SUFFIXES: diff --git a/src/twtest/Makefile.am b/src/twtest/Makefile.am index 4361ccb..662f936 100644 --- a/src/twtest/Makefile.am +++ b/src/twtest/Makefile.am @@ -81,7 +81,13 @@ wchar16_t.cpp twtest_HEADERS = stdtest.h stringutil_t.h test.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit -CLEANFILES = ../../bin/twtest + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + -rm -rf ../../bin/TWTestData + -rm -f ../../bin/twtest + -rm -f *.gcno *.gcda all: $(sbin_PROGRAMS) @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin diff --git a/src/twtest/Makefile.in b/src/twtest/Makefile.in index 84b0b3e..f3ee9b4 100644 --- a/src/twtest/Makefile.in +++ b/src/twtest/Makefile.in @@ -420,7 +420,6 @@ usernotifystdout_t.cpp \ wchar16_t.cpp twtest_HEADERS = stdtest.h stringutil_t.h test.h -CLEANFILES = ../../bin/twtest all: all-am .SUFFIXES: @@ -645,7 +644,6 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -656,7 +654,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am +clean-am: clean-generic clean-local clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -724,15 +722,15 @@ uninstall-am: uninstall-sbinPROGRAMS uninstall-twtestHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-sbinPROGRAMS cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ - install-strip install-twtestHEADERS installcheck \ - installcheck-am installdirs maintainer-clean \ + clean-local clean-sbinPROGRAMS cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-sbinPROGRAMS install-strip install-twtestHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-sbinPROGRAMS uninstall-twtestHEADERS @@ -740,6 +738,13 @@ uninstall-am: uninstall-sbinPROGRAMS uninstall-twtestHEADERS .PRECIOUS: Makefile +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + -rm -rf ../../bin/TWTestData + -rm -f ../../bin/twtest + -rm -f *.gcno *.gcda + all: $(sbin_PROGRAMS) @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin diff --git a/src/util/Makefile.am b/src/util/Makefile.am index a268a3d..bd39842 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -12,6 +12,7 @@ libutil_a_HEADERS = fileutil.h miscutil.h stdutil.h \ stringencoder.h util.h utilerrors.h utilstrings.h DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit +CLEANFILES = *.gcno *.gcda all: $(noinst_LIBRARIES) $(AR) ru ../../lib/libtripwire.a $(libutil_a_OBJECTS) diff --git a/src/util/Makefile.in b/src/util/Makefile.in index 8fd445d..96f23e3 100644 --- a/src/util/Makefile.in +++ b/src/util/Makefile.in @@ -323,6 +323,7 @@ libutil_a_SOURCES = \ libutil_a_HEADERS = fileutil.h miscutil.h stdutil.h \ stringencoder.h util.h utilerrors.h utilstrings.h +CLEANFILES = *.gcno *.gcda all: all-am .SUFFIXES: @@ -509,6 +510,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) From 0886ea31befabd24b510fb5b31464268622e111b Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 31 Aug 2017 21:44:24 -0700 Subject: [PATCH 063/110] Tweak a couple of test-harness tests to exclude variable properties like access time, since tests aren't interested in that behavior. --- src/test-harness/tests/integritycheck.pm | 4 ++-- src/test-harness/tests/polupdate.pm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test-harness/tests/integritycheck.pm b/src/test-harness/tests/integritycheck.pm index 7e8bbac..a7b8159 100644 --- a/src/test-harness/tests/integritycheck.pm +++ b/src/test-harness/tests/integritycheck.pm @@ -35,12 +35,12 @@ sub PolicyFileString # (rulename="RuleA", severity=30, emailto="elvis@mars") { - $root -> \$(ReadOnly)+S; #read only plus SHA-1 + $root -> \$(ReadOnly) +S -ab; #read only plus SHA-1 minus atime & blocks } (rulename="RuleB", severity=200, emailto="elvis@mars") { - $root2 -> \$(ReadOnly)+S; #read only plus SHA-1 + $root2 -> \$(ReadOnly) +S -ab; #read only plus SHA-1 minus atime & blocks } POLICY_END diff --git a/src/test-harness/tests/polupdate.pm b/src/test-harness/tests/polupdate.pm index 4f701a1..bc4a4d1 100644 --- a/src/test-harness/tests/polupdate.pm +++ b/src/test-harness/tests/polupdate.pm @@ -31,8 +31,8 @@ sub PolicyFileString return < \$(ReadOnly)+M; #read only plus MD5 - $root2 -> \$(ReadOnly)+M; #read only plus MD5 + $root1 -> \$(ReadOnly) +M -ab; #read only plus MD5 minus atime & blocks + $root2 -> \$(ReadOnly) +M -ab; #read only plus MD5 minus atime & blocks POLICY_END @@ -46,8 +46,8 @@ sub PolicyFileStringNew return < \$(ReadOnly)+S; #read only plus SHA1 - $root3 -> \$(ReadOnly)+S; #read only plus SHA1 + $root1 -> \$(ReadOnly) +S -ab; #read only plus SHA1 minus atime & blocks + $root3 -> \$(ReadOnly) +S -ab; #read only plus SHA1 minus atime & blocks POLICY_END From ce25569eeae154664f54ae6f920f53a073a6ab64 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 1 Sep 2017 13:48:57 -0700 Subject: [PATCH 064/110] Use 0 instead of CHILD_ERROR_NATIVE since the latter only exists in Perl >= 5.14.2, and doesn't seem to have any obvious advantages. --- src/test-harness/twtools.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index e575e8e..1252162 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -221,7 +221,7 @@ sub PrintPolicy { my (@out) = `$twrootdir/bin/twadmin -m p -c $twrootdir/$twcfgloc -p $twrootdir/$twpolfileloc -S $twrootdir/$twsitekeyloc $params{opts} 2>&1`; - my ($result) = ${^CHILD_ERROR_NATIVE}; + my ($result) = $?; logStatus(@out); @@ -239,7 +239,7 @@ sub PrintConfig { logStatus "printing config file...\n"; my (@out) = `$twrootdir/bin/twadmin -m f -c $twrootdir/$twcfgloc $params{opts} 2>&1`; - my ($result) = ${^CHILD_ERROR_NATIVE}; + my ($result) = $?; logStatus(@out); @@ -275,7 +275,7 @@ sub GeneratePolicyFile { my (@out) = `$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc 2>&1`; - my ($result) = ${^CHILD_ERROR_NATIVE}; + my ($result) = $?; logStatus(@out); @@ -297,7 +297,7 @@ sub CreatePolicy { my (@out) = `$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $params{policy-text} 2>&1`; - my ($result) = ${^CHILD_ERROR_NATIVE}; + my ($result) = $?; logStatus(@out); @@ -315,7 +315,7 @@ sub InitializeDatabase { print "initializing database for '$twmsg' test...\n" if $verbose; my (@out) = `$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`; - my ($result) = ${^CHILD_ERROR_NATIVE}; + my ($result) = $?; logStatus(@out); @@ -335,7 +335,7 @@ sub UpdateDatabase { print "updating database for '$twmsg' test...\n" if $verbose; my (@out) = `$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{secure-mode} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc -r $params{report} 2>&1`; - my ($result) = ${^CHILD_ERROR_NATIVE}; + my ($result) = $?; logStatus(@out); From 9d1d1e19d311f4c84bb0daa233d41d04aa10de19 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 1 Sep 2017 14:18:19 -0700 Subject: [PATCH 065/110] Re-add 'compile' script since make dist/distcheck seem to want it; remove it from .gitignore; recreate root Makefile.in with automake 1.15.1 --- .gitignore | 1 - Makefile.in | 3 +- compile | 348 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 349 insertions(+), 3 deletions(-) create mode 100755 compile diff --git a/.gitignore b/.gitignore index 14e685b..ee3da06 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ config.h config.h.in~ config.log config.status -compile autom4te.cache/ bin/ lib/ diff --git a/Makefile.in b/Makefile.in index bdfa8ff..faf90c5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -817,8 +817,7 @@ test: check .PHONY: targets targets: - @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make dat\ -a base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/compile b/compile new file mode 100755 index 0000000..2ab71e4 --- /dev/null +++ b/compile @@ -0,0 +1,348 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2016-01-11.22; # UTC + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: From 7a262bf1c163308fe4ce3d8a839991741f627e4b Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 1 Sep 2017 17:13:57 -0700 Subject: [PATCH 066/110] Fix AROS build issue that crept in somehow --- src/core/msystem.cpp | 2 +- src/twparser/yylex.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/msystem.cpp b/src/core/msystem.cpp index f63c3cb..025442d 100644 --- a/src/core/msystem.cpp +++ b/src/core/msystem.cpp @@ -78,7 +78,7 @@ #include #include #include -#if defined(HAVE_MALLOC_H) +#if HAVE_MALLOC_H && !IS_AROS #include #endif #include diff --git a/src/twparser/yylex.cpp b/src/twparser/yylex.cpp index 5fc5b78..b77935b 100644 --- a/src/twparser/yylex.cpp +++ b/src/twparser/yylex.cpp @@ -515,7 +515,7 @@ const int MIN_NUM_STATES = 20; //#endif #include -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H && !IS_AROS #include #endif #include From 736a761bffbca4dde9016efd3d4abbce5e733210 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 1 Sep 2017 19:43:05 -0700 Subject: [PATCH 067/110] Fix a couple of twtest-only valgrind issues --- src/twtest/crytpo_t.cpp | 10 +++++++--- src/twtest/fcosetimpl_t.cpp | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/twtest/crytpo_t.cpp b/src/twtest/crytpo_t.cpp index 5d83447..d3a0be2 100644 --- a/src/twtest/crytpo_t.cpp +++ b/src/twtest/crytpo_t.cpp @@ -44,9 +44,13 @@ void TestCrypto() const int BUFSIZE = 9000; - char source[BUFSIZE]; - char crypt[COUNT + BUFSIZE]; // needs to be able to hold even number of blocks - char dest[COUNT]; + std::vector source_buf(BUFSIZE); + std::vector crypt_buf(COUNT + BUFSIZE); // needs to be able to hold even number of blocks + std::vector dest_buf(COUNT); + + char* source = &source_buf[0]; + char* crypt = &crypt_buf[0]; + char* dest = &dest_buf[0]; memcpy(source, "I love the smell of the sheep.", 31); diff --git a/src/twtest/fcosetimpl_t.cpp b/src/twtest/fcosetimpl_t.cpp index 1cfc034..153e0d0 100644 --- a/src/twtest/fcosetimpl_t.cpp +++ b/src/twtest/fcosetimpl_t.cpp @@ -75,10 +75,12 @@ void TestFCOSetImpl() pFCO3->Release(); // let's iterate over the fcos - cIterProxy pit(set.GetIter()); + iFCOIter* pIter = set.GetIter(); + cIterProxy pit(pIter); pit->SeekBegin(); PrintIter(pit, d); + // lookup a specific fco cIterProxy pit2(set.Lookup(cFCOName(_T("fco2")))); if(! (iFCOIter*)pit2) @@ -113,10 +115,14 @@ void TestFCOSetImpl() // test operator= cFCOSetImpl set2; set2 = set; - pit = set2.GetIter(); + + pIter->DestroyIter(); + pIter = set2.GetIter(); + pit = pIter; d.TraceDebug("Made a new set and set it equal to the first with operator=; printing out...\n"); PrintIter(pit, d); + // test IsEmpty set.Clear(); TEST(set.IsEmpty()); @@ -142,6 +148,7 @@ void TestFCOSetImpl() pit = set3.GetIter(); PrintIter(pit, d); + pIter->DestroyIter(); d.TraceDebug("Leaving...\n"); return; From 0d21e71407d1904f437dafcf194fcaf4f72bb978 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 3 Sep 2017 00:12:54 -0700 Subject: [PATCH 068/110] Skip crc32 test if 'cksum' is not present for comparison (e.g. SkyOS) --- src/test-harness/tests/crc32.pm | 51 +++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/test-harness/tests/crc32.pm b/src/test-harness/tests/crc32.pm index b694b90..c4bf82d 100644 --- a/src/test-harness/tests/crc32.pm +++ b/src/test-harness/tests/crc32.pm @@ -28,39 +28,46 @@ sub initialize() { # sub run() { - my $twpassed = 1; + my $twpassed = 1; - twtools::logStatus("*** Beginning $description\n"); - printf("%-30s", "-- $description"); + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); - # lets see if the system 'cksum' agree's with siggen's crc32 value - # - my ($crc32, undef) = split(/ /, `cksum $twtools::twrootdir/test`); - my $siggen = `$twtools::twrootdir/bin/siggen -h -t -C $twtools::twrootdir/test`; + # lets see if the system 'cksum' agree's with siggen's crc32 value + # + my ($crc32, undef) = split(/ /, `cksum $twtools::twrootdir/test`); - chomp $crc32; - chomp $siggen; + if ($crc32 eq "") { + ++$twtools::twskippedtests; + print "SKIPPED\n"; + return; + } - # cksum issues results in decimal, so get siggen's result in base10. - $siggen = hex($siggen); + my $siggen = `$twtools::twrootdir/bin/siggen -h -t -C $twtools::twrootdir/test`; - twtools::logStatus(" cksum reports: $crc32\n"); - twtools::logStatus("siggen reports: $siggen\n"); + chomp $crc32; + chomp $siggen; - $twpassed = ($crc32 eq $siggen); + # cksum issues results in decimal, so get siggen's result in base10. + $siggen = hex($siggen); - ######################################################### - # - # See if the tests all succeeded... - # - if ($twpassed) { + twtools::logStatus(" cksum reports: $crc32\n"); + twtools::logStatus("siggen reports: $siggen\n"); + + $twpassed = ($crc32 eq $siggen); + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { print "PASSED\n"; ++$twtools::twpassedtests; - } - else { + } + else { ++$twtools::twfailedtests; print "*FAILED*\n"; - } + } } From 8c73f1cf3b024b9a8dcc0ebc3a0720c3248c65e1 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 3 Sep 2017 20:28:24 -0700 Subject: [PATCH 069/110] Rework unit test framework (such as it is) to refer to tests by name & not numeric id. Mark tests as skipped if they don't make any TEST assertions or are skipped explicitly --- src/twtest/archive_t.cpp | 4 + src/twtest/blockfile_t.cpp | 6 + src/twtest/blockrecordarray_t.cpp | 4 + src/twtest/charutil_t.cpp | 12 +- src/twtest/cmdlineparser_t.cpp | 7 + src/twtest/codeconvert_t.cpp | 12 +- src/twtest/configfile_t.cpp | 6 + src/twtest/cryptoarchive_t.cpp | 5 +- src/twtest/crytpo_t.cpp | 5 + src/twtest/dbdatasource_t.cpp | 5 + src/twtest/debug_t.cpp | 5 +- src/twtest/displayencoder_t.cpp | 23 +- src/twtest/error_t.cpp | 5 + src/twtest/errorbucketimpl_t.cpp | 4 + src/twtest/fcocompare_t.cpp | 5 + src/twtest/fcodatabasefile_t.cpp | 7 + src/twtest/fconame_t.cpp | 5 +- src/twtest/fconametbl_t.cpp | 5 + src/twtest/fconametranslator_t.cpp | 4 + src/twtest/fcopropimpl_t.cpp | 4 + src/twtest/fcopropvector_t.cpp | 5 + src/twtest/fcoreport_t.cpp | 4 + src/twtest/fcosetimpl_t.cpp | 4 + src/twtest/fcospec_t.cpp | 5 + src/twtest/fcospecattr_t.cpp | 5 + src/twtest/fcospechelper_t.cpp | 5 + src/twtest/fcospeclist_t.cpp | 4 + src/twtest/fcospecutil_t.cpp | 5 + src/twtest/file_t.cpp | 4 + src/twtest/fileheader_t.cpp | 5 + src/twtest/fileutil_t.cpp | 4 + src/twtest/fsdatasourceiter_t.cpp | 5 + src/twtest/fsobject_t.cpp | 7 + src/twtest/fspropcalc_t.cpp | 6 +- src/twtest/fspropdisplayer_t.cpp | 4 + src/twtest/fspropset_t.cpp | 5 + src/twtest/fsspec_t.cpp | 4 + src/twtest/genre_t.cpp | 29 +- src/twtest/genrespeclist_t.cpp | 9 + src/twtest/genreswitcher_t.cpp | 31 +- src/twtest/growheap_t.cpp | 4 + src/twtest/hashtable_t.cpp | 15 +- src/twtest/hierdatabase_t.cpp | 5 + src/twtest/keyfile_t.cpp | 4 + src/twtest/platform_t.cpp | 7 + src/twtest/policyparser_t.cpp | 8 +- src/twtest/refcountobj_t.cpp | 5 + src/twtest/resources_t.cpp | 5 +- src/twtest/serializer_t.cpp | 6 + src/twtest/serializerimpl_t.cpp | 4 + src/twtest/signature_t.cpp | 4 + src/twtest/srefcountobj_t.cpp | 4 + src/twtest/stringencoder_t.cpp | 4 + src/twtest/stringutil_t.h | 5 + src/twtest/tasktimer_t.cpp | 6 + src/twtest/tchar_t.cpp | 5 + src/twtest/test.cpp | 492 +++++++++++++++++------------ src/twtest/test.h | 17 +- src/twtest/textreportviewer_t.cpp | 6 +- src/twtest/twlocale_t.cpp | 8 + src/twtest/twutil_t.cpp | 5 + src/twtest/types_t.cpp | 5 + src/twtest/unixfsservices_t.cpp | 5 +- src/twtest/usernotifystdout_t.cpp | 6 + src/twtest/wchar16_t.cpp | 5 + 65 files changed, 650 insertions(+), 273 deletions(-) diff --git a/src/twtest/archive_t.cpp b/src/twtest/archive_t.cpp index e2e479d..3db5e8a 100644 --- a/src/twtest/archive_t.cpp +++ b/src/twtest/archive_t.cpp @@ -186,3 +186,7 @@ void TestArchive() } } +void RegisterSuite_Archive() +{ + RegisterTest("Archive", "Basic", TestArchive); +} diff --git a/src/twtest/blockfile_t.cpp b/src/twtest/blockfile_t.cpp index 9fb8712..9788af3 100644 --- a/src/twtest/blockfile_t.cpp +++ b/src/twtest/blockfile_t.cpp @@ -109,3 +109,9 @@ void TestBlockFile() bf.Close(); } + +void RegisterSuite_BlockFile() +{ + RegisterTest("BlockFile", "Basic", TestBlockFile); +} + diff --git a/src/twtest/blockrecordarray_t.cpp b/src/twtest/blockrecordarray_t.cpp index 4242f98..a1a3b34 100644 --- a/src/twtest/blockrecordarray_t.cpp +++ b/src/twtest/blockrecordarray_t.cpp @@ -125,3 +125,7 @@ void TestBlockRecordArray() #endif } +void RegisterSuite_BlockRecordArray() +{ + RegisterTest("BlockRecordArray", "Basic", TestBlockRecordArray); +} diff --git a/src/twtest/charutil_t.cpp b/src/twtest/charutil_t.cpp index c55d7cc..827f5ef 100644 --- a/src/twtest/charutil_t.cpp +++ b/src/twtest/charutil_t.cpp @@ -75,11 +75,7 @@ void TestCharUtilBasic() PrintChars( _T("fo\x23 54") ); } - -/* -TSS_BeginTestSuiteFrom( cCharEncoderTest ) - - TSS_AddTestCase( Basic ); - -TSS_EndTestSuite( cCharEncoderTest ) -*/ +void RegisterSuite_CharUtil() +{ + RegisterTest("CharUtil", "Basic", TestCharUtilBasic); +} diff --git a/src/twtest/cmdlineparser_t.cpp b/src/twtest/cmdlineparser_t.cpp index a58de3e..d4898de 100644 --- a/src/twtest/cmdlineparser_t.cpp +++ b/src/twtest/cmdlineparser_t.cpp @@ -161,3 +161,10 @@ void TestCmdLineParser() // TODO -- test a bunch more!!! } +void RegisterSuite_CmdLineParser() +{ + RegisterTest("CmdLineParser", "Basic", TestCmdLineParser); +} + + + diff --git a/src/twtest/codeconvert_t.cpp b/src/twtest/codeconvert_t.cpp index a5947f0..7700f0d 100644 --- a/src/twtest/codeconvert_t.cpp +++ b/src/twtest/codeconvert_t.cpp @@ -185,7 +185,8 @@ char NonZeroChar( char ch ) //TestMbToDb in codeconvert_t.cpp seems to hit an infinite loop or runs verrrry long; ifdef'd" void TestMbToDb() { - TCERR << "\nTODO: TestMbToDb in codeconvert_t.cpp is flaky & needs to be fixed/replaced; currently disabled." << std::endl; + skip("This test is flaky & needs to be fixed/replaced; currently disabled."); + #if 0 std::string s; s.resize( 0x10000 * 2 ); // two bytes for each combination @@ -240,7 +241,8 @@ void TestMbToDb() // dbchar_t to mbchar_t void TestDbToMb() { - TCERR << "\nTODO: TestDbToMb in codeconvert_t.cpp fails, most likely due to not speaking UTF-16. Should fix this." << std::endl; + skip("This test fails, most likely due to not speaking UTF-16. Should fix this."); + #if 0 wc16_string ws; wc16_string::size_type n; @@ -344,4 +346,8 @@ bool LowASCIILooksLikeUCS2InWchart() } #endif - +void RegisterSuite_CodeConvert() +{ + RegisterTest("CodeConvert", "MbToDb", TestMbToDb); + RegisterTest("CodeConvert", "DbToMb", TestDbToMb); +} diff --git a/src/twtest/configfile_t.cpp b/src/twtest/configfile_t.cpp index 2e7b479..d62b03e 100644 --- a/src/twtest/configfile_t.cpp +++ b/src/twtest/configfile_t.cpp @@ -177,3 +177,9 @@ void TestConfigFile2(void) d.TraceDetail("Tests Passed!\n"); //#endif // NOT_BRIANS_TEST } + +void RegisterSuite_ConfigFile() +{ + RegisterTest("ConfigFile", "Basic 1", TestConfigFile); + RegisterTest("ConfigFile", "Basic 2", TestConfigFile2); +} diff --git a/src/twtest/cryptoarchive_t.cpp b/src/twtest/cryptoarchive_t.cpp index 292a9a4..3b754a4 100644 --- a/src/twtest/cryptoarchive_t.cpp +++ b/src/twtest/cryptoarchive_t.cpp @@ -299,4 +299,7 @@ void TestCryptoArchive() #endif } - +void RegisterSuite_CryptoArchive() +{ + RegisterTest("CryptoArchive", "Basic", TestCryptoArchive); +} diff --git a/src/twtest/crytpo_t.cpp b/src/twtest/crytpo_t.cpp index d3a0be2..018f4bb 100644 --- a/src/twtest/crytpo_t.cpp +++ b/src/twtest/crytpo_t.cpp @@ -416,3 +416,8 @@ void TestCrypto() } } +void RegisterSuite_Crypto() +{ + RegisterTest("Crypto", "Basic", TestCrypto); +} + diff --git a/src/twtest/dbdatasource_t.cpp b/src/twtest/dbdatasource_t.cpp index 52680f9..c5d5b73 100644 --- a/src/twtest/dbdatasource_t.cpp +++ b/src/twtest/dbdatasource_t.cpp @@ -212,3 +212,8 @@ void TestDbDataSourceBasic() db.AssertAllBlocksValid(); #endif } + +void RegisterSuite_DbDataSource() +{ + RegisterTest("DbDataSource", "Basic", TestDbDataSourceBasic); +} diff --git a/src/twtest/debug_t.cpp b/src/twtest/debug_t.cpp index ad0d9f6..2b3be0f 100644 --- a/src/twtest/debug_t.cpp +++ b/src/twtest/debug_t.cpp @@ -90,4 +90,7 @@ void TestDebug() d.TraceDebug("Exiting...\n"); } - +void RegisterSuite_Debug() +{ + RegisterTest("Debug", "Basic", TestDebug); +} diff --git a/src/twtest/displayencoder_t.cpp b/src/twtest/displayencoder_t.cpp index 3ec8406..df98865 100644 --- a/src/twtest/displayencoder_t.cpp +++ b/src/twtest/displayencoder_t.cpp @@ -321,17 +321,16 @@ void TestDisplayEncoderBasic() // make sure there are '\' and '"' in it ) } -/*TSS_BeginTestSuiteFrom( cDisplayEncoderTest ) - - TSS_AddTestCase( Basic ); - TSS_AddTestCase( TestHexToChar ); - TSS_AddTestCase( TestCharToHex ); - TSS_AddTestCase( TestStringToHex ); - TSS_AddTestCase( TestHexToString ); - TSS_AddTestCase( TestUnconvertable ); - TSS_AddTestCase( TestUnprintable ); - TSS_AddTestCase( TestQuoteAndBackSlash ); - -TSS_EndTestSuite( cDisplayEncoderTest )*/ +void RegisterSuite_DisplayEncoder() +{ + RegisterTest("DisplayEncoder", "Basic", TestDisplayEncoderBasic); + RegisterTest("DisplayEncoder", "CharToHex", TestCharToHex); + RegisterTest("DisplayEncoder", "HexToChar", TestHexToChar); + RegisterTest("DisplayEncoder", "StringToHex", TestStringToHex); + RegisterTest("DisplayEncoder", "HexToString", TestHexToString); + //RegisterTest("DisplayEncoder", "Unconvertable", TestUnconvertable); + //RegisterTest("DisplayEncoder", "Unprintable", TestUnprintable); + RegisterTest("DisplayEncoder", "QuoteAndBackSlash", TestQuoteAndBackSlash); +} diff --git a/src/twtest/error_t.cpp b/src/twtest/error_t.cpp index 4ab7e35..f3ed526 100644 --- a/src/twtest/error_t.cpp +++ b/src/twtest/error_t.cpp @@ -81,3 +81,8 @@ void TestError() TEST(threw); } + +void RegisterSuite_Error() +{ + RegisterTest("Error", "Basic", TestError); +} diff --git a/src/twtest/errorbucketimpl_t.cpp b/src/twtest/errorbucketimpl_t.cpp index 2a677c2..0ab4184 100644 --- a/src/twtest/errorbucketimpl_t.cpp +++ b/src/twtest/errorbucketimpl_t.cpp @@ -143,3 +143,7 @@ void TestErrorBucketImpl() } +void RegisterSuite_ErrorBucketImpl() +{ + RegisterTest("ErrorBucketImpl", "Basic", TestErrorBucketImpl); +} diff --git a/src/twtest/fcocompare_t.cpp b/src/twtest/fcocompare_t.cpp index f4580ba..752a8f4 100644 --- a/src/twtest/fcocompare_t.cpp +++ b/src/twtest/fcocompare_t.cpp @@ -158,3 +158,8 @@ void TestFCOCompare() return; } + +void RegisterSuite_FCOCompare() +{ + RegisterTest("FCOCompare", "Basic", TestFCOCompare); +} diff --git a/src/twtest/fcodatabasefile_t.cpp b/src/twtest/fcodatabasefile_t.cpp index 551ba15..0e1d19f 100644 --- a/src/twtest/fcodatabasefile_t.cpp +++ b/src/twtest/fcodatabasefile_t.cpp @@ -32,9 +32,16 @@ // fcodatabasefile.cpp #include "tw/stdtw.h" #include "tw/fcodatabasefile.h" +#include "test.h" void TestFCODatabaseFile() { cDebug d("TestFCODatabaseFile"); d.TraceError("Implement this!\n"); + skip("TestFCODatabaseFile not implemented"); +} + +void RegisterSuite_FCODatabaseFile() +{ + RegisterTest("FCODatabaseFile", "Basic", TestFCODatabaseFile); } diff --git a/src/twtest/fconame_t.cpp b/src/twtest/fconame_t.cpp index 4be3a5b..7ef2f54 100644 --- a/src/twtest/fconame_t.cpp +++ b/src/twtest/fconame_t.cpp @@ -139,4 +139,7 @@ void TestFCOName() } } - +void RegisterSuite_FCOName() +{ + RegisterTest("FCOName", "Basic", TestFCOName); +} diff --git a/src/twtest/fconametbl_t.cpp b/src/twtest/fconametbl_t.cpp index b1bba5f..a0e2dbd 100644 --- a/src/twtest/fconametbl_t.cpp +++ b/src/twtest/fconametbl_t.cpp @@ -61,3 +61,8 @@ void TestFCONameTbl() pNode4->Release(); pNode5->Release(); } + +void RegisterSuite_FCONameTbl() +{ + RegisterTest("FCONameTbl", "Basic", TestFCONameTbl); +} diff --git a/src/twtest/fconametranslator_t.cpp b/src/twtest/fconametranslator_t.cpp index 2a32416..fd4bae3 100644 --- a/src/twtest/fconametranslator_t.cpp +++ b/src/twtest/fconametranslator_t.cpp @@ -115,3 +115,7 @@ void TestUnprintable( const TCHAR* pchName, const TCHAR* pchGenre ) TEST( fcoNameNew == fcoName ); } +void RegisterSuite_FCONameTranslator() +{ + RegisterTest("FCONameTranslator", "Basic", TestFCONameTranslator); +} diff --git a/src/twtest/fcopropimpl_t.cpp b/src/twtest/fcopropimpl_t.cpp index 8cda935..492a36f 100644 --- a/src/twtest/fcopropimpl_t.cpp +++ b/src/twtest/fcopropimpl_t.cpp @@ -94,3 +94,7 @@ void TestFCOPropImpl() return; } +void RegisterSuite_FCOPropImpl() +{ + RegisterTest("FCOPropImpl", "Basic", TestFCOPropImpl); +} diff --git a/src/twtest/fcopropvector_t.cpp b/src/twtest/fcopropvector_t.cpp index 699a085..5b4bf27 100644 --- a/src/twtest/fcopropvector_t.cpp +++ b/src/twtest/fcopropvector_t.cpp @@ -192,3 +192,8 @@ static void objManip (cFCOPropVector &testV, cDebug& d) v3.AddItem(3); TEST((v1 ^ v2) == v3); } + +void RegisterSuite_FCOPropVector() +{ + RegisterTest("FCOPropVector", "Basic", TestFCOPropVector); +} diff --git a/src/twtest/fcoreport_t.cpp b/src/twtest/fcoreport_t.cpp index 8dfea82..1a91220 100644 --- a/src/twtest/fcoreport_t.cpp +++ b/src/twtest/fcoreport_t.cpp @@ -171,3 +171,7 @@ void TestFCOReport() d.TraceDebug("Leaving...\n"); } +void RegisterSuite_FCOReport() +{ + RegisterTest("FCOReport", "Basic", TestFCOReport); +} diff --git a/src/twtest/fcosetimpl_t.cpp b/src/twtest/fcosetimpl_t.cpp index 153e0d0..b840958 100644 --- a/src/twtest/fcosetimpl_t.cpp +++ b/src/twtest/fcosetimpl_t.cpp @@ -155,3 +155,7 @@ void TestFCOSetImpl() } +void RegisterSuite_FCOSetImpl() +{ + RegisterTest("FCOSetImpl", "Basic", TestFCOSetImpl); +} diff --git a/src/twtest/fcospec_t.cpp b/src/twtest/fcospec_t.cpp index 251f4e5..86725d1 100644 --- a/src/twtest/fcospec_t.cpp +++ b/src/twtest/fcospec_t.cpp @@ -51,3 +51,8 @@ void TestFCOSpec() cout << "End\tTestFCOSpec" << endl; return; } + +void RegisterSuite_FCOSpec() +{ + RegisterTest("FCOSpec", "Basic", TestFCOSpec); +} diff --git a/src/twtest/fcospecattr_t.cpp b/src/twtest/fcospecattr_t.cpp index ffe9148..6ffc8fe 100644 --- a/src/twtest/fcospecattr_t.cpp +++ b/src/twtest/fcospecattr_t.cpp @@ -88,3 +88,8 @@ void TestFCOSpecAttr() pNew->Release(); pAttr->Release(); } + +void RegisterSuite_FCOSpecAttr() +{ + RegisterTest("FCOSpecAttr", "Basic", TestFCOSpecAttr); +} diff --git a/src/twtest/fcospechelper_t.cpp b/src/twtest/fcospechelper_t.cpp index 30ba8ce..5b86505 100644 --- a/src/twtest/fcospechelper_t.cpp +++ b/src/twtest/fcospechelper_t.cpp @@ -129,3 +129,8 @@ void TestFCOSpecHelper() delete pHelp1; delete pHelp2; } + +void RegisterSuite_FCOSpecHelper() +{ + RegisterTest("FCOSpecHelper", "Basic", TestFCOSpecHelper); +} diff --git a/src/twtest/fcospeclist_t.cpp b/src/twtest/fcospeclist_t.cpp index 8f06705..e5557c7 100644 --- a/src/twtest/fcospeclist_t.cpp +++ b/src/twtest/fcospeclist_t.cpp @@ -164,3 +164,7 @@ void TestFCOSpecList() return; } +void RegisterSuite_FCOSpecList() +{ + RegisterTest("FCOSpecList", "Basic", TestFCOSpecList); +} diff --git a/src/twtest/fcospecutil_t.cpp b/src/twtest/fcospecutil_t.cpp index 19979a7..4dbace8 100644 --- a/src/twtest/fcospecutil_t.cpp +++ b/src/twtest/fcospecutil_t.cpp @@ -80,3 +80,8 @@ void TestFcoSpecUtil() d.TraceDebug("Leaving..\n"); } + +void RegisterSuite_FcoSpecUtil() +{ + RegisterTest("FcoSpecUtil", "Basic", TestFcoSpecUtil); +} diff --git a/src/twtest/file_t.cpp b/src/twtest/file_t.cpp index 9700b83..1e55a96 100644 --- a/src/twtest/file_t.cpp +++ b/src/twtest/file_t.cpp @@ -58,3 +58,7 @@ void TestFile() TEST(testStream); } +void RegisterSuite_File() +{ + RegisterTest("File", "Basic", TestFile); +} diff --git a/src/twtest/fileheader_t.cpp b/src/twtest/fileheader_t.cpp index b2d0160..f4000b3 100644 --- a/src/twtest/fileheader_t.cpp +++ b/src/twtest/fileheader_t.cpp @@ -126,3 +126,8 @@ void TestFileHeader() TEST(memcmp(buf, "abc123", 6) == 0); } } + +void RegisterSuite_FileHeader() +{ + RegisterTest("FileHeader", "Basic", TestFileHeader); +} diff --git a/src/twtest/fileutil_t.cpp b/src/twtest/fileutil_t.cpp index b71a824..007c797 100644 --- a/src/twtest/fileutil_t.cpp +++ b/src/twtest/fileutil_t.cpp @@ -71,3 +71,7 @@ void TestFileUtil() unlink(source.c_str()); } +void RegisterSuite_FileUtil() +{ + RegisterTest("FileUtil", "Basic", TestFileUtil); +} diff --git a/src/twtest/fsdatasourceiter_t.cpp b/src/twtest/fsdatasourceiter_t.cpp index e462629..1917128 100644 --- a/src/twtest/fsdatasourceiter_t.cpp +++ b/src/twtest/fsdatasourceiter_t.cpp @@ -108,4 +108,9 @@ void TestFSDataSourceIter() PrintIter( iter, d ); } +void RegisterSuite_FSDataSourceIter() +{ + RegisterTest("FSDataSourceIter", "Basic", TestFSDataSourceIter); +} + diff --git a/src/twtest/fsobject_t.cpp b/src/twtest/fsobject_t.cpp index d486895..28d5fdd 100644 --- a/src/twtest/fsobject_t.cpp +++ b/src/twtest/fsobject_t.cpp @@ -32,9 +32,16 @@ // fsobject_t -- the file system object test driver #include "fs/stdfs.h" #include "fs/fsobject.h" +#include "test.h" void TestFSObject() { cDebug d("TestFSObject"); d.TraceError("Implement this!\n"); + skip("TestFSObject not implemented"); +} + +void RegisterSuite_FSObject() +{ + RegisterTest("FSObject", "Basic", TestFSObject); } diff --git a/src/twtest/fspropcalc_t.cpp b/src/twtest/fspropcalc_t.cpp index b98af3e..2699b2b 100644 --- a/src/twtest/fspropcalc_t.cpp +++ b/src/twtest/fspropcalc_t.cpp @@ -155,4 +155,8 @@ void TestGetSymLinkStr() TEST(arch.Length() == (int64)file.size()); } - +void RegisterSuite_FSPropCalc() +{ + RegisterTest("FSPropCalc", "Basic", TestFSPropCalc); + RegisterTest("FSPropCalc", "GetSymLinkStr", TestGetSymLinkStr); +} diff --git a/src/twtest/fspropdisplayer_t.cpp b/src/twtest/fspropdisplayer_t.cpp index a654df0..d1fdf82 100644 --- a/src/twtest/fspropdisplayer_t.cpp +++ b/src/twtest/fspropdisplayer_t.cpp @@ -133,3 +133,7 @@ void cTestFSPropDisplayer::Test() return; } +void RegisterSuite_FSPropDisplayer() +{ + RegisterTest("FSPropDisplayer", "Basic", TestFSPropDisplayer); +} diff --git a/src/twtest/fspropset_t.cpp b/src/twtest/fspropset_t.cpp index 269b447..89914d6 100644 --- a/src/twtest/fspropset_t.cpp +++ b/src/twtest/fspropset_t.cpp @@ -92,3 +92,8 @@ void TestFSPropSet() return; } + +void RegisterSuite_FSPropSet() +{ + RegisterTest("FSPropSet", "Basic", TestFSPropSet); +} diff --git a/src/twtest/fsspec_t.cpp b/src/twtest/fsspec_t.cpp index c115988..aca91ca 100644 --- a/src/twtest/fsspec_t.cpp +++ b/src/twtest/fsspec_t.cpp @@ -102,3 +102,7 @@ void TestFCOSpecImpl() pSpec->Release(); } +void RegisterSuite_FCOSpecImpl() +{ + RegisterTest("FCOSpecImpl", "Basic", TestFCOSpecImpl); +} diff --git a/src/twtest/genre_t.cpp b/src/twtest/genre_t.cpp index 2f425d8..e9f3395 100644 --- a/src/twtest/genre_t.cpp +++ b/src/twtest/genre_t.cpp @@ -33,31 +33,30 @@ // genre_t.cpp // -#include - #include "fco/stdfco.h" #include "fco/genreswitcher.h" #include "twtest/test.h" #include "fs/fs.h" -#include "fs/fsfactory.h" - -void TestGenreSwitcher() +void TestGenre() { - cDebug d("TestGenreSwitcher"); + cDebug d("TestGenre"); d.TraceDebug("Entering...\n"); - cGenreSwitcher* genreSwitcher = cGenreSwitcher::GetInstance(); + TEST(cGenreSwitcher::GetInstance()->StringToGenre(cGenreSwitcher::GetInstance()->GenreToString(cFS::GenreID())) == cFS::GenreID()); - TEST(genreSwitcher->CurrentGenre() == cFS::GenreID()); - - // can't switch to invalid genre - //genreSwitcher->SelectGenre(cGenre::GENRE_INVALID); - //TEST(genreSwitcher->CurrentGenre() == cGenre::GENRE_INVALID); + //TODO: GenreToString() dies w/ GENRE_INVALID. Figure out if this should be changed. + // + //TEST(cGenreSwitcher::GetInstance()->StringToGenre(cGenreSwitcher::GetInstance()->GenreToString(cGenre::GENRE_INVALID)) == cGenre::GENRE_INVALID); - genreSwitcher->SelectGenre(cFS::GenreID()); - TEST(genreSwitcher->CurrentGenre() == cFS::GenreID()); - TEST(typeid(*iTWFactory::GetInstance()) == typeid(cFSFactory)); + + TEST(cGenreSwitcher::GetInstance()->StringToGenre(_T("fs")) == cFS::GenreID()); + TEST(cGenreSwitcher::GetInstance()->StringToGenre(_T("none of the above")) == cGenre::GENRE_INVALID); d.TraceDebug("All tests passed.\n"); } + +void RegisterSuite_Genre() +{ + RegisterTest("Genre", "Basic", TestGenre); +} diff --git a/src/twtest/genrespeclist_t.cpp b/src/twtest/genrespeclist_t.cpp index 9109d24..8b446c0 100644 --- a/src/twtest/genrespeclist_t.cpp +++ b/src/twtest/genrespeclist_t.cpp @@ -91,3 +91,12 @@ void TestGenreSpecList() d.TraceDebug("All tests passed.\n"); } + +void RegisterSuite_GenreSpecList() +{ + RegisterTest("GenreSpecList", "Basic", TestGenreSpecList); +} + + + + diff --git a/src/twtest/genreswitcher_t.cpp b/src/twtest/genreswitcher_t.cpp index d378b1e..6fbd8eb 100644 --- a/src/twtest/genreswitcher_t.cpp +++ b/src/twtest/genreswitcher_t.cpp @@ -33,25 +33,36 @@ // genreswitcher_t.h // +#include + #include "fco/stdfco.h" #include "fco/genreswitcher.h" #include "twtest/test.h" #include "fs/fs.h" -void TestGenre() +#include "fs/fsfactory.h" + +void TestGenreSwitcher() { - cDebug d("TestGenre"); + cDebug d("TestGenreSwitcher"); d.TraceDebug("Entering...\n"); - TEST(cGenreSwitcher::GetInstance()->StringToGenre(cGenreSwitcher::GetInstance()->GenreToString(cFS::GenreID())) == cFS::GenreID()); - - //TODO: GenreToString() dies w/ GENRE_INVALID. Figure out if this should be changed. - // - //TEST(cGenreSwitcher::GetInstance()->StringToGenre(cGenreSwitcher::GetInstance()->GenreToString(cGenre::GENRE_INVALID)) == cGenre::GENRE_INVALID); - + cGenreSwitcher* genreSwitcher = cGenreSwitcher::GetInstance(); - TEST(cGenreSwitcher::GetInstance()->StringToGenre(_T("fs")) == cFS::GenreID()); - TEST(cGenreSwitcher::GetInstance()->StringToGenre(_T("none of the above")) == cGenre::GENRE_INVALID); + TEST(genreSwitcher->CurrentGenre() == cFS::GenreID()); + + // can't switch to invalid genre + //genreSwitcher->SelectGenre(cGenre::GENRE_INVALID); + //TEST(genreSwitcher->CurrentGenre() == cGenre::GENRE_INVALID); + + genreSwitcher->SelectGenre(cFS::GenreID()); + TEST(genreSwitcher->CurrentGenre() == cFS::GenreID()); + TEST(typeid(*iTWFactory::GetInstance()) == typeid(cFSFactory)); d.TraceDebug("All tests passed.\n"); } + +void RegisterSuite_GenreSwitcher() +{ + RegisterTest("GenreSwitcher", "Basic", TestGenreSwitcher); +} diff --git a/src/twtest/growheap_t.cpp b/src/twtest/growheap_t.cpp index 8fb6f99..61eecd2 100644 --- a/src/twtest/growheap_t.cpp +++ b/src/twtest/growheap_t.cpp @@ -97,3 +97,7 @@ void TestGrowHeap() TEST( gh.TotalMemUsage() == 0 ); } +void RegisterSuite_GrowHeap() +{ + RegisterTest("GrowHeap", "Basic", TestGrowHeap); +} diff --git a/src/twtest/hashtable_t.cpp b/src/twtest/hashtable_t.cpp index 96ea4d8..67b430e 100644 --- a/src/twtest/hashtable_t.cpp +++ b/src/twtest/hashtable_t.cpp @@ -43,15 +43,6 @@ using namespace std; -void HashTest1(); -void HashTest2(); - -void TestHashTable(void) -{ - HashTest1(); - HashTest2(); -} - void HashTest1() { //Test the Hash table with Key = TSTRING @@ -218,3 +209,9 @@ void HashTest2() d.TraceDebug("PASSED!\n"); } + +void RegisterSuite_HashTable() +{ + RegisterTest("HashTable", "Basic 1", HashTest1); + RegisterTest("HashTable", "Basic 2", HashTest2); +} diff --git a/src/twtest/hierdatabase_t.cpp b/src/twtest/hierdatabase_t.cpp index e18a8cf..4b87202 100644 --- a/src/twtest/hierdatabase_t.cpp +++ b/src/twtest/hierdatabase_t.cpp @@ -206,3 +206,8 @@ void TestHierDatabaseBasic() #endif } +void RegisterSuite_HierDatabase() +{ + RegisterTest("HierDatabase", "Basic", TestHierDatabaseBasic); +} + diff --git a/src/twtest/keyfile_t.cpp b/src/twtest/keyfile_t.cpp index 656dc05..cae960a 100644 --- a/src/twtest/keyfile_t.cpp +++ b/src/twtest/keyfile_t.cpp @@ -134,3 +134,7 @@ void TestKeyFile() return; } +void RegisterSuite_KeyFile() +{ + RegisterTest("KeyFile", "Basic", TestKeyFile); +} diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index 49cae44..b4ed007 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -204,6 +204,7 @@ void TestSizes() { cDebug d("TestSizes"); d.TraceError("Fix this!\n"); + skip("TODO: TestSizes needs work"); /* TEST( CanBeRepresentedAs( char(), char() ) ); TEST( CanBeRepresentedAs( char(), unsigned char() ) ); @@ -234,3 +235,9 @@ bool CanBeRepresentedAs( E e, T t ) return fReturn; } + +void RegisterSuite_Platform() +{ + RegisterTest("Platform", "Alignment", TestAlignment); + RegisterTest("Platform", "Sizes", TestSizes); +} diff --git a/src/twtest/policyparser_t.cpp b/src/twtest/policyparser_t.cpp index 97a6c35..6070e2d 100644 --- a/src/twtest/policyparser_t.cpp +++ b/src/twtest/policyparser_t.cpp @@ -101,6 +101,9 @@ void TestPolicyParser() cDebug d("TestPolicyParser()"); test_policy_file("pol.txt"); + + TCERR << "TestPolicyParser: Parser needs work to be able to test more than one policy" << std::endl; + // test_policy_file("directives.txt"); //fails unless you substitute your hostname for 'your_host' in this file // TODO: test currently segfaults if you create more than one policy parser in a process. (Not a real world scenario). @@ -110,4 +113,7 @@ void TestPolicyParser() test_policy_file("polruleattr.txt"); */ } - +void RegisterSuite_PolicyParser() +{ + RegisterTest("PolicyParser", "Basic", TestPolicyParser); +} diff --git a/src/twtest/refcountobj_t.cpp b/src/twtest/refcountobj_t.cpp index 68468c0..fb870ac 100644 --- a/src/twtest/refcountobj_t.cpp +++ b/src/twtest/refcountobj_t.cpp @@ -33,6 +33,7 @@ #include "core/stdcore.h" #include "core/refcountobj.h" #include "core/debug.h" +#include "test.h" class cRefCountTestObj : public cRefCountObj { @@ -166,3 +167,7 @@ void TestRefCountObj() return; } +void RegisterSuite_RefCountObj() +{ + RegisterTest("RefCountObj", "Basic", TestRefCountObj); +} diff --git a/src/twtest/resources_t.cpp b/src/twtest/resources_t.cpp index 52b37ec..b2533e3 100644 --- a/src/twtest/resources_t.cpp +++ b/src/twtest/resources_t.cpp @@ -95,6 +95,9 @@ void TestResources() } - +void RegisterSuite_Resources() +{ + RegisterTest("Resources", "Basic", TestResources); +} diff --git a/src/twtest/serializer_t.cpp b/src/twtest/serializer_t.cpp index ab4cd21..2244f05 100644 --- a/src/twtest/serializer_t.cpp +++ b/src/twtest/serializer_t.cpp @@ -38,6 +38,7 @@ #include "core/stdcore.h" #include "core/serializer.h" #include "core/serializable.h" +#include "test.h" // The reading and writing functionality of the serializer is tested in // serializerimpl_t.cpp, so there's very little to be done here. @@ -71,3 +72,8 @@ void TestSerializer() { cSerTestObject test_obj; } + +void RegisterSuite_Serializer() +{ + RegisterTest("Serializer", "Basic", TestSerializer); +} diff --git a/src/twtest/serializerimpl_t.cpp b/src/twtest/serializerimpl_t.cpp index cf69777..7762abf 100644 --- a/src/twtest/serializerimpl_t.cpp +++ b/src/twtest/serializerimpl_t.cpp @@ -178,3 +178,7 @@ void TestSerializerImpl() return; } +void RegisterSuite_SerializerImpl() +{ + RegisterTest("SerializerImpl", "Basic", TestSerializerImpl); +} diff --git a/src/twtest/signature_t.cpp b/src/twtest/signature_t.cpp index 55ee530..82b4b7d 100644 --- a/src/twtest/signature_t.cpp +++ b/src/twtest/signature_t.cpp @@ -361,3 +361,7 @@ void TestSignature() return; } +void RegisterSuite_Signature() +{ + RegisterTest("Signature", "Basic", TestSignature); +} diff --git a/src/twtest/srefcountobj_t.cpp b/src/twtest/srefcountobj_t.cpp index e12a486..9f0b118 100644 --- a/src/twtest/srefcountobj_t.cpp +++ b/src/twtest/srefcountobj_t.cpp @@ -144,3 +144,7 @@ void TestSerRefCountObj() return; } +void RegisterSuite_SerRefCountObj() +{ + RegisterTest("SerRefCountObj", "Basic", TestSerRefCountObj); +} diff --git a/src/twtest/stringencoder_t.cpp b/src/twtest/stringencoder_t.cpp index 77fea63..d0b7cf3 100644 --- a/src/twtest/stringencoder_t.cpp +++ b/src/twtest/stringencoder_t.cpp @@ -93,3 +93,7 @@ void OutputString( TSTRING& str ) TEST( str == qe.Unencode(qe.Encode(str)) ); } +void RegisterSuite_StringEncoder() +{ + RegisterTest("StringEncoder", "Basic", TestStringEncoder); +} diff --git a/src/twtest/stringutil_t.h b/src/twtest/stringutil_t.h index 4ed2875..70117f0 100644 --- a/src/twtest/stringutil_t.h +++ b/src/twtest/stringutil_t.h @@ -172,3 +172,8 @@ void TestStringUtil() #endif//__STRINGUTIL_T_H + +void RegisterSuite_StringUtil() +{ + RegisterTest("StringUtil", "Basic", TestStringUtil); +} diff --git a/src/twtest/tasktimer_t.cpp b/src/twtest/tasktimer_t.cpp index c501261..383021b 100644 --- a/src/twtest/tasktimer_t.cpp +++ b/src/twtest/tasktimer_t.cpp @@ -31,11 +31,17 @@ // // tasktimer_t -- test driver for cTaskTimer #include "core/stdcore.h" +#include "test.h" void TestTaskTimer() { cDebug d("TestTaskTimer"); d.TraceError("Implement this!\n"); + skip("TestTaskTimer unimplemented"); } +void RegisterSuite_TaskTimer() +{ + RegisterTest("TaskTimer", "Basic", TestTaskTimer); +} diff --git a/src/twtest/tchar_t.cpp b/src/twtest/tchar_t.cpp index 9bcc5d0..702bd79 100644 --- a/src/twtest/tchar_t.cpp +++ b/src/twtest/tchar_t.cpp @@ -133,3 +133,8 @@ void test_wist(const TSTRING& input, cDebug& d) d.TraceDetail("%s \n", parse.c_str() ); } +void RegisterSuite_TCHAR() +{ + RegisterTest("TCHAR", "Basic", TestTCHAR); +} + diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index fd6b2b9..69cca93 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -64,197 +64,142 @@ #include #include -// the test routines -void TestFCOName(); -void TestFCOTest(); -void TestFCOSetImpl(); -void TestFCOSpec(); -void TestFCOPropVector(); -void TestFileHeader(); -void TestFile(); -void TestFSPropSet(); -void TestFCOSpecImpl(); -void TestFSObject(); -void TestFSPropCalc(); -void TestFCOPropImpl(); -void TestFCOCompare(); -//void TestTripwire(); -void TestWin32FSServices(); -void TestFCOSpecList(); -void TestFCOReport(); -void TestArchive(); -void TestSerializer(); -void TestSerializerImpl(); -void TestRefCountObj(); -void TestSignature(); -void TestSerRefCountObj(); -void TestUnixFSServices(); -void TestError(); -void TestDebug(); -void TestFcoSpecUtil(); -void TestTypes(); -void TestTCHAR(); -void TestErrorBucketImpl(); -void TestHashTable(); -void TestTextReportViewer(); -void TestFCONameTbl(); -void TestConfigFile(); -void TestResources(); -void TestGetSymLinkStr(); -void TestPolicyParser(); - -void TestFCOSpecHelper(); -void TestCrypto(); -void TestCryptoArchive(); -void TestFCOSpecAttr(); -void TestCmdLineParser(); -void TestTaskTimer(); -void TestKeyFile(); -void TestTWUtil(); -void TestFSPropDisplayer(); -void TestFSPropDisplayer(); -void TestGenre(); -void TestFSDataSourceIter(); -void TestGenerateDb(); -void TestHierDatabaseBasic(); -void TestGenreSwitcher(); -void TestDbDataSourceBasic(); -void TestGenreSpecList(); -void TestIntegrityCheck(); -void TestFCODatabaseFile(); -void TestWchar16(); -void TestStringEncoder(); - -void TestGrowHeap(); -void TestPlatform(); -void TestBlockFile(); -void TestBlockRecordArray(); -void TestTWLocale(); -void TestFileUtil(); -void TestFCONameTranslator(); -void TestCodeConverter(); - -void TestCharToHex(); -void TestHexToChar(); -void TestStringToHex(); -void TestHexToString(); -//void TestUnconvertable(); -//void TestUnprintable(); -void TestQuoteAndBackSlash(); -void TestDisplayEncoderBasic(); -void TestCharUtilBasic(); -void TestConfigFile2(); -void TestUserNotifyStdout(); +// Known test suites +void RegisterSuite_Archive(); +void RegisterSuite_BlockFile(); +void RegisterSuite_BlockRecordArray(); +void RegisterSuite_CharUtil(); +void RegisterSuite_CmdLineParser(); +void RegisterSuite_CodeConvert(); +void RegisterSuite_ConfigFile(); +void RegisterSuite_CryptoArchive(); +void RegisterSuite_Crypto(); +void RegisterSuite_DbDataSource(); +void RegisterSuite_Debug(); +void RegisterSuite_DisplayEncoder(); +void RegisterSuite_Error(); +void RegisterSuite_ErrorBucketImpl(); +void RegisterSuite_FCOCompare(); +void RegisterSuite_FCODatabaseFile(); +void RegisterSuite_FCOName(); +void RegisterSuite_FCONameTbl(); +void RegisterSuite_FCONameTranslator(); +void RegisterSuite_FCOPropImpl(); +void RegisterSuite_FCOPropVector(); +void RegisterSuite_FCOReport(); +void RegisterSuite_FCOSetImpl(); +void RegisterSuite_FCOSpec(); +void RegisterSuite_FCOSpecAttr(); +void RegisterSuite_FCOSpecHelper(); +void RegisterSuite_FCOSpecList(); +void RegisterSuite_FcoSpecUtil(); +void RegisterSuite_File(); +void RegisterSuite_FileHeader(); +void RegisterSuite_FileUtil(); +void RegisterSuite_FSDataSourceIter(); +void RegisterSuite_FSObject(); +void RegisterSuite_FSPropCalc(); +void RegisterSuite_FSPropDisplayer(); +void RegisterSuite_FSPropSet(); +void RegisterSuite_FCOSpecImpl(); +void RegisterSuite_GenreSwitcher(); +void RegisterSuite_GenreSpecList(); +void RegisterSuite_Error(); +void RegisterSuite_GrowHeap(); +void RegisterSuite_HashTable(); +void RegisterSuite_HierDatabase(); +void RegisterSuite_KeyFile(); +void RegisterSuite_Platform(); +void RegisterSuite_PolicyParser(); +void RegisterSuite_RefCountObj(); +void RegisterSuite_Resources(); +void RegisterSuite_Serializer(); +void RegisterSuite_SerializerImpl(); +void RegisterSuite_Signature(); +void RegisterSuite_SerRefCountObj(); +void RegisterSuite_StringEncoder(); +void RegisterSuite_StringUtil(); +void RegisterSuite_TaskTimer(); +void RegisterSuite_TCHAR(); +void RegisterSuite_TextReportViewer(); +void RegisterSuite_TWLocale(); +void RegisterSuite_TWUtil(); +void RegisterSuite_Types(); +void RegisterSuite_UnixFSServices(); +void RegisterSuite_UserNotifyStdout(); +void RegisterSuite_Wchar16(); /// This is easier than all the (cpp) files and declarations #include "stringutil_t.h" void Usage() { - TCERR << _T("Usage: test {all | testid [testid ...]}\n") + TCERR << _T("Usage: test {all | list | testid [testid ...]}\n") _T("\n") - _T("Ex: test 1 2 3 12\n") - _T("(runs test id's 1, 2, 3, and 12)\n\n"); + _T("Ex: test foo bar/baz\n") + _T("(runs suite foo and test bar/baz)\n\n"); } -const int MAX_TEST_ID = 88; - static int ran_count = 0; static int failed_count = 0; +static int skipped_count = 0; +static int macro_count = 0; + static std::vector error_strings; +static std::vector skipped_strings; -static void Test(int testID) +class skip_exception : public std::runtime_error { - TCERR << std::endl << "=== Running test ID #" << testID << " ===" << std::endl; - - bool ran = true; +public: + skip_exception(const std::string& reason) : std::runtime_error(reason) {} +}; - try { - - switch (testID) +void skip(const std::string& reason) +{ + throw skip_exception(reason); +} + +void CountMacro() +{ + macro_count++; + TCERR << "*** Incrementing macro count, value is now" << macro_count << std::endl;; +} + +///////////////////////// + +static TestMap tests; + +void RegisterTest(const std::string& suite, const std::string testName, TestPtr testPtr ) +{ + tests[suite][testName] = testPtr; +} + + +static void RunTest(const std::string& suiteName, const std::string& testName, TestPtr testPtr) +{ + try + { + if (testPtr) { - case 1: TestArchive(); break; - case 2: TestCmdLineParser(); break; - case 3: TestCrypto(); break; - case 4: TestCryptoArchive(); break; - case 5: TestDebug(); break; - case 6: TestError(); break; - case 7: TestErrorBucketImpl(); break; - case 8: TestFCOCompare(); break; - case 9: TestUserNotifyStdout(); break; - - case 12: TestFCOName(); break; - case 13: TestFCONameTbl(); break; - case 14: TestFCOPropVector(); break; - case 15: TestFCOPropImpl(); break; - case 16: TestFCOReport(); break; - case 17: TestGetSymLinkStr(); break; - case 18: TestFCOSetImpl(); break; - case 19: TestFCOSpec(); break; - case 20: TestFCOSpecAttr(); break; - case 21: TestFCOSpecHelper(); break; - case 22: TestFCOSpecList(); break; - case 23: TestFcoSpecUtil(); break; - case 24: TestFileHeader(); break; - case 25: TestFile(); break; - case 26: TestFSPropSet(); break; - case 27: TestFSPropCalc(); break; - case 28: TestFCOSpecImpl(); break; - case 29: TestFSObject(); break; - case 30: TestSerializer(); break; - case 31: TestRefCountObj(); break; - case 32: TestSerializerImpl(); break; - case 33: TestResources(); break; - case 34: TestSignature(); break; - case 35: TestTaskTimer(); break; - //case 36: TestTripwire(); break; - case 37: TestTextReportViewer(); break; - case 39: TestSerRefCountObj(); break; - case 40: TestError(); break; - case 41: TestFCODatabaseFile(); break; - case 42: TestHashTable(); break; - case 43: TestTCHAR(); break; - case 44: TestTypes(); break; - case 45: TestUnixFSServices(); break; - case 46: TestConfigFile(); break; - case 47: TestPolicyParser(); break; - case 48: TestKeyFile(); break; - case 49: TestTWUtil(); break; - case 50: TestFSPropDisplayer(); break; - case 52: TestGenre(); break; - case 53: TestFSDataSourceIter(); break; - //case 54: TestGenerateDb(); break; - case 55: TestHierDatabaseBasic(); break; - case 56: TestGenreSwitcher(); break; - case 57: TestDbDataSourceBasic(); break; - case 58: TestGenreSpecList(); break; - //case 59: TestIntegrityCheck(); break; - - case 65: TestWchar16(); break; - case 66: TestStringEncoder(); break; - - case 69: TestGrowHeap(); break; - case 70: TestPlatform(); break; - case 71: TestBlockFile(); break; - case 72: TestBlockRecordArray(); break; - case 74: TestFileUtil(); break; - case 75: TestTWLocale(); break; - case 76: TestFCONameTranslator(); break; - case 77: TestStringUtil(); break; - case 78: TestCodeConverter(); break; - - case 79: TestCharToHex(); break; - case 80: TestHexToChar(); break; - case 81: TestStringToHex(); break; - case 82: TestHexToString(); break; - // case 83: TestUnconvertable(); break; - // case 84: TestUnprintable(); break; - case 85: TestQuoteAndBackSlash(); break; - case 86: TestDisplayEncoderBasic(); break; - case 87: TestCharUtilBasic(); break; - case 88: TestConfigFile2(); break; - default: ran = false; break; + ran_count++; + int pre_count = macro_count; + testPtr(); + if (macro_count > pre_count) + TCERR << "PASSED" << std::endl; + else + skip("Test did not make any TEST assertions"); } + return; + } + catch (skip_exception& e) + { + TCERR << "SKIPPED: " << e.what() << std::endl; + + std::stringstream sstr; + sstr << "Test " << suiteName << "/" << testName << ": " << e.what(); + skipped_strings.push_back(sstr.str()); + + skipped_count++; } catch (eError& error) { @@ -262,7 +207,7 @@ static void Test(int testID) cTWUtil::PrintErrorMsg(error); std::stringstream sstr; - sstr << "Test " << testID << ": " << error.GetMsg(); + sstr << "Test " << suiteName << "/" << testName << ": " << error.GetMsg(); error_strings.push_back(sstr.str()); failed_count++; @@ -271,7 +216,7 @@ static void Test(int testID) TCERR << "FAILED: " << e.what() << std::endl; std::stringstream sstr; - sstr << "Test " << testID << ": " << e.what(); + sstr << "Test " << suiteName << "/" << testName << ": " << e.what(); error_strings.push_back(sstr.str()); failed_count++; @@ -280,21 +225,134 @@ static void Test(int testID) TCERR << "FAILED: " << std::endl; std::stringstream sstr; - sstr << "Test " << testID << ": "; + sstr << "Test " << suiteName << "/" << testName << ": "; error_strings.push_back(sstr.str()); - - failed_count++; } - - if(ran) +} + + +static void RunTestSuite(const std::string& suiteName, SuiteMap suite) +{ + SuiteMap::const_iterator itr; + for( itr = suite.begin(); itr != suite.end(); ++itr) { - ran_count++; - TCERR << std::endl << "=== test ID #" << testID << " completed ===" << std::endl; + TCERR << "----- Running test: " << suiteName << "/" << itr->first << " -----" << std::endl << std::endl; + RunTest(suiteName, itr->first, itr->second); + TCERR << std::endl << "----- Finished test: " << suiteName << "/" << itr->first << " -----" << std::endl; + } +} + +static void RunAllTests() +{ + TestMap::const_iterator itr; + for( itr = tests.begin(); itr != tests.end(); ++itr) + { + TCERR << std::endl << "===== Starting test suite: " << itr->first << " =====" << std::endl; + RunTestSuite(itr->first, itr->second); + TCERR << "===== Finished test suite: " << itr->first << " =====" << std::endl; + } +} + +static void ListTests() +{ + TestMap::const_iterator itr; + for( itr = tests.begin(); itr != tests.end(); ++itr) + { + std::string suiteName = itr->first; + SuiteMap suite = itr->second; + + TCERR << suiteName << std::endl; + SuiteMap::const_iterator itr; + for( itr = suite.begin(); itr != suite.end(); ++itr) + { + TCERR << " " << suiteName << "/" << itr->first << std::endl; + } + } +} + +static void RunTest(const std::string& to_run) +{ + std::string::size_type pos = to_run.find_first_of("/"); + if(pos == std::string::npos) + { + RunTestSuite(to_run, tests[to_run]); } else - TCERR << std::endl << "=== test ID #" << testID << " currently unused ===" << std::endl; + { + std::string suite = to_run.substr(0, pos); + std::string testName = to_run.substr(pos+1); + RunTest(suite, testName, tests[suite][testName]); + } } +static void RegisterSuites() +{ + RegisterSuite_Archive(); + RegisterSuite_BlockFile(); + RegisterSuite_BlockRecordArray(); + RegisterSuite_CharUtil(); + RegisterSuite_CmdLineParser(); + RegisterSuite_CodeConvert(); + RegisterSuite_ConfigFile(); + RegisterSuite_CryptoArchive(); + RegisterSuite_Crypto(); + RegisterSuite_DbDataSource(); + RegisterSuite_Debug(); + RegisterSuite_DisplayEncoder(); + RegisterSuite_Error(); + RegisterSuite_ErrorBucketImpl(); + RegisterSuite_FCOCompare(); + RegisterSuite_FCODatabaseFile(); + RegisterSuite_FCOName(); + RegisterSuite_FCONameTbl(); + RegisterSuite_FCONameTranslator(); + RegisterSuite_FCOPropImpl(); + RegisterSuite_FCOPropVector(); + RegisterSuite_FCOReport(); + RegisterSuite_FCOSetImpl(); + RegisterSuite_FCOSpec(); + RegisterSuite_FCOSpecAttr(); + RegisterSuite_FCOSpecHelper(); + RegisterSuite_FCOSpecList(); + RegisterSuite_FcoSpecUtil(); + RegisterSuite_File(); + RegisterSuite_FileHeader(); + RegisterSuite_FileUtil(); + RegisterSuite_FSDataSourceIter(); + RegisterSuite_FSObject(); + RegisterSuite_FSPropCalc(); + RegisterSuite_FSPropDisplayer(); + RegisterSuite_FSPropSet(); + RegisterSuite_FCOSpecImpl(); + RegisterSuite_GenreSwitcher(); + RegisterSuite_GenreSpecList(); + RegisterSuite_Error(); + RegisterSuite_GrowHeap(); + RegisterSuite_HashTable(); + RegisterSuite_HierDatabase(); + RegisterSuite_KeyFile(); + RegisterSuite_Platform(); + RegisterSuite_PolicyParser(); + RegisterSuite_RefCountObj(); + RegisterSuite_Resources(); + RegisterSuite_Serializer(); + RegisterSuite_SerializerImpl(); + RegisterSuite_Signature(); + RegisterSuite_SerRefCountObj(); + RegisterSuite_StringEncoder(); + RegisterSuite_StringUtil(); + RegisterSuite_TaskTimer(); + RegisterSuite_TCHAR(); + RegisterSuite_TextReportViewer(); + RegisterSuite_TWLocale(); + RegisterSuite_TWUtil(); + RegisterSuite_Types(); + RegisterSuite_UnixFSServices(); + RegisterSuite_UserNotifyStdout(); + RegisterSuite_Wchar16(); +} + + std::string TwTestDir() { static std::string dir; @@ -358,17 +416,21 @@ void tw_unexpected_handler() int _tmain(int argc, TCHAR** argv) { +#ifdef _DEBUG std::cout << "Test: Init" << std::endl; + std::cout << "Test: Setup" << std::endl; + std::cout << "Test: argc - " << argc << std::endl; + std::cout << "Test: *argv - " << argv[0] << std::endl; +#endif - try + try { - std::cout << "Test: Setup" << std::endl; - std::cout << "Test: argc - " << argc << std::endl; - std::cout << "Test: *argv - " << argv[0] << std::endl; - EXCEPTION_NAMESPACE set_terminate(tw_terminate_handler); EXCEPTION_NAMESPACE set_unexpected(tw_unexpected_handler); + if (argc < 2) + Usage(); + cTWInit twInit; twInit.Init( argv[0] ); @@ -377,20 +439,24 @@ int _tmain(int argc, TCHAR** argv) //cDebug::SetDebugLevel(cDebug::D_NEVER); cDebug::SetDebugLevel(cDebug::D_DETAIL); //cDebug::SetDebugLevel(cDebug::D_DEBUG); - - int i; - if (argc < 2) - Usage(); - else if (_tcsicmp(argv[1], _T("all")) == 0) - // run all the tests - for (i = 1; i <= MAX_TEST_ID; ++i) - Test(i); + RegisterSuites(); + + if (_tcsicmp(argv[1], _T("all")) == 0) + { + RunAllTests(); + } + else if(_tcsicmp(argv[1], _T("list")) == 0) + { + ListTests(); + } else - for (i = 1; i < argc; ++i) - Test(_ttoi(argv[i])); // Note: if atoi returns 0, Test() will handle it fine. - - } + { + for (int i = 1; i < argc; ++i) + RunTest(argv[i]); + } + + } catch (eError& error) { cTWUtil::PrintErrorMsg(error); @@ -404,16 +470,30 @@ int _tmain(int argc, TCHAR** argv) return 1; } - // make sure all the refrence counted objects have been destroyed + // make sure all the reference counted objects have been destroyed // this test always fails because of the static cFCONameTbl //TEST(cRefCountObj::AllRefCountObjDestoryed() == true); - std::cout << std::endl << "Ran " << ran_count << " unit tests with " << failed_count << " failures." << std::endl; + std::cout << std::endl << "Ran " << ran_count << " unit tests with " << failed_count << " failures, " << skipped_count << " skipped." << std::endl; - std::vector::iterator itr; - for (itr = error_strings.begin(); itr != error_strings.end(); ++itr) + if (failed_count) { - std::cout << "\t" << *itr << std::endl; + std::cout << std::endl << "Failures: " << std::endl; + std::vector::iterator itr; + for (itr = error_strings.begin(); itr != error_strings.end(); ++itr) + { + std::cout << "\t" << *itr << std::endl; + } + } + + if (skipped_count) + { + std::cout << std::endl << "Skipped: " << std::endl; + std::vector::iterator itr; + for (itr = skipped_strings.begin(); itr != skipped_strings.end(); ++itr) + { + std::cout << "\t" << *itr << std::endl; + } } std::cout << std::endl; diff --git a/src/twtest/test.h b/src/twtest/test.h index 13c8db9..90351bb 100644 --- a/src/twtest/test.h +++ b/src/twtest/test.h @@ -66,9 +66,13 @@ public: TSS_EndPackage( cTest ) +void CountMacro(); + /////////////////////////////////////////////////////////////////////////////// -// TEST() -- Works like ASSERT() but it also breaks during release mode -#define TEST(exp) if (!(exp)) \ +// TEST() -- throw a std::runtime error if test condition is false. +// +#define TEST(exp) CountMacro(); \ + if (!(exp)) \ { \ std::cerr<<"TEST(" << #exp << ") failure, file " << __FILE__ << " line " << __LINE__ << std::endl; \ throw std::runtime_error(#exp); \ @@ -79,5 +83,14 @@ TSS_EndPackage( cTest ) std::string TwTestDir(); std::string TwTestPath(const std::string& child); +typedef void (*TestPtr)(); +typedef std::map< std::string, TestPtr > SuiteMap; +typedef std::map< std::string, SuiteMap > TestMap; + +void RegisterTest(const std::string& suite, const std::string testName, TestPtr testPtr ); + +void skip(const std::string& reason); + + #endif // __TEST_H diff --git a/src/twtest/textreportviewer_t.cpp b/src/twtest/textreportviewer_t.cpp index c5ed3e7..7616862 100644 --- a/src/twtest/textreportviewer_t.cpp +++ b/src/twtest/textreportviewer_t.cpp @@ -127,7 +127,7 @@ static void TraceReport(const cFCOReport& r, cDebug& d) void TestTextReportViewer() { - TCERR << std::endl << "TestTextReportViewer needs to be cleaned up & fixed, currently disabled" << std::endl; + skip("TestTextReportViewer needs to be cleaned up & fixed, currently disabled"); #if 0 cFCOReport report; @@ -476,3 +476,7 @@ void MakeDir( const TCHAR* const lpszDirName ) //#endif //FIXED_TRV_TEST_SUITE +void RegisterSuite_TextReportViewer() +{ + RegisterTest("TextReportViewer", "Basic", TestTextReportViewer); +} diff --git a/src/twtest/twlocale_t.cpp b/src/twtest/twlocale_t.cpp index 3bb4df0..289ba28 100644 --- a/src/twtest/twlocale_t.cpp +++ b/src/twtest/twlocale_t.cpp @@ -40,6 +40,7 @@ #include "core/stdcore.h" #include "core/debug.h" #include "core/twlocale.h" +#include "test.h" void TestAtoi(); void TestItoa(); @@ -56,6 +57,8 @@ void TestHex(); void TestTWLocale() { + skip("TWLocale tests are ifdef'd out, need to revisit them"); + #ifdef DOESNTWORK TestHex(); TestAtoi(); @@ -225,3 +228,8 @@ void TestHex() } #endif//DOESNTWORK +void RegisterSuite_TWLocale() +{ + RegisterTest("TWLocale", "Basic", TestTWLocale); +} + diff --git a/src/twtest/twutil_t.cpp b/src/twtest/twutil_t.cpp index 1f0a9e1..93e270b 100644 --- a/src/twtest/twutil_t.cpp +++ b/src/twtest/twutil_t.cpp @@ -108,3 +108,8 @@ std::string WideToNarrow( const TSTRING& strWide ) return strWide; } +void RegisterSuite_TWUtil() +{ + RegisterTest("TWUtil", "Basic", TestTWUtil); +} + diff --git a/src/twtest/types_t.cpp b/src/twtest/types_t.cpp index de1d18e..1b4fe67 100644 --- a/src/twtest/types_t.cpp +++ b/src/twtest/types_t.cpp @@ -50,3 +50,8 @@ void TestTypes() TEST(sizeof(float32) == 4); TEST(sizeof(float64) == 8); } + +void RegisterSuite_Types() +{ + RegisterTest("Types", "Basic", TestTypes); +} diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index 2d00329..45acdbb 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -158,7 +158,10 @@ void TestUnixFSServices() TEST( pFSServices->FileDelete( newtestfile ) ); } - +void RegisterSuite_UnixFSServices() +{ + RegisterTest("UnixFSServices", "Basic", TestUnixFSServices); +} diff --git a/src/twtest/usernotifystdout_t.cpp b/src/twtest/usernotifystdout_t.cpp index f81ffb5..29b6846 100644 --- a/src/twtest/usernotifystdout_t.cpp +++ b/src/twtest/usernotifystdout_t.cpp @@ -41,4 +41,10 @@ void TestUserNotifyStdout() { cDebug d("TestUserNotifyStdout"); d.TraceError("Implement this!\n"); + skip("TestUserNotifyStdout unimplemented"); +} + +void RegisterSuite_UserNotifyStdout() +{ + RegisterTest("UserNotifyStdout", "Basic", TestUserNotifyStdout); } diff --git a/src/twtest/wchar16_t.cpp b/src/twtest/wchar16_t.cpp index 83ad7b7..2d3a3c8 100644 --- a/src/twtest/wchar16_t.cpp +++ b/src/twtest/wchar16_t.cpp @@ -124,3 +124,8 @@ void TestWchar16() db.TraceAlways("Done...\n"); } + +void RegisterSuite_Wchar16() +{ + RegisterTest("Wchar16", "Basic", TestWchar16); +} From e453a81c879021cffed6f431eadac6e8f8d304d9 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 4 Sep 2017 01:35:27 -0700 Subject: [PATCH 070/110] Tweak unit tests that didn't invoke TEST() at all; add operator== to cFCOSpecAttr & cFSPropDisplayer for the sake of unit testing. --- src/twtest/configfile_t.cpp | 149 +++++++++++++++++------------- src/twtest/fcospecattr_t.cpp | 2 + src/twtest/fsdatasourceiter_t.cpp | 18 +++- src/twtest/fspropdisplayer_t.cpp | 16 ++-- src/twtest/platform_t.cpp | 8 +- src/twtest/policyparser_t.cpp | 1 + src/twtest/resources_t.cpp | 14 ++- src/twtest/serializer_t.cpp | 3 + src/twtest/stringutil_t.h | 2 + src/twtest/tchar_t.cpp | 17 ++-- src/twtest/test.cpp | 6 +- src/twtest/test.h | 1 + 12 files changed, 141 insertions(+), 96 deletions(-) diff --git a/src/twtest/configfile_t.cpp b/src/twtest/configfile_t.cpp index d62b03e..a2b032f 100644 --- a/src/twtest/configfile_t.cpp +++ b/src/twtest/configfile_t.cpp @@ -47,83 +47,101 @@ using namespace std; +static void assertParse(const std::string& configLineIn, bool expectValid) +{ + static const std::string sMandatory = \ + "\nPOLFILE=foo" \ + "\nDBFILE=foo" \ + "\nREPORTFILE=foo" \ + "\nSITEKEYFILE=foo" \ + "\nLOCALKEYFILE=foo"; + + bool threw = false; + cConfigFile cfg; + + std::string configLine = configLineIn + sMandatory; + + try + { + cfg.ReadString( configLine ); + } + catch( eConfigFileMissReqKey& e) + { + TCERR << "Got a missing key exception, which should not happen" << std::endl; + TEST(false); + } + catch( eConfigFile& e ) + { + e.SetFatality(false); + cTWUtil::PrintErrorMsg( e ); + + threw = true; + } + +#ifdef _DEBUG + TCERR << "LINE [" << configLineIn << "]" << std::endl << "Expected = " << expectValid << std::endl << "Threw = " << threw << std::endl; +#endif + + TEST(expectValid != threw); +} + + void TestConfigFile(void) { - TSTRING asConfigFileText[] = - { - _T("BRIAN=foo"), // 0 fine - _T("BRIAN=foo\nBILL=bar"), // 1 fine - _T("BRIAN=foo\r\nBILL=bar"), // 2 fine - _T("BRIAN=foo\n\n\rBILL=bar\n"),// 3 fine - _T(" WS=foo \n\n\r BILL=bar\n"), // 4 fine - _T(" WS = foo \n\n\r BILL = bar \n"), // 5 fine - _T("FOO=foo\nBAR=$(FOO)"), // 6 fine - _T("FOO=foo\nBAR=$(FO)"), // 7 undefined var - _T("FOO=foo\nBAR=$(FOO"), // 8 no r paren - _T("FOO=foo\nBAR=$(FOO "), // 9 no r paren - _T("BAR=$(FOO\n"), // 10 no r paren - _T(" VAR =foo \nWS = $(VAR)\n"), // 11 fine - _T(""), // 12 fine - _T("\n"), // 13 fine - _T("\r"), // 14 fine - _T("\r\n"), // 15 fine - _T("B=POO\nA"), // 16 no equals - _T(" B=POO \n A \r"), // 17 no equals - _T("B=POO\nB=CRAP"), // 18 redefined var - _T("DATE=CRAP"), // 19 redefine predefine var - _T("B=POO\nDATE=CRAP"), // 20 redefine predefine var - _T("A=1\nB=$(A)\nC=$(B)"), // 21 fine -- checking var sub - _T("A=$(DATE)"), // 22 fine -- checking predef var sub - _T("A=1\nB=$(A)\nC=$(DATE)"), // 23 fine -- checking predef var sub - _T("A=1\n=$(A)\nC=$(DATE)"), // 24 no key - _T("A=$(DATE)-B"), // 25 fine -- check that the '-' shows up - _T("A=$(DATE)-$(DATE)"), // 26 fine -- check that the '-' shows up - }; + // should succeed + assertParse( _T("BRIAN=foo"), true ); // 0 fine + assertParse( _T("BRIAN=foo\nBILL=bar"), true ); // 1 fine + assertParse( _T("BRIAN=foo\r\nBILL=bar"), true ); // 2 fine + assertParse( _T("BRIAN=foo\n\n\rBILL=bar\n"), true ); // 3 fine + assertParse( _T(" WS=foo \n\n\r BILL=bar\n"), true ); // 4 fine + assertParse( _T(" WS = foo \n\n\r BILL = bar \n"), true ); // 5 fine + assertParse( _T("FOO=foo\nBAR=$(FOO)"), true ); // 6 fine - /* - TSTRING sMandatory = \ - _T("\nPOLFILE=foo") \ - _T("\nDBFILE=foo") \ - _T("\nREPORTFILE=foo") \ - _T("\nSITEKEYFILE=foo") \ - _T("\nLOCALKEYFILE=foo"); - */ + // should fail + assertParse( _T("FOO=foo\nBAR=$(FO)"), false ); // 7 undefined var + assertParse( _T("FOO=foo\nBAR=$(FOO"), false ); // 8 no r paren + assertParse( _T("FOO=foo\nBAR=$(FOO "), false ); // 9 no r paren + assertParse( _T("BAR=$(FOO\n"), false ); // 10 no r paren + // should succeed + assertParse( _T(" VAR =foo \nWS = $(VAR)\n"), true ); // 11 fine + assertParse( _T(""), true ); // 12 fine + assertParse( _T("\n"), true ); // 13 fine + assertParse( _T("\r"), true ); // 14 fine + assertParse( _T("\r\n"), true ); // 15 fine - for( TSTRING* at = &asConfigFileText[0]; - at != &asConfigFileText[countof(asConfigFileText)]; - at++ ) - { - cConfigFile cfg; - //*at += sMandatory; + // should fail + assertParse( _T("B=POO\nA"), false ); // 16 no equals + assertParse( _T(" B=POO \n A \r"), false ); // 17 no equals + +/* This next test asserts that you can't change a variable once you've defined it. + However there's no actual code in cConfigFile to check for this, and + OST appears to work fine if you redefine a config variable, so I'm not going + to change the current behavior. Leaving this test in w/ a note for reference. + + assertParse( _T("B=POO\nB=CRAP"), false ); // 18 redefined var +*/ + assertParse( _T("DATE=CRAP"), false ); // 19 redefine predefine var + assertParse( _T("B=POO\nDATE=CRAP"), false ); // 20 redefine predefine var + // should succeed + assertParse( _T("A=1\nB=$(A)\nC=$(B)"), true ); // 21 fine -- checking var sub + assertParse( _T("A=$(DATE)"), true ); // 22 fine -- checking predef var sub + assertParse( _T("A=1\nB=$(A)\nC=$(DATE)"), true ); // 23 fine -- checking predef var sub + + // should fail + assertParse( _T("A=1\n=$(A)\nC=$(DATE)"), false ); // 24 no key + + // should succeed + assertParse( _T("A=$(DATE)-B"), true ); // 25 fine -- check that the '-' shows up + assertParse( _T("A=$(DATE)-$(DATE)"), true ); // 26 fine -- check that the '-' shows up - TCERR << _T("*** line:") << std::endl; - TCERR << *at << std::endl; - TCERR << _T("*** eol:") << std::endl; - try - { - cfg.ReadString( *at ); - } - catch( eConfigFileMissReqKey& ) - { - // ignore.... - } - catch( eConfigFile& e ) - { - int offset = ( at - asConfigFileText ); - int itemSize = sizeof( asConfigFileText[0] ); - int num = offset / itemSize; - TCERR << num << std::endl; - cTWUtil::PrintErrorMsg( e ); - } - } } void TestConfigFile2(void) { cDebug d("Testconfigfile"); d.TraceDetail("Entering...\n"); - iFSServices* pFSServices = iFSServices::GetInstance(); + //iFSServices* pFSServices = iFSServices::GetInstance(); //Define some test values for pairs to be //stored in a test config. module. I'm going to use the @@ -175,7 +193,6 @@ void TestConfigFile2(void) TEST( lookup2 == "test.twd" ); d.TraceDetail("Tests Passed!\n"); -//#endif // NOT_BRIANS_TEST } void RegisterSuite_ConfigFile() diff --git a/src/twtest/fcospecattr_t.cpp b/src/twtest/fcospecattr_t.cpp index 6ffc8fe..d483fe8 100644 --- a/src/twtest/fcospecattr_t.cpp +++ b/src/twtest/fcospecattr_t.cpp @@ -85,6 +85,8 @@ void TestFCOSpecAttr() // trace contents... TraceSpecAttr(pNew, d); + TEST( *pAttr == *pNew ); + pNew->Release(); pAttr->Release(); } diff --git a/src/twtest/fsdatasourceiter_t.cpp b/src/twtest/fsdatasourceiter_t.cpp index 1917128..21608a3 100644 --- a/src/twtest/fsdatasourceiter_t.cpp +++ b/src/twtest/fsdatasourceiter_t.cpp @@ -62,13 +62,12 @@ static void PrintDb( cHierDatabase::iterator iter, cDebug d, bool bFirst = true static void PrintIter( cFSDataSourceIter iter, cDebug& d ) { - // - //debug stuff - // - + int count = 0; + if( ! iter.CanDescend() ) { d.TraceError( "Iterator cannot descend; returning!\n"); + TEST(!"Unexpected !CanDescend at beginning of test"); return; } iter.Descend(); @@ -76,6 +75,7 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d ) for( iter.SeekBegin(); ! iter.Done(); iter.Next() ) { + count++; iFCO* pFCO = iter.CreateFCO(); if( pFCO ) { @@ -85,6 +85,7 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d ) else { d.TraceError( "*** Create of FCO failed!\n"); + fail("CreateFCO() failure"); } if( iter.CanDescend() ) { @@ -92,16 +93,23 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d ) PrintIter(iter, d); } } + + TEST(count > 0); } void TestFSDataSourceIter() { + skip("Fix this test"); + cFSDataSourceIter iter; cDebug d("TestFSDataSourceIter"); + cFCOName base(TwTestDir()); + // go to my temp directory and iterate over everything! - iter.SeekToFCO( cFCOName(_T("/tmp")) ); + iter.SeekToFCO( cFCOName(TwTestDir()) ); + // // print out everything below the iterator // diff --git a/src/twtest/fspropdisplayer_t.cpp b/src/twtest/fspropdisplayer_t.cpp index d1fdf82..e2b5c3d 100644 --- a/src/twtest/fspropdisplayer_t.cpp +++ b/src/twtest/fspropdisplayer_t.cpp @@ -83,11 +83,11 @@ void cTestFSPropDisplayer::Test() pPDNew->Merge( pPD ); - /* + //////////////////////// // write pd cFileArchive outFile; - outFile.OpenReadWrite(_T("c:\\tmp\\tmp.pd")); + outFile.OpenReadWrite( TwTestPath("tmp.pd").c_str() ); cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE); outSer.Init(); @@ -101,16 +101,17 @@ void cTestFSPropDisplayer::Test() //////////////////////// // read pd cFileArchive inFile; - inFile.OpenRead(_T("c:\\tmp\\tmp.pd")); + inFile.OpenRead( TwTestPath("tmp.pd").c_str() ); cSerializerImpl inSer(inFile, cSerializerImpl::S_READ); - cFSPropDisplayer* pPDNew = new cFSPropDisplayer(); + cFSPropDisplayer* pPDRead = new cFSPropDisplayer(); inSer.Init(); - pPDNew->Read( &inSer ); + pPDRead->Read( &inSer ); inSer.Finit(); - */ - + + TEST( *pPD == *pPDRead ); + TSTRING strRet; for( i = 0; i < 26; i++ ) { @@ -129,6 +130,7 @@ void cTestFSPropDisplayer::Test() delete pPD; delete pPDNew; + delete pPDRead; return; } diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index b4ed007..bf63b62 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -119,10 +119,14 @@ AlignMe::AlignMe() TCOUT << _T("Writing...") << std::endl; *pb = I; // access memory for write TCOUT << _T("Write succeeded.") << std::endl; -#endif + TCOUT << _T("Alignment of ") << ALIGN_SIZE << _T(" ") << ( ALIGN_SIZE == 1 ? _T("byte") : _T("bytes") ) << _T(" is OK") << std::endl << _T("=========================================\n"); + + TEST("Aligned"); // The actual test is not bus erroring up above; this just tells the framework we tested something. + +#endif } @@ -173,6 +177,7 @@ void TestAlignment() *pi = *pi; // misaligned access (read and write) TCOUT << _T("Misaligned access OK.") << std::endl; + TEST("Misaligned ok"); //again, the test is not exploding up above // - - - - - - - - - - - - - - - - - - - - - - // make sure our BYTE_ALIGN value is correct -- @@ -198,6 +203,7 @@ void TestAlignment() TCOUT << _T("Aligned access OK. BYTE_ALIGN value of ") << BYTE_ALIGN << _T(" is good.") << std::endl; TCOUT << _T("=========================================\n"); + TEST("BYTE_ALIGN ok"); // yet again, the test is not falling over a couple of lines up. } void TestSizes() diff --git a/src/twtest/policyparser_t.cpp b/src/twtest/policyparser_t.cpp index 6070e2d..828080b 100644 --- a/src/twtest/policyparser_t.cpp +++ b/src/twtest/policyparser_t.cpp @@ -89,6 +89,7 @@ void test_policy_file(const std::string& polfile) errorQ.SetChild( &errorT ); parser.Execute( policy, &errorQ ); + TEST("No exceptions thrown in cPolicyParser::Execute"); TCERR << "Parsed policy test file " << polfile << std::endl; return; diff --git a/src/twtest/resources_t.cpp b/src/twtest/resources_t.cpp index b2533e3..9a35abb 100644 --- a/src/twtest/resources_t.cpp +++ b/src/twtest/resources_t.cpp @@ -84,15 +84,13 @@ TSS_ImplementPackage( cTestResources ) void TestResources() { TSS_Package( cTestResources ).Count( 20 ); - - TCOUT << _T("Package::Count(") << TSS_Package( cTestResources ).Count() << _T(")\n" ) << std::endl; - TCOUT << TSS_GetString( cTestResources, test::IDS_TEST1 ) << std::endl; - TCOUT << TSS_GetString( cTestResources, test::IDS_TEST2 ) << std::endl; - TCOUT << TSS_GetString( cTestResources, test::IDS_TEST3 ) << std::endl; - TCOUT << TSS_GetString( cTestResources, test::IDS_INVALID ) << std::endl; - - + TEST( TSS_Package( cTestResources ).Count() == 20) ; + TEST( TSS_GetString( cTestResources, test::IDS_TEST1 ) == _T("Test String 1") ); + TEST( TSS_GetString( cTestResources, test::IDS_TEST2 ) == _T("Test String 2") ); + TEST( TSS_GetString( cTestResources, test::IDS_TEST3 ) == _T("Test String 3") ); + TEST( TSS_GetString( cTestResources, test::IDS_INVALID ) == _T("") ); + TEST( TSS_GetString( cTestResources, 42 ) == _T("") ); } void RegisterSuite_Resources() diff --git a/src/twtest/serializer_t.cpp b/src/twtest/serializer_t.cpp index 2244f05..498a2c9 100644 --- a/src/twtest/serializer_t.cpp +++ b/src/twtest/serializer_t.cpp @@ -71,6 +71,9 @@ cSerTestObject::cSerTestObject() void TestSerializer() { cSerTestObject test_obj; + + TEST( std::string(test_obj.GetType().AsString()) == std::string("cSerTestObject") ); + TEST( test_obj.Version() == 1); } void RegisterSuite_Serializer() diff --git a/src/twtest/stringutil_t.h b/src/twtest/stringutil_t.h index 70117f0..1d8494d 100644 --- a/src/twtest/stringutil_t.h +++ b/src/twtest/stringutil_t.h @@ -167,6 +167,8 @@ void TestStringUtil() TEST(tStr.length() == 9); db.TraceAlways("Done...\n"); +#else + skip("Implement this for non-DBS, i.e. most everywhere."); #endif // USING_NTDBS_STUFF } diff --git a/src/twtest/tchar_t.cpp b/src/twtest/tchar_t.cpp index 702bd79..fa48662 100644 --- a/src/twtest/tchar_t.cpp +++ b/src/twtest/tchar_t.cpp @@ -46,13 +46,15 @@ void test_wist(const TSTRING&, cDebug& d); void TestTCHAR() { + TCERR << "TODO: Right now this test mostly verifies that STL string & file classes work, which is not overly useful." << std::endl; + cDebug d("TestTCHAR()"); d.TraceDetail("Entering...\n"); //Testing TCOUT: TCOUT<< _T("Simple test of TSTRING (and TCOUT) :\n\n"); - TCERR<< _T("This should show up on cerr"); + TCERR<< _T("This should show up on cerr") << std::endl; TSTRING pString; pString = _T("Hi Mom!"); @@ -82,7 +84,7 @@ void TestTCHAR() //A true statement! d.TraceDetail("Testing TISTRINGSTREAM with TSTRING:\n"); - TSTRING send = _T("These should appear on seperate lines"); + TSTRING send = _T("These should appear on separate lines"); test_wist(send, d); //Did they? @@ -100,19 +102,18 @@ void TestTCHAR() TIFSTREAM from; from.open(inputfile.c_str(), std::ios_base::in); - if(!from) - d.TraceDetail("error opening input file\n"); + TEST(from); + TOFSTREAM to(outputfile.c_str(), std::ios_base::trunc); - if(!to) - d.TraceDetail("error opening output file\n"); + TEST(to); //Copy contents of input file to output file. TCHAR ch; while(from.get(ch)) to.put(ch); - if(!from.eof() || !to) - d.TraceDetail("something has gone terribly wrong...\n"); + + TEST(from.eof() && to); return; } diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index 69cca93..ff84c76 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -159,10 +159,14 @@ void skip(const std::string& reason) throw skip_exception(reason); } +void fail(const std::string& reason) +{ + throw std::runtime_error(reason); +} + void CountMacro() { macro_count++; - TCERR << "*** Incrementing macro count, value is now" << macro_count << std::endl;; } ///////////////////////// diff --git a/src/twtest/test.h b/src/twtest/test.h index 90351bb..db1d32d 100644 --- a/src/twtest/test.h +++ b/src/twtest/test.h @@ -90,6 +90,7 @@ typedef std::map< std::string, SuiteMap > TestMap; void RegisterTest(const std::string& suite, const std::string testName, TestPtr testPtr ); void skip(const std::string& reason); +void fail(const std::string& reason); #endif // __TEST_H From 25ddcc0ca61d8d75d6719e00aafead105af8cc3f Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 4 Sep 2017 11:47:35 -0700 Subject: [PATCH 071/110] Break some big unit tests into smaller ones --- src/fco/fcospecattr.cpp | 6 ++ src/fco/fcospecattr.h | 2 + src/fs/fspropdisplayer.cpp | 7 +- src/fs/fspropdisplayer.h | 3 + src/twtest/archive_t.cpp | 78 ++++++++++++------ src/twtest/fcopropimpl_t.cpp | 17 ++-- src/twtest/signature_t.cpp | 127 ++++++++++++++++++++++------- src/twtest/unixfsservices_t.cpp | 138 +++++++++++++++++++++----------- 8 files changed, 269 insertions(+), 109 deletions(-) diff --git a/src/fco/fcospecattr.cpp b/src/fco/fcospecattr.cpp index 8f7cbd9..9394c80 100644 --- a/src/fco/fcospecattr.cpp +++ b/src/fco/fcospecattr.cpp @@ -92,4 +92,10 @@ void cFCOSpecAttr::TraceContents(int dl) const } } +bool cFCOSpecAttr::operator==(const cFCOSpecAttr& rhs) const +{ + return ( (mEmailAddrs == rhs.mEmailAddrs) + && (mName == rhs.mName) + && (mSeverity == rhs.mSeverity)); +} diff --git a/src/fco/fcospecattr.h b/src/fco/fcospecattr.h index 1924bf8..746e9dc 100644 --- a/src/fco/fcospecattr.h +++ b/src/fco/fcospecattr.h @@ -76,6 +76,8 @@ public: void TraceContents(int dl = -1) const; + bool operator==(const cFCOSpecAttr& rhs) const; + DECLARE_SERREFCOUNT() private: cFCOSpecAttr (const cFCOSpecAttr& rhs); // not impl diff --git a/src/fs/fspropdisplayer.cpp b/src/fs/fspropdisplayer.cpp index 375cf67..28e733f 100644 --- a/src/fs/fspropdisplayer.cpp +++ b/src/fs/fspropdisplayer.cpp @@ -509,4 +509,9 @@ bool cFSPropDisplayer::AddGroupnameMapping( const int64& i64gid, const TSTRING& return( ret.second = false ); // returns true if key didn't exist before } - +bool cFSPropDisplayer::operator==(const cFSPropDisplayer& rhs) const +{ + return (mpvPropsWeDisplay == rhs.mpvPropsWeDisplay + && uidToUsername == rhs.uidToUsername + && gidToGroupname == rhs.gidToGroupname); +} diff --git a/src/fs/fspropdisplayer.h b/src/fs/fspropdisplayer.h index 91164b6..780bfe4 100644 --- a/src/fs/fspropdisplayer.h +++ b/src/fs/fspropdisplayer.h @@ -114,6 +114,9 @@ public: virtual bool GetLazy() const; virtual void Read (iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) + + bool operator==(const cFSPropDisplayer& rhs) const; // for testing + private: void AddMapping( const iFCOProp* const pProp, const TSTRING& tstrValue, const int propTypeEnum ); // pass in a property value and its string representation. for instance: ( FS::PROP_UID --> username ) diff --git a/src/twtest/archive_t.cpp b/src/twtest/archive_t.cpp index 3db5e8a..cf6410f 100644 --- a/src/twtest/archive_t.cpp +++ b/src/twtest/archive_t.cpp @@ -42,7 +42,7 @@ TSS_EXCEPTION(eTestArchiveError, eError); -void TestArchive() +void TestMemoryArchive() { // cMemoryArchive cMemoryArchive memarch; @@ -52,7 +52,7 @@ void TestArchive() memarch.WriteInt32(3); memarch.WriteInt32(4); - TSTRING s = _T("Weenus"); + TSTRING s = _T("Iridogorgia"); memarch.WriteString(s); memarch.WriteInt64(1234567L); @@ -74,7 +74,7 @@ void TestArchive() TSTRING s2; memarch.ReadString(s2); - TEST(s2.compare(_T("Weenus")) == 0); + TEST(s2.compare(_T("Iridogorgia")) == 0); memarch.ReadInt64(l); TEST(l == 1234567L); @@ -101,37 +101,61 @@ void TestArchive() TEST(memarch.GetMappedOffset() == 4 * sizeof(int32) + sizeof(int32) + 6); TEST(memarch.GetMappedLength() == sizeof(int64)); // TEST(tw_ntohll(*(int64*)memarch.GetMap()) == 1234567L); +} +void TestLockedTemporaryArchive() +{ + TSTRING s = _T("Metallogorgia"); + bool threw = false; // cLockedTemporaryFileArchive TSTRING lockedFileName = TwTestPath("inaccessable_file.bin"); -// lockedFileName += _T("/inaccessable_file.bin"); cLockedTemporaryFileArchive lockedArch; - // try to create an archive using a temp file - lockedArch.OpenReadWrite(); - lockedArch.Close(); + try + { + // try to create an archive using a temp file + lockedArch.OpenReadWrite(); + lockedArch.Close(); + } + catch (...) + { + threw = true; + } - // this should open and lock the file -- shouldn't be able to access it - lockedArch.OpenReadWrite(lockedFileName.c_str()); - lockedArch.Seek(0, cBidirArchive::BEGINNING); + try + { + // this should open and lock the file -- shouldn't be able to access it + lockedArch.OpenReadWrite(lockedFileName.c_str()); + lockedArch.Seek(0, cBidirArchive::BEGINNING); - // shouldn't be able to see these changes - lockedArch.WriteInt32(1); - lockedArch.WriteInt32(2); - lockedArch.WriteInt32(3); - lockedArch.WriteInt32(4); - lockedArch.WriteString(s); - lockedArch.WriteInt64(1234567L); - lockedArch.WriteInt16(42); + // shouldn't be able to see these changes + lockedArch.WriteInt32(1); + lockedArch.WriteInt32(2); + lockedArch.WriteInt32(3); + lockedArch.WriteInt32(4); + lockedArch.WriteString(s); + lockedArch.WriteInt64(1234567L); + lockedArch.WriteInt16(42); - // this should delete the file - lockedArch.Close(); + // this should delete the file + lockedArch.Close(); + } + catch (...) + { + threw = true; + } - // cFileArchive + TEST(!threw); +} + +void TestFileArchive() +{ + bool threw = false; + TSTRING s = _T("Acanthogorgia"); + // cFileArchive TSTRING fileName = TwTestPath("archive_test.bin"); - //fileName += _T("/archive_test.bin"); cFileArchive filearch; filearch.OpenReadWrite(fileName.c_str()); @@ -163,7 +187,7 @@ void TestArchive() TSTRING s3; filearch.ReadString(s3); - TEST(s3.compare(_T("Weenus")) == 0); + TEST(s3.compare(_T("Acanthogorgia")) == 0); filearch.ReadInt64(k); TEST(k == 1234567L); @@ -181,12 +205,16 @@ void TestArchive() } catch (eError& e) { - TEST(false); + threw=true; (void)e; } + + TEST(!threw); } void RegisterSuite_Archive() { - RegisterTest("Archive", "Basic", TestArchive); + RegisterTest("Archive", "MemoryArchive", TestMemoryArchive); + RegisterTest("Archive", "LockedTemporaryArchive)", TestLockedTemporaryArchive); + RegisterTest("Archive", "FileArchive", TestFileArchive); } diff --git a/src/twtest/fcopropimpl_t.cpp b/src/twtest/fcopropimpl_t.cpp index 492a36f..18b472d 100644 --- a/src/twtest/fcopropimpl_t.cpp +++ b/src/twtest/fcopropimpl_t.cpp @@ -35,9 +35,9 @@ #include "core/debug.h" #include "twtest/test.h" -void TestFCOPropImpl() +void TestNumeric() { - cDebug d("TestFCOPropImpl"); + cDebug d("TestNumeric"); d.TraceDebug("Entering...\n"); // print the enum key: @@ -69,12 +69,18 @@ void TestFCOPropImpl() d.TraceDebug("333ui64 == 456ui64 = %d\n", pui64.Compare(&pui64b, iFCOProp::OP_EQ)); TEST( iFCOProp::CMP_FALSE == p2i64.Compare(&pi64, iFCOProp::OP_EQ)); - +} + +void TestStrings() +{ + cDebug d("TestStrings"); cFCOPropTSTRING pt1; cFCOPropTSTRING pt2; pt1.SetValue(TSTRING(_T("bar"))); pt2.SetValue(TSTRING(_T("foo"))); - + cFCOPropInt64 pi64; + pi64.SetValue(8675309); + d.TraceDebug(_T("property TSTRING = (should be \"bar\") %s\n"), pt1.AsString().c_str()); TEST(pt1.AsString() == "bar"); @@ -96,5 +102,6 @@ void TestFCOPropImpl() void RegisterSuite_FCOPropImpl() { - RegisterTest("FCOPropImpl", "Basic", TestFCOPropImpl); + RegisterTest("FCOPropImpl", "Numeric", TestNumeric); + RegisterTest("FCOPropImpl", "Strings", TestStrings); } diff --git a/src/twtest/signature_t.cpp b/src/twtest/signature_t.cpp index 82b4b7d..30e54f6 100644 --- a/src/twtest/signature_t.cpp +++ b/src/twtest/signature_t.cpp @@ -43,11 +43,38 @@ using namespace std; -void TestSignature() +std::string getTestFile() +{ + // Create a file for which we know the signatures + // + //% siggen ~/signature_test.bin + //crc : AAAAAAAAAAy + //md5 : B/Y8ttBnlyw/NPCUu353ao + //crc32 : B1kP9v + //sha : Oia1aljHD793tfj7M55tND+3OG/ + //haval : BL6bFSo0EP5zf8lGSueeed + + static TSTRING sigFileName; + + if (sigFileName.empty()) + { + sigFileName = TwTestPath("signature_test.bin"); + + cFileArchive fileArc; + fileArc.OpenReadWrite(sigFileName.c_str()); + fileArc.WriteBlob("\x1\x2\x3\x4\x5\x6\x7\x8\x9\x0", 10); + fileArc.Close(); + } + + return sigFileName; +} + + +void TestSignatureBasic() { // Signature usage example (?) cCRC32Signature crcSig; - cDebug d("TestSignature"); + cDebug d("TestSignature1"); byte abData[ 64 ]; int i; @@ -58,7 +85,6 @@ void TestSignature() crcSig.Update( &abData[0], 32 ); crcSig.Update( &abData[32], 32 ); crcSig.Finit(); - TCOUT << _T("new way: ") << crcSig.AsString() << endl; cMemoryArchive arch; arch.WriteBlob( &abData[0], 32 ); @@ -69,32 +95,19 @@ void TestSignature() asg.AddSig( &crc ); asg.CalculateSignatures( arch ); - TCOUT << _T("old way: ") << crc.AsString() << endl; - + TEST( crc.AsStringHex() == crcSig.AsStringHex()); +} // Note: The following causes an ASSERT() in iSignature::Compare(), as it should, but // we don't want asserts to occur in a working test suite! // TEST(nullSig.Compare(&checksumSig, iFCOProp::OP_EQ) == iFCOProp::CMP_WRONG_PROP_TYPE); - - // Create a file for which we know the signatures - // - //% siggen ~/signature_test.bin - //crc : AAAAAAAAAAy - //md5 : B/Y8ttBnlyw/NPCUu353ao - //crc32 : B1kP9v - //sha : Oia1aljHD793tfj7M55tND+3OG/ - //haval : BL6bFSo0EP5zf8lGSueeed - - TSTRING sigFileName = TwTestPath("signature_test.bin"); - +void TestChecksum() +{ + TSTRING sigFileName = getTestFile(); cFileArchive fileArc; - fileArc.OpenReadWrite(sigFileName.c_str()); - fileArc.WriteBlob("\x1\x2\x3\x4\x5\x6\x7\x8\x9\x0", 10); - fileArc.Close(); - - + cDebug d("TestChecksum"); // test begins here // general signature & archive variables @@ -145,8 +158,19 @@ void TestSignature() check2.Read(&readSer); TEST(check1.Compare(&check2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); } +} + +void TestCRC32() +{ + TSTRING sigFileName = getTestFile(); + cFileArchive fileArc; + cDebug d("TestCRC32"); + + // general signature & archive variables + byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; + const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; + int cbRead; - // test CRC32 cCRC32Signature crc1, crc2; d.TraceDetail("Testing CRC32.\n"); @@ -190,7 +214,18 @@ void TestSignature() crc2.Read(&readSer); TEST(crc1.Compare(&crc2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); } +} +void TestMD5() +{ + TSTRING sigFileName = getTestFile(); + cFileArchive fileArc; + cDebug d("TestMD5"); + + // general signature & archive variables + byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; + const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; + int cbRead; // test MD5 cMD5Signature md51, md52; @@ -235,7 +270,18 @@ void TestSignature() md52.Read(&readSer); TEST(md51.Compare(&md52, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); } +} +void TestSHA1() +{ + TSTRING sigFileName = getTestFile(); + cFileArchive fileArc; + cDebug d("TestSHA1"); + + // general signature & archive variables + byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; + const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; + int cbRead; // test SHA cSHASignature sha1, sha2; @@ -280,8 +326,19 @@ void TestSignature() sha2.Read(&readSer); TEST(sha1.Compare(&sha2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); } +} + +void TestHAVAL() +{ + TSTRING sigFileName = getTestFile(); + cFileArchive fileArc; + cDebug d("TestHAVAL"); + + // general signature & archive variables + byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; + const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; + int cbRead; - // test HAVAL cHAVALSignature haval1, haval2; d.TraceDetail("Testing HAVAL.\n"); @@ -322,10 +379,16 @@ void TestSignature() haval1.Write(&writeSer); sigArchive.Seek(0, cBidirArchive::BEGINNING); cSerializerImpl readSer(sigArchive, cSerializerImpl::S_READ); - md52.Read(&readSer); + haval2.Read(&readSer); TEST(haval1.Compare(&haval2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); } - +} + +void TestArchiveSigGen() +{ + TSTRING sigFileName = getTestFile(); + cFileArchive fileArc; + cDebug d("TestArchiveSigGen"); // test cArchiveSigGen cArchiveSigGen asgtest; @@ -356,12 +419,16 @@ void TestSignature() TEST(haval3.AsString().compare(_T("BL6bFSo0EP5zf8lGSueeed")) == 0); TEST(haval3.AsStringHex().compare(_T("4be9b152a3410fe737fc9464ae79e79d")) == 0); - fileArc.Close(); - - return; + fileArc.Close(); } void RegisterSuite_Signature() { - RegisterTest("Signature", "Basic", TestSignature); + RegisterTest("Signature", "Basic", TestSignatureBasic); + RegisterTest("Signature", "Checksum", TestChecksum); + RegisterTest("Signature", "CRC32", TestCRC32); + RegisterTest("Signature", "MD5", TestMD5); + RegisterTest("Signature", "SHA1", TestSHA1); + RegisterTest("Signature", "HAVAL", TestHAVAL); + RegisterTest("Signature", "ArchiveSigGen", TestArchiveSigGen); } diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index 45acdbb..70865fe 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -44,12 +44,24 @@ using namespace std; -//Tests the functions that are currently implemented in win32fsservices. -void TestUnixFSServices() -{ - cDebug d("TestUnixFSServices"); - // d.RemoveOutTarget(cDebug::OUT_STDOUT); +std::string makeTestFile(const std::string &filename) +{ + TSTRING testfile = TwTestPath(filename); + cFileArchive filearch; + filearch.OpenReadWrite(testfile.c_str()); + filearch.Seek(0, cBidirArchive::BEGINNING); + filearch.WriteString(_T("This is a test")); + filearch.Close(); + + return testfile; +} + +//Tests the functions that are currently implemented in win32fsservices. +void TestReadDir() +{ + cDebug d("TestReadDir"); + // d.RemoveOutTarget(cDebug::OUT_STDOUT); iFSServices* pFSServices = iFSServices::GetInstance(); @@ -75,20 +87,20 @@ void TestUnixFSServices() TEST(n == v.size()); } +} +void TestStat() +{ //Test the Stat method cFSStatArgs stat; - //TO DO: use archive to create this file - TSTRING testfile = TwTestPath("tmp.tmp"); - cFileArchive filearch; - filearch.OpenReadWrite(testfile.c_str()); - filearch.Seek(0, cBidirArchive::BEGINNING); - filearch.WriteString(_T("This is a test")); - filearch.Close(); + std::string testfile = makeTestFile("stat.tmp"); - pFSServices->Stat(testfile, stat); + iFSServices::GetInstance()->Stat(testfile, stat); + TEST("Stat() did not throw"); +/* + cDebug d("TestStat"); //print out the information returned by Stat d.TraceDetail("Information returned by Stat: \n"); d.TraceDetail("Group ID : %-5d \n", stat.gid); @@ -102,65 +114,95 @@ void TestUnixFSServices() d.TraceDetail("Major/minor dev if special: %d \n", stat.rdev); d.TraceDetail("File size: %d \n", stat.size); d.TraceDetail("User ID: %d \n", stat.uid); +*/ +} - //Test GetCurrentDir: +void TestGetCurrentDir() +{ TSTRING currpath; - pFSServices->GetCurrentDir(currpath); - d.TraceDetail("GetCurrentDir returned %s\n", currpath.c_str()); + iFSServices::GetInstance()->GetCurrentDir(currpath); + + TEST("GetCurrentDir() did not throw"); + + //d.TraceDetail("GetCurrentDir returned %s\n", currpath.c_str()); //TEST(currpath == _T("~")); //they should both be ~!! +} - //Test MakeTempFilename +void TestMakeTempFilename() +{ TSTRING _template(_T("twtempXXXXXX")); - pFSServices->MakeTempFilename(_template); - d.TraceDetail("Testing MakeTempFilename: \n"); - d.TraceDetail("%s \n", _template.c_str() ); + iFSServices::GetInstance()->MakeTempFilename(_template); - // Test GetMachineName - d.TraceDetail("Testing GetMachineName:\n"); + TEST("MakeTempFilename() did not throw"); +} + +void TestGetMachineName() +{ TSTRING uname; - pFSServices->GetMachineName(uname); - d.TraceDetail("GetMachineName returned: %s\n", uname.c_str()); + iFSServices::GetInstance()->GetMachineName(uname); - // Test GetHostID - d.TraceDetail("Testing GetHostID:\n"); + TEST("GetMachineName() did not throw"); +} + +void TestGetHostID() +{ TSTRING hostid; - pFSServices->GetHostID(hostid); - d.TraceDetail("GetHostID returned: %s\n", hostid.c_str()); + iFSServices::GetInstance()->GetHostID(hostid); - // Test GetCurrentUserName - d.TraceDetail("Testing GetCurrentUserName:\n"); + TEST("GetHostID() did not throw:"); +} + +void TestGetCurrentUserName() +{ TSTRING username; - TEST( pFSServices->GetCurrentUserName(username) ); - d.TraceDetail("GetCurrentUserName returned: %s\n", username.c_str()); + TEST( iFSServices::GetInstance()->GetCurrentUserName(username) ); +} - // Test GetIPAddress - d.TraceDetail("Testing GetIPAddress:\n"); +void TestGetIPAddress() +{ uint32 ipaddr; - TEST( pFSServices->GetIPAddress( ipaddr ) ); - d.TraceDetail("GetIPAddress returned: %d\n", ipaddr); + TEST( iFSServices::GetInstance()->GetIPAddress( ipaddr ) ); +} - // test GetExecutableFilename - d.TraceDetail("Testing GetExecutableFilename: \n"); +void TestGetExecutableFilename() +{ TSTRING filename = _T("sh"); TSTRING fullpath = _T("/bin/"); - TEST(pFSServices->GetExecutableFilename(fullpath, filename)); + TEST( iFSServices::GetInstance()->GetExecutableFilename(fullpath, filename)); + filename = _T("/bin/sh"); - TEST(pFSServices->GetExecutableFilename(fullpath, filename)); + TEST( iFSServices::GetInstance()->GetExecutableFilename(fullpath, filename)); +} - // test Rename - d.TraceDetail("Testing Rename:\n"); - TSTRING newtestfile = TwTestPath("new.tmp"); - TEST( pFSServices->Rename( testfile, newtestfile ) ); +void TestRename() +{ + std::string testfile = makeTestFile("rename_from"); - // test FileDelete - d.TraceDetail("Testing FileDelete:\n"); - TEST( pFSServices->FileDelete( newtestfile ) ); + TSTRING newtestfile = TwTestPath("rename_to"); + TEST( iFSServices::GetInstance()->Rename( testfile, newtestfile ) ); +} + +void TestFileDelete() +{ + std::string to_rm = makeTestFile("to_rm"); + + TEST( iFSServices::GetInstance()->FileDelete( to_rm ) ); } void RegisterSuite_UnixFSServices() { - RegisterTest("UnixFSServices", "Basic", TestUnixFSServices); + RegisterTest("UnixFSServices", "ReadDir", TestReadDir); + RegisterTest("UnixFSServices", "Stat", TestStat); + RegisterTest("UnixFSServices", "GetCurrentDir", TestGetCurrentDir); + RegisterTest("UnixFSServices", "MakeTempFilename", TestMakeTempFilename); + RegisterTest("UnixFSServices", "GetMachineName", TestGetMachineName); + RegisterTest("UnixFSServices", "GetHostID", TestGetHostID); + RegisterTest("UnixFSServices", "GetCurrentUserName", TestGetCurrentUserName); + RegisterTest("UnixFSServices", "GetIPAddress", TestGetIPAddress); + RegisterTest("UnixFSServices", "GetExecutableFilename", TestGetExecutableFilename); + RegisterTest("UnixFSServices", "Rename", TestRename); + RegisterTest("UnixFSServices", "FileDelete", TestFileDelete); } From a47236408c4ef110ca5fb1acdca77af9982b6f60 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 4 Sep 2017 13:31:44 -0700 Subject: [PATCH 072/110] Add tests to check MD5 & SHA1 impls against RFC test cases --- src/twtest/signature_t.cpp | 84 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/twtest/signature_t.cpp b/src/twtest/signature_t.cpp index 30e54f6..13ad64d 100644 --- a/src/twtest/signature_t.cpp +++ b/src/twtest/signature_t.cpp @@ -422,6 +422,88 @@ void TestArchiveSigGen() fileArc.Close(); } +void assertMD5(const std::string& source, const std::string& expectedHex) +{ + // Signature usage example (?) + cMD5Signature md5Sig; + + md5Sig.Init(); + md5Sig.Update( (const byte*)source.c_str(), source.length() ); + md5Sig.Finit(); + + TEST( md5Sig.AsStringHex() == expectedHex); +} + +void assertSHA1(const std::string& source, const std::string& expectedHex) +{ + // Signature usage example (?) + cSHASignature shaSig; + + shaSig.Init(); + shaSig.Update( (const byte*)source.c_str(), source.length() ); + shaSig.Finit(); + + TCERR << "Source = [" << source << "]" << std::endl; + TCERR << "Expected = " << expectedHex << std::endl; + TCERR << "Observed = " << shaSig.AsStringHex() << std::endl; + + TEST( shaSig.AsStringHex() == expectedHex); +} + + +void TestRFC1321() +{ + // All MD5 test cases from RFC 1321, appendix A.5 + // https://www.ietf.org/rfc/rfc1321.txt + + assertMD5("", "d41d8cd98f00b204e9800998ecf8427e"); + assertMD5("a", "0cc175b9c0f1b6a831c399e269772661"); + assertMD5("abc", "900150983cd24fb0d6963f7d28e17f72"); + assertMD5("message digest", "f96b697d7cb7938d525a2f31aaf161d0"); + assertMD5("abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b"); + assertMD5( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "d174ab98d277d9f5a5611c2c9f419d9f"); + assertMD5( + "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "57edf4a22be3c955ac49da2e2107b67a"); +} + +void TestRFC3174() +{ + // SHA1 test cases from RFC 3174, section 7.3 + // https://www.ietf.org/rfc/rfc3174.txt + // plus BSD libmd test cases + // https://opensource.apple.com/source/libmd/libmd-3/Makefile + // + // TODO: Compare against NIST test vectors for extra pedanticity + // http://csrc.nist.gov/groups/STM/cavp/secure-hashing.html + + assertSHA1("abc", "a9993e364706816aba3e25717850c26c9cd0d89d"); + assertSHA1( + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "84983e441c3bd26ebaae4aa1f95129e5e54670f1"); + + assertSHA1("a", "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"); + assertSHA1( + "0123456701234567012345670123456701234567012345670123456701234567", + "e0c094e867ef46c350ef54a7f59dd60bed92ae83"); + + assertSHA1("", "da39a3ee5e6b4b0d3255bfef95601890afd80709"); + assertSHA1("abc", "a9993e364706816aba3e25717850c26c9cd0d89d"); + assertSHA1("message digest", "c12252ceda8be8994d5fa0290a47231c1d16aae3"); + assertSHA1( + "abcdefghijklmnopqrstuvwxyz", + "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"); + assertSHA1( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "761c457bf73b14d27e9e9265c46f4b4dda11f940"); + assertSHA1( + "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "50abf5706a150990a08b2c5ea40fa0e585554732"); +} + + void RegisterSuite_Signature() { RegisterTest("Signature", "Basic", TestSignatureBasic); @@ -431,4 +513,6 @@ void RegisterSuite_Signature() RegisterTest("Signature", "SHA1", TestSHA1); RegisterTest("Signature", "HAVAL", TestHAVAL); RegisterTest("Signature", "ArchiveSigGen", TestArchiveSigGen); + RegisterTest("Signature", "RFC1321", TestRFC1321); + RegisterTest("Signature", "RFC3174", TestRFC3174); } From e74d916a0975e40f6049d0e7b7c55d323eb4f688 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 4 Sep 2017 15:37:07 -0700 Subject: [PATCH 073/110] Rename misspelled crytpo_t.cpp -> crypto_t.cpp --- src/twtest/Makefile.am | 2 +- src/twtest/Makefile.in | 4 ++-- src/twtest/{crytpo_t.cpp => crypto_t.cpp} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename src/twtest/{crytpo_t.cpp => crypto_t.cpp} (100%) diff --git a/src/twtest/Makefile.am b/src/twtest/Makefile.am index 662f936..cedcf10 100644 --- a/src/twtest/Makefile.am +++ b/src/twtest/Makefile.am @@ -19,7 +19,7 @@ cmdlineparser_t.cpp \ codeconvert_t.cpp \ configfile_t.cpp \ cryptoarchive_t.cpp \ -crytpo_t.cpp \ +crypto_t.cpp \ dbdatasource_t.cpp \ debug_t.cpp \ displayencoder_t.cpp \ diff --git a/src/twtest/Makefile.in b/src/twtest/Makefile.in index f3ee9b4..409d2bd 100644 --- a/src/twtest/Makefile.in +++ b/src/twtest/Makefile.in @@ -109,7 +109,7 @@ am_twtest_OBJECTS = archive_t.$(OBJEXT) blockfile_t.$(OBJEXT) \ blockrecordarray_t.$(OBJEXT) charutil_t.$(OBJEXT) \ cmdlineparser_t.$(OBJEXT) codeconvert_t.$(OBJEXT) \ configfile_t.$(OBJEXT) cryptoarchive_t.$(OBJEXT) \ - crytpo_t.$(OBJEXT) dbdatasource_t.$(OBJEXT) debug_t.$(OBJEXT) \ + crypto_t.$(OBJEXT) dbdatasource_t.$(OBJEXT) debug_t.$(OBJEXT) \ displayencoder_t.$(OBJEXT) error_t.$(OBJEXT) \ errorbucketimpl_t.$(OBJEXT) fcocompare_t.$(OBJEXT) \ fcodatabasefile_t.$(OBJEXT) fconame_t.$(OBJEXT) \ @@ -360,7 +360,7 @@ cmdlineparser_t.cpp \ codeconvert_t.cpp \ configfile_t.cpp \ cryptoarchive_t.cpp \ -crytpo_t.cpp \ +crypto_t.cpp \ dbdatasource_t.cpp \ debug_t.cpp \ displayencoder_t.cpp \ diff --git a/src/twtest/crytpo_t.cpp b/src/twtest/crypto_t.cpp similarity index 100% rename from src/twtest/crytpo_t.cpp rename to src/twtest/crypto_t.cpp From 1566771be0c9b8d11f011be6c49258e92401b991 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Mon, 4 Sep 2017 17:24:47 -0700 Subject: [PATCH 074/110] Tweak install.sh slightly so you can optionally run it standalone instead of thru make install, & add a custom install dir param to it. --- installer/install.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/installer/install.sh b/installer/install.sh index 3492ccd..178731c 100755 --- a/installer/install.sh +++ b/installer/install.sh @@ -28,7 +28,7 @@ fi ## The usage message. ##------------------------------------------------------- -USAGE="install.sh [] [-n] [-f] [-s ] [-l ]" +USAGE="install.sh [] [-n] [-f] [-s ] [-l ] [-d ]" ##------------------------------------------------------- ## Figure out how to do an echo without newline. @@ -104,8 +104,10 @@ fi ## Miscellaneous configuration parameters. ##------------------------------------------------------- -# prefix -prefix="${prefix:=/usr}" +# set a few location variables if caller didn't pass them to us +prefix="${prefix:=/usr/local}" +sysconfdir="${sysconfdir:=/usr/local/etc}" +path_to_vi="${path_to_vi:=/usr/bin/vi}" # License File name TWLICENSEFILE="COPYING" @@ -178,6 +180,13 @@ while [ "x$1" != "x" ] ; do exit 1 ;; *) TW_LOCAL_PASS="$2"; shift ;; esac ;; + -d) case "$2" in + "" | -*) + echo "Error: missing install dir with -d option." 1>&2 + echo "$USAGE" + exit 1 ;; + *) prefix="$2"; sysconfdir="$2/bin"; shift ;; + esac ;; -*) echo "Error: unknown argument $1" 1>&2 echo "$USAGE" exit 1 ;; From a56bae53977178e4b3eb7c47f22f2e97be3441e4 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Tue, 5 Sep 2017 19:14:27 -0700 Subject: [PATCH 075/110] Only use /dev/urandom if --enable-urandom configure arg is used, since current impl falls over on HP-UX & Solaris 10 SPARC & possibly elsewhere --- config.h.in | 3 +++ configure | 14 ++++++++++++++ configure.ac | 6 ++++++ src/core/platform.h | 2 ++ src/twcrypto/crypto.cpp | 4 ++-- src/twtest/platform_t.cpp | 2 +- 6 files changed, 28 insertions(+), 3 deletions(-) diff --git a/config.h.in b/config.h.in index 184a9f7..616429f 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,9 @@ /* Compile with debug code */ #undef DEBUG +/* Enable use of /dev/urandom */ +#undef ENABLE_DEV_URANDOM + /* this is the prefix for STL exception functions */ #undef EXCEPTION_NAMESPACE diff --git a/configure b/configure index 5c6690e..f08717a 100755 --- a/configure +++ b/configure @@ -752,6 +752,7 @@ enable_static enable_debug enable_coverage enable_profiling +enable_urandom enable_dependency_tracking enable_commoncrypto enable_iconv @@ -1399,6 +1400,7 @@ Optional Features: --enable-debug compile with debuging enabled --enable-coverage enable code coverage --enable-profiling enable profiling + --enable-urandom use /dev/urandom --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking @@ -3525,6 +3527,18 @@ then LDFLAGS="${LDFLAGS} -pg" fi +# Check whether --enable-urandom was given. +if test "${enable_urandom+set}" = set; then : + enableval=$enable_urandom; +fi + +if test "x$enable_urandom" = xyes +then + +$as_echo "#define ENABLE_DEV_URANDOM 1" >>confdefs.h + +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/configure.ac b/configure.ac index 8b995a8..3cc105e 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,12 @@ then LDFLAGS="${LDFLAGS} -pg" fi +AC_ARG_ENABLE(urandom, [ --enable-urandom use /dev/urandom]) +if test "x$enable_urandom" = xyes +then + AC_DEFINE(ENABLE_DEV_URANDOM, 1, [Enable use of /dev/urandom]) +fi + dnl ################### dnl Checks for programs dnl ################### diff --git a/src/core/platform.h b/src/core/platform.h index 7a5ffcf..56155be 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -320,6 +320,8 @@ // which uses this syntax for UNC paths. So we'll allow leading double slashes there, but // continue removing them on all other platforms +#define USE_DEV_URANDOM (HAVE_DEV_URANDOM && ENABLE_DEV_URANDOM) + //============================================================================= // Miscellaneous // diff --git a/src/twcrypto/crypto.cpp b/src/twcrypto/crypto.cpp index a5efe74..0334555 100644 --- a/src/twcrypto/crypto.cpp +++ b/src/twcrypto/crypto.cpp @@ -1241,7 +1241,7 @@ cHashedKey192::~cHashedKey192() ///////////////////////////////////////////////////////// -#if HAVE_DEV_URANDOM +#if USE_DEV_URANDOM static bool randomize_by_device(const char* device_name, int8* destbuf, int len) { static int rng_device = -1; @@ -1267,7 +1267,7 @@ static bool gRandomizeBytesSeeded = false; void RandomizeBytes(int8* destbuf, int len) { -#if HAVE_DEV_URANDOM +#if USE_DEV_URANDOM if (randomize_by_device("/dev/urandom", destbuf, len)) return; diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index bf63b62..b9b96b0 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -91,7 +91,7 @@ AlignMe::AlignMe() // to have any need for that behavior, which begs the question of why // this test exists in the first place. // -bcox -#if (!IS_HPUX) +#if (!IS_HPUX && !IS_SOLARIS) //Turns out Solaris SPARC is unhappy with this test too, btw TCOUT << _T("Testing alignment of size ") << ALIGN_SIZE << std::endl; // access a double in the byte array to see if it is aligned. if it isn't and the CPU From 03bca0ebd4fb1e6f62ac53a26ebe0793b2b293e6 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 6 Sep 2017 12:25:52 -0700 Subject: [PATCH 076/110] Modify GetSymLinkStr for platforms that return ERANGE when buffer is too small, like HP_UX; tweak field splitting in crc32 test-harness test, for platforms that separate cksum fields with tabs, like Solaris 10 & maybe earlier. --- src/fs/fspropcalc.cpp | 8 ++++++++ src/test-harness/tests/crc32.pm | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index dca9572..9f35e95 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -99,7 +99,15 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s #endif if(rtn == -1) + { + // Some OSes (like HP-UX) return ERANGE if buffer is too small. + // This is nonstandard but better than the usual truncate-and-say-you-succeeded + // + if(ERANGE == errno) + return GetSymLinkStr(strName, arch, size*2); + return false; + } //Sadly if buf isn't big enough readlink 'succeeds' by truncating the string, so the only // clue your buffer might be too small is if you maxed it out. So we try again, within reason. diff --git a/src/test-harness/tests/crc32.pm b/src/test-harness/tests/crc32.pm index c4bf82d..764eccf 100644 --- a/src/test-harness/tests/crc32.pm +++ b/src/test-harness/tests/crc32.pm @@ -34,8 +34,10 @@ sub run() { printf("%-30s", "-- $description"); # lets see if the system 'cksum' agree's with siggen's crc32 value + # Doing split with ' ' instead of / / because some flavors of cksum + # like to separate fields with tabs, as seen on Solaris 10. # - my ($crc32, undef) = split(/ /, `cksum $twtools::twrootdir/test`); + my ($crc32, undef) = split(' ', `cksum $twtools::twrootdir/test`); if ($crc32 eq "") { ++$twtools::twskippedtests; From 078bf28164e594560a09125c9a56d88428442d09 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 7 Sep 2017 01:00:58 -0700 Subject: [PATCH 077/110] A few little tweaks for SkyOS unit tests & configure robustitude (i.e. relying on stdint.h (if present) to tell us which intrinsic type is 64 bits) --- src/core/types.h | 36 +++++++++++++++++++++++---------- src/fs/fspropcalc.cpp | 4 ++++ src/twtest/fspropcalc_t.cpp | 3 ++- src/twtest/unixfsservices_t.cpp | 4 +++- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/core/types.h b/src/core/types.h index bda69c2..644b482 100644 --- a/src/core/types.h +++ b/src/core/types.h @@ -36,35 +36,49 @@ #include "platform.h" +#if HAVE_STDINT_H +#include +#endif + + + //----------------------------------------------------------------------------- // standard TSS types //----------------------------------------------------------------------------- -typedef unsigned char byte ; // platform-independent +typedef unsigned char byte ; // platform-independent typedef signed char int8 ; typedef short int16 ; typedef float float32 ; typedef double float64 ; -typedef unsigned char uint8 ; -typedef unsigned short uint16 ; +typedef unsigned char uint8 ; +typedef unsigned short uint16 ; + +#if HAVE_STDINT_H +typedef int32_t int32 ; +typedef uint32_t uint32 ; + +#elif SIZEOF_INT == 4 +typedef int int32 ; +typedef unsigned int uint32 ; -#if SIZEOF_INT == 4 -typedef int int32 ; -typedef unsigned int uint32 ; #elif SIZEOF_LONG == 4 -typedef long int32 ; -typedef unsigned long uint32 ; +typedef long int32 ; +typedef unsigned long uint32 ; #else # error "I don't seem to have a 32-bit integer type on this system." #endif -#if SIZEOF_LONG == 8 +#if HAVE_STDINT_H +typedef int64_t int64 ; +typedef uint64_t uint64 ; +#elif SIZEOF_LONG == 8 typedef long int64 ; -typedef unsigned long uint64 ; +typedef unsigned long uint64 ; #elif SIZEOF_LONG_LONG == 8 typedef long long int64 ; -typedef unsigned long long uint64 ; +typedef unsigned long long uint64 ; #else # error "I don't seem to have a 64-bit integer type on this system." #endif diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index 9f35e95..9248b78 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -111,7 +111,11 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s //Sadly if buf isn't big enough readlink 'succeeds' by truncating the string, so the only // clue your buffer might be too small is if you maxed it out. So we try again, within reason. +#if IS_SKYOS + if((size_t)rtn >= size-1) //SkyOS wants space to null terminate the string it hands back, which is nice, I guess. +#else if((size_t)rtn == size) +#endif { if(size < 128*TW_PATH_SIZE) return GetSymLinkStr(strName, arch, size*2); diff --git a/src/twtest/fspropcalc_t.cpp b/src/twtest/fspropcalc_t.cpp index 2699b2b..3130f39 100644 --- a/src/twtest/fspropcalc_t.cpp +++ b/src/twtest/fspropcalc_t.cpp @@ -146,9 +146,10 @@ void TestGetSymLinkStr() std::string link = TwTestPath("linky"); int fd = creat(file.c_str(), 0777); + TEST(fd >= 0); close(fd); - symlink(file.c_str(), link.c_str()); + TEST(0 == symlink(file.c_str(), link.c_str())); cMemoryArchive arch(1024*1024); TEST(cFSPropCalc::GetSymLinkStr(link, arch, 8)); diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index 70865fe..b43869f 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -155,8 +155,10 @@ void TestGetHostID() void TestGetCurrentUserName() { +#if !IS_SKYOS // SkyOS breaks on this, for as-yet-unknown reasons TSTRING username; - TEST( iFSServices::GetInstance()->GetCurrentUserName(username) ); + TEST( iFSServices::GetInstance()->GetCurrentUserName(username) ) +#endif } void TestGetIPAddress() From 140ed7c26cd38ed15a0fc97afd0c2e05fb9a3d15 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 7 Sep 2017 20:42:00 -0700 Subject: [PATCH 078/110] Build fix for AROS (wasn't pulling in errno.h in fsprocalc.cpp, which is now needed for ERANGE symlink check) --- src/fs/fspropcalc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index 9248b78..2c3fd65 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -43,7 +43,7 @@ #include "fsobject.h" #include - +#include cFSPropCalc::cFSPropCalc() : mCollAction(iFCOPropCalc::PROP_LEAVE), mCalcFlags(0), mpErrorBucket(0) From 2a3d69e8c9fecf61ab7e481697122f26dda81173 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 8 Sep 2017 11:58:19 -0700 Subject: [PATCH 079/110] Fixes for Cygwin: Use local swab() impl, and tweak policy update test-harness test path handling -- it was prepending a path variable that's always empty, but we were also using absolute paths so we didn't notice elsewhere, though we were using paths of the form //foo/bar/baz. Leading double slashes are significant on Cygwin since they're used to denote UNC paths, so tests failed there & uncovered this problem --- config.h.in | 6 ++++++ configure | 26 +++++++++++++++++++++++++- configure.ac | 4 +++- src/core/platform.h | 2 +- src/test-harness/tests/polupdate.pm | 14 +++++++------- src/twadmin/twadmincl.cpp | 6 +++--- 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/config.h.in b/config.h.in index 616429f..51fa1fc 100644 --- a/config.h.in +++ b/config.h.in @@ -102,6 +102,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `swab' function. */ +#undef HAVE_SWAB + /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H @@ -135,6 +138,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UNISTD_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_USTAT_H diff --git a/configure b/configure index f08717a..c33967d 100755 --- a/configure +++ b/configure @@ -5569,7 +5569,20 @@ fi done -for ac_header in unistd.h syslog.h langinfo.h sys/statfs.h sys/select.h +for ac_header in unistd.h sys/unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in syslog.h langinfo.h sys/statfs.h sys/select.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -6182,6 +6195,17 @@ _ACEOF fi done +for ac_func in swab +do : + ac_fn_c_check_func "$LINENO" "swab" "ac_cv_func_swab" +if test "x$ac_cv_func_swab" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SWAB 1 +_ACEOF + +fi +done + for ac_header in fcntl.h do : diff --git a/configure.ac b/configure.ac index 3cc105e..5d7a0b1 100644 --- a/configure.ac +++ b/configure.ac @@ -99,7 +99,8 @@ AC_CHECK_HEADERS(sys/mount.h,,, #endif ]]) AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h) -AC_CHECK_HEADERS(unistd.h syslog.h langinfo.h sys/statfs.h sys/select.h) +AC_CHECK_HEADERS(unistd.h sys/unistd.h) +AC_CHECK_HEADERS(syslog.h langinfo.h sys/statfs.h sys/select.h) AC_CHECK_HEADERS(signum.h bits/signum.h, break ) AC_CHECK_HEADERS(stdarg.h varargs.h, break ) AC_CHECK_HEADERS(sys/utsname.h memory.h) @@ -143,6 +144,7 @@ dnl Checks for standard functions dnl ############################# AC_CHECK_FUNCS(strftime gethostname gethostid) AC_CHECK_FUNCS(mkstemp mktemp, break) +AC_CHECK_FUNCS(swab) dnl check for posix_fadvise AC_CHECK_HEADERS(fcntl.h, [AC_CHECK_FUNCS(posix_fadvise)]) diff --git a/src/core/platform.h b/src/core/platform.h index 56155be..cfb424f 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -303,7 +303,7 @@ #define SUPPORTS_POSIX_SIGNALS (!IS_DOS_DJGPP) #define SUPPORTS_NETWORKING (!IS_SORTIX && !IS_DOS_DJGPP) #define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS && !IS_RISCOS) -#define NEEDS_SWAB_IMPL (IS_SYLLABLE || IS_ANDROID || IS_SORTIX) +#define NEEDS_SWAB_IMPL (IS_CYGWIN || IS_SYLLABLE || IS_ANDROID || IS_SORTIX) #define USES_MBLEN (!IS_ANDROID && !IS_AROS) #define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP) #define ICONV_CONST_SOURCE (IS_MINIX) diff --git a/src/test-harness/tests/polupdate.pm b/src/test-harness/tests/polupdate.pm index bc4a4d1..a554a1b 100644 --- a/src/test-harness/tests/polupdate.pm +++ b/src/test-harness/tests/polupdate.pm @@ -56,31 +56,31 @@ POLICY_END ###################################################################### # CreateFile -- create a file with the specified contents # -# input: path -- path to the file; relative to $root +# input: path -- *absolute* path to the file # contents -- string to put in the file # sub CreateFile { my ($path, $contents) = @_; - system( "echo $contents > $root/$path" ); + system( "echo $contents > $path" ); - $? && die "Create file failed for $root/$path\n"; + $? && die "Create file failed for $path\n"; } ###################################################################### -# RemoveFile -- removes the named file +# RemoveFile -- removes the named file by absolute path # sub RemoveFile { my ($path) = @_; - if( -e "$root/$path" ) + if( -e $path ) { - system( "rm -f $root/$path" ); + system( "rm -f $path" ); } - $? && die "Remove file failed for $root/$path\n"; + $? && die "Remove file failed for $path\n"; } diff --git a/src/twadmin/twadmincl.cpp b/src/twadmin/twadmincl.cpp index 0c79a26..068d05f 100644 --- a/src/twadmin/twadmincl.cpp +++ b/src/twadmin/twadmincl.cpp @@ -34,8 +34,6 @@ // #include "stdtwadmin.h" -#include - #include "twadmincl.h" #include "twadminstrings.h" #include "keygeneration.h" @@ -63,8 +61,10 @@ #include "twcrypto/crypto.h" #include "core/displayencoder.h" +#include + //Provide a swab() impl. from glibc, for platforms that don't have one -#if NEEDS_SWAB_IMPL +#if !HAVE_SWAB || NEEDS_SWAB_IMPL void swab (const void *bfrom, void *bto, ssize_t n) { const char *from = (const char *) bfrom; From b648b2493f05885fdc80c492c9856a76061a22a2 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 8 Sep 2017 16:31:36 -0700 Subject: [PATCH 080/110] Fix various unit tests that didn't test anything, or needed cleanup; disable some cTWLocale methods that were unused outside of their own unit tests. --- src/core/twlocale.cpp | 5 ++- src/core/twlocale.h | 7 +-- src/twtest/blockrecordarray_t.cpp | 20 +++++++++ src/twtest/fspropcalc_t.cpp | 1 + src/twtest/fsspec_t.cpp | 35 ++++++++++----- src/twtest/platform_t.cpp | 37 +++++++--------- src/twtest/stringutil_t.h | 12 +---- src/twtest/twlocale_t.cpp | 74 +++++++++++++++---------------- 8 files changed, 103 insertions(+), 88 deletions(-) diff --git a/src/core/twlocale.cpp b/src/core/twlocale.cpp index 85382a3..c671dc6 100644 --- a/src/core/twlocale.cpp +++ b/src/core/twlocale.cpp @@ -104,6 +104,7 @@ void cTWLocale::InitGlobalLocale() } +/* TSTRING cTWLocale::FormatNumberAsHex( int32 i ) { // @@ -125,6 +126,7 @@ TSTRING cTWLocale::FormatNumberAsHex( int32 i ) // return( sstr.str() ); } +*/ template< class numT, class CharT > class cFormatNumberUtil @@ -190,6 +192,7 @@ public: } }; +/* TSTRING cTWLocale::FormatNumberClassic( int32 i ) { TSTRING s; @@ -200,7 +203,7 @@ int32 cTWLocale::FormatNumberClassic( const TSTRING& s ) { return cFormatNumberUtil< long, TCHAR >::Format( s, true ); } - +*/ TSTRING& cTWLocale::FormatNumber( uint64 ui, TSTRING& strBuf ) { diff --git a/src/core/twlocale.h b/src/core/twlocale.h index 0e0c386..052a49f 100644 --- a/src/core/twlocale.h +++ b/src/core/twlocale.h @@ -79,12 +79,13 @@ public: static TSTRING& FormatNumber( uint64 ui, TSTRING& strBuf ); static TSTRING& FormatNumber( double d, TSTRING& strBuf ); // returns the locale-specific representation of the given cardinal number - +/* static TSTRING FormatNumberClassic( int32 i ); static int32 FormatNumberClassic( const TSTRING& s ); // returns the C-locale representation of the given cardinal number - - static TSTRING FormatNumberAsHex( int32 x ); +*/ +// disabled this since nobody's using it +// static TSTRING FormatNumberAsHex( int32 x ); // locale-independant static TSTRING& FormatTime( int64 t, TSTRING& strBuf ); diff --git a/src/twtest/blockrecordarray_t.cpp b/src/twtest/blockrecordarray_t.cpp index a1a3b34..065bb95 100644 --- a/src/twtest/blockrecordarray_t.cpp +++ b/src/twtest/blockrecordarray_t.cpp @@ -37,6 +37,7 @@ #include "core/debug.h" #include "core/error.h" +//TODO: This test needs more comprehensive validity checks void TestBlockRecordArray() { cDebug d( "TestBlockRecordArray" ); @@ -57,6 +58,12 @@ void TestBlockRecordArray() // cBlockRecordArray ra1( &bf, 0 ); ra1.InitNewBlock(); cBlockRecordArray ra2( &bf, 1 ); ra2.InitNewBlock(); + + TEST(ra1.IsClassValid()); + TEST(ra2.IsClassValid()); + + TEST(ra1.Initialized()); + // // now, start adding and removing things from the arrays... // @@ -65,9 +72,13 @@ void TestBlockRecordArray() static const char data3[] = "Here is d a t a 3!"; static const char data4[] = "Three cheers for data 4!"; ra1.AddItem( (int8*)data1, sizeof(data1), 1 ); +// TEST(ra1.IsItemValid(1)); ra1.AddItem( (int8*)data2, sizeof(data2), 2 ); +// TEST(ra1.IsItemValid(2)); ra1.AddItem( (int8*)data3, sizeof(data3), 3 ); +// TEST(ra1.IsItemValid(3)); ra1.AddItem( (int8*)data4, sizeof(data4), 4 ); +// TEST(ra1.IsItemValid(4)); #ifdef _BLOCKFILE_DEBUG ra1.TraceContents(); #endif @@ -77,6 +88,7 @@ void TestBlockRecordArray() // delete item 2... ra1.DeleteItem( 1 ); + TEST(!ra1.IsItemValid(1)); #ifdef _BLOCKFILE_DEBUG ra1.TraceContents(); #endif @@ -84,6 +96,7 @@ void TestBlockRecordArray() // add a new item... static const char data5[] = "fffiiivvveee!"; ra1.AddItem( (int8*)data5, sizeof(data5), 5 ); +// TEST(ra1.IsItemValid(5)); #ifdef _BLOCKFILE_DEBUG ra1.TraceContents(); #endif @@ -91,10 +104,12 @@ void TestBlockRecordArray() // delete the second to last and last items to see if we clean up properly... // note that there are four things here at this point. ra1.DeleteItem( 2 ); + TEST(!ra1.IsItemValid(2)); #ifdef _BLOCKFILE_DEBUG ra1.TraceContents(); #endif ra1.DeleteItem( 3 ); + TEST(!ra1.IsItemValid(3)); #ifdef _BLOCKFILE_DEBUG ra1.TraceContents(); #endif @@ -114,6 +129,8 @@ void TestBlockRecordArray() ra1.TraceContents(); #endif + TEST(ra1.IsClassValid()); + // Now, we will close the file, reopen it and see if we can read it ok. // bf.Close(); @@ -123,6 +140,9 @@ void TestBlockRecordArray() #ifdef _BLOCKFILE_DEBUG ra3.TraceContents(); #endif + + TEST(ra3.Initialized()); + TEST(ra3.IsClassValid()); } void RegisterSuite_BlockRecordArray() diff --git a/src/twtest/fspropcalc_t.cpp b/src/twtest/fspropcalc_t.cpp index 3130f39..bb70f1e 100644 --- a/src/twtest/fspropcalc_t.cpp +++ b/src/twtest/fspropcalc_t.cpp @@ -149,6 +149,7 @@ void TestGetSymLinkStr() TEST(fd >= 0); close(fd); + unlink(link.c_str()); TEST(0 == symlink(file.c_str(), link.c_str())); cMemoryArchive arch(1024*1024); diff --git a/src/twtest/fsspec_t.cpp b/src/twtest/fsspec_t.cpp index aca91ca..fc0a9c9 100644 --- a/src/twtest/fsspec_t.cpp +++ b/src/twtest/fsspec_t.cpp @@ -65,23 +65,34 @@ static void PrintFCOTree(const iFCO* pFCO, cDebug d, int depth) } */ -void TestFCOSpecImpl() +void TestFCOSpecImpl1() { - cDebug d("TestFCOSpecImpl"); + cDebug d("TestFCOSpecImpl1"); d.TraceDebug("Entering...\n"); cFSDataSourceIter dataSrc; // test AllChildStopPoint fcos... d.TraceDebug("Now testing a spec whose start point is the only thing it maps to (%s)\n", TwTestDir().c_str()); - cFCOSpecImpl* pSpec2 = new cFCOSpecImpl(TwTestDir(), &dataSrc, new cFCOSpecNoChildren); - pSpec2->SetStartPoint(cFCOName(TwTestDir())); - dataSrc.SeekToFCO(pSpec2->GetStartPoint(), false); + cFCOSpecImpl* pSpec = new cFCOSpecImpl(TwTestDir(), &dataSrc, new cFCOSpecNoChildren); + pSpec->SetStartPoint(cFCOName(TwTestDir())); + + dataSrc.SeekToFCO(pSpec->GetStartPoint(), false); iFCO* pFCO = dataSrc.CreateFCO(); TEST(pFCO); //PrintFCOTree(pFCO, d, 0); pFCO->Release(); + pSpec->Release(); +} + +void TestFCOSpecImpl2() +{ + cDebug d("TestFCOSpecImpl2"); + d.TraceDebug("Entering...\n"); + + cFSDataSourceIter dataSrc; + // create an FSSpec and set up some start and stop points... cFCOSpecStopPointSet* pSet = new cFCOSpecStopPointSet; cFCOSpecImpl* pSpec = new cFCOSpecImpl(_T("Test FSSpec"), &dataSrc, pSet); @@ -89,13 +100,12 @@ void TestFCOSpecImpl() pSet->Add(cFCOName(_T("/etc/open gl"))); pSet->Add(cFCOName(_T("/etc/pclient"))); - // create all the fcos... - cFSDataSourceIter dataSrc2; - dataSrc2.SeekToFCO(pSpec->GetStartPoint(), false); - iFCO* pFCO2 = dataSrc2.CreateFCO(); - TEST(pFCO2); + dataSrc.SeekToFCO(pSpec->GetStartPoint(), false); + iFCO* pFCO = dataSrc.CreateFCO(); + TEST(pFCO); //PrintFCOTree(pFCO, d, 0); - pFCO2->Release(); + + pFCO->Release(); // TODO -- test Clone(), copy ctor, operator= @@ -104,5 +114,6 @@ void TestFCOSpecImpl() void RegisterSuite_FCOSpecImpl() { - RegisterTest("FCOSpecImpl", "Basic", TestFCOSpecImpl); + RegisterTest("FCOSpecImpl", "Basic1", TestFCOSpecImpl1); + RegisterTest("FCOSpecImpl", "Basic2", TestFCOSpecImpl2); } diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index b9b96b0..2612326 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -68,16 +68,6 @@ class AlignMe byte a[sizeof(int64)+ALIGN_SIZE]; // we want to be able to access a int64 at address [ALIGN_SIZE] }; -///////////////////////////////////////////////////////// -// MAIN TEST FUNCTION -///////////////////////////////////////////////////////// - -void TestPlatform() -{ - TestAlignment(); - TestSizes(); -} - ///////////////////////////////////////////////////////// // TEMPLATIZED UTIL CLASSES IMPLEMENTATIONS ///////////////////////////////////////////////////////// @@ -206,22 +196,25 @@ void TestAlignment() TEST("BYTE_ALIGN ok"); // yet again, the test is not falling over a couple of lines up. } +// Not sure this is a super valuable test, since it just verifies that builtin integer types +// work the way we think they do. void TestSizes() { cDebug d("TestSizes"); d.TraceError("Fix this!\n"); - skip("TODO: TestSizes needs work"); -/* - TEST( CanBeRepresentedAs( char(), char() ) ); - TEST( CanBeRepresentedAs( char(), unsigned char() ) ); - TEST( CanBeRepresentedAs( unsigned char(), char() ) ); - TEST( CanBeRepresentedAs( unsigned char(), unsigned char() ) ); - TEST( CanBeRepresentedAs( signed char(), char() ) ); - TEST( CanBeRepresentedAs( char(), signed char() ) ); - TEST( CanBeRepresentedAs( signed char(), signed char() ) ); - TEST( CanBeRepresentedAs( signed char(), unsigned char() ) ); - TEST( CanBeRepresentedAs( char(), signed char() ) ); - */ + + TEST( CanBeRepresentedAs( int8(), int8() ) ); + TEST( ! CanBeRepresentedAs( int8(), uint8() ) ); + TEST( ! CanBeRepresentedAs( uint8(), int8() ) ); + TEST( CanBeRepresentedAs( uint8(), uint8() ) ); + + TEST( CanBeRepresentedAs( int8(), int16() ) ); + TEST( CanBeRepresentedAs( int16(), int32() ) ); + TEST( CanBeRepresentedAs( int32(), int64() ) ); + + TEST( CanBeRepresentedAs( uint8(), uint16() ) ); + TEST( CanBeRepresentedAs( uint16(), uint32() ) ); + TEST( CanBeRepresentedAs( uint32(), uint64() ) ); } ///////////////////////////////////////////////////////// diff --git a/src/twtest/stringutil_t.h b/src/twtest/stringutil_t.h index 1d8494d..5a34a15 100644 --- a/src/twtest/stringutil_t.h +++ b/src/twtest/stringutil_t.h @@ -42,10 +42,7 @@ #define __STRINGUTIL_T_H #include "core/ntmbs.h" - -#if USING_NTDBS_STUFF #include "core/ntdbs.h" -#endif // USING_NTDBS_STUFF //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Char traits for WCHAR16 (aka dbchar_t) and NTMBCS (mctype_t) @@ -54,7 +51,6 @@ inline void TestStringUtil() { -#if USING_NTDBS_STUFF cDebug db("Test std::char_traits"); db.TraceAlways("Entering...\n"); @@ -63,12 +59,10 @@ void TestStringUtil() tss::dbstring b; std::string c; // Control String -//#if !IS_UNIX // need to get the L"" stuff working - static char NTMBS1[] = { 65, 66, 67, 68, 0 }; static dbchar_t NTDBS1[] = { 65, 66, 67, 68, 0 }; static dbchar_t NTDBS2[] = { 40, 66, 67, 68, 0 }; - static dbchar_t NTDBS0[] = { 65, 66, 67, 68, 0, 0 }; +// static dbchar_t NTDBS0[] = { 65, 66, 67, 68, 0, 0 }; c.assign( NTMBS1 ); a.assign( NTDBS1 ); @@ -126,7 +120,6 @@ void TestStringUtil() tss::dbstring x( NTDBS1 ); tss::dbstring ref = x; - TEST( x.c_str() == ref.c_str() ); TEST( x == ref ); TEST( std::equal( x.begin(), x.end(), ref.begin() ) ); TEST( x.size() == ref.size() ); @@ -167,9 +160,6 @@ void TestStringUtil() TEST(tStr.length() == 9); db.TraceAlways("Done...\n"); -#else - skip("Implement this for non-DBS, i.e. most everywhere."); -#endif // USING_NTDBS_STUFF } diff --git a/src/twtest/twlocale_t.cpp b/src/twtest/twlocale_t.cpp index 289ba28..b6f050f 100644 --- a/src/twtest/twlocale_t.cpp +++ b/src/twtest/twlocale_t.cpp @@ -55,21 +55,7 @@ void TestHex(); TEST( false ); \ } catch( error& ) {} -void TestTWLocale() -{ - skip("TWLocale tests are ifdef'd out, need to revisit them"); - -#ifdef DOESNTWORK - TestHex(); - TestAtoi(); - TestItoa(); - TestFlags(); - TestRoundtrip(); -#endif//NOTDONE -} - -#ifdef DOESNTWORK - +/* We don't do atoi stuff in cTWLocale anymore void TestAtoi() { // @@ -81,24 +67,25 @@ void TestAtoi() // // Try formatting with our default locale // - cTWLocale::InitGlobalLocale(); - n = cTWLocale::FormatNumber( str ); + TWLocale::InitGlobalLocale(); + n = cTWLocale::FormatNumberClassic( str ); TEST( n == 123456 ); // // Try formatting with "" locale // std::locale::global( std::locale("") ); - n = cTWLocale::FormatNumber( str ); + n = cTWLocale::FormatNumberClassic( str ); TEST( n == 123456 ); // // Try formatting with "C" locale // std::locale::global( std::locale("") ); - n = cTWLocale::FormatNumber( str ); + n = cTWLocale::FormatNumberClassic( str ); TEST( n == 123456 ); } +*/ void TestItoa() { @@ -118,23 +105,24 @@ void TestItoa() // cTWLocale::InitGlobalLocale(); cTWLocale::FormatNumber( n, str ); - TCOUT << str << std::endl; + TEST( str == "123456" ); // // Try formatting with "" locale // std::locale::global( std::locale("") ); cTWLocale::FormatNumber( n, str ); - TCOUT << str << std::endl; + TEST( str == "123,456" ); // // Try formatting with "C" locale // std::locale::global( std::locale("") ); cTWLocale::FormatNumber( n, str ); - TCOUT << str << std::endl; + TEST( str == "123,456" ); } +/* We don't do atoi stuff in cTWLocale anymore, so no roundtrip void TestRoundtrip() { // @@ -147,10 +135,10 @@ void TestRoundtrip() // TSTRING strIn = _T("123456"); TSTRING strOut; - strOut = cTWLocale::FormatNumber( cTWLocale::FormatNumber( strIn ), strOut ); + strOut = cTWLocale::FormatNumber( cTWLocale::FormatNumberClassic( strIn ), strOut ); // don't know if string will be the same due to possible changes in formatting from locale // ASSERT( strOut == strIn ); <---- can't do this ^^^ - TEST( 123456 == cTWLocale::FormatNumber( strOut ) ); + TEST( 123456 == cTWLocale::FormatNumberClassic( strOut ) ); // @@ -158,13 +146,15 @@ void TestRoundtrip() // int32 nIn = 654321; int32 nOut; - nOut = cTWLocale::FormatNumber( cTWLocale::FormatNumber( nIn, strIn ) ); + nOut = cTWLocale::FormatNumberClassic( cTWLocale::FormatNumber( nIn, strIn ) ); TEST( nOut == nIn ); } - +*/ void TestFlags() { + skip("Modernize & re-enable this"); +#if 0 // // init // @@ -207,29 +197,35 @@ void TestFlags() // try bad oct // ASSERT_THAT_IT_THROWS( cTWLocale::FormatNumber( _T("99"), std::ios_base::oct ), eError ); +#endif } +/* +void doTestHex(const uint32 value, const std::string& expected, const std::string& expected2 = "") +{ + TSTRING str = cTWLocale::FormatNumberAsHex( value ); + TCERR << "STR = " << str << " | Expected = " << expected << " | Expected2 = " << expected2 << std::endl; + TEST( str == expected || (!expected2.empty() && str == expected2) ); +} + void TestHex() { TSTRING str; - str = cTWLocale::FormatNumberAsHex( 0x1234 ); - TEST( str == _T("1234") ); - - str = cTWLocale::FormatNumberAsHex( 16 ); - TEST( str == _T("10") ); - - str = cTWLocale::FormatNumberAsHex( 0x12344321 ); - TEST( str == _T("12344321") ); - - str = cTWLocale::FormatNumberAsHex( 0xFFFFFFFF ); - TEST( str == _T("FFFFFFFF") || str == _T("ffffffff") ); + doTestHex( 0x1234, _T("1234") ); + doTestHex( 16, _T("10") ); + doTestHex( 0x12344321, _T("12344321") ); + doTestHex( 0xFFFFFFFF, _T("FFFFFFFF"), _T("ffffffff")); } -#endif//DOESNTWORK +*/ void RegisterSuite_TWLocale() { - RegisterTest("TWLocale", "Basic", TestTWLocale); +// RegisterTest("TWLocale", "Hex", TestHex); +// RegisterTest("TWLocale", "Atoi", TestAtoi); + RegisterTest("TWLocale", "Itoa", TestItoa); + RegisterTest("TWLocale", "Flags", TestFlags); +// RegisterTest("TWLocale", "Roundtrip", TestRoundtrip); } From e7b00507e967be23bbc81fa4d1ad71e343597bcb Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 8 Sep 2017 16:51:49 -0700 Subject: [PATCH 081/110] Skip a TWLocale test on Cygwin since it doesn't like the 'C' locale --- src/twtest/twlocale_t.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/twtest/twlocale_t.cpp b/src/twtest/twlocale_t.cpp index b6f050f..416be2e 100644 --- a/src/twtest/twlocale_t.cpp +++ b/src/twtest/twlocale_t.cpp @@ -89,6 +89,7 @@ void TestAtoi() void TestItoa() { +#if !IS_CYGWIN // // can't do ASSERT( str == _T("123456") ) // because locale may turn it into "123,465" or whatever @@ -120,6 +121,9 @@ void TestItoa() std::locale::global( std::locale("") ); cTWLocale::FormatNumber( n, str ); TEST( str == "123,456" ); +#else + skip("Test disabled because Cygwin doesn't like the 'C' locale for some reason"); +#endif } /* We don't do atoi stuff in cTWLocale anymore, so no roundtrip From 041ca7f3b3ea0dbabfeebcedcb7ac1d88d531601 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 8 Sep 2017 18:04:35 -0700 Subject: [PATCH 082/110] Tweak a couple of tests that generally fail due to environmental issues (locale configuration, local IP <--> hostname mapping, current username) so they're marked as skipped instead of failed when it looks like a configuration problem. --- src/twtest/twlocale_t.cpp | 65 +++++++++++++++++---------------- src/twtest/unixfsservices_t.cpp | 12 +++++- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/src/twtest/twlocale_t.cpp b/src/twtest/twlocale_t.cpp index 416be2e..b679d5b 100644 --- a/src/twtest/twlocale_t.cpp +++ b/src/twtest/twlocale_t.cpp @@ -89,41 +89,44 @@ void TestAtoi() void TestItoa() { -#if !IS_CYGWIN - // - // can't do ASSERT( str == _T("123456") ) - // because locale may turn it into "123,465" or whatever - // + try + { + // + // can't do ASSERT( str == _T("123456") ) + // because locale may turn it into "123,465" or whatever + // - // - // setup - // - int32 n = 123456; - TSTRING str; + // + // setup + // + int32 n = 123456; + TSTRING str; - // - // Try formatting with our default locale - // - cTWLocale::InitGlobalLocale(); - cTWLocale::FormatNumber( n, str ); - TEST( str == "123456" ); + // + // Try formatting with our default locale + // + cTWLocale::InitGlobalLocale(); + cTWLocale::FormatNumber( n, str ); + TEST( str == "123456" ); - // - // Try formatting with "" locale - // - std::locale::global( std::locale("") ); - cTWLocale::FormatNumber( n, str ); - TEST( str == "123,456" ); + // + // Try formatting with "" locale + // + std::locale::global( std::locale("") ); + cTWLocale::FormatNumber( n, str ); + TEST( str == "123,456" ); - // - // Try formatting with "C" locale - // - std::locale::global( std::locale("") ); - cTWLocale::FormatNumber( n, str ); - TEST( str == "123,456" ); -#else - skip("Test disabled because Cygwin doesn't like the 'C' locale for some reason"); -#endif + // + // Try formatting with "C" locale + // + std::locale::global( std::locale("") ); + cTWLocale::FormatNumber( n, str ); + TEST( str == "123,456" ); + } + catch(const std::runtime_error& e) + { + skip("Skipping test due to configuration issue w/ 'C' locale"); + } } /* We don't do atoi stuff in cTWLocale anymore, so no roundtrip diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index b43869f..ac82a24 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -157,14 +157,22 @@ void TestGetCurrentUserName() { #if !IS_SKYOS // SkyOS breaks on this, for as-yet-unknown reasons TSTRING username; - TEST( iFSServices::GetInstance()->GetCurrentUserName(username) ) + bool success = iFSServices::GetInstance()->GetCurrentUserName(username); + if ( !success ) + skip("GetCurrentUserName test skipped, usually caused by system configuration problems"); + + TEST("GetCurrentUserName() did not throw"); #endif } void TestGetIPAddress() { uint32 ipaddr; - TEST( iFSServices::GetInstance()->GetIPAddress( ipaddr ) ); + bool success = iFSServices::GetInstance()->GetIPAddress( ipaddr ); + if ( !success ) + skip("GetIPAddress test skipped, usually caused by hostname/IP configuration problems"); + + TEST("GetIPAddress() did not throw"); } void TestGetExecutableFilename() From 6f13e00055fae546ff1037e9b46cea6573bc5fa2 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 8 Sep 2017 23:00:36 -0700 Subject: [PATCH 083/110] Tweak siggen test-harness test for portability, since a few outlier impls of ps (e.g. Haiku) don't support -ef args --- src/test-harness/tests/siggen.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-harness/tests/siggen.pm b/src/test-harness/tests/siggen.pm index de159f3..ecde9a2 100644 --- a/src/test-harness/tests/siggen.pm +++ b/src/test-harness/tests/siggen.pm @@ -31,7 +31,7 @@ sub run() { printf("%-30s", "-- $description"); - twtools::logStatus(`ps -ef > $twtools::twrootdir/hashme.txt`); + twtools::logStatus(`ps > $twtools::twrootdir/hashme.txt`); if ( $? != 0 ) { twtools::logStatus("test file creation failed\n"); $twpassed = 0; From 9b194b5122905ad8c7469a0c859870d3fec17882 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 9 Sep 2017 20:24:17 -0700 Subject: [PATCH 084/110] Include OS name in test-harness output --- src/test-harness/twtest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-harness/twtest.pl b/src/test-harness/twtest.pl index 815e9b1..62b5290 100755 --- a/src/test-harness/twtest.pl +++ b/src/test-harness/twtest.pl @@ -137,7 +137,7 @@ processCommandLine(); prepareListOfTests() if scalar(@twtests) == 0; # only if none were on the cmdline print "\n"; -print "initializing for tests...\n\n"; +print "initializing for tests on $^O…\n\n"; print "logging to $ENV{'PWD'}/$twtools::twrootdir/status.log\n\n"; From 2a278ad29be6ee62f76ff71ba1bb65fda657d401 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 9 Sep 2017 23:26:45 -0700 Subject: [PATCH 085/110] Make 'syslog not supported' a warning vs a fatal error if someone tries to use it on syslog-less platforms; clean up unit & harness tests & handle some per-platform quirks --- src/test-harness/tests/complex.pm | 42 ++++++++++++++---------- src/test-harness/tests/dbupdate.pm | 6 ++-- src/test-harness/tests/inoderef.pm | 42 ++++++++++++++---------- src/test-harness/tests/integritycheck.pm | 35 +++++++++++++++----- src/test-harness/tests/readonly.pm | 41 +++++++++++++---------- src/test-harness/tests/siggen.pm | 11 ++++--- src/test-harness/twtools.pm | 4 +-- src/tripwire/twcmdline.cpp | 13 +++++--- src/twtest/configfile_t.cpp | 4 +-- src/twtest/displayencoder_t.cpp | 21 +++++++++--- src/twtest/error_t.cpp | 10 +++--- src/twtest/fconame_t.cpp | 8 +++-- src/twtest/fcospec_t.cpp | 6 +--- src/twtest/fsspec_t.cpp | 2 ++ src/twtest/growheap_t.cpp | 18 +++++----- src/twtest/platform_t.cpp | 40 +++++++++++----------- src/twtest/signature_t.cpp | 4 --- src/twtest/stringencoder_t.cpp | 4 +-- src/twtest/test.cpp | 1 + 19 files changed, 184 insertions(+), 128 deletions(-) diff --git a/src/test-harness/tests/complex.pm b/src/test-harness/tests/complex.pm index 5a08c50..936dffe 100644 --- a/src/test-harness/tests/complex.pm +++ b/src/test-harness/tests/complex.pm @@ -119,8 +119,8 @@ EOT # sub initialize() { - my $twstr = getPolicyFileString(); - twtools::GeneratePolicyFile($twstr); + my $twstr = getPolicyFileString(); + twtools::GeneratePolicyFile($twstr); } @@ -131,30 +131,36 @@ sub initialize() { # sub run() { - my $twpassed = 1; + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); - twtools::logStatus("*** Beginning $description\n"); - printf("%-30s", "-- $description"); + if ($^O eq "skyos") { + ++$twtools::twskippedtests; + print "SKIPPED; TODO: SkyOS has fewer expected changes here; refactor so we can test for correct values\n"; + return; + } - ######################################################### - # - # Run the tests describe above in the %TESTS structure. - # - $twpassed = twtools::RunIntegrityTests(%TESTS); + my $twpassed = 1; + + ######################################################### + # + # Run the tests describe above in the %TESTS structure. + # + $twpassed = twtools::RunIntegrityTests(%TESTS); - ######################################################### - # - # See if the tests all succeeded... - # - if ($twpassed) { + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { print "PASSED\n"; ++$twtools::twpassedtests; - } - else { + } + else { ++$twtools::twfailedtests; print "*FAILED*\n"; - } + } } diff --git a/src/test-harness/tests/dbupdate.pm b/src/test-harness/tests/dbupdate.pm index 4f361f4..9bab52b 100644 --- a/src/test-harness/tests/dbupdate.pm +++ b/src/test-harness/tests/dbupdate.pm @@ -159,9 +159,11 @@ sub RunBasicTest # Make sure we got 4 violations: 2 mod, 1 add, 1 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = ($^O ne "skyos") ? 4 : 3; + my $c_expected = ($^O ne "skyos") ? 2 : 1; + + if( ($n != $n_expected) || ($a != 1) || ($r != 1) || ($c != $c_expected) ) { - if( ($n != 4) || ($a != 1) || ($r != 1) || ($c != 2) ) - { twtools::logStatus("FAILED -- initial integrity check had unexpected results\n"); return 0; } diff --git a/src/test-harness/tests/inoderef.pm b/src/test-harness/tests/inoderef.pm index b779180..69e322b 100644 --- a/src/test-harness/tests/inoderef.pm +++ b/src/test-harness/tests/inoderef.pm @@ -77,8 +77,8 @@ EOT # sub initialize() { - my $twstr = getPolicyFileString(); - twtools::GeneratePolicyFile($twstr); + my $twstr = getPolicyFileString(); + twtools::GeneratePolicyFile($twstr); } @@ -89,30 +89,36 @@ sub initialize() { # sub run() { - my $twpassed = 1; + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); - twtools::logStatus("*** Beginning $description\n"); - printf("%-30s", "-- $description"); + if ($^O eq "skyos" || $^O eq "haiku") { + ++$twtools::twskippedtests; + print "SKIPPED; OS doesn't support hardlinks.\n"; + return; + } - ######################################################### - # - # Run the tests describe above in the %TESTS structure. - # - $twpassed = twtools::RunIntegrityTests(%TESTS); + my $twpassed = 1; + + ######################################################### + # + # Run the tests describe above in the %TESTS structure. + # + $twpassed = twtools::RunIntegrityTests(%TESTS); - ######################################################### - # - # See if the tests all succeeded... - # - if ($twpassed) { + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { ++$twtools::twpassedtests; print "PASSED\n"; - } - else { + } + else { ++$twtools::twfailedtests; print "*FAILED*\n"; - } + } } diff --git a/src/test-harness/tests/integritycheck.pm b/src/test-harness/tests/integritycheck.pm index a7b8159..e37dcc3 100644 --- a/src/test-harness/tests/integritycheck.pm +++ b/src/test-harness/tests/integritycheck.pm @@ -161,6 +161,7 @@ sub PrepareForTest sub run { my $twpassed = 1; + my $dir_mods = ($^O eq "skyos") ? 0 : 1; twtools::logStatus("*** Beginning integrity check test\n"); printf("%-30s", "-- $description"); @@ -181,8 +182,10 @@ sub run # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = $dir_mods ? 6 : 4; + my $c_expected = $dir_mods ? 3 : 1; - if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + if( ($n != $n_expected) || ($a != 1) || ($r != 2) || ($c != $c_expected) ) { twtools::logStatus("Full IC failed: $n $a $r $c\n"); $twpassed = 0; @@ -213,8 +216,10 @@ sub run # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = $dir_mods ? 6 : 4; + my $c_expected = $dir_mods ? 3 : 1; - if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + if( ($n != $n_expected) || ($a != 1) || ($r != 2) || ($c != $c_expected) ) { twtools::logStatus("IC with FS section failed: $n $a $r $c\n"); $twpassed = 0; @@ -229,8 +234,10 @@ sub run # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = $dir_mods ? 6 : 4; + my $c_expected = $dir_mods ? 3 : 1; - if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + if( ($n != $n_expected) || ($a != 1) || ($r != 2) || ($c != $c_expected) ) { twtools::logStatus("IC with FS section failed: $n $a $r $c\n"); $twpassed = 0; @@ -245,8 +252,10 @@ sub run # Make sure we got 4 violations this time: 2 mod, 1 add, 1 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = $dir_mods ? 4 : 3; + my $c_expected = $dir_mods ? 2 : 1; - if( ($n != 4) || ($a != 1) || ($r != 1) || ($c != 2) ) + if( ($n != $n_expected) || ($a != 1) || ($r != 1) || ($c != $c_expected) ) { twtools::logStatus("IC of Rule A failed: $n $a $r $c\n"); $twpassed = 0; @@ -261,8 +270,10 @@ sub run # Make sure we got 2 violations this time: 1 mod, 0 add, 1 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = $dir_mods ? 2 : 1; + my $c_expected = $dir_mods ? 1 : 0; - if( ($n != 2) || ($a != 0) || ($r != 1) || ($c != 1) ) + if( ($n != $n_expected) || ($a != 0) || ($r != 1) || ($c != $c_expected) ) { twtools::logStatus("IC of severity 200+ failed: $n $a $r $c\n"); $twpassed = 0; @@ -277,8 +288,10 @@ sub run # Make sure we got 2 violations this time: 1 mod, 0 add, 1 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = $dir_mods ? 2 : 1; + my $c_expected = $dir_mods ? 1 : 0; - if( ($n != 2) || ($a != 0) || ($r != 1) || ($c != 1) ) + if( ($n != $n_expected) || ($a != 0) || ($r != 1) || ($c != $c_expected) ) { twtools::logStatus("IC of severity 'high' failed: $n $a $r $c\n"); $twpassed = 0; @@ -314,8 +327,10 @@ sub run # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = $dir_mods ? 6 : 4; + my $c_expected = $dir_mods ? 3 : 1; - if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + if( ($n != $n_expected) || ($a != 1) || ($r != 2) || ($c != $c_expected) ) { twtools::logStatus("Full IC failed: $n $a $r $c\n"); $twpassed = 0; @@ -328,11 +343,13 @@ sub run RemoveFile("$reportloc"); twtools::RunIntegrityCheck({trailing-opts => "-I -V cat -P $twtools::twlocalpass"}); - # Make sure we got 1 violation this time: 1 mod, 0 add, 0 rm. + # Make sure we got 6 violations: 3 mod, 1 add, 2 rm. # my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); + my $n_expected = $dir_mods ? 6 : 4; + my $c_expected = $dir_mods ? 3 : 1; - if( ($n != 6) || ($a != 1) || ($r != 2) || ($c != 3) ) + if( ($n != $n_expected) || ($a != 1) || ($r != 2) || ($c != $c_expected) ) { twtools::logStatus("Interactive IC failed: $n $a $r $c\n"); $twpassed = 0; diff --git a/src/test-harness/tests/readonly.pm b/src/test-harness/tests/readonly.pm index 3a68139..86e8e5b 100644 --- a/src/test-harness/tests/readonly.pm +++ b/src/test-harness/tests/readonly.pm @@ -71,8 +71,8 @@ EOT sub initialize() { - my $twstr = getPolicyFileString(); - twtools::GeneratePolicyFile($twstr); + my $twstr = getPolicyFileString(); + twtools::GeneratePolicyFile($twstr); } @@ -83,32 +83,37 @@ sub initialize() { # sub run() { - my $twpassed = 1; + twtools::logStatus("\n\n*** Beginning $description\n"); + printf("%-30s", "-- $description"); - twtools::logStatus("\n\n*** Beginning $description\n"); + if ($^O eq "skyos") { + ++$twtools::twskippedtests; + print "SKIPPED; SkyOS doesn't support readonly files.\n"; + return; + } - printf("%-30s", "-- $description"); + my $twpassed = 1; - ######################################################### - # - # Run the tests describe above in the %TESTS structure. - # - $twpassed = twtools::RunIntegrityTests(%TESTS); + ######################################################### + # + # Run the tests describe above in the %TESTS structure. + # + $twpassed = twtools::RunIntegrityTests(%TESTS); - ######################################################### - # - # See if the tests all succeeded... - # - if ($twpassed) { + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { ++$twtools::twpassedtests; print "PASSED\n"; return 0; - } - else { + } + else { print "*FAILED*\n"; ++$twtools::twfailedtests; - } + } } diff --git a/src/test-harness/tests/siggen.pm b/src/test-harness/tests/siggen.pm index ecde9a2..f73ae90 100644 --- a/src/test-harness/tests/siggen.pm +++ b/src/test-harness/tests/siggen.pm @@ -37,10 +37,13 @@ sub run() { $twpassed = 0; } - twtools::logStatus(`mkfifo $twtools::twrootdir/donthashme.fifo`); - if ( $? != 0 ) { - twtools::logStatus("test fifo creation failed\n"); - $twpassed = 0; + # SkyOS doesn't have FIFOs, so this won't work + if ( $^O ne "skyos") { + twtools::logStatus(`mkfifo $twtools::twrootdir/donthashme.fifo`); + if ( $? != 0 ) { + twtools::logStatus("test fifo creation failed\n"); + $twpassed = 0; + } } twtools::logStatus(`$twtools::twrootdir/bin/siggen`); diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 1252162..218511d 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -189,7 +189,7 @@ sub AddEncryption { my ($filename) = @_; logStatus "addding crypt to file...\n"; - logStatus(`$twrootdir/bin/twadmin -m E -c $twrootdir/$twcfgloc -P $twlocalpass -Q $twsitepass $filename`); + logStatus(`$twrootdir/bin/twadmin -m E -c $twrootdir/$twcfgloc -P $twlocalpass -Q $twsitepass $filename 2>&1`); return ($? == 0); } @@ -204,7 +204,7 @@ sub RemoveEncryption { my ($filename) = @_; logStatus "removing crypto from file...\n"; - logStatus(`$twrootdir/bin/twadmin -m R -c $twrootdir/$twcfgloc -P $twlocalpass -Q $twsitepass $filename`); + logStatus(`$twrootdir/bin/twadmin -m R -c $twrootdir/$twcfgloc -P $twlocalpass -Q $twsitepass $filename 2>&1`); return ($? == 0); } diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index e692218..4cf28f9 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -446,14 +446,19 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) // SYSLOG reporting if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str)) { -#if SUPPORTS_SYSLOG if (_tcsicmp(str.c_str(), _T("true")) == 0) + { +#if SUPPORTS_SYSLOG pModeInfo->mbLogToSyslog = true; +#else + eTWSyslogNotSupported e; + e.SetFatality(false); + cErrorReporter::PrintErrorMsg(e); + pModeInfo->mbLogToSyslog = false; +#endif + } else pModeInfo->mbLogToSyslog = false; -#else - throw eTWSyslogNotSupported(); -#endif } else { diff --git a/src/twtest/configfile_t.cpp b/src/twtest/configfile_t.cpp index a2b032f..7b692a2 100644 --- a/src/twtest/configfile_t.cpp +++ b/src/twtest/configfile_t.cpp @@ -197,6 +197,6 @@ void TestConfigFile2(void) void RegisterSuite_ConfigFile() { - RegisterTest("ConfigFile", "Basic 1", TestConfigFile); - RegisterTest("ConfigFile", "Basic 2", TestConfigFile2); + RegisterTest("ConfigFile", "Basic1", TestConfigFile); + RegisterTest("ConfigFile", "Basic2", TestConfigFile2); } diff --git a/src/twtest/displayencoder_t.cpp b/src/twtest/displayencoder_t.cpp index df98865..448d1c4 100644 --- a/src/twtest/displayencoder_t.cpp +++ b/src/twtest/displayencoder_t.cpp @@ -71,7 +71,7 @@ static void util_TestUnprintable( const TSTRING& strCUnprintable ) TSTRING strEncoded = strCUnprintable; e.Encode( strEncoded ); - TCOUT << strEncoded << std::endl; +// TCOUT << strEncoded << std::endl; TSTRING strOut = strEncoded; e.Decode( strOut ); @@ -246,7 +246,7 @@ void TestQuoteAndBackSlash() /////////////////////////////////////////////////////////////////////////// // Basic /////////////////////////////////////////////////////////////////////////// -void TestDisplayEncoderBasic() +void TestDisplayEncoderBasic1() { //============================================================= // TEST UNPRINTABLE ENCODING/ROUNDTRIP @@ -269,7 +269,10 @@ void TestDisplayEncoderBasic() util_TestUnprintable( _T("\xEE\xEEtwo big") ); util_TestUnprintable( _T("small\x01") ); util_TestUnprintable( _T("\x01\x01two small") ); - +} + +void TestDisplayEncoderBasic2() +{ //============================================================= // TEST UNCONVERTABLE CHARS //============================================================= @@ -284,7 +287,10 @@ void TestDisplayEncoderBasic() } } util_TestUnprintable( strMessWithMe ); +} +void TestDisplayEncoderBasic3() +{ //============================================================= // TEST \\ and \x ENCODING/ROUNDTRIP //============================================================= @@ -298,8 +304,10 @@ void TestDisplayEncoderBasic() util_TestUnprintable( _T("Tri\\xcky") ); util_TestUnprintable( _T("Tricky\\x") ); util_TestUnprintable( _T("\\Tricky\\\\x") ); +} - +void TestDisplayEncoderBasic4() +{ //============================================================= // TEST UNCONVERTABLE, UNPRINTABLE, AND \\ and \" CHARS //============================================================= @@ -323,7 +331,10 @@ void TestDisplayEncoderBasic() void RegisterSuite_DisplayEncoder() { - RegisterTest("DisplayEncoder", "Basic", TestDisplayEncoderBasic); + RegisterTest("DisplayEncoder", "Basic1", TestDisplayEncoderBasic1); + RegisterTest("DisplayEncoder", "Basic2", TestDisplayEncoderBasic2); + RegisterTest("DisplayEncoder", "Basic3", TestDisplayEncoderBasic3); + RegisterTest("DisplayEncoder", "Basic4", TestDisplayEncoderBasic4); RegisterTest("DisplayEncoder", "CharToHex", TestCharToHex); RegisterTest("DisplayEncoder", "HexToChar", TestHexToChar); RegisterTest("DisplayEncoder", "StringToHex", TestStringToHex); diff --git a/src/twtest/error_t.cpp b/src/twtest/error_t.cpp index f3ed526..114bcae 100644 --- a/src/twtest/error_t.cpp +++ b/src/twtest/error_t.cpp @@ -44,16 +44,16 @@ void TestError() bool threw = false; try { - std::cout << "Before Exception" << std::endl; - std::cout << "Line number before throw: " << __LINE__ << std::endl; + // std::cout << "Before Exception" << std::endl; + // std::cout << "Line number before throw: " << __LINE__ << std::endl; throw eErrorGeneral(_T("This is an error!")); - std::cout << "After Exception" << std::endl; + // std::cout << "After Exception" << std::endl; } catch(eError& e) { threw = true; TEST(_tcscmp(e.GetMsg().c_str(), _T("This is an error!")) == 0); - TCOUT << _T("Exception caught!\n\nID=") << e.GetID() << _T("\n\t") << e.GetMsg() << std::endl; + // TCOUT << _T("Exception caught!\n\nID=") << e.GetID() << _T("\n\t") << e.GetMsg() << std::endl; } catch(...) { @@ -72,7 +72,7 @@ void TestError() { threw = true; TEST(_tcscmp(e.GetMsg().c_str(), _T("error_t.cpp")) == 0); - TCOUT << _T("Internal error caught!\n\nID=") << e.GetID() << _T("\n\t") << e.GetMsg() << std::endl; +// TCOUT << _T("Internal error caught!\n\nID=") << e.GetID() << _T("\n\t") << e.GetMsg() << std::endl; } catch(...) { diff --git a/src/twtest/fconame_t.cpp b/src/twtest/fconame_t.cpp index 7ef2f54..674a276 100644 --- a/src/twtest/fconame_t.cpp +++ b/src/twtest/fconame_t.cpp @@ -43,7 +43,7 @@ #include "core/archive.h" #include "fco/genreswitcher.h" -void TestFCOName() +void TestFCOName1() { // test the relationship operator... cFCOName above (_T("/etc")); @@ -82,7 +82,10 @@ void TestFCOName() TEST(_tcscmp(cat.Pop(),_T("cat")) == 0); TEST(dog.AsString().compare(cat.AsString()) == 0); TEST(dog.GetRelationship(cat) == cFCOName::REL_EQUAL); +} +void TestFCOName2() +{ cFCOName nullName; TEST(*nullName.AsString().c_str() == 0); @@ -141,5 +144,6 @@ void TestFCOName() void RegisterSuite_FCOName() { - RegisterTest("FCOName", "Basic", TestFCOName); + RegisterTest("FCOName", "Basic1", TestFCOName1); + RegisterTest("FCOName", "Basic2", TestFCOName2); } diff --git a/src/twtest/fcospec_t.cpp b/src/twtest/fcospec_t.cpp index 86725d1..ec391c1 100644 --- a/src/twtest/fcospec_t.cpp +++ b/src/twtest/fcospec_t.cpp @@ -41,15 +41,11 @@ using namespace std; void TestFCOSpec() { - cout << "Begin\tTestFCOSpec" << endl; // all it seems I can test here is that the default mask works const iFCOSpecMask* pDefMask = iFCOSpecMask::GetDefaultMask(); - TEST(pDefMask->GetName().compare(TSTRING(_T("Default"))) == 0); + TEST(pDefMask->GetName().compare( TSTRING(_T("Default")) ) == 0); iFCO* pf1 = (iFCO*)0xbad, *pf2 = (iFCO*)0xcab; TEST( pDefMask->Accept(pf1) && pDefMask->Accept(pf2) ); - - cout << "End\tTestFCOSpec" << endl; - return; } void RegisterSuite_FCOSpec() diff --git a/src/twtest/fsspec_t.cpp b/src/twtest/fsspec_t.cpp index fc0a9c9..c354434 100644 --- a/src/twtest/fsspec_t.cpp +++ b/src/twtest/fsspec_t.cpp @@ -78,6 +78,7 @@ void TestFCOSpecImpl1() pSpec->SetStartPoint(cFCOName(TwTestDir())); dataSrc.SeekToFCO(pSpec->GetStartPoint(), false); + TEST(!dataSrc.Done()); iFCO* pFCO = dataSrc.CreateFCO(); TEST(pFCO); //PrintFCOTree(pFCO, d, 0); @@ -101,6 +102,7 @@ void TestFCOSpecImpl2() pSet->Add(cFCOName(_T("/etc/pclient"))); dataSrc.SeekToFCO(pSpec->GetStartPoint(), false); + TEST(!dataSrc.Done()); iFCO* pFCO = dataSrc.CreateFCO(); TEST(pFCO); //PrintFCOTree(pFCO, d, 0); diff --git a/src/twtest/growheap_t.cpp b/src/twtest/growheap_t.cpp index 61eecd2..abe30e7 100644 --- a/src/twtest/growheap_t.cpp +++ b/src/twtest/growheap_t.cpp @@ -48,17 +48,17 @@ void TestGrowHeap() cGrowHeap gh( initSize, growBy, _T("growheap_t.cpp") ); // report initial state - TCOUT << _T("Initial size: ") << initSize << endl; +/* TCOUT << _T("Initial size: ") << initSize << endl; TCOUT << _T("Growby: ") << growBy << endl; TCOUT << _T("Initial Growheap memory usage: ") << gh.TotalMemUsage() << endl << endl; - +*/ const int growFactor = 5; // how much to enlarge requests each time // make it odd so we can see if the growheap // rounds to the alignment size for( size_t size = 1; size < growBy; size *= growFactor ) { // allocate memory - TCOUT << _T("Allocing by ") << size << endl; + //TCOUT << _T("Allocing by ") << size << endl; void* p = gh.Malloc( size ); TEST( p != NULL ); @@ -66,12 +66,12 @@ void TestGrowHeap() if( size > sizeof(int) ) { // read from memory - TCOUT << _T("Reading an int from memory...") << endl; + //TCOUT << _T("Reading an int from memory...") << endl; int* pi = static_cast< int* >( p ); int i = *pi; // write to memory - TCOUT << _T("Writing an int to memory...") << endl; + //TCOUT << _T("Writing an int to memory...") << endl; *pi = i; } @@ -79,19 +79,21 @@ void TestGrowHeap() if( size > sizeof(double) ) { // read from memory - TCOUT << _T("Reading a double from memory...") << endl; + //TCOUT << _T("Reading a double from memory...") << endl; double* pd = static_cast< double* >( p ); double d = *pd; // write to memory - TCOUT << _T("Writing a double to memory...") << endl; + //TCOUT << _T("Writing a double to memory...") << endl; *pd = d; } // report total usage - TCOUT << _T("Growheap memory usage: ") << gh.TotalMemUsage() << endl << endl; + //TCOUT << _T("Growheap memory usage: ") << gh.TotalMemUsage() << endl << endl; } + TEST( gh.TotalMemUsage() > 0); + // free memory gh.Clear(); TEST( gh.TotalMemUsage() == 0 ); diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index 2612326..ba7aec2 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -82,7 +82,7 @@ AlignMe::AlignMe() // this test exists in the first place. // -bcox #if (!IS_HPUX && !IS_SOLARIS) //Turns out Solaris SPARC is unhappy with this test too, btw - TCOUT << _T("Testing alignment of size ") << ALIGN_SIZE << std::endl; + //TCOUT << _T("Testing alignment of size ") << ALIGN_SIZE << std::endl; // access a double in the byte array to see if it is aligned. if it isn't and the CPU // can't handle it, you'll get a bus error @@ -90,11 +90,11 @@ AlignMe::AlignMe() // this should choke if the CPU can't // handle misaligned memory access int32* pi = (int32*)&a[ALIGN_SIZE]; - TCOUT << _T("Testing alignment of an int32...") << std::endl; - TCOUT << _T("Reading...") << std::endl; + //TCOUT << _T("Testing alignment of an int32...") << std::endl; + //TCOUT << _T("Reading...") << std::endl; int32 i = *pi; // access memory for read - TCOUT << _T("Read succeeded.") << std::endl; - TCOUT << _T("Writing...") << std::endl; + //TCOUT << _T("Read succeeded.") << std::endl; + //TCOUT << _T("Writing...") << std::endl; *pi = i; // access memory for write TCOUT << _T("Write succeeded.") << std::endl; @@ -102,17 +102,17 @@ AlignMe::AlignMe() // this should choke if the CPU can't // handle misaligned memory access int64* pb = (int64*)&a[ALIGN_SIZE]; - TCOUT << _T("Testing alignment of an int64...") << std::endl; - TCOUT << _T("Reading...") << std::endl; + //TCOUT << _T("Testing alignment of an int64...") << std::endl; + //TCOUT << _T("Reading...") << std::endl; int64 I = *pb; // access memory for read - TCOUT << _T("Read succeeded") << std::endl; - TCOUT << _T("Writing...") << std::endl; + //TCOUT << _T("Read succeeded") << std::endl; + //TCOUT << _T("Writing...") << std::endl; *pb = I; // access memory for write - TCOUT << _T("Write succeeded.") << std::endl; + //TCOUT << _T("Write succeeded.") << std::endl; - TCOUT << _T("Alignment of ") << ALIGN_SIZE << _T(" ") << ( ALIGN_SIZE == 1 ? _T("byte") : _T("bytes") ) << _T(" is OK") << std::endl - << _T("=========================================\n"); + /*TCOUT << _T("Alignment of ") << ALIGN_SIZE << _T(" ") << ( ALIGN_SIZE == 1 ? _T("byte") : _T("bytes") ) << _T(" is OK") << std::endl + << _T("=========================================\n"); */ TEST("Aligned"); // The actual test is not bus erroring up above; this just tells the framework we tested something. @@ -131,8 +131,8 @@ void TestAlignment() // The last AlignMe to be successfully constructed // - - - - - - - - - - - - - - - - - - - - - - - TCOUT << _T("Testing for byte alignment\n") - << _T("=========================================\n"); +// TCOUT << _T("Testing for byte alignment\n") +// << _T("=========================================\n"); AlignMe<128> a128; AlignMe<64> a64; @@ -156,10 +156,10 @@ void TestAlignment() a[0] = 0xAB; - TCOUT << _T("=========================================\n") +/* TCOUT << _T("=========================================\n") << _T("About to test memory access off by 1 byte\n") << _T("If you do not see a confirmation after this line, the test choked") - << std::endl; + << std::endl; */ // this should choke if the CPU can't // handle misaligned memory access @@ -180,20 +180,20 @@ void TestAlignment() // this should be fine b[0] = 0xAB; - TCOUT << _T("=========================================\n") +/* TCOUT << _T("=========================================\n") << _T("About to test memory access off by ") << BYTE_ALIGN << _T(" ") << ( BYTE_ALIGN == 1 ? _T("byte") : _T("bytes") ) << std::endl << _T("If you do not see a confirmation after this line, the test choked") << std::endl; - +*/ // this should choke if the CPU can't // handle misaligned memory access pi = (int32*)&b[BYTE_ALIGN]; *pi = *pi; // aligned (hopefully) access (read and write) - TCOUT << _T("Aligned access OK. BYTE_ALIGN value of ") << BYTE_ALIGN << _T(" is good.") << std::endl; +/* TCOUT << _T("Aligned access OK. BYTE_ALIGN value of ") << BYTE_ALIGN << _T(" is good.") << std::endl; TCOUT << _T("=========================================\n"); - TEST("BYTE_ALIGN ok"); // yet again, the test is not falling over a couple of lines up. + TEST("BYTE_ALIGN ok"); // yet again, the test is not falling over a couple of lines up. */ } // Not sure this is a super valuable test, since it just verifies that builtin integer types diff --git a/src/twtest/signature_t.cpp b/src/twtest/signature_t.cpp index 13ad64d..b9dcd43 100644 --- a/src/twtest/signature_t.cpp +++ b/src/twtest/signature_t.cpp @@ -443,10 +443,6 @@ void assertSHA1(const std::string& source, const std::string& expectedHex) shaSig.Update( (const byte*)source.c_str(), source.length() ); shaSig.Finit(); - TCERR << "Source = [" << source << "]" << std::endl; - TCERR << "Expected = " << expectedHex << std::endl; - TCERR << "Observed = " << shaSig.AsStringHex() << std::endl; - TEST( shaSig.AsStringHex() == expectedHex); } diff --git a/src/twtest/stringencoder_t.cpp b/src/twtest/stringencoder_t.cpp index d0b7cf3..bd39f26 100644 --- a/src/twtest/stringencoder_t.cpp +++ b/src/twtest/stringencoder_t.cpp @@ -86,9 +86,9 @@ void OutputString( TSTRING& str ) { cQuoteEncoder qe; - TCOUT << _T("Plain string: <") << str << _T(">") << endl; +/* TCOUT << _T("Plain string: <") << str << _T(">") << endl; TCOUT << _T("Encoded string: <") << qe.Encode( str ) << _T(">") << endl; - TCOUT << _T("Decoded string: <") << qe.Unencode( str ) << _T(">") << endl << endl ; + TCOUT << _T("Decoded string: <") << qe.Unencode( str ) << _T(">") << endl << endl ; */ TEST( str == qe.Unencode(qe.Encode(str)) ); } diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index ff84c76..aeb4c50 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -479,6 +479,7 @@ int _tmain(int argc, TCHAR** argv) //TEST(cRefCountObj::AllRefCountObjDestoryed() == true); std::cout << std::endl << "Ran " << ran_count << " unit tests with " << failed_count << " failures, " << skipped_count << " skipped." << std::endl; + std::cout << "(total test assertions: " << macro_count << ")" << std::endl; if (failed_count) { From 15b7d18104ae0d01660cf1ab109d10660ea17a90 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 10 Sep 2017 00:21:44 -0700 Subject: [PATCH 086/110] Couple more test-harness platform tweaks --- src/test-harness/tests/dirs.pm | 49 +++++++++++++++++++--------------- src/test-harness/twtest.pl | 2 +- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/test-harness/tests/dirs.pm b/src/test-harness/tests/dirs.pm index 3ff9b5e..071b76f 100644 --- a/src/test-harness/tests/dirs.pm +++ b/src/test-harness/tests/dirs.pm @@ -105,12 +105,12 @@ EOT # sub initialize() { - my $twstr = getPolicyFileString(); - twtools::GeneratePolicyFile($twstr); + my $twstr = getPolicyFileString(); + twtools::GeneratePolicyFile($twstr); - # this test requires a clean start of it's tree - # - system("rm -rf $twtools::twrootdir/" . $TESTS{"0-createTempDir"}{dir}); + # this test requires a clean start of it's tree + # + system("rm -rf $twtools::twrootdir/" . $TESTS{"0-createTempDir"}{dir}); } @@ -120,30 +120,37 @@ sub initialize() { # sub run() { - my $twpassed = 1; + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); - twtools::logStatus("*** Beginning $description\n"); - printf("%-30s", "-- $description"); + if ($^O eq "skyos") { + ++$twtools::twskippedtests; + print "SKIPPED; TODO: SkyOS has fewer expected changes here; refactor so we can test for correct values\n"; + return; + } - ######################################################### - # - # Run the tests describe above in the %TESTS structure. - # - $twpassed = twtools::RunIntegrityTests(%TESTS); + my $twpassed = 1; - ######################################################### - # - # See if the tests all succeeded... - # - if ($twpassed) { + ######################################################### + # + # Run the tests describe above in the %TESTS structure. + # + $twpassed = twtools::RunIntegrityTests(%TESTS); + + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { ++$twtools::twpassedtests; print "PASSED\n"; - } - else { + } + else { ++$twtools::twfailedtests; print "*FAILED*\n"; - } + } } diff --git a/src/test-harness/twtest.pl b/src/test-harness/twtest.pl index 62b5290..1611811 100755 --- a/src/test-harness/twtest.pl +++ b/src/test-harness/twtest.pl @@ -137,7 +137,7 @@ processCommandLine(); prepareListOfTests() if scalar(@twtests) == 0; # only if none were on the cmdline print "\n"; -print "initializing for tests on $^O…\n\n"; +print "initializing for tests on $^O...\n\n"; print "logging to $ENV{'PWD'}/$twtools::twrootdir/status.log\n\n"; From 5bea3693b46d1a02c14fbbdbdfa36dd973ba267b Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 10 Sep 2017 00:44:17 -0700 Subject: [PATCH 087/110] One more harness test tweak, avoiding access time violations in the readonly test --- src/test-harness/tests/readonly.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test-harness/tests/readonly.pm b/src/test-harness/tests/readonly.pm index 86e8e5b..d7ebaa8 100644 --- a/src/test-harness/tests/readonly.pm +++ b/src/test-harness/tests/readonly.pm @@ -55,9 +55,9 @@ sub getPolicyFileString { return < \$(ReadOnly); -$twtools::twcwd/$twtools::twrootdir/$TESTS{"1-accessed"}{file} -> \$(ReadOnly); -$twtools::twcwd/$twtools::twrootdir/$TESTS{"2-removed"}{file} -> \$(ReadOnly); +$twtools::twcwd/$twtools::twrootdir/$TESTS{"0-permsChange"}{file} -> \$(ReadOnly) -a; +$twtools::twcwd/$twtools::twrootdir/$TESTS{"1-accessed"}{file} -> \$(ReadOnly) -a; +$twtools::twcwd/$twtools::twrootdir/$TESTS{"2-removed"}{file} -> \$(ReadOnly) -a; EOT From 8d8652fe93be7b58eb3282d9a992c088714c2a5a Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 10 Sep 2017 01:16:17 -0700 Subject: [PATCH 088/110] More platform tweaks for harness tests, this time TODO-ing out a couple of tests for Hurd since it's expected to get fewer violations --- src/test-harness/tests/complex.pm | 4 ++-- src/test-harness/tests/readonly.pm | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test-harness/tests/complex.pm b/src/test-harness/tests/complex.pm index 936dffe..15ad9b9 100644 --- a/src/test-harness/tests/complex.pm +++ b/src/test-harness/tests/complex.pm @@ -134,9 +134,9 @@ sub run() { twtools::logStatus("*** Beginning $description\n"); printf("%-30s", "-- $description"); - if ($^O eq "skyos") { + if ($^O eq "skyos" || $^O eq "gnu") { ++$twtools::twskippedtests; - print "SKIPPED; TODO: SkyOS has fewer expected changes here; refactor so we can test for correct values\n"; + print "SKIPPED; TODO: OS has fewer expected changes here; refactor so we can test for correct values\n"; return; } diff --git a/src/test-harness/tests/readonly.pm b/src/test-harness/tests/readonly.pm index d7ebaa8..cb3cafd 100644 --- a/src/test-harness/tests/readonly.pm +++ b/src/test-harness/tests/readonly.pm @@ -90,8 +90,13 @@ sub run() { ++$twtools::twskippedtests; print "SKIPPED; SkyOS doesn't support readonly files.\n"; return; + } elseif ($^O eq "gnu") { + ++$twtools::twskippedtests; + print "SKIPPED; TODO: Hurd has fewer expected changes here; refactor so we can test for correct values\n"; + return; } + my $twpassed = 1; ######################################################### From 541c95171565838c2396b3633dbce5aba895f700 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 10 Sep 2017 01:22:31 -0700 Subject: [PATCH 089/110] Fix a typo in readonly test --- src/test-harness/tests/readonly.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-harness/tests/readonly.pm b/src/test-harness/tests/readonly.pm index cb3cafd..811b293 100644 --- a/src/test-harness/tests/readonly.pm +++ b/src/test-harness/tests/readonly.pm @@ -90,7 +90,7 @@ sub run() { ++$twtools::twskippedtests; print "SKIPPED; SkyOS doesn't support readonly files.\n"; return; - } elseif ($^O eq "gnu") { + } elsif ($^O eq "gnu") { ++$twtools::twskippedtests; print "SKIPPED; TODO: Hurd has fewer expected changes here; refactor so we can test for correct values\n"; return; From ee8c63b8f9bef54a1e1d45b146c22b4af5a75bbc Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 10 Sep 2017 12:59:21 -0700 Subject: [PATCH 090/110] In inode count test, update the list of platforms that don't do hardlinks --- src/test-harness/tests/inoderef.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-harness/tests/inoderef.pm b/src/test-harness/tests/inoderef.pm index 69e322b..50117d1 100644 --- a/src/test-harness/tests/inoderef.pm +++ b/src/test-harness/tests/inoderef.pm @@ -92,7 +92,7 @@ sub run() { twtools::logStatus("*** Beginning $description\n"); printf("%-30s", "-- $description"); - if ($^O eq "skyos" || $^O eq "haiku") { + if ($^O eq "skyos" || $^O eq "haiku" || $^O eq "syllable") { ++$twtools::twskippedtests; print "SKIPPED; OS doesn't support hardlinks.\n"; return; From 6cf39363196b32805beff2b78a7443d8c9e8ffa4 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 10 Sep 2017 20:29:53 -0700 Subject: [PATCH 091/110] Test-harness tweaks for DragonflyBSD, where we expect a few fewer changes (access/modify times). Tweak one test expected values to pass, skip 2 more with notes saying they need refactoring. --- src/test-harness/tests/dbupdate.pm | 5 +++-- src/test-harness/tests/dirs.pm | 4 ++-- src/test-harness/tests/integritycheck.pm | 12 +++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/test-harness/tests/dbupdate.pm b/src/test-harness/tests/dbupdate.pm index 9bab52b..8ba982d 100644 --- a/src/test-harness/tests/dbupdate.pm +++ b/src/test-harness/tests/dbupdate.pm @@ -158,9 +158,10 @@ sub RunBasicTest # Make sure we got 4 violations: 2 mod, 1 add, 1 rm. # + my $dir_mods = (($^O ne "skyos") && ($^O ne "dragonfly")) ? 0 : 1; my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); - my $n_expected = ($^O ne "skyos") ? 4 : 3; - my $c_expected = ($^O ne "skyos") ? 2 : 1; + my $n_expected = $dir_mods ? 4 : 3; + my $c_expected = $dir_mods ? 2 : 1; if( ($n != $n_expected) || ($a != 1) || ($r != 1) || ($c != $c_expected) ) { diff --git a/src/test-harness/tests/dirs.pm b/src/test-harness/tests/dirs.pm index 071b76f..dfbb37a 100644 --- a/src/test-harness/tests/dirs.pm +++ b/src/test-harness/tests/dirs.pm @@ -123,9 +123,9 @@ sub run() { twtools::logStatus("*** Beginning $description\n"); printf("%-30s", "-- $description"); - if ($^O eq "skyos") { + if (($^O eq "skyos") || ($^O eq "dragonfly")) { ++$twtools::twskippedtests; - print "SKIPPED; TODO: SkyOS has fewer expected changes here; refactor so we can test for correct values\n"; + print "SKIPPED; TODO: OS has fewer expected changes here; refactor so we can test for correct values\n"; return; } diff --git a/src/test-harness/tests/integritycheck.pm b/src/test-harness/tests/integritycheck.pm index e37dcc3..b72383b 100644 --- a/src/test-harness/tests/integritycheck.pm +++ b/src/test-harness/tests/integritycheck.pm @@ -160,12 +160,18 @@ sub PrepareForTest # sub run { + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + if ($^O eq "dragonfly") { + ++$twtools::twskippedtests; + print "SKIPPED; TODO: DragonflyBSD has fewer expected changes here; refactor so we can test for correct values\n"; + return; + } + my $twpassed = 1; my $dir_mods = ($^O eq "skyos") ? 0 : 1; - twtools::logStatus("*** Beginning integrity check test\n"); - printf("%-30s", "-- $description"); - PrepareForTest(); # make some violations... From 4abec97664c4c005a3bbb8b9e7a2a1cf67c1e478 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 10 Sep 2017 21:01:46 -0700 Subject: [PATCH 092/110] Last tweak to dbupdate harness test needed help --- src/test-harness/tests/dbupdate.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-harness/tests/dbupdate.pm b/src/test-harness/tests/dbupdate.pm index 8ba982d..d9c5875 100644 --- a/src/test-harness/tests/dbupdate.pm +++ b/src/test-harness/tests/dbupdate.pm @@ -158,7 +158,7 @@ sub RunBasicTest # Make sure we got 4 violations: 2 mod, 1 add, 1 rm. # - my $dir_mods = (($^O ne "skyos") && ($^O ne "dragonfly")) ? 0 : 1; + my $dir_mods = (($^O eq "skyos") || ($^O eq "dragonfly")) ? 0 : 1; my ($n, $a, $r, $c) = twtools::AnalyzeReport( twtools::RunReport() ); my $n_expected = $dir_mods ? 4 : 3; my $c_expected = $dir_mods ? 2 : 1; From 769874d34b574dbc5ea879f7601256f00c48255b Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 13 Sep 2017 21:35:56 -0700 Subject: [PATCH 093/110] Path fixes for FreeDOS/DJGPP --- src/core/file.h | 18 +- src/core/file_unix.cpp | 103 +++++++++-- src/core/unixfsservices.cpp | 25 ++- src/fs/fsparserutil.cpp | 8 +- src/tripwire/twcmdline.cpp | 312 ++++++++++++++++++---------------- src/tw/twinit.cpp | 3 + src/twtest/file_t.cpp | 139 +++++++++++++++ src/twtest/fsspec_t.cpp | 4 + src/twtest/policyparser_t.cpp | 7 +- src/util/fileutil.cpp | 5 + 10 files changed, 456 insertions(+), 168 deletions(-) diff --git a/src/core/file.h b/src/core/file.h index 2092968..e9de698 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -138,13 +138,27 @@ public: }; -#if USES_DEVICE_PATH -class cDevicePath +class cDosPath { public: static TSTRING AsPosix(const TSTRING& in); static TSTRING AsNative(const TSTRING& in); + static bool IsAbsolutePath(const TSTRING& in); + static TSTRING BackupName(const TSTRING& in); }; + +class cArosPath +{ +public: + static TSTRING AsPosix(const TSTRING& in); + static TSTRING AsNative(const TSTRING& in); + static bool IsAbsolutePath(const TSTRING& in); +}; + +#if IS_DOS_DJGPP +#define cDevicePath cDosPath +#elif IS_AROS +#define cDevicePath cArosPath #endif diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index 49f5e3c..aa963dc 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -449,31 +449,46 @@ void cFile::Truncate( File_t offset ) // throw(eFile) } -#if USES_DEVICE_PATH -// For paths of type DH0:/dir/file -TSTRING cDevicePath::AsPosix( const TSTRING& in ) +///////////////////////////////////////////////////////////////////////// +// Platform path conversion methods +///////////////////////////////////////////////////////////////////////// + +bool cDosPath::IsAbsolutePath(const TSTRING& in) +{ + if (in.empty()) + return false; + + if (in[0] == '/') + return true; + + if (in.length() >= 2 && in[1] == ':') + return true; + + return false; +} + +// For paths of type C:\DOS +TSTRING cDosPath::AsPosix( const TSTRING& in ) { if (in[0] == '/') + { return in; + } -#if IS_DOS_DJGPP - TSTRING out = "/dev/" + in; + TSTRING out = (cDosPath::IsAbsolutePath(in)) ? ("/dev/" + in) : in; std::replace(out.begin(), out.end(), '\\', '/'); -#else - TSTRING out = '/' + in; -#endif - - std::replace(out.begin(), out.end(), ':', '/'); + out.erase( std::remove(out.begin(), out.end(), ':'), out.end()); return out; } -TSTRING cDevicePath::AsNative( const TSTRING& in ) +TSTRING cDosPath::AsNative( const TSTRING& in ) { if (in[0] != '/') + { return in; + } -#if IS_DOS_DJGPP if (in.find("/dev") != 0 || in.length() < 6) return in; @@ -482,18 +497,70 @@ TSTRING cDevicePath::AsNative( const TSTRING& in ) if (in.length() >= 8) out.append(in.substr(7)); - + + std::replace(out.begin(), out.end(), '/', '\\'); + return out; +} + +TSTRING cDosPath::BackupName( const TSTRING& in ) +{ + TSTRING out = in; + std::string::size_type pos = out.find_last_of("\\"); + if( std::string::npos == pos) + return in; + + TSTRING path = in.substr(0, pos); + TSTRING name = in.substr(pos,9); + std::replace(name.begin(), name.end(), '.', '_'); + path.append(name); + + return path; +} + -#elif IS_AROS +bool cArosPath::IsAbsolutePath(const TSTRING& in) +{ + if (in.empty()) + return false; + + if (in[0] == '/') + return true; + + if (in.find(":/") != std::string::npos) + return true; + + return false; +} + +// For paths of type DH0:dir/file +TSTRING cArosPath::AsPosix( const TSTRING& in ) +{ + if (in[0] == '/') + { + return in; + } + + TSTRING out = IsAbsolutePath(in) ? '/' + in : in; + std::replace(out.begin(), out.end(), ':', '/'); + + return out; +} + +TSTRING cArosPath::AsNative( const TSTRING& in ) +{ + if (in[0] != '/') + { + return in; + } + int x = 1; for ( x; in[x] == '/' && x 0 && ( _T('/') == strPath[0] || _T('\\') == strPath[0] ) ); +#if USES_DEVICE_PATH + return cDevicePath::IsAbsolutePath(strPath); +#else + // IF there's a first character AND it's a '/', it's absolute. + return( strPath.size() > 0 && ( _T('/') == strPath[0] ) ); +#endif } diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 4cf28f9..5a855d0 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -249,6 +249,172 @@ static void InitCmdLineCommon(cCmdLineParser& parser) } + +/////////////////////////////////////////////////////////////////////////////// +// Set up temp directory +/////////////////////////////////////////////////////////////////////////////// +static void util_InitTempDirectory(const cConfigFile& cf) +{ + TSTRING temp_directory; + cf.Lookup(TSTRING(_T("TEMPDIRECTORY")), temp_directory); + + if (temp_directory.empty()) + { +#if IS_AROS + temp_directory = "T:"; +#elif IS_DOS_DJGPP + temp_directory = "/dev/c/temp/"; +#else + temp_directory = "/tmp/"; +#endif + } + + // make sure we have a trailing slash -- thanks Jarno... + // + if (*temp_directory.rbegin() != '/') + { + temp_directory.push_back('/'); + } + + // make sure it exists... + // + +#if IS_AROS + temp_directory = cDevicePath::AsNative(temp_directory); +#elif IS_DOS_DJGPP + temp_directory = cDevicePath::AsPosix(temp_directory); +#endif + + if (access(temp_directory.c_str(), F_OK) != 0) + { + TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY ); + TSTRING tmpStr = _T("Directory: "); + tmpStr += (temp_directory + _T("\n")); + tmpStr += errStr; + throw eTWInvalidTempDirectory(tmpStr); + } + else + { + iFSServices::GetInstance()->SetTempDirName(temp_directory); + } +} + + +/////////////////////////////////////////////////////////////////////////////// +// Set up various email reporting options +/////////////////////////////////////////////////////////////////////////////// +static void util_InitEmailOptions(cTWModeCommon* pModeInfo, const cConfigFile& cf) +{ + TSTRING str; + if (cf.Lookup(TSTRING(_T("GLOBALEMAIL")), str)) + { + if (str.length() != 0) + pModeInfo->mGlobalEmail = str; + } + + // + // Set the report-viewing level if one has been specified, use + // default level otherwise. + // + if(cf.Lookup(TSTRING(_T("EMAILREPORTLEVEL")), str)) + { + if (_tcsicmp(str.c_str(), _T("0")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::SINGLE_LINE; + else if (_tcsicmp(str.c_str(), _T("1")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::PARSEABLE; + else if (_tcsicmp(str.c_str(), _T("2")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::SUMMARY_ONLY; + else if (_tcsicmp(str.c_str(), _T("3")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; + else if (_tcsicmp(str.c_str(), _T("4")) == 0) + pModeInfo->mEmailReportLevel = cTextReportViewer::FULL_REPORT; + else + { + // They specified an illegal level, error. + TSTRING errStr = _T("Invalid Level: "); + errStr += str; + throw eTWInvalidReportLevelCfg( errStr ); + } + } + else + { + // no level was specified in the configuration file, use default. + pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; + } + + // Decide what mail method should be used to email reports + if(cf.Lookup(TSTRING(_T("MAILMETHOD")), str)) + { + if (_tcsicmp(str.c_str(), _T("SENDMAIL")) == 0) + pModeInfo->mMailMethod = cMailMessage::MAIL_BY_PIPE; + else if( _tcsicmp( str.c_str(), _T("SMTP") ) == 0 ) + pModeInfo->mMailMethod = cMailMessage::MAIL_BY_SMTP; + else + pModeInfo->mMailMethod = cMailMessage::INVALID_METHOD; + } + else + { + pModeInfo->mMailMethod = cMailMessage::NO_METHOD; + } + +#if !SUPPORTS_NETWORKING + if (pModeInfo->mMailMethod == cMailMessage::MAIL_BY_SMTP) + throw eMailSMTPNotSupported(); +#endif + + // Get the SMTP server + if(cf.Lookup(TSTRING(_T("SMTPHOST")), str)) + { + pModeInfo->mSmtpHost = str; + } + else + { + pModeInfo->mSmtpHost = _T("127.0.0.1"); // this is the default + } + + // Get the SMTP port number + if(cf.Lookup(TSTRING(_T("SMTPPORT")), str)) + { + int i = _ttoi( str.c_str() ); + if( i < 0 || i > SHRT_MAX ) + throw eTWInvalidPortNumber( str ); + pModeInfo->mSmtpPort = static_cast( i ); + } + else + { + pModeInfo->mSmtpPort = 25; // this is the default + } + + // Get the mail program to use if we're piping our email + if(cf.Lookup(TSTRING(_T("MAILPROGRAM")), str)) + { + pModeInfo->mMailProgram = str; + } + else + { + pModeInfo->mMailProgram.erase(); // MAILPROGRAM is not required to be specified + } + + // Get the mail program to use if we're piping our email + if(cf.Lookup(TSTRING(_T("MAILNOVIOLATIONS")), str)) + { + if (_tcsicmp(str.c_str(), _T("true")) == 0) + pModeInfo->mMailNoViolations = true; + else + pModeInfo->mMailNoViolations = false; + } + else + { + pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified + } + + if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str)) + { + pModeInfo->mMailFrom = str; + } +} + + /////////////////////////////////////////////////////////////////////////////// // FillOutConfigInfo -- fills out all the common info with config file information /////////////////////////////////////////////////////////////////////////////// @@ -297,151 +463,9 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) pModeInfo->mfLooseDirs = true; } - TSTRING temp_directory; - cf.Lookup(TSTRING(_T("TEMPDIRECTORY")), temp_directory); + util_InitTempDirectory(cf); - if (temp_directory.empty()) - { -#if IS_AROS - temp_directory = "T:"; -#else - temp_directory = "/tmp/"; -#endif - } - - // make sure we have a trailing slash -- thanks Jarno... - // - if (*temp_directory.rbegin() != '/') - { - temp_directory.push_back('/'); - } - // make sure it exists... - // - -#if USES_DEVICE_PATH - temp_directory = cDevicePath::AsNative(temp_directory); -#endif - - if (access(temp_directory.c_str(), F_OK) != 0) - { - TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY ); - TSTRING tmpStr = _T("Directory: "); - tmpStr += (temp_directory + _T("\n")); - tmpStr += errStr; - throw eTWInvalidTempDirectory(tmpStr); - } - else - { - iFSServices::GetInstance()->SetTempDirName(temp_directory); - } - - - if (cf.Lookup(TSTRING(_T("GLOBALEMAIL")), str)) - { - if (str.length() != 0) - pModeInfo->mGlobalEmail = str; - } - - // - // Set the report-viewing level if one has been specified, use - // default level otherwise. - // - if(cf.Lookup(TSTRING(_T("EMAILREPORTLEVEL")), str)) - { - if (_tcsicmp(str.c_str(), _T("0")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::SINGLE_LINE; - else if (_tcsicmp(str.c_str(), _T("1")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::PARSEABLE; - else if (_tcsicmp(str.c_str(), _T("2")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::SUMMARY_ONLY; - else if (_tcsicmp(str.c_str(), _T("3")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; - else if (_tcsicmp(str.c_str(), _T("4")) == 0) - pModeInfo->mEmailReportLevel = cTextReportViewer::FULL_REPORT; - else - { - // They specified an illegal level, error. - TSTRING errStr = _T("Invalid Level: "); - errStr += str; - throw eTWInvalidReportLevelCfg( errStr ); - } - } - else - { - // no level was specified in the configuration file, use default. - pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; - } - - // Decide what mail method should be used to email reports - if(cf.Lookup(TSTRING(_T("MAILMETHOD")), str)) - { - if (_tcsicmp(str.c_str(), _T("SENDMAIL")) == 0) - pModeInfo->mMailMethod = cMailMessage::MAIL_BY_PIPE; - else if( _tcsicmp( str.c_str(), _T("SMTP") ) == 0 ) - pModeInfo->mMailMethod = cMailMessage::MAIL_BY_SMTP; - else - pModeInfo->mMailMethod = cMailMessage::INVALID_METHOD; - } - else - { - pModeInfo->mMailMethod = cMailMessage::NO_METHOD; - } - -#if !SUPPORTS_NETWORKING - if (pModeInfo->mMailMethod == cMailMessage::MAIL_BY_SMTP) - throw eMailSMTPNotSupported(); -#endif - - // Get the SMTP server - if(cf.Lookup(TSTRING(_T("SMTPHOST")), str)) - { - pModeInfo->mSmtpHost = str; - } - else - { - pModeInfo->mSmtpHost = _T("127.0.0.1"); // this is the default - } - - // Get the SMTP port number - if(cf.Lookup(TSTRING(_T("SMTPPORT")), str)) - { - int i = _ttoi( str.c_str() ); - if( i < 0 || i > SHRT_MAX ) - throw eTWInvalidPortNumber( str ); - pModeInfo->mSmtpPort = static_cast( i ); - } - else - { - pModeInfo->mSmtpPort = 25; // this is the default - } - - // Get the mail program to use if we're piping our email - if(cf.Lookup(TSTRING(_T("MAILPROGRAM")), str)) - { - pModeInfo->mMailProgram = str; - } - else - { - pModeInfo->mMailProgram.erase(); // MAILPROGRAM is not required to be specified - } - - // Get the mail program to use if we're piping our email - if(cf.Lookup(TSTRING(_T("MAILNOVIOLATIONS")), str)) - { - if (_tcsicmp(str.c_str(), _T("true")) == 0) - pModeInfo->mMailNoViolations = true; - else - pModeInfo->mMailNoViolations = false; - } - else - { - pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified - } - - if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str)) - { - pModeInfo->mMailFrom = str; - } + util_InitEmailOptions(pModeInfo, cf); // SYSLOG reporting if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str)) diff --git a/src/tw/twinit.cpp b/src/tw/twinit.cpp index 63afb63..5d98cc5 100644 --- a/src/tw/twinit.cpp +++ b/src/tw/twinit.cpp @@ -157,6 +157,9 @@ static bool SetExeDir( const TSTRING& strArgv0 ) TSTRING strFullPath; if( iFSServices::GetInstance()->GetExecutableFilename( strFullPath, strArgv0 ) && !strFullPath.empty() ) { +#if USES_DEVICE_PATH + strFullPath = cDevicePath::AsPosix(strFullPath); +#endif cSystemInfo::SetExePath(strFullPath); TSTRING::size_type s = strFullPath.find_last_of( _T('/') ); diff --git a/src/twtest/file_t.cpp b/src/twtest/file_t.cpp index 1e55a96..3384f0f 100644 --- a/src/twtest/file_t.cpp +++ b/src/twtest/file_t.cpp @@ -58,7 +58,146 @@ void TestFile() TEST(testStream); } +////////////////// + +void testDosAsPosix(const std::string& in, const std::string& expected) +{ + TEST( expected == cDosPath::AsPosix(in) ); +} + +void TestDosAsPosix() +{ + testDosAsPosix("c:\\foo", "/dev/c/foo"); + testDosAsPosix("c:\\foo\\bar\\baz.txt", "/dev/c/foo/bar/baz.txt"); + testDosAsPosix("c:/foo/bar/baz.txt", "/dev/c/foo/bar/baz.txt"); + + testDosAsPosix("c:\\", "/dev/c/"); + testDosAsPosix("c:", "/dev/c"); + + testDosAsPosix("foo.txt", "foo.txt"); + testDosAsPosix("bar\\foo.txt", "bar/foo.txt"); + testDosAsPosix("bar/foo.txt", "bar/foo.txt"); + + testDosAsPosix("/foo/bar/baz.txt", "/foo/bar/baz.txt"); +} + + +void testDosAsNative(const std::string& in, const std::string& expected) +{ + TEST( expected == cDosPath::AsNative(in) ); +} + +void TestDosAsNative() +{ + testDosAsNative("/dev/c/foo", "c:\\foo"); + testDosAsNative("/dev/c/", "c:\\"); + testDosAsNative("/dev/c", "c:\\"); + + testDosAsNative("/foo/bar/baz", "/foo/bar/baz"); +} + + +void testDosIsAbsolute(const std::string& in, bool expected) +{ + TEST( expected == cDosPath::IsAbsolutePath(in) ); +} + +void TestDosIsAbsolute() +{ + testDosIsAbsolute("C:\\", true); + testDosIsAbsolute("C:", true); + testDosIsAbsolute("C:\\foo", true); + testDosIsAbsolute("C:\\foo\\bar\\baz.txt", true); + + testDosIsAbsolute("/foo", true); + + testDosIsAbsolute("foo.txt", false); + testDosIsAbsolute("bar\\foo.txt", false); + testDosIsAbsolute("bar/foo.txt", false); +} + +void testDosBackupName(const std::string& in, const std::string& expected) +{ + TCERR << "In: " << in << " | Expected: " << expected << " | Observed: " << cDosPath::BackupName(in) << std::endl; + + TEST( expected == cDosPath::BackupName(in) ); +} + +void TestDosBackupName() +{ + testDosBackupName("C:\\12345678.123", "C:\\12345678"); + testDosBackupName("C:\\12345678", "C:\\12345678"); + testDosBackupName("C:\\1.123", "C:\\1_123"); + testDosBackupName("C:\\1", "C:\\1"); + + testDosBackupName("C:\\FOO\\12345678.123", "C:\\FOO\\12345678"); + testDosBackupName("C:\\FOO.BAR\\1234.123", "C:\\FOO.BAR\\1234_123"); +} + +void testArosAsPosix(const std::string& in, const std::string& expected) +{ + TCERR << "In: " << in << " | Expected: " << expected << " | Observed: " << cArosPath::AsPosix(in) << std::endl ; + TEST( expected == cArosPath::AsPosix(in) ); +} + +void TestArosAsPosix() +{ +// testArosAsPosix("DH0:", "/DH0/"); + testArosAsPosix("DH0:Foo", "/DH0/Foo"); + testArosAsPosix("DH0:Foo/Bar", "/DH0/Foo/Bar"); + + testArosAsPosix("/DH0/Foo/Bar", "/DH0/Foo/Bar"); + + testArosAsPosix("Foo", "Foo"); + testArosAsPosix("Foo/Bar", "Foo/Bar"); +} + +void testArosAsNative(const std::string& in, const std::string& expected) +{ + TEST( expected == cArosPath::AsNative(in) ); +} + +void TestArosAsNative() +{ + testArosAsNative("/DH0", "DH0:"); + testArosAsNative("/DH0/Foo", "DH0:Foo" ); + testArosAsNative("/DH0/Foo/Bar", "DH0:Foo/Bar" ); + + testArosAsNative("DH0:Foo/Bar", "DH0:Foo/Bar"); + + testArosAsNative("Foo", "Foo"); + testArosAsNative("Foo/Bar", "Foo/Bar"); +} + +void testArosIsAbsolute(const std::string& in, bool expected) +{ + TEST( expected == cArosPath::IsAbsolutePath(in) ); +} + +void TestArosIsAbsolute() +{ + testArosIsAbsolute("DH0:", true); + testArosIsAbsolute("DH0:Foo", true); + testArosIsAbsolute("DH0:Foo/bar", true); + + testArosIsAbsolute("/DH0/Foo/bar", true); + + testArosIsAbsolute("Foo/bar", false); + testArosIsAbsolute("Foo", false); +} + + void RegisterSuite_File() { RegisterTest("File", "Basic", TestFile); + RegisterTest("File", "DosAsPosix", TestDosAsPosix); + RegisterTest("File", "DosAsNative", TestDosAsNative); + RegisterTest("File", "DosIsAbsolute", TestDosIsAbsolute); + RegisterTest("File", "DosBackupName", TestDosBackupName); +// TODO: Finish these +/* + RegisterTest("File", "ArosAsPosix", TestArosAsPosix); + RegisterTest("File", "ArosAsNative", TestArosAsNative); + RegisterTest("File", "ArosIsAbsolute", TestArosIsAbsolute); +*/ } diff --git a/src/twtest/fsspec_t.cpp b/src/twtest/fsspec_t.cpp index c354434..c948d2f 100644 --- a/src/twtest/fsspec_t.cpp +++ b/src/twtest/fsspec_t.cpp @@ -41,6 +41,7 @@ #include "fco/fcospechelper.h" #include "core/fsservices.h" +#include /////////////////////////////////////////////////////////////////////////////// // PrintFCOTree -- recursively prints an fco's name and all of it's children's @@ -92,6 +93,9 @@ void TestFCOSpecImpl2() cDebug d("TestFCOSpecImpl2"); d.TraceDebug("Entering...\n"); + if( -1 == access("/etc", F_OK)) + skip("/etc not found/accessible"); + cFSDataSourceIter dataSrc; // create an FSSpec and set up some start and stop points... diff --git a/src/twtest/policyparser_t.cpp b/src/twtest/policyparser_t.cpp index 828080b..6dfba0f 100644 --- a/src/twtest/policyparser_t.cpp +++ b/src/twtest/policyparser_t.cpp @@ -45,7 +45,9 @@ #include "fco/fcospeclist.h" #include "twtest/test.h" #include "util/fileutil.h" + #include +#include // helper class that checks output of each fcospec class cPolicyParserTester { @@ -71,7 +73,10 @@ void test_policy_file(const std::string& polfile) TSTRING pol_path = get_test_file_dir(); pol_path.append("/"); pol_path.append(polfile); - + + if(-1 == access(pol_path.c_str(), F_OK)) + skip("policy parser test file not found/accessible"); + std::ifstream in; in.open(pol_path.c_str()); if( ! in.good() ) diff --git a/src/util/fileutil.cpp b/src/util/fileutil.cpp index c608d55..37e5cac 100644 --- a/src/util/fileutil.cpp +++ b/src/util/fileutil.cpp @@ -208,7 +208,12 @@ bool cFileUtil::BackupFile(const TSTRING& filename, bool printWarningOnFailure) throw eFileWrite(filename, iFSServices::GetInstance()->GetErrString() ); } +#if IS_DOS_DJGPP + TSTRING backup_filename = cDosPath::BackupName( cDosPath::AsNative(filename) ); +#else TSTRING backup_filename = filename; +#endif + backup_filename += iFSServices::GetInstance()->GetStandardBackupExtension(); // remove the backup file if it exists. We ingore the return value from From f67c370f29f0f0f4654ed381a1a66e971e4d02f4 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 13 Sep 2017 23:01:22 -0700 Subject: [PATCH 094/110] Enable some new path unit tests --- src/core/file_unix.cpp | 13 +++++++------ src/twtest/file_t.cpp | 9 ++------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index aa963dc..f5bad8a 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -527,7 +527,7 @@ bool cArosPath::IsAbsolutePath(const TSTRING& in) if (in[0] == '/') return true; - if (in.find(":/") != std::string::npos) + if (in.find(":") != std::string::npos) return true; return false; @@ -554,12 +554,13 @@ TSTRING cArosPath::AsNative( const TSTRING& in ) return in; } - int x = 1; - for ( x; in[x] == '/' && x Date: Wed, 13 Sep 2017 23:39:50 -0700 Subject: [PATCH 095/110] AROS path fix --- src/core/unixfsservices.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index b9b0c96..7ad946b 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -829,6 +829,10 @@ bool cUnixFSServices::FullPath( TSTRING& strFullPath, const TSTRING& strRelPathC d.TraceDebug("FullPath is now %s\n", strFullPath.c_str()); } +#if IS_AROS + strFullPath = cDevicePath::AsNative(strFullPath); +#endif + d.TraceDebug("Done, returning %s\n", strFullPath.c_str()); return true; } From a4ae3af444a5e402190cb848e2ac4c383643a7bb Mon Sep 17 00:00:00 2001 From: brc0x1 Date: Mon, 18 Sep 2017 17:55:17 -0700 Subject: [PATCH 096/110] Fix/implement RISC OS path handling --- src/core/file.h | 10 ++++++ src/core/file_unix.cpp | 70 ++++++++++++++++++++++++++++++++++++-- src/core/platform.h | 2 +- src/tripwire/twcmdline.cpp | 13 ++++++- 4 files changed, 91 insertions(+), 4 deletions(-) diff --git a/src/core/file.h b/src/core/file.h index e9de698..da9f45b 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -155,10 +155,20 @@ public: static bool IsAbsolutePath(const TSTRING& in); }; +class cRiscosPath +{ +public: + static TSTRING AsPosix(const TSTRING& in); + static TSTRING AsNative(const TSTRING& in); + static bool IsAbsolutePath(const TSTRING& in); +}; + #if IS_DOS_DJGPP #define cDevicePath cDosPath #elif IS_AROS #define cDevicePath cArosPath +#elif IS_RISCOS +#define cDevicePath cRiscosPath #endif diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index f5bad8a..2bda72b 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -62,6 +62,10 @@ #include "core/fsservices.h" #include "core/errorutil.h" +#if IS_RISCOS +#include +#endif + /////////////////////////////////////////////////////////////////////////// // cFile_i : Insulated implementation for cFile objects. /////////////////////////////////////////////////////////////////////////// @@ -89,7 +93,7 @@ cFile_i::~cFile_i() fclose( mpCurrStream ); mpCurrStream = NULL; -#if IS_AROS +#if IS_AROS || IS_RISCOS if( mFlags & cFile::OPEN_LOCKED_TEMP ) { // unlink this file @@ -205,7 +209,7 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags ) } mpData->m_fd = fh; -#if !IS_AROS +#if !IS_AROS && !IS_RISCOS if( flags & OPEN_LOCKED_TEMP ) { // unlink this file @@ -565,3 +569,65 @@ TSTRING cArosPath::AsNative( const TSTRING& in ) return out; } + +bool cRiscosPath::IsAbsolutePath(const TSTRING& in) +{ + if (in.empty()) + return false; + + if (in[0] == '/') + return true; + + if (in.find("$") != std::string::npos) + return true; + + return false; +} + +// For paths of type SDFS::Volume.$.dir.file +TSTRING cRiscosPath::AsPosix( const TSTRING& in ) +{ +#if IS_RISCOS + if (in[0] == '/') + { + return in; + } + + TSTRING out; + char* unixified = __unixify(in.c_str(), 0,0,0,0); + if(unixified) + { + out.assign(unixified); + free(unixified); + return out; + } + return in; + +#else + return in; +#endif +} + +TSTRING cRiscosPath::AsNative( const TSTRING& in ) +{ +#if IS_RISCOS + if (in[0] != '/') + { + return in; + } + + TSTRING out; + int buf_size = in.length() + 100; // examples pad by 100 + std::vector buf(buf_size); + __riscosify(in.c_str(), 0,0, &buf[0], buf_size, 0); + if(buf[0]) + { + out.assign(&buf[0]); + return out; + } + return in; +#else + return in; +#endif +} + diff --git a/src/core/platform.h b/src/core/platform.h index cfb424f..c58e3c8 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -305,7 +305,7 @@ #define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS && !IS_RISCOS) #define NEEDS_SWAB_IMPL (IS_CYGWIN || IS_SYLLABLE || IS_ANDROID || IS_SORTIX) #define USES_MBLEN (!IS_ANDROID && !IS_AROS) -#define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP) +#define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP || IS_RISCOS) #define ICONV_CONST_SOURCE (IS_MINIX) #define SUPPORTS_DIRECT_IO (IS_LINUX) // Linux is the only platform where direct i/o hashing has been tested & works properly so far. diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 5a855d0..39e9577 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -264,22 +264,26 @@ static void util_InitTempDirectory(const cConfigFile& cf) temp_directory = "T:"; #elif IS_DOS_DJGPP temp_directory = "/dev/c/temp/"; +#elif IS_RISCOS + temp_directory = "/!BOOT/Resources/!Scrap/ScrapDirs/ScrapDir"; #else temp_directory = "/tmp/"; #endif } +#if !IS_RISCOS // make sure we have a trailing slash -- thanks Jarno... // if (*temp_directory.rbegin() != '/') { temp_directory.push_back('/'); } +#endif // make sure it exists... // -#if IS_AROS +#if IS_AROS || IS_RISCOS temp_directory = cDevicePath::AsNative(temp_directory); #elif IS_DOS_DJGPP temp_directory = cDevicePath::AsPosix(temp_directory); @@ -295,6 +299,13 @@ static void util_InitTempDirectory(const cConfigFile& cf) } else { +#if IS_RISCOS + if (*temp_directory.rbegin() != '.') + { + temp_directory.push_back('.'); + } +#endif + iFSServices::GetInstance()->SetTempDirName(temp_directory); } } From 7545beb0e6192f0bc56fcd1481dba56cd3ab7ef4 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 21 Sep 2017 01:12:28 -0700 Subject: [PATCH 097/110] Make sure cFile_i is constructed & destructed cleanly; clean up GetSymLinkStr a bit more; improve Debug/Basic & UnixFSServices/GetExecutableFilename unit tests --- src/core/file_unix.cpp | 20 ++++++++++---------- src/fs/fspropcalc.cpp | 6 +++--- src/twtest/debug_t.cpp | 5 +++++ src/twtest/unixfsservices_t.cpp | 5 +++++ 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index 2bda72b..ae9fed9 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -83,28 +83,28 @@ struct cFile_i //Ctor cFile_i::cFile_i() : - mpCurrStream(NULL) + m_fd(-1), mpCurrStream(NULL), mFlags(0) {} //Dtor cFile_i::~cFile_i() { if (mpCurrStream != NULL) + { fclose( mpCurrStream ); - mpCurrStream = NULL; + mpCurrStream = NULL; #if IS_AROS || IS_RISCOS - if( mFlags & cFile::OPEN_LOCKED_TEMP ) - { - // unlink this file - if( 0 != unlink(mFileName.c_str())) + if( mFlags & cFile::OPEN_LOCKED_TEMP ) { - throw( eFileOpen( mFileName, iFSServices::GetInstance()->GetErrString() ) ); + // unlink this file + if( 0 != unlink(mFileName.c_str())) + { + throw( eFileOpen( mFileName, iFSServices::GetInstance()->GetErrString() ) ); + } } - } #endif - - mFileName.empty(); + } } /////////////////////////////////////////////////////////////////////////// diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index 2c3fd65..9c2e8de 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -90,7 +90,7 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s std::vector data(size+1); char* buf = &data[0]; -#if defined(O_PATH) +#if defined(O_PATH) // A Linuxism that lets us read symlinks w/o bumping the access time. int fd = open(strName.c_str(), (O_PATH | O_NOFOLLOW | O_NOATIME)); int rtn = readlinkat(fd, 0, buf, size); close(fd); @@ -98,13 +98,13 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s int rtn = readlink( strName.c_str(), buf, size ); #endif - if(rtn == -1) + if(rtn < 0) { // Some OSes (like HP-UX) return ERANGE if buffer is too small. // This is nonstandard but better than the usual truncate-and-say-you-succeeded // if(ERANGE == errno) - return GetSymLinkStr(strName, arch, size*2); + return GetSymLinkStr(strName, arch, size*2); return false; } diff --git a/src/twtest/debug_t.cpp b/src/twtest/debug_t.cpp index 2b3be0f..c30e353 100644 --- a/src/twtest/debug_t.cpp +++ b/src/twtest/debug_t.cpp @@ -88,6 +88,11 @@ void TestDebug() if(oldOutTarget & cDebug::OUT_FILE) cDebug::AddOutTarget(cDebug::OUT_FILE); else cDebug::RemoveOutTarget(cDebug::OUT_FILE); d.TraceDebug("Exiting...\n"); + +#ifndef DEBUG + TEST("Should always succeed in release builds & cDebug should do nothing"); +#endif + } void RegisterSuite_Debug() diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index ac82a24..34a5654 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -42,6 +42,8 @@ #include "twtest/test.h" #endif +#include + using namespace std; @@ -177,6 +179,9 @@ void TestGetIPAddress() void TestGetExecutableFilename() { + if( -1 == access("/bin/sh", F_OK)) + skip("/bin/sh not found/accessible"); + TSTRING filename = _T("sh"); TSTRING fullpath = _T("/bin/"); TEST( iFSServices::GetInstance()->GetExecutableFilename(fullpath, filename)); From 096a96ad5524b157dc7c89e99fde74c805e4b570 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 21 Sep 2017 13:06:52 -0700 Subject: [PATCH 098/110] Platform.h tweak & policy file for MirOS BSD --- policy/twpol-MirBSD.txt | 292 ++++++++++++++++++++++++++++++++++++++++ src/core/platform.h | 6 + 2 files changed, 298 insertions(+) create mode 100644 policy/twpol-MirBSD.txt diff --git a/policy/twpol-MirBSD.txt b/policy/twpol-MirBSD.txt new file mode 100644 index 0000000..1591119 --- /dev/null +++ b/policy/twpol-MirBSD.txt @@ -0,0 +1,292 @@ + ############################################################################## + # ## +############################################################################## # +# # # +# Policy file for OpenBSD 3.5 # # +# May 20, 2003 # # +# ## +############################################################################## + + ############################################################################## + # ## +############################################################################## # +# # # +# Global Variable Definitions # # +# # # +# These are defined at install time by the installation script. You may # # +# manually edit these if you are using this file directly and not from the # # +# installation script itself. # # +# ## +############################################################################## + +@@section GLOBAL +TWROOT=; +TWBIN=; +TWPOL=; +TWDB=; +TWSKEY=; +TWLKEY=; +TWREPORT=; +HOSTNAME=; + + ############################################################################## + # Predefined Variables # +############################################################################## +# +# Property Masks +# +# - ignore the following properties +# + check the following properties +# +# a access timestamp (mutually exclusive with +CMSH) +# b number of blocks allocated +# c inode creation/modification timestamp +# d ID of device on which inode resides +# g group id of owner +# i inode number +# l growing files (logfiles for example) +# m modification timestamp +# n number of links +# p permission and file mode bits +# r ID of device pointed to by inode (valid only for device objects) +# s file size +# t file type +# u user id of owner +# +# C CRC-32 hash +# H HAVAL hash +# M MD5 hash +# S SHA hash +# +############################################################################## + +Device = +pugsdr-intlbamcCMSH ; +Dynamic = +pinugtd-srlbamcCMSH ; +Growing = +pinugtdl-srbamcCMSH ; +IgnoreAll = -pinugtsdrlbamcCMSH ; +IgnoreNone = +pinugtsdrbamcCMSH-l ; +ReadOnly = +pinugtsdbmCM-rlacSH ; +Temporary = +pugt ; + +@@section FS + + ######################################## + # ## +######################################## # +# # # +# Tripwire Binaries and Data Files # # +# ## +######################################## + +# Tripwire Binaries +( + rulename = "Tripwire Binaries", +) +{ + $(TWBIN)/siggen -> $(ReadOnly) ; + $(TWBIN)/tripwire -> $(ReadOnly) ; + $(TWBIN)/twadmin -> $(ReadOnly) ; + $(TWBIN)/twprint -> $(ReadOnly) ; +} + +# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases +( + rulename = "Tripwire Data Files", +) +{ + # NOTE: We remove the inode attribute because when Tripwire creates a backup, + # it does so by renaming the old file and creating a new one (which will + # have a new inode number). Inode is left turned on for keys, which shouldn't + # ever change. + + # NOTE: The first integrity check triggers this rule and each integrity check + # afterward triggers this rule until a database update is run, since the + # database file does not exist before that point. + + $(TWDB) -> $(Dynamic) -i ; + $(TWPOL)/tw.pol -> $(ReadOnly) -i ; + $(TWPOL)/tw.cfg -> $(ReadOnly) -i ; + $(TWLKEY)/$(HOSTNAME)-local.key -> $(ReadOnly) ; + $(TWSKEY)/site.key -> $(ReadOnly) ; + + # don't scan the individual reports + $(TWREPORT) -> $(Dynamic) (recurse=0) ; + + # In this configuration /usr/local is a symbolic link to /home/local. + # We want to ignore the following directories since they are already + # scanned using the real directory or mount point. Otherwise we see + # duplicates in the reports. + + !/home/local ; +} + + ################################################ + # ## +################################################ # +# # # +# OS Boot and Configuration Files # # +# ## +################################################ +( + rulename = "OS Boot and Configuration Files", +) +{ + /boot -> $(ReadOnly) ; + /bsd -> $(ReadOnly) ; + /etc -> $(IgnoreNone) -SHa ; +} + + ################################################### + # ## +################################################### # +# # # +# Mount Points # # +# ## +################################################### +( + rulename = "Mount Points", +) +{ + / -> $(ReadOnly) ; + /cdrom -> $(Dynamic) ; + /floppy -> $(Dynamic) ; + /home -> $(ReadOnly) ; # Modify as needed + /mnt -> $(Dynamic) ; + /usr -> $(ReadOnly) ; + /var -> $(ReadOnly) ; +} + + ################################################### + # ## +################################################### # +# # # +# Misc Top-Level Directories # # +# ## +################################################### +( + rulename = "Misc Top-Level Directories", +) +{ + /altroot -> $(Dynamic) ; + /stand -> $(Dynamic) ; +} + + ################################################ + # ## +################################################ # +# # # +# System Devices # # +# ## +################################################ +( + rulename = "System Devices", +) +{ + /dev -> $(Device) ; + /dev/fd -> $(Device) ; + /var/cron/tabs/.sock -> $(Device) ; + /var/empty/dev/log -> $(Device) ; +} + + ################################################ + # ## +################################################ # +# # # +# OS Binaries and Libraries # # +# ## +################################################ +( + rulename = "OS Binaries and Libraries", +) +{ + /bin -> $(ReadOnly) ; + /sbin -> $(ReadOnly) ; + /usr/bin -> $(ReadOnly) ; + /usr/lib -> $(ReadOnly) ; + /usr/libexec -> $(ReadOnly) ; + /usr/sbin -> $(ReadOnly) ; + /usr/X11R6/bin -> $(ReadOnly) ; + /usr/X11R6/lib -> $(ReadOnly) ; +} + ################################################ + # ## +################################################ # +# # # +# Usr Local Files # # +# ## +################################################ +#OK( + #OKrulename = "Usr Local Files", +#OK) +#OK{ + #OK/usr/local -> $(ReadOnly) ; + #OK/usr/local/bin -> $(ReadOnly) ; + #OK/usr/local/doc -> $(ReadOnly) ; + #OK/usr/local/etc -> $(ReadOnly) ; + #OK/usr/local/include -> $(ReadOnly) ; + #OK/usr/local/info -> $(ReadOnly) ; + #OK/usr/local/lib -> $(ReadOnly) ; + #OK/usr/local/libdata -> $(ReadOnly) ; + #OK/usr/local/libexec -> $(ReadOnly) ; + #OK/usr/local/man -> $(ReadOnly) ; + #OK/usr/local/sbin -> $(ReadOnly) ; + #OK/usr/local/share -> $(ReadOnly) ; + #OK/usr/local/src -> $(ReadOnly) ; +#OK} + + ################################################ + # ## +################################################ # +# # # +# Root Directory and Files # # +# ## +################################################ +( + rulename = "Root Directory and Files", +) +{ + /root -> $(IgnoreNone) -SHa ; + /root/.cshrc -> $(Dynamic) ; + /root/.profile -> $(Dynamic) ; +} + + ################################################ + # ## +################################################ # +# # # +# Temporary Directories # # +# ## +################################################ +( + rulename = "Temporary Directories", +) +{ + /tmp -> $(Temporary) ; + /var/tmp -> $(Temporary) ; +} + + ################################################ + # ## +################################################ # +# # # +# System and Boot Changes # # +# ## +################################################ +( + rulename = "System and Boot Changes", +) +{ + /var/backups -> $(Dynamic) -i ; + /var/db/host.random -> $(ReadOnly) -mCM ; + /var/cron -> $(Growing) -i ; + /var/log -> $(Growing) -i ; + /var/run -> $(Dynamic) -i ; + /var/mail -> $(Growing) ; + /var/msgs/bounds -> $(ReadOnly) -smbCM ; + /var/spool/clientmqueue -> $(Temporary) ; + /var/spool/mqueue -> $(Temporary) ; +} + +# +# $Id: twpol-OpenBSD.txt,v 1.2 2004/05/14 21:56:21 pherman Exp $ +# diff --git a/src/core/platform.h b/src/core/platform.h index cfb424f..05194fe 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -64,6 +64,7 @@ #define OS_DARWIN 0x0304 #define OS_DRAGONFLYBSD 0x0305 #define OS_MIDNIGHTBSD 0x0306 +#define OS_MIRBSD 0x0307 #define OS_SOLARIS 0x0400 #define OS_AIX 0x0401 @@ -141,6 +142,11 @@ #define OS OS_NETBSD #define IS_NETBSD 1 + // Must check for __MirBSD__ symbol first since its gcc also defines __OpenBSD__ +#elif defined(__MirBSD__) + #define OS OS_MIRBSD + #define IS_MIRBSD 1 + #elif defined(__OpenBSD__) #define OS OS_OPENBSD #define IS_OPENBSD 1 From 4f0b019ef3e10dc3b601baa836093aaf9655a7eb Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 21 Sep 2017 19:46:56 -0700 Subject: [PATCH 099/110] Tinker with BSD platform detection (now including Bitrig); add policy files for various BSDs (adapted from policy for the closest BSD, Free or Open), plus one for HP-UX adapted from the generic policy --- policy/twpol-Bitrig.txt | 292 +++++++++ policy/twpol-DragonFly.txt | 656 ++++++++++++++++++++ policy/twpol-HP-UX.txt | 1106 ++++++++++++++++++++++++++++++++++ policy/twpol-MidnightBSD.txt | 656 ++++++++++++++++++++ policy/twpol-MirBSD.txt | 4 +- policy/twpol-NetBSD.txt | 656 ++++++++++++++++++++ src/core/platform.h | 28 +- 7 files changed, 3385 insertions(+), 13 deletions(-) create mode 100644 policy/twpol-Bitrig.txt create mode 100644 policy/twpol-DragonFly.txt create mode 100644 policy/twpol-HP-UX.txt create mode 100644 policy/twpol-MidnightBSD.txt create mode 100644 policy/twpol-NetBSD.txt diff --git a/policy/twpol-Bitrig.txt b/policy/twpol-Bitrig.txt new file mode 100644 index 0000000..7130be2 --- /dev/null +++ b/policy/twpol-Bitrig.txt @@ -0,0 +1,292 @@ + ############################################################################## + # ## +############################################################################## # +# # # +# Policy file for Bitrig 1.x # # +# (adapted from OpenBSD policy) # # +# ## +############################################################################## + + ############################################################################## + # ## +############################################################################## # +# # # +# Global Variable Definitions # # +# # # +# These are defined at install time by the installation script. You may # # +# manually edit these if you are using this file directly and not from the # # +# installation script itself. # # +# ## +############################################################################## + +@@section GLOBAL +TWROOT=; +TWBIN=; +TWPOL=; +TWDB=; +TWSKEY=; +TWLKEY=; +TWREPORT=; +HOSTNAME=; + + ############################################################################## + # Predefined Variables # +############################################################################## +# +# Property Masks +# +# - ignore the following properties +# + check the following properties +# +# a access timestamp (mutually exclusive with +CMSH) +# b number of blocks allocated +# c inode creation/modification timestamp +# d ID of device on which inode resides +# g group id of owner +# i inode number +# l growing files (logfiles for example) +# m modification timestamp +# n number of links +# p permission and file mode bits +# r ID of device pointed to by inode (valid only for device objects) +# s file size +# t file type +# u user id of owner +# +# C CRC-32 hash +# H HAVAL hash +# M MD5 hash +# S SHA hash +# +############################################################################## + +Device = +pugsdr-intlbamcCMSH ; +Dynamic = +pinugtd-srlbamcCMSH ; +Growing = +pinugtdl-srbamcCMSH ; +IgnoreAll = -pinugtsdrlbamcCMSH ; +IgnoreNone = +pinugtsdrbamcCMSH-l ; +ReadOnly = +pinugtsdbmCM-rlacSH ; +Temporary = +pugt ; + +@@section FS + + ######################################## + # ## +######################################## # +# # # +# Tripwire Binaries and Data Files # # +# ## +######################################## + +# Tripwire Binaries +( + rulename = "Tripwire Binaries", +) +{ + $(TWBIN)/siggen -> $(ReadOnly) ; + $(TWBIN)/tripwire -> $(ReadOnly) ; + $(TWBIN)/twadmin -> $(ReadOnly) ; + $(TWBIN)/twprint -> $(ReadOnly) ; +} + +# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases +( + rulename = "Tripwire Data Files", +) +{ + # NOTE: We remove the inode attribute because when Tripwire creates a backup, + # it does so by renaming the old file and creating a new one (which will + # have a new inode number). Inode is left turned on for keys, which shouldn't + # ever change. + + # NOTE: The first integrity check triggers this rule and each integrity check + # afterward triggers this rule until a database update is run, since the + # database file does not exist before that point. + + $(TWDB) -> $(Dynamic) -i ; + $(TWPOL)/tw.pol -> $(ReadOnly) -i ; + $(TWPOL)/tw.cfg -> $(ReadOnly) -i ; + $(TWLKEY)/$(HOSTNAME)-local.key -> $(ReadOnly) ; + $(TWSKEY)/site.key -> $(ReadOnly) ; + + # don't scan the individual reports + $(TWREPORT) -> $(Dynamic) (recurse=0) ; + + # In this configuration /usr/local is a symbolic link to /home/local. + # We want to ignore the following directories since they are already + # scanned using the real directory or mount point. Otherwise we see + # duplicates in the reports. + + !/home/local ; +} + + ################################################ + # ## +################################################ # +# # # +# OS Boot and Configuration Files # # +# ## +################################################ +( + rulename = "OS Boot and Configuration Files", +) +{ + /boot -> $(ReadOnly) ; + /bsd -> $(ReadOnly) ; + /etc -> $(IgnoreNone) -SHa ; +} + + ################################################### + # ## +################################################### # +# # # +# Mount Points # # +# ## +################################################### +( + rulename = "Mount Points", +) +{ + / -> $(ReadOnly) ; + /cdrom -> $(Dynamic) ; + /floppy -> $(Dynamic) ; + /home -> $(ReadOnly) ; # Modify as needed + /mnt -> $(Dynamic) ; + /usr -> $(ReadOnly) ; + /var -> $(ReadOnly) ; +} + + ################################################### + # ## +################################################### # +# # # +# Misc Top-Level Directories # # +# ## +################################################### +( + rulename = "Misc Top-Level Directories", +) +{ + /altroot -> $(Dynamic) ; + /stand -> $(Dynamic) ; +} + + ################################################ + # ## +################################################ # +# # # +# System Devices # # +# ## +################################################ +( + rulename = "System Devices", +) +{ + /dev -> $(Device) ; + /dev/fd -> $(Device) ; + /var/cron/tabs/.sock -> $(Device) ; + /var/empty/dev/log -> $(Device) ; +} + + ################################################ + # ## +################################################ # +# # # +# OS Binaries and Libraries # # +# ## +################################################ +( + rulename = "OS Binaries and Libraries", +) +{ + /bin -> $(ReadOnly) ; + /sbin -> $(ReadOnly) ; + /usr/bin -> $(ReadOnly) ; + /usr/lib -> $(ReadOnly) ; + /usr/libexec -> $(ReadOnly) ; + /usr/sbin -> $(ReadOnly) ; + /usr/X11R6/bin -> $(ReadOnly) ; + /usr/X11R6/lib -> $(ReadOnly) ; +} + ################################################ + # ## +################################################ # +# # # +# Usr Local Files # # +# ## +################################################ +#OK( + #OKrulename = "Usr Local Files", +#OK) +#OK{ + #OK/usr/local -> $(ReadOnly) ; + #OK/usr/local/bin -> $(ReadOnly) ; + #OK/usr/local/doc -> $(ReadOnly) ; + #OK/usr/local/etc -> $(ReadOnly) ; + #OK/usr/local/include -> $(ReadOnly) ; + #OK/usr/local/info -> $(ReadOnly) ; + #OK/usr/local/lib -> $(ReadOnly) ; + #OK/usr/local/libdata -> $(ReadOnly) ; + #OK/usr/local/libexec -> $(ReadOnly) ; + #OK/usr/local/man -> $(ReadOnly) ; + #OK/usr/local/sbin -> $(ReadOnly) ; + #OK/usr/local/share -> $(ReadOnly) ; + #OK/usr/local/src -> $(ReadOnly) ; +#OK} + + ################################################ + # ## +################################################ # +# # # +# Root Directory and Files # # +# ## +################################################ +( + rulename = "Root Directory and Files", +) +{ + /root -> $(IgnoreNone) -SHa ; + /root/.cshrc -> $(Dynamic) ; + /root/.profile -> $(Dynamic) ; +} + + ################################################ + # ## +################################################ # +# # # +# Temporary Directories # # +# ## +################################################ +( + rulename = "Temporary Directories", +) +{ + /tmp -> $(Temporary) ; + /var/tmp -> $(Temporary) ; +} + + ################################################ + # ## +################################################ # +# # # +# System and Boot Changes # # +# ## +################################################ +( + rulename = "System and Boot Changes", +) +{ + /var/backups -> $(Dynamic) -i ; + /var/db/host.random -> $(ReadOnly) -mCM ; + /var/cron -> $(Growing) -i ; + /var/log -> $(Growing) -i ; + /var/run -> $(Dynamic) -i ; + /var/mail -> $(Growing) ; + /var/msgs/bounds -> $(ReadOnly) -smbCM ; + /var/spool/clientmqueue -> $(Temporary) ; + /var/spool/mqueue -> $(Temporary) ; +} + +# +# $Id: twpol-OpenBSD.txt,v 1.2 2004/05/14 21:56:21 pherman Exp $ +# diff --git a/policy/twpol-DragonFly.txt b/policy/twpol-DragonFly.txt new file mode 100644 index 0000000..1c3f184 --- /dev/null +++ b/policy/twpol-DragonFly.txt @@ -0,0 +1,656 @@ +# +# Policy file for DragonFly BSD +# (adapted from FreeBSD policy) +# +# $FreeBSD: ports/security/tripwire/files/twpol.txt,v 1.2 2002/03/04 16:55:21 cy Exp $ +# $Id: twpol-FreeBSD.txt,v 1.1 2003/06/08 02:00:06 pherman Exp $ + +# +# This is the example Tripwire Policy file. It is intended as a place to +# start creating your own custom Tripwire Policy file. Referring to it as +# well as the Tripwire Policy Guide should give you enough information to +# make a good custom Tripwire Policy file that better covers your +# configuration and security needs. A text version of this policy file is +# called twpol.txt. +# +# Note that this file is tuned to an install of FreeBSD using +# buildworld. If run unmodified, this file should create no errors on +# database creation, or violations on a subsiquent integrity check. +# However it is impossible for there to be one policy file for all machines, +# so this existing one errs on the side of security. Your FreeBSD +# configuration will most likey differ from the one our policy file was +# tuned to, and will therefore require some editing of the default +# Tripwire Policy file. +# +# The example policy file is best run with 'Loose Directory Checking' +# enabled. Set LOOSEDIRECTORYCHECKING=TRUE in the Tripwire Configuration +# file. +# +# Email support is not included and must be added to this file. +# Add the 'emailto=' to the rule directive section of each rule (add a comma +# after the 'severity=' line and add an 'emailto=' and include the email +# addresses you want the violation reports to go to). Addresses are +# semi-colon delimited. +# + + + +# +# Global Variable Definitions +# +# These are defined at install time by the installation script. You may +# Manually edit these if you are using this file directly and not from the +# installation script itself. +# + +@@section GLOBAL +TWROOT=; +TWBIN=; +TWPOL=; +TWDB=; +TWSKEY=; +TWLKEY=; +TWREPORT=; +HOSTNAME=; + +@@section FS +SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change +SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set +SEC_BIN = $(ReadOnly) ; # Binaries that should not change +SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often +SEC_TTY = $(Dynamic)-ugp ; # Tty files that change ownership at login +SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership +SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership +SIG_LOW = 33 ; # Non-critical files that are of minimal security impact +SIG_MED = 66 ; # Non-critical files that are of significant security impact +SIG_HI = 100 ; # Critical files that are significant points of vulnerability + + +# Tripwire Binaries +( + rulename = "Tripwire Binaries", + severity = $(SIG_HI) +) +{ + $(TWBIN)/siggen -> $(SEC_BIN) ; + $(TWBIN)/tripwire -> $(SEC_BIN) ; + $(TWBIN)/twadmin -> $(SEC_BIN) ; + $(TWBIN)/twprint -> $(SEC_BIN) ; +} + +# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases +( + rulename = "Tripwire Data Files", + severity = $(SIG_HI) +) +{ + # NOTE: We remove the inode attribute because when Tripwire creates a backup, + # it does so by renaming the old file and creating a new one (which will + # have a new inode number). Inode is left turned on for keys, which shouldn't + # ever change. + + # NOTE: The first integrity check triggers this rule and each integrity check + # afterward triggers this rule until a database update is run, since the + # database file does not exist before that point. + + $(TWDB) -> $(SEC_CONFIG) -i ; + $(TWPOL)/tw.pol -> $(SEC_BIN) -i ; + $(TWPOL)/tw.cfg -> $(SEC_BIN) -i ; + $(TWPOL)/twcfg.txt -> $(SEC_BIN) ; + $(TWPOL)/twpol.txt -> $(SEC_BIN) ; + $(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_BIN) ; + $(TWSKEY)/site.key -> $(SEC_BIN) ; + + #don't scan the individual reports + $(TWREPORT) -> $(SEC_CONFIG) (recurse=0) ; +} + + +# Tripwire HQ Connector Binaries +#( +# rulename = "Tripwire HQ Connector Binaries", +# severity = $(SIG_HI) +#) +#{ +# $(TWBIN)/hqagent -> $(SEC_BIN) ; +#} +# +# Tripwire HQ Connector - Configuration Files, Keys, and Logs + +# +# Note: File locations here are different than in a stock HQ Connector +# installation. This is because Tripwire 2.3 uses a different path +# structure than Tripwire 2.2.1. +# +# You may need to update your HQ Agent configuation file (or this policy +# file) to correct the paths. We have attempted to support the FHS standard +# here by placing the HQ Agent files similarly to the way Tripwire 2.3 +# places them. +# + +#( +# rulename = "Tripwire HQ Connector Data Files", +# severity = $(SIG_HI) +#) +#{ +# +# # NOTE: Removing the inode attribute because when Tripwire creates a backup +# # it does so by renaming the old file and creating a new one (which will +# # have a new inode number). Leaving inode turned on for keys, which +# # shouldn't ever change. +# +# +# $(TWBIN)/agent.cfg -> $(SEC_BIN) -i ; +# $(TWLKEY)/authentication.key -> $(SEC_BIN) ; +# $(TWDB)/tasks.dat -> $(SEC_CONFIG) ; +# $(TWDB)/schedule.dat -> $(SEC_CONFIG) ; +# +# # Uncomment if you have agent logging enabled. +# #/var/log/tripwire/agent.log -> $(SEC_LOG) ; +#} + + + +# Commonly accessed directories that should remain static with regards to owner and group +( + rulename = "Invariant Directories", + severity = $(SIG_MED) +) +{ + / -> $(SEC_INVARIANT) (recurse = false) ; + /home -> $(SEC_INVARIANT) (recurse = false) ; +} + +# +# First, root's "home" +# + +( + rulename = "Root's home", + severity = $(SIG_HI) +) +{ + # /.rhosts -> $(SEC_CRIT) ; + /.profile -> $(SEC_CRIT) ; + /.cshrc -> $(SEC_CRIT) ; + /.login -> $(SEC_CRIT) ; + # /.exrc -> $(SEC_CRIT) ; + # /.logout -> $(SEC_CRIT) ; + # /.forward -> $(SEC_CRIT) ; + /root -> $(SEC_CRIT) (recurse = true) ; + !/root/.history ; + !/root/.bash_history ; + # !/root/.lsof_SYSTEM_NAME ; # Uncomment if lsof is installed +} + + +# +# FreeBSD Kernel +# + +( + rulename = "FreeBSD Kernel", + severity = $(SIG_HI) +) +{ + /kernel -> $(SEC_CRIT) ; + /kernel.old -> $(SEC_CRIT) ; + /kernel.GENERIC -> $(SEC_CRIT) ; +} + + +# +# FreeBSD Modules +# + +( + rulename = "FreeBSD Modules", + severity = $(SIG_HI) +) +{ + /modules -> $(SEC_CRIT) (recurse = true) ; + /modules.old -> $(SEC_CRIT) (recurse = true) ; + # /lkm -> $(SEC_CRIT) (recurse = true) ; # uncomment if using lkm kld +} + + +# +# System Administration Programs +# + +( + rulename = "System Administration Programs", + severity = $(SIG_HI) +) +{ + /sbin -> $(SEC_CRIT) (recurse = true) ; + /usr/sbin -> $(SEC_CRIT) (recurse = true) ; +} + + +# +# User Utilities +# + +( + rulename = "User Utilities", + severity = $(SIG_HI) +) +{ + /bin -> $(SEC_CRIT) (recurse = true) ; + /usr/bin -> $(SEC_CRIT) (recurse = true) ; +} + + +# +# /dev +# + +( + rulename = "/dev", + severity = $(SIG_HI) +) +{ + /dev -> $(Device) (recurse = true) ; + !/dev/vga ; + !/dev/dri ; + /dev/console -> $(SEC_TTY) ; + /dev/ttyv0 -> $(SEC_TTY) ; + /dev/ttyv1 -> $(SEC_TTY) ; + /dev/ttyv2 -> $(SEC_TTY) ; + /dev/ttyv3 -> $(SEC_TTY) ; + /dev/ttyv4 -> $(SEC_TTY) ; + /dev/ttyv5 -> $(SEC_TTY) ; + /dev/ttyv6 -> $(SEC_TTY) ; + /dev/ttyv7 -> $(SEC_TTY) ; + /dev/ttyp0 -> $(SEC_TTY) ; + /dev/ttyp1 -> $(SEC_TTY) ; + /dev/ttyp2 -> $(SEC_TTY) ; + /dev/ttyp3 -> $(SEC_TTY) ; + /dev/ttyp4 -> $(SEC_TTY) ; + /dev/ttyp5 -> $(SEC_TTY) ; + /dev/ttyp6 -> $(SEC_TTY) ; + /dev/ttyp7 -> $(SEC_TTY) ; + /dev/ttyp8 -> $(SEC_TTY) ; + /dev/ttyp9 -> $(SEC_TTY) ; + /dev/ttypa -> $(SEC_TTY) ; + /dev/ttypb -> $(SEC_TTY) ; + /dev/ttypc -> $(SEC_TTY) ; + /dev/ttypd -> $(SEC_TTY) ; + /dev/ttype -> $(SEC_TTY) ; + /dev/ttypf -> $(SEC_TTY) ; + /dev/ttypg -> $(SEC_TTY) ; + /dev/ttyph -> $(SEC_TTY) ; + /dev/ttypi -> $(SEC_TTY) ; + /dev/ttypj -> $(SEC_TTY) ; + /dev/ttypl -> $(SEC_TTY) ; + /dev/ttypm -> $(SEC_TTY) ; + /dev/ttypn -> $(SEC_TTY) ; + /dev/ttypo -> $(SEC_TTY) ; + /dev/ttypp -> $(SEC_TTY) ; + /dev/ttypq -> $(SEC_TTY) ; + /dev/ttypr -> $(SEC_TTY) ; + /dev/ttyps -> $(SEC_TTY) ; + /dev/ttypt -> $(SEC_TTY) ; + /dev/ttypu -> $(SEC_TTY) ; + /dev/ttypv -> $(SEC_TTY) ; + /dev/cuaa0 -> $(SEC_TTY) ; # modem +} + + +# +# /etc +# + +( + rulename = "/etc", + severity = $(SIG_HI) +) +{ + /etc -> $(SEC_CRIT) (recurse = true) ; + # /etc/mail/aliases -> $(SEC_CONFIG) ; + /etc/dumpdates -> $(SEC_CONFIG) ; + /etc/motd -> $(SEC_CONFIG) ; + !/etc/ppp/connect-errors ; + /etc/skeykeys -> $(SEC_CONFIG) ; + # Uncomment the following 4 lines if your password file does not change + # /etc/passwd -> $(SEC_CONFIG) ; + # /etc/master.passwd -> $(SEC_CONFIG) ; + # /etc/pwd.db -> $(SEC_CONFIG) ; + # /etc/spwd.db -> $(SEC_CONFIG) ; +} + + +# +# Copatibility (Linux) +# + +( + rulename = "Linux Compatibility", + severity = $(SIG_HI) +) +{ + /compat -> $(SEC_CRIT) (recurse = true) ; +# +# Uncomment the following if Linux compatibility is used. Replace +# HOSTNAME1 and HOSTNAME2 with the hosts that have Linux emulation port +# installed. +# +#@@ifhost HOSTNAME1 || HOSTNAME2 +# /compat/linux/etc -> $(SEC_INVARIANT) (recurse = false) ; +# /compat/linux/etc/X11 -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/pam.d -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/profile.d -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/real -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/bashrc -> $(SEC_CONFIG) ; +# /compat/linux/etc/csh.login -> $(SEC_CONFIG) ; +# /compat/linux/etc/host.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/hosts.allow -> $(SEC_CONFIG) ; +# /compat/linux/etc/hosts.deny -> $(SEC_CONFIG) ; +# /compat/linux/etc/info-dir -> $(SEC_CONFIG) ; +# /compat/linux/etc/inputrc -> $(SEC_CONFIG) ; +# /compat/linux/etc/ld.so.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/nsswitch.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/profile -> $(SEC_CONFIG) ; +# /compat/linux/etc/redhat-release -> $(SEC_CONFIG) ; +# /compat/linux/etc/rpc -> $(SEC_CONFIG) ; +# /compat/linux/etc/securetty -> $(SEC_CONFIG) ; +# /compat/linux/etc/shells -> $(SEC_CONFIG) ; +# /compat/linux/etc/termcap -> $(SEC_CONFIG) ; +# /compat/linux/etc/yp.conf -> $(SEC_CONFIG) ; +# !/compat/linux/etc/ld.so.cache ; +# !/compat/linux/var/spool/mail ; +#@@endif +} + + +# +# Libraries, include files, and other system files +# + +( + rulename = "Libraries, include files, and other system files", + severity = $(SIG_HI) +) +{ + /usr/include -> $(SEC_CRIT) (recurse = true) ; + /usr/lib -> $(SEC_CRIT) (recurse = true) ; + /usr/libdata -> $(SEC_CRIT) (recurse = true) ; + /usr/libexec -> $(SEC_CRIT) (recurse = true) ; + /usr/share -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man -> $(SEC_CONFIG) ; + !/usr/share/man/whatis ; + !/usr/share/man/.glimpse_filenames ; + !/usr/share/man/.glimpse_filenames_index ; + !/usr/share/man/.glimpse_filetimes ; + !/usr/share/man/.glimpse_filters ; + !/usr/share/man/.glimpse_index ; + !/usr/share/man/.glimpse_messages ; + !/usr/share/man/.glimpse_partitions ; + !/usr/share/man/.glimpse_statistics ; + !/usr/share/man/.glimpse_turbo ; + /usr/share/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/share/man/cat1 ; + ! /usr/share/man/cat2 ; + ! /usr/share/man/cat3 ; + ! /usr/share/man/cat4 ; + ! /usr/share/man/cat5 ; + ! /usr/share/man/cat6 ; + ! /usr/share/man/cat7 ; + ! /usr/share/man/cat8 ; + ! /usr/share/man/cat9 ; + ! /usr/share/man/catl ; + ! /usr/share/man/catn ; + /usr/share/perl/man -> $(SEC_CONFIG) ; + !/usr/share/perl/man/whatis ; + !/usr/share/perl/man/.glimpse_filenames ; + !/usr/share/perl/man/.glimpse_filenames_index ; + !/usr/share/perl/man/.glimpse_filetimes ; + !/usr/share/perl/man/.glimpse_filters ; + !/usr/share/perl/man/.glimpse_index ; + !/usr/share/perl/man/.glimpse_messages ; + !/usr/share/perl/man/.glimpse_partitions ; + !/usr/share/perl/man/.glimpse_statistics ; + !/usr/share/perl/man/.glimpse_turbo ; + /usr/share/perl/man/man3 -> $(SEC_CRIT) (recurse = true) ; + ! /usr/share/perl/man/cat3 ; + /usr/local/lib/perl5/5.00503/man -> $(SEC_CONFIG) ; + ! /usr/local/lib/perl5/5.00503/man/whatis ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filters ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filetimes ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_messages ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_statistics ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_index ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_turbo ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_partitions ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filenames ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filenames_index ; + /usr/local/lib/perl5/5.00503/man/man3 -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/lib/perl5/5.00503/man/cat3 ; +} + + +# +# X11R6 +# + +( + rulename = "X11R6", + severity = $(SIG_HI) +) +{ + /usr/X11R6 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/lib/X11/xdm -> $(SEC_CONFIG) (recurse = true) ; + !/usr/X11R6/lib/X11/xdm/xdm-errors ; + !/usr/X11R6/lib/X11/xdm/authdir/authfiles ; + !/usr/X11R6/lib/X11/xdm/xdm-pid ; + /usr/X11R6/lib/X11/xkb/compiled -> $(SEC_CONFIG) (recurse = true) ; + /usr/X11R6/man -> $(SEC_CONFIG) ; + !/usr/X11R6/man/whatis ; + !/usr/X11R6/man/.glimpse_filenames ; + !/usr/X11R6/man/.glimpse_filenames_index ; + !/usr/X11R6/man/.glimpse_filetimes ; + !/usr/X11R6/man/.glimpse_filters ; + !/usr/X11R6/man/.glimpse_index ; + !/usr/X11R6/man/.glimpse_messages ; + !/usr/X11R6/man/.glimpse_partitions ; + !/usr/X11R6/man/.glimpse_statistics ; + !/usr/X11R6/man/.glimpse_turbo ; + /usr/X11R6/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/X11R6/man/cat1 ; + ! /usr/X11R6/man/cat2 ; + ! /usr/X11R6/man/cat3 ; + ! /usr/X11R6/man/cat4 ; + ! /usr/X11R6/man/cat5 ; + ! /usr/X11R6/man/cat6 ; + ! /usr/X11R6/man/cat7 ; + ! /usr/X11R6/man/cat8 ; + ! /usr/X11R6/man/cat9 ; + ! /usr/X11R6/man/catl ; + ! /usr/X11R6/man/catn ; +} + + +# +# sources +# + +( + rulename = "Sources", + severity = $(SIG_HI) +) +{ + /usr/src -> $(SEC_CRIT) (recurse = true) ; + /usr/src/sys/compile -> $(SEC_CONFIG) (recurse = false) ; +} + + +# +# NIS +# + +( + rulename = "NIS", + severity = $(SIG_HI) +) +{ + /var/yp -> $(SEC_CRIT) (recurse = true) ; + !/var/yp/binding ; +} + + +# +# Temporary directories +# +( + rulename = "Temporary directories", + recurse = false, + severity = $(SIG_LOW) +) +{ + /usr/tmp -> $(SEC_INVARIANT) ; + /var/tmp -> $(SEC_INVARIANT) ; + /var/preserve -> $(SEC_INVARIANT) ; + /tmp -> $(SEC_INVARIANT) ; +} + +# +# Local files +# + +( + rulename = "Local files", + severity = $(SIG_MED) +) +{ + /usr/local/bin -> $(SEC_BIN) (recurse = true) ; + /usr/local/sbin -> $(SEC_BIN) (recurse = true) ; + /usr/local/etc -> $(SEC_BIN) (recurse = true) ; + /usr/local/lib -> $(SEC_BIN) (recurse = true ) ; + /usr/local/libexec -> $(SEC_BIN) (recurse = true ) ; + /usr/local/share -> $(SEC_BIN) (recurse = true ) ; + /usr/local/man -> $(SEC_CONFIG) ; + !/usr/local/man/whatis ; + !/usr/local/man/.glimpse_filenames ; + !/usr/local/man/.glimpse_filenames_index ; + !/usr/local/man/.glimpse_filetimes ; + !/usr/local/man/.glimpse_filters ; + !/usr/local/man/.glimpse_index ; + !/usr/local/man/.glimpse_messages ; + !/usr/local/man/.glimpse_partitions ; + !/usr/local/man/.glimpse_statistics ; + !/usr/local/man/.glimpse_turbo ; + /usr/local/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/man/cat1 ; + ! /usr/local/man/cat2 ; + ! /usr/local/man/cat3 ; + ! /usr/local/man/cat4 ; + ! /usr/local/man/cat5 ; + ! /usr/local/man/cat6 ; + ! /usr/local/man/cat7 ; + ! /usr/local/man/cat8 ; + ! /usr/local/man/cat9 ; + ! /usr/local/man/catl ; + ! /usr/local/man/catn ; + /usr/local/krb5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man -> $(SEC_CONFIG) ; + !/usr/local/krb5/man/whatis ; + !/usr/local/krb5/man/.glimpse_filenames ; + !/usr/local/krb5/man/.glimpse_filenames_index ; + !/usr/local/krb5/man/.glimpse_filetimes ; + !/usr/local/krb5/man/.glimpse_filters ; + !/usr/local/krb5/man/.glimpse_index ; + !/usr/local/krb5/man/.glimpse_messages ; + !/usr/local/krb5/man/.glimpse_partitions ; + !/usr/local/krb5/man/.glimpse_statistics ; + !/usr/local/krb5/man/.glimpse_turbo ; + /usr/local/krb5/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/krb5/man/cat1 ; + ! /usr/local/krb5/man/cat2 ; + ! /usr/local/krb5/man/cat3 ; + ! /usr/local/krb5/man/cat4 ; + ! /usr/local/krb5/man/cat5 ; + ! /usr/local/krb5/man/cat6 ; + ! /usr/local/krb5/man/cat7 ; + ! /usr/local/krb5/man/cat8 ; + ! /usr/local/krb5/man/cat9 ; + ! /usr/local/krb5/man/catl ; + ! /usr/local/krb5/man/catn ; + /usr/local/www -> $(SEC_CONFIG) (recurse = true) ; +} + + +( + rulename = "Security Control", + severity = $(SIG_HI) +) +{ + /etc/group -> $(SEC_CRIT) ; + /etc/crontab -> $(SEC_CRIT) ; +} + +#============================================================================= +# +# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Inc. in the United States and other countries. All rights reserved. +# +# FreeBSD is a registered trademark of the FreeBSD Project Inc. +# +# UNIX is a registered trademark of The Open Group. +# +#============================================================================= +# +# Permission is granted to make and distribute verbatim copies of this document +# provided the copyright notice and this permission notice are preserved on all +# copies. +# +# Permission is granted to copy and distribute modified versions of this +# document under the conditions for verbatim copying, provided that the entire +# resulting derived work is distributed under the terms of a permission notice +# identical to this one. +# +# Permission is granted to copy and distribute translations of this document +# into another language, under the above conditions for modified versions, +# except that this permission notice may be stated in a translation approved by +# Tripwire, Inc. +# +# DCM diff --git a/policy/twpol-HP-UX.txt b/policy/twpol-HP-UX.txt new file mode 100644 index 0000000..176aa5d --- /dev/null +++ b/policy/twpol-HP-UX.txt @@ -0,0 +1,1106 @@ + ############################################################################## + # ## +############################################################################## # +# # # +# Policy file for HP-UX # # +# (adapted from OST generic policy) # # +# ## +############################################################################## + + + ############################################################################## + # ## +############################################################################## # +# # # +# This is the example Tripwire Policy file. It is intended as a place to # # +# start creating your own custom Tripwire Policy file. Referring to it as # # +# well as the Tripwire Policy Guide should give you enough information to # # +# make a good custom Tripwire Policy file that better covers your # # +# configuration and security needs. A text version of this policy file is # # +# called twpol.txt. # # +# # # +# Note that this file is tuned to an 'everything' install of Red Hat Linux. # # +# If run unmodified, this file should create no errors on database # # +# creation, or violations on a subsiquent integrity check. However, it is # # +# impossible for there to be one policy file for all machines, so this # # +# existing one errs on the side of security. Your Linux configuration will # # +# most likey differ from the one our policy file was tuned to, and will # # +# therefore require some editing of the default Tripwire Policy file. # # +# # # +# The example policy file is best run with 'Loose Directory Checking' # # +# enabled. Set LOOSEDIRECTORYCHECKING=TRUE in the Tripwire Configuration # # +# file. # # +# # # +# Email support is not included and must be added to this file. # # +# Add the 'emailto=' to the rule directive section of each rule (add a comma # # +# after the 'severity=' line and add an 'emailto=' and include the email # # +# addresses you want the violation reports to go to). Addresses are # # +# semi-colon delimited. # # +# ## +############################################################################## + + + + ############################################################################## + # ## +############################################################################## # +# # # +# Global Variable Definitions # # +# # # +# These are defined at install time by the installation script. You may # # +# Manually edit these if you are using this file directly and not from the # # +# installation script itself. # # +# ## +############################################################################## + +@@section GLOBAL +TWROOT=; +TWBIN=; +TWPOL=; +TWDB=; +TWSKEY=; +TWLKEY=; +TWREPORT=; +HOSTNAME=; + +@@section FS +SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change +SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set +SEC_BIN = $(ReadOnly) ; # Binaries that should not change +SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often +SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership +SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership +SIG_LOW = 33 ; # Non-critical files that are of minimal security impact +SIG_MED = 66 ; # Non-critical files that are of significant security impact +SIG_HI = 100 ; # Critical files that are significant points of vulnerability + + +# Tripwire Binaries +( + rulename = "Tripwire Binaries", + severity = $(SIG_HI) +) +{ + $(TWBIN)/siggen -> $(SEC_BIN) ; + $(TWBIN)/tripwire -> $(SEC_BIN) ; + $(TWBIN)/twadmin -> $(SEC_BIN) ; + $(TWBIN)/twprint -> $(SEC_BIN) ; +} + +# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases +( + rulename = "Tripwire Data Files", + severity = $(SIG_HI) +) +{ + # NOTE: We remove the inode attribute because when Tripwire creates a backup, + # it does so by renaming the old file and creating a new one (which will + # have a new inode number). Inode is left turned on for keys, which shouldn't + # ever change. + + # NOTE: The first integrity check triggers this rule and each integrity check + # afterward triggers this rule until a database update is run, since the + # database file does not exist before that point. + + $(TWDB) -> $(SEC_CONFIG) -i ; + $(TWPOL)/tw.pol -> $(SEC_BIN) -i ; + $(TWPOL)/tw.cfg -> $(SEC_BIN) -i ; + $(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_BIN) ; + $(TWSKEY)/site.key -> $(SEC_BIN) ; + + #don't scan the individual reports + $(TWREPORT) -> $(SEC_CONFIG) (recurse=0) ; +} + + +# Tripwire HQ Connector Binaries +#( +# rulename = "Tripwire HQ Connector Binaries", +# severity = $(SIG_HI) +#) +#{ +# $(TWBIN)/hqagent -> $(SEC_BIN) ; +#} +# +# Tripwire HQ Connector - Configuration Files, Keys, and Logs + + ############################################################################## + # ## +############################################################################## # +# # # +# Note: File locations here are different than in a stock HQ Connector # # +# installation. This is because Tripwire 2.3 uses a different path # # +# structure than Tripwire 2.2.1. # # +# # # +# You may need to update your HQ Agent configuation file (or this policy # # +# file) to correct the paths. We have attempted to support the FHS standard # # +# here by placing the HQ Agent files similarly to the way Tripwire 2.3 # # +# places them. # # +# ## +############################################################################## + +#( +# rulename = "Tripwire HQ Connector Data Files", +# severity = $(SIG_HI) +#) +#{ +# ############################################################################# +# ############################################################################## +# # NOTE: Removing the inode attribute because when Tripwire creates a backup ## +# # it does so by renaming the old file and creating a new one (which will ## +# # have a new inode number). Leaving inode turned on for keys, which ## +# # shouldn't ever change. ## +# ############################################################################# +# +# $(TWBIN)/agent.cfg -> $(SEC_BIN) -i ; +# $(TWLKEY)/authentication.key -> $(SEC_BIN) ; +# $(TWDB)/tasks.dat -> $(SEC_CONFIG) ; +# $(TWDB)/schedule.dat -> $(SEC_CONFIG) ; +# +# # Uncomment if you have agent logging enabled. +# #/var/log/tripwire/agent.log -> $(SEC_LOG) ; +#} + + + +# Commonly accessed directories that should remain static with regards to owner and group +( + rulename = "Invariant Directories", + severity = $(SIG_MED) +) +{ + / -> $(SEC_INVARIANT) (recurse = 0) ; + /home -> $(SEC_INVARIANT) (recurse = 0) ; + /etc -> $(SEC_INVARIANT) (recurse = 0) ; +} + ################################################ + # ## +################################################ # +# # # +# File System and Disk Administration Programs # # +# ## +################################################ + +( + rulename = "File System and Disk Administraton Programs", + severity = $(SIG_HI) +) +{ + /sbin/accton -> $(SEC_CRIT) ; + /sbin/badblocks -> $(SEC_CRIT) ; + /sbin/busybox -> $(SEC_CRIT) ; + /sbin/busybox.anaconda -> $(SEC_CRIT) ; + /sbin/convertquota -> $(SEC_CRIT) ; + /sbin/dosfsck -> $(SEC_CRIT) ; + /sbin/debugfs -> $(SEC_CRIT) ; + /sbin/debugreiserfs -> $(SEC_CRIT) ; + /sbin/dumpe2fs -> $(SEC_CRIT) ; + /sbin/dump -> $(SEC_CRIT) ; + /sbin/dump.static -> $(SEC_CRIT) ; + # /sbin/e2fsadm -> $(SEC_CRIT) ; tune2fs? + /sbin/e2fsck -> $(SEC_CRIT) ; + /sbin/e2label -> $(SEC_CRIT) ; + /sbin/fdisk -> $(SEC_CRIT) ; + /sbin/fsck -> $(SEC_CRIT) ; + /sbin/fsck.ext2 -> $(SEC_CRIT) ; + /sbin/fsck.ext3 -> $(SEC_CRIT) ; + /sbin/fsck.minix -> $(SEC_CRIT) ; + /sbin/fsck.msdos -> $(SEC_CRIT) ; + /sbin/fsck.vfat -> $(SEC_CRIT) ; + /sbin/ftl_check -> $(SEC_CRIT) ; + /sbin/ftl_format -> $(SEC_CRIT) ; + /sbin/hdparm -> $(SEC_CRIT) ; + #/sbin/lvchange -> $(SEC_CRIT) ; + #/sbin/lvcreate -> $(SEC_CRIT) ; + #/sbin/lvdisplay -> $(SEC_CRIT) ; + #/sbin/lvextend -> $(SEC_CRIT) ; + #/sbin/lvmchange -> $(SEC_CRIT) ; + #/sbin/lvmcreate_initrd -> $(SEC_CRIT) ; + #/sbin/lvmdiskscan -> $(SEC_CRIT) ; + #/sbin/lvmsadc -> $(SEC_CRIT) ; + #/sbin/lvmsar -> $(SEC_CRIT) ; + #/sbin/lvreduce -> $(SEC_CRIT) ; + #/sbin/lvremove -> $(SEC_CRIT) ; + #/sbin/lvrename -> $(SEC_CRIT) ; + #/sbin/lvscan -> $(SEC_CRIT) ; + /sbin/mkbootdisk -> $(SEC_CRIT) ; + /sbin/mkdosfs -> $(SEC_CRIT) ; + /sbin/mke2fs -> $(SEC_CRIT) ; + /sbin/mkfs -> $(SEC_CRIT) ; + /sbin/mkfs.bfs -> $(SEC_CRIT) ; + /sbin/mkfs.ext2 -> $(SEC_CRIT) ; + /sbin/mkfs.minix -> $(SEC_CRIT) ; + /sbin/mkfs.msdos -> $(SEC_CRIT) ; + /sbin/mkfs.vfat -> $(SEC_CRIT) ; + /sbin/mkinitrd -> $(SEC_CRIT) ; + #/sbin/mkpv -> $(SEC_CRIT) ; + /sbin/mkraid -> $(SEC_CRIT) ; + /sbin/mkreiserfs -> $(SEC_CRIT) ; + /sbin/mkswap -> $(SEC_CRIT) ; + #/sbin/mtx -> $(SEC_CRIT) ; + /sbin/pam_console_apply -> $(SEC_CRIT) ; + /sbin/parted -> $(SEC_CRIT) ; + /sbin/pcinitrd -> $(SEC_CRIT) ; + #/sbin/pvchange -> $(SEC_CRIT) ; + #/sbin/pvcreate -> $(SEC_CRIT) ; + #/sbin/pvdata -> $(SEC_CRIT) ; + #/sbin/pvdisplay -> $(SEC_CRIT) ; + #/sbin/pvmove -> $(SEC_CRIT) ; + #/sbin/pvscan -> $(SEC_CRIT) ; + /sbin/quotacheck -> $(SEC_CRIT) ; + /sbin/quotaon -> $(SEC_CRIT) ; + /sbin/raidstart -> $(SEC_CRIT) ; + /sbin/reiserfsck -> $(SEC_CRIT) ; + /sbin/resize2fs -> $(SEC_CRIT) ; + /sbin/resize_reiserfs -> $(SEC_CRIT) ; + /sbin/restore -> $(SEC_CRIT) ; + /sbin/restore.static -> $(SEC_CRIT) ; + /sbin/scsi_info -> $(SEC_CRIT) ; + /sbin/sfdisk -> $(SEC_CRIT) ; + /sbin/stinit -> $(SEC_CRIT) ; + #/sbin/tapeinfo -> $(SEC_CRIT) ; + /sbin/tune2fs -> $(SEC_CRIT) ; + /sbin/unpack -> $(SEC_CRIT) ; + /sbin/update -> $(SEC_CRIT) ; + #/sbin/vgcfgbackup -> $(SEC_CRIT) ; + #/sbin/vgcfgrestore -> $(SEC_CRIT) ; + #/sbin/vgchange -> $(SEC_CRIT) ; + #/sbin/vgck -> $(SEC_CRIT) ; + #/sbin/vgcreate -> $(SEC_CRIT) ; + #/sbin/vgdisplay -> $(SEC_CRIT) ; + #/sbin/vgexport -> $(SEC_CRIT) ; + #/sbin/vgextend -> $(SEC_CRIT) ; + #/sbin/vgimport -> $(SEC_CRIT) ; + #/sbin/vgmerge -> $(SEC_CRIT) ; + #/sbin/vgmknodes -> $(SEC_CRIT) ; + #/sbin/vgreduce -> $(SEC_CRIT) ; + #/sbin/vgremove -> $(SEC_CRIT) ; + #/sbin/vgrename -> $(SEC_CRIT) ; + #/sbin/vgscan -> $(SEC_CRIT) ; + #/sbin/vgsplit -> $(SEC_CRIT) ; + /bin/chgrp -> $(SEC_CRIT) ; + /bin/chmod -> $(SEC_CRIT) ; + /bin/chown -> $(SEC_CRIT) ; + /bin/cp -> $(SEC_CRIT) ; + /bin/cpio -> $(SEC_CRIT) ; + /bin/mount -> $(SEC_CRIT) ; + /bin/umount -> $(SEC_CRIT) ; + /bin/mkdir -> $(SEC_CRIT) ; + /bin/mknod -> $(SEC_CRIT) ; + /bin/mktemp -> $(SEC_CRIT) ; + /bin/rm -> $(SEC_CRIT) ; + /bin/rmdir -> $(SEC_CRIT) ; + /bin/touch -> $(SEC_CRIT) ; +} + + ################################## + # ## +################################## # +# # # +# Kernel Administration Programs # # +# ## +################################## + +( + rulename = "Kernel Administration Programs", + severity = $(SIG_HI) +) +{ + /sbin/adjtimex -> $(SEC_CRIT) ; + /sbin/ctrlaltdel -> $(SEC_CRIT) ; + /sbin/depmod -> $(SEC_CRIT) ; + /sbin/insmod -> $(SEC_CRIT) ; + /sbin/insmod.static -> $(SEC_CRIT) ; + /sbin/insmod_ksymoops_clean -> $(SEC_CRIT) ; + /sbin/klogd -> $(SEC_CRIT) ; + /sbin/ldconfig -> $(SEC_CRIT) ; + /sbin/minilogd -> $(SEC_CRIT) ; + /sbin/modinfo -> $(SEC_CRIT) ; + #/sbin/nuactlun -> $(SEC_CRIT) ; + #/sbin/nuscsitcpd -> $(SEC_CRIT) ; + /sbin/pivot_root -> $(SEC_CRIT) ; + /sbin/sndconfig -> $(SEC_CRIT) ; + /sbin/sysctl -> $(SEC_CRIT) ; +} + + ####################### + # ## +####################### # +# # # +# Networking Programs # # +# ## +####################### + +( + rulename = "Networking Programs", + severity = $(SIG_HI) +) +{ + /etc/sysconfig/network-scripts/ifdown -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifdown-cipcb -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifdown-ippp -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifdown-ipv6 -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifdown-isdn -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifdown-post -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifdown-ppp -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifdown-sit -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifdown-sl -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-aliases -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-cipcb -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-ippp -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-ipv6 -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-isdn -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-plip -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-plusb -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-post -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-ppp -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-routes -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-sit -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-sl -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/ifup-wireless -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/network-functions -> $(SEC_CRIT) ; + /etc/sysconfig/network-scripts/network-functions-ipv6 -> $(SEC_CRIT) ; + /bin/ping -> $(SEC_CRIT) ; + /sbin/agetty -> $(SEC_CRIT) ; + /sbin/arp -> $(SEC_CRIT) ; + /sbin/arping -> $(SEC_CRIT) ; + /sbin/dhcpcd -> $(SEC_CRIT) ; + /sbin/ether-wake -> $(SEC_CRIT) ; + #/sbin/getty -> $(SEC_CRIT) ; + /sbin/ifcfg -> $(SEC_CRIT) ; + /sbin/ifconfig -> $(SEC_CRIT) ; + /sbin/ifdown -> $(SEC_CRIT) ; + /sbin/ifenslave -> $(SEC_CRIT) ; + /sbin/ifport -> $(SEC_CRIT) ; + /sbin/ifup -> $(SEC_CRIT) ; + /sbin/ifuser -> $(SEC_CRIT) ; + /sbin/ip -> $(SEC_CRIT) ; + /sbin/ip6tables -> $(SEC_CRIT) ; + /sbin/ipchains -> $(SEC_CRIT) ; + /sbin/ipchains-restore -> $(SEC_CRIT) ; + /sbin/ipchains-save -> $(SEC_CRIT) ; + /sbin/ipfwadm -> $(SEC_CRIT) ; + /sbin/ipmaddr -> $(SEC_CRIT) ; + /sbin/iptables -> $(SEC_CRIT) ; + /sbin/iptables-restore -> $(SEC_CRIT) ; + /sbin/iptables-save -> $(SEC_CRIT) ; + /sbin/iptunnel -> $(SEC_CRIT) ; + #/sbin/ipvsadm -> $(SEC_CRIT) ; + #/sbin/ipvsadm-restore -> $(SEC_CRIT) ; + #/sbin/ipvsadm-save -> $(SEC_CRIT) ; + /sbin/ipx_configure -> $(SEC_CRIT) ; + /sbin/ipx_interface -> $(SEC_CRIT) ; + /sbin/ipx_internal_net -> $(SEC_CRIT) ; + /sbin/iwconfig -> $(SEC_CRIT) ; + /sbin/iwgetid -> $(SEC_CRIT) ; + /sbin/iwlist -> $(SEC_CRIT) ; + /sbin/iwpriv -> $(SEC_CRIT) ; + /sbin/iwspy -> $(SEC_CRIT) ; + /sbin/mgetty -> $(SEC_CRIT) ; + /sbin/mingetty -> $(SEC_CRIT) ; + /sbin/nameif -> $(SEC_CRIT) ; + /sbin/netreport -> $(SEC_CRIT) ; + /sbin/plipconfig -> $(SEC_CRIT) ; + /sbin/portmap -> $(SEC_CRIT) ; + /sbin/ppp-watch -> $(SEC_CRIT) ; + #/sbin/rarp -> $(SEC_CRIT) ; + /sbin/route -> $(SEC_CRIT) ; + /sbin/slattach -> $(SEC_CRIT) ; + /sbin/tc -> $(SEC_CRIT) ; + #/sbin/uugetty -> $(SEC_CRIT) ; + /sbin/vgetty -> $(SEC_CRIT) ; + /sbin/ypbind -> $(SEC_CRIT) ; +} + + ################################## + # ## +################################## # +# # # +# System Administration Programs # # +# ## +################################## + +( + rulename = "System Administration Programs", + severity = $(SIG_HI) +) +{ + /sbin/chkconfig -> $(SEC_CRIT) ; + /sbin/fuser -> $(SEC_CRIT) ; + /sbin/halt -> $(SEC_CRIT) ; + /sbin/init -> $(SEC_CRIT) ; + /sbin/initlog -> $(SEC_CRIT) ; + /sbin/install-info -> $(SEC_CRIT) ; + /sbin/killall5 -> $(SEC_CRIT) ; + #/sbin/linuxconf -> $(SEC_CRIT) ; + #/sbin/linuxconf-auth -> $(SEC_CRIT) ; + /sbin/pam_tally -> $(SEC_CRIT) ; + /sbin/pwdb_chkpwd -> $(SEC_CRIT) ; + #/sbin/remadmin -> $(SEC_CRIT) ; + /sbin/rescuept -> $(SEC_CRIT) ; + /sbin/rmt -> $(SEC_CRIT) ; + /sbin/rpc.lockd -> $(SEC_CRIT) ; + /sbin/rpc.statd -> $(SEC_CRIT) ; + /sbin/rpcdebug -> $(SEC_CRIT) ; + /sbin/service -> $(SEC_CRIT) ; + /sbin/setsysfont -> $(SEC_CRIT) ; + /sbin/shutdown -> $(SEC_CRIT) ; + /sbin/sulogin -> $(SEC_CRIT) ; + /sbin/swapon -> $(SEC_CRIT) ; + /sbin/syslogd -> $(SEC_CRIT) ; + /sbin/unix_chkpwd -> $(SEC_CRIT) ; + /bin/pwd -> $(SEC_CRIT) ; + /bin/uname -> $(SEC_CRIT) ; +} + + ######################################## + # ## +######################################## # +# # # +# Hardware and Device Control Programs # # +# ## +######################################## +( + rulename = "Hardware and Device Control Programs", + severity = $(SIG_HI) +) +{ + /bin/setserial -> $(SEC_CRIT) ; + /bin/sfxload -> $(SEC_CRIT) ; + /sbin/blockdev -> $(SEC_CRIT) ; + /sbin/cardctl -> $(SEC_CRIT) ; + /sbin/cardmgr -> $(SEC_CRIT) ; + /sbin/cbq -> $(SEC_CRIT) ; + /sbin/dump_cis -> $(SEC_CRIT) ; + /sbin/elvtune -> $(SEC_CRIT) ; + /sbin/hotplug -> $(SEC_CRIT) ; + /sbin/hwclock -> $(SEC_CRIT) ; + /sbin/ide_info -> $(SEC_CRIT) ; + #/sbin/isapnp -> $(SEC_CRIT) ; + /sbin/kbdrate -> $(SEC_CRIT) ; + /sbin/losetup -> $(SEC_CRIT) ; + /sbin/lspci -> $(SEC_CRIT) ; + /sbin/lspnp -> $(SEC_CRIT) ; + /sbin/mii-tool -> $(SEC_CRIT) ; + /sbin/pack_cis -> $(SEC_CRIT) ; + #/sbin/pnpdump -> $(SEC_CRIT) ; + /sbin/probe -> $(SEC_CRIT) ; + /sbin/pump -> $(SEC_CRIT) ; + /sbin/setpci -> $(SEC_CRIT) ; + /sbin/shapecfg -> $(SEC_CRIT) ; +} + + ############################### + # ## +############################### # +# # # +# System Information Programs # # +# ## +############################### +( + rulename = "System Information Programs", + severity = $(SIG_HI) +) +{ + /sbin/consoletype -> $(SEC_CRIT) ; + /sbin/kernelversion -> $(SEC_CRIT) ; + /sbin/runlevel -> $(SEC_CRIT) ; +} + + #################################### + # ## +#################################### # +# # # +# Application Information Programs # # +# ## +#################################### + +( + rulename = "Application Information Programs", + severity = $(SIG_HI) +) +{ + /sbin/genksyms -> $(SEC_CRIT) ; + #/sbin/genksyms.old -> $(SEC_CRIT) ; + /sbin/rtmon -> $(SEC_CRIT) ; +} + + ########################## + # ## +########################## # +# # # +# Shell Related Programs # # +# ## +########################## +( + rulename = "Shell Related Programs", + severity = $(SIG_HI) +) +{ + /sbin/getkey -> $(SEC_CRIT) ; + /sbin/nash -> $(SEC_CRIT) ; + /sbin/sash -> $(SEC_CRIT) ; +} + + + ################ + # ## +################ # +# # # +# OS Utilities # # +# ## +################ +( + rulename = "Operating System Utilities", + severity = $(SIG_HI) +) +{ + /bin/arch -> $(SEC_CRIT) ; + /bin/ash -> $(SEC_CRIT) ; + /bin/ash.static -> $(SEC_CRIT) ; + /bin/aumix-minimal -> $(SEC_CRIT) ; + /bin/basename -> $(SEC_CRIT) ; + /bin/cat -> $(SEC_CRIT) ; + /bin/consolechars -> $(SEC_CRIT) ; + /bin/cut -> $(SEC_CRIT) ; + /bin/date -> $(SEC_CRIT) ; + /bin/dd -> $(SEC_CRIT) ; + /bin/df -> $(SEC_CRIT) ; + /bin/dmesg -> $(SEC_CRIT) ; + /bin/doexec -> $(SEC_CRIT) ; + /bin/echo -> $(SEC_CRIT) ; + /bin/ed -> $(SEC_CRIT) ; + /bin/egrep -> $(SEC_CRIT) ; + /bin/false -> $(SEC_CRIT) ; + /bin/fgrep -> $(SEC_CRIT) ; + /bin/gawk -> $(SEC_CRIT) ; + /bin/gawk-3.1.0 -> $(SEC_CRIT) ; + /bin/gettext -> $(SEC_CRIT) ; + /bin/grep -> $(SEC_CRIT) ; + /bin/gunzip -> $(SEC_CRIT) ; + /bin/gzip -> $(SEC_CRIT) ; + /bin/hostname -> $(SEC_CRIT) ; + /bin/igawk -> $(SEC_CRIT) ; + /bin/ipcalc -> $(SEC_CRIT) ; + /bin/kill -> $(SEC_CRIT) ; + /bin/ln -> $(SEC_CRIT) ; + /bin/loadkeys -> $(SEC_CRIT) ; + /bin/login -> $(SEC_CRIT) ; + /bin/ls -> $(SEC_CRIT) ; + /bin/mail -> $(SEC_CRIT) ; + /bin/more -> $(SEC_CRIT) ; + /bin/mt -> $(SEC_CRIT) ; + /bin/mv -> $(SEC_CRIT) ; + /bin/netstat -> $(SEC_CRIT) ; + /bin/nice -> $(SEC_CRIT) ; + /bin/pgawk -> $(SEC_CRIT) ; + /bin/ps -> $(SEC_CRIT) ; + /bin/rpm -> $(SEC_CRIT) ; + /bin/sed -> $(SEC_CRIT) ; + /bin/sleep -> $(SEC_CRIT) ; + /bin/sort -> $(SEC_CRIT) ; + /bin/stty -> $(SEC_CRIT) ; + /bin/su -> $(SEC_CRIT) ; + /bin/sync -> $(SEC_CRIT) ; + /bin/tar -> $(SEC_CRIT) ; + /bin/true -> $(SEC_CRIT) ; + /bin/usleep -> $(SEC_CRIT) ; + /bin/vi -> $(SEC_CRIT) ; + /bin/zcat -> $(SEC_CRIT) ; + /bin/zsh -> $(SEC_CRIT) ; + #/bin/zsh-4.0.2 -> $(SEC_CRIT) ; + /sbin/sln -> $(SEC_CRIT) ; + /usr/bin/vimtutor -> $(SEC_CRIT) ; +} + + ############################## + # ## +############################## # +# # # +# Critical Utility Sym-Links # # +# ## +############################## +( + rulename = "Critical Utility Sym-Links", + severity = $(SIG_HI) +) +{ + #/sbin/askrunlevel -> $(SEC_CRIT) ; + /sbin/clock -> $(SEC_CRIT) ; + #/sbin/fixperm -> $(SEC_CRIT) ; + /sbin/fsck.reiserfs -> $(SEC_CRIT) ; + #/sbin/fsconf -> $(SEC_CRIT) ; + /sbin/ipfwadm-wrapper -> $(SEC_CRIT) ; + /sbin/kallsyms -> $(SEC_CRIT) ; + /sbin/ksyms -> $(SEC_CRIT) ; + /sbin/lsmod -> $(SEC_CRIT) ; + #/sbin/mailconf -> $(SEC_CRIT) ; + /sbin/mkfs.reiserfs -> $(SEC_CRIT) ; + #/sbin/modemconf -> $(SEC_CRIT) ; + /sbin/modprobe -> $(SEC_CRIT) ; + /sbin/mount.ncp -> $(SEC_CRIT) ; + /sbin/mount.ncpfs -> $(SEC_CRIT) ; + /sbin/mount.smb -> $(SEC_CRIT) ; + /sbin/mount.smbfs -> $(SEC_CRIT) ; + #/sbin/netconf -> $(SEC_CRIT) ; + /sbin/pidof -> $(SEC_CRIT) ; + /sbin/poweroff -> $(SEC_CRIT) ; + /sbin/quotaoff -> $(SEC_CRIT) ; + /sbin/raid0run -> $(SEC_CRIT) ; + /sbin/raidhotadd -> $(SEC_CRIT) ; + /sbin/raidhotgenerateerror -> $(SEC_CRIT) ; + /sbin/raidhotremove -> $(SEC_CRIT) ; + /sbin/raidstop -> $(SEC_CRIT) ; + /sbin/rdump -> $(SEC_CRIT) ; + /sbin/rdump.static -> $(SEC_CRIT) ; + /sbin/reboot -> $(SEC_CRIT) ; + /sbin/rmmod -> $(SEC_CRIT) ; + /sbin/rrestore -> $(SEC_CRIT) ; + /sbin/rrestore.static -> $(SEC_CRIT) ; + /sbin/swapoff -> $(SEC_CRIT) ; + /sbin/telinit -> $(SEC_CRIT) ; + #/sbin/userconf -> $(SEC_CRIT) ; + #/sbin/uucpconf -> $(SEC_CRIT) ; + #/sbin/vregistry -> $(SEC_CRIT) ; + /bin/awk -> $(SEC_CRIT) ; + /bin/bash2 -> $(SEC_CRIT) ; + /bin/bsh -> $(SEC_CRIT) ; + /bin/csh -> $(SEC_CRIT) ; + /bin/dnsdomainname -> $(SEC_CRIT) ; + /bin/domainname -> $(SEC_CRIT) ; + /bin/ex -> $(SEC_CRIT) ; + /bin/gtar -> $(SEC_CRIT) ; + /bin/nisdomainname -> $(SEC_CRIT) ; + /bin/red -> $(SEC_CRIT) ; + /bin/rvi -> $(SEC_CRIT) ; + /bin/rview -> $(SEC_CRIT) ; + /bin/view -> $(SEC_CRIT) ; + /bin/ypdomainname -> $(SEC_CRIT) ; +} + + + ######################### + # ## +######################### # +# # # +# Temporary directories # # +# ## +######################### +( + rulename = "Temporary directories", + recurse = false, + severity = $(SIG_LOW) +) +{ + /usr/tmp -> $(SEC_INVARIANT) ; + /var/tmp -> $(SEC_INVARIANT) ; + /tmp -> $(SEC_INVARIANT) ; +} + + ############### + # ## +############### # +# # # +# Local files # # +# ## +############### +( + rulename = "User binaries", + severity = $(SIG_MED) +) +{ + /sbin -> $(SEC_BIN) (recurse = 1) ; + /usr/bin -> $(SEC_BIN) (recurse = 1) ; + /usr/sbin -> $(SEC_BIN) (recurse = 1) ; + /usr/local/bin -> $(SEC_BIN) (recurse = 1) ; +} + +( + rulename = "Shell Binaries", + severity = $(SIG_HI) +) +{ + /bin/bash -> $(SEC_BIN) ; + /bin/ksh -> $(SEC_BIN) ; + # /bin/psh -> $(SEC_BIN) ; # No longer used? + # /bin/Rsh -> $(SEC_BIN) ; # No longer used? + /bin/sh -> $(SEC_BIN) ; + # /bin/shell -> $(SEC_SUID) ; # No longer used? + # /bin/tsh -> $(SEC_BIN) ; # No longer used? + /bin/tcsh -> $(SEC_BIN) ; + /sbin/nologin -> $(SEC_BIN) ; +} + +( + rulename = "Security Control", + severity = $(SIG_HI) +) +{ + /etc/group -> $(SEC_CRIT) ; + /etc/security -> $(SEC_CRIT) ; + #/var/spool/cron/crontabs -> $(SEC_CRIT) ; # Uncomment when this file exists +} + +#( +# rulename = "Boot Scripts", +# severity = $(SIG_HI) +#) +#{ +# /etc/rc -> $(SEC_CONFIG) ; +# /etc/rc.bsdnet -> $(SEC_CONFIG) ; +# /etc/rc.dt -> $(SEC_CONFIG) ; +# /etc/rc.net -> $(SEC_CONFIG) ; +# /etc/rc.net.serial -> $(SEC_CONFIG) ; +# /etc/rc.nfs -> $(SEC_CONFIG) ; +# /etc/rc.powerfail -> $(SEC_CONFIG) ; +# /etc/rc.tcpip -> $(SEC_CONFIG) ; +# /etc/trcfmt.Z -> $(SEC_CONFIG) ; +#} + +( + rulename = "Login Scripts", + severity = $(SIG_HI) +) +{ + /etc/bashrc -> $(SEC_CONFIG) ; + /etc/csh.cshrc -> $(SEC_CONFIG) ; + /etc/csh.login -> $(SEC_CONFIG) ; + /etc/inputrc -> $(SEC_CONFIG) ; + # /etc/tsh_profile -> $(SEC_CONFIG) ; #Uncomment when this file exists + /etc/profile -> $(SEC_CONFIG) ; +} + +# Libraries +( + rulename = "Libraries", + severity = $(SIG_MED) +) +{ + /usr/lib -> $(SEC_BIN) ; + /usr/local/lib -> $(SEC_BIN) ; +} + + + ###################################################### + # ## +###################################################### # +# # # +# Critical System Boot Files # # +# These files are critical to a correct system boot. # # +# ## +###################################################### + +( + rulename = "Critical system boot files", + severity = $(SIG_HI) +) +{ + /boot -> $(SEC_CRIT) ; + #/sbin/devfsd -> $(SEC_CRIT) ; + /sbin/grub -> $(SEC_CRIT) ; + /sbin/grub-install -> $(SEC_CRIT) ; + /sbin/grub-md5-crypt -> $(SEC_CRIT) ; + /sbin/installkernel -> $(SEC_CRIT) ; + /sbin/lilo -> $(SEC_CRIT) ; + /sbin/mkkerneldoth -> $(SEC_CRIT) ; + !/boot/System.map ; + !/boot/module-info ; + /usr/share/grub/i386-redhat/e2fs_stage1_5 -> $(SEC_CRIT) ; + /usr/share/grub/i386-redhat/fat_stage1_5 -> $(SEC_CRIT) ; + /usr/share/grub/i386-redhat/ffs_stage1_5 -> $(SEC_CRIT) ; + /usr/share/grub/i386-redhat/minix_stage1_5 -> $(SEC_CRIT) ; + /usr/share/grub/i386-redhat/reiserfs_stage1_5 -> $(SEC_CRIT) ; + /usr/share/grub/i386-redhat/stage1 -> $(SEC_CRIT) ; + /usr/share/grub/i386-redhat/stage2 -> $(SEC_CRIT) ; + /usr/share/grub/i386-redhat/vstafs_stage1_5 -> $(SEC_CRIT) ; + # other boot files may exist. Look for: + #/ufsboot -> $(SEC_CRIT) ; +} + ################################################## + ################################################### + # These files change every time the system boots ## + ################################################## +( + rulename = "System boot changes", + severity = $(SIG_HI) +) +{ + !/var/run/ftp.pids-all ; # Comes and goes on reboot. + !/root/.enlightenment ; + /dev/log -> $(SEC_CONFIG) ; + /dev/cua0 -> $(SEC_CONFIG) ; + # /dev/printer -> $(SEC_CONFIG) ; # Uncomment if you have a printer device + /dev/console -> $(SEC_CONFIG) -u ; # User ID may change on console login/logout. + /dev/tty1 -> $(SEC_CONFIG) ; # tty devices + /dev/tty2 -> $(SEC_CONFIG) ; # tty devices + /dev/tty3 -> $(SEC_CONFIG) ; # are extremely + /dev/tty4 -> $(SEC_CONFIG) ; # variable + /dev/tty5 -> $(SEC_CONFIG) ; + /dev/tty6 -> $(SEC_CONFIG) ; + /dev/urandom -> $(SEC_CONFIG) ; + /dev/initctl -> $(SEC_CONFIG) ; + /var/lock/subsys -> $(SEC_CONFIG) ; + #/var/lock/subsys/amd -> $(SEC_CONFIG) ; + /var/lock/subsys/anacron -> $(SEC_CONFIG) ; + /var/lock/subsys/apmd -> $(SEC_CONFIG) ; + #/var/lock/subsys/arpwatch -> $(SEC_CONFIG) ; + /var/lock/subsys/atd -> $(SEC_CONFIG) ; + /var/lock/subsys/autofs -> $(SEC_CONFIG) ; + #/var/lock/subsys/bcm5820 -> $(SEC_CONFIG) ; + #/var/lock/subsys/bgpd -> $(SEC_CONFIG) ; + #/var/lock/subsys/bootparamd -> $(SEC_CONFIG) ; + #/var/lock/subsys/canna -> $(SEC_CONFIG) ; + /var/lock/subsys/crond -> $(SEC_CONFIG) ; + #/var/lock/subsys/cWnn -> $(SEC_CONFIG) ; + #/var/lock/subsys/dhcpd -> $(SEC_CONFIG) ; + #/var/lock/subsys/firewall -> $(SEC_CONFIG) ; + #/var/lock/subsys/freeWnn -> $(SEC_CONFIG) ; + #/var/lock/subsys/gated -> $(SEC_CONFIG) ; + /var/lock/subsys/gpm -> $(SEC_CONFIG) ; + #/var/lock/subsys/httpd -> $(SEC_CONFIG) ; + #/var/lock/subsys/identd -> $(SEC_CONFIG) ; + #/var/lock/subsys/innd -> $(SEC_CONFIG) ; + /var/lock/subsys/ipchains -> $(SEC_CONFIG) ; + #/var/lock/subsys/iptables -> $(SEC_CONFIG) ; + #/var/lock/subsys/ipvsadm -> $(SEC_CONFIG) ; + #/var/lock/subsys/irda -> $(SEC_CONFIG) ; + #/var/lock/subsys/iscsi -> $(SEC_CONFIG) ; + #/var/lock/subsys/isdn -> $(SEC_CONFIG) ; + #/var/lock/subsys/junkbuster -> $(SEC_CONFIG) ; + #/var/lock/subsys/kadmin -> $(SEC_CONFIG) ; + /var/lock/subsys/keytable -> $(SEC_CONFIG) ; + #/var/lock/subsys/kprop -> $(SEC_CONFIG) ; + #/var/lock/subsys/krb524 -> $(SEC_CONFIG) ; + #/var/lock/subsys/krb5kdc -> $(SEC_CONFIG) ; + /var/lock/subsys/kudzu -> $(SEC_CONFIG) ; + #/var/lock/subsys/kWnn -> $(SEC_CONFIG) ; + #/var/lock/subsys/ldap -> $(SEC_CONFIG) ; + #/var/lock/subsys/linuxconf -> $(SEC_CONFIG) ; + #/var/lock/subsys/lpd -> $(SEC_CONFIG) ; + #/var/lock/subsys/mars_nwe -> $(SEC_CONFIG) ; + #/var/lock/subsys/mcserv -> $(SEC_CONFIG) ; + #/var/lock/subsys/mysqld -> $(SEC_CONFIG) ; + #/var/lock/subsys/named -> $(SEC_CONFIG) ; + /var/lock/subsys/netfs -> $(SEC_CONFIG) ; + /var/lock/subsys/network -> $(SEC_CONFIG) ; + #/var/lock/subsys/nfs -> $(SEC_CONFIG) ; + /var/lock/subsys/nfslock -> $(SEC_CONFIG) ; + #/var/lock/subsys/nscd -> $(SEC_CONFIG) ; + #/var/lock/subsys/ntpd -> $(SEC_CONFIG) ; + #/var/lock/subsys/ospf6d -> $(SEC_CONFIG) ; + #/var/lock/subsys/ospfd -> $(SEC_CONFIG) ; + /var/lock/subsys/pcmcia -> $(SEC_CONFIG) ; + /var/lock/subsys/portmap -> $(SEC_CONFIG) ; + #/var/lock/subsys/postgresql -> $(SEC_CONFIG) ; + #/var/lock/subsys/pxe -> $(SEC_CONFIG) ; + #/var/lock/subsys/radvd -> $(SEC_CONFIG) ; + /var/lock/subsys/random -> $(SEC_CONFIG) ; + #/var/lock/subsys/rarpd -> $(SEC_CONFIG) ; + /var/lock/subsys/reconfig -> $(SEC_CONFIG) ; + /var/lock/subsys/rhnsd -> $(SEC_CONFIG) ; + #/var/lock/subsys/ripd -> $(SEC_CONFIG) ; + #/var/lock/subsys/ripngd -> $(SEC_CONFIG) ; + #/var/lock/subsys/routed -> $(SEC_CONFIG) ; + #/var/lock/subsys/rstatd -> $(SEC_CONFIG) ; + #/var/lock/subsys/rusersd -> $(SEC_CONFIG) ; + #/var/lock/subsys/rwalld -> $(SEC_CONFIG) ; + #/var/lock/subsys/rwhod -> $(SEC_CONFIG) ; + /var/lock/subsys/sendmail -> $(SEC_CONFIG) ; + #/var/lock/subsys/smb -> $(SEC_CONFIG) ; + #/var/lock/subsys/snmpd -> $(SEC_CONFIG) ; + #/var/lock/subsys/squid -> $(SEC_CONFIG) ; + /var/lock/subsys/sshd -> $(SEC_CONFIG) ; + /var/lock/subsys/syslog -> $(SEC_CONFIG) ; + #/var/lock/subsys/tux -> $(SEC_CONFIG) ; + #/var/lock/subsys/tWnn -> $(SEC_CONFIG) ; + #/var/lock/subsys/ups -> $(SEC_CONFIG) ; + #/var/lock/subsys/vncserver -> $(SEC_CONFIG) ; + #/var/lock/subsys/wine -> $(SEC_CONFIG) ; + /var/lock/subsys/xfs -> $(SEC_CONFIG) ; + /var/lock/subsys/xinetd -> $(SEC_CONFIG) ; + /var/lock/subsys/ypbind -> $(SEC_CONFIG) ; + #/var/lock/subsys/yppasswdd -> $(SEC_CONFIG) ; + #/var/lock/subsys/ypserv -> $(SEC_CONFIG) ; + #/var/lock/subsys/ypxfrd -> $(SEC_CONFIG) ; + #/var/lock/subsys/zebra -> $(SEC_CONFIG) ; + /var/run -> $(SEC_CONFIG) ; + /var/log -> $(SEC_CONFIG) ; + /etc/ioctl.save -> $(SEC_CONFIG) ; + /etc/issue.net -> $(SEC_CONFIG) -i ; # Inode number changes + /etc/issue -> $(SEC_CONFIG) ; + /etc/mtab -> $(SEC_CONFIG) -i ; # Inode number changes on any mount/unmount + /lib/modules -> $(SEC_CONFIG) ; + /etc/.pwd.lock -> $(SEC_CONFIG) ; + # /lib/modules/preferred -> $(SEC_CONFIG) ; #Uncomment when this file exists +} + +# These files change the behavior of the root account +( + rulename = "Root config files", + severity = 100 +) +{ + /root -> $(SEC_CRIT) ; # Catch all additions to /root + #/root/.Xresources -> $(SEC_CONFIG) ; + /root/.bashrc -> $(SEC_CONFIG) ; + /root/.bash_profile -> $(SEC_CONFIG) ; + /root/.bash_logout -> $(SEC_CONFIG) ; + /root/.cshrc -> $(SEC_CONFIG) ; + /root/.tcshrc -> $(SEC_CONFIG) ; + /root/Mail -> $(SEC_CONFIG) ; + #/root/mail -> $(SEC_CONFIG) ; + #/root/.amandahosts -> $(SEC_CONFIG) ; + #/root/.addressbook.lu -> $(SEC_CONFIG) ; + #/root/.addressbook -> $(SEC_CONFIG) ; + /root/.bash_history -> $(SEC_CONFIG) ; + /root/.elm -> $(SEC_CONFIG) ; + #/root/.esd_auth -> $(SEC_CONFIG) ; + /root/.gnome_private -> $(SEC_CONFIG) ; + /root/.gnome-desktop -> $(SEC_CONFIG) ; + /root/.gnome -> $(SEC_CONFIG) ; + /root/.ICEauthority -> $(SEC_CONFIG) ; + #/root/.mc -> $(SEC_CONFIG) ; + #/root/.pinerc -> $(SEC_CONFIG) ; + /root/.sawfish -> $(SEC_CONFIG) ; + /root/.Xauthority -> $(SEC_CONFIG) -i ; # Changes Inode number on login + #/root/.xauth -> $(SEC_CONFIG) ; + /root/.xsession-errors -> $(SEC_CONFIG) ; +} + + ################################ + # ## +################################ # +# # # +# Critical configuration files # # +# ## +################################ +( + rulename = "Critical configuration files", + severity = $(SIG_HI) +) +{ + #/etc/conf.linuxconf -> $(SEC_BIN) ; + /etc/crontab -> $(SEC_BIN) ; + /etc/cron.hourly -> $(SEC_BIN) ; + /etc/cron.daily -> $(SEC_BIN) ; + /etc/cron.weekly -> $(SEC_BIN) ; + /etc/cron.monthly -> $(SEC_BIN) ; + /etc/default -> $(SEC_BIN) ; + /etc/fstab -> $(SEC_BIN) ; + /etc/exports -> $(SEC_BIN) ; + /etc/group- -> $(SEC_BIN) ; # changes should be infrequent + /etc/host.conf -> $(SEC_BIN) ; + /etc/hosts.allow -> $(SEC_BIN) ; + /etc/hosts.deny -> $(SEC_BIN) ; + /etc/httpd/conf -> $(SEC_BIN) ; # changes should be infrequent + /etc/protocols -> $(SEC_BIN) ; + /etc/services -> $(SEC_BIN) ; + /etc/rc.d/init.d -> $(SEC_BIN) ; + /etc/rc.d -> $(SEC_BIN) ; + /etc/mail.rc -> $(SEC_BIN) ; + /etc/modules.conf -> $(SEC_BIN) ; + /etc/motd -> $(SEC_BIN) ; + /etc/named.conf -> $(SEC_BIN) ; + /etc/passwd -> $(SEC_CONFIG) ; + /etc/passwd- -> $(SEC_CONFIG) ; + /etc/profile.d -> $(SEC_BIN) ; + /var/lib/nfs/rmtab -> $(SEC_BIN) ; + /usr/sbin/fixrmtab -> $(SEC_BIN) ; + /etc/rpc -> $(SEC_BIN) ; + /etc/sysconfig -> $(SEC_BIN) ; + /etc/samba/smb.conf -> $(SEC_CONFIG) ; + #/etc/gettydefs -> $(SEC_BIN) ; + /etc/nsswitch.conf -> $(SEC_BIN) ; + /etc/yp.conf -> $(SEC_BIN) ; + /etc/hosts -> $(SEC_CONFIG) ; + /etc/xinetd.conf -> $(SEC_CONFIG) ; + /etc/inittab -> $(SEC_CONFIG) ; + /etc/resolv.conf -> $(SEC_CONFIG) ; + /etc/syslog.conf -> $(SEC_CONFIG) ; +} + + #################### + # ## +#################### # +# # # +# Critical devices # # +# ## +#################### +( + rulename = "Critical devices", + severity = $(SIG_HI), + recurse = false +) +{ + /dev/kmem -> $(Device) ; + /dev/mem -> $(Device) ; + /dev/null -> $(Device) ; + /dev/zero -> $(Device) ; + /proc/devices -> $(Device) ; + /proc/net -> $(Device) ; + /proc/sys -> $(Device) ; + /proc/cpuinfo -> $(Device) ; + /proc/modules -> $(Device) ; + /proc/mounts -> $(Device) ; + /proc/dma -> $(Device) ; + /proc/filesystems -> $(Device) ; + /proc/pci -> $(Device) ; + /proc/interrupts -> $(Device) ; + /proc/driver/rtc -> $(Device) ; + /proc/ioports -> $(Device) ; + #/proc/scsi -> $(Device) ; + /proc/kcore -> $(Device) ; + /proc/self -> $(Device) ; + /proc/kmsg -> $(Device) ; + /proc/stat -> $(Device) ; + /proc/ksyms -> $(Device) ; + /proc/loadavg -> $(Device) ; + /proc/uptime -> $(Device) ; + /proc/locks -> $(Device) ; + /proc/version -> $(Device) ; + /proc/mdstat -> $(Device) ; + /proc/meminfo -> $(Device) ; + /proc/cmdline -> $(Device) ; + /proc/misc -> $(Device) ; +} + +# Rest of critical system binaries +( + rulename = "OS executables and libraries", + severity = $(SIG_HI) +) +{ + /bin -> $(SEC_BIN) ; + /lib -> $(SEC_BIN) ; +} + +#============================================================================= +# +# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Inc. in the United States and other countries. All rights reserved. +# +# Linux is a registered trademark of Linus Torvalds. +# +# UNIX is a registered trademark of The Open Group. +# +#============================================================================= +# +# Permission is granted to make and distribute verbatim copies of this document +# provided the copyright notice and this permission notice are preserved on all +# copies. +# +# Permission is granted to copy and distribute modified versions of this +# document under the conditions for verbatim copying, provided that the entire +# resulting derived work is distributed under the terms of a permission notice +# identical to this one. +# +# Permission is granted to copy and distribute translations of this document +# into another language, under the above conditions for modified versions, +# except that this permission notice may be stated in a translation approved by +# Tripwire, Inc. +# +# DCM +# +# $Id: twpol-GENERIC.txt,v 1.1 2003/06/08 02:00:06 pherman Exp $ +# diff --git a/policy/twpol-MidnightBSD.txt b/policy/twpol-MidnightBSD.txt new file mode 100644 index 0000000..b9c55a3 --- /dev/null +++ b/policy/twpol-MidnightBSD.txt @@ -0,0 +1,656 @@ +# +# Policy file for MidnightBSD +# (adapted from FreeBSD policy) +# +# $FreeBSD: ports/security/tripwire/files/twpol.txt,v 1.2 2002/03/04 16:55:21 cy Exp $ +# $Id: twpol-FreeBSD.txt,v 1.1 2003/06/08 02:00:06 pherman Exp $ + +# +# This is the example Tripwire Policy file. It is intended as a place to +# start creating your own custom Tripwire Policy file. Referring to it as +# well as the Tripwire Policy Guide should give you enough information to +# make a good custom Tripwire Policy file that better covers your +# configuration and security needs. A text version of this policy file is +# called twpol.txt. +# +# Note that this file is tuned to an install of FreeBSD using +# buildworld. If run unmodified, this file should create no errors on +# database creation, or violations on a subsiquent integrity check. +# However it is impossible for there to be one policy file for all machines, +# so this existing one errs on the side of security. Your FreeBSD +# configuration will most likey differ from the one our policy file was +# tuned to, and will therefore require some editing of the default +# Tripwire Policy file. +# +# The example policy file is best run with 'Loose Directory Checking' +# enabled. Set LOOSEDIRECTORYCHECKING=TRUE in the Tripwire Configuration +# file. +# +# Email support is not included and must be added to this file. +# Add the 'emailto=' to the rule directive section of each rule (add a comma +# after the 'severity=' line and add an 'emailto=' and include the email +# addresses you want the violation reports to go to). Addresses are +# semi-colon delimited. +# + + + +# +# Global Variable Definitions +# +# These are defined at install time by the installation script. You may +# Manually edit these if you are using this file directly and not from the +# installation script itself. +# + +@@section GLOBAL +TWROOT=; +TWBIN=; +TWPOL=; +TWDB=; +TWSKEY=; +TWLKEY=; +TWREPORT=; +HOSTNAME=; + +@@section FS +SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change +SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set +SEC_BIN = $(ReadOnly) ; # Binaries that should not change +SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often +SEC_TTY = $(Dynamic)-ugp ; # Tty files that change ownership at login +SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership +SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership +SIG_LOW = 33 ; # Non-critical files that are of minimal security impact +SIG_MED = 66 ; # Non-critical files that are of significant security impact +SIG_HI = 100 ; # Critical files that are significant points of vulnerability + + +# Tripwire Binaries +( + rulename = "Tripwire Binaries", + severity = $(SIG_HI) +) +{ + $(TWBIN)/siggen -> $(SEC_BIN) ; + $(TWBIN)/tripwire -> $(SEC_BIN) ; + $(TWBIN)/twadmin -> $(SEC_BIN) ; + $(TWBIN)/twprint -> $(SEC_BIN) ; +} + +# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases +( + rulename = "Tripwire Data Files", + severity = $(SIG_HI) +) +{ + # NOTE: We remove the inode attribute because when Tripwire creates a backup, + # it does so by renaming the old file and creating a new one (which will + # have a new inode number). Inode is left turned on for keys, which shouldn't + # ever change. + + # NOTE: The first integrity check triggers this rule and each integrity check + # afterward triggers this rule until a database update is run, since the + # database file does not exist before that point. + + $(TWDB) -> $(SEC_CONFIG) -i ; + $(TWPOL)/tw.pol -> $(SEC_BIN) -i ; + $(TWPOL)/tw.cfg -> $(SEC_BIN) -i ; + $(TWPOL)/twcfg.txt -> $(SEC_BIN) ; + $(TWPOL)/twpol.txt -> $(SEC_BIN) ; + $(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_BIN) ; + $(TWSKEY)/site.key -> $(SEC_BIN) ; + + #don't scan the individual reports + $(TWREPORT) -> $(SEC_CONFIG) (recurse=0) ; +} + + +# Tripwire HQ Connector Binaries +#( +# rulename = "Tripwire HQ Connector Binaries", +# severity = $(SIG_HI) +#) +#{ +# $(TWBIN)/hqagent -> $(SEC_BIN) ; +#} +# +# Tripwire HQ Connector - Configuration Files, Keys, and Logs + +# +# Note: File locations here are different than in a stock HQ Connector +# installation. This is because Tripwire 2.3 uses a different path +# structure than Tripwire 2.2.1. +# +# You may need to update your HQ Agent configuation file (or this policy +# file) to correct the paths. We have attempted to support the FHS standard +# here by placing the HQ Agent files similarly to the way Tripwire 2.3 +# places them. +# + +#( +# rulename = "Tripwire HQ Connector Data Files", +# severity = $(SIG_HI) +#) +#{ +# +# # NOTE: Removing the inode attribute because when Tripwire creates a backup +# # it does so by renaming the old file and creating a new one (which will +# # have a new inode number). Leaving inode turned on for keys, which +# # shouldn't ever change. +# +# +# $(TWBIN)/agent.cfg -> $(SEC_BIN) -i ; +# $(TWLKEY)/authentication.key -> $(SEC_BIN) ; +# $(TWDB)/tasks.dat -> $(SEC_CONFIG) ; +# $(TWDB)/schedule.dat -> $(SEC_CONFIG) ; +# +# # Uncomment if you have agent logging enabled. +# #/var/log/tripwire/agent.log -> $(SEC_LOG) ; +#} + + + +# Commonly accessed directories that should remain static with regards to owner and group +( + rulename = "Invariant Directories", + severity = $(SIG_MED) +) +{ + / -> $(SEC_INVARIANT) (recurse = false) ; + /home -> $(SEC_INVARIANT) (recurse = false) ; +} + +# +# First, root's "home" +# + +( + rulename = "Root's home", + severity = $(SIG_HI) +) +{ + # /.rhosts -> $(SEC_CRIT) ; + /.profile -> $(SEC_CRIT) ; + /.cshrc -> $(SEC_CRIT) ; + /.login -> $(SEC_CRIT) ; + # /.exrc -> $(SEC_CRIT) ; + # /.logout -> $(SEC_CRIT) ; + # /.forward -> $(SEC_CRIT) ; + /root -> $(SEC_CRIT) (recurse = true) ; + !/root/.history ; + !/root/.bash_history ; + # !/root/.lsof_SYSTEM_NAME ; # Uncomment if lsof is installed +} + + +# +# FreeBSD Kernel +# + +( + rulename = "FreeBSD Kernel", + severity = $(SIG_HI) +) +{ + /kernel -> $(SEC_CRIT) ; + /kernel.old -> $(SEC_CRIT) ; + /kernel.GENERIC -> $(SEC_CRIT) ; +} + + +# +# FreeBSD Modules +# + +( + rulename = "FreeBSD Modules", + severity = $(SIG_HI) +) +{ + /modules -> $(SEC_CRIT) (recurse = true) ; + /modules.old -> $(SEC_CRIT) (recurse = true) ; + # /lkm -> $(SEC_CRIT) (recurse = true) ; # uncomment if using lkm kld +} + + +# +# System Administration Programs +# + +( + rulename = "System Administration Programs", + severity = $(SIG_HI) +) +{ + /sbin -> $(SEC_CRIT) (recurse = true) ; + /usr/sbin -> $(SEC_CRIT) (recurse = true) ; +} + + +# +# User Utilities +# + +( + rulename = "User Utilities", + severity = $(SIG_HI) +) +{ + /bin -> $(SEC_CRIT) (recurse = true) ; + /usr/bin -> $(SEC_CRIT) (recurse = true) ; +} + + +# +# /dev +# + +( + rulename = "/dev", + severity = $(SIG_HI) +) +{ + /dev -> $(Device) (recurse = true) ; + !/dev/vga ; + !/dev/dri ; + /dev/console -> $(SEC_TTY) ; + /dev/ttyv0 -> $(SEC_TTY) ; + /dev/ttyv1 -> $(SEC_TTY) ; + /dev/ttyv2 -> $(SEC_TTY) ; + /dev/ttyv3 -> $(SEC_TTY) ; + /dev/ttyv4 -> $(SEC_TTY) ; + /dev/ttyv5 -> $(SEC_TTY) ; + /dev/ttyv6 -> $(SEC_TTY) ; + /dev/ttyv7 -> $(SEC_TTY) ; + /dev/ttyp0 -> $(SEC_TTY) ; + /dev/ttyp1 -> $(SEC_TTY) ; + /dev/ttyp2 -> $(SEC_TTY) ; + /dev/ttyp3 -> $(SEC_TTY) ; + /dev/ttyp4 -> $(SEC_TTY) ; + /dev/ttyp5 -> $(SEC_TTY) ; + /dev/ttyp6 -> $(SEC_TTY) ; + /dev/ttyp7 -> $(SEC_TTY) ; + /dev/ttyp8 -> $(SEC_TTY) ; + /dev/ttyp9 -> $(SEC_TTY) ; + /dev/ttypa -> $(SEC_TTY) ; + /dev/ttypb -> $(SEC_TTY) ; + /dev/ttypc -> $(SEC_TTY) ; + /dev/ttypd -> $(SEC_TTY) ; + /dev/ttype -> $(SEC_TTY) ; + /dev/ttypf -> $(SEC_TTY) ; + /dev/ttypg -> $(SEC_TTY) ; + /dev/ttyph -> $(SEC_TTY) ; + /dev/ttypi -> $(SEC_TTY) ; + /dev/ttypj -> $(SEC_TTY) ; + /dev/ttypl -> $(SEC_TTY) ; + /dev/ttypm -> $(SEC_TTY) ; + /dev/ttypn -> $(SEC_TTY) ; + /dev/ttypo -> $(SEC_TTY) ; + /dev/ttypp -> $(SEC_TTY) ; + /dev/ttypq -> $(SEC_TTY) ; + /dev/ttypr -> $(SEC_TTY) ; + /dev/ttyps -> $(SEC_TTY) ; + /dev/ttypt -> $(SEC_TTY) ; + /dev/ttypu -> $(SEC_TTY) ; + /dev/ttypv -> $(SEC_TTY) ; + /dev/cuaa0 -> $(SEC_TTY) ; # modem +} + + +# +# /etc +# + +( + rulename = "/etc", + severity = $(SIG_HI) +) +{ + /etc -> $(SEC_CRIT) (recurse = true) ; + # /etc/mail/aliases -> $(SEC_CONFIG) ; + /etc/dumpdates -> $(SEC_CONFIG) ; + /etc/motd -> $(SEC_CONFIG) ; + !/etc/ppp/connect-errors ; + /etc/skeykeys -> $(SEC_CONFIG) ; + # Uncomment the following 4 lines if your password file does not change + # /etc/passwd -> $(SEC_CONFIG) ; + # /etc/master.passwd -> $(SEC_CONFIG) ; + # /etc/pwd.db -> $(SEC_CONFIG) ; + # /etc/spwd.db -> $(SEC_CONFIG) ; +} + + +# +# Copatibility (Linux) +# + +( + rulename = "Linux Compatibility", + severity = $(SIG_HI) +) +{ + /compat -> $(SEC_CRIT) (recurse = true) ; +# +# Uncomment the following if Linux compatibility is used. Replace +# HOSTNAME1 and HOSTNAME2 with the hosts that have Linux emulation port +# installed. +# +#@@ifhost HOSTNAME1 || HOSTNAME2 +# /compat/linux/etc -> $(SEC_INVARIANT) (recurse = false) ; +# /compat/linux/etc/X11 -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/pam.d -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/profile.d -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/real -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/bashrc -> $(SEC_CONFIG) ; +# /compat/linux/etc/csh.login -> $(SEC_CONFIG) ; +# /compat/linux/etc/host.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/hosts.allow -> $(SEC_CONFIG) ; +# /compat/linux/etc/hosts.deny -> $(SEC_CONFIG) ; +# /compat/linux/etc/info-dir -> $(SEC_CONFIG) ; +# /compat/linux/etc/inputrc -> $(SEC_CONFIG) ; +# /compat/linux/etc/ld.so.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/nsswitch.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/profile -> $(SEC_CONFIG) ; +# /compat/linux/etc/redhat-release -> $(SEC_CONFIG) ; +# /compat/linux/etc/rpc -> $(SEC_CONFIG) ; +# /compat/linux/etc/securetty -> $(SEC_CONFIG) ; +# /compat/linux/etc/shells -> $(SEC_CONFIG) ; +# /compat/linux/etc/termcap -> $(SEC_CONFIG) ; +# /compat/linux/etc/yp.conf -> $(SEC_CONFIG) ; +# !/compat/linux/etc/ld.so.cache ; +# !/compat/linux/var/spool/mail ; +#@@endif +} + + +# +# Libraries, include files, and other system files +# + +( + rulename = "Libraries, include files, and other system files", + severity = $(SIG_HI) +) +{ + /usr/include -> $(SEC_CRIT) (recurse = true) ; + /usr/lib -> $(SEC_CRIT) (recurse = true) ; + /usr/libdata -> $(SEC_CRIT) (recurse = true) ; + /usr/libexec -> $(SEC_CRIT) (recurse = true) ; + /usr/share -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man -> $(SEC_CONFIG) ; + !/usr/share/man/whatis ; + !/usr/share/man/.glimpse_filenames ; + !/usr/share/man/.glimpse_filenames_index ; + !/usr/share/man/.glimpse_filetimes ; + !/usr/share/man/.glimpse_filters ; + !/usr/share/man/.glimpse_index ; + !/usr/share/man/.glimpse_messages ; + !/usr/share/man/.glimpse_partitions ; + !/usr/share/man/.glimpse_statistics ; + !/usr/share/man/.glimpse_turbo ; + /usr/share/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/share/man/cat1 ; + ! /usr/share/man/cat2 ; + ! /usr/share/man/cat3 ; + ! /usr/share/man/cat4 ; + ! /usr/share/man/cat5 ; + ! /usr/share/man/cat6 ; + ! /usr/share/man/cat7 ; + ! /usr/share/man/cat8 ; + ! /usr/share/man/cat9 ; + ! /usr/share/man/catl ; + ! /usr/share/man/catn ; + /usr/share/perl/man -> $(SEC_CONFIG) ; + !/usr/share/perl/man/whatis ; + !/usr/share/perl/man/.glimpse_filenames ; + !/usr/share/perl/man/.glimpse_filenames_index ; + !/usr/share/perl/man/.glimpse_filetimes ; + !/usr/share/perl/man/.glimpse_filters ; + !/usr/share/perl/man/.glimpse_index ; + !/usr/share/perl/man/.glimpse_messages ; + !/usr/share/perl/man/.glimpse_partitions ; + !/usr/share/perl/man/.glimpse_statistics ; + !/usr/share/perl/man/.glimpse_turbo ; + /usr/share/perl/man/man3 -> $(SEC_CRIT) (recurse = true) ; + ! /usr/share/perl/man/cat3 ; + /usr/local/lib/perl5/5.00503/man -> $(SEC_CONFIG) ; + ! /usr/local/lib/perl5/5.00503/man/whatis ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filters ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filetimes ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_messages ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_statistics ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_index ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_turbo ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_partitions ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filenames ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filenames_index ; + /usr/local/lib/perl5/5.00503/man/man3 -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/lib/perl5/5.00503/man/cat3 ; +} + + +# +# X11R6 +# + +( + rulename = "X11R6", + severity = $(SIG_HI) +) +{ + /usr/X11R6 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/lib/X11/xdm -> $(SEC_CONFIG) (recurse = true) ; + !/usr/X11R6/lib/X11/xdm/xdm-errors ; + !/usr/X11R6/lib/X11/xdm/authdir/authfiles ; + !/usr/X11R6/lib/X11/xdm/xdm-pid ; + /usr/X11R6/lib/X11/xkb/compiled -> $(SEC_CONFIG) (recurse = true) ; + /usr/X11R6/man -> $(SEC_CONFIG) ; + !/usr/X11R6/man/whatis ; + !/usr/X11R6/man/.glimpse_filenames ; + !/usr/X11R6/man/.glimpse_filenames_index ; + !/usr/X11R6/man/.glimpse_filetimes ; + !/usr/X11R6/man/.glimpse_filters ; + !/usr/X11R6/man/.glimpse_index ; + !/usr/X11R6/man/.glimpse_messages ; + !/usr/X11R6/man/.glimpse_partitions ; + !/usr/X11R6/man/.glimpse_statistics ; + !/usr/X11R6/man/.glimpse_turbo ; + /usr/X11R6/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/X11R6/man/cat1 ; + ! /usr/X11R6/man/cat2 ; + ! /usr/X11R6/man/cat3 ; + ! /usr/X11R6/man/cat4 ; + ! /usr/X11R6/man/cat5 ; + ! /usr/X11R6/man/cat6 ; + ! /usr/X11R6/man/cat7 ; + ! /usr/X11R6/man/cat8 ; + ! /usr/X11R6/man/cat9 ; + ! /usr/X11R6/man/catl ; + ! /usr/X11R6/man/catn ; +} + + +# +# sources +# + +( + rulename = "Sources", + severity = $(SIG_HI) +) +{ + /usr/src -> $(SEC_CRIT) (recurse = true) ; + /usr/src/sys/compile -> $(SEC_CONFIG) (recurse = false) ; +} + + +# +# NIS +# + +( + rulename = "NIS", + severity = $(SIG_HI) +) +{ + /var/yp -> $(SEC_CRIT) (recurse = true) ; + !/var/yp/binding ; +} + + +# +# Temporary directories +# +( + rulename = "Temporary directories", + recurse = false, + severity = $(SIG_LOW) +) +{ + /usr/tmp -> $(SEC_INVARIANT) ; + /var/tmp -> $(SEC_INVARIANT) ; + /var/preserve -> $(SEC_INVARIANT) ; + /tmp -> $(SEC_INVARIANT) ; +} + +# +# Local files +# + +( + rulename = "Local files", + severity = $(SIG_MED) +) +{ + /usr/local/bin -> $(SEC_BIN) (recurse = true) ; + /usr/local/sbin -> $(SEC_BIN) (recurse = true) ; + /usr/local/etc -> $(SEC_BIN) (recurse = true) ; + /usr/local/lib -> $(SEC_BIN) (recurse = true ) ; + /usr/local/libexec -> $(SEC_BIN) (recurse = true ) ; + /usr/local/share -> $(SEC_BIN) (recurse = true ) ; + /usr/local/man -> $(SEC_CONFIG) ; + !/usr/local/man/whatis ; + !/usr/local/man/.glimpse_filenames ; + !/usr/local/man/.glimpse_filenames_index ; + !/usr/local/man/.glimpse_filetimes ; + !/usr/local/man/.glimpse_filters ; + !/usr/local/man/.glimpse_index ; + !/usr/local/man/.glimpse_messages ; + !/usr/local/man/.glimpse_partitions ; + !/usr/local/man/.glimpse_statistics ; + !/usr/local/man/.glimpse_turbo ; + /usr/local/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/man/cat1 ; + ! /usr/local/man/cat2 ; + ! /usr/local/man/cat3 ; + ! /usr/local/man/cat4 ; + ! /usr/local/man/cat5 ; + ! /usr/local/man/cat6 ; + ! /usr/local/man/cat7 ; + ! /usr/local/man/cat8 ; + ! /usr/local/man/cat9 ; + ! /usr/local/man/catl ; + ! /usr/local/man/catn ; + /usr/local/krb5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man -> $(SEC_CONFIG) ; + !/usr/local/krb5/man/whatis ; + !/usr/local/krb5/man/.glimpse_filenames ; + !/usr/local/krb5/man/.glimpse_filenames_index ; + !/usr/local/krb5/man/.glimpse_filetimes ; + !/usr/local/krb5/man/.glimpse_filters ; + !/usr/local/krb5/man/.glimpse_index ; + !/usr/local/krb5/man/.glimpse_messages ; + !/usr/local/krb5/man/.glimpse_partitions ; + !/usr/local/krb5/man/.glimpse_statistics ; + !/usr/local/krb5/man/.glimpse_turbo ; + /usr/local/krb5/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/krb5/man/cat1 ; + ! /usr/local/krb5/man/cat2 ; + ! /usr/local/krb5/man/cat3 ; + ! /usr/local/krb5/man/cat4 ; + ! /usr/local/krb5/man/cat5 ; + ! /usr/local/krb5/man/cat6 ; + ! /usr/local/krb5/man/cat7 ; + ! /usr/local/krb5/man/cat8 ; + ! /usr/local/krb5/man/cat9 ; + ! /usr/local/krb5/man/catl ; + ! /usr/local/krb5/man/catn ; + /usr/local/www -> $(SEC_CONFIG) (recurse = true) ; +} + + +( + rulename = "Security Control", + severity = $(SIG_HI) +) +{ + /etc/group -> $(SEC_CRIT) ; + /etc/crontab -> $(SEC_CRIT) ; +} + +#============================================================================= +# +# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Inc. in the United States and other countries. All rights reserved. +# +# FreeBSD is a registered trademark of the FreeBSD Project Inc. +# +# UNIX is a registered trademark of The Open Group. +# +#============================================================================= +# +# Permission is granted to make and distribute verbatim copies of this document +# provided the copyright notice and this permission notice are preserved on all +# copies. +# +# Permission is granted to copy and distribute modified versions of this +# document under the conditions for verbatim copying, provided that the entire +# resulting derived work is distributed under the terms of a permission notice +# identical to this one. +# +# Permission is granted to copy and distribute translations of this document +# into another language, under the above conditions for modified versions, +# except that this permission notice may be stated in a translation approved by +# Tripwire, Inc. +# +# DCM diff --git a/policy/twpol-MirBSD.txt b/policy/twpol-MirBSD.txt index 1591119..a74fb67 100644 --- a/policy/twpol-MirBSD.txt +++ b/policy/twpol-MirBSD.txt @@ -2,8 +2,8 @@ # ## ############################################################################## # # # # -# Policy file for OpenBSD 3.5 # # -# May 20, 2003 # # +# Policy file for MirOS BSD # # +# (adapted from OpenBSD policy) # # # ## ############################################################################## diff --git a/policy/twpol-NetBSD.txt b/policy/twpol-NetBSD.txt new file mode 100644 index 0000000..79e742e --- /dev/null +++ b/policy/twpol-NetBSD.txt @@ -0,0 +1,656 @@ +# +# Policy file for NetBSD +# (adapted from FreeBSD policy) +# +# $FreeBSD: ports/security/tripwire/files/twpol.txt,v 1.2 2002/03/04 16:55:21 cy Exp $ +# $Id: twpol-FreeBSD.txt,v 1.1 2003/06/08 02:00:06 pherman Exp $ + +# +# This is the example Tripwire Policy file. It is intended as a place to +# start creating your own custom Tripwire Policy file. Referring to it as +# well as the Tripwire Policy Guide should give you enough information to +# make a good custom Tripwire Policy file that better covers your +# configuration and security needs. A text version of this policy file is +# called twpol.txt. +# +# Note that this file is tuned to an install of FreeBSD using +# buildworld. If run unmodified, this file should create no errors on +# database creation, or violations on a subsiquent integrity check. +# However it is impossible for there to be one policy file for all machines, +# so this existing one errs on the side of security. Your FreeBSD +# configuration will most likey differ from the one our policy file was +# tuned to, and will therefore require some editing of the default +# Tripwire Policy file. +# +# The example policy file is best run with 'Loose Directory Checking' +# enabled. Set LOOSEDIRECTORYCHECKING=TRUE in the Tripwire Configuration +# file. +# +# Email support is not included and must be added to this file. +# Add the 'emailto=' to the rule directive section of each rule (add a comma +# after the 'severity=' line and add an 'emailto=' and include the email +# addresses you want the violation reports to go to). Addresses are +# semi-colon delimited. +# + + + +# +# Global Variable Definitions +# +# These are defined at install time by the installation script. You may +# Manually edit these if you are using this file directly and not from the +# installation script itself. +# + +@@section GLOBAL +TWROOT=; +TWBIN=; +TWPOL=; +TWDB=; +TWSKEY=; +TWLKEY=; +TWREPORT=; +HOSTNAME=; + +@@section FS +SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change +SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set +SEC_BIN = $(ReadOnly) ; # Binaries that should not change +SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often +SEC_TTY = $(Dynamic)-ugp ; # Tty files that change ownership at login +SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership +SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership +SIG_LOW = 33 ; # Non-critical files that are of minimal security impact +SIG_MED = 66 ; # Non-critical files that are of significant security impact +SIG_HI = 100 ; # Critical files that are significant points of vulnerability + + +# Tripwire Binaries +( + rulename = "Tripwire Binaries", + severity = $(SIG_HI) +) +{ + $(TWBIN)/siggen -> $(SEC_BIN) ; + $(TWBIN)/tripwire -> $(SEC_BIN) ; + $(TWBIN)/twadmin -> $(SEC_BIN) ; + $(TWBIN)/twprint -> $(SEC_BIN) ; +} + +# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases +( + rulename = "Tripwire Data Files", + severity = $(SIG_HI) +) +{ + # NOTE: We remove the inode attribute because when Tripwire creates a backup, + # it does so by renaming the old file and creating a new one (which will + # have a new inode number). Inode is left turned on for keys, which shouldn't + # ever change. + + # NOTE: The first integrity check triggers this rule and each integrity check + # afterward triggers this rule until a database update is run, since the + # database file does not exist before that point. + + $(TWDB) -> $(SEC_CONFIG) -i ; + $(TWPOL)/tw.pol -> $(SEC_BIN) -i ; + $(TWPOL)/tw.cfg -> $(SEC_BIN) -i ; + $(TWPOL)/twcfg.txt -> $(SEC_BIN) ; + $(TWPOL)/twpol.txt -> $(SEC_BIN) ; + $(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_BIN) ; + $(TWSKEY)/site.key -> $(SEC_BIN) ; + + #don't scan the individual reports + $(TWREPORT) -> $(SEC_CONFIG) (recurse=0) ; +} + + +# Tripwire HQ Connector Binaries +#( +# rulename = "Tripwire HQ Connector Binaries", +# severity = $(SIG_HI) +#) +#{ +# $(TWBIN)/hqagent -> $(SEC_BIN) ; +#} +# +# Tripwire HQ Connector - Configuration Files, Keys, and Logs + +# +# Note: File locations here are different than in a stock HQ Connector +# installation. This is because Tripwire 2.3 uses a different path +# structure than Tripwire 2.2.1. +# +# You may need to update your HQ Agent configuation file (or this policy +# file) to correct the paths. We have attempted to support the FHS standard +# here by placing the HQ Agent files similarly to the way Tripwire 2.3 +# places them. +# + +#( +# rulename = "Tripwire HQ Connector Data Files", +# severity = $(SIG_HI) +#) +#{ +# +# # NOTE: Removing the inode attribute because when Tripwire creates a backup +# # it does so by renaming the old file and creating a new one (which will +# # have a new inode number). Leaving inode turned on for keys, which +# # shouldn't ever change. +# +# +# $(TWBIN)/agent.cfg -> $(SEC_BIN) -i ; +# $(TWLKEY)/authentication.key -> $(SEC_BIN) ; +# $(TWDB)/tasks.dat -> $(SEC_CONFIG) ; +# $(TWDB)/schedule.dat -> $(SEC_CONFIG) ; +# +# # Uncomment if you have agent logging enabled. +# #/var/log/tripwire/agent.log -> $(SEC_LOG) ; +#} + + + +# Commonly accessed directories that should remain static with regards to owner and group +( + rulename = "Invariant Directories", + severity = $(SIG_MED) +) +{ + / -> $(SEC_INVARIANT) (recurse = false) ; + /home -> $(SEC_INVARIANT) (recurse = false) ; +} + +# +# First, root's "home" +# + +( + rulename = "Root's home", + severity = $(SIG_HI) +) +{ + # /.rhosts -> $(SEC_CRIT) ; + /.profile -> $(SEC_CRIT) ; + /.cshrc -> $(SEC_CRIT) ; + /.login -> $(SEC_CRIT) ; + # /.exrc -> $(SEC_CRIT) ; + # /.logout -> $(SEC_CRIT) ; + # /.forward -> $(SEC_CRIT) ; + /root -> $(SEC_CRIT) (recurse = true) ; + !/root/.history ; + !/root/.bash_history ; + # !/root/.lsof_SYSTEM_NAME ; # Uncomment if lsof is installed +} + + +# +# FreeBSD Kernel +# + +( + rulename = "FreeBSD Kernel", + severity = $(SIG_HI) +) +{ + /kernel -> $(SEC_CRIT) ; + /kernel.old -> $(SEC_CRIT) ; + /kernel.GENERIC -> $(SEC_CRIT) ; +} + + +# +# FreeBSD Modules +# + +( + rulename = "FreeBSD Modules", + severity = $(SIG_HI) +) +{ + /modules -> $(SEC_CRIT) (recurse = true) ; + /modules.old -> $(SEC_CRIT) (recurse = true) ; + # /lkm -> $(SEC_CRIT) (recurse = true) ; # uncomment if using lkm kld +} + + +# +# System Administration Programs +# + +( + rulename = "System Administration Programs", + severity = $(SIG_HI) +) +{ + /sbin -> $(SEC_CRIT) (recurse = true) ; + /usr/sbin -> $(SEC_CRIT) (recurse = true) ; +} + + +# +# User Utilities +# + +( + rulename = "User Utilities", + severity = $(SIG_HI) +) +{ + /bin -> $(SEC_CRIT) (recurse = true) ; + /usr/bin -> $(SEC_CRIT) (recurse = true) ; +} + + +# +# /dev +# + +( + rulename = "/dev", + severity = $(SIG_HI) +) +{ + /dev -> $(Device) (recurse = true) ; + !/dev/vga ; + !/dev/dri ; + /dev/console -> $(SEC_TTY) ; + /dev/ttyv0 -> $(SEC_TTY) ; + /dev/ttyv1 -> $(SEC_TTY) ; + /dev/ttyv2 -> $(SEC_TTY) ; + /dev/ttyv3 -> $(SEC_TTY) ; + /dev/ttyv4 -> $(SEC_TTY) ; + /dev/ttyv5 -> $(SEC_TTY) ; + /dev/ttyv6 -> $(SEC_TTY) ; + /dev/ttyv7 -> $(SEC_TTY) ; + /dev/ttyp0 -> $(SEC_TTY) ; + /dev/ttyp1 -> $(SEC_TTY) ; + /dev/ttyp2 -> $(SEC_TTY) ; + /dev/ttyp3 -> $(SEC_TTY) ; + /dev/ttyp4 -> $(SEC_TTY) ; + /dev/ttyp5 -> $(SEC_TTY) ; + /dev/ttyp6 -> $(SEC_TTY) ; + /dev/ttyp7 -> $(SEC_TTY) ; + /dev/ttyp8 -> $(SEC_TTY) ; + /dev/ttyp9 -> $(SEC_TTY) ; + /dev/ttypa -> $(SEC_TTY) ; + /dev/ttypb -> $(SEC_TTY) ; + /dev/ttypc -> $(SEC_TTY) ; + /dev/ttypd -> $(SEC_TTY) ; + /dev/ttype -> $(SEC_TTY) ; + /dev/ttypf -> $(SEC_TTY) ; + /dev/ttypg -> $(SEC_TTY) ; + /dev/ttyph -> $(SEC_TTY) ; + /dev/ttypi -> $(SEC_TTY) ; + /dev/ttypj -> $(SEC_TTY) ; + /dev/ttypl -> $(SEC_TTY) ; + /dev/ttypm -> $(SEC_TTY) ; + /dev/ttypn -> $(SEC_TTY) ; + /dev/ttypo -> $(SEC_TTY) ; + /dev/ttypp -> $(SEC_TTY) ; + /dev/ttypq -> $(SEC_TTY) ; + /dev/ttypr -> $(SEC_TTY) ; + /dev/ttyps -> $(SEC_TTY) ; + /dev/ttypt -> $(SEC_TTY) ; + /dev/ttypu -> $(SEC_TTY) ; + /dev/ttypv -> $(SEC_TTY) ; + /dev/cuaa0 -> $(SEC_TTY) ; # modem +} + + +# +# /etc +# + +( + rulename = "/etc", + severity = $(SIG_HI) +) +{ + /etc -> $(SEC_CRIT) (recurse = true) ; + # /etc/mail/aliases -> $(SEC_CONFIG) ; + /etc/dumpdates -> $(SEC_CONFIG) ; + /etc/motd -> $(SEC_CONFIG) ; + !/etc/ppp/connect-errors ; + /etc/skeykeys -> $(SEC_CONFIG) ; + # Uncomment the following 4 lines if your password file does not change + # /etc/passwd -> $(SEC_CONFIG) ; + # /etc/master.passwd -> $(SEC_CONFIG) ; + # /etc/pwd.db -> $(SEC_CONFIG) ; + # /etc/spwd.db -> $(SEC_CONFIG) ; +} + + +# +# Copatibility (Linux) +# + +( + rulename = "Linux Compatibility", + severity = $(SIG_HI) +) +{ + /compat -> $(SEC_CRIT) (recurse = true) ; +# +# Uncomment the following if Linux compatibility is used. Replace +# HOSTNAME1 and HOSTNAME2 with the hosts that have Linux emulation port +# installed. +# +#@@ifhost HOSTNAME1 || HOSTNAME2 +# /compat/linux/etc -> $(SEC_INVARIANT) (recurse = false) ; +# /compat/linux/etc/X11 -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/pam.d -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/profile.d -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/real -> $(SEC_CONFIG) (recurse = true) ; +# /compat/linux/etc/bashrc -> $(SEC_CONFIG) ; +# /compat/linux/etc/csh.login -> $(SEC_CONFIG) ; +# /compat/linux/etc/host.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/hosts.allow -> $(SEC_CONFIG) ; +# /compat/linux/etc/hosts.deny -> $(SEC_CONFIG) ; +# /compat/linux/etc/info-dir -> $(SEC_CONFIG) ; +# /compat/linux/etc/inputrc -> $(SEC_CONFIG) ; +# /compat/linux/etc/ld.so.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/nsswitch.conf -> $(SEC_CONFIG) ; +# /compat/linux/etc/profile -> $(SEC_CONFIG) ; +# /compat/linux/etc/redhat-release -> $(SEC_CONFIG) ; +# /compat/linux/etc/rpc -> $(SEC_CONFIG) ; +# /compat/linux/etc/securetty -> $(SEC_CONFIG) ; +# /compat/linux/etc/shells -> $(SEC_CONFIG) ; +# /compat/linux/etc/termcap -> $(SEC_CONFIG) ; +# /compat/linux/etc/yp.conf -> $(SEC_CONFIG) ; +# !/compat/linux/etc/ld.so.cache ; +# !/compat/linux/var/spool/mail ; +#@@endif +} + + +# +# Libraries, include files, and other system files +# + +( + rulename = "Libraries, include files, and other system files", + severity = $(SIG_HI) +) +{ + /usr/include -> $(SEC_CRIT) (recurse = true) ; + /usr/lib -> $(SEC_CRIT) (recurse = true) ; + /usr/libdata -> $(SEC_CRIT) (recurse = true) ; + /usr/libexec -> $(SEC_CRIT) (recurse = true) ; + /usr/share -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man -> $(SEC_CONFIG) ; + !/usr/share/man/whatis ; + !/usr/share/man/.glimpse_filenames ; + !/usr/share/man/.glimpse_filenames_index ; + !/usr/share/man/.glimpse_filetimes ; + !/usr/share/man/.glimpse_filters ; + !/usr/share/man/.glimpse_index ; + !/usr/share/man/.glimpse_messages ; + !/usr/share/man/.glimpse_partitions ; + !/usr/share/man/.glimpse_statistics ; + !/usr/share/man/.glimpse_turbo ; + /usr/share/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/share/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/share/man/cat1 ; + ! /usr/share/man/cat2 ; + ! /usr/share/man/cat3 ; + ! /usr/share/man/cat4 ; + ! /usr/share/man/cat5 ; + ! /usr/share/man/cat6 ; + ! /usr/share/man/cat7 ; + ! /usr/share/man/cat8 ; + ! /usr/share/man/cat9 ; + ! /usr/share/man/catl ; + ! /usr/share/man/catn ; + /usr/share/perl/man -> $(SEC_CONFIG) ; + !/usr/share/perl/man/whatis ; + !/usr/share/perl/man/.glimpse_filenames ; + !/usr/share/perl/man/.glimpse_filenames_index ; + !/usr/share/perl/man/.glimpse_filetimes ; + !/usr/share/perl/man/.glimpse_filters ; + !/usr/share/perl/man/.glimpse_index ; + !/usr/share/perl/man/.glimpse_messages ; + !/usr/share/perl/man/.glimpse_partitions ; + !/usr/share/perl/man/.glimpse_statistics ; + !/usr/share/perl/man/.glimpse_turbo ; + /usr/share/perl/man/man3 -> $(SEC_CRIT) (recurse = true) ; + ! /usr/share/perl/man/cat3 ; + /usr/local/lib/perl5/5.00503/man -> $(SEC_CONFIG) ; + ! /usr/local/lib/perl5/5.00503/man/whatis ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filters ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filetimes ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_messages ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_statistics ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_index ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_turbo ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_partitions ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filenames ; + ! /usr/local/lib/perl5/5.00503/man/.glimpse_filenames_index ; + /usr/local/lib/perl5/5.00503/man/man3 -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/lib/perl5/5.00503/man/cat3 ; +} + + +# +# X11R6 +# + +( + rulename = "X11R6", + severity = $(SIG_HI) +) +{ + /usr/X11R6 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/lib/X11/xdm -> $(SEC_CONFIG) (recurse = true) ; + !/usr/X11R6/lib/X11/xdm/xdm-errors ; + !/usr/X11R6/lib/X11/xdm/authdir/authfiles ; + !/usr/X11R6/lib/X11/xdm/xdm-pid ; + /usr/X11R6/lib/X11/xkb/compiled -> $(SEC_CONFIG) (recurse = true) ; + /usr/X11R6/man -> $(SEC_CONFIG) ; + !/usr/X11R6/man/whatis ; + !/usr/X11R6/man/.glimpse_filenames ; + !/usr/X11R6/man/.glimpse_filenames_index ; + !/usr/X11R6/man/.glimpse_filetimes ; + !/usr/X11R6/man/.glimpse_filters ; + !/usr/X11R6/man/.glimpse_index ; + !/usr/X11R6/man/.glimpse_messages ; + !/usr/X11R6/man/.glimpse_partitions ; + !/usr/X11R6/man/.glimpse_statistics ; + !/usr/X11R6/man/.glimpse_turbo ; + /usr/X11R6/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/X11R6/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/X11R6/man/cat1 ; + ! /usr/X11R6/man/cat2 ; + ! /usr/X11R6/man/cat3 ; + ! /usr/X11R6/man/cat4 ; + ! /usr/X11R6/man/cat5 ; + ! /usr/X11R6/man/cat6 ; + ! /usr/X11R6/man/cat7 ; + ! /usr/X11R6/man/cat8 ; + ! /usr/X11R6/man/cat9 ; + ! /usr/X11R6/man/catl ; + ! /usr/X11R6/man/catn ; +} + + +# +# sources +# + +( + rulename = "Sources", + severity = $(SIG_HI) +) +{ + /usr/src -> $(SEC_CRIT) (recurse = true) ; + /usr/src/sys/compile -> $(SEC_CONFIG) (recurse = false) ; +} + + +# +# NIS +# + +( + rulename = "NIS", + severity = $(SIG_HI) +) +{ + /var/yp -> $(SEC_CRIT) (recurse = true) ; + !/var/yp/binding ; +} + + +# +# Temporary directories +# +( + rulename = "Temporary directories", + recurse = false, + severity = $(SIG_LOW) +) +{ + /usr/tmp -> $(SEC_INVARIANT) ; + /var/tmp -> $(SEC_INVARIANT) ; + /var/preserve -> $(SEC_INVARIANT) ; + /tmp -> $(SEC_INVARIANT) ; +} + +# +# Local files +# + +( + rulename = "Local files", + severity = $(SIG_MED) +) +{ + /usr/local/bin -> $(SEC_BIN) (recurse = true) ; + /usr/local/sbin -> $(SEC_BIN) (recurse = true) ; + /usr/local/etc -> $(SEC_BIN) (recurse = true) ; + /usr/local/lib -> $(SEC_BIN) (recurse = true ) ; + /usr/local/libexec -> $(SEC_BIN) (recurse = true ) ; + /usr/local/share -> $(SEC_BIN) (recurse = true ) ; + /usr/local/man -> $(SEC_CONFIG) ; + !/usr/local/man/whatis ; + !/usr/local/man/.glimpse_filenames ; + !/usr/local/man/.glimpse_filenames_index ; + !/usr/local/man/.glimpse_filetimes ; + !/usr/local/man/.glimpse_filters ; + !/usr/local/man/.glimpse_index ; + !/usr/local/man/.glimpse_messages ; + !/usr/local/man/.glimpse_partitions ; + !/usr/local/man/.glimpse_statistics ; + !/usr/local/man/.glimpse_turbo ; + /usr/local/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/local/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/man/cat1 ; + ! /usr/local/man/cat2 ; + ! /usr/local/man/cat3 ; + ! /usr/local/man/cat4 ; + ! /usr/local/man/cat5 ; + ! /usr/local/man/cat6 ; + ! /usr/local/man/cat7 ; + ! /usr/local/man/cat8 ; + ! /usr/local/man/cat9 ; + ! /usr/local/man/catl ; + ! /usr/local/man/catn ; + /usr/local/krb5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man -> $(SEC_CONFIG) ; + !/usr/local/krb5/man/whatis ; + !/usr/local/krb5/man/.glimpse_filenames ; + !/usr/local/krb5/man/.glimpse_filenames_index ; + !/usr/local/krb5/man/.glimpse_filetimes ; + !/usr/local/krb5/man/.glimpse_filters ; + !/usr/local/krb5/man/.glimpse_index ; + !/usr/local/krb5/man/.glimpse_messages ; + !/usr/local/krb5/man/.glimpse_partitions ; + !/usr/local/krb5/man/.glimpse_statistics ; + !/usr/local/krb5/man/.glimpse_turbo ; + /usr/local/krb5/man/man1 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man2 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man3 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man4 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man5 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man6 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man7 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man8 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/man9 -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/manl -> $(SEC_CRIT) (recurse = true) ; + /usr/local/krb5/man/mann -> $(SEC_CRIT) (recurse = true) ; + ! /usr/local/krb5/man/cat1 ; + ! /usr/local/krb5/man/cat2 ; + ! /usr/local/krb5/man/cat3 ; + ! /usr/local/krb5/man/cat4 ; + ! /usr/local/krb5/man/cat5 ; + ! /usr/local/krb5/man/cat6 ; + ! /usr/local/krb5/man/cat7 ; + ! /usr/local/krb5/man/cat8 ; + ! /usr/local/krb5/man/cat9 ; + ! /usr/local/krb5/man/catl ; + ! /usr/local/krb5/man/catn ; + /usr/local/www -> $(SEC_CONFIG) (recurse = true) ; +} + + +( + rulename = "Security Control", + severity = $(SIG_HI) +) +{ + /etc/group -> $(SEC_CRIT) ; + /etc/crontab -> $(SEC_CRIT) ; +} + +#============================================================================= +# +# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Inc. in the United States and other countries. All rights reserved. +# +# FreeBSD is a registered trademark of the FreeBSD Project Inc. +# +# UNIX is a registered trademark of The Open Group. +# +#============================================================================= +# +# Permission is granted to make and distribute verbatim copies of this document +# provided the copyright notice and this permission notice are preserved on all +# copies. +# +# Permission is granted to copy and distribute modified versions of this +# document under the conditions for verbatim copying, provided that the entire +# resulting derived work is distributed under the terms of a permission notice +# identical to this one. +# +# Permission is granted to copy and distribute translations of this document +# into another language, under the above conditions for modified versions, +# except that this permission notice may be stated in a translation approved by +# Tripwire, Inc. +# +# DCM diff --git a/src/core/platform.h b/src/core/platform.h index 92b8d82..f6f09b8 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -65,6 +65,7 @@ #define OS_DRAGONFLYBSD 0x0305 #define OS_MIDNIGHTBSD 0x0306 #define OS_MIRBSD 0x0307 +#define OS_BITRIG 0x0308 #define OS_SOLARIS 0x0400 #define OS_AIX 0x0401 @@ -132,8 +133,18 @@ #elif defined(__linux__) #define OS OS_LINUX #define IS_LINUX 1 - - + + +// A herd of BSDs. Have to detect MidnightBSD before FreeBSD, and MirOS & Bitrig before OpenBSD +// because they also define symbols for their ancestor BSDs. +#elif defined(__DragonFly__) + #define OS OS_DRAGONFLYBSD + #define IS_DRAGONFLYBSD 1 + +#elif defined(__MidnightBSD__) + #define OS OS_MIDNIGHTBSD + #define IS_MIDNIGHTBSD 1 + #elif defined(__FreeBSD__) #define OS OS_FREEBSD #define IS_FREEBSD 1 @@ -142,11 +153,14 @@ #define OS OS_NETBSD #define IS_NETBSD 1 - // Must check for __MirBSD__ symbol first since its gcc also defines __OpenBSD__ #elif defined(__MirBSD__) #define OS OS_MIRBSD #define IS_MIRBSD 1 +#elif defined(__Bitrig__) + #define OS OS_BITRIG + #define IS_BITRIG 1 + #elif defined(__OpenBSD__) #define OS OS_OPENBSD #define IS_OPENBSD 1 @@ -155,14 +169,6 @@ #define OS OS_DARWIN #define IS_DARWIN 1 -#elif defined(__DragonFly__) - #define OS OS_DRAGONFLYBSD - #define IS_DRAGONFLYBSD 1 - -#elif defined(__MidnightBSD__) - #define OS OS_MIDNIGHTBSD - #define IS_MIDNIGHTBSD 1 - #elif defined(__sun) #define OS OS_SOLARIS From 3924c4376c88ba7cce75af0824a3d86c845ee610 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 21 Sep 2017 23:34:41 -0700 Subject: [PATCH 100/110] Add unit test to verify IS_xxx platform macros are defined correctly --- src/twtest/platform_t.cpp | 78 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 4 deletions(-) diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index ba7aec2..a0c46c4 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -39,6 +39,8 @@ #include "twtest/test.h" #include "core/error.h" +#include + using namespace std; ///////////////////////////////////////////////////////// @@ -200,9 +202,6 @@ void TestAlignment() // work the way we think they do. void TestSizes() { - cDebug d("TestSizes"); - d.TraceError("Fix this!\n"); - TEST( CanBeRepresentedAs( int8(), int8() ) ); TEST( ! CanBeRepresentedAs( int8(), uint8() ) ); TEST( ! CanBeRepresentedAs( uint8(), int8() ) ); @@ -216,7 +215,7 @@ void TestSizes() TEST( CanBeRepresentedAs( uint16(), uint32() ) ); TEST( CanBeRepresentedAs( uint32(), uint64() ) ); } - + ///////////////////////////////////////////////////////// // TEMPLATIZED UTIL FUNCTION IMPEMENTATIONS ///////////////////////////////////////////////////////// @@ -235,8 +234,79 @@ bool CanBeRepresentedAs( E e, T t ) return fReturn; } + +//////////////////////////// + +#if IS_LINUX +const TSTRING expected_os("Linux"); +#elif IS_DARWIN +const TSTRING expected_os("Darwin"); +#elif IS_CYGWIN +const TSTRING expected_os("Cygwin"); +#elif IS_DOS_DJGPP +const TSTRING expected_os("DJGPP"); +#elif IS_ANDROID +const TSTRING expected_os("Android"); +#elif IS_DRAGONFLYBSD +const TSTRING expected_os("DragonFly"); +#elif IS_MIDNIGHTBSD +const TSTRING expected_os("MidnightBSD"); +#elif IS_FREEBSD +const TSTRING expected_os("FreeBSD"); +#elif IS_NETBSD +const TSTRING expected_os("NetBSD"); +#elif IS_MIRBSD +const TSTRING expected_os("MirBSD"); +#elif IS_BITRIG +const TSTRING expected_os("Bitrig"); +#elif IS_OPENBSD +const TSTRING expected_os("OpenBSD"); +#elif IS_SOLARIS +const TSTRING expected_os("SunOS"); +#elif IS_AIX +const TSTRING expected_os("AIX"); +#elif IS_HPUX +const TSTRING expected_os("HP-UX"); +#elif IS_IRIX +const TSTRING expected_os("IRIX"); +#elif IS_OSF1 +const TSTRING expected_os("Tru64"); +#elif IS_MINIX +const TSTRING expected_os("Minix"); +#elif IS_HURD +const TSTRING expected_os("GNU"); +#elif IS_HAIKU +const TSTRING expected_os("Haiku"); +#elif IS_SYLLABLE +const TSTRING expected_os("Syllable"); +#elif IS_SKYOS +const TSTRING expected_os("SkyOS"); +#elif IS_SORTIX +const TSTRING expected_os("Sortix"); +#elif IS_MINT +const TSTRING expected_os("MiNT"); +#elif IS_AROS +const TSTRING expected_os("AROS"); +#elif IS_RTEMS +const TSTRING expected_os("RTEMS"); +#elif IS_RISCOS +const TSTRING expected_os("RISC OS"); +#else +const TSTRING expected_os("?!?!?"); +#endif + +void TestPlatformDetection() +{ + struct utsname os_info; + TEST( uname(&os_info) == 0); + + TSTRING observed_os(os_info.sysname); + TEST( observed_os == expected_os ); +} + void RegisterSuite_Platform() { RegisterTest("Platform", "Alignment", TestAlignment); RegisterTest("Platform", "Sizes", TestSizes); + RegisterTest("Platform", "PlatformDetection", TestPlatformDetection); } From 6a104efd03258936eb21e74a672363a9b00adfa7 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 22 Sep 2017 20:20:17 -0700 Subject: [PATCH 101/110] Update config.guess & config.sub to GNU latest (but re-adding MidnightBSD fix); add config macros for struct stat fields that aren't always present (instead of static defines in platform.h); platform detection & path handling for Redox --- config.guess | 109 ++++++++++++++++++------------------ config.h.in | 6 ++ config.sub | 63 ++++++++++++++------- configure | 77 +++++++++++++++++++++++++ configure.ac | 3 + src/core/file.h | 10 ++++ src/core/file_unix.cpp | 52 ++++++++++++++++- src/core/platform.h | 12 ++-- src/core/unixfsservices.cpp | 11 +++- src/twtest/file_t.cpp | 61 +++++++++++++++++++- src/twtest/platform_t.cpp | 6 ++ 11 files changed, 326 insertions(+), 84 deletions(-) diff --git a/config.guess b/config.guess index 471f5a5..a05ca70 100644 --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-02-11' +timestamp='2017-09-16' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ timestamp='2016-02-11' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,7 +27,7 @@ timestamp='2016-02-11' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -186,9 +186,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in - arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -256,6 +259,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:Sortix:*:*) echo ${UNAME_MACHINE}-unknown-sortix exit ;; + *:Redox:*:*) + echo ${UNAME_MACHINE}-unknown-redox + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -312,15 +318,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exitcode=$? trap '' 0 exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; @@ -386,7 +383,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 @@ -684,7 +681,7 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac @@ -701,7 +698,7 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w @@ -834,10 +831,11 @@ EOF UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:MidnightBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -860,10 +858,6 @@ EOF *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; @@ -879,27 +873,12 @@ EOF echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; @@ -909,7 +888,7 @@ EOF exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -1006,6 +985,9 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1038,6 +1020,9 @@ EOF ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1285,6 +1270,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1300,14 +1288,21 @@ EOF if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub @@ -1331,15 +1326,18 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) + NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; - NSR-?:NONSTOP_KERNEL:*:*) + NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; @@ -1395,7 +1393,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1414,18 +1412,17 @@ esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/config.h.in b/config.h.in index 51fa1fc..f3f1b37 100644 --- a/config.h.in +++ b/config.h.in @@ -102,6 +102,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLOCKS + +/* Define to 1 if `st_rdev' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_RDEV + /* Define to 1 if you have the `swab' function. */ #undef HAVE_SWAB diff --git a/config.sub b/config.sub index 6f126a0..ec385cc 100644 --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-01-01' +timestamp='2017-09-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ timestamp='2016-01-01' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,7 +33,7 @@ timestamp='2016-01-01' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -67,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,7 +117,7 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -229,9 +229,6 @@ case $os in -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; -psos*) os=-psos ;; @@ -263,7 +260,7 @@ case $basic_machine in | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia64 \ + | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ @@ -301,6 +298,7 @@ case $basic_machine in | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ @@ -314,6 +312,7 @@ case $basic_machine in | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ + | wasm32 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -387,7 +386,7 @@ case $basic_machine in | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ @@ -428,6 +427,7 @@ case $basic_machine in | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ @@ -444,6 +444,7 @@ case $basic_machine in | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -643,6 +644,14 @@ case $basic_machine in basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -938,6 +947,9 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -1022,7 +1034,7 @@ case $basic_machine in ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1032,7 +1044,7 @@ case $basic_machine in ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1233,6 +1245,9 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + wasm32) + basic_machine=wasm32-unknown + ;; w65*) basic_machine=w65-wdc os=-none @@ -1241,6 +1256,9 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + x64) + basic_machine=x86_64-pc + ;; xbox) basic_machine=i686-pc os=-mingw32 @@ -1348,8 +1366,8 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases that might get confused + # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux @@ -1369,9 +1387,9 @@ case $os in -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; - # First accept the basic system types. + # Now accept the basic system types. # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. + # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ @@ -1387,9 +1405,9 @@ case $os in | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ @@ -1399,7 +1417,7 @@ case $os in | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos*) + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1531,6 +1549,8 @@ case $os in ;; -nacl*) ;; + -ios) + ;; -none) ;; *) @@ -1626,6 +1646,9 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; diff --git a/configure b/configure index c33967d..0a503fa 100755 --- a/configure +++ b/configure @@ -2030,6 +2030,63 @@ rm -f conftest.val } # ac_fn_c_compute_int +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member + # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. @@ -6171,6 +6228,26 @@ $as_echo "#define IS_UNIX 1" >>confdefs.h $as_echo "#define NDEBUG 1" >>confdefs.h +ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_RDEV 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 +_ACEOF + + +fi + + for ac_func in strftime gethostname gethostid do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/configure.ac b/configure.ac index 5d7a0b1..2efec78 100644 --- a/configure.ac +++ b/configure.ac @@ -139,6 +139,9 @@ AC_DEFINE(IS_UNIX, 1, [Is a unix type platform]) dnl whether or not to generate debuging code? AC_DEFINE(NDEBUG, 1, [don't generate debuging code]) +dnl look for struct stat members that aren't always there +AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blocks]) + dnl ############################# dnl Checks for standard functions dnl ############################# diff --git a/src/core/file.h b/src/core/file.h index da9f45b..6b50a87 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -163,12 +163,22 @@ public: static bool IsAbsolutePath(const TSTRING& in); }; +class cRedoxPath +{ +public: + static TSTRING AsPosix(const TSTRING& in); + static TSTRING AsNative(const TSTRING& in); + static bool IsAbsolutePath(const TSTRING& in); +}; + #if IS_DOS_DJGPP #define cDevicePath cDosPath #elif IS_AROS #define cDevicePath cArosPath #elif IS_RISCOS #define cDevicePath cRiscosPath +#elif IS_REDOX +#define cDevicePath cRedoxPath #endif diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index ae9fed9..963bc9e 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -522,7 +522,7 @@ TSTRING cDosPath::BackupName( const TSTRING& in ) return path; } - +///////////////////////////////////////////////////////////////////////// bool cArosPath::IsAbsolutePath(const TSTRING& in) { if (in.empty()) @@ -569,7 +569,7 @@ TSTRING cArosPath::AsNative( const TSTRING& in ) return out; } - +///////////////////////////////////////////////////////////////////////// bool cRiscosPath::IsAbsolutePath(const TSTRING& in) { if (in.empty()) @@ -631,3 +631,51 @@ TSTRING cRiscosPath::AsNative( const TSTRING& in ) #endif } + +///////////////////////////////////////////////////////////////////////// +bool cRedoxPath::IsAbsolutePath(const TSTRING& in) +{ + if (in.empty()) + return false; + + if (in[0] == '/') + return true; + + if (in.find(":") != std::string::npos) + return true; + + return false; +} + +// For paths of type file:/dir/file +TSTRING cRedoxPath::AsPosix( const TSTRING& in ) +{ + if (in[0] == '/') + { + return in; + } + + TSTRING out = IsAbsolutePath(in) ? '/' + in : in; + std::string::size_type colon = out.find_first_of(":"); + if( colon != std::string::npos ) + out.erase(colon, 1); + return out; +} + +TSTRING cRedoxPath::AsNative( const TSTRING& in ) +{ + if (in[0] != '/') + { + return in; + } + + std::string::size_type drive = in.find_first_not_of("/"); + TSTRING out = (drive != std::string::npos) ? in.substr(drive) : in; + TSTRING::size_type slash = out.find_first_of('/'); + if(slash != std::string::npos) + out.insert(slash, ":"); + else + out.append(":/"); + + return out; +} diff --git a/src/core/platform.h b/src/core/platform.h index f6f09b8..87a904f 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -83,6 +83,7 @@ #define OS_AROS 0x0508 #define OS_RTEMS 0x0509 #define OS_RISCOS 0x050A +#define OS_REDOX 0x050B #define COMP_UNKNOWN 0 #define COMP_GCC 0x0001 @@ -231,6 +232,10 @@ #define OS OS_RISCOS #define IS_RISCOS 1 +#elif defined(__redox__) + #define OS OS_REDOX + #define IS_REDOX 1 + #endif @@ -311,18 +316,17 @@ #define SUPPORTS_MEMBER_TEMPLATES ( ! IS_SUNPRO ) #define SUPPORTS_EXPLICIT_TEMPLATE_FUNC_INST ( ! IS_SUNPRO ) -#define SUPPORTS_ST_BLOCKS (!IS_DOS_DJGPP) #define SUPPORTS_POSIX_SIGNALS (!IS_DOS_DJGPP) -#define SUPPORTS_NETWORKING (!IS_SORTIX && !IS_DOS_DJGPP) +#define SUPPORTS_NETWORKING (!IS_SORTIX && !IS_DOS_DJGPP && !IS_REDOX) #define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS && !IS_RISCOS) #define NEEDS_SWAB_IMPL (IS_CYGWIN || IS_SYLLABLE || IS_ANDROID || IS_SORTIX) #define USES_MBLEN (!IS_ANDROID && !IS_AROS) -#define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP || IS_RISCOS) +#define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP || IS_RISCOS || IS_REDOX) #define ICONV_CONST_SOURCE (IS_MINIX) #define SUPPORTS_DIRECT_IO (IS_LINUX) // Linux is the only platform where direct i/o hashing has been tested & works properly so far. -#define SUPPORTS_TERMIOS (!IS_RTEMS) +#define SUPPORTS_TERMIOS (!IS_RTEMS && !IS_REDOX) // RTEMS errors are probably just a buildsys issue & this will change or go away. #define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN) diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index 7ad946b..2229b62 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -326,6 +326,7 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const if( ret < 0 ) throw eFSServicesGeneric( strName, iFSServices::GetInstance()->GetErrString() ); +#if HAVE_STRUCT_STAT_ST_RDEV // new stuff 7/17/99 - BAM // if the file is not a device set rdev to zero by hand (most OSs will // do this for us, but some don't) @@ -335,6 +336,7 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const // actual type of the object -- could be a struct (requiring '= {0}' ) util_ZeroMemory( statbuf.st_rdev ); } +#endif //copy information returned by lstat call into the structure passed in stat.gid = statbuf.st_gid; @@ -342,14 +344,21 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const stat.ctime = statbuf.st_ctime; stat.mtime = statbuf.st_mtime; stat.dev = statbuf.st_dev; + +#if HAVE_STRUCT_STAT_ST_RDEV stat.rdev = statbuf.st_rdev; +#else + stat.rdev = 0; +#endif + stat.ino = statbuf.st_ino; stat.mode = statbuf.st_mode; stat.nlink = statbuf.st_nlink; stat.size = statbuf.st_size; stat.uid = statbuf.st_uid; stat.blksize = statbuf.st_blksize; -#if SUPPORTS_ST_BLOCKS + +#if HAVE_STRUCT_STAT_ST_BLOCKS stat.blocks = statbuf.st_blocks; #else stat.blocks = 0; diff --git a/src/twtest/file_t.cpp b/src/twtest/file_t.cpp index 1961926..8ebc8f7 100644 --- a/src/twtest/file_t.cpp +++ b/src/twtest/file_t.cpp @@ -58,7 +58,7 @@ void TestFile() TEST(testStream); } -////////////////// +//////////////////////////////////////////////////////////////////////// void testDosAsPosix(const std::string& in, const std::string& expected) { @@ -132,6 +132,8 @@ void TestDosBackupName() testDosBackupName("C:\\FOO.BAR\\1234.123", "C:\\FOO.BAR\\1234_123"); } + +//////////////////////////////////////////////////////////////////////// void testArosAsPosix(const std::string& in, const std::string& expected) { TEST( expected == cArosPath::AsPosix(in) ); @@ -184,6 +186,59 @@ void TestArosIsAbsolute() } +//////////////////////////////////////////////////////////////////////// +void testRedoxAsPosix(const std::string& in, const std::string& expected) +{ + TEST( expected == cRedoxPath::AsPosix(in) ); +} + +void TestRedoxAsPosix() +{ + testRedoxAsPosix("file:/", "/file/"); + testRedoxAsPosix("file:/Foo", "/file/Foo"); + testRedoxAsPosix("file:/Foo/Bar", "/file/Foo/Bar"); + + testRedoxAsPosix("/file/Foo/Bar", "/file/Foo/Bar"); + + testRedoxAsPosix("Foo", "Foo"); + testRedoxAsPosix("Foo/Bar", "Foo/Bar"); +} + +void testRedoxAsNative(const std::string& in, const std::string& expected) +{ + TEST( expected == cRedoxPath::AsNative(in) ); +} + +void TestRedoxAsNative() +{ + testRedoxAsNative("/file", "file:/"); + testRedoxAsNative("/file/Foo", "file:/Foo" ); + testRedoxAsNative("/file/Foo/Bar", "file:/Foo/Bar" ); + + testRedoxAsNative("file:/Foo/Bar", "file:/Foo/Bar"); + + testRedoxAsNative("Foo", "Foo"); + testRedoxAsNative("Foo/Bar", "Foo/Bar"); +} + +void testRedoxIsAbsolute(const std::string& in, bool expected) +{ + TEST( expected == cRedoxPath::IsAbsolutePath(in) ); +} + +void TestRedoxIsAbsolute() +{ + testRedoxIsAbsolute("file:", true); + testRedoxIsAbsolute("file:/Foo", true); + testRedoxIsAbsolute("file:/Foo/bar", true); + + testRedoxIsAbsolute("/file/Foo/bar", true); + + testRedoxIsAbsolute("Foo/bar", false); + testRedoxIsAbsolute("Foo", false); +} + + void RegisterSuite_File() { RegisterTest("File", "Basic", TestFile); @@ -195,4 +250,8 @@ void RegisterSuite_File() RegisterTest("File", "ArosAsPosix", TestArosAsPosix); RegisterTest("File", "ArosAsNative", TestArosAsNative); RegisterTest("File", "ArosIsAbsolute", TestArosIsAbsolute); + + RegisterTest("File", "RedoxAsPosix", TestRedoxAsPosix); + RegisterTest("File", "RedoxAsNative", TestRedoxAsNative); + RegisterTest("File", "RedoxIsAbsolute", TestRedoxIsAbsolute); } diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index a0c46c4..7e937bf 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -39,7 +39,9 @@ #include "twtest/test.h" #include "core/error.h" +#if HAVE_SYS_UTSNAME_H #include +#endif using namespace std; @@ -291,17 +293,21 @@ const TSTRING expected_os("AROS"); const TSTRING expected_os("RTEMS"); #elif IS_RISCOS const TSTRING expected_os("RISC OS"); +#elif IS_RISCOS +const TSTRING expected_os("Redox"); #else const TSTRING expected_os("?!?!?"); #endif void TestPlatformDetection() { +#if HAVE_SYS_UTSNAME_H struct utsname os_info; TEST( uname(&os_info) == 0); TSTRING observed_os(os_info.sysname); TEST( observed_os == expected_os ); +#endif } void RegisterSuite_Platform() From 9b6750a98c9b098c99bf5039464b9e39470e0f45 Mon Sep 17 00:00:00 2001 From: brc0x1 Date: Fri, 22 Sep 2017 21:02:50 -0700 Subject: [PATCH 102/110] More for Redox support, & cleaner exclusion of SMTP stuff when SUPPORTS_NETWORKING is false --- src/core/msystem.cpp | 7 +++++++ src/core/unixfsservices.cpp | 10 +++++++++- src/tripwire/mailmessage.h | 10 +++++++--- src/tripwire/smtpmailmessage.cpp | 4 ++++ src/tripwire/twcmdlineutil.cpp | 14 ++++++++------ 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/core/msystem.cpp b/src/core/msystem.cpp index 025442d..e122fd1 100644 --- a/src/core/msystem.cpp +++ b/src/core/msystem.cpp @@ -94,6 +94,13 @@ #include #include "msystem.h" +#if IS_REDOX +#define setuid(x) sleep(0) +#define setgid(x) sleep(0) +#endif + + + /* * signal type */ diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index 2229b62..83b576c 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -77,6 +77,10 @@ #include +#if IS_REDOX +#define restrict __restrict__ +#endif + #if HAVE_SYS_SOCKET_H # include # include @@ -538,7 +542,8 @@ bool cUnixFSServices::GetUserName( uid_t user_id, TSTRING& tstrUser ) const bool cUnixFSServices::GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const { bool fSuccess = true; - + +#if !IS_REDOX if( mResolveNames ) { struct group* pg = getgrgid( group_id ); @@ -552,10 +557,13 @@ bool cUnixFSServices::GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const } else { +#endif std::stringstream sstr; sstr << group_id; tstrGroup = sstr.str(); +#if !IS_REDOX } +#endif return( fSuccess ); } diff --git a/src/tripwire/mailmessage.h b/src/tripwire/mailmessage.h index 734119a..5e86aac 100644 --- a/src/tripwire/mailmessage.h +++ b/src/tripwire/mailmessage.h @@ -36,7 +36,11 @@ #include "core/error.h" #endif -#if HAVE_SYS_SOCKET_H +#if IS_REDOX +#define restrict __restrict__ +#endif + +#if SUPPORTS_NETWORKING && HAVE_SYS_SOCKET_H # include #endif #define SOCKET int @@ -207,7 +211,7 @@ public: }; - +#if SUPPORTS_NETWORKING /////////////////////////////////////////////////////////////////////////////// // // This class implements sending a message via SMTP @@ -245,7 +249,7 @@ private: TSTRING mstrServerName; unsigned short mPortNumber; }; - +#endif /////////////////////////////////////////////////////////////////////////////// // diff --git a/src/tripwire/smtpmailmessage.cpp b/src/tripwire/smtpmailmessage.cpp index 695b649..1d04fe5 100644 --- a/src/tripwire/smtpmailmessage.cpp +++ b/src/tripwire/smtpmailmessage.cpp @@ -42,6 +42,8 @@ #include +#if SUPPORTS_NETWORKING + //All the spleck that it takes to run sockets in Unix... #include #if HAVE_SYS_SOCKET_H @@ -564,3 +566,5 @@ void cSMTPMailMessage::DecodeError() #endif // defined(_DEBUG) } +#endif // SUPPORTS_NETWORKING + diff --git a/src/tripwire/twcmdlineutil.cpp b/src/tripwire/twcmdlineutil.cpp index 98e95c5..68fb7b2 100644 --- a/src/tripwire/twcmdlineutil.cpp +++ b/src/tripwire/twcmdlineutil.cpp @@ -536,15 +536,16 @@ static bool EmailReportTo(const TSTRING &toAddress, const cFCOReportHeader& head // allocate the right kind of emailer object based on what came out of the config file. switch (modeCommon->mMailMethod) { - default: - ASSERT(false); - return false; +#if SUPPORTS_NETWORKING case cMailMessage::MAIL_BY_SMTP: reportMail = TW_UNIQUE_PTR(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort)); break; +#endif case cMailMessage::MAIL_BY_PIPE: reportMail = TW_UNIQUE_PTR(new cPipedMailMessage(modeCommon->mMailProgram)); break; + default: + return false; } TSTRING strTempFilename; @@ -690,15 +691,16 @@ bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING &mAddress, const cTWMode // allocate the right kind of emailer object based on what came out of the config file. switch (modeCommon->mMailMethod) { - default: - ASSERT(false); - return false; +#if SUPPORTS_NETWORKING case cMailMessage::MAIL_BY_SMTP: reportMail = TW_UNIQUE_PTR(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort)); break; +#endif case cMailMessage::MAIL_BY_PIPE: reportMail = TW_UNIQUE_PTR(new cPipedMailMessage(modeCommon->mMailProgram)); break; + default: + return false; } From ea885446c252f415dcc2ce7bf6e5d2d93c8e5f0e Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 22 Sep 2017 23:40:36 -0700 Subject: [PATCH 103/110] Small Redox path tweaks --- src/core/unixfsservices.cpp | 2 +- src/tripwire/twcmdline.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index 83b576c..c48e34f 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -846,7 +846,7 @@ bool cUnixFSServices::FullPath( TSTRING& strFullPath, const TSTRING& strRelPathC d.TraceDebug("FullPath is now %s\n", strFullPath.c_str()); } -#if IS_AROS +#if IS_AROS || IS_REDOX strFullPath = cDevicePath::AsNative(strFullPath); #endif diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 39e9577..4254d71 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -266,6 +266,8 @@ static void util_InitTempDirectory(const cConfigFile& cf) temp_directory = "/dev/c/temp/"; #elif IS_RISCOS temp_directory = "/!BOOT/Resources/!Scrap/ScrapDirs/ScrapDir"; +#elif IS_REDOX + temp_directory = "/file/tmp/"; #else temp_directory = "/tmp/"; #endif From 99641c468f7c9c477ae84b19ebc0342d574b2261 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 23 Sep 2017 13:19:40 -0700 Subject: [PATCH 104/110] Add a platform macro indicating whether OS lets temp files be unlinked while open --- src/core/file_unix.cpp | 4 ++-- src/core/platform.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index 963bc9e..8144aa0 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -94,7 +94,7 @@ cFile_i::~cFile_i() fclose( mpCurrStream ); mpCurrStream = NULL; -#if IS_AROS || IS_RISCOS +#if !CAN_UNLINK_WHILE_OPEN // so unlink after close instead if( mFlags & cFile::OPEN_LOCKED_TEMP ) { // unlink this file @@ -209,7 +209,7 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags ) } mpData->m_fd = fh; -#if !IS_AROS && !IS_RISCOS +#if CAN_UNLINK_WHILE_OPEN if( flags & OPEN_LOCKED_TEMP ) { // unlink this file diff --git a/src/core/platform.h b/src/core/platform.h index 87a904f..7faeb7e 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -328,6 +328,9 @@ #define SUPPORTS_TERMIOS (!IS_RTEMS && !IS_REDOX) // RTEMS errors are probably just a buildsys issue & this will change or go away. +// Redox will probably implement this in the future. + +#define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX) #define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN) // POSIX standard says paths beginning with 2 slashes are "implementation defined" From 1333f3c15e3b673df619eb192803e14cdbd7b835 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 23 Sep 2017 18:21:13 -0700 Subject: [PATCH 105/110] LibertyBSD platform detection --- configure | 3 +++ configure.ac | 3 +++ src/core/platform.h | 5 +++++ src/twtest/platform_t.cpp | 2 ++ 4 files changed, 13 insertions(+) diff --git a/configure b/configure index 0a503fa..2d13e8b 100755 --- a/configure +++ b/configure @@ -7097,6 +7097,9 @@ case $target in ;; *-*-netbsd*) ;; + *-*-libertybsd*) + CXXFLAGS="${CXXFLAGS} -DTW_LibertyBSD" + ;; i[0-9]86-pc-linux*) ;; sparc-*-linux*) diff --git a/configure.ac b/configure.ac index 2efec78..ca3439d 100644 --- a/configure.ac +++ b/configure.ac @@ -338,6 +338,9 @@ case $target in ;; *-*-netbsd*) ;; + *-*-libertybsd*) + CXXFLAGS="${CXXFLAGS} -DTW_LibertyBSD" + ;; i[[0-9]]86-pc-linux*) ;; sparc-*-linux*) diff --git a/src/core/platform.h b/src/core/platform.h index 7faeb7e..ba40bcc 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -66,6 +66,7 @@ #define OS_MIDNIGHTBSD 0x0306 #define OS_MIRBSD 0x0307 #define OS_BITRIG 0x0308 +#define OS_LIBERTYBSD 0x0309 #define OS_SOLARIS 0x0400 #define OS_AIX 0x0401 @@ -162,6 +163,10 @@ #define OS OS_BITRIG #define IS_BITRIG 1 +#elif defined(TW_LibertyBSD) + #define OS OS_LIBERTYBSD + #define IS_LIBERTYBSD 1 + #elif defined(__OpenBSD__) #define OS OS_OPENBSD #define IS_OPENBSD 1 diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index 7e937bf..fffdf4d 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -261,6 +261,8 @@ const TSTRING expected_os("NetBSD"); const TSTRING expected_os("MirBSD"); #elif IS_BITRIG const TSTRING expected_os("Bitrig"); +#elif IS_LIBERTYBSD +const TSTRING expected_os("LibertyBSD"); #elif IS_OPENBSD const TSTRING expected_os("OpenBSD"); #elif IS_SOLARIS From 9872bef2f22048dac80e77d4239cbd6bcf50ff7a Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 24 Sep 2017 18:44:47 -0700 Subject: [PATCH 106/110] Fix/implement more unit tests that were marked as 'skipped' --- src/core/tasktimer.h | 123 +++++++++------------------ src/tripwire/twcmdline.cpp | 4 +- src/tw/twutil.cpp | 4 +- src/twtest/charutil_t.cpp | 21 ++--- src/twtest/fsdatasourceiter_t.cpp | 109 ++++++++++++------------ src/twtest/fsobject_t.cpp | 25 +++++- src/twtest/refcountobj_t.cpp | 10 ++- src/twtest/tasktimer_t.cpp | 23 ++++- src/twtest/twlocale_t.cpp | 134 ------------------------------ 9 files changed, 156 insertions(+), 297 deletions(-) diff --git a/src/core/tasktimer.h b/src/core/tasktimer.h index 51f8867..59135dd 100644 --- a/src/core/tasktimer.h +++ b/src/core/tasktimer.h @@ -46,105 +46,60 @@ #endif #include +#include + /////////////////////////////////////////////////////////////////////////////// // cTaskTimer -- /////////////////////////////////////////////////////////////////////////////// -template class cTaskTimer { + + public: cTaskTimer(const TSTRING& name) : mName(name), mTotalTime(0), mStartTime(0), mNumStarts(0) {} - ~cTaskTimer(); - void Start(); - void Stop(); + inline ~cTaskTimer() + { + // stop the timer if it is currently running + if(IsRunning()) + Stop(); + + // trace out the time contents... + cDebug d("cTaskTimer"); + d.TraceDebug("----- Time to execute %s: %d (started %d times)\n", mName.c_str(), mTotalTime, mNumStarts); + } + + inline void Start() + { + ASSERT(! IsRunning()); + time_t dummy; + mStartTime = time(&dummy); + mNumStarts++; + } + + void Stop() + { + ASSERT(IsRunning()); + time_t dummy; + mTotalTime += ( time(&dummy) - mStartTime ); + mStartTime = 0; + } + bool IsRunning() { return (mStartTime != 0); } - void Reset() { mNumStarts = mStartTime = mTotalTime = 0 } - int32 GetTotalTime() const; - int32 GetNumTimesStarted() const; // returns the number of times start() was called - const std::string& GetName() const; + void Reset() { mNumStarts = mStartTime = mTotalTime = 0; } + uint32 GetTotalTime() const { return mTotalTime; } + uint32 GetNumTimesStarted() const { return mNumStarts; } + const std::string& GetName() const { return mName; } private: TSTRING mName; - int32 mTotalTime; - TIME_TYPE mStartTime; - int32 mNumStarts; + uint32 mTotalTime; + uint32 mStartTime; + uint32 mNumStarts; + }; -/////////////////////////////////////////////////////////////////////////////// -// cUnixTimeFn -- Unix version, inserts proper function call and overloads -// operator() -/////////////////////////////////////////////////////////////////////////////// -#include -class cUnixTimeFn -{ -public: - typedef uint32 DataType; - - uint32 operator()() - { - return time( &dummy_var ); - } -private: - time_t dummy_var; -}; - -/////////////////////////////////////////////////////////////////////////////// -// cUnixTaskTimer -- the Unix typedef... -/////////////////////////////////////////////////////////////////////////////// -typedef cTaskTimer cUnixTaskTimer; -typedef cUnixTaskTimer cGenericTaskTimer; - - - -//----------------------------------------------------------------------------- -// inline implementation -//----------------------------------------------------------------------------- - -template -inline void cTaskTimer::Start() -{ - ASSERT(! IsRunning()); - TIME_FN GetTime; - mStartTime = GetTime(); - mNumStarts++; -} - -template -inline void cTaskTimer::Stop() -{ - ASSERT(IsRunning()); - TIME_FN GetTime; - mTotalTime += ( GetTime() - mStartTime ); - mStartTime = 0; -} - -template -inline int32 cTaskTimer::GetTotalTime() const -{ - return mTotalTime; -} - -template -inline const std::string& cTaskTimer::GetName() const -{ - return mName -} - -template -inline cTaskTimer::~cTaskTimer() -{ - // stop the timer if it is currently running - if(IsRunning()) - Stop(); - - // trace out the time contents... - cDebug d("cTaskTimer"); - d.TraceDebug("----- Time to execute %s: %d (started %d times)\n", mName.c_str(), mTotalTime, mNumStarts); -} - - #endif diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 4254d71..9a971f5 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -751,7 +751,7 @@ int cTWModeDbInit::Execute(cErrorQueue* pQueue) cTWCmdLineUtil::ParsePolicyFile(genreSpecList, mpData->mPolFile, mpData->mSiteKeyFile, pQueue); #ifdef TW_PROFILE - cWin32TaskTimer timer("cTripwire::GenerateDatabase"); + cTaskTimer timer("cTripwire::GenerateDatabase"); timer.Start(); #endif @@ -1375,7 +1375,7 @@ int cTWModeIC::Execute(cErrorQueue* pQueue) iUserNotify::GetInstance()->Notify(1, TSS_GetString( cTripwire, tripwire::STR_INTEGRITY_CHECK).c_str()); #ifdef TW_PROFILE - cWin32TaskTimer timer("cTripwire::IntegrityCheck"); + cTaskTimer timer("cTripwire::IntegrityCheck"); timer.Start(); #endif cIntegrityCheck ic( (cGenre::Genre)dbIter.GetGenre(), specList, dbIter.GetDb(), report, pQueue ); diff --git a/src/tw/twutil.cpp b/src/tw/twutil.cpp index f02e0e2..d8a3a13 100644 --- a/src/tw/twutil.cpp +++ b/src/tw/twutil.cpp @@ -345,7 +345,7 @@ void cTWUtil::WriteDatabase(const TCHAR* filename, cFCODatabaseFile& db, bool bE //fileHeader.SetVersion(1); #ifdef TW_PROFILE - cWin32TaskTimer timer(_T("Write Database")); + cTaskTimer timer(_T("Write Database")); timer.Start(); #endif @@ -370,7 +370,7 @@ void cTWUtil::ReadDatabase(const TCHAR* filename, cFCODatabaseFile& db, const cE cDisplayEncoder::EncodeInline( filename ).c_str() ); #ifdef TW_PROFILE - cWin32TaskTimer timer("cTWUtil::ReadDatabase"); + cTaskTimer timer("cTWUtil::ReadDatabase"); timer.Start(); #endif diff --git a/src/twtest/charutil_t.cpp b/src/twtest/charutil_t.cpp index 827f5ef..13d7c38 100644 --- a/src/twtest/charutil_t.cpp +++ b/src/twtest/charutil_t.cpp @@ -43,7 +43,7 @@ #include "twtest/test.h" -void PrintChars( const TSTRING& str ) +void CheckChars( const TSTRING& str, int length_expected = 1) { TSTRING::const_iterator cur = str.begin(); TSTRING::const_iterator end = str.end(); @@ -51,19 +51,9 @@ void PrintChars( const TSTRING& str ) while( cCharUtil::PopNextChar( cur, end, first, last ) ) { - TCOUT << _T("char length: ") << (int)(last - first) << std::endl; - - TCOUT << _T("char: <"); - for( TSTRING::const_iterator at = first; at != last; at++ ) - { - if( at != first ) - TCOUT << _T(","); - TCOUT << (int)*at; - } - TCOUT << _T(">") << std::endl; + int length = (int)(last - first); + TEST(length == length_expected); } - - TCOUT << _T("----------------------------") << std::endl; } /////////////////////////////////////////////////////////////////////////// @@ -71,8 +61,9 @@ void PrintChars( const TSTRING& str ) /////////////////////////////////////////////////////////////////////////// void TestCharUtilBasic() { - PrintChars( _T("foo") ); - PrintChars( _T("fo\x23 54") ); + CheckChars( "foo" ); + CheckChars( "fo\x23 54" ); + CheckChars( "\U0001F408", 4 ); //Cat emoji. Assumes UTF-8 } void RegisterSuite_CharUtil() diff --git a/src/twtest/fsdatasourceiter_t.cpp b/src/twtest/fsdatasourceiter_t.cpp index 21608a3..710618f 100644 --- a/src/twtest/fsdatasourceiter_t.cpp +++ b/src/twtest/fsdatasourceiter_t.cpp @@ -36,84 +36,89 @@ #include "core/debug.h" #include "twtest/test.h" #include "fco/fco.h" +#include "fco/twfactory.h" +#include "core/errorbucketimpl.h" -/* -static void PrintDb( cHierDatabase::iterator iter, cDebug d, bool bFirst = true ) +namespace { - if( ! bFirst ) - { - iter.Descend(); - } - d.TraceDebug( "-- Processing directory %s\n", iter.GetCwd().c_str() ); +int num_processed = 0; - for( iter.SeekBegin(); ! iter.Done(); iter.Next() ) - { - d.TraceDebug( "Processing entry %s\n", iter.GetName().c_str() ); - if( iter.CanDescend() ) - { - d.TraceDebug( ">>Descending...\n" ); - PrintDb(iter, d, false); - } - } - - d.TraceDebug( "-- Done Processing directory %s\n", iter.GetCwd().c_str() ); -} -*/ - -static void PrintIter( cFSDataSourceIter iter, cDebug& d ) +void util_ProcessDir( iFCODataSourceIter* pIter ) { - int count = 0; - - if( ! iter.CanDescend() ) - { - d.TraceError( "Iterator cannot descend; returning!\n"); - TEST(!"Unexpected !CanDescend at beginning of test"); + TEST( ! pIter->Done() ); + TEST( pIter->CanDescend() ); + if( ! pIter->CanDescend() ) return; - } - iter.Descend(); - iter.TraceContents(); - for( iter.SeekBegin(); ! iter.Done(); iter.Next() ) + pIter->Descend(); + + for( pIter->SeekBegin(); ! pIter->Done(); pIter->Next() ) { - count++; - iFCO* pFCO = iter.CreateFCO(); + iFCO* pFCO = pIter->CreateFCO(); if( pFCO ) { - pFCO->TraceContents(); + num_processed++; pFCO->Release(); + + if( pIter->CanDescend() ) + { + TW_UNIQUE_PTR pCopy( pIter->CreateCopy() ); + util_ProcessDir( pCopy.get() ); + } } else { - d.TraceError( "*** Create of FCO failed!\n"); - fail("CreateFCO() failure"); + fail("CreateFCO failure"); } - if( iter.CanDescend() ) + } +} + +void util_ProcessDir( const cFCOName& name ) +{ + //Create a cFSDataSourceIter the same way we do in DB gen / IC + TW_UNIQUE_PTR pDSIter(iTWFactory::GetInstance()->CreateDataSourceIter()); + + cErrorQueue errorQueue; + pDSIter->SetErrorBucket(&errorQueue); + + pDSIter->SeekToFCO ( name, false ); // false means don't generate my peers... + if( ! pDSIter->Done() ) + { + iFCO* pFCO = pDSIter->CreateFCO(); + if( pFCO ) { - d.TraceDebug( ">>Descending...\n" ); - PrintIter(iter, d); + num_processed++; + pFCO->Release(); + + if( pDSIter->CanDescend() ) + { + TW_UNIQUE_PTR pCopy( pDSIter->CreateCopy() ); + util_ProcessDir( pCopy.get() ); + } + } + else + { + fail("CreateFCO failure"); } } - TEST(count > 0); + TEST( 0 == errorQueue.GetNumErrors()); + TEST( 0 < num_processed ); } +} // namespace + + +////////////////////////////////////// + void TestFSDataSourceIter() { - skip("Fix this test"); - - cFSDataSourceIter iter; cDebug d("TestFSDataSourceIter"); + cFCOName base(TwTestDir()); - - // go to my temp directory and iterate over everything! - iter.SeekToFCO( cFCOName(TwTestDir()) ); - - // - // print out everything below the iterator - // - PrintIter( iter, d ); + util_ProcessDir(base); } void RegisterSuite_FSDataSourceIter() diff --git a/src/twtest/fsobject_t.cpp b/src/twtest/fsobject_t.cpp index 28d5fdd..bbdfd26 100644 --- a/src/twtest/fsobject_t.cpp +++ b/src/twtest/fsobject_t.cpp @@ -32,13 +32,34 @@ // fsobject_t -- the file system object test driver #include "fs/stdfs.h" #include "fs/fsobject.h" +#include "fs/fspropcalc.h" #include "test.h" +#include void TestFSObject() { cDebug d("TestFSObject"); - d.TraceError("Implement this!\n"); - skip("TestFSObject not implemented"); + + cFCOName path( TwTestPath("fsobject") ); + std::ofstream fstr(path.AsString().c_str()); + if(fstr.bad()) + { + d.TraceError("Unable to create test file %s!\n", path.AsString().c_str()); + TEST(false); + } + fstr.close(); + + cFSObject obj(path); + + cFSPropCalc propCalc; + cFCOPropVector v(obj.GetPropSet()->GetValidVector().GetSize()); + for( int x=0; x < cFSPropSet::PROP_NUMITEMS; x++) + v.AddItem(x); + propCalc.SetPropVector(v); + + obj.AcceptVisitor(&propCalc); + + TEST(obj.GetPropSet()->GetNumProps() == cFSPropSet::PROP_NUMITEMS); } void RegisterSuite_FSObject() diff --git a/src/twtest/refcountobj_t.cpp b/src/twtest/refcountobj_t.cpp index fb870ac..610eab8 100644 --- a/src/twtest/refcountobj_t.cpp +++ b/src/twtest/refcountobj_t.cpp @@ -158,9 +158,13 @@ void TestRefCountObj() } } - //These fields only exist in debug builds, so we can't use TEST() here. - ASSERT(cRefCountObj::objectCounter == 0); - ASSERT(cRefCountObj::referenceCounter == 0); +#ifdef DEBUG + //These fields only exist in debug builds + TEST(cRefCountObj::objectCounter == 0); + TEST(cRefCountObj::referenceCounter == 0); +#else + TEST("This test can only make useful assertions in debug builds"); +#endif db.TraceAlways("Done...\n"); diff --git a/src/twtest/tasktimer_t.cpp b/src/twtest/tasktimer_t.cpp index 383021b..ae774bd 100644 --- a/src/twtest/tasktimer_t.cpp +++ b/src/twtest/tasktimer_t.cpp @@ -32,12 +32,29 @@ // tasktimer_t -- test driver for cTaskTimer #include "core/stdcore.h" #include "test.h" +#include "core/tasktimer.h" +#include void TestTaskTimer() { - cDebug d("TestTaskTimer"); - d.TraceError("Implement this!\n"); - skip("TestTaskTimer unimplemented"); + cTaskTimer timer("unit testing"); + + TEST(!timer.IsRunning()); + TEST(0 == timer.GetTotalTime()); + TEST(0 == timer.GetNumTimesStarted()); + + for( int counter=0; counter<5; counter++) + { + timer.Start(); + TEST(timer.IsRunning()); + sleep(1); + timer.Stop(); + TEST(!timer.IsRunning()); + } + + TEST(!timer.IsRunning()); + TEST(5 >= timer.GetTotalTime()); + TEST(5 == timer.GetNumTimesStarted()); } void RegisterSuite_TaskTimer() diff --git a/src/twtest/twlocale_t.cpp b/src/twtest/twlocale_t.cpp index b679d5b..4b3e2ec 100644 --- a/src/twtest/twlocale_t.cpp +++ b/src/twtest/twlocale_t.cpp @@ -55,38 +55,6 @@ void TestHex(); TEST( false ); \ } catch( error& ) {} -/* We don't do atoi stuff in cTWLocale anymore -void TestAtoi() -{ - // - // setup - // - int32 n; - TSTRING str = _T("123456"); - - // - // Try formatting with our default locale - // - TWLocale::InitGlobalLocale(); - n = cTWLocale::FormatNumberClassic( str ); - TEST( n == 123456 ); - - // - // Try formatting with "" locale - // - std::locale::global( std::locale("") ); - n = cTWLocale::FormatNumberClassic( str ); - TEST( n == 123456 ); - - // - // Try formatting with "C" locale - // - std::locale::global( std::locale("") ); - n = cTWLocale::FormatNumberClassic( str ); - TEST( n == 123456 ); -} -*/ - void TestItoa() { try @@ -129,110 +97,8 @@ void TestItoa() } } -/* We don't do atoi stuff in cTWLocale anymore, so no roundtrip -void TestRoundtrip() -{ - // - // init - // - cTWLocale::InitGlobalLocale(); - - // - // atoitoa - // - TSTRING strIn = _T("123456"); - TSTRING strOut; - strOut = cTWLocale::FormatNumber( cTWLocale::FormatNumberClassic( strIn ), strOut ); - // don't know if string will be the same due to possible changes in formatting from locale - // ASSERT( strOut == strIn ); <---- can't do this ^^^ - TEST( 123456 == cTWLocale::FormatNumberClassic( strOut ) ); - - - // - // itoatoi - // - int32 nIn = 654321; - int32 nOut; - nOut = cTWLocale::FormatNumberClassic( cTWLocale::FormatNumber( nIn, strIn ) ); - TEST( nOut == nIn ); -} -*/ - -void TestFlags() -{ - skip("Modernize & re-enable this"); -#if 0 - // - // init - // - cTWLocale::InitGlobalLocale(); - - // - // hex - // - TSTRING str = _T("FF"); - int n = cTWLocale::FormatNumber( str, std::ios_base::hex ); - TEST( n == 0xFF ); - - // - // bad number for dec - // - ASSERT_THAT_IT_THROWS( cTWLocale::FormatNumberAsHex( str ), eError ); - - // - // oct - // - TSTRING strOct = _T("0712"); - n = cTWLocale::FormatNumber( strOct, std::ios_base::oct ); - TEST( n == 0712 ); - - // - // oct again - // - strOct = _T("00712"); - n = cTWLocale::FormatNumber( strOct, std::ios_base::oct ); - TEST( n == 0712 ); - - // - // oct again again - // - strOct = _T("712"); - n = cTWLocale::FormatNumber( strOct, std::ios_base::oct ); - TEST( n == 0712 ); - - // - // try bad oct - // - ASSERT_THAT_IT_THROWS( cTWLocale::FormatNumber( _T("99"), std::ios_base::oct ), eError ); -#endif -} - - -/* -void doTestHex(const uint32 value, const std::string& expected, const std::string& expected2 = "") -{ - TSTRING str = cTWLocale::FormatNumberAsHex( value ); - TCERR << "STR = " << str << " | Expected = " << expected << " | Expected2 = " << expected2 << std::endl; - TEST( str == expected || (!expected2.empty() && str == expected2) ); -} - -void TestHex() -{ - TSTRING str; - - doTestHex( 0x1234, _T("1234") ); - doTestHex( 16, _T("10") ); - doTestHex( 0x12344321, _T("12344321") ); - doTestHex( 0xFFFFFFFF, _T("FFFFFFFF"), _T("ffffffff")); -} -*/ - void RegisterSuite_TWLocale() { -// RegisterTest("TWLocale", "Hex", TestHex); -// RegisterTest("TWLocale", "Atoi", TestAtoi); RegisterTest("TWLocale", "Itoa", TestItoa); - RegisterTest("TWLocale", "Flags", TestFlags); -// RegisterTest("TWLocale", "Roundtrip", TestRoundtrip); } From 249c2cd33ff4bc408db0cb773313d2ab31f00f78 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 24 Sep 2017 23:48:57 -0700 Subject: [PATCH 107/110] Additional unit test tweaks to make DOS+DJGPP happier --- src/core/platform.h | 2 +- src/twtest/archive_t.cpp | 15 ++++++++++++++- src/twtest/charutil_t.cpp | 23 ++++++++++++++++++++++- src/twtest/platform_t.cpp | 6 +++++- src/twtest/tasktimer_t.cpp | 2 +- 5 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/core/platform.h b/src/core/platform.h index ba40bcc..7667c26 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -335,7 +335,7 @@ // RTEMS errors are probably just a buildsys issue & this will change or go away. // Redox will probably implement this in the future. -#define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX) +#define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX && !IS_DOS_DJGPP) #define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN) // POSIX standard says paths beginning with 2 slashes are "implementation defined" diff --git a/src/twtest/archive_t.cpp b/src/twtest/archive_t.cpp index cf6410f..260ec4b 100644 --- a/src/twtest/archive_t.cpp +++ b/src/twtest/archive_t.cpp @@ -38,6 +38,7 @@ #include "core/archive.h" #include "twtest/test.h" #include "core/error.h" +#include "tw/twutil.h" #include TSS_EXCEPTION(eTestArchiveError, eError); @@ -119,6 +120,12 @@ void TestLockedTemporaryArchive() lockedArch.OpenReadWrite(); lockedArch.Close(); } + catch (eError& e) + { + threw=true; + TCERR << "Error opening locked temp archive" << std::endl; + cTWUtil::PrintErrorMsg(e); + } catch (...) { threw = true; @@ -142,6 +149,12 @@ void TestLockedTemporaryArchive() // this should delete the file lockedArch.Close(); } + catch (eError& e) + { + threw=true; + TCERR << "Error writing locked temp archive" << std::endl; + cTWUtil::PrintErrorMsg(e); + } catch (...) { threw = true; @@ -215,6 +228,6 @@ void TestFileArchive() void RegisterSuite_Archive() { RegisterTest("Archive", "MemoryArchive", TestMemoryArchive); - RegisterTest("Archive", "LockedTemporaryArchive)", TestLockedTemporaryArchive); + RegisterTest("Archive", "LockedTemporaryArchive", TestLockedTemporaryArchive); RegisterTest("Archive", "FileArchive", TestFileArchive); } diff --git a/src/twtest/charutil_t.cpp b/src/twtest/charutil_t.cpp index 13d7c38..79166b7 100644 --- a/src/twtest/charutil_t.cpp +++ b/src/twtest/charutil_t.cpp @@ -42,6 +42,21 @@ #include "core/errorbucketimpl.h" #include "twtest/test.h" +#include + +bool localeIsUtf8() +{ + std::string locale(setlocale(LC_CTYPE, 0)); + std::transform(locale.begin(), locale.end(), locale.begin(), ::tolower); + + if(locale.find("utf-8") != std::string::npos) + return true; + + if(locale.find("utf8") != std::string::npos) + return true; + + return false; +} void CheckChars( const TSTRING& str, int length_expected = 1) { @@ -52,6 +67,8 @@ void CheckChars( const TSTRING& str, int length_expected = 1) while( cCharUtil::PopNextChar( cur, end, first, last ) ) { int length = (int)(last - first); + if (length != length_expected ) + TCERR << "CheckChars on '" << str << "' : expected = " << length_expected << " | observed = " << length << std::endl; TEST(length == length_expected); } } @@ -63,7 +80,11 @@ void TestCharUtilBasic() { CheckChars( "foo" ); CheckChars( "fo\x23 54" ); - CheckChars( "\U0001F408", 4 ); //Cat emoji. Assumes UTF-8 + + if(localeIsUtf8()) + CheckChars( "\U0001F408", 4 ); //Cat emoji, if UTF-8 + else + CheckChars( "\U0001F408", 1 ); // just a bag of bytes otherwise } void RegisterSuite_CharUtil() diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index fffdf4d..ccfd667 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -246,7 +246,7 @@ const TSTRING expected_os("Darwin"); #elif IS_CYGWIN const TSTRING expected_os("Cygwin"); #elif IS_DOS_DJGPP -const TSTRING expected_os("DJGPP"); +const TSTRING expected_os("FreeDOS"); // This will likely fail for other DOS flavors #elif IS_ANDROID const TSTRING expected_os("Android"); #elif IS_DRAGONFLYBSD @@ -308,6 +308,10 @@ void TestPlatformDetection() TEST( uname(&os_info) == 0); TSTRING observed_os(os_info.sysname); + + if ( observed_os != expected_os ) + TCERR << "Expected OS: " << expected_os << " | Observed OS: " << observed_os << std::endl; + TEST( observed_os == expected_os ); #endif } diff --git a/src/twtest/tasktimer_t.cpp b/src/twtest/tasktimer_t.cpp index ae774bd..b702093 100644 --- a/src/twtest/tasktimer_t.cpp +++ b/src/twtest/tasktimer_t.cpp @@ -53,7 +53,7 @@ void TestTaskTimer() } TEST(!timer.IsRunning()); - TEST(5 >= timer.GetTotalTime()); + TEST(5 <= timer.GetTotalTime()); TEST(5 == timer.GetNumTimesStarted()); } From 9bdb855d9a9ab3feb56336ecf78740c1b76bb60f Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Tue, 26 Sep 2017 00:46:56 -0700 Subject: [PATCH 108/110] Don't look for stuff in /dev on AROS during configure, as this pops up an ugly 'Please insert disk' dialog box. --- configure | 18 ++++++++++++------ configure.ac | 23 +++++++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 2d13e8b..6a9c917 100755 --- a/configure +++ b/configure @@ -6376,24 +6376,30 @@ done -if test -c "/dev/random"; then +UNAME=`uname` + + +if [ $UNAME != "AROS" ]; then + + if test -c "/dev/random"; then $as_echo "#define HAVE_DEV_RANDOM 1" >>confdefs.h -fi + fi -if test -c "/dev/urandom"; then + if test -c "/dev/urandom"; then $as_echo "#define HAVE_DEV_URANDOM 1" >>confdefs.h -fi + fi -if test -c "/dev/arandom"; then + if test -c "/dev/arandom"; then $as_echo "#define HAVE_DEV_ARANDOM 1" >>confdefs.h -fi + fi +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lc" >&5 diff --git a/configure.ac b/configure.ac index ca3439d..3876be6 100644 --- a/configure.ac +++ b/configure.ac @@ -171,18 +171,29 @@ dnl ############################################## dnl check for various RNG/PRNG devices dnl ############################################## -if test -c "/dev/random"; then +UNAME=`uname` + +dnl ############################################## +dnl AROS pops up a "Please insert disk" dialog for /dev +dnl if script looks for devices (which don't exist) +dnl so don't even try looking. +dnl ############################################## + +if [[ $UNAME != "AROS" ]]; then + + if test -c "/dev/random"; then AC_DEFINE(HAVE_DEV_RANDOM, [1], [Has /dev/random]) -fi + fi -if test -c "/dev/urandom"; then + if test -c "/dev/urandom"; then AC_DEFINE(HAVE_DEV_URANDOM, [1], [Has /dev/urandom]) -fi + fi -if test -c "/dev/arandom"; then + if test -c "/dev/arandom"; then AC_DEFINE(HAVE_DEV_ARANDOM, [1], [Has /dev/arandom]) -fi + fi +fi dnl ############################################## dnl Checks for various platform specific libraries From 38ba3175887681bb373d54f3618cb7038850771e Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 27 Sep 2017 00:07:59 -0700 Subject: [PATCH 109/110] Update ChangeLog for 2.4.3.6 (finally); Tweak a TWUtil test so it expects the right uid value on AROS --- ChangeLog | 18 +++++++++++++++++- src/twtest/twutil_t.cpp | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e5ac5c3..e49ca47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2017-10-01 Brian Cox + * Update version to 2.4.3.6 + * Fix & expand tests in Perl acceptance test framework + * Fix & expand twtest unit tests, & rework unit test mini-framework so they’re referenced by name, not some numeric ID, and list tests as “skipped" if they don’t make any test assertions. + * Add configure options to enable coverage, profiling, & use /dev/urandom as RNG (all off by default) + * Add a ‘list’ make target to list all make targets + * Remove dead code & add test coverage per gcov+lcov results + * Fix various memory issues pointed out by valgrind + * In examine-encryption mode, better reporting (& nonzero exit) if we can't find a keyfile for the examined file. + * More exception handling around individual objects & init/IC as a whole, since there have been occasional reports of uncaught exceptions during init or check, and so far haven’t been able to repro or figure out what circumstances it occurs under. (e.g. Github issue #25) + * Tweak install.sh so it can be run directly, not just thru 'make install' if you want. (Github issue #26) + * Improve native (non-Posixy) path handling on platforms that need it (DOS, AROS, RISC OS, Redox) + * New platforms: MirOS BSD, Bitrig, LibertyBSD, RISC OS, Redox + * Add default policies for HP-UX & various BSDs + 2017-03-30 Brian Cox * Bump version to 2.4.3.5 * Fix ‘install-strip’, ‘check’, ‘uninstall’, and ‘distcheck’ make targets. @@ -35,7 +50,8 @@ * AROS: Correctly hide passphrases & delete temp files. * Remove dead code & unused files. * Optional RESOLVE_IDS_TO_NAMES option to disable uid/gid to name resolution, if needed. - * New --key-size option to twadmin --generate-keys, to generate 1024 (default) or 2048 bit El Gamal keys. + * New --key-size option to twadmin --generate-keys, to generate 1024 (default) or 2048 bit El Gamal keys. + 2016-04-20 Brian Cox * Bump version to 2.4.3.1 * Revive old 'twtest' unit test suite (such as it is); move _t.cpp files into twtest dir. diff --git a/src/twtest/twutil_t.cpp b/src/twtest/twutil_t.cpp index 93e270b..b1fbcb6 100644 --- a/src/twtest/twutil_t.cpp +++ b/src/twtest/twutil_t.cpp @@ -75,7 +75,11 @@ void TestTWUtil() TEST(cFileUtil::FileWritable(tmpFN) == true) TEST(cFileUtil::FileExists(tmpFN) == false); +#if IS_AROS + bool is_root = (65534 == getuid()); //AROS doesn't really have users, & posixy fns use this pseudo value. +#else bool is_root = (0 == getuid()); +#endif // make the dir read only and make sure write tests false // windows fails this test, perhaps because I am an administrator? From d06b001efec627f2c287cff3ed660e1182c93cd1 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 27 Sep 2017 20:25:24 -0700 Subject: [PATCH 110/110] Platform macros for QNX, & recognize the QNX-only 'Named special file' filetype --- src/core/fsservices.h | 3 ++- src/core/platform.h | 5 +++++ src/core/unixfsservices.cpp | 12 +++++++++++- src/fs/fsdatasourceiter.cpp | 3 +++ src/fs/fspropcalc.cpp | 3 +++ src/fs/fspropset.cpp | 3 ++- src/fs/fspropset.h | 1 + src/fs/fsstrings.cpp | 1 + src/fs/fsstrings.h | 1 + src/twtest/platform_t.cpp | 2 ++ 10 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/core/fsservices.h b/src/core/fsservices.h index 0175f49..aa93ba1 100644 --- a/src/core/fsservices.h +++ b/src/core/fsservices.h @@ -133,7 +133,8 @@ struct cFSStatArgs { TY_FIFO, TY_SOCK, TY_DOOR, - TY_PORT + TY_PORT, + TY_NAMED }; // attr is fs dependent? diff --git a/src/core/platform.h b/src/core/platform.h index 7667c26..1c2a849 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -85,6 +85,7 @@ #define OS_RTEMS 0x0509 #define OS_RISCOS 0x050A #define OS_REDOX 0x050B +#define OS_QNX 0x050C #define COMP_UNKNOWN 0 #define COMP_GCC 0x0001 @@ -241,6 +242,10 @@ #define OS OS_REDOX #define IS_REDOX 1 +#elif defined(__QNX__) + #define OS OS_QNX + #define IS_QNX 1 + #endif diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index c48e34f..d1ea0c0 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -386,7 +386,11 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const #if HAVE_PORT_CREATE else if(S_ISPORT(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_PORT; #endif - + +#ifdef S_ISNAM + else if(S_ISNAM(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_NAMED; +#endif + else stat.mFileType = cFSStatArgs::TY_INVALID; } @@ -625,6 +629,12 @@ void cUnixFSServices::ConvertModeToString( uint64 perm, TSTRING& tstrPerm ) cons szPerm[0] = _T('P'); break; #endif + +#ifdef S_IFNAM + case S_IFNAM: + szPerm[0] = _T('n'); + break; +#endif break; } diff --git a/src/fs/fsdatasourceiter.cpp b/src/fs/fsdatasourceiter.cpp index 8d8d80f..8ebaebf 100644 --- a/src/fs/fsdatasourceiter.cpp +++ b/src/fs/fsdatasourceiter.cpp @@ -271,6 +271,9 @@ bool cFSDataSourceIter::InitializeTypeInfo(iFCO* pFCO) case cFSStatArgs::TY_PORT: propSet.SetFileType(cFSPropSet::FT_PORT); break; + case cFSStatArgs::TY_NAMED: + propSet.SetFileType(cFSPropSet::FT_NAMED); + break; default: // set it to invalid propSet.SetFileType(cFSPropSet::FT_INVALID); diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index 9c2e8de..afc1f67 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -304,6 +304,9 @@ void cFSPropCalc::HandleStatProperties( const cFCOPropVector& propsToCheck, cons case cFSStatArgs::TY_PORT: propSet.SetFileType(cFSPropSet::FT_PORT); break; + case cFSStatArgs::TY_NAMED: + propSet.SetFileType(cFSPropSet::FT_NAMED); + break; default: // set it to invalid propSet.SetFileType(cFSPropSet::FT_INVALID); diff --git a/src/fs/fspropset.cpp b/src/fs/fspropset.cpp index 8189710..d03d629 100644 --- a/src/fs/fspropset.cpp +++ b/src/fs/fspropset.cpp @@ -60,7 +60,8 @@ TSTRING cFCOPropFileType::AsString() const fs::STR_FT_FIFO, fs::STR_FT_SOCK, fs::STR_FT_DOOR, - fs::STR_FT_PORT + fs::STR_FT_PORT, + fs::STR_FT_NAMED }; int32 fileType = GetValue(); diff --git a/src/fs/fspropset.h b/src/fs/fspropset.h index b771673..57f7dc4 100644 --- a/src/fs/fspropset.h +++ b/src/fs/fspropset.h @@ -111,6 +111,7 @@ public: FT_SOCK, FT_DOOR, FT_PORT, + FT_NAMED, FT_NUMITEMS }; diff --git a/src/fs/fsstrings.cpp b/src/fs/fsstrings.cpp index e639723..97a08bf 100644 --- a/src/fs/fsstrings.cpp +++ b/src/fs/fsstrings.cpp @@ -51,6 +51,7 @@ TSS_BeginStringtable( cFS ) TSS_StringEntry( fs::STR_FT_SOCK, _T("Socket") ), TSS_StringEntry( fs::STR_FT_DOOR, _T("Door") ), TSS_StringEntry( fs::STR_FT_PORT, _T("Event Port") ), + TSS_StringEntry( fs::STR_FT_NAMED, _T("Named Special File") ), // property names TSS_StringEntry( fs::STR_PROP_DEV, _T("Device Number") ), diff --git a/src/fs/fsstrings.h b/src/fs/fsstrings.h index ad4a6dc..6607e08 100644 --- a/src/fs/fsstrings.h +++ b/src/fs/fsstrings.h @@ -55,6 +55,7 @@ TSS_BeginStringIds( fs ) STR_FT_SOCK, STR_FT_DOOR, STR_FT_PORT, + STR_FT_NAMED, // property names STR_PROP_DEV, diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index ccfd667..4cb4b21 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -297,6 +297,8 @@ const TSTRING expected_os("RTEMS"); const TSTRING expected_os("RISC OS"); #elif IS_RISCOS const TSTRING expected_os("Redox"); +#elif IS_QNX +const TSTRING expected_os("QNX"); #else const TSTRING expected_os("?!?!?"); #endif