Commit ade940bcbad27c7c5dfe6cc8b76995f50cdd7611

Kano 2012-09-13T09:44:58

api.c all STATUS messages automatically escaped

diff --git a/api.c b/api.c
index 51f9d3b..67f0d78 100644
--- a/api.c
+++ b/api.c
@@ -496,7 +496,7 @@ struct CODES {
  { SEVERITY_INFO,  MSG_PGALRDIS,PARAM_PGA,	"PGA %d already disabled" },
  { SEVERITY_INFO,  MSG_PGAENA,	PARAM_PGA,	"PGA %d sent enable message" },
  { SEVERITY_INFO,  MSG_PGADIS,	PARAM_PGA,	"PGA %d set disable flag" },
- { SEVERITY_ERR,   MSG_PGAUNW,	PARAM_PGA,	"PGA %d is not flagged WELL\\, cannot enable" },
+ { SEVERITY_ERR,   MSG_PGAUNW,	PARAM_PGA,	"PGA %d is not flagged WELL, cannot enable" },
 #endif
 #ifdef WANT_CPUMINE
  { SEVERITY_ERR,   MSG_CPUNON,	PARAM_NONE,	"No CPUs" },
@@ -564,8 +564,8 @@ struct CODES {
  { SEVERITY_SUCC,  MSG_SETCONFIG,PARAM_SET,	"Set config '%s' to %d" },
  { SEVERITY_ERR,   MSG_UNKCON,	PARAM_STR,	"Unknown config '%s'" },
  { SEVERITY_ERR,   MSG_INVNUM,	PARAM_BOTH,	"Invalid number (%d) for '%s' range is 0-9999" },
- { SEVERITY_ERR,   MSG_CONPAR,	PARAM_NONE,	"Missing config parameters 'name\\,N'" },
- { SEVERITY_ERR,   MSG_CONVAL,	PARAM_STR,	"Missing config value N for '%s\\,N'" },
+ { SEVERITY_ERR,   MSG_CONPAR,	PARAM_NONE,	"Missing config parameters 'name,N'" },
+ { SEVERITY_ERR,   MSG_CONVAL,	PARAM_STR,	"Missing config value N for '%s,N'" },
  { SEVERITY_FAIL, 0, 0, NULL }
 };
 
@@ -1189,8 +1189,8 @@ static char *message(int messageid, int paramid, char *param2, bool isjson)
 			root = api_add_string(root, _STATUS, severity, false);
 			root = api_add_time(root, "When", &when, false);
 			root = api_add_int(root, "Code", &messageid, false);
-			root = api_add_string(root, "Msg", buf, false);
-			root = api_add_string(root, "Description", opt_api_description, false);
+			root = api_add_escape(root, "Msg", buf, false);
+			root = api_add_escape(root, "Description", opt_api_description, false);
 
 			root = print_data(root, ptr, isjson);
 			if (isjson)
@@ -1204,8 +1204,8 @@ static char *message(int messageid, int paramid, char *param2, bool isjson)
 	int id = -1;
 	root = api_add_int(root, "Code", &id, false);
 	sprintf(buf, "%d", messageid);
-	root = api_add_string(root, "Msg", buf, false);
-	root = api_add_string(root, "Description", opt_api_description, false);
+	root = api_add_escape(root, "Msg", buf, false);
+	root = api_add_escape(root, "Description", opt_api_description, false);
 
 	root = print_data(root, ptr, isjson);
 	if (isjson)