<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi!<br>
<br>
On 12/18/2012 06:28 AM, Son Tran-Nguyen wrote:<br>
</div>
<blockquote
cite="mid:CAB3emm1pxs34+NDaQywS=GSTLQ8e8=6UsaVgc7gtmg9K+FJ9AQ@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr"><font color="#3366ff" face="tahoma, sans-serif">Hello
list,</font>
<div><font color="#3366ff" face="tahoma, sans-serif"><br>
</font></div>
<div><font color="#3366ff" face="tahoma, sans-serif">In one of
my application, I start a restricted shell as a slave node,
using a callback module as follow:</font></div>
<div><br>
</div>
<div style=""><font color="#3366ff" face="tahoma, sans-serif">The
callback module, for example, returns {false, State} for
gen_event:start/0 function to prevent that to be run. When
tested in an actual restricted shell, it is prevented as
expected:</font></div>
<div style=""><font color="#3366ff" face="tahoma, sans-serif"><br>
</font></div>
<div style=""><font color="#3366ff" face="tahoma, sans-serif">
<div>smba:eggs esente$ erl -pa apps/*/ebin -stdlib
restricted_shell shell_callback</div>
<div>Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4]
[async-threads:0] [hipe] [kernel-poll:false] [dtrace]</div>
<div><br>
</div>
<div>Restricted Eshell V5.9.2 (abort with ^G)</div>
<div>1> gen_event:start().</div>
<div>** exception exit: restricted shell does not allow
gen_event:start()</div>
<div>2> </div>
<div><br>
</div>
<div style="">However, when used in my app by making a call
to the remote restricted shell using rpc:call/4, the call
went through:</div>
<div style=""><br>
</div>
<div style="">
<div>Args = "-stdlib restricted_shell editor_shell",</div>
<div>{ok, Node} = slave:start_link(smba, editor, Args),</div>
</div>
</font></div>
<div><font color="#3366ff" face="tahoma, sans-serif">{ok,
Entity} = rpc:call(Node, gen_event, start, []),</font></div>
<div><font color="#3366ff" face="tahoma, sans-serif"><br>
</font></div>
<div style=""><font color="#3366ff" face="tahoma, sans-serif">It
returns Entity as a pid().</font></div>
<div style=""><font color="#3366ff" face="tahoma, sans-serif"><br>
</font></div>
<div style=""><font color="#3366ff" face="tahoma, sans-serif">I
understand that the callback functions cannot be used to
allow or disallow execution of functions called from
compiled code, but only functions called from expressions
entered at the shell prompt.</font></div>
<div style=""><font color="#3366ff" face="tahoma, sans-serif"><br>
</font></div>
<div style=""><font color="#3366ff" face="tahoma, sans-serif">I
would like to confirm that rpc:call/4 does not enter the
call into the remote shell, but doing some stuffs to run the
call directly.<br>
</font></div>
</div>
</blockquote>
<br>
<font color="#3366ff"><font face="tahoma, sans-serif">You are
correct, rpc:call has nothing to do with the shell. Rpc calls an
already started server (rex) on the node and asks it to apply
the module, function and parameters and send the result back
(basiacally). That never passes any shell or interpreter.<br>
<br>
</font></font>
<blockquote
cite="mid:CAB3emm1pxs34+NDaQywS=GSTLQ8e8=6UsaVgc7gtmg9K+FJ9AQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div style=""><font color="#3366ff" face="tahoma, sans-serif">
</font><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
Cheers,<br>
/Patrik<br>
</body>
</html>