+captive-sandbox-server for isolated filesystem sendbox server
authorshort <>
Sat, 7 Jun 2003 06:39:44 +0000 (06:39 +0000)
committershort <>
Sat, 7 Jun 2003 06:39:44 +0000 (06:39 +0000)
configure.in
src/client/Makefile.am
src/client/sandbox-server/Makefile.am [new file with mode: 0644]
src/client/sandbox-server/main.c [new file with mode: 0644]

index 2ba0b80..4e25932 100644 (file)
@@ -237,6 +237,7 @@ Makefile
 ./src/libcaptive/client/Makefile
 ./src/client/Makefile
 ./src/client/cmdline/Makefile
+./src/client/sandbox-server/Makefile
 ./src/client/libcaptive-gnomevfs/Makefile
 ./doc/Makefile
 ./doc/apiref/Makefile
index e518b2b..b2e1bf1 100644 (file)
@@ -1,6 +1,6 @@
 # $Id$
 # automake source listing subdirs of all client sources
-# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# Copyright (C) 2002-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
@@ -18,4 +18,4 @@
 
 include $(top_srcdir)/Makefile-head.am
 
-SUBDIRS=cmdline libcaptive-gnomevfs
+SUBDIRS=cmdline sandbox-server libcaptive-gnomevfs
diff --git a/src/client/sandbox-server/Makefile.am b/src/client/sandbox-server/Makefile.am
new file mode 100644 (file)
index 0000000..5a76438
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for sandbox filesystem sandbox server
+# 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 $(top_srcdir)/Makefile-head.am
+
+captive_sandbox_server_SOURCES= \
+               main.c
+captive_sandbox_server_LDADD=$(captive_library) $(INTLLIBS)
+sbin_PROGRAMS+=captive-sandbox-server
diff --git a/src/client/sandbox-server/main.c b/src/client/sandbox-server/main.c
new file mode 100644 (file)
index 0000000..8f0b670
--- /dev/null
@@ -0,0 +1,104 @@
+/* $Id$
+ * filesystem sandbox server stub for libcaptive
+ * 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 <glib/gmessages.h>
+#include <stdlib.h>
+#include <glib/giochannel.h>
+#include <glib/gerror.h>
+#include <popt.h>
+#include <string.h>
+#include <stdio.h>
+#include <locale.h>
+#include "captive/options.h"
+#include <glib-object.h>
+
+
+GQuark sandbox_server_main_error_quark(void)
+{
+GQuark r=0;
+
+       if (!r)
+               r=g_quark_from_static_string("sandbox-server");
+
+       return r;
+}
+
+
+static const struct poptOption popt_table[]={
+               CAPTIVE_POPT_INCLUDE,
+               POPT_AUTOHELP
+               POPT_TABLEEND
+               };
+
+
+int main(int argc,char **argv)
+{
+poptContext context;
+int errint;
+const char *cmd_arg;
+struct captive_options options;
+
+       /* Initialize the i18n stuff */
+       setlocale(LC_ALL,"");
+       bindtextdomain(PACKAGE,LOCALEDIR);
+       textdomain(PACKAGE);
+
+       /* Initialize GObject subsystem of GLib. */
+       g_type_init();
+
+       captive_options_init(&options);
+       captive_options=&options;       /* for parsing by 'CAPTIVE_POPT_INCLUDE' */
+
+       context=poptGetContext(
+                       PACKAGE,        /* name */
+                       argc,(/*en-const*/const char **)argv,   /* argc,argv */
+                       popt_table,     /* options */
+                       POPT_CONTEXT_POSIXMEHARDER);    /* flags; && !POPT_CONTEXT_KEEP_FIRST */
+       if (context==NULL) {
+               g_assert_not_reached(); /* argument recognization args_error */
+               return EXIT_FAILURE;
+               }
+       errint=poptReadDefaultConfig(context,
+                       TRUE);  /* useEnv */
+       if (errint!=0) {
+               g_assert_not_reached(); /* argument recognization args_error */
+               return EXIT_FAILURE;
+               }
+       errint=poptGetNextOpt(context);
+       if (errint!=-1) {
+               g_assert_not_reached(); /* some non-callbacked argument reached */
+               return EXIT_FAILURE;
+               }
+       cmd_arg=poptPeekArg(context);
+       if (cmd_arg) {
+               g_assert_not_reached(); /* some non-option argument reached */
+               return EXIT_FAILURE;
+               }
+       /* 'cmd_arg'-style args gets cleared by 'poptFreeContext(context);' below */
+       poptFreeContext(context);
+
+       captive_options=NULL;   /* already parsed by 'CAPTIVE_POPT_INCLUDE' */
+
+       captive_corba_sandbox_child();
+
+       g_assert_not_reached();
+       return EXIT_SUCCESS;
+}