Skip to content

Commit

Permalink
code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mhogomchungu committed Jul 23, 2024
1 parent a236fad commit 1d5abba
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ add_definitions( -D_DEFAULT_SOURCE -fstack-protector-all --param ssp-buffer-size

include_directories( ${PROJECT_BINARY_DIR} )

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_definitions(-Qunused-arguments)
endif()

if( LIB_SUFFIX )
set( CMAKE_INSTALL_LIBDIR "${LIB_SUFFIX}" )
set( CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${LIB_SUFFIX}" )
Expand Down
2 changes: 1 addition & 1 deletion zuluCrypt-cli/bin/libzuluCrypt-exe.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void zuluCryptExeSetOriginalUID( uid_t s ) ;
/*
* this function is defined in security.c
*/
int zuluCryptExeOriginalUserIsNotRoot() ;
int zuluCryptExeOriginalUserIsNotRoot( void ) ;

/*
* get command line arguments and in struct_opts structure to be used in various calls *
Expand Down
4 changes: 2 additions & 2 deletions zuluCrypt-cli/bin/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static const char * _run_time_path ;
*/
static void ( *zuluCryptSecurityPrivilegeElevationError )( const char * ) = NULL ;

const char * zuluCryptRunTimePath()
const char * zuluCryptRunTimePath( void )
{
return _run_time_path ;
}
Expand All @@ -61,7 +61,7 @@ void zuluCryptExeSetOriginalUID( uid_t s )
_original_UID = s ;
}

int zuluCryptExeOriginalUserIsNotRoot()
int zuluCryptExeOriginalUserIsNotRoot( void )
{
return _original_UID != 0 ;
}
Expand Down
2 changes: 1 addition & 1 deletion zuluCrypt-cli/bin/security.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void zuluCryptSecurityLockMemory_1( string_t st ) ;

void zuluCryptSecurityUnlockMemory_1( string_t st ) ;

const char * zuluCryptRunTimePath() ;
const char * zuluCryptRunTimePath( void ) ;

#ifdef __cplusplus
}
Expand Down
6 changes: 3 additions & 3 deletions zuluCrypt-cli/lib/bitlocker.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static int zuluExit( int st,struct crypt_device * cd )
return st ;
}

const char * zuluCryptBitLockerType()
const char * zuluCryptBitLockerType( void )
{
return "crypto_BitLocker" ;
}
Expand All @@ -43,7 +43,7 @@ const char * zuluCryptBitLockerFolderPrefix( void )
return "cryptoBitlocker" ;
}

const char * zuluCryptCryptsetupBitLockerType()
const char * zuluCryptCryptsetupBitLockerType( void )
{
#ifdef CRYPT_BITLK
return CRYPT_BITLK ;
Expand Down Expand Up @@ -264,7 +264,7 @@ int zuluCryptBitLockerlock( string_t mapperPath,char ** mount_point )
}
}

static const char * _dislocker_fuse_path()
static const char * _dislocker_fuse_path( void )
{
struct stat st ;
const char * e ;
Expand Down
2 changes: 1 addition & 1 deletion zuluCrypt-cli/lib/open_tcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void _close( int x )
if( close( x ) ){}
}

const char * zuluCryptCryptsetupTCRYPTType()
const char * zuluCryptCryptsetupTCRYPTType( void )
{
#ifdef CRYPT_TCRYPT
return CRYPT_TCRYPT ;
Expand Down
2 changes: 1 addition & 1 deletion zuluCrypt-cli/utility/string/String.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ string_t StringCopy( string_t st )
}
}

string_t StringEmpty()
string_t StringEmpty( void )
{
return StringBuffer( 8 ) ;
}
Expand Down
16 changes: 10 additions & 6 deletions zuluCrypt-gui/password_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ passwordDialog::passwordDialog( QTableWidget * table,
auto cc = static_cast< void( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ) ;

connect( m_ui->PushButtonCancel,&QPushButton::clicked,this,&passwordDialog::HideUI ) ;
connect( m_ui->PushButtonOpen,&QPushButton::clicked,this,&passwordDialog::openVolume ) ;
connect( m_ui->PushButtonMountPointPath,&QPushButton::clicked,this,&passwordDialog::mount_point ) ;
connect( m_ui->PushButtonVolumePath,&QPushButton::clicked,this,&passwordDialog::file_path ) ;
connect( m_ui->pushButtonPassPhraseFromFile,&QPushButton::clicked,this,&passwordDialog::clickedPassPhraseFromFileButton ) ;
Expand All @@ -109,6 +108,11 @@ passwordDialog::passwordDialog( QTableWidget * table,
utility::mountWithSharedMountPoint( s == Qt::Checked ) ;
} ) ;

connect( m_ui->PushButtonOpen,&QPushButton::clicked,[ this ](){

this->openVolume( m_ui->PassPhraseField->text() ) ;
} ) ;

m_ui->cbVolumeType->setCurrentIndex( utility::defaultUnlockingVolumeType() ) ;
this->cbVolumeType( utility::defaultUnlockingVolumeType() ) ;

Expand Down Expand Up @@ -253,7 +257,7 @@ void passwordDialog::pbPlugin()

m_pluginMenu->addAction( tr( "Cancel" ) )->setObjectName( "Cancel" ) ;

connect( m_pluginMenu,SIGNAL( triggered( QAction * ) ),this,SLOT( pbPluginEntryClicked( QAction * ) ) ) ;
connect( m_pluginMenu,&QMenu::triggered,this,&passwordDialog::pbPluginEntryClicked ) ;

m_pluginMenu->exec( QCursor::pos() ) ;
}
Expand Down Expand Up @@ -282,10 +286,9 @@ void passwordDialog::tcryptGui()

tcrypt::instance( this,false,[ this ]( const QString& key,const QStringList& keyFiles ) {

m_key = key.toUtf8() ;
m_keyFiles = keyFiles ;

this->openVolume() ;
this->openVolume( key ) ;

m_ui->cbKeyType->setCurrentIndex( passwordDialog::key ) ;
m_ui->PassPhraseField->setText( QString() ) ;
Expand Down Expand Up @@ -663,10 +666,11 @@ void passwordDialog::enableAll()
}
}

void passwordDialog::openVolume()
void passwordDialog::openVolume( const QString& key )
{
this->disableAll() ;
m_key = m_ui->PassPhraseField->text().toUtf8() ;

m_key = key.toUtf8() ;

m_device = utility::resolvePath( m_ui->OpenVolumePath->text() ) ;

Expand Down
2 changes: 1 addition & 1 deletion zuluCrypt-gui/password_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public slots:
void ShowUI( const QString& volumePath,const QString& mount_point ) ;
void ShowUI( QString ) ;
private:
void openVolume() ;
void openVolume( const QString& ) ;
void cbVisibleKeyStateChanged( int ) ;
void cbVolumeType( int ) ;
void cbActicated( int ) ;
Expand Down
4 changes: 2 additions & 2 deletions zuluMount-cli/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static int _checkUnmount( const char * device,uid_t uid )
*/
r = zuluCryptBindUnmountVolume( stx,device,uid ) ;

if( r != 3 || r != 4 ){
if( !( r == 3 || r == 4 ) ){

st = StringListStringAtSecondPlace( stl ) ;
/*
Expand Down Expand Up @@ -407,7 +407,7 @@ static int _zuluMountExe( ARGS * args )
return _zuluExit_1( 200,StringListVoid,NULL,gettext( "ERROR: unrecognized argument encountered" ) ) ;
}

static int _mount_help()
static int _mount_help( void )
{
const char * doc6 ;
const char * doc5 ;
Expand Down
2 changes: 1 addition & 1 deletion zuluMount-gui/zulumount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ void zuluMount::cryfsVolumeProperties()

msg.ShowUIInfo( tr( "INFORMATION" ),true,[ & ](){

return QString( [ this ](){
return QString( [](){

auto l = { tr( "Block Size: %1" ),
tr( "Used Blocks: %2" ),
Expand Down

0 comments on commit 1d5abba

Please sign in to comment.