* Added a protocol version field to AS_GET_DESKTOP. This should be bumped after

incompatible releases, and makes sure clients using the old libbe.so will be
  rejected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34210 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-11-24 17:22:44 +00:00
parent 121ce64309
commit 15fe75b9a0
3 changed files with 27 additions and 14 deletions

View File

@ -28,6 +28,8 @@
# define SERVER_INPUT_PORT "haiku-test:input port"
#endif
#define AS_PROTOCOL_VERSION 1
#define AS_REQUEST_COLOR_KEY 0x00010000
// additional option for AS_VIEW_SET_VIEW_BITMAP

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Haiku.
* Copyright 2001-2009, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -1273,6 +1273,7 @@ BApplication::_ConnectToServer()
fServerLink->Attach<port_id>(clientPort);
fServerLink->Attach<int32>(getuid());
fServerLink->AttachString(getenv("TARGET_SCREEN"));
fServerLink->Attach<int32>(AS_PROTOCOL_VERSION);
int32 code;
if (fServerLink->FlushWithReply(code) != B_OK || code != B_OK) {

View File

@ -35,7 +35,7 @@
// Globals
port_id gAppServerPort;
static AppServer *sAppServer;
static AppServer* sAppServer;
BTokenSpace gTokenSpace;
uint32 gAppServerSIMDFlags = 0;
@ -128,6 +128,9 @@ AppServer::AppServer()
sAppServer = this;
// Initialize SIMD flags
detect_simd();
gInputManager = new InputManager();
// Create the font server and scan the proper directories.
@ -142,9 +145,6 @@ AppServer::AppServer()
// Create the bitmap allocator. Object declared in BitmapManager.cpp
gBitmapManager = new BitmapManager();
// Initialize SIMD flags
detect_simd();
}
@ -239,9 +239,10 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
switch (code) {
case AS_GET_DESKTOP:
{
Desktop* desktop = NULL;
port_id replyPort;
if (msg.Read<port_id>(&replyPort) < B_OK)
break;
msg.Read<port_id>(&replyPort);
int32 userID;
msg.Read<int32>(&userID);
@ -253,16 +254,25 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
targetScreen = NULL;
}
Desktop* desktop = _FindDesktop(userID, targetScreen);
if (desktop == NULL) {
// we need to create a new desktop object for this user
// TODO: test if the user exists on the system
// TODO: maybe have a separate AS_START_DESKTOP_SESSION for
// authorizing the user
desktop = _CreateDesktop(userID, targetScreen);
int32 version;
if (msg.Read<int32>(&version) < B_OK
|| version != AS_PROTOCOL_VERSION) {
syslog(LOG_ERR, "Application for user %ld with port %ld does "
"not support the current server protocol.\n", userID,
replyPort);
} else {
desktop = _FindDesktop(userID, targetScreen);
if (desktop == NULL) {
// we need to create a new desktop object for this user
// TODO: test if the user exists on the system
// TODO: maybe have a separate AS_START_DESKTOP_SESSION for
// authorizing the user
desktop = _CreateDesktop(userID, targetScreen);
}
}
free(targetScreen);
BPrivate::LinkSender reply(replyPort);
if (desktop != NULL) {
reply.StartMessage(B_OK);