NEWS for captive-0.9
--------------------
+* Multifilesystem capability by new CaptiveVfsObject
+* Finished and deployed CORBA sandbox separation
NEWS for captive-0.8 (2003-05-02)
TODO
----
-* Finish src/libcaptive/sandbox/ CORBA interface
- * Implement backward GIOChannel CORBA interface
-* reentrancy of captive_init() to return non-static GObject captive_vfs
+* Implement backward GIOChannel CORBA interface
#include <glib/gerror.h>
#include <popt.h>
#include <stdlib.h>
+#include <glib-object.h>
#include "cmd_quit.h" /* self */
+#include "main.h"
GQuark cmdline_cmd_quit_error_quark(void)
{
g_return_if_fail(!errp || !*errp);
- exit(EXIT_SUCCESS);
+ main_exit();
}
return FALSE;
}
+static GIOChannel *main_giochannel;
+
+void main_exit(void)
+{
+ if (cmdline_captive_vfs_object) {
+ g_object_unref(cmdline_captive_vfs_object);
+ cmdline_captive_vfs_object=NULL;
+ }
+ if (main_giochannel) {
+ g_io_channel_unref(main_giochannel);
+ main_giochannel=NULL;
+ }
+ exit(EXIT_SUCCESS);
+}
+
int main(int argc,char **argv)
{
poptContext context;
void invoke_cmd(int cmd_argc,const char **cmd_argv);
void err_cleanup(GError **errp);
gboolean errvfsresult_to_gerr(GError **errp,GnomeVFSResult errvfsresult);
+void main_exit(void);
#endif /* _CAPTIVE_CLIENT_CMDLINE_MAIN_H */
#include "reactos/ntos/types.h" /* for HANDLE */
#include "reactos/ddk/iotypes.h" /* for IO_STATUS_BLOCK */
#include "reactos/ddk/iofuncs.h" /* for IoCreateFile() */
-#include "captive/sandbox.h"
#include "result.h"
#include "captive/leave.h"
#include "captive/usecount.h"
+#include "vfs.h"
+#include "captive/parent-Directory.h"
static gpointer captive_directory_object_parent_class=NULL;
static void captive_directory_object_finalize(CaptiveDirectoryObject *captive_directory_object)
{
-GnomeVFSResult errvfsresult;
-
g_return_if_fail(captive_directory_object!=NULL);
- errvfsresult=captive_directory_close(captive_directory_object);
- g_assert(errvfsresult==GNOME_VFS_OK);
+ captive_directory_close(captive_directory_object); /* errors ignored */
G_OBJECT_CLASS(captive_directory_object_parent_class)->finalize((GObject *)captive_directory_object);
}
}
-static GnomeVFSResult captive_directory_new_internal(CaptiveDirectoryObject **captive_directory_object_return,
- CaptiveVfsObject *captive_vfs_object,const gchar *pathname,gboolean create,guint create_perm)
+static GnomeVFSResult captive_directory_new_internal
+ (CaptiveDirectoryObject *captive_directory_object,const gchar *pathname,gboolean create,guint create_perm)
{
GnomeVFSResult errvfsresult;
OBJECT_ATTRIBUTES dir_ObjectAttributes;
HANDLE dir_Handle;
IO_STATUS_BLOCK dir_IoStatusBlock;
NTSTATUS err;
-CaptiveDirectoryObject *captive_directory_object;
- g_return_val_if_fail(captive_directory_object_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- *captive_directory_object_return=NULL;
-
errvfsresult=captive_ObjectAttributes_init(pathname,&dir_ObjectAttributes);
g_return_val_if_fail(errvfsresult==GNOME_VFS_OK,errvfsresult);
==(!create ? FILE_OPENED : FILE_CREATED),
GNOME_VFS_ERROR_GENERIC);
- captive_directory_object=g_object_new(
- CAPTIVE_DIRECTORY_TYPE_OBJECT, /* object_type */
- NULL); /* first_property_name; FIXME: support properties */
-
- captive_directory_object->vfs=captive_vfs_object;
captive_directory_object->dir_Handle=dir_Handle;
- *captive_directory_object_return=captive_directory_object;
return GNOME_VFS_OK;
}
CaptiveVfsObject *captive_vfs_object,const gchar *pathname)
{
GnomeVFSResult r;
-
- if (CAPTIVE_IS_SANDBOX_PARENT())
- return captive_sandbox_parent_directory_new_open(captive_directory_object_return,pathname);
+CaptiveDirectoryObject *captive_directory_object;
g_return_val_if_fail(captive_directory_object_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- r=captive_directory_new_internal(captive_directory_object_return,captive_vfs_object,pathname,
+ captive_directory_object=g_object_new(
+ CAPTIVE_DIRECTORY_TYPE_OBJECT, /* object_type */
+ NULL); /* first_property_name; FIXME: support properties */
+ captive_directory_object->dir_Handle=NULL;
+ captive_directory_object->vfs=captive_vfs_object;
+ *captive_directory_object_return=captive_directory_object;
+
+ if (captive_vfs_object->is_sandbox_parent)
+ return captive_sandbox_parent_directory_new_open(captive_directory_object,pathname);
+
+ r=captive_directory_new_internal(captive_directory_object,pathname,
FALSE, /* create */
0); /* create_perm; ignored */
captive_leave();
if (r==GNOME_VFS_OK)
captive_usecount(+1);
+ else
+ g_object_unref(captive_directory_object);
return r;
}
CaptiveVfsObject *captive_vfs_object,const gchar *pathname,guint perm)
{
GnomeVFSResult r;
+CaptiveDirectoryObject *captive_directory_object;
g_return_val_if_fail(captive_directory_object_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- r=captive_directory_new_internal(captive_directory_object_return,captive_vfs_object,pathname,
+ captive_directory_object=g_object_new(
+ CAPTIVE_DIRECTORY_TYPE_OBJECT, /* object_type */
+ NULL); /* first_property_name; FIXME: support properties */
+ captive_directory_object->dir_Handle=NULL;
+ captive_directory_object->vfs=captive_vfs_object;
+ *captive_directory_object_return=captive_directory_object;
+
+ if (captive_vfs_object->is_sandbox_parent)
+ return captive_sandbox_parent_directory_new_make(captive_directory_object,pathname,perm);
+
+ r=captive_directory_new_internal(captive_directory_object,pathname,
TRUE, /* create */
perm); /* create_perm; ignored */
captive_leave();
if (r==GNOME_VFS_OK)
captive_usecount(+1);
+ else
+ g_object_unref(captive_directory_object);
return r;
}
NTSTATUS err;
HANDLE dir_Handle;
- if (CAPTIVE_IS_SANDBOX_PARENT())
- return captive_sandbox_parent_directory_close(captive_directory_object);
-
g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_directory_object->dir_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS); /* already closed */
- captive_usecount(-1); /* close() errors notwithstanding */
+ if (captive_directory_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_directory_close(captive_directory_object);
- dir_Handle=captive_directory_object->dir_Handle;
- captive_directory_object->dir_Handle=NULL;
- err=NtClose(dir_Handle);
- g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
+ if (captive_directory_object->dir_Handle!=NULL) { /* not yet already closed */
+ captive_usecount(-1); /* close() errors notwithstanding */
+
+ dir_Handle=captive_directory_object->dir_Handle;
+ captive_directory_object->dir_Handle=NULL;
+ err=NtClose(dir_Handle);
+ g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
+ }
captive_leave();
return GNOME_VFS_OK;
FILE_BOTH_DIR_INFORMATION *FileBothDirInformation;
GnomeVFSResult errvfsresult;
- if (CAPTIVE_IS_SANDBOX_PARENT())
+ g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ if (captive_directory_object->vfs->is_sandbox_parent)
return captive_sandbox_parent_directory_read(captive_directory_object,file_info);
- g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(captive_directory_object->dir_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
FileIdBothDirInformation=(void *)captive_directory_object->QueryDirectory_buf.FileIdBothDirInformation;
retry:
GnomeVFSResult errvfsresult;
g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ if (captive_directory_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_directory_remove(captive_directory_object);
+
g_return_val_if_fail(captive_directory_object->dir_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
FileDispositionInformation_struct.DoDeleteFile=TRUE;
#include "reactos/napi/types.h" /* for NTSTATUS */
#include "reactos/ntos/zwtypes.h" /* for FILE_ID_BOTH_DIR_INFORMATION */
#include "captive/client-vfs.h"
+#include "../sandbox/sandbox.h"
G_BEGIN_DECLS
/*< private >*/
CaptiveVfsObject *vfs;
+ Captive_Directory corba_Directory_object;
HANDLE dir_Handle;
gboolean read_first;
/* 'QueryDirectory_buf' for NtQueryDirectoryFile() must be persistent
#include "reactos/ntos/types.h" /* for HANDLE */
#include "reactos/ddk/iotypes.h" /* for IO_STATUS_BLOCK */
#include "reactos/ddk/iofuncs.h" /* for IoCreateFile() */
-#include "captive/sandbox.h"
#include "result.h"
#include "captive/client-directory.h"
#include "reactos/ddk/obfuncs.h" /* for ObReferenceObjectByHandle() */
#include "captive/macros.h"
#include "captive/leave.h"
#include "captive/usecount.h"
+#include "vfs.h"
+#include "captive/parent-File.h"
static gpointer captive_file_object_parent_class=NULL;
static void captive_file_object_finalize(CaptiveFileObject *captive_file_object)
{
-GnomeVFSResult errvfsresult;
-
g_return_if_fail(captive_file_object!=NULL);
- errvfsresult=captive_file_close(captive_file_object);
- g_assert(errvfsresult==GNOME_VFS_OK);
+ captive_file_close(captive_file_object); /* errors ignored */
G_OBJECT_CLASS(captive_file_object_parent_class)->finalize((GObject *)captive_file_object);
}
}
-static GnomeVFSResult captive_file_new_internal(CaptiveFileObject **captive_file_object_return,
- CaptiveVfsObject *captive_vfs_object,
+static GnomeVFSResult captive_file_new_internal(CaptiveFileObject *captive_file_object,
const gchar *pathname,GnomeVFSOpenMode mode,gboolean create,gboolean create_exclusive,guint create_perm)
{
IO_STATUS_BLOCK file_IoStatusBlock;
GnomeVFSResult errvfsresult;
OBJECT_ATTRIBUTES file_ObjectAttributes;
HANDLE file_Handle;
-CaptiveFileObject *captive_file_object;
NTSTATUS err;
- if (CAPTIVE_IS_SANDBOX_PARENT())
- return captive_sandbox_parent_file_new_open(captive_file_object_return,pathname,mode);
-
- g_return_val_if_fail(captive_file_object_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- *captive_file_object_return=NULL;
-
errvfsresult=captive_ObjectAttributes_init(pathname,&file_ObjectAttributes);
g_return_val_if_fail(errvfsresult==GNOME_VFS_OK,errvfsresult);
==(!create ? FILE_OPENED : FILE_CREATED),
GNOME_VFS_ERROR_GENERIC);
- captive_file_object=g_object_new(
- CAPTIVE_FILE_TYPE_OBJECT, /* object_type */
- NULL); /* first_property_name; FIXME: support properties */
-
- captive_file_object->vfs=captive_vfs_object;
captive_file_object->file_Handle=file_Handle;
- captive_file_object->offset=0;
- *captive_file_object_return=captive_file_object;
return GNOME_VFS_OK;
}
CaptiveVfsObject *captive_vfs_object,const gchar *pathname,GnomeVFSOpenMode mode)
{
GnomeVFSResult r;
+CaptiveFileObject *captive_file_object;
g_return_val_if_fail(captive_file_object_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- r=captive_file_new_internal(captive_file_object_return,captive_vfs_object,pathname,mode,
+ captive_file_object=g_object_new(
+ CAPTIVE_FILE_TYPE_OBJECT, /* object_type */
+ NULL); /* first_property_name; FIXME: support properties */
+ captive_file_object->vfs=captive_vfs_object;
+ captive_file_object->file_Handle=NULL;
+ captive_file_object->offset=0;
+ *captive_file_object_return=captive_file_object;
+
+ if (captive_vfs_object->is_sandbox_parent)
+ return captive_sandbox_parent_file_new_open(captive_file_object,pathname,mode);
+
+ r=captive_file_new_internal(captive_file_object,pathname,mode,
FALSE, /* create */
FALSE, /* create_exclusive; ignored */
0); /* create_perm; ignored */
captive_leave();
if (r==GNOME_VFS_OK)
captive_usecount(+1);
+ else
+ g_object_unref(captive_file_object);
return r;
}
CaptiveVfsObject *captive_vfs_object,const gchar *pathname,GnomeVFSOpenMode mode,gboolean exclusive,guint perm)
{
GnomeVFSResult r;
+CaptiveFileObject *captive_file_object;
g_return_val_if_fail(captive_file_object_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(captive_vfs_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- r=captive_file_new_internal(captive_file_object_return,captive_vfs_object,pathname,mode,
+ captive_file_object=g_object_new(
+ CAPTIVE_FILE_TYPE_OBJECT, /* object_type */
+ NULL); /* first_property_name; FIXME: support properties */
+ captive_file_object->vfs=captive_vfs_object;
+ captive_file_object->file_Handle=NULL;
+ captive_file_object->offset=0;
+ *captive_file_object_return=captive_file_object;
+
+ if (captive_vfs_object->is_sandbox_parent)
+ return captive_sandbox_parent_file_new_create(captive_file_object,pathname,mode,exclusive,perm);
+
+ r=captive_file_new_internal(captive_file_object,pathname,mode,
TRUE, /* create */
exclusive, /* create_exclusive */
perm); /* create_perm */
captive_leave();
if (r==GNOME_VFS_OK)
captive_usecount(+1);
+ else
+ g_object_unref(captive_file_object);
return r;
}
NTSTATUS err;
HANDLE file_Handle;
- if (CAPTIVE_IS_SANDBOX_PARENT())
- return captive_sandbox_parent_file_close(captive_file_object);
-
g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS); /* already closed */
- captive_usecount(-1); /* close() errors notwithstanding */
+ if (captive_file_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_file_close(captive_file_object);
- file_Handle=captive_file_object->file_Handle;
- captive_file_object->file_Handle=NULL;
- err=NtClose(file_Handle);
- g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
+ if (captive_file_object->file_Handle!=NULL) { /* not yet already closed */
+ captive_usecount(-1); /* close() errors notwithstanding */
+
+ file_Handle=captive_file_object->file_Handle;
+ captive_file_object->file_Handle=NULL;
+ err=NtClose(file_Handle);
+ g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
+ }
captive_leave();
return GNOME_VFS_OK;
LARGE_INTEGER file_offset;
GnomeVFSResult errvfsresult;
- if (CAPTIVE_IS_SANDBOX_PARENT())
- return captive_sandbox_parent_file_read(captive_file_object,buffer,num_bytes,bytes_read_return);
-
g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(buffer!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(bytes_read_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(num_bytes==(ULONG)num_bytes,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ if (captive_file_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_file_read(captive_file_object,buffer,num_bytes,bytes_read_return);
+
+ g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
file_offset.QuadPart=captive_file_object->offset;
err=NtReadFile(
captive_file_object->file_Handle, /* FileHandle */
GnomeVFSFileSize endoffile_wanted;
GnomeVFSResult errvfsresult;
- if (CAPTIVE_IS_SANDBOX_PARENT())
- return captive_sandbox_parent_file_write(captive_file_object,buffer,num_bytes,bytes_written_return);
-
g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(buffer!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(bytes_written_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(num_bytes==(ULONG)num_bytes,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ if (captive_file_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_file_write(captive_file_object,buffer,num_bytes,bytes_written_return);
+
+ g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
if ((GnomeVFSFileOffset)(captive_file_object->offset+num_bytes) < captive_file_object->offset)
return GNOME_VFS_ERROR_TOO_BIG;
endoffile_wanted=captive_file_object->offset+num_bytes;
GnomeVFSResult captive_file_seek
(CaptiveFileObject *captive_file_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset)
{
- if (CAPTIVE_IS_SANDBOX_PARENT())
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ if (captive_file_object->vfs->is_sandbox_parent)
return captive_sandbox_parent_file_seek(captive_file_object,whence,offset);
- g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
switch (whence) {
GnomeVFSResult captive_file_tell(CaptiveFileObject *captive_file_object,GnomeVFSFileOffset *offset_return)
{
- if (CAPTIVE_IS_SANDBOX_PARENT())
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(offset_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ if (captive_file_object->vfs->is_sandbox_parent)
return captive_sandbox_parent_file_tell(captive_file_object,offset_return);
- g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(offset_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
*offset_return=captive_file_object->offset;
captive_leave();
GnomeVFSResult errvfsresult;
g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ if (captive_file_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_file_remove(captive_file_object);
+
g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
FileDispositionInformation_struct.DoDeleteFile=TRUE;
+0x1000 /* max 'FileName' length, 255 should be enough */ * sizeof(WCHAR /* *FILE_ALL_INFORMATION.NameInformation.FileName */ )];
g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ if (captive_file_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_file_file_info_get(captive_file_object,file_info);
+
+ g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
/* ntfs.sys of NT-5.1sp1 has *(FILE_BASIC_INFORMATION *)FILE_ALL_INFORMATION.BasicInformation
* size 0x28 although reactos includes and all the information says 0x24.
* fastfat.sys of NT-5.1sp1 also has the 'official' sizeof 0x24.
const GnomeVFSFileInfo *info,GnomeVFSSetFileInfoMask mask)
{
g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(info!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ if (captive_file_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_file_file_info_set(captive_file_object,info,mask);
+
+ g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
if (mask & GNOME_VFS_SET_FILE_INFO_NAME) {
gchar *name_dirname,*name_basename;
UNICODE_STRING *name_UnicodeString;
GnomeVFSResult errvfsresult;
g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ if (captive_file_object->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_file_truncate(captive_file_object,file_size);
+
g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
FileEndOfFileInformation_struct.EndOfFile.QuadPart=file_size;
OBJECT_ATTRIBUTES pathname_new_ObjectAttributes;
g_return_val_if_fail(captive_file_object_old!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_file_object_old->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
g_return_val_if_fail(pathname_new!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ if (captive_file_object_old->vfs->is_sandbox_parent)
+ return captive_sandbox_parent_file_move(captive_file_object_old,pathname_new,force_replace);
+
+ g_return_val_if_fail(captive_file_object_old->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
errvfsresult=captive_ObjectAttributes_init(pathname_new,&pathname_new_ObjectAttributes);
g_return_val_if_fail(errvfsresult==GNOME_VFS_OK,errvfsresult);
#include <glib/gtypes.h>
#include "reactos/napi/types.h" /* for NTSTATUS */
#include "captive/client-vfs.h"
+#include "../sandbox/sandbox.h"
G_BEGIN_DECLS
/*< private >*/
CaptiveVfsObject *vfs;
+ Captive_File corba_File_object;
HANDLE file_Handle;
GnomeVFSFileOffset offset;
};
#include <popt.h>
#include <glib/gstrfuncs.h>
#include <glib/glist.h>
-#include <glib/gutils.h> /* for g_atexit() */
#include "giochannel-blind.h"
#include <glib-object.h>
#include "reactos/internal/se.h" /* for SeInit2() */
static TOP_LEVEL_IRP TopLevelIrp; /* TODO:thread */
-/* Non-blinded original GIOChannel for flushing during shutdown. */
-static GIOChannel *captive_options_image_iochannel_orig;
-
-
void *_local_unwind2_addr;
g_return_val_if_fail(captive_options!=NULL,FALSE);
g_return_val_if_fail(captive_options->filesystem!=NULL,FALSE);
- erriostatus=g_io_channel_set_encoding(captive_options->image_iochannel,
+ erriostatus=g_io_channel_set_encoding(captive_image_iochannel,
NULL, /* encoding; force binary data */
NULL); /* error */
g_assert(erriostatus==G_IO_STATUS_NORMAL);
/* captive_giochannel_size() only _after_ g_io_channel_set_encoding() ! */
- captive_image_size=captive_giochannel_size(captive_options->image_iochannel);
+ captive_image_size=captive_giochannel_size(captive_image_iochannel);
g_return_val_if_fail(captive_image_size>0,FALSE);
/* Part of reactos/ntoskrnl/ke/main.c/KiSystemStartup() begins. */
}
-static void captive_shutdown_atexit(void);
-
-
static void log_discard_func(const gchar *log_domain,GLogLevelFlags log_level,const gchar *message,gpointer user_data)
{
/* NOP */
0 /* log_levels */
| G_LOG_FLAG_RECURSION
| G_LOG_FLAG_FATAL
+ /* The same mask is in libcaptive/sandbox/server-GlibLogFunc.c ! */
| G_LOG_LEVEL_MESSAGE
| G_LOG_LEVEL_INFO
| G_LOG_LEVEL_DEBUG,
NULL); /* user_data */
}
- captive_options_image_iochannel_orig=captive_options->image_iochannel;
if (captive_options->rwmode==CAPTIVE_OPTION_RWMODE_BLIND)
- captive_options->image_iochannel=(GIOChannel *)captive_giochannel_blind_new(captive_options->image_iochannel);
+ captive_image_iochannel=(GIOChannel *)captive_giochannel_blind_new(captive_options->image_iochannel);
+ else
+ captive_image_iochannel=captive_options->image_iochannel;
/* Do not initialize 'captive_image_size' by captive_giochannel_size() here
* as we yet need to do g_io_channel_set_encoding().
errbool=captive_w32_init();
g_return_val_if_fail(errbool==TRUE,FALSE);
- g_atexit(captive_shutdown_atexit);
-
active=TRUE;
return TRUE;
}
* captive_shutdown:
*
* Closes down %libcaptive. It should flush all pending buffers and successfuly
- * close the filesystem. Variable #captive_options->image_iochannel will be set to %NULL,
+ * close the filesystem. Variable #captive_options->image_iochannel will not be set to %NULL,
* you should close such channel yourself.
*
* Returns: %TRUE if successfuly shutdown.
GIOStatus erriostatus;
g_return_val_if_fail(active==TRUE,FALSE);
+ g_return_val_if_fail(captive_image_iochannel!=NULL,FALSE);
g_return_val_if_fail(captive_options->image_iochannel!=NULL,FALSE);
/* Invoke all pending idle functions just to not to forget for anything... */
/* libcaptive is not authorized to shutdown 'captive_image_channel'. */
erriostatus=g_io_channel_flush(
- captive_options->image_iochannel, /* channel */
+ captive_image_iochannel, /* channel */
NULL); /* error */
g_assert(erriostatus==G_IO_STATUS_NORMAL);
- /* 'captive_options->image_iochannel' may be blinded wrapper. */
- if (captive_options->image_iochannel!=captive_options_image_iochannel_orig) {
+ /* 'captive_image_iochannel' may be blinded wrapper of 'captive_options->image_iochannel'. */
+ if (captive_image_iochannel!=captive_options->image_iochannel) {
erriostatus=g_io_channel_flush(
- captive_options_image_iochannel_orig, /* channel */
+ captive_options->image_iochannel, /* channel */
NULL); /* error */
g_assert(erriostatus==G_IO_STATUS_NORMAL);
+ g_io_channel_unref(captive_image_iochannel);
}
- captive_options->image_iochannel=NULL;
+ captive_image_iochannel=NULL;
active=FALSE;
return TRUE;
}
-
-
-static void captive_shutdown_atexit(void)
-{
- if (active)
- captive_shutdown();
-}
options->media=CAPTIVE_OPTION_MEDIA_DISK;
options->debug_messages=FALSE;
options->load_module=NULL;
+ options->sandbox=TRUE;
}
captive_options->debug_messages=TRUE;
}
+static void arg_no_sandbox(void)
+{
+ captive_options->sandbox=FALSE;
+}
+
static void captive_popt_callback
(poptContext con,enum poptCallbackReason reason,const struct poptOption *opt,const char *arg,const void *data);
CAPTIVE_POPT_NONE( "cdrom" ,N_("Media type: CD-ROM")),
CAPTIVE_POPT_NONE( "disk" ,N_("Media type: Disk (default)")),
CAPTIVE_POPT_NONE( "debug-messages",N_("Turn on debugging messages")),
+ CAPTIVE_POPT_NONE( "no-sandbox" ,N_("Turn off sandboxing feature (default on)")),
#undef CAPTIVE_POPT_NONE
#undef CAPTIVE_POPT_STRING
arg_cdrom,
arg_disk,
arg_debug_messages,
+ arg_no_sandbox,
};
#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;
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);
}
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;
}
{
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);
#include <glib/gmacros.h>
#include <glib/gtypes.h>
+#include <glib-object.h>
+#include "../sandbox/sandbox.h"
G_BEGIN_DECLS
/*< private >*/
struct captive_options options;
+
+ gboolean is_sandbox_parent;
+ Captive_Vfs corba_Vfs_object;
+ Captive_GlibLogFunc corba_GlibLogFunc_object;
+ int corba_parentheart_fds_1;
};
struct _CaptiveVfsObjectClass {
GObjectClass parent_class;
macros.h \
mm.h \
options.h \
+ parent-Directory.h \
+ parent-File.h \
+ parent-Vfs.h \
ps_reactos.h \
rtl-file.h \
- sandbox.h \
signal.h \
storage.h \
unicode.h \
gboolean debug_messages;
GIOChannel *image_iochannel;
GList *load_module; /* of 'gchar *' */
+ gboolean sandbox;
};
/**
--- /dev/null
+/* $Id$
+ * Include file for CORBA/ORBit server side of Directory 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
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_PARENT_DIRECTORY_H
+#define _CAPTIVE_CLIENT_PARENT_DIRECTORY_H 1
+
+
+#include <glib/gmacros.h>
+#include <glib-object.h>
+#include <libgnomevfs/gnome-vfs-result.h> /* for GnomeVFSResult */
+#include "captive/client-directory.h"
+
+
+G_BEGIN_DECLS
+
+GnomeVFSResult captive_sandbox_parent_directory_new_open
+ (CaptiveDirectoryObject *captive_directory_object,const gchar *pathname);
+GnomeVFSResult captive_sandbox_parent_directory_new_make
+ (CaptiveDirectoryObject *captive_directory_object,const gchar *pathname,guint perm);
+GnomeVFSResult captive_sandbox_parent_directory_close(CaptiveDirectoryObject *captive_directory_object);
+GnomeVFSResult captive_sandbox_parent_directory_read
+ (CaptiveDirectoryObject *captive_directory_object,GnomeVFSFileInfo *file_info_captive);
+GnomeVFSResult captive_sandbox_parent_directory_remove(CaptiveDirectoryObject *captive_directory_object);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_CLIENT_PARENT_DIRECTORY_H */
--- /dev/null
+/* $Id$
+ * Include file for CORBA/ORBit server side of File 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
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_PARENT_FILE_H
+#define _CAPTIVE_CLIENT_PARENT_FILE_H 1
+
+
+#include <glib/gmacros.h>
+#include <glib-object.h>
+#include <libgnomevfs/gnome-vfs-result.h> /* for GnomeVFSResult */
+#include "captive/client-file.h"
+
+
+G_BEGIN_DECLS
+
+GnomeVFSResult captive_sandbox_parent_file_new_open(CaptiveFileObject *captive_file_object,
+ const gchar *pathname,GnomeVFSOpenMode mode);
+GnomeVFSResult captive_sandbox_parent_file_new_create(CaptiveFileObject *captive_file_object,
+ const gchar *pathname,GnomeVFSOpenMode mode,gboolean exclusive,guint perm);
+GnomeVFSResult captive_sandbox_parent_file_close(CaptiveFileObject *captive_file_object);
+GnomeVFSResult captive_sandbox_parent_file_read(CaptiveFileObject *captive_file_object,
+ gpointer buffer,GnomeVFSFileSize num_bytes,GnomeVFSFileSize *bytes_read_return);
+GnomeVFSResult captive_sandbox_parent_file_write(CaptiveFileObject *captive_file_object,
+ gconstpointer buffer,GnomeVFSFileSize num_bytes,GnomeVFSFileSize *bytes_written_return);
+GnomeVFSResult captive_sandbox_parent_file_seek
+ (CaptiveFileObject *captive_file_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset);
+GnomeVFSResult captive_sandbox_parent_file_tell(CaptiveFileObject *captive_file_object,GnomeVFSFileOffset *offset_return);
+GnomeVFSResult captive_sandbox_parent_file_remove(CaptiveFileObject *captive_file_object);
+GnomeVFSResult captive_sandbox_parent_file_file_info_get(CaptiveFileObject *captive_file_object,
+ GnomeVFSFileInfo *file_info);
+GnomeVFSResult captive_sandbox_parent_file_file_info_set(CaptiveFileObject *captive_file_object,
+ const GnomeVFSFileInfo *info,GnomeVFSSetFileInfoMask mask);
+GnomeVFSResult captive_sandbox_parent_file_truncate(CaptiveFileObject *captive_file_object,GnomeVFSFileSize file_size);
+GnomeVFSResult captive_sandbox_parent_file_move
+ (CaptiveFileObject *captive_file_object_old,const gchar *pathname_new,gboolean force_replace);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_CLIENT_PARENT_FILE_H */
--- /dev/null
+/* $Id$
+ * Include file for 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
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_PARENT_VFS_H
+#define _CAPTIVE_CLIENT_PARENT_VFS_H 1
+
+
+#include <glib/gmacros.h>
+#include <glib-object.h>
+#include <libgnomevfs/gnome-vfs-result.h> /* for GnomeVFSResult */
+#include "captive/client-vfs.h"
+
+
+G_BEGIN_DECLS
+
+GnomeVFSResult captive_sandbox_parent_vfs_new(CaptiveVfsObject *captive_vfs_object);
+GnomeVFSResult captive_sandbox_parent_vfs_close(CaptiveVfsObject *captive_vfs_object);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_CLIENT_PARENT_VFS_H */
G_BEGIN_DECLS
/**
+ * captive_image_iochannel
+ *
+ * The readl #GIOChannel to be used for accessing the disk image.
+ * It may be either directly #captive_options->image_iochannel
+ * or the wrapper by #giochannel-blind.
+ */
+extern GIOChannel *captive_image_iochannel;
+
+
+/**
* captive_image_size:
*
* Size of #captive_image_iochannel. Empty files are rejected and therefore
--- /dev/null
+/* $Id$
+ * CORBA/ORBit server side of GnomeVFSFileInfo handling
+ * 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 "FileInfo.h" /* self */
+#include <glib/gmessages.h>
+
+
+GnomeVFSResult captive_sandbox_file_info_corba_to_captive
+ (GnomeVFSFileInfo *file_info_captive,const Captive_GnomeVFSFileInfo *file_info_corba)
+{
+ g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(file_info_corba!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ file_info_captive->valid_fields=0;
+ file_info_captive->name=g_strdup(file_info_corba->name);
+ if (file_info_corba->type_valid) {
+ file_info_captive->type=file_info_corba->type;
+ file_info_captive->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_TYPE;
+ }
+ if (file_info_corba->permissions_valid) {
+ file_info_captive->permissions=file_info_corba->permissions;
+ file_info_captive->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
+ }
+ if (file_info_corba->size_valid) {
+ file_info_captive->size=file_info_corba->size;
+ file_info_captive->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_SIZE;
+ }
+ if (file_info_corba->block_count_valid) {
+ file_info_captive->block_count=file_info_corba->block_count;
+ file_info_captive->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT;
+ }
+ if (file_info_corba->atime) {
+ file_info_captive->atime=file_info_corba->atime;
+ file_info_captive->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_ATIME;
+ }
+ if (file_info_corba->mtime) {
+ file_info_captive->mtime=file_info_corba->mtime;
+ file_info_captive->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_MTIME;
+ }
+ if (file_info_corba->ctime) {
+ file_info_captive->ctime=file_info_corba->ctime;
+ file_info_captive->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_CTIME;
+ }
+ if (file_info_corba->flags_valid) {
+ file_info_captive->flags=file_info_corba->flags;
+ file_info_captive->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_FLAGS;
+ }
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_file_info_captive_to_corba
+ (Captive_GnomeVFSFileInfo *file_info_corba,const GnomeVFSFileInfo *file_info_captive)
+{
+ g_return_val_if_fail(file_info_corba!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ file_info_corba->name=CORBA_string_dup(file_info_captive->name);
+ if ((file_info_corba->type_valid=!!(file_info_captive->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_TYPE)))
+ file_info_corba->type=file_info_captive->type;
+ if ((file_info_corba->permissions_valid=!!(file_info_captive->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS)))
+ file_info_corba->permissions=file_info_captive->permissions;
+ if ((file_info_corba->size_valid=!!(file_info_captive->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_SIZE)))
+ file_info_corba->size=file_info_captive->size;
+ if ((file_info_corba->block_count_valid=!!(file_info_captive->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT)))
+ file_info_corba->block_count=file_info_captive->block_count;
+ file_info_corba->atime=(!(file_info_captive->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_ATIME) ? 0 : file_info_captive->atime);
+ file_info_corba->mtime=(!(file_info_captive->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_MTIME) ? 0 : file_info_captive->mtime);
+ file_info_corba->ctime=(!(file_info_captive->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_CTIME) ? 0 : file_info_captive->ctime);
+ if ((file_info_corba->flags_valid=!!(file_info_captive->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_FLAGS)))
+ file_info_corba->flags=file_info_captive->flags;
+
+ return GNOME_VFS_OK;
+}
--- /dev/null
+/* $Id$
+ * Include file for CORBA/ORBit server side of GnomeVFSFileInfo handling
+ * 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
+ */
+
+
+#ifndef _SERVER_FILEINFO_H
+#define _SERVER_FILEINFO_H 1
+
+
+#include <glib/gmacros.h>
+#include "sandbox.h"
+#include <libgnomevfs/gnome-vfs-file-info.h>
+
+
+G_BEGIN_DECLS
+
+GnomeVFSResult captive_sandbox_file_info_corba_to_captive
+ (GnomeVFSFileInfo *file_info_captive,const Captive_GnomeVFSFileInfo *file_info_corba);
+GnomeVFSResult captive_sandbox_file_info_captive_to_corba
+ (Captive_GnomeVFSFileInfo *file_info_corba,const GnomeVFSFileInfo *file_info_captive);
+
+G_END_DECLS
+
+
+#endif /* _SERVER_FILEINFO_H */
noinst_LTLIBRARIES=libsandbox.la
libsandbox_la_SOURCES= \
$(SANDBOX_IDL_SOURCES) \
+ FileInfo.c \
+ FileInfo.h \
+ parent-Directory.c \
+ parent-File.c \
+ parent-Vfs.c \
split.c \
split.h \
server-GlibLogFunc.c \
--- /dev/null
+/* $Id$
+ * CORBA/ORBit server side of Directory 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-Directory.h" /* self */
+#include <glib/gmessages.h>
+#include "split.h"
+#include "sandbox.h"
+#include "../client/directory.h"
+#include "../client/vfs.h"
+#include "FileInfo.h"
+
+
+GnomeVFSResult captive_sandbox_parent_directory_new_open
+ (CaptiveDirectoryObject *captive_directory_object,const gchar *pathname)
+{
+ g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ captive_directory_object->corba_Directory_object=Captive_Vfs_directory_new_open(
+ captive_directory_object->vfs->corba_Vfs_object,pathname,&captive_corba_ev);
+
+ return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
+}
+
+
+GnomeVFSResult captive_sandbox_parent_directory_new_make
+ (CaptiveDirectoryObject *captive_directory_object,const gchar *pathname,guint perm)
+{
+ g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ captive_directory_object->corba_Directory_object=Captive_Vfs_directory_new_make(
+ captive_directory_object->vfs->corba_Vfs_object,pathname,perm,&captive_corba_ev);
+
+ return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
+}
+
+
+GnomeVFSResult captive_sandbox_parent_directory_close(CaptiveDirectoryObject *captive_directory_object)
+{
+ g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ CORBA_Object_release((CORBA_Object)captive_directory_object->corba_Directory_object,&captive_corba_ev);
+ captive_directory_object->corba_Directory_object=CORBA_OBJECT_NIL;
+
+ return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
+}
+
+
+GnomeVFSResult captive_sandbox_parent_directory_read
+ (CaptiveDirectoryObject *captive_directory_object,GnomeVFSFileInfo *file_info_captive)
+{
+Captive_GnomeVFSFileInfo *file_info_corba;
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ Captive_Directory_read(captive_directory_object->corba_Directory_object,&file_info_corba,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ if (GNOME_VFS_OK!=(r=captive_sandbox_file_info_corba_to_captive(file_info_captive,file_info_corba)))
+ return r; /* 'file_info_corba' leak */
+
+ Captive_GnomeVFSFileInfo__freekids(file_info_corba,NULL/* 'd'; meaning? */);
+ CORBA_free(file_info_corba);
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_directory_remove(CaptiveDirectoryObject *captive_directory_object)
+{
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ Captive_Directory_remove(captive_directory_object->corba_Directory_object,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ return GNOME_VFS_OK;
+}
--- /dev/null
+/* $Id$
+ * CORBA/ORBit server side of File 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-File.h" /* self */
+#include <glib/gmessages.h>
+#include "split.h"
+#include "sandbox.h"
+#include "../client/file.h"
+#include "../client/vfs.h"
+#include "FileInfo.h"
+
+
+GnomeVFSResult captive_sandbox_parent_file_new_open(CaptiveFileObject *captive_file_object,
+ const gchar *pathname,GnomeVFSOpenMode mode)
+{
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ captive_file_object->corba_File_object=Captive_Vfs_file_new_open(
+ captive_file_object->vfs->corba_Vfs_object,pathname,mode,&captive_corba_ev);
+
+ return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_new_create(CaptiveFileObject *captive_file_object,
+ const gchar *pathname,GnomeVFSOpenMode mode,gboolean exclusive,guint perm)
+{
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ captive_file_object->corba_File_object=Captive_Vfs_file_new_create(
+ captive_file_object->vfs->corba_Vfs_object,pathname,mode,exclusive,perm,&captive_corba_ev);
+
+ return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_close(CaptiveFileObject *captive_file_object)
+{
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ CORBA_Object_release((CORBA_Object)captive_file_object->corba_File_object,&captive_corba_ev);
+ captive_file_object->corba_File_object=CORBA_OBJECT_NIL;
+
+ return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_read(CaptiveFileObject *captive_file_object,
+ gpointer buffer_captive,GnomeVFSFileSize num_bytes,GnomeVFSFileSize *bytes_read_return)
+{
+GnomeVFSResult r;
+Captive_Bytes *buffer_corba;
+
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(buffer_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(bytes_read_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(num_bytes==(ULONG)num_bytes,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ *bytes_read_return=0;
+
+ Captive_File_read(captive_file_object->corba_File_object,&buffer_corba,num_bytes,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ g_return_val_if_fail(buffer_corba->_length<=num_bytes,GNOME_VFS_ERROR_GENERIC);
+ memcpy(buffer_captive,buffer_corba->_buffer,buffer_corba->_length);
+ *bytes_read_return=buffer_corba->_length;
+
+ Captive_Bytes__freekids(buffer_corba,NULL/* 'd'; meaning? */);
+ CORBA_free(buffer_corba);
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_write(CaptiveFileObject *captive_file_object,
+ gconstpointer buffer_captive,GnomeVFSFileSize num_bytes,GnomeVFSFileSize *bytes_written_return)
+{
+GnomeVFSResult r;
+Captive_Bytes buffer_corba_local;
+Captive_GnomeVFSFileSize bytes_written_corba;
+
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(buffer_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(bytes_written_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(num_bytes==(ULONG)num_bytes,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ *bytes_written_return=0;
+
+ buffer_corba_local._maximum=num_bytes;
+ buffer_corba_local._length=num_bytes;
+ buffer_corba_local._buffer=(/* de-const */gpointer)buffer_captive;
+ buffer_corba_local._release=FALSE;
+
+ Captive_File_write(captive_file_object->corba_File_object,&buffer_corba_local,&bytes_written_corba,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ *bytes_written_return=bytes_written_corba;
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_seek
+ (CaptiveFileObject *captive_file_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset)
+{
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ Captive_File_seek(captive_file_object->corba_File_object,whence,offset,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_tell(CaptiveFileObject *captive_file_object,GnomeVFSFileOffset *offset_return)
+{
+Captive_GnomeVFSFileOffset offset_corba;
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(offset_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ Captive_File_tell(captive_file_object->corba_File_object,&offset_corba,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ *offset_return=offset_corba;
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_remove(CaptiveFileObject *captive_file_object)
+{
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ Captive_File_remove(captive_file_object->corba_File_object,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_file_info_get(CaptiveFileObject *captive_file_object,
+ GnomeVFSFileInfo *file_info_captive)
+{
+Captive_GnomeVFSFileInfo *file_info_corba;
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ Captive_File_file_info_get(captive_file_object->corba_File_object,&file_info_corba,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ r=captive_sandbox_file_info_corba_to_captive(file_info_captive,file_info_corba);
+ Captive_GnomeVFSFileInfo__freekids(file_info_corba,NULL/* 'd'; meaning? */);
+ CORBA_free(file_info_corba);
+ if (r!=GNOME_VFS_OK)
+ return r;
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_file_info_set(CaptiveFileObject *captive_file_object,
+ const GnomeVFSFileInfo *file_info_captive,GnomeVFSSetFileInfoMask mask)
+{
+Captive_GnomeVFSFileInfo file_info_corba;
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ if (GNOME_VFS_OK!=(r=captive_sandbox_file_info_captive_to_corba(&file_info_corba,file_info_captive)))
+ return r;
+
+ Captive_File_file_info_set(captive_file_object->corba_File_object,&file_info_corba,mask,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ Captive_GnomeVFSFileInfo__freekids(&file_info_corba,NULL/* 'd'; meaning? */);
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_truncate(CaptiveFileObject *captive_file_object,GnomeVFSFileSize file_size)
+{
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ Captive_File_truncate(captive_file_object->corba_File_object,file_size,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_sandbox_parent_file_move
+ (CaptiveFileObject *captive_file_object_old,const gchar *pathname_new,gboolean force_replace)
+{
+GnomeVFSResult r;
+
+ g_return_val_if_fail(captive_file_object_old!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(pathname_new!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+ g_return_val_if_fail(captive_file_object_old->file_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+ Captive_File_move(captive_file_object_old->corba_File_object,pathname_new,force_replace,&captive_corba_ev);
+ if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev)))
+ return r;
+
+ return GNOME_VFS_OK;
+}
--- /dev/null
+/* $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;
+}
interface Directory {
- GnomeVFSFileInfo read()
+ void read(out GnomeVFSFileInfo file_info)
raises (GnomeVFSResultException,GlibLogMessageFatal);
void remove()
raises (GnomeVFSResultException,GlibLogMessageFatal);
interface File {
- void read(out Bytes buffer,in GnomeVFSFileSize num_bytes,out GnomeVFSFileSize bytes_read_return)
+ void read(out Bytes buffer,in GnomeVFSFileSize num_bytes)
raises (GnomeVFSResultException,GlibLogMessageFatal);
void write(in Bytes buffer,out GnomeVFSFileSize bytes_written_return)
raises (GnomeVFSResultException,GlibLogMessageFatal);
interface Vfs {
void registerGlibLogFunc(in GlibLogFunc glib_log_func);
+ void shutdown();
Directory directory_new_open(in string pathname)
raises (GnomeVFSResultException,GlibLogMessageFatal);
Directory directory_new_make(in string pathname,in GnomeVFSFilePermissions perm)
#include "sandbox.h"
#include <glib/gmessages.h>
#include "captive/macros.h"
+#include "../client/directory.h"
+#include "FileInfo.h"
+#include "split.h"
-typedef struct {
- POA_Captive_Directory servant;
- PortableServer_POA poa;
- } impl_POA_Captive_Directory;
+static void impl_Captive_Directory_fini(impl_POA_Captive_Directory *servant,CORBA_Environment *ev);
+static void impl_Captive_Directory_read
+ (impl_POA_Captive_Directory *servant,Captive_GnomeVFSFileInfo **file_info,CORBA_Environment *ev);
+static void impl_Captive_Directory_remove(impl_POA_Captive_Directory *servant,CORBA_Environment *ev);
-static Captive_GnomeVFSFileInfo *impl_Captive_Directory_read
- (impl_POA_Captive_Directory *servant,CORBA_Environment *ev);
static PortableServer_ServantBase__epv impl_Captive_Directory_base_epv={
NULL, /* _private data */
- NULL, /* finalize routine */
+ (gpointer)&impl_Captive_Directory_fini, /* finalize routine */
NULL, /* default_POA routine */
};
static POA_Captive_Directory__epv impl_Captive_Directory_epv={
NULL, /* _private */
(gpointer)&impl_Captive_Directory_read,
+ (gpointer)&impl_Captive_Directory_remove,
};
static POA_Captive_Directory__vepv impl_Captive_Directory_vepv={
&impl_Captive_Directory_base_epv,
captive_new0(newservant); /* FIXME: leak */
newservant->servant.vepv=&impl_Captive_Directory_vepv;
newservant->poa=poa;
+ newservant->captive_directory_object=NULL;
POA_Captive_Directory__init((PortableServer_Servant)newservant,ev);
objid=PortableServer_POA_activate_object(poa,newservant,ev);
CORBA_free(objid);
}
-static Captive_GnomeVFSFileInfo *impl_Captive_Directory_read
- (impl_POA_Captive_Directory *servant,CORBA_Environment *ev)
+static void impl_Captive_Directory_fini(impl_POA_Captive_Directory *servant,CORBA_Environment *ev)
{
-Captive_GnomeVFSFileInfo *retval;
-
- retval=Captive_GnomeVFSFileInfo__alloc();
-/*
- CORBA_string name;
- Captive_Directory_GnomeVFSFileType type;
- Captive_Directory_GnomeVFSFilePermissions permissions;
- Captive_Directory_GnomeVFSFileSize size;
- Captive_Directory_GnomeVFSFileSize block_count;
- Captive_Directory_time_t atime;
- Captive_Directory_time_t mtime;
- Captive_Directory_time_t ctime;
-*/
+ if (servant->captive_directory_object) {
+ g_object_unref(servant->captive_directory_object);
+ servant->captive_directory_object=NULL;
+ }
+}
+
+
+static void impl_Captive_Directory__destroy(impl_POA_Captive_Directory *servant,CORBA_Environment *ev)
+{
+PortableServer_ObjectId *objid;
+
+ objid=PortableServer_POA_servant_to_id(servant->poa,servant,ev);
+ PortableServer_POA_deactivate_object(servant->poa,objid,ev);
+ CORBA_free(objid);
+ impl_Captive_Directory_fini(servant,ev);
+ g_free(servant);
+}
+
+
+Captive_Directory impl_Captive_Vfs_directory_new_open
+ (impl_POA_Captive_Vfs *servant,const CORBA_char *pathname,CORBA_Environment *ev)
+{
+Captive_Directory retval;
+impl_POA_Captive_Directory *retval_servant;
+GnomeVFSResult errvfsresult;
+
+ retval=impl_Captive_Directory__create(servant->poa,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return NULL;
+
+ retval_servant=PortableServer_POA_reference_to_servant(servant->poa,retval,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return NULL; /* 'retval' leak */
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_directory_new_open(&retval_servant->captive_directory_object,
+ servant->captive_vfs_object,pathname))) {
+ impl_Captive_Directory__destroy(retval_servant,ev);
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return NULL;
+ }
+
return retval;
}
+
+
+Captive_Directory impl_Captive_Vfs_directory_new_make(impl_POA_Captive_Vfs *servant,
+ const CORBA_char *pathname,const Captive_GnomeVFSFilePermissions perm,CORBA_Environment *ev)
+{
+Captive_Directory retval;
+impl_POA_Captive_Directory *retval_servant;
+GnomeVFSResult errvfsresult;
+
+ retval=impl_Captive_Directory__create(servant->poa,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return NULL;
+
+ retval_servant=PortableServer_POA_reference_to_servant(servant->poa,retval,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return NULL; /* 'retval' leak */
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_directory_new_make(&retval_servant->captive_directory_object,
+ servant->captive_vfs_object,pathname,perm))) {
+ impl_Captive_Directory__destroy(retval_servant,ev);
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return NULL;
+ }
+
+ return retval;
+}
+
+
+static void impl_Captive_Directory_read
+ (impl_POA_Captive_Directory *servant,Captive_GnomeVFSFileInfo **file_info_corba_return,CORBA_Environment *ev)
+{
+GnomeVFSFileInfo file_info_captive;
+Captive_GnomeVFSFileInfo *file_info_corba;
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_directory_read(servant->captive_directory_object,&file_info_captive))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+
+ file_info_corba=Captive_GnomeVFSFileInfo__alloc();
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_sandbox_file_info_captive_to_corba(
+ file_info_corba,&file_info_captive))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ Captive_GnomeVFSFileInfo__freekids(file_info_corba,NULL/* 'd'; meaning? */);
+ CORBA_free(file_info_corba);
+ return;
+ }
+
+ *file_info_corba_return=file_info_corba;
+}
+
+
+static void impl_Captive_Directory_remove(impl_POA_Captive_Directory *servant,CORBA_Environment *ev)
+{
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_directory_remove(servant->captive_directory_object))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+}
#include <glib/gmacros.h>
#include "sandbox.h"
+#include "captive/client-directory.h"
+#include "server-Vfs.h"
G_BEGIN_DECLS
+typedef struct {
+ POA_Captive_Directory servant;
+ PortableServer_POA poa;
+ CaptiveDirectoryObject *captive_directory_object;
+ } impl_POA_Captive_Directory;
+
+
Captive_Directory impl_Captive_Directory__create(PortableServer_POA poa,CORBA_Environment *ev);
+Captive_Directory impl_Captive_Vfs_directory_new_open
+ (impl_POA_Captive_Vfs *servant,const CORBA_char *pathname,CORBA_Environment *ev);
+Captive_Directory impl_Captive_Vfs_directory_new_make(impl_POA_Captive_Vfs *servant,
+ const CORBA_char *pathname,const Captive_GnomeVFSFilePermissions perm,CORBA_Environment *ev);
G_END_DECLS
#include "sandbox.h"
#include <glib/gmessages.h>
#include "captive/macros.h"
+#include "split.h"
+#include "FileInfo.h"
-typedef struct {
- POA_Captive_File servant;
- PortableServer_POA poa;
- } impl_POA_Captive_File;
+static void impl_Captive_File_fini(impl_POA_Captive_File *servant,CORBA_Environment *ev);
+static void impl_Captive_File_read(impl_POA_Captive_File *servant,Captive_Bytes **buffer,
+ const Captive_GnomeVFSFileSize num_bytes,CORBA_Environment *ev);
+static void impl_Captive_File_write(impl_POA_Captive_File *servant,
+ const Captive_Bytes *buffer,Captive_GnomeVFSFileSize *bytes_written_return,CORBA_Environment *ev);
+static void impl_Captive_File_seek(impl_POA_Captive_File *servant,
+ const Captive_GnomeVFSSeekPosition whence,const Captive_GnomeVFSFileOffset offset,CORBA_Environment *ev);
+static void impl_Captive_File_tell
+ (impl_POA_Captive_File *servant,Captive_GnomeVFSFileOffset *offset_return,CORBA_Environment *ev);
+static void impl_Captive_File_remove(impl_POA_Captive_File *servant,CORBA_Environment *ev);
+static void impl_Captive_File_file_info_get
+ (impl_POA_Captive_File *servant,Captive_GnomeVFSFileInfo **file_info,CORBA_Environment *ev);
+static void impl_Captive_File_file_info_set(impl_POA_Captive_File *servant,
+ const Captive_GnomeVFSFileInfo *file_info,const Captive_GnomeVFSSetFileInfoMask mask,CORBA_Environment *ev);
+static void impl_Captive_File_truncate
+ (impl_POA_Captive_File *servant,const Captive_GnomeVFSFileSize file_size,CORBA_Environment *ev);
+static void impl_Captive_File_move
+ (impl_POA_Captive_File *servant,const CORBA_char *pathname_new,const CORBA_boolean force_replace,CORBA_Environment *ev);
-static Captive_GnomeVFSFileInfo *impl_Captive_File_read
- (impl_POA_Captive_File *servant,CORBA_Environment *ev);
static PortableServer_ServantBase__epv impl_Captive_File_base_epv={
NULL, /* _private data */
- NULL, /* finalize routine */
+ (gpointer)&impl_Captive_File_fini, /* finalize routine */
NULL, /* default_POA routine */
};
static POA_Captive_File__epv impl_Captive_File_epv={
NULL, /* _private */
(gpointer)&impl_Captive_File_read,
+ (gpointer)&impl_Captive_File_write,
+ (gpointer)&impl_Captive_File_seek,
+ (gpointer)&impl_Captive_File_tell,
+ (gpointer)&impl_Captive_File_remove,
+ (gpointer)&impl_Captive_File_file_info_get,
+ (gpointer)&impl_Captive_File_file_info_set,
+ (gpointer)&impl_Captive_File_truncate,
+ (gpointer)&impl_Captive_File_move,
};
static POA_Captive_File__vepv impl_Captive_File_vepv={
&impl_Captive_File_base_epv,
captive_new0(newservant); /* FIXME: leak */
newservant->servant.vepv=&impl_Captive_File_vepv;
newservant->poa=poa;
+ newservant->captive_file_object=NULL;
POA_Captive_File__init((PortableServer_Servant)newservant,ev);
objid=PortableServer_POA_activate_object(poa,newservant,ev);
CORBA_free(objid);
}
-static Captive_GnomeVFSFileInfo *impl_Captive_File_read
- (impl_POA_Captive_File *servant,CORBA_Environment *ev)
+static void impl_Captive_File_fini(impl_POA_Captive_File *servant,CORBA_Environment *ev)
{
-Captive_GnomeVFSFileInfo *retval;
-
- retval=Captive_GnomeVFSFileInfo__alloc();
-/*
- CORBA_string name;
- Captive_File_GnomeVFSFileType type;
- Captive_File_GnomeVFSFilePermissions permissions;
- Captive_File_GnomeVFSFileSize size;
- Captive_File_GnomeVFSFileSize block_count;
- Captive_File_time_t atime;
- Captive_File_time_t mtime;
- Captive_File_time_t ctime;
-*/
+ if (servant->captive_file_object) {
+ g_object_unref(servant->captive_file_object);
+ servant->captive_file_object=NULL;
+ }
+}
+
+
+static void impl_Captive_File__destroy(impl_POA_Captive_File *servant,CORBA_Environment *ev)
+{
+PortableServer_ObjectId *objid;
+
+ objid=PortableServer_POA_servant_to_id(servant->poa,servant,ev);
+ PortableServer_POA_deactivate_object(servant->poa,objid,ev);
+ CORBA_free(objid);
+ impl_Captive_File_fini(servant,ev);
+ g_free(servant);
+}
+
+
+Captive_File impl_Captive_Vfs_file_new_open
+ (impl_POA_Captive_Vfs *servant,const CORBA_char *pathname,const Captive_GnomeVFSOpenMode mode,CORBA_Environment *ev)
+{
+Captive_File retval;
+impl_POA_Captive_File *retval_servant;
+GnomeVFSResult errvfsresult;
+
+ retval=impl_Captive_File__create(servant->poa,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return NULL;
+
+ retval_servant=PortableServer_POA_reference_to_servant(servant->poa,retval,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return NULL; /* 'retval' leak */
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_new_open(&retval_servant->captive_file_object,
+ servant->captive_vfs_object,pathname,mode))) {
+ impl_Captive_File__destroy(retval_servant,ev);
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return NULL;
+ }
+
return retval;
}
+
+
+Captive_File impl_Captive_Vfs_file_new_create(impl_POA_Captive_Vfs *servant,const CORBA_char *pathname,
+ const Captive_GnomeVFSOpenMode mode,const CORBA_boolean exclusive,const CORBA_unsigned_long perm,CORBA_Environment *ev)
+{
+Captive_File retval;
+impl_POA_Captive_File *retval_servant;
+GnomeVFSResult errvfsresult;
+
+ retval=impl_Captive_File__create(servant->poa,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return NULL;
+
+ retval_servant=PortableServer_POA_reference_to_servant(servant->poa,retval,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return NULL; /* 'retval' leak */
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_new_create(&retval_servant->captive_file_object,
+ servant->captive_vfs_object,pathname,mode,exclusive,perm))) {
+ impl_Captive_File__destroy(retval_servant,ev);
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return NULL;
+ }
+
+ return retval;
+}
+
+
+static void impl_Captive_File_read(impl_POA_Captive_File *servant,Captive_Bytes **buffer_corba_return,
+ const Captive_GnomeVFSFileSize num_bytes,CORBA_Environment *ev)
+{
+Captive_Bytes *buffer_corba;
+GnomeVFSFileSize bytes_read;
+GnomeVFSResult errvfsresult;
+
+ buffer_corba=Captive_Bytes__alloc();
+ buffer_corba->_maximum=num_bytes;
+ buffer_corba->_length=0;
+ buffer_corba->_buffer=Captive_Bytes_allocbuf(buffer_corba->_maximum);
+ buffer_corba->_release=TRUE;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_read(servant->captive_file_object,
+ buffer_corba->_buffer,num_bytes,&bytes_read))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ Captive_Bytes__freekids(buffer_corba,NULL/* 'd'; meaning? */);
+ CORBA_free(buffer_corba);
+ return;
+ }
+
+ buffer_corba->_length=bytes_read;
+ *buffer_corba_return=buffer_corba;
+}
+
+
+static void impl_Captive_File_write(impl_POA_Captive_File *servant,
+ const Captive_Bytes *buffer_corba,Captive_GnomeVFSFileSize *bytes_written_return,CORBA_Environment *ev)
+{
+GnomeVFSFileSize bytes_written;
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_write(servant->captive_file_object,
+ buffer_corba->_buffer,buffer_corba->_length,&bytes_written))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+
+ *bytes_written_return=bytes_written;
+}
+
+
+static void impl_Captive_File_seek(impl_POA_Captive_File *servant,
+ const Captive_GnomeVFSSeekPosition whence,const Captive_GnomeVFSFileOffset offset,CORBA_Environment *ev)
+{
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_seek(servant->captive_file_object,whence,offset))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+}
+
+
+static void impl_Captive_File_tell
+ (impl_POA_Captive_File *servant,Captive_GnomeVFSFileOffset *offset_return,CORBA_Environment *ev)
+{
+GnomeVFSFileOffset offset_captive;
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_tell(servant->captive_file_object,&offset_captive))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+
+ *offset_return=offset_captive;
+}
+
+
+static void impl_Captive_File_remove(impl_POA_Captive_File *servant,CORBA_Environment *ev)
+{
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_remove(servant->captive_file_object))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+}
+
+
+static void impl_Captive_File_file_info_get
+ (impl_POA_Captive_File *servant,Captive_GnomeVFSFileInfo **file_info_corba_return,CORBA_Environment *ev)
+{
+GnomeVFSFileInfo file_info_captive;
+GnomeVFSResult errvfsresult;
+Captive_GnomeVFSFileInfo *file_info_corba;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_file_info_get(servant->captive_file_object,&file_info_captive))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+
+ file_info_corba=Captive_GnomeVFSFileInfo__alloc();
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_sandbox_file_info_captive_to_corba(
+ file_info_corba,&file_info_captive))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ Captive_GnomeVFSFileInfo__freekids(file_info_corba,NULL/* 'd'; meaning? */);
+ CORBA_free(file_info_corba);
+ return;
+ }
+
+ *file_info_corba_return=file_info_corba;
+}
+
+
+static void impl_Captive_File_file_info_set(impl_POA_Captive_File *servant,
+ const Captive_GnomeVFSFileInfo *file_info_corba,const Captive_GnomeVFSSetFileInfoMask mask,CORBA_Environment *ev)
+{
+GnomeVFSFileInfo file_info_captive;
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_sandbox_file_info_corba_to_captive(
+ &file_info_captive,file_info_corba))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_file_info_set(servant->captive_file_object,&file_info_captive,mask))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+}
+
+
+static void impl_Captive_File_truncate
+ (impl_POA_Captive_File *servant,const Captive_GnomeVFSFileSize file_size,CORBA_Environment *ev)
+{
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_truncate(servant->captive_file_object,file_size))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+}
+
+
+static void impl_Captive_File_move
+ (impl_POA_Captive_File *servant,const CORBA_char *pathname_new,const CORBA_boolean force_replace,CORBA_Environment *ev)
+{
+GnomeVFSResult errvfsresult;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_move(servant->captive_file_object,pathname_new,force_replace))) {
+ captive_sandbox_child_GnomeVFSResultException_throw(ev,errvfsresult);
+ return;
+ }
+}
*/
-#ifndef _SERVER_DIRECTORY_H
-#define _SERVER_DIRECTORY_H 1
+#ifndef _SERVER_FILE_H
+#define _SERVER_FILE_H 1
#include <glib/gmacros.h>
#include "sandbox.h"
+#include "captive/client-file.h"
+#include "server-Vfs.h"
G_BEGIN_DECLS
+typedef struct {
+ POA_Captive_File servant;
+ PortableServer_POA poa;
+ CaptiveFileObject *captive_file_object;
+ } impl_POA_Captive_File;
+
+
Captive_File impl_Captive_File__create(PortableServer_POA poa,CORBA_Environment *ev);
+Captive_File impl_Captive_Vfs_file_new_open
+ (impl_POA_Captive_Vfs *servant,const CORBA_char *pathname,const Captive_GnomeVFSOpenMode mode,CORBA_Environment *ev);
+Captive_File impl_Captive_Vfs_file_new_create(impl_POA_Captive_Vfs *servant,const CORBA_char *pathname,
+ const Captive_GnomeVFSOpenMode mode,const CORBA_boolean exclusive,const CORBA_unsigned_long perm,CORBA_Environment *ev);
G_END_DECLS
-#endif /* _SERVER_DIRECTORY_H */
+#endif /* _SERVER_FILE_H */
static void impl_Captive_GlibLogFunc_glibLogFunc
(impl_POA_Captive_GlibLogFunc *servant,const Captive_GlibLogMessage *glib_log_message,CORBA_Environment *ev)
{
- g_log(G_LOG_DOMAIN,glib_log_message->log_level,"%s",glib_log_message->message);
+GLogLevelFlags log_level_use;
+gboolean fatal;
+
+ log_level_use=glib_log_message->log_level;
+ /* Downgrade always-fatal 'ERROR' to 'CRITICAL' level */
+ if (log_level_use&G_LOG_LEVEL_ERROR) {
+ log_level_use=(log_level_use|G_LOG_LEVEL_CRITICAL)&~G_LOG_LEVEL_ERROR;
+ fatal=TRUE;
+ }
+ if (log_level_use&G_LOG_FLAG_FATAL) {
+ log_level_use&=~G_LOG_FLAG_FATAL;
+ fatal=TRUE;
+ }
+
+ g_log(G_LOG_DOMAIN,log_level_use,"%s%s",(!fatal ? "" : "FATAL: "),glib_log_message->message);
}
CORBA_Environment ev;
Captive_GlibLogMessage glib_log_message;
- /* Init 'ev' */
CORBA_exception_init(&ev);
-
glib_log_message.log_level=log_level;
glib_log_message.message=(CORBA_string)message;
Captive_GlibLogFunc_glibLogFunc(obj,&glib_log_message,&ev);
g_assert(validate_CORBA_Environment(&ev));
-
- /* Shutdown 'ev' */
CORBA_exception_free(&ev);
}
+static gboolean impl_Captive_Vfs_registerGlibLogFunc_handled=FALSE;
+static guint impl_Captive_Vfs_registerGlibLogFunc_handler_id;
+static Captive_GlibLogFunc glib_log_func_copy;
+
+
void impl_Captive_Vfs_registerGlibLogFunc
(impl_POA_Captive_Vfs *servant,const Captive_GlibLogFunc glib_log_func,CORBA_Environment *ev)
{
- g_log_set_handler(
+ g_assert(impl_Captive_Vfs_registerGlibLogFunc_handled==FALSE);
+
+ glib_log_func_copy=CORBA_Object_duplicate(glib_log_func,ev);
+ if (ev->_major!=CORBA_NO_EXCEPTION)
+ return;
+
+ impl_Captive_Vfs_registerGlibLogFunc_handler_id=g_log_set_handler(
G_LOG_DOMAIN, /* log_domain; "Captive" */
0 /* log_levels */
- | 0 /* !G_LOG_FLAG_RECURSION */
+ | 0 /* !G_LOG_FLAG_RECURSION */
| G_LOG_FLAG_FATAL
- | G_LOG_LEVEL_MASK,
+ | (G_LOG_LEVEL_MASK & ~(captive_options->debug_messages ? 0 : 0
+ /* The same mask is in libcaptive/client/init.c ! */
+ | G_LOG_LEVEL_MESSAGE
+ | G_LOG_LEVEL_INFO
+ | G_LOG_LEVEL_DEBUG)),
(GLogFunc)impl_Captive_Vfs_registerGlibLogFunc_log_func, /* log_func */
- (gpointer)glib_log_func); /* user_data */
+ (gpointer)glib_log_func_copy); /* user_data */
+
+ impl_Captive_Vfs_registerGlibLogFunc_handled=TRUE;
+}
+
+
+/* Called during child shutdown where our CORBA peer is no longer responding. */
+void impl_Captive_Vfs_registerGlibLogFunc_disable(void)
+{
+CORBA_Environment ev;
+
+ if (!impl_Captive_Vfs_registerGlibLogFunc_handled)
+ return;
+
+ g_log_remove_handler(
+ G_LOG_DOMAIN, /* log_domain; "Captive" */
+ impl_Captive_Vfs_registerGlibLogFunc_handler_id); /* handler_id */
+ CORBA_exception_init(&ev);
+ CORBA_Object_release(glib_log_func_copy,&ev);
+ g_assert(validate_CORBA_Environment(&ev));
+ CORBA_exception_free(&ev);
+
+ impl_Captive_Vfs_registerGlibLogFunc_handled=FALSE;
}
void impl_Captive_Vfs_registerGlibLogFunc
(impl_POA_Captive_Vfs *servant,const Captive_GlibLogFunc glib_log_func,CORBA_Environment *ev);
Captive_GlibLogFunc impl_Captive_GlibLogFunc__create(PortableServer_POA poa,CORBA_Environment *ev);
+void impl_Captive_Vfs_registerGlibLogFunc_disable(void);
G_END_DECLS
--- /dev/null
+/* $Id$
+ * CORBA/ORBit server side of Vfs object, ran by sandbox_child()
+ * 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 "server-Vfs.h" /* self */
+#include "server-GlibLogFunc.h" /* for impl_Captive_Vfs_registerGlibLogFunc() */
+#include "sandbox.h"
+#include <glib/gmessages.h>
+#include "captive/macros.h"
+#include "server-Directory.h"
+#include "server-File.h"
+#include "split.h"
+
+
+static void impl_Captive_Vfs_shutdown(impl_POA_Captive_Vfs *servant,CORBA_Environment *ev);
+
+static PortableServer_ServantBase__epv impl_Captive_Vfs_base_epv={
+ NULL, /* _private data */
+ NULL, /* finalize routine */
+ NULL, /* default_POA routine */
+ };
+static POA_Captive_Vfs__epv impl_Captive_Vfs_epv={
+ NULL, /* _private */
+ (gpointer)&impl_Captive_Vfs_registerGlibLogFunc,
+ (gpointer)&impl_Captive_Vfs_shutdown,
+ (gpointer)&impl_Captive_Vfs_directory_new_open,
+ (gpointer)&impl_Captive_Vfs_directory_new_make,
+ (gpointer)&impl_Captive_Vfs_file_new_open,
+ (gpointer)&impl_Captive_Vfs_file_new_create,
+ };
+static POA_Captive_Vfs__vepv impl_Captive_Vfs_vepv={
+ &impl_Captive_Vfs_base_epv,
+ &impl_Captive_Vfs_epv,
+ };
+
+
+struct captive_options *captive_corba_child_options;
+
+
+Captive_Vfs impl_Captive_Vfs__create(PortableServer_POA poa,CORBA_Environment *ev)
+{
+Captive_Vfs retval;
+impl_POA_Captive_Vfs *newservant;
+PortableServer_ObjectId *objid;
+GnomeVFSResult errvfsresult;
+
+ captive_new0(newservant); /* FIXME: leak */
+ newservant->servant.vepv=&impl_Captive_Vfs_vepv;
+ newservant->poa=poa;
+ if (GNOME_VFS_OK!=(errvfsresult=captive_vfs_new(&newservant->captive_vfs_object,captive_corba_child_options))) {
+ g_free(newservant);
+ CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Captive_GnomeVFSResultException,GINT_TO_POINTER((gint)errvfsresult));
+ return NULL;
+ }
+ POA_Captive_Vfs__init((PortableServer_Servant)newservant,ev);
+ objid=PortableServer_POA_activate_object(poa,newservant,ev);
+ CORBA_free(objid);
+ retval=PortableServer_POA_servant_to_reference(poa,newservant,ev);
+
+ return retval;
+}
+
+
+static gboolean impl_Captive_Vfs_shutdown_idle(gpointer data /* unused */)
+{
+ sandbox_child_shutdown();
+
+ return FALSE; /* remove me */
+}
+
+static void impl_Captive_Vfs_shutdown(impl_POA_Captive_Vfs *servant,CORBA_Environment *ev)
+{
+ /* Do not call sandbox_child_shutdown() directly as we would fail
+ * to finish this CORBA method call properly.
+ */
+ g_idle_add_full(
+ G_PRIORITY_LOW, /* priority */
+ impl_Captive_Vfs_shutdown_idle, /* function */
+ NULL, /* data */
+ NULL); /* notify */
+}
/* $Id$
- * Include file for reactos sandboxing of libcaptive
- * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * Include file for CORBA/ORBit server side of Vfs object
+ * 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
*/
-#ifndef _CAPTIVE_SANDBOX_H
-#define _CAPTIVE_SANDBOX_H 1
+#ifndef _SERVER_VFS_H
+#define _SERVER_VFS_H 1
-#include <glib/gtypes.h>
+#include <glib/gmacros.h>
+#include "sandbox.h"
+#include "captive/client-vfs.h"
G_BEGIN_DECLS
-/* TODO: Not yet finished */
-#define CAPTIVE_IS_SANDBOX_PARENT() (FALSE)
+typedef struct {
+ POA_Captive_Vfs servant;
+ PortableServer_POA poa;
+ CaptiveVfsObject *captive_vfs_object;
+ } impl_POA_Captive_Vfs;
+
+
+extern struct captive_options *captive_corba_child_options;
+
+
+Captive_Vfs impl_Captive_Vfs__create(PortableServer_POA poa,CORBA_Environment *ev);
G_END_DECLS
-#endif /* _CAPTIVE_SANDBOX_H */
+#endif /* _SERVER_VFS_H */
#include "server-GlibLogFunc.h"
#include "server-Directory.h"
#include "server-Vfs.h"
+#include "../client/vfs.h"
/* CONFIG: */
return TRUE;
}
+CORBA_Environment captive_corba_ev;
+CORBA_ORB captive_corba_orb;
+PortableServer_POA captive_corba_poa;
+
+static void corba_shutdown_atexit(void);
static gboolean corba_init(const char *pname,CORBA_Environment *evp,CORBA_ORB *orbp,PortableServer_POA *poap)
{
+static gboolean done=FALSE;
int orb_argc=1;
gchar *orb_argv[]={
(gchar *)captive_strdup_alloca(pname),
g_return_val_if_fail(orbp!=NULL,FALSE);
g_return_val_if_fail(poap!=NULL,FALSE);
+ if (done)
+ return TRUE;
+
/* Init 'ev' */
CORBA_exception_init(evp);
g_return_val_if_fail(validate_CORBA_Environment(evp),FALSE);
}
+ g_atexit(corba_shutdown_atexit);
+
+ done=TRUE;
return TRUE;
}
static CORBA_ORB heartbeat_source_callback_orb=CORBA_OBJECT_NIL;
-static gboolean corba_shutdown(CORBA_Environment *evp,CORBA_ORB *orbp,PortableServer_POA *poap)
+gboolean corba_shutdown(CORBA_Environment *evp,CORBA_ORB *orbp,PortableServer_POA *poap)
{
PortableServer_POA poa;
CORBA_ORB orb;
return TRUE;
}
-
-static gboolean corba_servant_object_destroy(PortableServer_POA poa,CORBA_Object reference,CORBA_Environment *evp)
+static void corba_shutdown_atexit(void)
{
-PortableServer_ObjectId *objid;
-PortableServer_Servant servant;
+gboolean errbool;
- g_return_val_if_fail(poa!=CORBA_OBJECT_NIL,FALSE);
- g_return_val_if_fail(reference!=CORBA_OBJECT_NIL,FALSE);
- g_return_val_if_fail(evp!=NULL,FALSE);
+ errbool=corba_shutdown(&captive_corba_ev,&captive_corba_orb,&captive_corba_poa);
+ g_assert(errbool==TRUE);
+}
- objid=PortableServer_POA_reference_to_id(poa,reference,evp);
- g_return_val_if_fail(validate_CORBA_Environment(evp),FALSE);
- servant=PortableServer_POA_reference_to_servant(poa,reference,evp);
- g_return_val_if_fail(validate_CORBA_Environment(evp),FALSE);
- PortableServer_POA_deactivate_object(poa,objid,evp);
- g_return_val_if_fail(validate_CORBA_Environment(evp),FALSE);
- CORBA_free(objid);
- (*((PortableServer_ServantBase *)servant)->vepv[0]->finalize)(servant,evp);
- g_return_val_if_fail(validate_CORBA_Environment(evp),FALSE);
- g_free(servant);
- return TRUE;
+void sandbox_child_shutdown(void)
+{
+ /* Do not fail by passing logging messages to the master. */
+ impl_Captive_Vfs_registerGlibLogFunc_disable();
+
+ g_main_loop_quit(linc_main_get_loop());
}
static gboolean heartbeat_source_callback(gpointer data /* unused */)
{
-CORBA_Environment ev;
-
g_return_val_if_fail(heartbeat_source_callback_orb!=CORBA_OBJECT_NIL,FALSE); /* the source should be removed */
- CORBA_exception_init(&ev);
- /* CORBA_ORB_shutdown() is not enough as 'init_level' still >0 */
- CORBA_ORB_destroy(
- heartbeat_source_callback_orb, /* orb */
- &ev); /* ev */
- g_assert(validate_CORBA_Environment(&ev));
- CORBA_exception_free(&ev);
+ sandbox_child_shutdown();
return FALSE; /* the source should be removed */
}
-static void sandbox_child(int Vfs_IOR_fd_write,GSource *gsource) G_GNUC_NORETURN;
-static void sandbox_child(int Vfs_IOR_fd_write,GSource *gsource)
+static void sandbox_child(int Vfs_IOR_fd_write,GSource *gsource,CaptiveVfsObject *child_captive_vfs_object) G_GNUC_NORETURN;
+static void sandbox_child(int Vfs_IOR_fd_write,GSource *gsource,CaptiveVfsObject *child_captive_vfs_object)
{
-CORBA_Environment ev;
-CORBA_ORB orb;
-PortableServer_POA poa;
Captive_Vfs Vfs_object;
gboolean errbool;
int errint;
guint errguint;
- errbool=corba_init("sandbox_child",&ev,&orb,&poa);
- g_assert(errbool==TRUE);
- heartbeat_source_callback_orb=orb;
+ errint=close(0); /* STDIN */
+ g_assert(errint==0);
+ errint=close(1); /* STDOUT */
+ g_assert(errint==0);
+ errint=close(2); /* STDERR */
+ g_assert(errint==0);
+
+ g_assert(captive_corba_child_options==NULL);
+ captive_corba_child_options=&child_captive_vfs_object->options;
+
+ heartbeat_source_callback_orb=captive_corba_orb;
/* linc_main_get_loop() makes sense only after corba_init() -> CORBA_ORB_init() */
errguint=g_source_attach(
g_assert(errguint!=0);
/* Init 'Vfs_object' */
- Vfs_object=impl_Captive_Vfs__create(poa,&ev);
- g_assert(validate_CORBA_Environment(&ev));
+ Vfs_object=impl_Captive_Vfs__create(captive_corba_poa,&captive_corba_ev);
+ g_assert(validate_CORBA_Environment(&captive_corba_ev));
/* pass IOR to our parent */
{
char *Vfs_IOR;
- Vfs_IOR=CORBA_ORB_object_to_string(orb,Vfs_object,&ev);
- g_assert(validate_CORBA_Environment(&ev));
+ Vfs_IOR=CORBA_ORB_object_to_string(captive_corba_orb,Vfs_object,&captive_corba_ev);
+ g_assert(validate_CORBA_Environment(&captive_corba_ev));
g_assert(Vfs_IOR!=NULL);
errint=write(Vfs_IOR_fd_write,Vfs_IOR,strlen(Vfs_IOR)+1);
g_assert((unsigned)errint==strlen(Vfs_IOR)+1);
/* CORBA_ORB_run() -> linc_main_loop_run() -> g_main_loop_run()
* and therefore we should be safe with glib events handling.
*/
- CORBA_ORB_run(orb,&ev);
- g_assert(validate_CORBA_Environment(&ev));
+ CORBA_ORB_run(captive_corba_orb,&captive_corba_ev);
+ g_assert(validate_CORBA_Environment(&captive_corba_ev));
/* Shutdown 'Vfs' servant */
- errbool=corba_servant_object_destroy(poa,Vfs_object,&ev);
- g_assert(errbool==TRUE);
+ CORBA_Object_release(Vfs_object,&captive_corba_ev);
+ g_assert(validate_CORBA_Environment(&captive_corba_ev));
- errbool=corba_shutdown(&ev,&orb,&poa);
+ errbool=corba_shutdown(&captive_corba_ev,&captive_corba_orb,&captive_corba_poa);
g_assert(errbool==TRUE);
_exit(EXIT_SUCCESS);
}
-static void sandbox_parent(int Vfs_IOR_fd_read)
+static void sandbox_parent
+ (int Vfs_IOR_fd_read,Captive_Vfs *corba_Vfs_object_return,Captive_GlibLogFunc *corba_GlibLogFunc_object_return)
{
-CORBA_Environment ev;
-CORBA_ORB orb;
-PortableServer_POA poa;
-gboolean errbool;
char *Vfs_IOR;
gsize Vfs_IOR_size;
-Captive_Directory directory_object;
Captive_Vfs Vfs_object;
Captive_GlibLogFunc GlibLogFunc_object;
int errint;
- errbool=corba_init("sandbox_parent",&ev,&orb,&poa);
- g_return_if_fail(errbool==TRUE);
+ g_return_if_fail(Vfs_IOR_fd_read!=-1);
+ g_return_if_fail(corba_Vfs_object_return!=NULL);
+ g_return_if_fail(corba_GlibLogFunc_object_return!=NULL);
Vfs_IOR=captive_rtl_file_read(Vfs_IOR_fd_read,&Vfs_IOR_size);
g_assert(Vfs_IOR!=NULL);
errint=close(Vfs_IOR_fd_read);
g_assert(errint==0);
- Vfs_object=CORBA_ORB_string_to_object(orb,Vfs_IOR,&ev);
- g_assert(validate_CORBA_Environment(&ev));
+ Vfs_object=CORBA_ORB_string_to_object(captive_corba_orb,Vfs_IOR,&captive_corba_ev);
+ g_assert(validate_CORBA_Environment(&captive_corba_ev));
g_free(Vfs_IOR);
/* Init 'GlibLogFunc_object' */
- GlibLogFunc_object=impl_Captive_GlibLogFunc__create(poa,&ev);
- g_assert(validate_CORBA_Environment(&ev));
- Captive_Vfs_registerGlibLogFunc(Vfs_object,GlibLogFunc_object,&ev);
- g_assert(validate_CORBA_Environment(&ev));
-
- directory_object=Captive_Vfs_directory_new_open(Vfs_object,"/directory",&ev);
- g_assert(validate_CORBA_Environment(&ev));
- puts("TEST DONE");
+ GlibLogFunc_object=impl_Captive_GlibLogFunc__create(captive_corba_poa,&captive_corba_ev);
+ g_assert(validate_CORBA_Environment(&captive_corba_ev));
+ Captive_Vfs_registerGlibLogFunc(Vfs_object,GlibLogFunc_object,&captive_corba_ev);
+ g_assert(validate_CORBA_Environment(&captive_corba_ev));
- /* Shutdown 'GlibLogFunc' servant */
- errbool=corba_servant_object_destroy(poa,GlibLogFunc_object,&ev);
- g_assert(errbool==TRUE);
-
- CORBA_Object_release(Vfs_object,&ev);
- g_assert(validate_CORBA_Environment(&ev));
-
- errbool=corba_shutdown(&ev,&orb,&poa);
- g_assert(errbool==TRUE);
+ *corba_Vfs_object_return=Vfs_object;
+ *corba_GlibLogFunc_object_return=GlibLogFunc_object;
}
static gboolean heartbeat_source_prepare(GSource *source,gint *timeout)
};
-void captive_sandbox_init(void)
+gboolean captive_sandbox_spawn(CaptiveVfsObject *child_captive_vfs_object,
+ Captive_Vfs *corba_Vfs_object_return,Captive_GlibLogFunc *corba_GlibLogFunc_object_return,int *parentheart_fds_1_return)
{
/* Vfs_IOR_fds[0] for reading by sandbox_parent() - client,
* Vfs_IOR_fds[1] for writing by sandbox_child() - server
*/
int Vfs_IOR_fds[2],parentheart_fds[2];
int errint;
+gboolean errbool;
+
+ g_return_val_if_fail(child_captive_vfs_object!=NULL,FALSE);
+ g_return_val_if_fail(corba_Vfs_object_return!=NULL,FALSE);
+ g_return_val_if_fail(corba_GlibLogFunc_object_return!=NULL,FALSE);
+ g_return_val_if_fail(parentheart_fds_1_return!=NULL,FALSE);
errint=pipe(Vfs_IOR_fds);
- g_assert(errint==0);
+ g_return_val_if_fail(errint==0,FALSE);
errint=pipe(parentheart_fds);
- g_assert(errint==0);
+ g_return_val_if_fail(errint==0,FALSE);
+
+ /* We cannot initialize 'parent' and 'child' name specifically as
+ * we need to have persistence master and its children will be already
+ * CORBA-initialized during their spawn.
+ */
+ errbool=corba_init("captive-sandbox",&captive_corba_ev,&captive_corba_orb,&captive_corba_poa);
+ g_return_val_if_fail(errbool==TRUE,FALSE);
+
+ /* Currently never called anywhere:
+ * errbool=corba_shutdown(&captive_corba_ev,&captive_corba_orb,&captive_corba_poa);
+ * g_assert(errbool==TRUE);
+ */
+
switch (fork()) {
case -1: /* error */
- g_assert_not_reached();
+ g_return_val_if_reached(FALSE);
case 0: { /* child */
GSource *gsource;
errint=close(Vfs_IOR_fds[0]); /* close Vfs_IOR_fd_read */
- g_assert(errint==0);
+ g_return_val_if_fail(errint==0,FALSE);
errint=close(parentheart_fds[1]); /* close parentheart_fd_write */
- g_assert(errint==0);
+ g_return_val_if_fail(errint==0,FALSE);
/* attach heartbeat_source_callback() to watch for any abnormalities
* on our open pipe 'parentheart_fds' and terminate the child if parent dies.
*/
gsource=g_source_new(&heartbeat_source_watch_funcs,sizeof(GSource));
- g_assert(gsource!=NULL);
+ g_return_val_if_fail(gsource!=NULL,FALSE);
g_source_set_callback(
gsource, /* source */
heartbeat_source_callback, /* func */
heartbeat_source_check_gpollfd.events=HEARTBEAT_SOURCE_CHECK_EVENTS;
heartbeat_source_check_gpollfd.revents=0;
g_source_add_poll(gsource,&heartbeat_source_check_gpollfd);
- sandbox_child(Vfs_IOR_fds[1],gsource); /* pass Vfs_IOR_fd_write */
+ sandbox_child(Vfs_IOR_fds[1],gsource,child_captive_vfs_object); /* pass Vfs_IOR_fd_write */
+ g_return_val_if_reached(FALSE);
} /* NOTREACHED */
default: /* parent */
errint=close(Vfs_IOR_fds[1]); /* close Vfs_IOR_fd_write */
- g_assert(errint==0);
+ g_return_val_if_fail(errint==0,FALSE);
errint=close(parentheart_fds[0]); /* close parentheart_fd_read */
- g_assert(errint==0);
+ g_return_val_if_fail(errint==0,FALSE);
errint=fcntl(parentheart_fds[1],F_SETFD,FD_CLOEXEC);
/* This fcntl(2) may not be enough - some fork(2) may duplicate this
* write descriptor and even if we do some process finish the child
* may remain alone connected with some unknown fork(2)er from us.
* Currently I am not aware such case would occur.
*/
- g_assert(errint==0);
- sandbox_parent(Vfs_IOR_fds[0]); /* pass Vfs_IOR_fd_read, it will be closed there */
- break;
+ g_return_val_if_fail(errint==0,FALSE);
+ *parentheart_fds_1_return=parentheart_fds[1];
+ sandbox_parent(
+ Vfs_IOR_fds[0], /* Vfs_IOR_fd_read */
+ corba_Vfs_object_return, /* corba_Vfs_object_return */
+ corba_GlibLogFunc_object_return); /* corba_GlibLogFunc_object_return */
+ /* 'parentheart_fds[1]' - parentheart_fd_write - is left open here */
+ return TRUE;
+ }
+ /* NOTREACHED */
+ g_return_val_if_reached(FALSE);
+}
+
+
+GnomeVFSResult captive_sandbox_parent_return_from_CORBA_Environment(CORBA_Environment *evp)
+{
+GnomeVFSResult r;
+
+ if (evp->_major==CORBA_NO_EXCEPTION)
+ return GNOME_VFS_OK;
+
+ if (!strcmp(ex_Captive_GnomeVFSResultException,CORBA_exception_id(evp)))
+ r=((Captive_GnomeVFSResultException *)CORBA_exception_value(evp))->gnome_vfs_result;
+ else {
+ r=GNOME_VFS_ERROR_GENERIC;
+ g_warning(_("CORBA Exception occured: id=\"%s\", value=%p"),
+ CORBA_exception_id(evp),CORBA_exception_value(evp));
}
- /* 'parentheart_fds[1]' - parentheart_fd_write - is left open here */
+ CORBA_exception_free(evp);
+
+ return r;
+}
+
+
+void captive_sandbox_child_GnomeVFSResultException_throw(CORBA_Environment *evp,GnomeVFSResult errvfsresult)
+{
+Captive_GnomeVFSResultException *gnome_vfs_result_exception;
+
+ g_return_if_fail(evp!=NULL);
+
+ gnome_vfs_result_exception=Captive_GnomeVFSResultException__alloc();
+ gnome_vfs_result_exception->gnome_vfs_result=errvfsresult;
+ CORBA_exception_set(evp,CORBA_USER_EXCEPTION,ex_Captive_GnomeVFSResultException,gnome_vfs_result_exception);
}
#include <glib/gmacros.h>
#include "sandbox.h"
+#include "captive/client-vfs.h"
G_BEGIN_DECLS
+extern CORBA_Environment captive_corba_ev;
+extern CORBA_ORB captive_corba_orb;
+extern PortableServer_POA captive_corba_poa;
+
+gboolean captive_sandbox_spawn(CaptiveVfsObject *child_captive_vfs_object,
+ Captive_Vfs *corba_Vfs_object_return,Captive_GlibLogFunc *corba_GlibLogFunc_object_return,int *parentheart_fds_1_return);
gboolean validate_CORBA_Environment(const CORBA_Environment *evp);
+GnomeVFSResult captive_sandbox_parent_return_from_CORBA_Environment(CORBA_Environment *evp);
+void captive_sandbox_child_GnomeVFSResultException_throw(CORBA_Environment *evp,GnomeVFSResult errvfsresult);
+void sandbox_child_shutdown(void);
G_END_DECLS
* captive_cdrom_init:
*
* Creates system device "\Device\CdRom%d" providing readonly access
- * to the given #image_iochannel as emulation of CD-ROM driver.
+ * to the given #captive_image_iochannel as emulation of CD-ROM driver.
*
* libcaptive currently supports just one drive and thus "\Device\CdRom0"
* is always created. It is forbidden to call this function twice.
static struct captive_DriverObject cdrom_captive_DriverObject;
NTSTATUS err;
- g_return_val_if_fail(captive_options->image_iochannel!=NULL,FALSE);
+ g_return_val_if_fail(captive_image_iochannel!=NULL,FALSE);
cdrom_captive_DriverObject.DiskGeometry.BytesPerSector=2048;
cdrom_captive_DriverObject.DiskGeometry.MediaType=RemovableMedia;
* captive_disk_init:
*
* Creates system device "\Device\CaptiveHarddisk%d" providing readwrite access
- * to the given #image_iochannel as emulation of harddisk driver.
+ * to the given #captive_image_iochannel as emulation of harddisk driver.
* reactos initializes "\Device\Harddisk%d\Partition0" as the whole disk
* and each partition it founds by IoReadPartitionTable() it will create
* as "\Device\Harddisk%d\Partition1", "\Device\Harddisk%d\Partition2" etc.
*
* libcaptive does not (yet?) support any partitions and it will always create
- * just the disk device for the whole given #image_iochannel.
+ * just the disk device for the whole given #captive_image_iochannel.
* As this behaviour is a bit specific we rather create some non-standard name
* of the device; anyway I have seen some "\Device\Harddisk%dVolume%d" on W32
* system.
static struct captive_DriverObject disk_captive_DriverObject;
NTSTATUS err;
- g_return_val_if_fail(captive_options->image_iochannel!=NULL,FALSE);
+ g_return_val_if_fail(captive_image_iochannel!=NULL,FALSE);
disk_captive_DriverObject.DiskGeometry.BytesPerSector=512;
disk_captive_DriverObject.DiskGeometry.MediaType=FixedMedia;
#include "captive/options.h"
+GIOChannel *captive_image_iochannel;
guint64 captive_image_size;
G_STRLOC,(IrpStack->MajorFunction==IRP_MJ_READ ? "IRP_MJ_READ" : "IRP_MJ_WRITE"),
(guint64)Parameters->ByteOffset.QuadPart,(gulong)Parameters->Length);
- erriostatus=g_io_channel_seek_position(captive_options->image_iochannel,
+ erriostatus=g_io_channel_seek_position(captive_image_iochannel,
Parameters->ByteOffset.QuadPart, /* offset */
G_SEEK_SET, /* type */
NULL); /* error */
case IRP_MJ_READ: {
gsize bytesread;
- erriostatus=g_io_channel_read_chars(captive_options->image_iochannel,
+ erriostatus=g_io_channel_read_chars(captive_image_iochannel,
buffer, /* buf */
Parameters->Length, /* count */
&bytesread, /* bytesread */
case IRP_MJ_WRITE: {
gsize byteswritten;
- erriostatus=g_io_channel_write_chars(captive_options->image_iochannel,
+ erriostatus=g_io_channel_write_chars(captive_image_iochannel,
buffer, /* buf */
Parameters->Length, /* count */
&byteswritten, /* byteswritten */
/* libcaptive is not authorized to shutdown 'captive_image_channel'. */
erriostatus=g_io_channel_flush(
- captive_options->image_iochannel, /* channel */
+ captive_image_iochannel, /* channel */
NULL); /* error */
g_assert(erriostatus==G_IO_STATUS_NORMAL);