Commit a294e28a authored by Slava Monich's avatar Slava Monich

Merge branch 'dbus-access' into 'master'

D-Bus access control

See merge request !22
parents da3f3c66 d05adbc6
......@@ -17,7 +17,7 @@ include ../mms-lib/Config.mak
# Required packages
#
PKGS = gio-unix-2.0 gio-2.0 libglibutil
PKGS = gio-unix-2.0 gio-2.0 libdbusaccess libglibutil
LIB_PKGS = libwspcodec gmime-2.6 libgofono libsoup-2.4 dconf
ifdef SAILFISH
......
This diff is collapsed.
TEMPLATE = app
CONFIG += link_pkgconfig
PKGCONFIG += gmime-2.6 gio-unix-2.0 gio-2.0 glib-2.0 libsoup-2.4 dconf
PKGCONFIG += libwspcodec libgofono libglibutil
PKGCONFIG += libwspcodec libgofono libdbusaccess libglibutil
QMAKE_CFLAGS += -Wno-unused-parameter
include(../mms-lib/mms-lib-config.pri)
......
This diff is collapsed.
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2019 Jolla Ltd.
* Copyright (C) 2013-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -16,6 +17,8 @@
#define JOLLA_MMS_ENGINE_H
#include <gio/gio.h>
#include <dbusaccess_types.h>
#include "mms_settings.h"
#include "mms_version.h"
......@@ -35,15 +38,42 @@
# define MMS_ENGINE_CONFIG_FILE "/etc/mms-engine.conf"
#endif /* MMS_ENGINE_CONFIG_FILE */
#define MMS_ENGINE_DBUS_METHODS(m) \
m(CANCEL) \
m(RECEIVE_MESSAGE) \
m(SEND_READ_REPORT) \
m(SEND_MESSAGE) \
m(PUSH) \
m(PUSH_NOTIFY) \
m(SET_LOG_LEVEL) \
m(SET_LOG_TYPE) \
m(GET_VERSION) \
m(MIGRATE_SETTINGS)
typedef enum mms_engine_action {
/* Action ids must be non-zero, shift those by one */
MMS_ENGINE_ACTION_NONE = 0,
#define MMS_ENGINE_ACTION_(id) MMS_ENGINE_ACTION_##id,
MMS_ENGINE_DBUS_METHODS(MMS_ENGINE_ACTION_)
#undef MMS_ENGINE_ACTION_
} MMS_ENGINE_ACTION;
typedef struct mms_engine MMSEngine;
typedef struct engine_dbus_config {
GBusType type;
DAPolicy* engine_access;
DAPolicy* tx_list_access;
DAPolicy* tx_access;
} MMSEngineDbusConfig;
MMSEngine*
mms_engine_new(
const MMSConfig* config,
const MMSSettingsSimData* defaults,
unsigned int flags,
MMSLogModule* log_modules[],
int log_count);
const MMSEngineDbusConfig* dbus_config,
MMSLogModule* log_modules[], /* NULL terminated */
unsigned int flags);
MMSEngine*
mms_engine_ref(
......
/*
* Copyright (C) 2014-2018 Jolla Ltd.
* Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2014-2019 Jolla Ltd.
* Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -117,6 +118,12 @@ mms_settings_load_defaults(
MMSSettingsSimDataCopy* simconfig,
GError** error);
void
mms_settings_parse(
GKeyFile* file,
MMSConfigCopy* config,
MMSSettingsSimDataCopy* data);
void
mms_settings_set_sim_defaults(
MMSSettings* settings,
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2019 Jolla Ltd.
* Copyright (C) 2013-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -15,7 +16,7 @@
#include "mms_connman.h"
/* Logging */
#define MMS_LOG_MODULE_NAME mms_connman_log
#define GLOG_MODULE_NAME mms_connman_log
#include <gutil_log.h>
G_DEFINE_ABSTRACT_TYPE(MMSConnMan, mms_connman, G_TYPE_OBJECT)
......
/*
* Copyright (C) 2014-2018 Jolla Ltd.
* Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2014-2019 Jolla Ltd.
* Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -187,18 +188,27 @@ mms_settings_load_defaults(
MMSSettingsSimDataCopy* data,
GError** error)
{
gboolean ok = FALSE;
GKeyFile* file = g_key_file_new();
if (g_key_file_load_from_file(file, path, 0, error)) {
gboolean ok = g_key_file_load_from_file(file, path, 0, error);
if (ok) {
GDEBUG("Loading %s", path);
mms_settings_parse_global_config(config, file);
mms_settings_parse_sim_config(data, file);
ok = TRUE;
mms_settings_parse(file, config, data);
}
g_key_file_free(file);
return ok;
}
void
mms_settings_parse(
GKeyFile* file,
MMSConfigCopy* config,
MMSSettingsSimDataCopy* data)
{
mms_settings_parse_global_config(config, file);
mms_settings_parse_sim_config(data, file);
}
void
mms_settings_sim_data_copy(
MMSSettingsSimDataCopy* dest,
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2019 Jolla Ltd.
* Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -16,7 +17,9 @@
/* Logging */
#define GLOG_MODULE_NAME mms_transfer_list_log
#include "mms_lib_log.h"
#include <gutil_log.h>
GLOG_MODULE_DEFINE("mms-transfer-list");
G_DEFINE_ABSTRACT_TYPE(MMSTransferList, mms_transfer_list, G_TYPE_OBJECT)
......
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2019 Jolla Ltd.
* Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -17,7 +18,6 @@
/* Logging */
#define GLOG_MODULE_NAME mms_transfer_list_log
#include <gutil_log.h>
GLOG_MODULE_DEFINE("mms-transfer-list-test");
/* Class definition */
typedef MMSTransferListClass MMSTransferListTestClass;
......
......@@ -3,7 +3,7 @@
.PHONY: clean all debug release
# Required packages
PKGS = libglibutil glib-2.0 gio-2.0 gio-unix-2.0
PKGS = libdbusaccess libglibutil glib-2.0 gio-2.0 gio-unix-2.0
#
# Default target
......
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2019 Jolla Ltd.
* Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -18,8 +19,39 @@
#include "mms_transfer_list.h"
#include <dbusaccess_types.h>
#define MMS_TRANSFER_LIST_DBUS_METHODS(m) \
m(GET)
typedef enum mms_transfer_list_action {
/* Action ids must be non-zero, shift those by one */
MMS_TRANSFER_LIST_ACTION_NONE = 0,
#define MMS_TRANSFER_LIST_ACTION_(id) MMS_TRANSFER_LIST_ACTION_##id,
MMS_TRANSFER_LIST_DBUS_METHODS(MMS_TRANSFER_LIST_ACTION_)
#undef MMS_TRANSFER_LIST_ACTION_
} MMS_TRANSFER_LIST_ACTION;
#define MMS_TRANSFER_DBUS_METHODS(m) \
m(GET_ALL) \
m(ENABLE_UPDATES) \
m(DISABLE_UPDATES) \
m(GET_INTERFACE_VERSION) \
m(GET_SEND_PROGRESS) \
m(GET_RECEIVE_PROGRESS)
typedef enum mms_transfer_action {
/* Action ids must be non-zero, shift those by one */
MMS_TRANSFER_ACTION_NONE = 0,
#define MMS_TRANSFER_ACTION_(id) MMS_TRANSFER_ACTION_##id,
MMS_TRANSFER_DBUS_METHODS(MMS_TRANSFER_ACTION_)
#undef MMS_TRANSFER_ACTION_
} MMS_TRANSFER_ACTION;
MMSTransferList*
mms_transfer_list_dbus_new(void);
mms_transfer_list_dbus_new(
DAPolicy* tx_list_access,
DAPolicy* tx_access);
#endif /* JOLLA_MMS_TRANSFER_LIST_DBUS_H */
......
......@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += staticlib
CONFIG -= qt
CONFIG += link_pkgconfig
PKGCONFIG += libglibutil glib-2.0 gio-2.0 gio-unix-2.0
PKGCONFIG += libdbusaccess libglibutil glib-2.0 gio-2.0 gio-unix-2.0
DBUS_SPEC_DIR = $$_PRO_FILE_PWD_/spec
INCLUDEPATH += . include
INCLUDEPATH += ../mms-lib/include
......
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2019 Jolla Ltd.
* Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -16,7 +17,7 @@
#ifndef JOLLA_MMS_TRANSFER_DBUS_H
#define JOLLA_MMS_TRANSFER_DBUS_H
#include "mms_lib_types.h"
#include "mms_transfer_list_dbus.h"
#include <gio/gio.h>
......@@ -43,6 +44,8 @@ GType mms_transfer_dbus_get_type(void);
MMSTransferDbus*
mms_transfer_dbus_new(
GDBusConnection* bus,
DA_BUS da_bus,
DAPolicy* access,
const char* id,
const char* type);
......
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2019 Jolla Ltd.
* Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -16,8 +17,9 @@
#ifndef JOLLA_MMS_TRANSFER_LIST_DBUS_LOG_H
#define JOLLA_MMS_TRANSFER_LIST_DBUS_LOG_H
#define MMS_LOG_MODULE_NAME mms_transfer_list_log
#define GLOG_MODULE_NAME mms_transfer_list_log
#include "mms_lib_log.h"
#include <gutil_log.h>
#endif /* JOLLA_MMS_TRANSFER_LIST_DBUS_LOG_H */
......
......@@ -4,7 +4,7 @@ Version: 1.0.67
Release: 1
Group: Communications/Telephony and IM
License: GPLv2
URL: https://git.merproject.org/mer-core/mms-engine
URL: https://git.sailfishos.org/mer-core/mms-engine
Source0: %{name}-%{version}.tar.bz2
Requires: dbus
Requires: ofono
......@@ -13,6 +13,7 @@ Requires: libwspcodec >= 2.2
Requires: libgofono >= 2.0.0
Requires: libgofonoext >= 1.0.4
Requires: libglibutil >= 1.0.5
Requires: libdbusaccess >= 1.0.10
Requires(post): glib2
Requires(postun): glib2
......@@ -28,6 +29,7 @@ BuildRequires: pkgconfig(libwspcodec) >= 2.2
BuildRequires: pkgconfig(libgofono) >= 2.0.0
BuildRequires: pkgconfig(libgofonoext) >= 1.0.4
BuildRequires: pkgconfig(libglibutil) >= 1.0.11
BuildRequires: pkgconfig(libdbusaccess)
#BuildRequires: pkgconfig(ImageMagick)
BuildRequires: pkgconfig(Qt5Gui)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment