summaryrefslogtreecommitdiff
path: root/src/agent/service-adapter
diff options
context:
space:
mode:
authorJinkun Jang <jinkun.jang@samsung.com>2013-03-16 01:18:13 +0900
committerJinkun Jang <jinkun.jang@samsung.com>2013-03-16 01:18:13 +0900
commit2928ee51d097094087c5a6445bea90840f6f1db6 (patch)
tree2322cd9266510a98abd61e1a8d7fb9f593665eff /src/agent/service-adapter
parentd6aa47559c38d7e20d6d6a7a3671fa48ed58b9eb (diff)
downloadoma-ds-agent-2928ee51d097094087c5a6445bea90840f6f1db6.tar.gz
oma-ds-agent-2928ee51d097094087c5a6445bea90840f6f1db6.tar.bz2
oma-ds-agent-2928ee51d097094087c5a6445bea90840f6f1db6.zip
merge with master
Diffstat (limited to 'src/agent/service-adapter')
-rwxr-xr-xsrc/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c8
-rwxr-xr-xsrc/agent/service-adapter/sa_common_interface.c50
-rwxr-xr-xsrc/agent/service-adapter/sa_session.c14
-rwxr-xr-xsrc/agent/service-adapter/sa_util.c9
4 files changed, 52 insertions, 29 deletions
diff --git a/src/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c b/src/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c
index b6b14db..bda3a46 100755
--- a/src/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c
+++ b/src/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c
@@ -563,7 +563,7 @@ static sync_agent_pb_error_e _oma_ds_binder_devinf_converter_function(sync_agent
}
}
- __append_devinf_contenttype_to_wbxml_node(devInfDataStore->rx_pref, binder, datastore_node, ELEMENT_RX_PREF);
+ err = __append_devinf_contenttype_to_wbxml_node(devInfDataStore->rx_pref, binder, datastore_node, ELEMENT_RX_PREF);
if (err != SYNC_AGENT_PB_RETURN_OK)
goto error;
@@ -571,19 +571,19 @@ static sync_agent_pb_error_e _oma_ds_binder_devinf_converter_function(sync_agent
devinf_content_type_s *devInfContentType = NULL;
for (rxIter = devInfDataStore->rx; rxIter != NULL; rxIter = g_list_next(rxIter)) {
devInfContentType = rxIter->data;
- __append_devinf_contenttype_to_wbxml_node(devInfContentType, binder, datastore_node, ELEMENT_RX);
+ err = __append_devinf_contenttype_to_wbxml_node(devInfContentType, binder, datastore_node, ELEMENT_RX);
if (err != SYNC_AGENT_PB_RETURN_OK)
goto error;
}
- __append_devinf_contenttype_to_wbxml_node(devInfDataStore->tx_pref, binder, datastore_node, ELEMENT_TX_PREF);
+ err = __append_devinf_contenttype_to_wbxml_node(devInfDataStore->tx_pref, binder, datastore_node, ELEMENT_TX_PREF);
if (err != SYNC_AGENT_PB_RETURN_OK)
goto error;
GList *txIter = NULL;
for (txIter = devInfDataStore->tx; txIter != NULL; txIter = g_list_next(txIter)) {
devInfContentType = txIter->data;
- __append_devinf_contenttype_to_wbxml_node(devInfContentType, binder, datastore_node, ELEMENT_TX);
+ err = __append_devinf_contenttype_to_wbxml_node(devInfContentType, binder, datastore_node, ELEMENT_TX);
if (err != SYNC_AGENT_PB_RETURN_OK)
goto error;
diff --git a/src/agent/service-adapter/sa_common_interface.c b/src/agent/service-adapter/sa_common_interface.c
index 614aded..c2e2a6a 100755
--- a/src/agent/service-adapter/sa_common_interface.c
+++ b/src/agent/service-adapter/sa_common_interface.c
@@ -201,7 +201,7 @@ static sa_error_type_e _create_session(int account_id, char *session_id, bool se
}
/* create session info */
- errorType = create_session(VERSION_12, PROTOCOL_TYPE_DS, account_id, session_id, pSourceLocation, pTargetLocation, session);
+ errorType = create_session(VERSION_12, PROTOCOL_TYPE_DS, account_id, session_id, dup_location(pSourceLocation), dup_location(pTargetLocation), session);
if (errorType != SA_INTERNAL_OK) {
_DEBUG_ERROR("failed to create session");
goto error;
@@ -216,18 +216,38 @@ static sa_error_type_e _create_session(int account_id, char *session_id, bool se
error:
- if (id != NULL)
+ if (id != NULL) {
free(id);
- if (pwd != NULL)
+ id = NULL;
+ }
+ if (pwd != NULL) {
free(pwd);
- if (targetUrl != NULL)
+ pwd = NULL;
+ }
+ if (targetUrl != NULL) {
free(targetUrl);
- if (sourceUrl != NULL)
+ targetUrl = NULL;
+ }
+ if (sourceUrl != NULL) {
free(sourceUrl);
- if (nextNonce != NULL)
+ sourceUrl = NULL;
+ }
+ if (nextNonce != NULL) {
free(nextNonce);
- if (pTempChal != NULL)
+ nextNonce = NULL;
+ }
+ if (pTempChal != NULL) {
free_chal(pTempChal);
+ pTempChal = NULL;
+ }
+ if (pSourceLocation != NULL) {
+ free_location(pSourceLocation);
+ pSourceLocation = NULL;
+ }
+ if (pTargetLocation != NULL) {
+ free_location(pTargetLocation);
+ pTargetLocation = NULL;
+ }
_INNER_FUNC_EXIT;
return errorType;
@@ -245,7 +265,6 @@ static sa_error_type_e _generate_presync_msg(session_s * session, bool server_fl
char *credData = NULL;
char *decoded_nonce = NULL;
bool resume = false;
- char *value = NULL;
alert_type_e alert_type = ALERT_UNKNOWN;
/*pkg1 always has final tag */
@@ -333,10 +352,6 @@ static sa_error_type_e _generate_presync_msg(session_s * session, bool server_fl
decoded_nonce = NULL;
}
- if (nextNonce != NULL) {
- free(nextNonce);
- nextNonce = NULL;
- }
nonce_size = 0;
if (errorType != SA_INTERNAL_OK) {
@@ -527,8 +542,6 @@ static sa_error_type_e _generate_presync_msg(session_s * session, bool server_fl
free(targetUrl);
if (nextNonce != NULL)
free(nextNonce);
- if (value != NULL)
- free(value);
if (pCred != NULL)
free_cred(pCred);
@@ -548,8 +561,6 @@ static sa_error_type_e _generate_presync_msg(session_s * session, bool server_fl
free(targetUrl);
if (nextNonce != NULL)
free(nextNonce);
- if (value != NULL)
- free(value);
if (syncml != NULL)
free_syncml(syncml);
if (pSyncHdr != NULL)
@@ -731,6 +742,9 @@ static sa_error_type_e _generate_msg(session_s * session, void **sync_obj, bool
}
free_commands(commands);
+ if (binder != NULL)
+ oma_ds_1_2_binder_terminate(binder);
+
_INNER_FUNC_EXIT;
return errorType;
}
@@ -2617,7 +2631,7 @@ int auto_configure(char *addr, char *id, char *password, GList ** configure)
target = NULL;
}
*/
-
+/*
GList *iter = NULL;
GList *innerIter = NULL;
devinf_datastore_s *devInfDataStore = NULL;
@@ -2670,7 +2684,7 @@ int auto_configure(char *addr, char *id, char *password, GList ** configure)
}
}
}
-
+*/
tempConfigure = g_list_append(tempConfigure, contactCandidate);
tempConfigure = g_list_append(tempConfigure, calendarCandidate);
tempConfigure = g_list_append(tempConfigure, memoCandidate);
diff --git a/src/agent/service-adapter/sa_session.c b/src/agent/service-adapter/sa_session.c
index 3ff27a1..6b0feae 100755
--- a/src/agent/service-adapter/sa_session.c
+++ b/src/agent/service-adapter/sa_session.c
@@ -903,6 +903,7 @@ static sa_error_type_e _receive_changes_command(session_s * session, command_s *
free_command(session->large_obj_cmd);
session->large_obj_cmd = NULL;
+ command = NULL;
} else {
status_s *temp = NULL;
errorType = create_new_status_location(session, ERROR_SIZE_MISMATCH, command, changedItem->source, changedItem->target, convert_command_type_change_type(changeType), &temp);
@@ -925,6 +926,7 @@ static sa_error_type_e _receive_changes_command(session_s * session, command_s *
}
}
}
+
if (changeType == CHANGE_ADD) {
int datastore_id = 0;
if (strcmp(changedItem->content_type, ELEMENT_TEXT_VCARD) == 0 || strcmp(changedItem->content_type, ELEMENT_TEXT_VCARD_30) == 0)
@@ -971,7 +973,10 @@ static sa_error_type_e _receive_changes_command(session_s * session, command_s *
}
status_s *temp = NULL;
- errorType = create_new_status_location(session, ERROR_UNKNOWN, command, changedItem->source, changedItem->target, convert_command_type_change_type(changeType), &temp);
+
+ if (command != NULL)
+ errorType = create_new_status_location(session, ERROR_UNKNOWN, command, changedItem->source, changedItem->target, convert_command_type_change_type(changeType), &temp);
+
if (errorType != SA_INTERNAL_OK) {
_DEBUG_ERROR("failed in create_new_status_location");
goto error;
@@ -985,8 +990,10 @@ static sa_error_type_e _receive_changes_command(session_s * session, command_s *
error:
- if (changed != NULL)
+ if (changed) {
free_changed_item(changed);
+ changed = NULL;
+ }
_INNER_FUNC_ENTER;
return errorType;
@@ -1485,6 +1492,7 @@ sa_error_type_e receive_commands(session_s * session, GList * receive_command, b
command = iter->data;
if (auto_config != true || (auto_config == true && command->type == COMMAND_TYPE_RESULTS)) {
+ _DEBUG_INFO("command->type = %d", command->type);
switch (command->type) {
case COMMAND_TYPE_UNKNOWN:
case COMMAND_TYPE_HEADER:
@@ -1525,7 +1533,7 @@ sa_error_type_e receive_commands(session_s * session, GList * receive_command, b
case COMMAND_TYPE_REPLACE:
case COMMAND_TYPE_DELETE:
{
- if (command->type != COMMAND_TYPE_ADD || luid_str_list != NULL) {
+ if (luid_str_list != NULL) {
errorType = _receive_changes_command(session, command, luid_str_list, &index, &changedDatastore);
} else {
_DEBUG_ERROR("luid_str_list is NULL !!");
diff --git a/src/agent/service-adapter/sa_util.c b/src/agent/service-adapter/sa_util.c
index 6538765..fb450d9 100755
--- a/src/agent/service-adapter/sa_util.c
+++ b/src/agent/service-adapter/sa_util.c
@@ -34,12 +34,13 @@ void put_into_list(GList ** commands, GList ** commands_last, void *command)
{
_EXTERN_FUNC_ENTER;
- GList *temp = NULL;
if (*commands_last == NULL) {
- *commands_last = *commands = g_list_append(*commands, command);
+ *commands = g_list_append(*commands, command);
+ *commands_last = *commands;
} else {
- temp = g_list_append(*commands_last, command);
- *commands_last = g_list_next(*commands_last);
+ *commands_last = g_list_append(*commands_last, command);
+ *commands = g_list_first(*commands_last);
+ *commands_last = g_list_last(*commands_last);
}
_EXTERN_FUNC_EXIT;