From: erickson Date: Mon, 15 Dec 2008 21:30:54 +0000 (+0000) Subject: protect against unknown clients, except when running in migratable mode X-Git-Tag: osrf_rel_2_0_1~498 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3482b3f2410c0c0460e5f1324ee31c800f95e53e;p=OpenSRF.git protect against unknown clients, except when running in migratable mode git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1528 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/libopensrf/osrf_stack.c b/src/libopensrf/osrf_stack.c index aeab9c5..6f2fe09 100644 --- a/src/libopensrf/osrf_stack.c +++ b/src/libopensrf/osrf_stack.c @@ -1,5 +1,6 @@ #include #include +#include /* the max number of oilsMessage blobs present in any one root packet */ #define OSRF_MAX_MSGS_PER_PACKET 256 @@ -65,8 +66,23 @@ osrfAppSession* osrf_stack_transport_handler( transport_message* msg, osrfAppSession* session = osrf_app_session_find_session( msg->thread ); - if( !session && my_service ) - session = osrf_app_server_session_init( msg->thread, my_service, msg->sender); + if(my_service) { + + if(session) { + if(strcmp(msg->sender, session->remote_id) != 0) { + /* unexpected client connection. See if we are running in "migratable" mode */ + char* mable = osrf_settings_host_value("/apps/%s/migratable", my_service); + if(!mable) { + osrfLogError("Connection to service %s from unknown client %s", my_service, msg->sender); + return NULL; + } + free(mable); + } + + } else { + session = osrf_app_server_session_init(msg->thread, my_service, msg->sender); + } + } if( !session ) { message_free( msg );