diff --git a/protocol.c b/protocol.c index c85f7138..e1c87863 100644 --- a/protocol.c +++ b/protocol.c @@ -489,9 +489,12 @@ int SCWriteSycamore(SConnection * pCon, char *pBuffer, int iOut) return 0; } - snprintf(pBueffel,sizeof(pBueffel)-1, "Next line intended for socket: %d", pCon->sockHandle); - SICSLogWrite(pBueffel, eInternal); - SICSLogWrite(pBuffer, iOut); + iRet=snprintf(pBueffel,sizeof(pBueffel)-1, "[%d]:%s", pCon->sockHandle, pBuffer); + SICSLogWrite(pBueffel, iOut); + if (iRet >= MAXMSG) { + snprintf(pBueffel,sizeof(pBueffel)-1, "TRUNCATED MESSAGE: message len=%d, MAXMSG=%d",strlen(pBuffer), MAXMSG); + SICSLogWrite(pBueffel, eError); + } /* write to commandlog if user or manager privilege */ if (SCGetRights(pCon) <= usUser) { @@ -683,10 +686,13 @@ int SCWriteJSON_String(SConnection * pCon, char *pBuffer, int iOut) if (strlen(pBuffer) == 0) return 1; - if (pCon->iMacro != 1) { - snprintf(pBueffel,sizeof(pBueffel)-1, "Next line intended for socket: %d", pCon->sockHandle); - SICSLogWrite(pBueffel, eInternal); - SICSLogWrite(pBuffer, iOut); + if (!SCinMacro(pCon)) { + iRet=snprintf(pBueffel,sizeof(pBueffel)-1, "[%d]:%s", pCon->sockHandle, pBuffer); + SICSLogWrite(pBueffel, iOut); + if (iRet >= MAXMSG) { + snprintf(pBueffel,sizeof(pBueffel)-1, "TRUNCATED MESSAGE: message len=%d, MAXMSG=%d",strlen(pBuffer), MAXMSG); + SICSLogWrite(pBueffel, eError); + } } /* write to commandlog if user or manager privilege */