Exemplo n.º 1
0
int 
freeRuleExecInfoInternals(ruleExecInfo_t *rs, int freeSpeialStructFlag)
{
  if (rs->msParamArray != NULL && (freeSpeialStructFlag & FREE_MS_PARAM) > 0) {
    clearMsParamArray (rs->msParamArray, 1);
    free (rs->msParamArray);
  }

  if (rs->doinp != NULL && (freeSpeialStructFlag & FREE_DOINP) > 0) {
     clearDataObjInp (rs->doinp);
     free (rs->doinp);
  }
 
  if (rs->doi != NULL) 
    freeAllDataObjInfo(rs->doi);
  if (rs->rgi != NULL)
    freeRescGrpInfo(rs->rgi);
  if (rs->uoic != NULL)
    freeUserInfo(rs->uoic);
  if (rs->uoip != NULL)
    freeUserInfo(rs->uoip);
  if (rs->coi != NULL)
    freeCollInfo(rs->coi);
#if 0	/* XXXXX deplicate rgio */
  if (rs->rgio != NULL)
    freeRescGrpInfo(rs->rgio);
#endif
  if (rs->uoio != NULL)
    freeUserInfo(rs->uoio);
  if (rs->condInputData != NULL) 
    freeKeyValPairStruct(rs->condInputData);
  if (rs->next != NULL) 
    freeRuleExecInfoStruct(rs->next, freeSpeialStructFlag);
  return(0);
}
Exemplo n.º 2
0
char* parseClientUserAddUser(int sock,void* buf,int serverid,int* outResult){
	uint16_t length = ntohs(*(uint16_t*)buf);
	buf += sizeof(uint16_t);
	char *txt = malloc(length);
	memcpy(txt,buf,length);
	buf += length;	
	cJSON* json = cJSON_Parse(txt);
	if(!json){
		free(txt);
		return NULL;
	}

	char* str = cJSON_GetObjectItem(json,"username")->valuestring;	
	char* username = malloc(strlen(str)+1);
	strncpy(username,str,strlen(str));
	str = cJSON_GetObjectItem(json,"friendname")->valuestring;
	char* friendname = 	malloc(strlen(str)+1);
	strncpy(friendname,str,strlen(str));
#ifndef CLIENTMAKE	
	user_info_t* uinfo = addFriendsUseName(username,friendname);//getUserInfoByName(username,&userinfo);//userLogin(username,drivceId,&clientinfo);//regUser(username,userid);	
	int isSucess = 0;
	if(uinfo != NULL)
		isSucess = 1;
	*outResult = createServerUserAddUser(sock,serverid,uinfo);
	freeUserInfo(uinfo);
#endif	
	free(txt);
	cJSON_Delete(json);
	return username;
}