|
From: <cre...@us...> - 2006-07-26 17:41:51
|
Revision: 1465 Author: creecode Date: 2006-07-26 10:24:31 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1465&view=rev Log Message: ----------- handle multiple domains Modified Paths: -------------- ODBs/trunk/frontierRoot/system/verbs/builtins/betty/rpc/server.fvc Modified: ODBs/trunk/frontierRoot/system/verbs/builtins/betty/rpc/server.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/betty/rpc/server.fvc 2006-07-26 17:18:57 UTC (rev 1464) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/betty/rpc/server.fvc 2006-07-26 17:24:31 UTC (rev 1465) @@ -1,31 +1,45 @@ -FrontierVcsFile:1:scpt:system.verbs.builtins.betty.rpc.server +FrontierVcsFile:3:scpt:system.verbs.builtins.betty.rpc.server on server (xmlText, adrParamTable) { //called from the RPC2 responder on an incoming request - \xC7Change notes: - \xC701/31/02; 2:13:15 PM by JES - \xC7Factored the security check by IP address to betty.rpc.checkClient, so the check can be used for both XML-RPC and SOAP. - \xC704/27/01; 7:58:15 PM by JES - \xC7If a request doesn't have a <params> element, don't fault. Instead treat it as a call with no input parameters. - \xC7Thu, 02 Dec 1999 at 5:17:37 PM by AR - \xC7Disabled fldebug flag again. - \xC7Wed, 04 Nov 1999 at 10:33:45 PM by AR - \xC7If user.betty.prefs.flAllowByIpOnly is true, block XML-RPC requests from anyone except those IP addresses listed in user.betty.prefs.allowedIpAddresses - \xC7Mon, 25 Oct 1999 at 11:07:19 PM by AR - \xC7If user.betty.prefs.flKeepServerLog is true, we log all incoming requests to the rpcServer section of the daily log GDB. - \xC7Mon, 14 Jun 1999 15:46:57 GMT by AR - \xC7When walking the XML structure to extract the parameters, we now handle the case correctly when a parameter is a table and the next parameter is a scalar. - \xC7If an RPC fault occurs, left angle brackets and ampersands in the error string are now properly encoded to ensure that the XML-RPC response is well-formed. - \xC7Friday, July 17, 1998 at 12:57:38 PM by PBS - \xC7XML header is now lowercase to conform to the XML spec. - \xC7Turned off debugging; use a local table rather than a global table so the server is thread-safe. + «Changes + «5/24/06; 8:15:45 AM by DW + «Handle multiple domains as described here < http://geeks.opml.org/2006/05/24#a865 >. + «01/31/02; 2:13:15 PM by JES + «Factored the security check by IP address to betty.rpc.checkClient, so the check can be used for both XML-RPC and SOAP. + «04/27/01; 7:58:15 PM by JES + «If a request doesn't have a <params> element, don't fault. Instead treat it as a call with no input parameters. + «Thu, 02 Dec 1999 at 5:17:37 PM by AR + «Disabled fldebug flag again. + «Wed, 04 Nov 1999 at 10:33:45 PM by AR + «If user.betty.prefs.flAllowByIpOnly is true, block XML-RPC requests from anyone except those IP addresses listed in user.betty.prefs.allowedIpAddresses + «Mon, 25 Oct 1999 at 11:07:19 PM by AR + «If user.betty.prefs.flKeepServerLog is true, we log all incoming requests to the rpcServer section of the daily log GDB. + «Mon, 14 Jun 1999 15:46:57 GMT by AR + «When walking the XML structure to extract the parameters, we now handle the case correctly when a parameter is a table and the next parameter is a scalar. + «If an RPC fault occurs, left angle brackets and ampersands in the error string are now properly encoded to ensure that the XML-RPC response is well-formed. + «Friday, July 17, 1998 at 12:57:38 PM by PBS + «XML header is now lowercase to conform to the XML spec. + «Turned off debugging; use a local table rather than a global table so the server is thread-safe. local (fldebug = false, flFault = false, securitylist = {}); betty.init (); + local (adrhandlerstable = @user.betty.rpcHandlers); + + if user.betty.prefs.flServerDomains { + if defined (user.betty.domains) { + if defined (adrparamtable^.host) { + local (host = adrparamtable^.host); + if host contains ":" { //remove the port designator + host = string.nthfield (host, ":", 1)}; + local (adrtable = @user.betty.domains.[host]); + if defined (adrtable^) { + adrhandlerstable = adrtable}}}}; + local (flLog = user.betty.prefs.flKeepServerLog); + local (xmlResponse = "", indentlevel = 1); - local (xmlResponse = "", indentlevel = 1); on add (s) { xmlResponse = xmlResponse + string.filledString ("\t", indentlevel) + s + "\r\n"}; @@ -44,6 +58,7 @@ if defined (adrParamTable^.requestHeaders.["User-Agent"]) { adrHitTable^.agent = adrParamTable^.requestHeaders.["User-Agent"]}; adrHitTable^.ticks = clock.ticks () - adrParamTable^.stats.requestProcessingStarted}; + on rpcFault (errorstring, errornum) { flFault = true; add ("<fault>"); indentlevel++; @@ -80,29 +95,29 @@ bundle { //AR 11/04/1999: check for rpc request blocking if not betty.rpc.checkClient (adrParamTable) { //1/31/02 JES: factored for use for both XML-RPC and SOAP - rpcFault ("Access not allowed from " + adrParamTable^.client + ".", betty.rpc.errorCodes.securityFault)}; - \xC7if defined (user.betty.prefs.flAllowByIpOnly) - \xC7if user.betty.prefs.flAllowByIpOnly - \xC7local (flBlocked = true) - \xC7local (okIpList = user.betty.prefs.allowedIpAddresses) - \xC7if typeOf (okIpList) == stringType - \xC7It's a comma-delimited string: create a local list from that string. - \xC7local (s = okIpList) - \xC7okIpList = {} - \xC7local (i) - \xC7for i = 1 to string.countFields (s, ',') - \xC7local (oneIpAddress = string.nthField (s, ',', i)) - \xC7oneIpAddress = string.trimWhiteSpace (oneIpAddress) - \xC7if oneIpAddress != "" - \xC7okIpList = okIpList + oneIpAddress - \xC7local (oneIp) - \xC7for oneIp in okIpList - \xC7if string.trimWhiteSpace (oneIp) != "" - \xC7if adrParamTable^.client == oneIp - \xC7flblocked = false - \xC7break - \xC7if flblocked - \xC7rpcFault ("Access not allowed from " + adrParamTable^.client + ".", betty.rpc.errorCodes.securityFault)}; + rpcFault ("Access not allowed from " + adrParamTable^.client + ".", betty.rpc.errorCodes.securityFault)}}; + «if defined (user.betty.prefs.flAllowByIpOnly) + «if user.betty.prefs.flAllowByIpOnly + «local (flBlocked = true) + «local (okIpList = user.betty.prefs.allowedIpAddresses) + «if typeOf (okIpList) == stringType + «It's a comma-delimited string: create a local list from that string. + «local (s = okIpList) + «okIpList = {} + «local (i) + «for i = 1 to string.countFields (s, ',') + «local (oneIpAddress = string.nthField (s, ',', i)) + «oneIpAddress = string.trimWhiteSpace (oneIpAddress) + «if oneIpAddress != "" + «okIpList = okIpList + oneIpAddress + «local (oneIp) + «for oneIp in okIpList + «if string.trimWhiteSpace (oneIp) != "" + «if adrParamTable^.client == oneIp + «flblocked = false + «break + «if flblocked + «rpcFault ("Access not allowed from " + adrParamTable^.client + ".", betty.rpc.errorCodes.securityFault) if (not flFault) { //get the procedure name and the paramlist on parseXML () { @@ -208,4 +223,6 @@ try { addToRpcLog ()}}; - return (xmlResponse)} \ No newline at end of file + return (xmlResponse)} + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |