summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2020-05-25 12:56:52 +0200
committerSlávek Banko <[email protected]>2020-05-25 17:00:45 +0200
commit6215ca65481d7ee463cda151ed6c5103ce929343 (patch)
tree6bcc244512c95fa22d27b9de09181e0a16fa97d4
parent5fc690d685686a904809c31c26fb4705baf14581 (diff)
downloadtdeutils-6215ca65481d7ee463cda151ed6c5103ce929343.tar.gz
tdeutils-6215ca65481d7ee463cda151ed6c5103ce929343.zip
klaptopdaemon: Fix acpi helper violation check.
1. Dependence on crcresult.h solved correctly. 2. Used macro tde_add_executable to define makecrc target. 3. Fixed command to run makecrc - it depends on both makecrc and klaptop_acpi_helper, - it must be run in build binary directory, not source, - the target name is used as the makecrc command, so there is no need to use get_target_property( ... LOCATION ), which caused a warning due to CMP0026. 4. The block of code that performs the binary violation verification was rolled back because it was removed in commit 2abe1e6f40 for an unknown reason, and the check was not actually performed. Signed-off-by: Slávek Banko <[email protected]> (cherry picked from commit bf71f730b3e204d4404fbd47562946170bf87de0)
-rw-r--r--klaptopdaemon/CMakeLists.txt33
-rw-r--r--klaptopdaemon/acpi.cpp11
-rw-r--r--klaptopdaemon/apm.cpp11
3 files changed, 38 insertions, 17 deletions
diff --git a/klaptopdaemon/CMakeLists.txt b/klaptopdaemon/CMakeLists.txt
index 2558f04..b7b4d72 100644
--- a/klaptopdaemon/CMakeLists.txt
+++ b/klaptopdaemon/CMakeLists.txt
@@ -60,14 +60,12 @@ tde_add_library( kcmlaptop SHARED AUTOMOC
tde_add_kpart( kcm_laptop AUTOMOC
SOURCES battery.cpp main.cpp pcmcia.cpp
power.cpp warning.cpp acpi.cpp sony.cpp
- profile.cpp buttons.cpp apm.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/crcresult.h
+ profile.cpp buttons.cpp apm.cpp
LINK tdeio-shared kcmlaptop-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
+ DEPENDENCIES crcresult-header
)
-# crcresult.h header is included here cause it is
-# generated during build time. Otherwice the
-# dependency on it won't be handeled correctly.
+
##### kded_klaptopdaemon (kpart) ################
@@ -84,18 +82,19 @@ tde_add_kpart( kded_klaptopdaemon AUTOMOC
##### crcresult.h (header) ######################
-# FIXME: that should potentialy break the cross
-# compilation, If it is possible in
-# generall.
-add_executable( makecrc makecrc.cpp )
-target_link_libraries( makecrc z )
-
-get_target_property( MAKECRC_EXE makecrc LOCATION)
+tde_add_executable( makecrc
+ SOURCES makecrc.cpp
+ LINK z
+)
-add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/crcresult.h
- COMMAND
- ${MAKECRC_EXE} >${CMAKE_CURRENT_BINARY_DIR}/crcresult.h
- DEPENDS makecrc
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+add_custom_command(
+ OUTPUT crcresult.h
+ COMMAND makecrc > crcresult.h
+ DEPENDS makecrc klaptop_acpi_helper
+)
+add_custom_target( crcresult-header
+ DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/crcresult.h
+)
diff --git a/klaptopdaemon/acpi.cpp b/klaptopdaemon/acpi.cpp
index 27125dd..8bce86b 100644
--- a/klaptopdaemon/acpi.cpp
+++ b/klaptopdaemon/acpi.cpp
@@ -165,6 +165,17 @@ void AcpiConfig::setupHelper()
unsigned long len, crc;
TQString helper = TDEStandardDirs::findExe("klaptop_acpi_helper");
checkcrc(TQFile::encodeName(helper), len, crc);
+ if (len != file_len || crc != file_crc)
+ {
+ TQString str(i18n("The %1 application does not seem to have "
+ "the same size or checksum as when it was compiled we do NOT recommend "
+ "you proceed with making it setuid-root without further investigation").arg(helper));
+ int rc = KMessageBox::warningContinueCancel(0, str, i18n("KLaptopDaemon"), i18n("Run Nevertheless"));
+ if (rc != KMessageBox::Continue)
+ {
+ return;
+ }
+ }
TQString tdesu = TDEStandardDirs::findExe("tdesu");
if (!tdesu.isEmpty()) {
diff --git a/klaptopdaemon/apm.cpp b/klaptopdaemon/apm.cpp
index a7cb189..e2940d2 100644
--- a/klaptopdaemon/apm.cpp
+++ b/klaptopdaemon/apm.cpp
@@ -187,6 +187,17 @@ void ApmConfig::setupHelper2() // we use the acpi helper to do software suspend
unsigned long len, crc;
TQString helper = TDEStandardDirs::findExe("klaptop_acpi_helper");
checkcrc(helper.latin1(), len, crc);
+ if (len != file_len || crc != file_crc)
+ {
+ TQString str(i18n("The %1 application does not seem to have "
+ "the same size or checksum as when it was compiled we do NOT recommend "
+ "you proceed with making it setuid-root without further investigation").arg(helper));
+ int rc = KMessageBox::warningContinueCancel(0, str, i18n("KLaptopDaemon"), i18n("Run Nevertheless"));
+ if (rc != KMessageBox::Continue)
+ {
+ return;
+ }
+ }
TQString tdesu = TDEStandardDirs::findExe("tdesu");
if (!tdesu.isEmpty()) {