From: short <> Date: Tue, 4 Nov 2003 18:18:34 +0000 (+0000) Subject: Compatibility with ORBit2>=2.7.x; new configure option '--with-orbit-line'. X-Git-Tag: captive-1_0_2~25 X-Git-Url: http://git.jankratochvil.net/?p=captive.git;a=commitdiff_plain;h=222ad5da3ec6edebf645978ce79af2e799f55272;ds=sidebyside Compatibility with ORBit2>=2.7.x; new configure option '--with-orbit-line'. - ORBit2>=2.7.x use private 'linc2'/'link' instead of external 'linc'. --- diff --git a/captive.spec.in b/captive.spec.in index 5d00491..e226be6 100644 --- a/captive.spec.in +++ b/captive.spec.in @@ -31,7 +31,7 @@ Copyright: GPL BuildRoot: /var/tmp/@PACKAGE@-@VERSION@-%{release}-root BuildRequires: ORBit2-devel Requires: ORBit2 -# We do not yet handle correctly linc2 of ORBit-2.7.x+ +# Due to --with-orbit-line=linc Conflicts: ORBit2 >= 2.7.0 BuildRequires: openssl-devel Requires: openssl @@ -130,7 +130,8 @@ NTFS disks will become mount(8)able at directories: /mnt/captive-VOLUME_NAME --enable-man-pages \ --enable-sbin-mountdir=/sbin \ --enable-sbin-mount-fs=ntfs:fastfat:cdfs:ext2fsd \ - --disable-gtk-doc + --disable-gtk-doc \ + --with-orbit-line=linc make %install diff --git a/configure.in b/configure.in index a850de3..3aca33c 100644 --- a/configure.in +++ b/configure.in @@ -336,14 +336,32 @@ fi AM_CONDITIONAL(ENABLE_LUFS,[ $have_lufs_includes && test x$PATH_LUFSMOUNT != x -a x$enable_lufs != no ]) AC_SUBST(PATH_LUFSMOUNT) -dnl for $(top_srcdir)/src/libcaptive/sandbox/split-sandbox.c -AM_PATH_LINC(,,[AC_MSG_ERROR([Captive requires linc library used by ORBit.])]) - dnl for $(top_srcdir)/src/libcaptive/client/ dnl Do not use '[client server]' as $4 to prevent: configure: test: too many arguments dnl - currently this argument is not used by 'orbit2-config' in any way anyway AM_PATH_ORBIT2(,,[AC_MSG_ERROR([Captive requires ORBit library.])]) +AC_ARG_WITH(orbit-line,[ --with-orbit-line=[link/linc/auto] Use 'link' for ORBit2 >=2.7.x+ (def.=auto)],,with_orbit_line=auto) +captive_save_CFLAGS="$CFLAGS" +captive_save_LIBS="$LIBS" +CFLAGS="$CFLAGS $ORBIT_CFLAGS" +LIBS="$LIBS $ORBIT_LIBS" +AC_CHECK_FUNC(link_get_tmpdir,[ + AC_DEFINE(HAVE_ORBIT_LINK,,[ORBit2 is 2.7.x+ and therefore includes its own 'link' library]) + found_orbit_line=link + ], + found_orbit_line=linc + ) +CFLAGS="$captive_save_CFLAGS" +LIBS="$captive_save_LIBS" +if test "x$with_orbit_line" != "xauto" -a "x$with_orbit_line" != "x$found_orbit_line";then + AC_MSG_ERROR([--with-orbit-line=$with_orbit_line specified but the detected line is $found_orbit_line]) +fi + +if test "x$found_orbit_line" = "xlinc";then + AM_PATH_LINC(,,[AC_MSG_ERROR([Captive requires linc library used by ORBit.])]) +fi + # AC_ARG_ENABLE(install-pkg,[--enable-install-pkg=[no/yes/auto]],,enable_install_pkg=auto) GLADE_W_INIT([ ./src/install/acquire/ui-gnome-interface.c diff --git a/debian/control b/debian/control index e027133..987497d 100644 --- a/debian/control +++ b/debian/control @@ -26,7 +26,8 @@ Depends: liborbit2, libpopt0, libglib2.0-0, libreadline4 -Conflicts: liborbit2 (>= 2.7.0) +# Due to --with-orbit-line=link +Conflicts: liborbit2 (< 2.8.2) Recommends: captive-lufs (= ${Source-Version}) Description: NTFS filesystem using Microsoft Windows drivers Existing binary Microsoft Windows file system drivers were exploited diff --git a/debian/rules b/debian/rules index 84740b1..e0cc48e 100755 --- a/debian/rules +++ b/debian/rules @@ -58,7 +58,8 @@ config.status: configure --enable-man-pages \ --enable-sbin-mountdir=/sbin \ --enable-sbin-mount-fs=ntfs:fastfat:cdfs:ext2fsd \ - --disable-gtk-doc + --disable-gtk-doc \ + --with-orbit-line=link build-arch: config.status build-arch-stamp build-arch-stamp: diff --git a/src/client/sandbox-server/main.c b/src/client/sandbox-server/main.c index 796fbbc..4ade0fa 100644 --- a/src/client/sandbox-server/main.c +++ b/src/client/sandbox-server/main.c @@ -40,9 +40,15 @@ #include #include #include -#include /* for linc_set_tmpdir() */ #include +#ifdef HAVE_ORBIT_LINK +char *link_get_tmpdir(void); +void link_set_tmpdir(const char *dir); +#else +#include /* for linc_set_tmpdir() */ +#endif + /* Do not: #include "../../libcaptive/sandbox/split.h" * for captive_sandbox_fd_closeup(); FIXME * * as it has libcaptive-dependent includes conditioned by ORBIT2. @@ -496,9 +502,19 @@ gchar *orb_argv[]={ if (ev._major!=CORBA_NO_EXCEPTION) fatal("Cannot initialize CORBA ORB (exception): %m"); } +#ifdef HAVE_ORBIT_LINK + chrooted_orbit_dir_old=link_get_tmpdir(); /* returns g_strdup()ed string */ +#else chrooted_orbit_dir_old=linc_get_tmpdir(); /* returns g_strdup()ed string */ +#endif g_assert(chrooted_orbit_dir_old!=NULL); +#ifdef HAVE_ORBIT_LINK + link_set_tmpdir(chrooted_orbit_dir); +#else linc_set_tmpdir(chrooted_orbit_dir); +#endif + if (!*chrooted_orbit_dir_old) + fatal("Cannot detect chrooted_orbit_dir: --with-orbit-line incompatible with ORBit2 version"); if (rmdir(chrooted_orbit_dir_old)) fatal("Cannot remove old chrooted_orbit_dir \"%s\": %m",chrooted_orbit_dir_old); g_free(chrooted_orbit_dir_old); @@ -517,7 +533,7 @@ gchar *orb_argv[]={ SANDBOX_SERVER_RLIMIT(RLIMIT_MEMLOCK,0); SANDBOX_SERVER_RLIMIT(RLIMIT_CORE,0); SANDBOX_SERVER_RLIMIT(RLIMIT_FSIZE,0); - SANDBOX_SERVER_RLIMIT(RLIMIT_NOFILE,6); /* >=6 */ + SANDBOX_SERVER_RLIMIT(RLIMIT_NOFILE,16); /* >=6; newer ORBit2/link require >6 */ /* FIXME: Why flock(dirfd,...) in chrooted_createdir() succeeds?: */ SANDBOX_SERVER_RLIMIT(RLIMIT_LOCKS,0); #undef SANDBOX_SERVER_RLIMIT diff --git a/src/libcaptive/sandbox/server-Directory.c b/src/libcaptive/sandbox/server-Directory.c index f31ad24..069db40 100644 --- a/src/libcaptive/sandbox/server-Directory.c +++ b/src/libcaptive/sandbox/server-Directory.c @@ -218,6 +218,6 @@ GSource *source; servant, /* data */ NULL); /* notify */ g_source_attach(source, - g_main_loop_get_context(linc_main_get_loop())); /* context; NULL means 'default context' */ + captive_corba_get_context()); /* context; NULL means 'default context' */ g_source_unref(source); } diff --git a/src/libcaptive/sandbox/server-File.c b/src/libcaptive/sandbox/server-File.c index ae0ecc3..48e94d8 100644 --- a/src/libcaptive/sandbox/server-File.c +++ b/src/libcaptive/sandbox/server-File.c @@ -350,6 +350,6 @@ GSource *source; servant, /* data */ NULL); /* notify */ g_source_attach(source, - g_main_loop_get_context(linc_main_get_loop())); /* context; NULL means 'default context' */ + captive_corba_get_context()); /* context; NULL means 'default context' */ g_source_unref(source); } diff --git a/src/libcaptive/sandbox/server-Vfs.c b/src/libcaptive/sandbox/server-Vfs.c index b42538e..f904089 100644 --- a/src/libcaptive/sandbox/server-Vfs.c +++ b/src/libcaptive/sandbox/server-Vfs.c @@ -210,7 +210,7 @@ GSource *source; servant, /* data */ NULL); /* notify */ g_source_attach(source, - g_main_loop_get_context(linc_main_get_loop())); /* context; NULL means 'default context' */ + captive_corba_get_context()); /* context; NULL means 'default context' */ g_source_unref(source); #endif } diff --git a/src/libcaptive/sandbox/split.c b/src/libcaptive/sandbox/split.c index 72107a1..c7cfefd 100644 --- a/src/libcaptive/sandbox/split.c +++ b/src/libcaptive/sandbox/split.c @@ -28,7 +28,6 @@ #include "captive/rtl-file.h" #include #include -#include /* for linc_main_get_loop() */ #include "server-Directory.h" #include "server-Vfs.h" #include "../client/vfs.h" @@ -39,6 +38,13 @@ #include "../client/giochannel-blind.h" /* for captive_giochannel_blind_new() */ #include +#ifdef HAVE_ORBIT_LINK +extern GMainLoop *link_loop; +void link_set_tmpdir(const char *dir); +#else +#include /* for linc_main_get_loop() */ +#endif + /* CONFIG: */ @@ -168,13 +174,26 @@ void sandbox_child_prepare_shutdown(void) } #endif +GMainLoop *captive_corba_get_loop(void) +{ +#ifdef HAVE_ORBIT_LINK + return link_loop; +#else + return linc_main_get_loop(); +#endif +} + +GMainContext *captive_corba_get_context(void) +{ + return g_main_loop_get_context(captive_corba_get_loop()); +} void sandbox_child_shutdown(void) { /* Do not fail by passing logging messages to the master. */ impl_Captive_Vfs_init_g_log_func_disable(); - g_main_loop_quit(linc_main_get_loop()); + g_main_loop_quit(captive_corba_get_loop()); } @@ -243,10 +262,10 @@ int errint; heartbeat_source_callback_orb=captive_corba_orb; - /* linc_main_get_loop() makes sense only after corba_init() -> CORBA_ORB_init() */ + /* captive_corba_get_context() makes sense only after corba_init() -> CORBA_ORB_init() */ errguint=g_source_attach( captive_corba_sandbox_child_heartbeat_gsource, /* source */ - g_main_loop_get_context(linc_main_get_loop())); /* context; NULL means 'default context' */ + captive_corba_get_context()); /* context; NULL means 'default context' */ g_assert(errguint!=0); /* Init 'Vfs_object' */ @@ -463,7 +482,11 @@ gboolean errbool; g_assert_not_reached(); } sandbox_parent_own_orbit_dir_cleanup_init(); +#ifdef HAVE_ORBIT_LINK + link_set_tmpdir(sandbox_parent_own_orbit_dir); +#else linc_set_tmpdir(sandbox_parent_own_orbit_dir); +#endif } data=captive_rtl_file_read(Vfs_IOR_fd_read,&data_size); /* data_fd_read */ diff --git a/src/libcaptive/sandbox/split.h b/src/libcaptive/sandbox/split.h index b27db01..b3d0ba0 100644 --- a/src/libcaptive/sandbox/split.h +++ b/src/libcaptive/sandbox/split.h @@ -22,6 +22,7 @@ #include +#include #ifdef ORBIT2 /* Prevent missing $(ORBIT_CFLAGS) outside of libcaptive/sandbox/ */ #include "sandbox.h" #include "captive/client-vfs.h" @@ -41,6 +42,8 @@ void captive_corba_sandbox_child(const gchar *chrooted_orbit_dir); void sandbox_child_prepare_shutdown(void); void captive_sandbox_fd_closeup(int fd_first_to_delete); void sandbox_child_shutdown(void); +GMainLoop *captive_corba_get_loop(void); +GMainContext *captive_corba_get_context(void); #ifdef ORBIT2 /* Prevent missing $(ORBIT_CFLAGS) outside of libcaptive/sandbox/ */ gboolean captive_sandbox_spawn(CaptiveVfsParentObject *captive_vfs_parent_object); gboolean validate_CORBA_Environment(CORBA_Environment *evp);