#include <sys/file.h>
#include <sys/resource.h>
#include <orbit/orb-core/corba-defs.h>
+#include "captive/client.h"
#ifdef HAVE_ORBIT_LINK
char *link_get_tmpdir(void);
g_get_home_dir();
g_get_tmp_dir();
+ /* Pre-resolve "link_get_tmpdir" symbol to prevent its later failed
+ * resolving in chroot(2) mode in Debian dynamic build.
+ */
+#ifdef HAVE_ORBIT_LINK
+ g_free(link_get_tmpdir()); /* returns g_strdup()ed string */
+#else
+ g_free(linc_get_tmpdir()); /* returns g_strdup()ed string */
+#endif
+
if (fragile && !optarg_chroot)
fatal("Fragile setuid/root environment but no --chroot set");
if (optarg_chroot) {
}
g_rand_free(grand);
*s=0;
- if (geteuid()==0) /* Not 'fragile' as we can be native 'root'. */
+ if (geteuid()==0) { /* Not 'fragile' as we can be native 'root'. */
chrooted_cleanuplockeddirs(optarg_chroot,"s-");
+ chrooted_cleanuplockeddirs(captive_printf_alloca("%s/tmp",optarg_chroot),"captive-orbit-");
+ }
chroot_pid_dir=captive_printf_alloca("%s/s-%d",optarg_chroot,(int)getpid());
chrooted_createdir(chroot_pid_dir,(!optarg_setuid ? (uid_t)-1 : want_uid),(!optarg_setgid ? (gid_t)-1 : want_gid),
TRUE); /* lock */
|G_LOG_LEVEL_DEBUG
));
+ /* Do not do it later than chroot_setup() as it requires it.
+ * On the other hand it is SETUID-fragile this way.
+ */
+ captive_standalone_init();
+
fatal_argv0=argv[0];
fragile=(getuid()!=geteuid() || getuid()==0 || geteuid()==0);
chroot_setup(TRUE);
#endif /* MAINTAINER_MODE */
- /* 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' */