various improvements
- use dig for resolving host names - ascon.c: fix terminator parsing - property callback: change property before callback - logger.c:default for logger period must be the old value instead of 1 - add frappy type history writing - increase max. logreader line length - HIPNONE returns "null" with json protocol - encode strings properly in formatNameValue - fix memory leak in json2tcl - scriptcontext: do not show debug messages when script starts with underscore or when the "send" property is empty - scriptcontext: remove args for action timestamp - scriptcontext: "que" function will replace an already queued action, e.g. for 'halt - introduced updatestatus script
This commit is contained in:
18
protocol.c
18
protocol.c
@@ -469,10 +469,11 @@ struct json_object *mkJSON_Object(SConnection * pCon, char *pBuffer,
|
||||
char pError[256];
|
||||
pError[0] = '\0';
|
||||
|
||||
|
||||
/*
|
||||
if (strlen(pBuffer) == 0) {
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
if (!SCVerifyConnection(pCon)) {
|
||||
return 0;
|
||||
@@ -518,9 +519,14 @@ struct json_object *mkJSON_Object(SConnection * pCon, char *pBuffer,
|
||||
}
|
||||
if (iOut == eHdbValue || iOut == eHdbEvent) {
|
||||
tmp_json = json_tokener_parse(pBuffer);
|
||||
if (tmp_json == NULL) {
|
||||
linenum = __LINE__;
|
||||
goto reporterr;
|
||||
if (strcmp(pBuffer, "null") != 0) {
|
||||
if (tmp_json == NULL) {
|
||||
tmp_json = json_object_new_string(pBuffer);
|
||||
}
|
||||
if (tmp_json == NULL) {
|
||||
linenum = __LINE__;
|
||||
goto reporterr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Strip \r and \n */
|
||||
@@ -561,9 +567,11 @@ int SCWriteJSON_String(SConnection * pCon, char *pBuffer, int iOut)
|
||||
char pBueffel[MAXMSG], errBuff[MAXMSG];
|
||||
int iRet, errLen = MAXMSG;
|
||||
|
||||
/*
|
||||
if (strlen(pBuffer) == 0)
|
||||
return 1;
|
||||
|
||||
*/
|
||||
|
||||
/* log it for any case */
|
||||
iRet = SCGetSockHandle(pCon);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user