Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Access to modules

Expand Messages
  • Paul Kulchenko
    Hi, mbrutsch! ... I don t recommend you to do it. Almost any security restriction is there for a reason. If you use static dispatch, name of the class is
    Message 1 of 4 , Apr 10, 2001
    • 0 Attachment
      Hi, mbrutsch!

      > @INC is disabled (due to security reasons)". Before I go hacking
      > SOAP::Lite to remove this crippling restriction, I'm wondering
      I don't recommend you to do it. Almost any security restriction is
      there for a reason. If you use static dispatch, name of the class is
      well-known and incoming request could be checked. If you use dynamic
      dispatch, content of directory(ies) is unknown and nothing stops user
      from loading class that DO NOT belong to this directory (for example
      from @INC).

      To allow to do what you want you may either take a look into
      documentation that describes 4 different ways to deal with this
      restriction. Probably the most convenient way for you is to use
      static dispatch, but with mask instead of class name:

      ->dispatch_to('Class::[\w:]+');

      It should allow you to load all classes that have Class:: in their
      name (but not Class itself). Any regular expressions are allowed, so
      it shouldn't be difficult for you to specify tree of your objects.

      Hope it helps. Let me know if it doesn't give you what you need.

      Best wishes, Paul.

      --- mbrutsch@... wrote:
      > The SOAP::Lite guide states that "during dynamic dispatch access to
      > @INC is disabled (due to security reasons)". Before I go hacking
      > SOAP::Lite to remove this crippling restriction, I'm wondering just
      > what the "security reasons" are for doing this. We have a large,
      > well-defined tree of object modules, and, as far as I can tell, the
      > only way to use them is either to (A) copy (or link) them all into
      > a
      > single directory (which won't work due to name overlaps) or (B)
      > list
      > them individually in a massive dispatch_to() call. Can anyone shed
      > any light on this problem?
      >
      > Thanks.
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Get email at your own domain with Yahoo! Mail.
      http://personal.mail.yahoo.com/
    • Brutsch, Michael
      Hi Paul! ... I m trying to use the regex-enabled static dispatch. Here are my files, and their locations: My module is in
      Message 2 of 4 , Apr 10, 2001
      • 0 Attachment
        Hi Paul!

        > restriction. Probably the most convenient way for you is to use
        > ->dispatch_to('Class::[\w:]+');
        >
        > It should allow you to load all classes that have Class:: in their
        > name (but not Class itself). Any regular expressions are allowed, so

        I'm trying to use the regex-enabled static dispatch. Here are my files, and their locations:

        My module is in
        /opt/camelot/lib/PDS/MGT/DEMO/Demo.pm
        and looks like
        ----------------
        package Demo;
        sub hi { my ($self, $name) = @_; return "hello, $name\n"; }
        sub bye { my ($self, $name) = @_; return "goodbye, cruel $name\n"; }
        1;
        ----------------
        My server:
        ----------------
        use SOAP::Transport::HTTP;
        my $daemon = SOAP::Transport::HTTP::Daemon
        -> new (LocalPort => 12000)
        -> dispatch_to('PDS::[\w:]+');
        $daemon->handle;
        -----------------
        and my client:
        -----------------
        use SOAP::Lite;

        my $soap = SOAP::Lite
        -> uri('PDS/MGT/DEMO/Demo')
        -> proxy('http://localhost:12001')
        -> hi('test');
        print $soap->fault ? $soap->faultdetail."\n" : $soap->result;
        ------------------
        What I get, when I run the client, is
        ------------------
        bash$ perl soap_client.pl
        Failed to access class (PDS::MGT::DEMO::Demo): Can't locate PDS/MGT/DEMO/Demo.pm in @INC (@INC contains: PDS::[\w:]+) at (eval 16) line 3.

        Where do I specify the '/opt/camelot/lib' that my module tree lives in?
      • Paul Kulchenko
        Hi, Michael! ... use lib /opt/camelot/lib ; or combine static and dynamic approach in dispatch_to (all directories will be added to @INC during static
        Message 3 of 4 , Apr 10, 2001
        • 0 Attachment
          Hi, Michael!

          > Where do I specify the '/opt/camelot/lib' that my module tree lives
          > in?

          you may specify it as you usually do with lib pragma in server code:

          > use SOAP::Transport::HTTP;
          use lib '/opt/camelot/lib';

          or combine static and dynamic approach in dispatch_to (all
          directories will be added to @INC during static dispatch):

          -> dispatch_to('/opt/camelot/lib', 'PDS::[\w:]+');

          Best wishes, Paul.

          --- "Brutsch, Michael" <mbrutsch@...> wrote:
          > Hi Paul!
          >
          > > restriction. Probably the most convenient way for you is to use
          > > ->dispatch_to('Class::[\w:]+');
          > >
          > > It should allow you to load all classes that have Class:: in
          > their
          > > name (but not Class itself). Any regular expressions are allowed,
          > so
          >
          > I'm trying to use the regex-enabled static dispatch. Here are my
          > files, and their locations:
          >
          > My module is in
          > /opt/camelot/lib/PDS/MGT/DEMO/Demo.pm
          > and looks like
          > ----------------
          > package Demo;
          > sub hi { my ($self, $name) = @_; return "hello, $name\n"; }
          > sub bye { my ($self, $name) = @_; return "goodbye, cruel $name\n";
          > }
          > 1;
          > ----------------
          > My server:
          > ----------------
          > use SOAP::Transport::HTTP;
          > my $daemon = SOAP::Transport::HTTP::Daemon
          > -> new (LocalPort => 12000)
          > -> dispatch_to('PDS::[\w:]+');
          > $daemon->handle;
          > -----------------
          > and my client:
          > -----------------
          > use SOAP::Lite;
          >
          > my $soap = SOAP::Lite
          > -> uri('PDS/MGT/DEMO/Demo')
          > -> proxy('http://localhost:12001')
          > -> hi('test');
          > print $soap->fault ? $soap->faultdetail."\n" : $soap->result;
          > ------------------
          > What I get, when I run the client, is
          > ------------------
          > bash$ perl soap_client.pl
          > Failed to access class (PDS::MGT::DEMO::Demo): Can't locate
          > PDS/MGT/DEMO/Demo.pm in @INC (@INC contains: PDS::[\w:]+) at (eval
          > 16) line 3.
          >
          > Where do I specify the '/opt/camelot/lib' that my module tree lives
          > in?
          >
          > ------------------------ Yahoo! Groups Sponsor
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to
          > http://docs.yahoo.com/info/terms/
          >
          >


          __________________________________________________
          Do You Yahoo!?
          Get email at your own domain with Yahoo! Mail.
          http://personal.mail.yahoo.com/
        Your message has been successfully submitted and would be delivered to recipients shortly.