<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/083716029d8d303b29e49340afec64e0"
  from="Josh Burdick &lt;jburdick@g...&gt;"
  author="Josh Burdick"
  date="2003-12-08T05:12:28"
  subject="[Caml-list] language-based permissions?"
  prev="2003/12/aea7690c5ae1dc3cf7f1ac93954dd44f"
  next="2003/12/1105bab9c10b9c01731f4c1bab489e1a"
  next-in-thread="2003/12/1105bab9c10b9c01731f4c1bab489e1a"
  prev-thread="2003/12/9858c49f93267380e2253b15dcb61404"
  next-thread="2003/12/03fba8ae19894a59d47993bc1f31be69"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] language-based permissions?">
<msg 
  url="2003/12/083716029d8d303b29e49340afec64e0"
  from="Josh Burdick &lt;jburdick@g...&gt;"
  author="Josh Burdick"
  date="2003-12-08T05:12:28"
  subject="[Caml-list] language-based permissions?">
<msg 
  url="2003/12/1105bab9c10b9c01731f4c1bab489e1a"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-12-08T05:39:10"
  subject="Re: [Caml-list] language-based permissions?">
</msg>
</msg>
</thread>

<contents>
    I noticed that as of OCaml 3.05, there was a new option, 
"-nostdlib".  It seems superficially like with this, and the 
"-nopervasives" option, you could do language-based security (as in the 
MMM web browser of yore, Java, and Perl's Safe module, among many others.)
    In the attached three files, it seems like "foo.ml" should only be 
allowed to see, and use, the primitives in "fileworld.ml" (which aren't 
much; this is a toy example.)  If "foo.ml" tries to use anything else 
(as in the commented-out "print_string" line), it gets "Unbound value" 
errors in compiling, and can't.
    My question: could "foo.ml" call other primitives somehow, even 
though they're not linked in?  Using the preprocessor, or "external" 
functions", maybe?  (Assuming that you don't use the  "-unsafe" option, 
of course...)

    Thanks,
    Josh Burdick
    jburdick@gradient.cis.upenn.edu

==&gt; fileworld.ml &lt;==
open Pervasives
 
let (+) = (+)
let print_int = print_int
 
==&gt; foo.ml &lt;==
open Fileworld
 
let _ =
(*  print_string "test\n" *)
  print_int (2+2)
 
==&gt; makescript.sh &lt;==
#!/bin/bash
 
ocamlc -c fileworld.ml
 
# now, this should only allow primitives in fileworld.ml to be used...
ocamlc -c -nopervasives -nostdlib foo.ml
 
# to build the final object, need to allow Pervasives to be linked in
ocamlc fileworld.cmo foo.cmo


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

