Changes: Fixes filtering out credentials from applications without manifests

RevBy: Jussi Lind
pull/1/head
Antti Kervinen 15 years ago
parent 7295bd3c0a
commit 97917d8e38

@ -37,15 +37,17 @@
#ifdef HAVE_CREDS
#include <sys/creds.h>
CredsList Booster::m_extraCreds;
const char * const Booster::m_strCreds[] = {
namespace
{
const char * const g_strCreds[] =
{
"applauncherd-launcher::access",
"SRC::com.nokia.maemo",
"AID::com.nokia.maemo.applauncherd-invoker.client",
"applauncherd-invoker::applauncherd-invoker"
};
#endif
}
#endif // HAVE_CREDS
Booster::Booster() :
m_appData(new AppData),
@ -54,7 +56,12 @@ Booster::Booster() :
m_oldPriorityOk(false),
m_spaceAvailable(0),
m_bootMode(false)
{}
{
#ifdef HAVE_CREDS
// initialize credentials to be filtered out from boosted applications
convertStringsToCreds(g_strCreds, sizeof(g_strCreds) / sizeof(char*));
#endif
}
Booster::~Booster()
{
@ -453,16 +460,15 @@ AppData* Booster::appData() const
#ifdef HAVE_CREDS
void Booster::initExtraCreds()
void Booster::convertStringsToCreds(const char * const strings[], unsigned int numStrings)
{
// Convert string-formatted credentials into
// "binary"-formatted credentials
unsigned int numCreds = sizeof(m_strCreds) / sizeof(char*);
for (unsigned int i = 0; i < numCreds; i++)
for (unsigned int i = 0; i < numStrings; i++)
{
creds_value_t value;
creds_value_t ret = creds_str2creds(m_strCreds[i], &value);
creds_value_t ret = creds_str2creds(strings[i], &value);
if (ret != CREDS_BAD)
m_extraCreds.push_back(BinCredsPair(ret, value));

@ -133,11 +133,6 @@ public:
//! Get application data object
AppData* appData() const;
#ifdef HAVE_CREDS
//! initialize invoker-specific credentials to be filtered out by filterOutCreds()
static void initExtraCreds();
#endif
/*!
* \brief Return the communication socket used by a Booster.
* This method returns the socket used between invoker and the Booster.
@ -224,15 +219,16 @@ private:
bool m_bootMode;
#ifdef HAVE_CREDS
//! initialize invoker-specific credentials to be filtered out by filterOutCreds()
void convertStringsToCreds(const char * const strings[], unsigned int numStrings);
//! filter out invoker-specific credentials from boosted application
static void filterOutCreds(creds_t creds);
void filterOutCreds(creds_t creds);
//! set of credentials to be filtered out of credentials
//! inhereted from invoker process
static CredsList m_extraCreds;
CredsList m_extraCreds;
//! str array of creds to filter out
static const char * const m_strCreds[];
#endif
#ifdef UNIT_TEST

@ -186,11 +186,6 @@ void Daemon::run()
// dlopen single-instance
loadSingleInstancePlugin();
#ifdef HAVE_CREDS
// initialize credentials to be filtered out from boosted applications
Booster::initExtraCreds();
#endif
// Fork each booster for the first time
forkBoosters();

Loading…
Cancel
Save