[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [guile-user] Sandboxing?
From: |
Martin Grabmueller |
Subject: |
Re: [guile-user] Sandboxing? |
Date: |
Wed, 21 Mar 2001 08:06:55 +0100 |
> From: Keisuke Nishida <address@hidden>
> Date: Tue, 20 Mar 2001 17:13:36 -0500
>
> At Mon, 19 Mar 2001 17:23:59 +0000 (/etc/localtime),
> Kyle Cronan wrote:
> >
> > 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?
>
> Hmm, you could import your procedures into the safe environment:
>
> (define custom-environment (safe-environment 5))
>
> (module-define! custom-environment 'hello (lambda () "Hello"))
>
> (eval '(hello) custom-environment) => "Hello"
>
> Or you could define your custom module:
>
> ---- custom-environment.scm ----------
> (define-module (custom-environment)
> :pure
> :use-module (ice-9 safe-r5rs))
>
> (define (hello) "Hello")
> --------------------------------------
>
> Then
>
> (eval '(hello) (resolve-module '(custom-environment))) => "Hello"
>
> I don't know how to do this using the GH interface, sorry.
Rob Browning (IIRC) has posted some C code a while ago, which defines
variables in a specified module, but I don't know if it will help you
in your case. You should search the archives (at the end last year)
for Rob's Articles.
Regards,
'martin
- [guile-user] Sandboxing?, Bobby D. Bryant, 2001/03/12
- Re: [guile-user] Sandboxing?, Kyle Cronan, 2001/03/19
- Re: [guile-user] Sandboxing?, Keisuke Nishida, 2001/03/19
- Re: [guile-user] Sandboxing?, Kyle Cronan, 2001/03/19
- Re: [guile-user] Sandboxing?, Keisuke Nishida, 2001/03/20
- Re: [guile-user] Sandboxing?, Kyle Cronan, 2001/03/20
- Re: [guile-user] Sandboxing?, Keisuke Nishida, 2001/03/20
- Re: [guile-user] Sandboxing?, Martin Grabmueller, 2001/03/21
- Re: [guile-user] Sandboxing?,
Martin Grabmueller <=