Merge branch 'conclean' into rhel7

Conflicts:
	SCinter.c
	telnet.c
This commit is contained in:
2017-04-03 11:44:35 +02:00
23 changed files with 306 additions and 930 deletions

View File

@ -306,8 +306,8 @@ static int ProtocolSet(SConnection * pCon, Protocol * pPro, char *pProName)
SCSetWriteFunc(pCon, pPro->defaultWriter);
break;
}
pCon->iProtocolID = proID;
pMaster->iProtocolID = proID;
SCSetProtocolID(pCon,proID);
SCSetProtocolID(pMaster,proID);
SCSendOK(pCon);
return 1;
}
@ -322,7 +322,7 @@ int ProtocolGet(SConnection * pCon, void *pData, char *pProName, int len)
}
if (pData == NULL) {
pCon->iProtocolID = 0;
SCSetProtocolID(pCon,0);
return 1;
}
@ -330,12 +330,12 @@ int ProtocolGet(SConnection * pCon, void *pData, char *pProName, int len)
if (0 == pPro->isDefaultSet) {
pPro->defaultWriter = SCGetWriteFunc(pCon);
pPro->isDefaultSet = 1;
pCon->iProtocolID = 0;
SCSetProtocolID(pCon,0);
}
strlcpy(pProName, pPro->pProList[pCon->iProtocolID], len);
strlcpy(pProName, pPro->pProList[SCGetProtocolID(pCon)], len);
return 1;
#if 0
Index = pCon->iProtocolID;
Index = SCGetProtocolID(pCon);
/* check list of protocols for valid name */
switch (Index) {
@ -448,7 +448,7 @@ static int InitDefaultProtocol(SConnection * pCon, Protocol * pPro)
if (0 == pPro->isDefaultSet) {
pPro->defaultWriter = SCGetWriteFunc(pCon);
pPro->isDefaultSet = 1;
pCon->iProtocolID = PROTSICS;
SCSetProtocolID(pCon,PROTSICS);
}
return pPro->isDefaultSet;
}
@ -498,7 +498,7 @@ struct json_object *mkJSON_Object(SConnection * pCon, char *pBuffer,
}
/* field 1: connID */
json_object_object_add(msg_json, "con",
json_object_new_int(pCon->ident));
json_object_new_int(SCGetIdent(pCon)));
/* field 2: taskID */
json_object_object_add(msg_json, "trans", json_object_new_int(taskID));
/* deviceID */
@ -565,11 +565,7 @@ int SCWriteJSON_String(SConnection * pCon, char *pBuffer, int iOut)
return 1;
/* log it for any case */
if (pCon->pSock) {
iRet = pCon->pSock->sockid;
} else {
iRet = 0;
}
iRet = SCGetSockHandle(pCon);
/* write to commandlog if user or manager privilege */
if (SCGetRights(pCon) <= usUser && !SCinMacro(pCon)) {
@ -627,13 +623,13 @@ char *GetProtocolName(SConnection * pCon)
InitDefaultProtocol(pCon, pPro);
/* check list of protocols for valid name */
switch (pCon->iProtocolID) {
switch (SCGetProtocolID(pCon)) {
case PROTSICS: /* default = psi_sics */
case PROTNORM: /* normal (connection start default) */
case PROTCODE: /* outcodes */
case PROTJSON: /* json */
case PROTACT: /* act */
return strdup(pPro->pProList[pCon->iProtocolID]);
return strdup(pPro->pProList[SCGetProtocolID(pCon)]);
break;
default:
return strdup("invalid");
@ -644,17 +640,14 @@ char *GetProtocolName(SConnection * pCon)
/*----------------------------------*/
int GetProtocolID(SConnection * pCon)
{
if (NULL != pCon) {
return pCon->iProtocolID;
}
return -1;
return SCGetProtocolID(pCon);
}
/*---------------------------------------------------------------------------*/
writeFunc GetProtocolWriteFunc(SConnection * pCon)
{
if (pCon != NULL) {
switch (pCon->iProtocolID) {
switch (SCGetProtocolID(pCon)) {
case PROTCODE: /* outcodes */
return SCWriteWithOutcode;
break;