SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.0.1")
-ADD_SUBDIRECTORY(src/accounts)
+ADD_SUBDIRECTORY(server)
+++ /dev/null
-1. make the build directory
-
- ex)
-
- $ mkdir build
-
-
-2. change the working directory to the build directory
-
- ex)
-
- $ cd build
-
-
-3. run 'cmake'
-
- $ cmake ${SOURCE_DIR} -DCMAKE_INSTALL_PREFIX=/usr
-
- ex)
-
- $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
-
- or
-
- $ cmake ..
-
-
-4. make & make install
-
- ex)
-
- $ make -j 2 && make install
-
License: Apache-2.0
Source0: account-manager-%{version}.tar.gz
Source1: accounts-service.service
+Source2: org.tizen.account.manager.service
+Source3: org.tizen.account.manager.conf
BuildRequires: cmake
-BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(glib-2.0) >= 2.26
BuildRequires: pkgconfig(gio-2.0)
-BuildRequires: pkgconfig(gio-unix-2.0)
+BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-session)
BuildRequires: pkgconfig(cynara-creds-gdbus)
+BuildRequires: pkgconfig(account-common)
BuildRequires: pkgconfig(accounts-svc)
-BuildRequires: python-xml
-BuildRequires: python-devel
Requires(post): /sbin/ldconfig
Requires(post): /usr/bin/sqlite3
%prep
%setup -q
+cp %{SOURCE2} .
%build
#export CFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default"
#export CFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow -fno-common"
#export CXXFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow"
-export CFLAGS="${CFLAGS} -fPIC -fvisibility=hidden"
-cmake . -DCMAKE_INSTALL_PREFIX=/usr
+export CFLAGS="${CFLAGS} -fvisibility=hidden -fPIE"
+export LDFLAGS="${LDFLAGS} -pie"
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir}
make %{?jobs:-j%jobs}
rm -rf %{buildroot}
%make_install
-mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+mkdir -p %{buildroot}%{_unitdir}/default.target.wants
install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/accounts-service.service
-ln -s ../accounts-service.service %{buildroot}%{_unitdir}/multi-user.target.wants/accounts-service.service
+ln -s ../accounts-service.service %{buildroot}%{_unitdir}/default.target.wants/accounts-service.service
+#ln -s ../accounts-service.service %{buildroot}%{_unitdir}/multi-user.target.wants/accounts-service.service
rm -rf %{buildroot}/usr/lib/account-manager
+
+mkdir -p %{buildroot}%{_unitdir}/dbus-1/system-services
+install -m 0644 %SOURCE2 %{buildroot}%{_unitdir}/dbus-1/system-services/org.tizen.account.manager.service
+
+mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
+install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/dbus-1/system.d/
+
%post
/sbin/ldconfig
#if [ ! -d /opt/usr/dbspace ]
CREATE TABLE if not exists account_type (_id INTEGER PRIMARY KEY AUTOINCREMENT, AppId TEXT,
ServiceProviderId TEXT, IconPath TEXT, SmallIconPath TEXT, MultipleAccountSupport INT);
CREATE TABLE if not exists account_custom (AccountId INTEGER, AppId TEXT, Key TEXT, Value TEXT);
- CREATE TABLE if not exists account (id INTEGER PRIMARY KEY AUTOINCREMENT, user_name TEXT, email_address TEXT, display_name TEXT, icon_path TEXT,
+ CREATE TABLE if not exists account (_id INTEGER PRIMARY KEY AUTOINCREMENT, user_name TEXT, email_address TEXT, display_name TEXT, icon_path TEXT,
source TEXT, package_name TEXT, access_token TEXT, domain_name TEXT, auth_type INTEGER, secret INTEGER, sync_support INTEGER,
txt_custom0 TEXT, txt_custom1 TEXT, txt_custom2 TEXT, txt_custom3 TEXT, txt_custom4 TEXT,
int_custom0 INTEGER, int_custom1 INTEGER, int_custom2 INTEGER, int_custom3 INTEGER, int_custom4 INTEGER);
CREATE TABLE if not exists capability (_id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, value INTEGER,
- package_name TEXT, user_name TEXT, account_id INTEGER, FOREIGN KEY (account_id) REFERENCES account(id));
+ package_name TEXT, user_name TEXT, account_id INTEGER, FOREIGN KEY (account_id) REFERENCES account(_id));
CREATE TABLE if not exists provider_feature (app_id TEXT, key TEXT);
'
fi
#set message key value to NULL
#vconftool set -t string db/account/msg '' -g 6514
-vconftool set -tf string db/account/msg '' -s libaccounts-svc -u 200 -g 5000
+#vconftool set -tf string db/account/msg '' -s libaccounts-svc -u 200 -g 5000
#smack labeling
-chsmack -a 'System' %{TZ_SYS_DB}/.account.db-journal
-chsmack -a 'System' %{TZ_SYS_DB}/.account.db
+#chsmack -a 'System' %{TZ_SYS_DB}/.account.db-journal
+#chsmack -a 'System' %{TZ_SYS_DB}/.account.db
%postun -p /sbin/ldconfig
%files
-%manifest libaccounts-svc.manifest
-%defattr(-,root,root,-)
+%manifest account-svcd.manifest
+%defattr(-,system,system,-)
+%config %{_sysconfdir}/dbus-1/system.d/org.tizen.account.manager.conf
%attr(0755,root,root) %{_bindir}/account-svcd
%attr(-,root,root) %{_unitdir}/accounts-service.service
-%attr(-,root,root) %{_unitdir}/multi-user.target.wants/accounts-service.service
+#%attr(-,root,root) %{_unitdir}/multi-user.target.wants/accounts-service.service
+%attr(-,root,root) %{_unitdir}/default.target.wants/accounts-service.service
+%attr(-,root,root) %{_unitdir}/dbus-1/system-services/org.tizen.account.manager.service
Description=Accounts service
[Service]
-User=system
-Group=system
-
+#User=system
+#Group=system
Type=simple
ExecStart=/usr/bin/account-svcd
Restart=always
RestartSec=1
+
[Install]
-WantedBy=multi-user.target
+WantedBy=default.target
--- /dev/null
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow own="org.tizen.account.manager"/>
+ <allow send_destination="org.tizen.account.manager"/>
+ <allow send_interface="org.tizen.account.manager"/>
+ <allow receive_sender="org.tizen.account.manager"/>
+ </policy>
+ <policy user="system">
+ <allow own="org.tizen.account.manager"/>
+ <allow send_destination="org.tizen.account.manager"/>
+ <allow send_interface="org.tizen.account.manager"/>
+ <allow receive_sender="org.tizen.account.manager"/>
+ </policy>
+ <policy at_console="true">
+ <allow send_destination="org.tizen.account.manager"/>
+ <allow receive_sender="org.tizen.account.manager"/>
+ </policy>
+ <policy context="default">
+ <deny own="org.tizen.account.manager"/>
+ <allow send_destination="org.tizen.account.manager"/>
+ <allow receive_sender="org.tizen.account.manager"/>
+ </policy>
+</busconfig>
--- /dev/null
+[D-BUS Service]
+Name=org.tizen.account.manager
+Exec=/usr/bin/account-svcd
+User=system
+Group=system
capi-base-common
pkgmgr-info
aul
- dbus-1
gio-2.0
- gio-unix-2.0
+ vconf
cynara-client
cynara-session
cynara-creds-gdbus
+ account-common
accounts-svc
)
ENDFOREACH(flag)
SET(SERVER_SRCS
- account-server.c
- account-server-db.c
+ src/account-server-private.c
+ src/account-server.c
+ src/account-server-db.c
)
-ADD_CUSTOM_COMMAND(
- WORKING_DIRECTORY
- OUTPUT account-mgr-stub.c
- COMMAND gdbus-codegen --interface-prefix org.tizen.
- --generate-c-code account-mgr-stub ../account_mgr.xml
- COMMENT "Generating Account SVC GDBus .c/.h")
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/include)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
SET(CMAKE_LDFLAGS "-Wl,-zdefs")
-ADD_EXECUTABLE(${DAEMON} ${SERVER_SRCS} account-mgr-stub.c)
+ADD_EXECUTABLE(${DAEMON} ${SERVER_SRCS})
TARGET_LINK_LIBRARIES(${DAEMON} ${pkgs_LDFLAGS})
#ifndef __ACC_SERVER_DB_H__
-#include <db-util.h>
-#include "account-private.h"
-
-typedef sqlite3_stmt* account_stmt;
+#include <account-private.h>
//ACCOUNT_TABLE
#define ACCOUNT_SCHEMA "create table account \n"\
"(\n"\
-"id INTEGER PRIMARY KEY, "\
+"_id INTEGER PRIMARY KEY, "\
"user_name TEXT, "\
"email_address TEXT, "\
"display_name TEXT, "\
int _account_insert_to_db(account_s* account, int pid, int *account_id);
-int _account_db_open(int mode, const char* account_db_path);
+int _account_db_open(int mode, int pid);
int _account_db_close(void);
int _account_type_insert_to_db(account_type_s* account_type, int* account_type_id);
GSList* _account_db_query_all(int pid);
--- /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 <stdlib.h>
#include <string.h>
#include <fcntl.h>
-#include <account.h>
#include <glib.h>
#include <db-util.h>
#include <pthread.h>
#include <aul.h>
#include <unistd.h>
-#include "account-private.h"
+#include <dbg.h>
+#include <account_ipc_marshal.h>
+#include <account-private.h>
+#include <account.h>
+#include <account-error.h>
+#include "account-server-private.h"
#include "account-server-db.h"
-#include "dbg.h"
-#include "account_ipc_marshal.h"
typedef sqlite3_stmt* account_stmt;
#define ACCOUNT_DB_OPEN_READONLY 0
#define ACCOUNT_DB_OPEN_READWRITE 1
+#define MAX_TEXT 4096
+
#define _TIZEN_PUBLIC_
#ifndef _TIZEN_PUBLIC_
-#include <csc-feature.h>
+//#include <csc-feature.h>
#endif
pthread_mutex_t account_mutex = PTHREAD_MUTEX_INITIALIZER;
static char *_account_get_text(const char *text_data);
-static int _account_gslist_free(GSList* list);
-static int _account_glist_free(GList* list);
static const char *_account_query_table_column_text(account_stmt pStmt, int pos);
static int _account_insert_custom(account_s *account, int account_id);
static int _account_update_custom(account_s *account, int account_id);
ret = aul_app_get_appid_bypid(pid, appid, sizeof(appid));
if(ret < 0){
- ACCOUNT_ERROR("fail to get current appid\n");
+ ACCOUNT_ERROR("fail to get current appid ret=[%d], appid=%s\n", ret, appid);
}
_INFO("");
account->access_token = NULL;
}
+ _ACCOUNT_FREE(caller_package_name);
return ACCOUNT_ERROR_NONE;
}
return ACCOUNT_ERROR_INVALID_PARAMETER;
static int _remove_sensitive_info_from_non_owning_account_list(int caller_pid, GList *account_list)
{
+ int return_code = ACCOUNT_ERROR_NONE;
+
if (account_list == NULL)
{
_ERR("Null input");
for (list_iter = account_list; list_iter != NULL; list_iter = g_list_next(list_iter))
{
account_s *account = (account_s *) list_iter->data;
- return _remove_sensitive_info_from_non_owning_account(caller_pid, account);
+ int ret = _remove_sensitive_info_from_non_owning_account(caller_pid, account);
+ if( ret != ACCOUNT_ERROR_NONE)
+ return_code = ret;
}
- return ACCOUNT_ERROR_INVALID_PARAMETER;
+ return return_code;
}
static int _remove_sensitive_info_from_non_owning_account_slist(int caller_pid, GSList *account_list)
{
+ int return_code = ACCOUNT_ERROR_NONE;
+
if (account_list == NULL)
{
_ERR("Null input");
for (list_iter = account_list; list_iter != NULL; list_iter = g_slist_next(list_iter))
{
account_s *account = (account_s *) list_iter->data;
- return _remove_sensitive_info_from_non_owning_account(caller_pid, account);
+ int ret = _remove_sensitive_info_from_non_owning_account(caller_pid, account);
+ if( ret != ACCOUNT_ERROR_NONE)
+ return_code = ret;
}
- return ACCOUNT_ERROR_INVALID_PARAMETER;
+ return return_code;
}
static const char *_account_db_err_msg()
return ret;
}
-int _account_db_open(int mode, const char* account_db_path)
+int _account_db_open(int mode, int pid)
{
int rc = 0;
int ret = -1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ char account_db_path[256] = {0, };
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ _INFO( "start _account_db_open()");
+
+ ACCOUNT_MEMSET(account_db_path, 0x00, sizeof(account_db_path));
+ ACCOUNT_SNPRINTF(account_db_path, sizeof(account_db_path), "%s", ACCOUNT_DB_PATH);
if( g_hAccountDB ) {
- ACCOUNT_ERROR( "Account database is using in another app. %x", g_hAccountDB );
+ _ERR( "Account database is using in another app. %x", g_hAccountDB );
return ACCOUNT_ERROR_DATABASE_BUSY;
}
return ACCOUNT_ERROR_DB_NOT_OPENED;
}
+ _INFO( "end _account_db_open()");
return ACCOUNT_ERROR_NONE;
}
return ret;
}
-static int _account_free_capability_items(account_capability_s *data)
-{
- _ACCOUNT_FREE(data->type);
- _ACCOUNT_FREE(data->package_name);
- _ACCOUNT_FREE(data->user_name);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_custom_item_free(account_custom_s *data)
-{
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->key);
- _ACCOUNT_FREE(data->value);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static 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;
-}
-
-static int _account_free_account_items(account_s *data)
-{
- _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;
-}
-
-static 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;
-}
-
-static 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;
-}
-
static int _account_check_duplicated(account_s *data, const char* verified_appid)
{
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
return ACCOUNT_ERROR_NONE;
}
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where id=%d", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
_INFO("_account_insert_capability _account_get_record_count [%s]", query);
rc = _account_get_record_count(query);
return ACCOUNT_ERROR_NONE;
}
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where id=%d", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
rc = _account_get_record_count(query);
_INFO("");
char* verified_appid = NULL;
error_code = _account_check_account_type_with_appid_group(appid, &verified_appid);//FIX
+ _ACCOUNT_FREE(appid);
if(error_code != ACCOUNT_ERROR_NONE)
{
- _INFO("");
+ _ERR("error_code = %d", error_code);
ret_transaction = _account_end_transaction(FALSE);
ACCOUNT_ERROR("App id is not registered in account type DB, transaction ret (%x)!!!!\n", ret_transaction);
_ACCOUNT_FREE(verified_appid);
- _ACCOUNT_FREE(appid);
pthread_mutex_unlock(&account_mutex);
return error_code;
}
char buf[64]={0,};
ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", ACCOUNT_NOTI_NAME_INSERT, *account_id);
_account_insert_delete_update_notification_send(buf);
- _INFO("(%s)-(%d) account _notification_send.");
+ _INFO("account _notification_send end.");
return ACCOUNT_ERROR_NONE;
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE id = %d", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_id);
hstmt = _account_prepare_query(query);
rc = _account_query_step(hstmt);
ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE id = %d ", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE _id = %d ", ACCOUNT_TABLE, account_id);
count = _account_get_record_count(query);
if (count <= 0) {
ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET user_name=?, email_address =?, display_name =?, "
"icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?, sync_support =?,"
"txt_custom0=?, txt_custom1=?, txt_custom2=?, txt_custom3=?, txt_custom4=?, "
- "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE id=? ", ACCOUNT_TABLE);
+ "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE _id=? ", ACCOUNT_TABLE);
hstmt = _account_prepare_query(query);
ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE id = %d ", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE _id = %d ", ACCOUNT_TABLE, account_id);
count = _account_get_record_count(query);
if (count <= 0) {
ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET user_name=?, email_address =?, display_name =?, "
"icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?, sync_support =?,"
"txt_custom0=?, txt_custom1=?, txt_custom2=?, txt_custom3=?, txt_custom4=?, "
- "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE id=? ", ACCOUNT_TABLE);
+ "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE _id=? ", ACCOUNT_TABLE);
hstmt = _account_prepare_query(query);
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where id=%d", ACCOUNT_TABLE, account_db_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_db_id);
rc = _account_get_record_count(query);
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET sync_support=? WHERE id = %d", ACCOUNT_TABLE, account_db_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET sync_support=? WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
hstmt = _account_prepare_query(query);
_account_query_bind_int(hstmt, count, sync_status);
int _account_query_account_by_account_id(int pid, int account_db_id, account_s *account_record)
{
- ACCOUNT_DEBUG("account_db_id=[%d]", account_db_id);
+ _INFO("_account_query_account_by_account_id() start, account_db_id=[%d]", account_db_id);
int error_code = ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
ACCOUNT_DEBUG("starting db operations");
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE id = %d", ACCOUNT_TABLE, account_db_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
hstmt = _account_prepare_query(query);
+ rc = _account_db_err_code();
+ _INFO("after _account_prepare_query, rc=[%d]", rc);
- if( _account_db_err_code() == SQLITE_PERM ){
+ if( rc == SQLITE_PERM ){
ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
if (account_head)
{
_remove_sensitive_info_from_non_owning_account_list(pid, account_head->account_list);
- return account_head->account_list;
+ GList* result = account_head->account_list;
+ _ACCOUNT_FREE(account_head);
+ return result;
}
return NULL;
}
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE id IN (SELECT account_id from %s WHERE key=? AND value=?)", ACCOUNT_TABLE, CAPABILITY_TABLE);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id IN (SELECT account_id from %s WHERE key=? AND value=?)", ACCOUNT_TABLE, CAPABILITY_TABLE);
hstmt = _account_prepare_query(query);
}
- error_code = ACCOUNT_ERROR_NONE;
+ *error_code = ACCOUNT_ERROR_NONE;
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ if ( rc != ACCOUNT_ERROR_NONE ) {
+ *error_code = rc;
+ _ERR("finalize error");
+ }
hstmt = NULL;
}
+ if( *error_code != ACCOUNT_ERROR_NONE && account_head ) {
+ _account_glist_free(account_head->account_list);
+ _ACCOUNT_FREE(account_head);
+ account_head = NULL;
+ }
+
pthread_mutex_unlock(&account_mutex);
if (account_head)
{
_remove_sensitive_info_from_non_owning_account_list(pid, account_head->account_list);
- return account_head->account_list;
+ GList* result = account_head->account_list;
+ _ACCOUNT_FREE(account_head);
+ return result;
}
return NULL;
}
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE id IN (SELECT account_id from %s WHERE key=?)", ACCOUNT_TABLE, CAPABILITY_TABLE);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id IN (SELECT account_id from %s WHERE key=?)", ACCOUNT_TABLE, CAPABILITY_TABLE);
hstmt = _account_prepare_query(query);
if (hstmt != NULL)
{
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ if (rc != ACCOUNT_ERROR_NONE) {
+ *error_code = rc;
+ _ERR("finalize error");
+ }
hstmt = NULL;
}
+ if( (*error_code != ACCOUNT_ERROR_NONE) && account_head ) {
+ _account_glist_free(account_head->account_list);
+ _ACCOUNT_FREE(account_head);
+ account_head = NULL;
+ }
+
pthread_mutex_unlock(&account_mutex);
if (account_head)
{
_remove_sensitive_info_from_non_owning_account_list(pid, account_head->account_list);
- return account_head->account_list;
+ GList* result = account_head->account_list;
+ _ACCOUNT_FREE(account_head);
+ return result;
}
return NULL;
}
if (hstmt != NULL)
{
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ if (rc != ACCOUNT_ERROR_NONE) {
+ *error_code = rc;
+ _ERR("finalize error");
+ }
hstmt = NULL;
}
pthread_mutex_unlock(&account_mutex);
+
+ if( (*error_code != ACCOUNT_ERROR_NONE) && account_head ) {
+ _account_glist_free(account_head->account_list);
+ _ACCOUNT_FREE(account_head);
+ account_head = NULL;
+ }
+
if ((*error_code == ACCOUNT_ERROR_NONE) && account_head != NULL)
{
_INFO("Returning account_list");
_remove_sensitive_info_from_non_owning_account_list(pid,account_head->account_list);
- return account_head->account_list;
+ GList* result = account_head->account_list;
+ _ACCOUNT_FREE(account_head);
+ return result;
}
return NULL;
}
int count = -1;
/* Check requested ID to delete */
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE id=%d", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE _id=%d", ACCOUNT_TABLE, account_id);
count = _account_get_record_count(query);
ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE id = %d", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_id);
hstmt = _account_prepare_query(query);
ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
_INFO("After iter->data");
if (account != NULL)
{
- char* id = (char*) calloc(1, sizeof(account->id));
+ char id[256] = {0, };
+
+ ACCOUNT_MEMSET(id, 0, 256);
- sprintf(id, "%d", account->id);
+ ACCOUNT_SNPRINTF(id, 256, "%d", account->id);
_INFO("Adding account id [%s]", id);
account_id_list = g_slist_append(account_id_list, g_strdup(id));
return ACCOUNT_ERROR_NONE;
}
-static int _account_type_free_label_items(label_s *data)
-{
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->label);
- _ACCOUNT_FREE(data->locale);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_free_feature_items(provider_feature_s *data)
-{
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->key);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static 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;
-}
-
-static int _account_type_item_free(account_type_s *data)
-{
- _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;
-}
-
-static 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;
-}
-
-static int _account_type_free_account_type_items(account_type_s *data)
-{
- _account_type_item_free(data);
-
- _account_type_gslist_free(data->label_list);
- _account_type_glist_free(data->account_type_list);
-
- return ACCOUNT_ERROR_NONE;
-}
-
int account_type_create(account_type_h *account_type)
{
if (!account_type) {
return ACCOUNT_ERROR_NONE;
}
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where id=%d", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
rc = _account_get_record_count(query);
return ACCOUNT_ERROR_NONE;
}
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where id=%d", ACCOUNT_TABLE, account_id);
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
rc = _account_get_record_count(query);
--- /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 <cynara-session.h>
#include <cynara-creds-gdbus.h>
-#include <gio/gio.h>
+#include <dbg.h>
+#include <account_ipc_marshal.h>
+#include <account-mgr-stub.h>
+#include <account-private.h>
+#include <account-error.h>
-#include "dbg.h"
+#include "account-server-private.h"
#include "account-server-db.h"
-#include "account_ipc_marshal.h"
-#include "account-mgr-stub.h"
-#include "account-private.h"
-#include "account-error.h"
-
#define _PRIVILEGE_ACCOUNT_READ "http://tizen.org/privilege/account.read"
#define _PRIVILEGE_ACCOUNT_WRITE "http://tizen.org/privilege/account.write"
{
_INFO("account_manager_account_add start");
int db_id = -1;
+ account_s* account = NULL;
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
_ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
goto RETURN;
}
- account_s* account = umarshal_account(account_data);
+ account = umarshal_account(account_data);
if (account == NULL)
{
_ERR("account unmarshalling failed");
return_code = ACCOUNT_ERROR_NONE;
}
+ _account_free_account_items(account);
+
return true;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
gboolean account_manager_account_type_add(AccountManager *obj, GDBusMethodInvocation *invocation, gchar *account_db_path, GVariant *account_type_data, gpointer user_data)
{
int db_id = -1;
+ account_type_s* account_type = NULL;
_INFO("account_manager_account_type_add start");
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
- account_type_s* account_type = umarshal_account_type(account_type_data);
+ account_type = umarshal_account_type(account_type_data);
if (account_type == NULL)
{
_ERR("account_type unmarshalling failed");
return_code = ACCOUNT_ERROR_NONE;
}
+ _account_type_free_account_type_items(account_type);
return true;
}
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
gint account_id)
{
_INFO("account_manager_account_update_to_db_by_id start");
+ account_s* account = NULL;
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
- account_s* account = umarshal_account(account_data);
+ account = umarshal_account(account_data);
if (account == NULL)
{
_ERR("Unmarshal failed");
return_code = ACCOUNT_ERROR_NONE;
}
+ _account_free_account_items(account);
+
return true;
}
const gchar *package_name)
{
_INFO("account_manager_handle_account_update_to_db_by_user_name start");
+ account_s* account = NULL;
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
- account_s* account = umarshal_account(account_data);
+ account = umarshal_account(account_data);
if (account == NULL)
{
_ERR("Unmarshal failed");
return_code = ACCOUNT_ERROR_NONE;
}
+ _account_free_account_items(account);
+
return true;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
{
_INFO("account_manager_handle_account_query_account_by_account_id start");
GVariant* account_variant = NULL;
+ account_s* account_data = NULL;
guint pid = _get_client_pid(invocation);
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
- account_s* account_data = create_empty_account_instance();
+ account_data = create_empty_account_instance();
if (account_data == NULL)
{
_ERR("out of memory");
return_code = ACCOUNT_ERROR_NONE;
}
+ _account_free_account_items(account_data);
+
return true;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
-
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
const gchar *app_id)
{
_INFO("account_manager_handle_account_type_update_to_db_by_app_id start");
+ account_type_s* account_type = NULL;
guint pid = _get_client_pid(invocation);
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
- account_type_s* account_type = umarshal_account_type(account_type_variant);
+ account_type = umarshal_account_type(account_type_variant);
_INFO("before _account_type_update_to_db_by_app_id");
return_code = _account_type_update_to_db_by_app_id(account_type, app_id);
return_code = ACCOUNT_ERROR_NONE;
}
+ _account_type_free_account_type_items(account_type);
+
return true;
}
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
goto RETURN;
}
- return_code = _account_db_open(0, (const char*)account_db_path);
+ return_code = _account_db_open(0, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
gint account_id)
{
_INFO("account_manager_handle_account_update_to_db_by_id_ex start");
+ account_s* account = NULL;
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
goto RETURN;
}
- return_code = _account_db_open(1, (const char*)account_db_path);
+ return_code = _account_db_open(1, pid);
if (return_code != ACCOUNT_ERROR_NONE)
{
- _ERR("_account_db_open() error, db_path = %s, ret = %d", (char*)account_db_path, return_code);
+ _ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
- account_s* account = umarshal_account(account_data);
+ account = umarshal_account(account_data);
if (account == NULL)
{
_ERR("Unmarshal failed");
return_code = ACCOUNT_ERROR_NONE;
}
+ _account_free_account_items(account);
+
return true;
}
_INFO("connecting account signals end");
g_dbus_object_manager_server_set_connection(account_mgr_server_mgr, connection);
+ if( connection == NULL ) {
+ _INFO("g_dbus_object_manager_server_set_connection failed");
+ }
+ _INFO("on_bus_acquired end [%s]", name);
}
static void
return true;
}
-
-
static void _initialize()
{
#if !GLIB_CHECK_VERSION(2,35,0)
mainloop = g_main_loop_new(NULL, FALSE);
+ _INFO("g_main_loop_new");
+
_initialize();
+ _INFO("_initialize");
+
g_main_loop_run(mainloop);
+ _INFO("g_main_loop_run");
+
cynara_finish(p_cynara);
_INFO("Ending Accounts SVC");
+++ /dev/null
-ADD_SUBDIRECTORY(server)
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<node name="/org/tizen/account/manager">
- <interface name="org.tizen.account.manager">
- <method name="account_add">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="a{sv}" name="account_data" direction="in" />
- <arg type="i" name="account_db_id" direction="out" />
- </method>
- <method name="account_type_add">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="a{sv}" name="account_type_data" direction="in" />
- <arg type="i" name="account_type_db_id" direction="out" />
- </method>
- <method name="account_query_all">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="aa{sv}" name="account_data" direction="out" />
- </method>
- <method name="account_type_query_all">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="aa{sv}" name="account_type_data" direction="out" />
- </method>
- <method name="account_delete_from_db_by_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="i" name="account_db_id" direction="in" />
- </method>
- <method name="account_delete_from_db_by_user_name">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="user_name" direction="in" />
- <arg type="s" name="package_name" direction="in" />
- </method>
- <method name="account_delete_from_db_by_package_name">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="package_name" direction="in" />
- <arg type="b" name="permission" direction="in" />
- </method>
- <method name="account_update_to_db_by_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="a{sv}" name="account_data" direction="in" />
- <arg type="i" name="account_id" direction="in" />
- </method>
- <method name="account_get_total_count_from_db">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="b" name="include_hidden" direction="in" />
- <arg type="i" name="count" direction="out" />
- </method>
- <method name="account_query_account_by_account_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="i" name="account_db_id" direction="in" />
- <arg type="a{sv}" name="account_data" direction="out" />
- </method>
- <method name="account_update_to_db_by_user_name">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="a{sv}" name="account_data" direction="in" />
- <arg type="s" name="user_name" direction="in" />
- <arg type="s" name="package_name" direction="in" />
- </method>
- <method name="account_type_query_label_by_locale">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="app_id" direction="in" />
- <arg type="s" name="locale" direction="in" />
- <arg type="s" name="label_name" direction="out" />
- </method>
- <method name="account_type_query_by_provider_feature">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="key" direction="in" />
- <arg type="aa{sv}" name="account_type_list_data" direction="out" />
- </method>
- <method name="account_query_account_by_user_name">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="user_name" direction="in" />
- <arg type="aa{sv}" name="account_list_data" direction="out" />
- </method>
- <method name="account_query_account_by_package_name">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="package_name" direction="in" />
- <arg type="aa{sv}" name="account_list_data" direction="out" />
- </method>
- <method name="account_query_account_by_capability">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="capability_type" direction="in" />
- <arg type="i" name="capability_value" direction="in" />
- <arg type="aa{sv}" name="account_list_data" direction="out" />
- </method>
- <method name="account_query_account_by_capability_type">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="capability_type" direction="in" />
- <arg type="aa{sv}" name="account_list_data" direction="out" />
- </method>
- <method name="account_query_capability_by_account_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="i" name="account_id" direction="in" />
- <arg type="aa{sv}" name="account_list_data" direction="out" />
- </method>
- <method name="account_update_sync_status_by_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="i" name="account_db_id" direction="in" />
- <arg type="i" name="sync_status" direction="in" />
- </method>
- <method name="account_type_query_provider_feature_by_app_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="app_id" direction="in" />
- <arg type="a(ss)" name="feature_list_data" direction="out" />
- </method>
- <method name="account_type_query_supported_feature">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="app_id" direction="in" />
- <arg type="s" name="capability" direction="in" />
- <arg type="i" name="is_supported" direction="out" />
- </method>
- <method name="account_type_update_to_db_by_app_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="a{sv}" name="account_type_variant" direction="in" />
- <arg type="s" name="app_id" direction="in" />
- </method>
- <method name="account_type_delete_by_app_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="app_id" direction="in" />
- </method>
- <method name="account_type_query_label_by_app_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="app_id" direction="in" />
- <arg type="a(sss)" name="label_list_variant" direction="out" />
- </method>
- <method name="account_type_query_by_app_id">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="app_id" direction="in" />
- <arg type="a{sv}" name="account_type_variant" direction="out" />
- </method>
- <method name="account_type_query_app_id_exist">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="s" name="app_id" direction="in" />
- </method>
- <method name="account_update_to_db_by_id_ex">
- <arg type="s" name="account_db_path" direction="in" />
- <arg type="a{sv}" name="account_variant" direction="in" />
- <arg type="i" name="account_id" direction="in" />
- </method>
- </interface>
-</node>
+++ /dev/null
-/usr/bin/account-svcd &