Finished and deployed CORBA sandbox separation
[captive.git] / src / libcaptive / client / vfs.c
index bb3cd97..e31ce55 100644 (file)
@@ -23,8 +23,9 @@
 #include "vfs.h"       /* self-priv */
 #include <glib/gmessages.h>
 #include "captive/macros.h"
-#include "captive/sandbox.h"
 #include "init.h"
+#include "captive/parent-Vfs.h"
+#include "../sandbox/server-Vfs.h"     /* for captive_corba_child_options */
 
 
 static gpointer captive_vfs_object_parent_class=NULL;
@@ -34,12 +35,9 @@ static GnomeVFSResult captive_vfs_close(CaptiveVfsObject *captive_vfs_object);
 
 static void captive_vfs_object_finalize(CaptiveVfsObject *captive_vfs_object)
 {
-GnomeVFSResult errvfsresult;
-
        g_return_if_fail(captive_vfs_object!=NULL);
 
-       errvfsresult=captive_vfs_close(captive_vfs_object);
-       g_assert(errvfsresult==GNOME_VFS_OK);
+       captive_vfs_close(captive_vfs_object);  /* errors ignored */
 
        G_OBJECT_CLASS(captive_vfs_object_parent_class)->finalize((GObject *)captive_vfs_object);
 }
@@ -102,13 +100,18 @@ gboolean errbool;
 
        captive_options_copy(&captive_vfs_object->options,options);
 
+       *captive_vfs_object_return=captive_vfs_object;
+
+       /* We are sandboxing && we are the master */
+       if (options->sandbox && !captive_corba_child_options)
+               return captive_sandbox_parent_vfs_new(captive_vfs_object);
+
        g_assert(captive_options==NULL);
        captive_options=&captive_vfs_object->options;
 
        errbool=captive_init();
        g_assert(errbool==TRUE);
 
-       *captive_vfs_object_return=captive_vfs_object;
        return GNOME_VFS_OK;
 }
 
@@ -117,11 +120,11 @@ static GnomeVFSResult captive_vfs_close(CaptiveVfsObject *captive_vfs_object)
 {
 gboolean errbool;
 
-       if (CAPTIVE_IS_SANDBOX_PARENT())
-               return captive_sandbox_parent_vfs_close(captive_vfs_object);
-
        g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
 
+       if (captive_vfs_object->is_sandbox_parent)
+               return captive_sandbox_parent_vfs_close(captive_vfs_object);
+
        g_assert(captive_options==&captive_vfs_object->options);
        errbool=captive_shutdown();
        g_assert(errbool==TRUE);