guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [guile-user] Sandboxing?


From: Kyle Cronan
Subject: Re: [guile-user] Sandboxing?
Date: Mon, 19 Mar 2001 17:23:59 +0000 (/etc/localtime)

On Mon, 19 Mar 2001, Keisuke Nishida wrote:

> I guess `eval' does what you want:
> 
>   (use-modules (ice-9 safe))
> 
>   (eval '(+ 1 2) (safe-environment 5)) => 3
> 
>   (eval '(gc) (safe-environment 5))    ;; ERROR
> 

Ok, I decided to use this approach.  I have some C code that takes some
scheme code from a cgi and calls gh_eval_str on something like this:

(eval '(begin <formcode>) (safe-environment 5))

My problem is the procedures I have defined with gh_new_procedure are
unbound in this environment.  Ideally, it would be nice to have a way to
evaluate everything passed to gh_eval_str within a safe environment.  Or
is there some way I can get the C procedures available to the eval
statement above?

Kyle
<address@hidden>

> You could write your own repl if you want:
> 
>   (use-modules (ice-9 safe))
>   (define safe-module (make-safe-module))
> 
>   (define (safe-repl)
>     (display "safe> ")
>     (write (eval (read) safe-module))
>     (newline)
>     (safe-repl))
> 
>   (safe-repl)
>   safe> (+ 1 2)
>   3
>   safe> (gc)
>   ERROR
> 
> If you have any trouble with error handling or such,
> I think you can feel free to ask it here.
> 
> Kei
> 
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/guile-user
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]