On Fri, 08 Jan 2010, Mindaugas Kavaliauskas wrote:
Hi,
> Yes, situation is a little complicated. Do we have .prg level
> functions to test if symbol is registered in global symbol table and
> is associated with function?
empty( sSymbol )
return .F. when symbol item points to function.
> How default rpc filter function code
> will look in case lRaw == .T.?
In this case we will have function name as character item.
See the message about TYPE() I send a while ago.
To make things easier I've just added extended __DYNSISFUN()
so not it accepts also function name as parameter so it may
look like:
func rpc_filter( lCheck, cFunc, ... )
if lCheck
return __dynsIsFun( cFunc )
endif
return &cFunc( ... )
> The following code (untested and perhaps is buggy) looks like
> security hole for me. cFunc can be used to do any macro code
> injection:
>
> PROC defaultrpcfilter(lCheck, cFunc, ...)
> IF lCheck
> RETURN TYPE(cFunc + "()") == "UI"
see my last message about TYPE()
> ENDIF
> RETURN &("@" + cFunc + "()"):exec(...)
RETURN &cFunc( ... )
is much simpler :)
> Filter hash could be used instead of filter function also:
> {"STR"=>@STR(), "VAL"=>@MY_VAL(), "MEMOREAD"=>@HB_MEMOREAD(),
> "IDLE"=>{|| NIL}}. It is less flexible solution than filter
> function, but can solve problem of NETIO_PROCEXIST().
I do not think it's less flexible. It allow to create quite
interesting RPC servers, i.e. some custom set of commands:
{ { "Code:1" => { |...|
local hResult:={=>}
goTop()
while !eof()
hResult[ field->articule ] += field->quantity
dbskip()
enddo
return hResult
} }, ;
{ "Code:2" => { |...|
[...]
}
best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour