|
signon
8.40
|
00001 /* 00002 * This file is part of signon 00003 * 00004 * Copyright (C) 2011 Intel Corporation. 00005 * 00006 * Contact: Elena Reshetova <elena.reshetova@intel.com> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * version 2.1 as published by the Free Software Foundation. 00011 * 00012 * This library is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00020 * 02110-1301 USA 00021 */ 00022 00023 #include "smack-access-control-manager.h" 00024 #include "debug.h" 00025 00026 #include <DBusSmackContext> 00027 #include <SmackQt> 00028 00029 static const char keychainAppId[] = "SignondKeychain"; 00030 00031 SmackAccessControlManager::SmackAccessControlManager(QObject *parent): 00032 SignOn::AbstractAccessControlManager(parent) 00033 { 00034 } 00035 00036 SmackAccessControlManager::~SmackAccessControlManager() 00037 { 00038 } 00039 00040 QString SmackAccessControlManager::keychainWidgetAppId() 00041 { 00042 return QLatin1String(keychainAppId); 00043 } 00044 00045 bool SmackAccessControlManager::isPeerAllowedToAccess( 00046 const QDBusMessage &peerMessage, 00047 const QString &securityContext) 00048 { 00049 QString appId = 00050 SmackQt::DBusSmackContext::getCallerSmackContext(peerMessage); 00051 TRACE() << appId << ":" << securityContext; 00052 00053 if (SmackQt::Smack::hasAccess(appId, securityContext, QLatin1String("r")) || 00054 SmackQt::Smack::hasAccess(appId, securityContext, QLatin1String("x"))) { 00055 TRACE() << "Process ACCESS:TRUE"; 00056 return true; 00057 } else { 00058 TRACE() << "Process ACCESS:FALSE"; 00059 return false; 00060 } 00061 } 00062 00063 QString SmackAccessControlManager::appIdOfPeer(const QDBusMessage &peerMessage) 00064 { 00065 TRACE() << SmackQt::DBusSmackContext::getCallerSmackContext(peerMessage); 00066 return SmackQt::DBusSmackContext::getCallerSmackContext(peerMessage); 00067 } 00068