Add a preliminary way to resolve the calling application.

This will have to be reworked though, as by using the roster only
BApplications can be resolved, as plain cli apps aren't registered with
the registrar.
This commit is contained in:
Michael Lotz
2013-03-05 11:04:20 -05:00
committed by Ryan Leavengood
parent aef629f200
commit 76df966ee6
2 changed files with 22 additions and 0 deletions
+19
View File
@@ -15,6 +15,7 @@
#include <Entry.h>
#include <FindDirectory.h>
#include <Path.h>
#include <Roster.h>
#include <String.h>
#include <new>
@@ -477,6 +478,24 @@ KeyStoreServer::_AccessFlagsFor(uint32 command) const
}
status_t
KeyStoreServer::_ResolveCallingApp(const BMessage& message,
app_info& callingAppInfo) const
{
team_id callingTeam = message.ReturnAddress().Team();
status_t result = be_roster->GetRunningAppInfo(callingTeam,
&callingAppInfo);
if (result != B_OK)
return result;
// Do some sanity checks.
if (callingAppInfo.team != callingTeam)
return B_ERROR;
return B_OK;
}
Keyring*
KeyStoreServer::_FindKeyring(const BString& name)
{
+3
View File
@@ -12,6 +12,7 @@
#include <ObjectList.h>
struct app_info;
class Keyring;
typedef BObjectList<Keyring> KeyringList;
@@ -29,6 +30,8 @@ private:
status_t _WriteKeyStoreDatabase();
uint32 _AccessFlagsFor(uint32 command) const;
status_t _ResolveCallingApp(const BMessage& message,
app_info& callingAppInfo) const;
Keyring* _FindKeyring(const BString& name);