Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/InterDeviceManager/Idm_TCP_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,11 @@ int open_remote_connection(connection_config_t* connectionConf, int (*connection
char* getFile_to_remote(connection_info_t* conn_info,void *payload)
{
CcspTraceDebug(("Inside %s:%d\n",__FUNCTION__,__LINE__));
FILE* fptr;
payload_t *Data;
char* buffer;
FILE* fptr = NULL;
payload_t *Data = NULL;
char* buffer = NULL;
int bytes = 0;
uint32_t length;
uint32_t length = 0;

#ifndef IDM_DEBUG
if(conn_info->enc.ssl == NULL){
Expand Down
19 changes: 16 additions & 3 deletions source/InterDeviceManager/Idm_call_back_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ int connection_cb(device_info_t* Device, connection_info_t* conn_info, uint encr

//TODO: Send request all parameters of remote device
//Send request to get Capabilities

if(Device == NULL || conn_info == NULL)
{
return -1;
}
idm_send_msg_Params_t param;
memset(&param, 0, sizeof(param));
strncpy(param.Mac_dest, Device->mac_addr, sizeof(param.Mac_dest)-1);
Expand Down Expand Up @@ -476,9 +481,17 @@ int discovery_cb(device_info_t* Device, uint discovery_status, uint authenticati
int iErrorCode = 0;

Discovery_cb_threadargs *threadArgs = malloc(sizeof(Discovery_cb_threadargs));
strncpy(threadArgs->device.mac_addr, Device->mac_addr, MAC_ADDR_SIZE);
strncpy(threadArgs->device.ipv4_addr, Device->ipv4_addr, IPv4_ADDR_SIZE);
strncpy(threadArgs->device.ipv6_addr, Device->ipv6_addr, IPv6_ADDR_SIZE);

if(threadArgs == NULL)
{
CcspTraceInfo(("%s %d - Failed to allocate threadArgs\n", __FUNCTION__, __LINE__ ));
return -1;
}

memset((char*)threadArgs, 0 , sizeof(Discovery_cb_threadargs));
strncpy(threadArgs->device.mac_addr, Device->mac_addr, sizeof(threadArgs->device.mac_addr) - 1);
strncpy(threadArgs->device.ipv4_addr, Device->ipv4_addr, sizeof(threadArgs->device.ipv4_addr) - 1);
strncpy(threadArgs->device.ipv6_addr, Device->ipv6_addr, sizeof(threadArgs->device.ipv6_addr) - 1);
threadArgs->discovery_status = discovery_status;
threadArgs->auth_status = authentication_status;

Expand Down
12 changes: 9 additions & 3 deletions source/InterDeviceManager/Idm_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ static int IdmMgr_get_IDM_ParametersFromPSM()

if (retPsmGet == CCSP_SUCCESS)
{
AnscCopyString(pidmDmlInfo->stConnectionInfo.Capabilities, param_value);
if(strlen(param_value) > 0)
{
strncpy(pidmDmlInfo->stConnectionInfo.Capabilities, param_value, sizeof(pidmDmlInfo->stConnectionInfo.Capabilities) - 1);
}
Comment thread
johnsonsebastiar marked this conversation as resolved.
}

_ansc_memset(param_name, 0, sizeof(param_name));
Expand All @@ -62,7 +65,10 @@ static int IdmMgr_get_IDM_ParametersFromPSM()

if (retPsmGet == CCSP_SUCCESS)
{
AnscCopyString(pidmDmlInfo->stConnectionInfo.Interface, param_value);
if(strlen(param_value) > 0)
{
strncpy(pidmDmlInfo->stConnectionInfo.Interface, param_value, sizeof(pidmDmlInfo->stConnectionInfo.Interface) - 1);
}
Comment thread
johnsonsebastiar marked this conversation as resolved.
}

_ansc_memset(param_name, 0, sizeof(param_name));
Expand Down Expand Up @@ -205,7 +211,7 @@ void IdmMgr_SetConfigData_Default()
pidmDmlInfo->stRemoteInfo.ulDeviceNumberOfEntries = 0;
pidmDmlInfo->stRemoteInfo.Port = IDM_DEVICE_MESSAGING_PORT;
pidmDmlInfo->stRemoteInfo.max_file_size = DEFAULT_MAX_FT_SIZE;
AnscCopyString(pidmDmlInfo->stRemoteInfo.ft_status,FT_SUCCESS);
strncpy(pidmDmlInfo->stRemoteInfo.ft_status, FT_SUCCESS, sizeof(pidmDmlInfo->stRemoteInfo.ft_status) - 1);
}

}
Expand Down
24 changes: 16 additions & 8 deletions source/InterDeviceManager/Idm_msg_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ ANSC_STATUS IDM_sendFile_to_Remote_device(char* Mac_dest,char* filename,char* ou
memset(&payload, 0, sizeof(payload_t));
payload.operation = SFT;
payload.msgType = SFT;
strncpy(payload.Mac_source, localDevice->stRemoteDeviceInfo.MAC,MAC_ADDR_SIZE-1);
strncpy(payload.Mac_source, localDevice->stRemoteDeviceInfo.MAC,sizeof(payload.Mac_source)-1);
strncpy(payload.param_name,filename,sizeof(payload.param_name)-1);
CcspTraceDebug(("Inside %s:%d peer MAC=%s\n",__FUNCTION__,__LINE__,Mac_dest));
send_status = sendFile_to_remote(&remoteDevice->stRemoteDeviceInfo.conn_info, &payload,output_location);
Expand Down Expand Up @@ -729,14 +729,14 @@ static void IDM_Rbus_subscriptionEventHandler(rbusHandle_t handle, rbusEvent_t c
char* IDM_SFT_receive(connection_info_t* conn_info,void* payload)
{
CcspTraceDebug(("Inside %s:%d\n",__FUNCTION__,__LINE__));
char* buf;
char* buf = NULL;
int bytes=0,length=0,total_bytes=0;
#ifndef IDM_DEBUG
SSL* ssl= NULL;
#else
int conn=0;
#endif
payload_t *Data;
payload_t *Data = NULL;
PIDM_DML_INFO pidmDmlInfo = IdmMgr_GetConfigData_locked();
if( pidmDmlInfo == NULL )
{
Expand Down Expand Up @@ -800,7 +800,7 @@ char* IDM_SFT_receive(connection_info_t* conn_info,void* payload)
return FT_INVALID_FILE_SIZE;
}
IdmMgrDml_GetConfigData_release(pidmDmlInfo);
FILE* fptr;
FILE* fptr = NULL;
fptr = fopen(Data->param_name,"wb");
if(!fptr){
CcspTraceError(("file not found\n"));
Expand Down Expand Up @@ -898,6 +898,11 @@ int IDM_Incoming_Request_handler(payload_t * payload)
CcspTraceInfo(("%s %d - \n", __FUNCTION__, __LINE__));
rbusError_t err= RBUS_ERROR_SUCCESS;

if(payload == NULL)
{
return -1;
}

if(payload->operation == IDM_SUBS)
{
/*Create entry in incoming subscription list */
Expand Down Expand Up @@ -1033,8 +1038,8 @@ void *IDM_Incoming_req_handler_thread()
payload.reqID = ReqEntry->reqId;
payload.operation = ReqEntry->operation;
payload.msgType = GFT;
strncpy(payload.Mac_source,remoteDevice->stRemoteDeviceInfo.MAC,MAC_ADDR_SIZE);
strncpy(payload.param_name,ReqEntry->param_name,sizeof(payload.param_name));
strncpy(payload.Mac_source,remoteDevice->stRemoteDeviceInfo.MAC,sizeof(payload.Mac_source) - 1);
strncpy(payload.param_name,ReqEntry->param_name,sizeof(payload.param_name) - 1);
Comment thread
johnsonsebastiar marked this conversation as resolved.
//Find the device using MAC
while(remoteDevice!=NULL)
{
Expand Down Expand Up @@ -1119,9 +1124,12 @@ void IDM_Broadcast_LocalDeviceInfo()
payload.reqID = -1; //It's an Async message reqID not avaiable.
payload.operation = IDM_REQUEST;
payload.msgType = RES;
strncpy(payload.Mac_source,remoteDevice->stRemoteDeviceInfo.MAC,sizeof(payload.Mac_source)-1);

remoteDevice=remoteDevice->next;
if(remoteDevice)
Comment thread
johnsonsebastiar marked this conversation as resolved.
{
strncpy(payload.Mac_source,remoteDevice->stRemoteDeviceInfo.MAC,sizeof(payload.Mac_source)-1);
remoteDevice=remoteDevice->next;
}
while(remoteDevice!=NULL)
{
if(remoteDevice->stRemoteDeviceInfo.Status == DEVICE_CONNECTED)
Expand Down
5 changes: 5 additions & 0 deletions source/InterDeviceManager/Idm_rbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,11 @@ rbusError_t X_RDK_Connection_SetHandler(rbusHandle_t handle, rbusProperty_t prop
{
(void)opts;
char const* name = rbusProperty_GetName(prop);

if(name == NULL)
{
return RBUS_ERROR_BUS_ERROR;
Comment thread
johnsonsebastiar marked this conversation as resolved.
}
rbusValue_t value = rbusProperty_GetValue(prop);
rbusValueType_t type = rbusValue_GetType(value);

Expand Down
2 changes: 2 additions & 0 deletions source/InterDeviceManager/Idm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,10 @@ ANSC_STATUS IDM_UpdateLocalDeviceData()
CcspTraceInfo(("[%s: %d] Update Local Device Data. Iface(%s)\n", __FUNCTION__, __LINE__, pidmDmlInfo->stConnectionInfo.Interface));
/* get Interface MAC */
platform_hal_GetBaseMacAddress(wan_mac);
memset(localDevice->stRemoteDeviceInfo.MAC, 0, sizeof(localDevice->stRemoteDeviceInfo.MAC));
strncpy(localDevice->stRemoteDeviceInfo.MAC, wan_mac, sizeof(localDevice->stRemoteDeviceInfo.MAC)-1);
platform_hal_GetModelName(localDevice->stRemoteDeviceInfo.ModelNumber);
memset(localDevice->stRemoteDeviceInfo.Capabilities, 0, sizeof(localDevice->stRemoteDeviceInfo.Capabilities));
strncpy(localDevice->stRemoteDeviceInfo.Capabilities, pidmDmlInfo->stConnectionInfo.Capabilities, sizeof(localDevice->stRemoteDeviceInfo.Capabilities)-1);
localDevice->stRemoteDeviceInfo.HelloInterval = pidmDmlInfo->stConnectionInfo.HelloInterval;
}
Expand Down
12 changes: 6 additions & 6 deletions source/InterDeviceManager/inter_device_manager_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cap_user appcaps;

#define DEBUG_INI_NAME "/etc/debug.ini"

char g_Subsystem[32] = {0};
char g_Subsystem[32] = {0};
extern char* pComponentName;

char g_sslCert[128];
Expand Down Expand Up @@ -170,12 +170,10 @@ int main(int argc, char* argv[])
BOOL bRunAsDaemon = TRUE;
int idx = 0;
int ind = -1;
int cmdChar = 0;
DmErr_t err;
int cmdChar = 0;
char *subSys = NULL;
Comment thread
johnsonsebastiar marked this conversation as resolved.
appcaps.caps = NULL;
Comment thread
johnsonsebastiar marked this conversation as resolved.
appcaps.user_name = NULL;
char buf[8] = {'\0'};

#ifdef FEATURE_SUPPORT_RDKLOG
RDK_LOGGER_INIT();
Expand All @@ -192,8 +190,10 @@ int main(int argc, char* argv[])
{
if((idx + 1) < argc)
{
if ( AnscSizeOfString(argv[idx+1]) < sizeof(g_Subsystem))
AnscCopyString(g_Subsystem, (char *)argv[idx+1]);
if (strlen(argv[idx+1]) > 0)
{
snprintf(g_Subsystem, sizeof(g_Subsystem), "%s", argv[idx+1]);
}
}
else
{
Expand Down
Loading