XMLRPC::Server.set_valid_ip

(Rene Paulokat) #1

hi,
i run into trouble trying to restrict connection-attempts to
XMLRPC::Server using the method set_valid_ip
without using this restriction everything runs smoothe.

   ips = ["127.0.0.1", "192.168.30.42"]
   @@server.set_valid_ip(ips)

i start the server:
log says:
[Tue Aug 16 02:38:20 2005] HttpServer 192.168.30.42:8080 start

i connect with client:
log says:
HttpServer 192.168.30.42:8080 client:55058 insane<127.0.0.1> connect

but client gets an:

/usr/local/lib/ruby/1.8/xmlrpc/client.rb:535:in `do_rpc': HTTP-Error: 403 Forbidden (RuntimeError)
        from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:409:in `call2'
        from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:399:in `call'
        from client.rb:7

although
  @@server.get_valid_ip
    --> [["127.0.0.1", "192.168.30.42"]]

so, if anybody got some hint...
would be great.

greetings
rene

···

--
GnuPG fingerprint = E883 D359 3F56 51AF 0294 8BEB 16B3 15BD 8FC7 8254
fetch www.so36.net/~rp/rene.asc

(Daniel Berger) #2

Rene Paulokat wrote:

hi,
i run into trouble trying to restrict connection-attempts to
XMLRPC::Server using the method set_valid_ip
without using this restriction everything runs smoothe.

   ips = ["127.0.0.1", "192.168.30.42"]
   @@server.set_valid_ip(ips)

<snip>

I think you need to splat the "ips" variable, e.g.
@@server.set_valid_ip(*ips).

It should probably handle that automatically.

Regards,

Dan

(Rene Paulokat) #3

thanks for your answer, but meanwhile i think my problem is quite mysterious,
if i start little testserver:

--- snip ---
require 'xmlrpc/server'
class TestServer < XMLRPC::Server
   def foo
      puts "bar"
   end
end

t = TestServer.new(8080)
t.add_introspection
ip = ["127.0.0.1","192.168.30.42"]
t.set_valid_ip(*ip)
t.serve
--- snap ---

result is:
/usr/local/lib/ruby/1.8/xmlrpc/client.rb:535:in `do_rpc': HTTP-Error: 500 Internal Server Error (RuntimeError)
        from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:409:in `call2'
        from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:399:in `call'
        from client.rb:7

my client just queries for 'system.listMethods' -
if i comment out set_valid_ip - i get the expected result.

hrm, dunno

rene

···

On Tue, Aug 16, 2005 at 10:06:13AM +0900, Daniel Berger wrote:

Rene Paulokat wrote:
> hi,
> i run into trouble trying to restrict connection-attempts to
> XMLRPC::Server using the method set_valid_ip
> without using this restriction everything runs smoothe.

I think you need to splat the "ips" variable, e.g.
@@server.set_valid_ip(*ips).

--
GnuPG fingerprint = E883 D359 3F56 51AF 0294 8BEB 16B3 15BD 8FC7 8254
fetch www.so36.net/~rp/rene.asc