ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/bin/aemp
(Generate patch)

Comparing AnyEvent-MP/bin/aemp (file contents):
Revision 1.55 by root, Thu Mar 8 21:37:51 2012 UTC vs.
Revision 1.56 by root, Wed Mar 21 15:22:16 2012 UTC

473including remotely-triggered execution of code. 473including remotely-triggered execution of code.
474 474
475Sometimes a more secure mode is desired - this can be achieved by setting 475Sometimes a more secure mode is desired - this can be achieved by setting
476the secure option to a true value. 476the secure option to a true value.
477 477
478When secure mode is enabled, then remote nodes cannot execute code 478When secure mode is enabled, then the node will not execute code locally,
479locally, at least not via the normal node protocol. All other messages are 479at least not via the normal node protocol. All other messages are still
480still allowed. This means remote nodes can monitor, kill or local ports 480allowed. This means remote nodes can monitor, kill or local ports (port
481(port names can be easily guessed). 481names can be easily guessed). Specifically, note that the very common
482"send me a list that I prepend to my reply message" idiom can easily
483be used to subvert this security mechanism by asking a trusted node to
484"reply" to some other message.
482 485
483At the moment, this affects C<snd_on>, C<eval_on> and C<spawn> 486At the moment, this setting affects C<snd_on>, C<eval_on> and C<spawn>
484functionality. 487functionality.
485 488
486The C<configure> function additionally allows you to specify a callback 489The C<configure> function additionally allows you to specify a callback
487that can grant or suppress such requests on a per-node basis. 490that can grant or suppress such requests on a per-node basis.
488 491
629 632
630our $cfg = AnyEvent::MP::Config::config; 633our $cfg = AnyEvent::MP::Config::config;
631our $profile = $cfg; 634our $profile = $cfg;
632 635
633sub trace { 636sub trace {
634 my ($node) = @_; 637 my ($seed) = @_;
635 my $cv = AE::cv; 638 my $cv = AE::cv;
636 my %seen; 639 my %seen;
637 640
638 my $to = AE::timer 15, 0, sub { exit 1 }; 641 my $to;
639 642
640 init; 643 init;
641 644
642 my $reply = port { 645 my $reply = port {
643 my ($node, undef, @neigh) = @_; 646 my ($node, undef, @neigh) = @_;
644 647
648 $to = AE::timer 15, 0, sub { exit 1 };
645 @neigh = grep $_ ne $NODE, @neigh; 649 @neigh = grep $_ ne $NODE, @neigh;
646 650
647 print $node, " -> ", (join " ", @neigh), "\n"; 651 print $node, " -> ", (join " ", @neigh), "\n";
648 652
649 for (@neigh) { 653 for (@neigh) {
655 659
656 $cv->end; 660 $cv->end;
657 }; 661 };
658 662
659 $cv->begin; 663 $cv->begin;
660 snd $reply, $node => undef, AnyEvent::MP::Kernel::up_nodes; 664 snd $reply, seed => undef, $seed;
661 665
662 $cv->recv; 666 $cv->recv;
663} 667}
664 668
665sub shell { 669sub shell {
678 682
679EOF 683EOF
680 my $pkg = "AnyEvent::MP::Kernel"; 684 my $pkg = "AnyEvent::MP::Kernel";
681 my $cv = AE::cv; 685 my $cv = AE::cv;
682 my $echo = port { 686 my $echo = port {
683 print "\n ECHO<$AnyEvent::MP::Kernel::SRCNODE->{id}> ", JSON::XS::encode_json \@_, "\n$node $pkg> "; 687 print "\n ECHO<$AnyEvent::MP::Kernel::SRCNODE> ", JSON::XS::encode_json \@_, "\n$node $pkg> ";
684 }; 688 };
685 print "$node $pkg> "; 689 print "$node $pkg> ";
686 my $t = AE::io *STDIN, 0, sub { 690 my $t = AE::io *STDIN, 0, sub {
687 chomp (my $line = <STDIN>); 691 chomp (my $line = <STDIN>);
688 692

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines