vboxweb.cpp revision 22d7a125fcbe8650770ac700108b6f27ca1f0dfd
03831d35f7499c87d51205817c93e9a8d42c4baestevel * hand-coded parts of the webservice server. This is linked with the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * generated code in out/.../src/VBox/Main/webservice/methodmaps.cpp
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * (plus static gSOAP server code) to implement the actual webservice
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * server, to which clients can connect.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Copyright (C) 2006-2010 Sun Microsystems, Inc.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This file is part of VirtualBox Open Source Edition (OSE), as
03831d35f7499c87d51205817c93e9a8d42c4baestevel * available from http://www.virtualbox.org. This file is free software;
03831d35f7499c87d51205817c93e9a8d42c4baestevel * you can redistribute it and/or modify it under the terms of the GNU
03831d35f7499c87d51205817c93e9a8d42c4baestevel * General Public License (GPL) as published by the Free Software
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Foundation, in version 2 as it comes in the "COPYING" file of the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Clara, CA 95054 USA or visit http://www.sun.com if you need
03831d35f7499c87d51205817c93e9a8d42c4baestevel * additional information or have any questions.
03831d35f7499c87d51205817c93e9a8d42c4baestevel// shared webservice header
03831d35f7499c87d51205817c93e9a8d42c4baestevel// vbox headers
03831d35f7499c87d51205817c93e9a8d42c4baestevel// workaround for compile problems on gcc 4.1
03831d35f7499c87d51205817c93e9a8d42c4baestevel// gSOAP headers (must come after vbox includes because it checks for conflicting defs)
03831d35f7499c87d51205817c93e9a8d42c4baestevel// standard headers
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki// include generated namespaces table
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki#include "vboxwebsrv.nsmap"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * private typedefs
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ****************************************************************************/
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkitypedef std::map<uint64_t, ManagedObjectRef*>::iterator
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkitypedef std::map<uint64_t, WebServiceSession*>::iterator
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Read-only global variables
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ****************************************************************************/
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki// generated strings in methodmaps.cpp
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiextern const char *g_pcszISession,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki// globals for vboxweb command-line arguments
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiconst char *g_pcszBindToHost = NULL; // host; NULL = current machine
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiunsigned int g_uBacklog = 100; // backlog = max queue size for requests
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined (RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Writeable global variables
03831d35f7499c87d51205817c93e9a8d42c4baestevel ****************************************************************************/
03831d35f7499c87d51205817c93e9a8d42c4baestevel// this mutex protects all of the below
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki/****************************************************************************
03831d35f7499c87d51205817c93e9a8d42c4baestevel ****************************************************************************/
03831d35f7499c87d51205817c93e9a8d42c4baestevel#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined (RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
03831d35f7499c87d51205817c93e9a8d42c4baestevel RTStrmPrintf(g_pStdErr, "\nUsage: vboxwebsrv [options]\n\nSupported options (default values in brackets):\n");
03831d35f7499c87d51205817c93e9a8d42c4baestevel for (unsigned i = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined (RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki pcszDescr = "Session timeout in seconds; 0 = disable timeouts (" DEFAULT_TIMEOUT_SECS_STRING ").";
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki pcszDescr = "Frequency of timeout checks in seconds (5).";
a90d965d832a5578dbfc2eadd1617e8cccf25264fw RTStrmPrintf(g_pStdErr, "%-23s%s\n", str.c_str(), pcszDescr);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Implementation for WEBLOG macro defined in vboxweb.h; this prints a message
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * to the console and optionally to the file that may have been given to the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * vboxwebsrv command line.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param pszFormat
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // terminal
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // log file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // logger instance
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTLogLoggerEx(LOG_INSTANCE, RTLOGGRPFLAGS_DJ, LOG_GROUP, "%s", psz);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Helper for printing SOAP error messages.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param soap
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki const char *pcszFaultString = *soap_faultstring(soap);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki pcszFaultString ? pcszFaultString : "[no fault string available]",
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki (ppcszDetail && *ppcszDetail) ? *ppcszDetail : "no details available");
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Start up the webservice server. This keeps running and waits
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * for incoming SOAP connections; for each request that comes in,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * it calls method implementation code, most of it in the generated
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param argc
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param argv[]
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // intialize runtime
03831d35f7499c87d51205817c93e9a8d42c4baestevel RTStrmPrintf(g_pStdErr, VBOX_PRODUCT " Webservice Version " VBOX_VERSION_STRING "\n"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "All rights reserved.\n");
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0 /* fFlags */);
4c5e0fde93352f23abc94e445999402e38b91268vivek int rc2 = RTStrmOpen(ValueUnion.psz, "a", &g_pstrLog);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTPrintf("Error: Cannot open log file \"%s\" for writing, error %d.\n", ValueUnion.psz, rc2);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "Opened log file \"%s\"\n", VBOX_VERSION_STRING, ValueUnion.psz);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined (RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
a90d965d832a5578dbfc2eadd1617e8cccf25264fw RTStrmPrintf(g_pStdErr, "unhandled parameter: %s\n", ValueUnion.psz);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw if (c > 0)
a90d965d832a5578dbfc2eadd1617e8cccf25264fw RTStrmPrintf(g_pStdErr, "unknown option: %s", ValueUnion.psz);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTStrmPrintf(g_pStdErr, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined (RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
a90d965d832a5578dbfc2eadd1617e8cccf25264fw rc = RTProcDaemonize(false /* fNoChDir */, false /* fNoClose */,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTStrmPrintf(g_pStdErr, "vboxwebsrv: failed to daemonize, rc=%Rrc. exiting.\n", rc);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // intialize COM/XPCOM
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki rc = g_pVirtualBox.createLocalObject(CLSID_VirtualBox);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTPrintf("ERROR: failed to create the VirtualBox object!\n");
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTPrintf("ERROR: failed to create a session object!\n");
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTPrintf("Most likely, the VirtualBox COM server is not running or failed to start.\n");
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // start our watchdog thread
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "Watchdog"))
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTStrmPrintf(g_pStdErr, "[!] Cannot start watchdog thread\n");
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // set up gSOAP
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // avoid EADDRINUSE on bind()
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki int m, s; // master and slave sockets
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WebLog("Socket connection successful: host = %s, port = %u, master socket = %d\n",
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki (g_pcszBindToHost) ? g_pcszBindToHost : "default (localhost)",
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // call gSOAP to handle incoming SOAP connection
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WebLog("%llu: accepted connection from IP=%lu.%lu.%lu.%lu socket=%d... ",
03831d35f7499c87d51205817c93e9a8d42c4baestevel // enclose the entire RPC call in the sessions lock
03831d35f7499c87d51205817c93e9a8d42c4baestevel // so that the watchdog cannot destroy COM objects
03831d35f7499c87d51205817c93e9a8d42c4baestevel // while the RPC is ongoing
03831d35f7499c87d51205817c93e9a8d42c4baestevel // now process the RPC request (this goes into the
03831d35f7499c87d51205817c93e9a8d42c4baestevel // generated code in methodmaps.cpp with all the COM calls)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki soap_end(&soap); // clean up everything and close socket
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // we have to process main event queue
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki int vrc = com::EventQueue::getMainEventQueue()->processEventQueue(0);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki soap_done(&soap); // close master socket and detach environment
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Watchdog thread
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ****************************************************************************/
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * Watchdog thread, runs in the background while the webservice is alive.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This gets started by main() and runs in the background to check all sessions
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * for whether they have been no requests in a configurable timeout period. In
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * that case, the session is automatically logged off.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("Watchdog: sleeping %d seconds\n", g_iWatchdogCheckInterval));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("Watchdog: checking %d sessions\n", g_mapSessions.size()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("Watchdog: tNow: %d, session timestamp: %d\n", tNow, pSession->getLastObjectLookup()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki > pSession->getLastObjectLookup() + g_iWatchdogTimeoutSecs
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("Watchdog: Session %llX timed out, deleting\n", pSession->getID()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * SOAP exceptions
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ****************************************************************************/
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Helper function to raise a SOAP fault. Called by the other helper
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * functions, which raise specific SOAP faults.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param soap
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param str
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param extype
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param ex
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki const char *pcsz,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // raise the fault
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki struct SOAP_ENV__Detail *pDetail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // without the following, gSOAP crashes miserably when sending out the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // data because it will try to serialize all fields (stupid documentation)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // fill extended info depending on SOAP version
a90d965d832a5578dbfc2eadd1617e8cccf25264fw soap->fault->SOAP_ENV__Detail->__any = NULL; // no other XML data
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Raises a SOAP fault that signals that an invalid object was passed.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param soap
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param obj
a90d965d832a5578dbfc2eadd1617e8cccf25264fw _vbox__InvalidObjectFault *ex = soap_new__vbox__InvalidObjectFault(soap, 1);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki str += "Invalid managed object reference \"" + obj + "\"";
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * Return a safe C++ string from the given COM string,
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * without crashing if the COM string is empty.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param bstr
a90d965d832a5578dbfc2eadd1617e8cccf25264fw const char *pcsz;
a90d965d832a5578dbfc2eadd1617e8cccf25264fw return "";
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * Return a safe C++ string from the given COM UUID,
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * without crashing if the UUID is empty.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param bstr
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki const char *pcsz;
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Raises a SOAP runtime fault.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param pObj
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTStrmPrintf(g_pStdErr, "API return code: 0x%08X (%Rhrc)\n", apirc, apirc);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw RTStrmPrintf(g_pStdErr, "COM error info result code: 0x%lX\n", info.getResultCode());
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki RTStrmPrintf(g_pStdErr, "COM error info text: %ls\n", info.getText().raw());
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // allocated our own soap fault struct
a90d965d832a5578dbfc2eadd1617e8cccf25264fw _vbox__RuntimeFault *ex = soap_new__vbox__RuntimeFault(soap, 1);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ex->component = ConvertComString(info.getComponent());
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ex->interfaceID = ConvertComString(info.getInterfaceID());
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // compose descriptive message
a90d965d832a5578dbfc2eadd1617e8cccf25264fw com::Utf8StrFmt str("VirtualBox error: %s (0x%RU32)", ex->text.c_str(), ex->resultCode);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * splitting and merging of object IDs
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ****************************************************************************/
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Splits a managed object reference (in string form, as
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * passed in from a SOAP method call) into two integers for
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * session and object IDs, respectively.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param id
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param sessid
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param objid
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // 64-bit numbers in hex have 16 digits; hence
03831d35f7499c87d51205817c93e9a8d42c4baestevel // the object-ref string must have 16 + "-" + 16 characters
a90d965d832a5578dbfc2eadd1617e8cccf25264fw return true;
a90d965d832a5578dbfc2eadd1617e8cccf25264fw return false;
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Creates a managed object reference (in string form) from
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * two integers representing a session and object ID, respectively.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * @param sz Buffer with at least 34 bytes space to receive MOR string.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param sessid
03831d35f7499c87d51205817c93e9a8d42c4baestevel * @param objid
03831d35f7499c87d51205817c93e9a8d42c4baestevel RTStrFormatNumber(sz, sessid, 16, 16, 0, RTSTR_F_64BIT | RTSTR_F_ZEROPAD);
03831d35f7499c87d51205817c93e9a8d42c4baestevel RTStrFormatNumber(sz + 17, objid, 16, 16, 0, RTSTR_F_64BIT | RTSTR_F_ZEROPAD);
03831d35f7499c87d51205817c93e9a8d42c4baestevel/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * class WebServiceSession
03831d35f7499c87d51205817c93e9a8d42c4baestevel ****************************************************************************/
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Constructor for the session object.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Preconditions: Caller must have locked g_mutexSessions.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * @param username
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param password
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // register this session globally
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * Destructor. Cleans up and destroys all contained managed object references on the way.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Preconditions: Caller must have locked g_mutexSessions.
03831d35f7499c87d51205817c93e9a8d42c4baestevel // delete us from global map first so we can't be found
03831d35f7499c87d51205817c93e9a8d42c4baestevel // any more while we're cleaning up
03831d35f7499c87d51205817c93e9a8d42c4baestevel // notify ManagedObjectRef destructor so it won't
03831d35f7499c87d51205817c93e9a8d42c4baestevel // remove itself from the maps; this avoids rebalancing
03831d35f7499c87d51205817c93e9a8d42c4baestevel // the map's tree on every delete as well
03831d35f7499c87d51205817c93e9a8d42c4baestevel // if (_pISession)
03831d35f7499c87d51205817c93e9a8d42c4baestevel // delete _pISession;
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // _pISession = NULL;
03831d35f7499c87d51205817c93e9a8d42c4baestevel delete pRef; // this frees the contained ComPtr as well
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Authenticate the username and password against an authentification authority.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @return 0 if the user was successfully authenticated, or an error code
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * otherwise.
03831d35f7499c87d51205817c93e9a8d42c4baestevelint WebServiceSession::authenticate(const char *pcszUsername,
03831d35f7499c87d51205817c93e9a8d42c4baestevel static bool fAuthLibLoaded = false;
03831d35f7499c87d51205817c93e9a8d42c4baestevel // retrieve authentication library from system properties
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki g_pVirtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam());
03831d35f7499c87d51205817c93e9a8d42c4baestevel systemProperties->COMGETTER(WebServiceAuthLibrary)(authLibrary.asOutParam());
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("external authentication library is '%ls'\n", authLibrary.raw()));
03831d35f7499c87d51205817c93e9a8d42c4baestevel // authentication disabled, let everyone in:
03831d35f7499c87d51205817c93e9a8d42c4baestevel WEBDEBUG(("%s() Failed to load external authentication library. Error code: %Rrc\n", __FUNCTION__, rc));
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (RT_FAILURE(rc = RTLdrGetSymbol(hlibAuth, "VRDPAuth2", (void**)&pfnAuthEntry2)))
03831d35f7499c87d51205817c93e9a8d42c4baestevel WEBDEBUG(("%s(): Could not resolve import '%s'. Error code: %Rrc\n", __FUNCTION__, "VRDPAuth2", rc));
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (RT_FAILURE(rc = RTLdrGetSymbol(hlibAuth, "VRDPAuth", (void**)&pfnAuthEntry)))
03831d35f7499c87d51205817c93e9a8d42c4baestevel WEBDEBUG(("%s(): Could not resolve import '%s'. Error code: %Rrc\n", __FUNCTION__, "VRDPAuth", rc));
03831d35f7499c87d51205817c93e9a8d42c4baestevel } while (0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel result = pfnAuthEntry2(NULL, VRDPAuthGuestNotAsked, pcszUsername, pcszPassword, NULL, true, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel WEBDEBUG(("%s(): result of VRDPAuth2(): %d\n", __FUNCTION__, result));
03831d35f7499c87d51205817c93e9a8d42c4baestevel result = pfnAuthEntry(NULL, VRDPAuthGuestNotAsked, pcszUsername, pcszPassword, NULL);
03831d35f7499c87d51205817c93e9a8d42c4baestevel WEBDEBUG(("%s(): result of VRDPAuth(%s, [%d]): %d\n", __FUNCTION__, pcszUsername, strlen(pcszPassword), result));
03831d35f7499c87d51205817c93e9a8d42c4baestevel // fAuthLibLoaded = true but both pointers are NULL:
03831d35f7499c87d51205817c93e9a8d42c4baestevel // then the authlib was "null" and auth was disabled
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("Could not resolve VRDPAuth2 or VRDPAuth entry point"));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // now create the ISession object that this webservice session can use
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // (and of which IWebsessionManager::getSessionObject returns a managed object reference)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if (FAILED(rc = session.createInprocObject(CLSID_Session)))
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki _pISession = new ManagedObjectRef(*this, g_pcszISession, session);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG((" * %s: created session object with comptr 0x%lX, MOR = %s\n", __FUNCTION__, p, strMOR.c_str()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki } while (0);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Look up, in this session, whether a ManagedObjectRef has already been
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * created for the given COM pointer.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Note how we require that a ComPtr<IUnknown> is passed, which causes a
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * queryInterface call when the caller passes in a different type, since
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * a ComPtr<IUnknown> will point to something different than a
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * ComPtr<IVirtualBox>, for example. As we store the ComPtr<IUnknown> in
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * our private hash table, we must search for one too.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Preconditions: Caller must have locked g_mutexSessions.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param pcu pointer to a COM object.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @return The existing ManagedObjectRef that represents the COM object, or NULL if there's none yet.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiManagedObjectRef* WebServiceSession::findRefFromPtr(const ComPtr<IUnknown> &pcu)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // WEBDEBUG((" %s: looking up 0x%lX\n", __FUNCTION__, ulp));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ManagedObjectsMapByPtr::iterator it = _pp->_mapManagedObjectsByPtr.find(ulp);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG((" %s: found existing ref %s for COM obj 0x%lX\n", __FUNCTION__, id.c_str(), ulp));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Static method which attempts to find the session for which the given managed
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * object reference was created, by splitting the reference into the session and
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * object IDs and then looking up the session object for that session ID.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Preconditions: Caller must have locked g_mutexSessions.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param id Managed object reference (with combined session and object IDs).
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiWebServiceSession* WebServiceSession::findSessionFromRef(const WSDLT_ID &id)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Touches the webservice session to prevent it from timing out.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Each webservice session has an internal timestamp that records
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * the last request made to it from the client that started it.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * If no request was made within a configurable timeframe, then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * the client is logged off automatically,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * by calling IWebsessionManager::logoff()
4c5e0fde93352f23abc94e445999402e38b91268vivek/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * class ManagedObjectRef
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ****************************************************************************/
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Constructor, which assigns a unique ID to this managed object
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * reference and stores it two global hashs:
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * a) G_mapManagedObjectsById, which maps ManagedObjectID's to
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * instances of this class; this hash is then used by the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * findObjectFromRef() template function in vboxweb.h
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * to quickly retrieve the COM object from its managed
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * object ID (mostly in the context of the method mappers
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * in methodmaps.cpp, when a web service client passes in
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * a managed object ID);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * b) G_mapManagedObjectsByComPtr, which maps COM pointers to
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * instances of this class; this hash is used by
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * createRefFromObject() to quickly figure out whether an
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * instance already exists for a given COM pointer.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * This does _not_ check whether another instance already
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * exists in the hash. This gets called only from the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * createRefFromObject() template function in vboxweb.h, which
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * does perform that check.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Preconditions: Caller must have locked g_mutexSessions.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param pObj
a90d965d832a5578dbfc2eadd1617e8cccf25264fwManagedObjectRef::ManagedObjectRef(WebServiceSession &session,
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // and count globally
a90d965d832a5578dbfc2eadd1617e8cccf25264fw ULONG64 cTotal = ++g_cManagedObjects; // raise global count and make a copy for the debug message below
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG((" * %s: MOR created for ulp 0x%lX (%s), new ID is %llX; now %lld objects total\n", __FUNCTION__, _ulp, pcszInterface, _id, cTotal));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Destructor; removes the instance from the global hash of
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * managed objects.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Preconditions: Caller must have locked g_mutexSessions.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG((" * %s: deleting MOR for ID %llX (%s); now %lld objects total\n", __FUNCTION__, _id, _pcszInterface, cTotal));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // if we're being destroyed from the session's destructor,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // then that destructor is iterating over the maps, so
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // don't remove us there! (data integrity + speed)
a90d965d832a5578dbfc2eadd1617e8cccf25264fw WEBDEBUG((" * %s: removing from session maps\n", __FUNCTION__));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if (_session._pp->_mapManagedObjectsByPtr.erase(_ulp) != 1)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG((" WARNING: could not find %llX in _mapManagedObjectsByPtr\n", _ulp));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Converts the ID of this managed object reference to string
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * form, for returning with SOAP data or similar.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @return The ID in string form.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Static helper method for findObjectFromRef() template that actually
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * looks up the object from a given integer ID.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * This has been extracted into this non-template function to reduce
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * code bloat as we have the actual STL map lookup only in this function.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * This also "touches" the timestamp in the session whose ID is encoded
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * in the given integer ID, in order to prevent the session from timing
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Preconditions: Caller must have locked g_mutexSessions.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param strId
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param iter
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // allow NULL (== empty string) input reference, which should return a NULL pointer
4c5e0fde93352f23abc94e445999402e38b91268vivek WEBDEBUG((" %s(): looking up objref %s\n", __FUNCTION__, id.c_str()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG((" %s(): sessid %llX, objid %llX\n", __FUNCTION__, sessid, objid));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG((" %s: cannot find session for objref %s\n", __FUNCTION__, id.c_str()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // "touch" session to prevent it from timing out
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ManagedObjectsIteratorById iter = pSess->_pp->_mapManagedObjectsById.find(objid);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw WEBDEBUG((" %s: cannot find comobj for objref %s\n", __FUNCTION__, id.c_str()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki } while (0);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * interface IManagedObjectRef
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ****************************************************************************/
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * This is the hard-coded implementation for the IManagedObjectRef::getInterfaceName()
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * that our WSDL promises to our web service clients. This method returns a
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * string describing the interface that this managed object reference
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * supports, e.g. "IMachine".
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param soap
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param req
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param resp
a90d965d832a5578dbfc2eadd1617e8cccf25264fw _vbox__IManagedObjectRef_USCOREgetInterfaceNameResponse *resp)
a90d965d832a5578dbfc2eadd1617e8cccf25264fw if (!ManagedObjectRef::findRefFromId(req->_USCOREthis, &pRef, false))
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki } while (0);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * This is the hard-coded implementation for the IManagedObjectRef::release()
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * that our WSDL promises to our web service clients. This method releases
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * a managed object reference and removes it from our stacks.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param soap
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param req
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param resp
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if ((rc = ManagedObjectRef::findRefFromId(req->_USCOREthis, &pRef, false)))
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // this removes the object from all stacks; since
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // there's a ComPtr<> hidden inside the reference,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // this should also invoke Release() on the COM
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki } while (0);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki/****************************************************************************
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * interface IWebsessionManager
a90d965d832a5578dbfc2eadd1617e8cccf25264fw ****************************************************************************/
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Hard-coded implementation for IWebsessionManager::logon. As opposed to the underlying
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * COM API, this is the first method that a webservice client must call before the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * webservice will do anything useful.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * This returns a managed object reference to the global IVirtualBox object; into this
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * reference a session ID is encoded which remains constant with all managed object
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * references returned by other methods.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * This also creates an instance of ISession, which is stored internally with the
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * webservice session and can be retrieved with IWebsessionManager::getSessionObject
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * (__vbox__IWebsessionManager_USCOREgetSessionObject). In order for the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * VirtualBox web service to do anything useful, one usually needs both a
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * VirtualBox and an ISession object, for which these two methods are designed.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * When the webservice client is done, it should call IWebsessionManager::logoff. This
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * will clean up internally (destroy all remaining managed object references and
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * related COM objects used internally).
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * After logon, an internal timeout ensures that if the webservice client does not
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * call any methods, after a configurable number of seconds, the webservice will log
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * off the client automatically. This is to ensure that the webservice does not
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * drown in managed object references and eventually deny service. Still, it is
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * a much better solution, both for performance and cleanliness, for the webservice
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * client to clean up itself.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Preconditions: Caller must have locked g_mutexSessions.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Since this gets called from main() like other SOAP method
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * implementations, this is ensured.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * @param vbox__IWebsessionManager_USCORElogon
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param vbox__IWebsessionManager_USCORElogonResponse
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // create new session; the constructor stores the new session
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // in the global map automatically
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // authenticate the user
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // in the new session, create a managed object reference (moref) for the
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // global VirtualBox object; this encodes the session ID in the moref so
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // that it will be implicitly be included in all future requests of this
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki // webservice client
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ManagedObjectRef *pRef = new ManagedObjectRef(*pSession, g_pcszIVirtualBox, g_pVirtualBox);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("VirtualBox object ref is %s\n", resp->returnval.c_str()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki } while (0);
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Returns the ISession object that was created for the webservice client
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * on logon.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Preconditions: Caller must have locked g_mutexSessions.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * Since this gets called from main() like other SOAP method
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * implementations, this is ensured.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki _vbox__IWebsessionManager_USCOREgetSessionObject *req,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki _vbox__IWebsessionManager_USCOREgetSessionObjectResponse *resp)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if ((pSession = WebServiceSession::findSessionFromRef(req->refIVirtualBox)))
a90d965d832a5578dbfc2eadd1617e8cccf25264fw } while (0);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * hard-coded implementation for IWebsessionManager::logoff.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * Preconditions: Caller must have locked g_mutexSessions.
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * Since this gets called from main() like other SOAP method
a90d965d832a5578dbfc2eadd1617e8cccf25264fw * implementations, this is ensured.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param vbox__IWebsessionManager_USCORElogon
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki * @param vbox__IWebsessionManager_USCORElogonResponse
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if ((pSession = WebServiceSession::findSessionFromRef(req->refIVirtualBox)))
a90d965d832a5578dbfc2eadd1617e8cccf25264fw // destructor cleans up
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki WEBDEBUG(("session destroyed, %d sessions left open\n", g_mapSessions.size()));
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki } while (0);
a90d965d832a5578dbfc2eadd1617e8cccf25264fw WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));