Finished and deployed CORBA sandbox separation
[captive.git] / src / libcaptive / sandbox / parent-Vfs.c
diff --git a/src/libcaptive/sandbox/parent-Vfs.c b/src/libcaptive/sandbox/parent-Vfs.c
new file mode 100644 (file)
index 0000000..304a423
--- /dev/null
@@ -0,0 +1,72 @@
+/* $Id$
+ * CORBA/ORBit server side of Vfs object of sandbox_parent()
+ * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/parent-Vfs.h"        /* self */
+#include <glib/gmessages.h>
+#include "split.h"
+#include "../client/vfs.h"
+#include "sandbox.h"
+#include <unistd.h>
+
+
+GnomeVFSResult captive_sandbox_parent_vfs_new(CaptiveVfsObject *captive_vfs_object)
+{
+gboolean errbool;
+
+       g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+       captive_vfs_object->is_sandbox_parent=TRUE;
+
+       errbool=captive_sandbox_spawn(
+                       captive_vfs_object,     /* child_captive_vfs_object */
+                       &captive_vfs_object->corba_Vfs_object,  /* corba_Vfs_object_return */
+                       &captive_vfs_object->corba_GlibLogFunc_object,  /* corba_GlibLogFunc_object_return */
+                       &captive_vfs_object->corba_parentheart_fds_1);  /* parentheart_fds_1_return */
+       g_return_val_if_fail(errbool==TRUE,GNOME_VFS_ERROR_GENERIC);
+
+       return GNOME_VFS_OK;
+}
+
+
+gboolean corba_shutdown(CORBA_Environment *evp,CORBA_ORB *orbp,PortableServer_POA *poap);
+
+GnomeVFSResult captive_sandbox_parent_vfs_close(CaptiveVfsObject *captive_vfs_object)
+{
+GnomeVFSResult r;
+int errint;
+
+       g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+       Captive_Vfs_shutdown(captive_vfs_object->corba_Vfs_object,&captive_corba_ev);
+       r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
+
+       CORBA_Object_release(captive_vfs_object->corba_Vfs_object,&captive_corba_ev);
+       g_assert(validate_CORBA_Environment(&captive_corba_ev));
+
+       /* Shutdown 'GlibLogFunc' servant */
+       CORBA_Object_release(captive_vfs_object->corba_GlibLogFunc_object,&captive_corba_ev);
+       g_assert(validate_CORBA_Environment(&captive_corba_ev));
+
+       errint=close(captive_vfs_object->corba_parentheart_fds_1);      /* close parentheart_fd_write */
+       g_return_val_if_fail(errint==0,FALSE);
+
+       return r;
+}