From 47dad9e8a2ce3d24baca4ef6f0ff2624e69e5a09 Mon Sep 17 00:00:00 2001
From: Tim Wickberg <tim@schedmd.com>
Date: Thu, 31 Aug 2017 00:24:02 -0600
Subject: [PATCH] Add support for SLURM_TESTSUITE_DROP_PRIV to the
 accounting_storage plugins.

A lot of slurmdbd operations are authenticated by the accounting_storage
plugin, rather than in slurmdbd. To allow the drop_priv flag to work it
must be checked in is_user_min_admin_level() in addition to the various
functions in proc_req.c .
---
 src/plugins/accounting_storage/common/common_as.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/plugins/accounting_storage/common/common_as.c b/src/plugins/accounting_storage/common/common_as.c
index 7d48ac7c6bc..9993cff5960 100644
--- a/src/plugins/accounting_storage/common/common_as.c
+++ b/src/plugins/accounting_storage/common/common_as.c
@@ -62,6 +62,8 @@ extern char *wckey_day_table;
 extern char *wckey_hour_table;
 extern char *wckey_month_table;
 
+extern __thread bool drop_priv;
+
 /*
  * We want SLURMDB_MODIFY_ASSOC always to be the last
  */
@@ -466,6 +468,10 @@ extern bool is_user_min_admin_level(void *db_conn, uid_t uid,
 	 * THERE IS NO AUTHENTICATION WHEN RUNNNING OUT OF THE
 	 * SLURMDBD!
 	 */
+#ifndef NDEBUG
+	if (drop_priv)
+		return false;
+#endif
 	if (slurmdbd_conf) {
 		/* We have to check the authentication here in the
 		 * plugin since we don't know what accounts are being
-- 
GitLab