mirror of https://github.com/cutefishos/appmotor
				
				
				
			Fixes: NB#299083 - apps started via invoker --type m retain applauncher's privileges on D-Bus
RevBy: Alexey Shilovpull/1/head
							parent
							
								
									e72c3a3a31
								
							
						
					
					
						commit
						c99cc0b7ea
					
				@ -0,0 +1,49 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
 | 
			
		||||
** All rights reserved.
 | 
			
		||||
** Contact: Nokia Corporation (directui@nokia.com)
 | 
			
		||||
**
 | 
			
		||||
** This file is part of applauncherd
 | 
			
		||||
**
 | 
			
		||||
** If you have questions regarding the use of this file, please contact
 | 
			
		||||
** Nokia at directui@nokia.com.
 | 
			
		||||
**
 | 
			
		||||
** This library is free software; you can redistribute it and/or
 | 
			
		||||
** modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
** License version 2.1 as published by the Free Software Foundation
 | 
			
		||||
** and appearing in the file LICENSE.LGPL included in the packaging
 | 
			
		||||
** of this file.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef WHITELIST_H
 | 
			
		||||
#define WHITELIST_H
 | 
			
		||||
 | 
			
		||||
const char * const app_whitelist[] =
 | 
			
		||||
{
 | 
			
		||||
    "/usr/bin/conndlgs",
 | 
			
		||||
    "/usr/bin/call-ui",
 | 
			
		||||
    "/usr/bin/accounts-ui",
 | 
			
		||||
    "/usr/bin/grob",
 | 
			
		||||
    "/usr/bin/calc",
 | 
			
		||||
    "/usr/bin/organiser",
 | 
			
		||||
    "/usr/bin/call-history",
 | 
			
		||||
    "/usr/bin/camera-ui",
 | 
			
		||||
    "/usr/bin/contacts",
 | 
			
		||||
    "/usr/bin/duicontrolpanel.launch",
 | 
			
		||||
    "/usr/bin/gallery",
 | 
			
		||||
    "/usr/bin/fenix",
 | 
			
		||||
    "/usr/bin/mediaviewer",
 | 
			
		||||
    "/usr/bin/messaging-ui",
 | 
			
		||||
    "/usr/bin/music-suite",
 | 
			
		||||
    "/usr/bin/notes",
 | 
			
		||||
    "/usr/bin/office-tools",
 | 
			
		||||
    "/usr/bin/search",
 | 
			
		||||
    "/usr/bin/sync-ui",
 | 
			
		||||
    "/usr/bin/userguide",
 | 
			
		||||
    "/usr/bin/video-suite",
 | 
			
		||||
    "/usr/bin/videosheetplayer"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // WHITELIST_H
 | 
			
		||||
@ -0,0 +1,35 @@
 | 
			
		||||
# Set sources
 | 
			
		||||
set(SRC fala_dbus.cpp)
 | 
			
		||||
 | 
			
		||||
link_libraries(${MEEGOTOUCH_LIBRARIES})
 | 
			
		||||
 | 
			
		||||
include(${QT_USE_FILE})
 | 
			
		||||
 | 
			
		||||
SET (QT_USE_QTDBUS true)
 | 
			
		||||
INCLUDE_DIRECTORIES(${QT_QTDBUS_INCLUDE_DIR})
 | 
			
		||||
 | 
			
		||||
# Use the compiler and linker flags given in meegotouch-boostable.pc
 | 
			
		||||
# in the source tree.
 | 
			
		||||
execute_process(COMMAND "env" 
 | 
			
		||||
                         "PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig" 
 | 
			
		||||
                         "/usr/bin/pkg-config" 
 | 
			
		||||
                         "--cflags" 
 | 
			
		||||
                         "meegotouch-boostable" 
 | 
			
		||||
                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 
 | 
			
		||||
                OUTPUT_VARIABLE booster_cflags 
 | 
			
		||||
                OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
execute_process(COMMAND "env" 
 | 
			
		||||
                        "PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig" 
 | 
			
		||||
                        "/usr/bin/pkg-config" "--libs" 
 | 
			
		||||
                        "meegotouch-boostable" 
 | 
			
		||||
                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 
 | 
			
		||||
                OUTPUT_VARIABLE booster_libs 
 | 
			
		||||
                OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cflags}")
 | 
			
		||||
set(CMAKE_EXE_LINKER_FLAGS ${booster_libs})
 | 
			
		||||
 | 
			
		||||
add_executable(fala_dbus ${SRC})
 | 
			
		||||
 | 
			
		||||
# Install
 | 
			
		||||
install(PROGRAMS fala_dbus DESTINATION /usr/bin/ )
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,50 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
 | 
			
		||||
** All rights reserved.
 | 
			
		||||
** Contact: Nokia Corporation (directui@nokia.com)
 | 
			
		||||
**
 | 
			
		||||
** This file is part of applauncherd
 | 
			
		||||
**
 | 
			
		||||
** If you have questions regarding the use of this file, please contact
 | 
			
		||||
** Nokia at directui@nokia.com.
 | 
			
		||||
**
 | 
			
		||||
** This library is free software; you can redistribute it and/or
 | 
			
		||||
** modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
** License version 2.1 as published by the Free Software Foundation
 | 
			
		||||
** and appearing in the file LICENSE.LGPL included in the packaging
 | 
			
		||||
** of this file.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <MApplication>
 | 
			
		||||
#include <QDBusConnection>
 | 
			
		||||
#include <QDBusMessage>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <syslog.h>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
#include <MExport>
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_MCOMPONENTCACHE
 | 
			
		||||
#include <mcomponentcache.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
M_EXPORT int main(int argc, char ** argv)
 | 
			
		||||
{
 | 
			
		||||
#ifdef HAVE_MCOMPONENTCACHE
 | 
			
		||||
    MApplication *app = MComponentCache::mApplication(argc, argv);
 | 
			
		||||
#else
 | 
			
		||||
    MApplication *app = new MApplication(argc, argv);
 | 
			
		||||
#endif
 | 
			
		||||
    Q_UNUSED(app);
 | 
			
		||||
    QDBusConnection bus = QDBusConnection::systemBus();
 | 
			
		||||
    QDBusMessage msg = QDBusMessage::createMethodCall("com.nokia.dsme", "/com/nokia/dsme/request", "com.nokia.dsme.request", "req_powerup");
 | 
			
		||||
    QDBusMessage reply = bus.call(msg,QDBus::AutoDetect, 5);
 | 
			
		||||
    QString dbusReplyError = reply.errorName();
 | 
			
		||||
    openlog ("qfala_dbus", LOG_NDELAY | LOG_PID | LOG_PERROR, LOG_DAEMON);
 | 
			
		||||
    syslog (LOG_DAEMON | LOG_NOTICE, "fala_dbus connection error: '%s'", dbusReplyError.toLocal8Bit().data());    
 | 
			
		||||
    closelog();
 | 
			
		||||
    std::cerr << "fala_dbus connection error:" << dbusReplyError.toLocal8Bit().data() << "\n";
 | 
			
		||||
    _exit(0);
 | 
			
		||||
}
 | 
			
		||||
@ -1,3 +1,3 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
invoker --type=m --wait-term /usr/bin/fala_ft_hello
 | 
			
		||||
invoker --test-mode --type=m --wait-term /usr/bin/fala_ft_hello
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue