diff -urp smartmontools-5.38.orig/configure.in smartmontools-5.38/configure.in --- smartmontools-5.38.orig/configure.in 2009-08-16 07:42:57.000000000 -0400 +++ smartmontools-5.38/configure.in 2009-08-16 08:07:53.000000000 -0400 @@ -143,6 +143,8 @@ if test "$with_selinux" = "yes"; then AC_DEFINE(WITH_SELINUX, [1], [Define to 1 if SELinux support is enabled]) fi +LIBCAP_NG_PATH + if test "$prefix" = "NONE"; then dnl no prefix and no mandir, so use ${prefix}/share/man as default if test "$mandir" = '${prefix}/man'; then diff -urp smartmontools-5.38.orig/Makefile.am smartmontools-5.38/Makefile.am --- smartmontools-5.38.orig/Makefile.am 2009-08-16 07:42:57.000000000 -0400 +++ smartmontools-5.38/Makefile.am 2009-08-16 08:07:53.000000000 -0400 @@ -35,7 +35,7 @@ smartd_SOURCES = smartd.cpp \ utility.cpp \ utility.h -smartd_LDADD = @os_deps@ @os_libs@ +smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@ smartd_DEPENDENCIES = @os_deps@ EXTRA_smartd_SOURCES = os_darwin.cpp \ diff -urp smartmontools-5.38.orig/smartd.cpp smartmontools-5.38/smartd.cpp --- smartmontools-5.38.orig/smartd.cpp 2009-08-16 07:42:57.000000000 -0400 +++ smartmontools-5.38/smartd.cpp 2009-08-16 08:08:27.000000000 -0400 @@ -74,6 +74,10 @@ extern "C" int __stdcall FreeConsole(voi #include // setmode() #endif // __CYGWIN__ +#ifdef HAVE_LIBCAP_NG +#include +#endif //LIBCAP_NG + // locally included files #include "int64.h" #include "atacmds.h" @@ -4408,6 +4412,14 @@ static int smartd_main(int argc, char ** // don't exit on bad checksums con->checksumfail=0; + +#ifdef HAVE_LIBCAP_NG + // Drop capabilities + capng_clear(CAPNG_SELECT_BOTH); + capng_update(CAPNG_ADD, (capng_type_t)(CAPNG_EFFECTIVE|CAPNG_PERMITTED), + CAP_SYS_ADMIN); + capng_apply(CAPNG_SELECT_BOTH); +#endif // the main loop of the code while (1){