]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3493] Run sudo -k before checking passwordless sudo to make sure sudo is not cached
authorAndrei Pavel <andrei@isc.org>
Tue, 17 Jun 2025 09:15:22 +0000 (12:15 +0300)
committerAndrei Pavel <andrei@isc.org>
Tue, 17 Jun 2025 18:34:44 +0000 (21:34 +0300)
meson.build

index a7d577e8ca58f69ee1f6a3f6e15ae2d658e5c777..31be3700ab771f9f714c169d79c90003081725e3 100644 (file)
@@ -129,6 +129,19 @@ ENV = find_program(TOP_SOURCE_DIR / 'scripts/env.sh')
 GRABBER = find_program(TOP_SOURCE_DIR / 'scripts/grabber.py')
 KEA_MSG_COMPILER = disabler()
 
+#### sudo
+
+PASSWORDLESS_SUDO_SET_UP = false
+if SUDO.found()
+    result = run_command(SUDO, '-k', check: false)
+    if result.returncode() == 0
+        result = run_command(SUDO, '-n', 'true', check: false)
+        if result.returncode() == 0
+            PASSWORDLESS_SUDO_SET_UP = true
+        endif
+    endif
+endif
+
 #### Configuration Data
 
 # TODO: Remaining define macros used in code, but not handled by meson:
@@ -568,14 +581,6 @@ else
 endif
 conf_data.set('PACKAGE_VERSION_TYPE', f'"@package_version_type@"')
 
-PASSWORDLESS_SUDO_SET_UP = false
-if SUDO.found()
-    result = run_command(SUDO, '-n', 'true', check: false)
-    if result.returncode() == 0
-        PASSWORDLESS_SUDO_SET_UP = true
-    endif
-endif
-
 #### Compiler
 
 compile_args = []