-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
Apache License
Version 2.0, January 2004
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
--- /dev/null
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
Name: account-manager
Summary: Account Manager
-Version: 0.0.4
+Version: 0.0.8
Release: 1
Group: Social & Content/Other
License: Apache-2.0
ENDFOREACH(flag)
SET(SERVER_SRCS
- src/account-server-private.c
src/account-server.c
src/account-server-db.c
)
+++ /dev/null
-/*
- * account
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jiseob Jang <jiseob.jang@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef __ACCOUNT_SERVER_PRIVATE_H__
-#define __ACCOUNT_SERVER_PRIVATE_H__
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include <glib.h>
-#include <account-private.h>
-
-int _account_gslist_free(GSList* list);
-int _account_glist_free(GList* list);
-int _account_free_capability_items(account_capability_s *data);
-int _account_custom_item_free(account_custom_s *data);
-int _account_custom_gslist_free(GSList* list);
-int _account_free_account_items(account_s *data);
-int _account_type_free_label_items(label_s *data);
-int _account_type_free_feature_items(provider_feature_s *data);
-int _account_type_gslist_free(GSList* list);
-int _account_type_item_free(account_type_s *data);
-//int _account_type_glist_free(GList* list);
-int _account_type_free_account_type_items(account_type_s *data);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __ACCOUNT_SERVER_PRIVATE_H__*/
#include <dbg.h>
#include <account_ipc_marshal.h>
+#include <account_free.h>
#include <account-private.h>
#include <account.h>
#include <account-error.h>
-#include "account-server-private.h"
#include "account-server-db.h"
typedef sqlite3_stmt* account_stmt;
CATCH:
if (old_account) {
- _account_free_account_items(old_account);
- _ACCOUNT_FREE(old_account);
+ _account_free_account_with_items(old_account);
}
if (hstmt != NULL) {
cb_ret = callback(capability_record->type, capability_record->value, user_data);
- _account_free_capability_items(capability_record);
- _ACCOUNT_FREE(capability_record);
+ _account_free_capability_with_items(capability_record);
ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
old_account = (account_s*)calloc(1, sizeof(account_s));
+ if (old_account == NULL) {
+ _ERR("Out of Memory");
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
// user custom table
CATCH:
- if (old_account) {
- _account_free_account_items(old_account);
- _ACCOUNT_FREE(old_account);
- }
+ if (old_account)
+ _account_free_account_with_items(old_account);
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
old_account = (account_s*)calloc(1, sizeof(account_s));
+ if (old_account == NULL) {
+ _ERR("Out Of memory");
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
CATCH:
if (old_account) {
- _account_free_account_items(old_account);
- _ACCOUNT_FREE(old_account);
+ _account_free_account_with_items(old_account);
}
if (hstmt != NULL) {
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- _account_compare_old_record(account, account_id);
+ error_code = _account_compare_old_record(account, account_id);
+ if (error_code != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("_account_compare_old_record fail\n");
+ return error_code;
+ }
if( _account_db_err_code() == SQLITE_PERM ){
ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- _account_compare_old_record(account, account_id);
+ error_code = _account_compare_old_record(account, account_id);
+ if (error_code != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("_account_compare_old_record fail\n");
+ return error_code;
+ }
if( _account_db_err_code() == SQLITE_PERM ){
ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {_account_gslist_free(account_list);}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {_account_gslist_account_free(account_list);}, NULL, ("finalize error"));
hstmt = NULL;
}
if (account_list)
}
if( *error_code != ACCOUNT_ERROR_NONE && account_head ) {
- _account_glist_free(account_head->account_list);
+ _account_glist_account_free(account_head->account_list);
_ACCOUNT_FREE(account_head);
account_head = NULL;
}
}
if( (*error_code != ACCOUNT_ERROR_NONE) && account_head ) {
- _account_glist_free(account_head->account_list);
+ _account_glist_account_free(account_head->account_list);
_ACCOUNT_FREE(account_head);
account_head = NULL;
}
pthread_mutex_unlock(&account_mutex);
if( (*error_code != ACCOUNT_ERROR_NONE) && account_head ) {
- _account_glist_free(account_head->account_list);
+ _account_glist_account_free(account_head->account_list);
_ACCOUNT_FREE(account_head);
account_head = NULL;
}
ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account handle is null!"));
- _account_free_account_items(data);
- _ACCOUNT_FREE(data);
+ _account_free_account_with_items(data);
return ACCOUNT_ERROR_NONE;
}
if(error_code != ACCOUNT_ERROR_NONE){
ACCOUNT_ERROR("No permission to delete\n");
- _account_glist_free(account_list_temp);
+ _account_glist_account_free(account_list_temp);
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
}
}
}
- _account_glist_free(account_list_temp);
+ _account_glist_account_free(account_list_temp);
/* transaction control required*/
ret_transaction = _account_begin_transaction();
ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account type handle is null!"));
- _account_type_free_account_type_items(data);
- _ACCOUNT_FREE(data);
+ _account_type_free_account_type_with_items(data);
return ACCOUNT_ERROR_NONE;
}
cb_ret = callback(feature_record->app_id, feature_record->key, user_data);
- _account_type_free_feature_items(feature_record);
- _ACCOUNT_FREE(feature_record);
+ _account_type_free_feature_with_items(feature_record);
ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
cb_ret = callback(label_record->app_id, label_record->label , label_record->locale, user_data);
- _account_type_free_label_items(label_record);
- _ACCOUNT_FREE(label_record);
+ _account_type_free_label_with_items(label_record);
ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
int rc = 0, binding_count = 1;
ACCOUNT_RETURN_VAL((app_id != 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((account_type_record != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("account type record(account_type_s**) is NULL"));
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
*account_type_record = create_empty_account_type_instance();
+ if (*account_type_record == NULL) {
+ _ERR("Out of Memory");
+ error_code = ACCOUNT_ERROR_OUT_OF_MEMORY;
+ goto CATCH;
+ }
while (rc == SQLITE_ROW) {
_account_type_convert_column_to_account_type(hstmt, *account_type_record);
rc = _account_query_finalize(hstmt);
if (rc != ACCOUNT_ERROR_NONE )
{
- _account_type_gslist_free(account_type_list);
+ _account_type_gslist_account_type_free(account_type_list);
ACCOUNT_ERROR("finalize error(%s)", rc);
*error_code = rc;
goto CATCH;
if (hstmt != NULL)
{
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {_account_type_gslist_free(account_type_list);}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {_account_type_gslist_account_type_free(account_type_list);}, NULL, ("finalize error"));
hstmt = NULL;
}
//Making label newly created
*label = _account_get_text(label_record->label);
- _account_type_free_label_items(label_record);
- _ACCOUNT_FREE(label_record);
+ _account_type_free_label_with_items(label_record);
rc = _account_query_step(hstmt);
}
cb_ret = callback(custom_record->key, custom_record->value, user_data);
- _account_custom_item_free(custom_record);
- _ACCOUNT_FREE(custom_record);
+ _account_free_custom_with_items(custom_record);
ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
+++ /dev/null
-/*
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <account-types.h>
-#include <account-error.h>
-#include <account-private.h>
-#include "account-server-private.h"
-
-int _account_glist_free(GList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- GList* iter;
-
- for (iter = list; iter != NULL; iter = g_list_next(iter)) {
- account_s *account_record = (account_s*)iter->data;
- _account_free_account_items(account_record);
- _ACCOUNT_FREE(account_record);
- }
-
- g_list_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_gslist_free(GSList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- account_capability_s *cap_data = (account_capability_s*)iter->data;
- _account_free_capability_items(cap_data);
- _ACCOUNT_FREE(cap_data);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_custom_gslist_free(GSList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- account_custom_s *custom_data = (account_custom_s*)iter->data;
- _account_custom_item_free(custom_data);
- _ACCOUNT_FREE(custom_data);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_free_capability_items(account_capability_s *data)
-{
- if(!data)
- return ACCOUNT_ERROR_INVALID_PARAMETER;
-
- _ACCOUNT_FREE(data->type);
- _ACCOUNT_FREE(data->package_name);
- _ACCOUNT_FREE(data->user_name);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_custom_item_free(account_custom_s *data)
-{
- if(!data)
- return ACCOUNT_ERROR_INVALID_PARAMETER;
-
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->key);
- _ACCOUNT_FREE(data->value);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_free_account_items(account_s *data)
-{
- if(!data)
- return ACCOUNT_ERROR_INVALID_PARAMETER;
-
- _ACCOUNT_FREE(data->user_name);
- _ACCOUNT_FREE(data->email_address);
- _ACCOUNT_FREE(data->display_name);
- _ACCOUNT_FREE(data->icon_path);
- _ACCOUNT_FREE(data->source);
- _ACCOUNT_FREE(data->package_name);
- _ACCOUNT_FREE(data->domain_name);
- _ACCOUNT_FREE(data->access_token);
-
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- _ACCOUNT_FREE(data->user_data_txt[i]);
-
- _account_gslist_free(data->capablity_list);
- _account_glist_free(data->account_list);
- _account_custom_gslist_free(data->custom_list);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_type_free_label_items(label_s *data)
-{
- if(!data)
- return ACCOUNT_ERROR_INVALID_PARAMETER;
-
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->label);
- _ACCOUNT_FREE(data->locale);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_type_free_feature_items(provider_feature_s *data)
-{
- if(!data)
- return ACCOUNT_ERROR_INVALID_PARAMETER;
-
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->key);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_type_gslist_free(GSList* list)
-{
- ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- label_s *label_data = (label_s*)iter->data;
- _account_type_free_label_items(label_data);
- _ACCOUNT_FREE(label_data);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
-int _account_type_item_free(account_type_s *data)
-{
- if(!data)
- return ACCOUNT_ERROR_INVALID_PARAMETER;
-
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->service_provider_id);
- _ACCOUNT_FREE(data->icon_path);
- _ACCOUNT_FREE(data->small_icon_path);
-
- return ACCOUNT_ERROR_NONE;
-}
-/*
-int _account_type_glist_free(GList* list)
-{
- ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Glist is NULL"));
-
- GList* iter;
-
- for (iter = list; iter != NULL; iter = g_list_next(iter)) {
- account_type_s *account_type_record = (account_type_s*)iter->data;
- _account_type_item_free(account_type_record);
- _ACCOUNT_FREE(account_type_record);
- }
-
- g_list_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-*/
-int _account_type_free_account_type_items(account_type_s *data)
-{
- if(!data)
- return ACCOUNT_ERROR_INVALID_PARAMETER;
-
- _account_type_item_free(data);
-
- _account_type_gslist_free(data->label_list);
-// _account_type_glist_free(data->account_type_list);
-
- return ACCOUNT_ERROR_NONE;
-}
-
#include <dbg.h>
#include <account_ipc_marshal.h>
+#include <account_free.h>
#include <account-mgr-stub.h>
#include <account-private.h>
#include <account-error.h>
-#include "account-server-private.h"
#include "account-server-db.h"
#define _PRIVILEGE_ACCOUNT_READ "http://tizen.org/privilege/account.read"
#define _PRIVILEGE_ACCOUNT_WRITE "http://tizen.org/privilege/account.write"
return_code = ACCOUNT_ERROR_NONE;
}
- _account_free_account_items(account);
+ _account_free_account_with_items(account);
return true;
}
return_code = ACCOUNT_ERROR_NONE;
}
- _account_type_free_account_type_items(account_type);
+ _account_type_free_account_type_with_items(account_type);
return true;
}
return_code = ACCOUNT_ERROR_NONE;
}
- _account_free_account_items(account);
+ _account_free_account_with_items(account);
return true;
}
return_code = ACCOUNT_ERROR_NONE;
}
- _account_free_account_items(account);
+ _account_free_account_with_items(account);
return true;
}
return_code = ACCOUNT_ERROR_NONE;
}
- _account_free_account_items(account_data);
+ _account_free_account_with_items(account_data);
return true;
}
return_code = ACCOUNT_ERROR_NONE;
}
- _account_type_free_account_type_items(account_type);
+ _account_type_free_account_type_with_items(account_type);
return true;
}
return_code = ACCOUNT_ERROR_NONE;
}
+ _account_type_free_account_type_with_items(account_type);
+
return true;
}
}
else
{
- _INFO("Calling account_manager_complete_account_type_query_by_app_id");
+ _INFO("Calling account_manager_complete_account_type_query_by_app_id_exist");
account_manager_complete_account_type_query_app_id_exist (obj, invocation);
}
_INFO("account_manager_handle_account_type_query_app_id_exist end");
return_code = ACCOUNT_ERROR_NONE;
}
- _account_free_account_items(account);
+ _account_free_account_with_items(account);
return true;
}