This will be triggered when a non-privileged user executes "sreport"
and the cluster name contains a special character such as '-' .
From 98b8eceaee64dfd53418a867d12769afa274a753 Mon Sep 17 00:00:00 2001
From: Hongjia Cao <[email protected]>
Date: Mon, 9 Nov 2015 14:47:50 +0800
Subject: [PATCH] quote assoc table name in mysql query

---
 src/plugins/accounting_storage/mysql/as_mysql_assoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/accounting_storage/mysql/as_mysql_assoc.c b/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
index 1dc945a..1674d9a 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
@@ -1871,7 +1871,7 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 	 */
 	if (!is_admin && (private_data & PRIVATE_DATA_USERS)) {
 		int set = 0;
-		query = xstrdup_printf("select lft from %s_%s where user='%s'",
+		query = xstrdup_printf("select lft from \"%s_%s\" where user='%s'",
 				       cluster_name, assoc_table, user->name);
 		if (user->coord_accts) {
 			slurmdb_coord_rec_t *coord = NULL;
-- 
2.1.1

Reply via email to