* 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
+2
View File
@@ -28,6 +28,8 @@
# define SERVER_INPUT_PORT "haiku-test:input port" # define SERVER_INPUT_PORT "haiku-test:input port"
#endif #endif
#define AS_PROTOCOL_VERSION 1
#define AS_REQUEST_COLOR_KEY 0x00010000 #define AS_REQUEST_COLOR_KEY 0x00010000
// additional option for AS_VIEW_SET_VIEW_BITMAP // additional option for AS_VIEW_SET_VIEW_BITMAP
+2 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2008, Haiku. * Copyright 2001-2009, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -1273,6 +1273,7 @@ BApplication::_ConnectToServer()
fServerLink->Attach<port_id>(clientPort); fServerLink->Attach<port_id>(clientPort);
fServerLink->Attach<int32>(getuid()); fServerLink->Attach<int32>(getuid());
fServerLink->AttachString(getenv("TARGET_SCREEN")); fServerLink->AttachString(getenv("TARGET_SCREEN"));
fServerLink->Attach<int32>(AS_PROTOCOL_VERSION);
int32 code; int32 code;
if (fServerLink->FlushWithReply(code) != B_OK || code != B_OK) { if (fServerLink->FlushWithReply(code) != B_OK || code != B_OK) {
+16 -6
View File
@@ -128,6 +128,9 @@ AppServer::AppServer()
sAppServer = this; sAppServer = this;
// Initialize SIMD flags
detect_simd();
gInputManager = new InputManager(); gInputManager = new InputManager();
// Create the font server and scan the proper directories. // Create the font server and scan the proper directories.
@@ -142,9 +145,6 @@ AppServer::AppServer()
// Create the bitmap allocator. Object declared in BitmapManager.cpp // Create the bitmap allocator. Object declared in BitmapManager.cpp
gBitmapManager = new BitmapManager(); gBitmapManager = new BitmapManager();
// Initialize SIMD flags
detect_simd();
} }
@@ -239,9 +239,10 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
switch (code) { switch (code) {
case AS_GET_DESKTOP: case AS_GET_DESKTOP:
{ {
Desktop* desktop = NULL;
port_id replyPort; port_id replyPort;
if (msg.Read<port_id>(&replyPort) < B_OK) msg.Read<port_id>(&replyPort);
break;
int32 userID; int32 userID;
msg.Read<int32>(&userID); msg.Read<int32>(&userID);
@@ -253,7 +254,14 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
targetScreen = NULL; targetScreen = NULL;
} }
Desktop* desktop = _FindDesktop(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) { if (desktop == NULL) {
// we need to create a new desktop object for this user // we need to create a new desktop object for this user
// TODO: test if the user exists on the system // TODO: test if the user exists on the system
@@ -261,8 +269,10 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
// authorizing the user // authorizing the user
desktop = _CreateDesktop(userID, targetScreen); desktop = _CreateDesktop(userID, targetScreen);
} }
}
free(targetScreen); free(targetScreen);
BPrivate::LinkSender reply(replyPort); BPrivate::LinkSender reply(replyPort);
if (desktop != NULL) { if (desktop != NULL) {
reply.StartMessage(B_OK); reply.StartMessage(B_OK);