Index: NEWS =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/NEWS,v retrieving revision 1.1.2.1.2.7 retrieving revision 1.1.2.1.2.9 diff -u -p -I$Id: -r1.1.2.1.2.7 -r1.1.2.1.2.9 --- NEWS 30 Dec 2003 14:22:13 -0000 1.1.2.1.2.7 +++ NEWS 26 Jan 2004 18:23:13 -0000 1.1.2.1.2.9 @@ -1,3 +1,28 @@ +Version 0.28 +============ + + - BUGFIX: fixed context creation when both fakeinit-flag and a + static context is wanted; previous versions ignored the fakeinit + flag in this situation + + - BUGFIX: vserver-copy: autodetect mktemp/tempfile (reported by + DUCLOS Andre) + + - FEATURE: allow to override start/stop commands of vservers + (patch by Erik Smit) + + - BUGFIX: call 'chkconfig' to fix initscripts *after* generating + the configuration (reported by DUCLOS Andre) + + - call programs with 'exec' on vserver's 'suexec' command (patch + by Alec Thomas) + + - improved e2fsprogs header detection + + - API-CHANGE: removed argument from vc_get_version() since the + only supported category is VC_CAT_COMPAT + + Version 0.27 ============ Index: configure.ac =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/configure.ac,v retrieving revision 1.1.2.1.2.24 retrieving revision 1.1.2.1.2.27 diff -u -p -I$Id: -r1.1.2.1.2.24 -r1.1.2.1.2.27 --- configure.ac 30 Dec 2003 19:38:29 -0000 1.1.2.1.2.24 +++ configure.ac 28 Jan 2004 11:04:13 -0000 1.1.2.1.2.27 @@ -25,7 +25,7 @@ dnl AC_PREREQ(2.57) -AC_INIT(util-vserver, 0.27, enrico.scholz@informatik.tu-chemnitz.de) +AC_INIT(util-vserver, 0.28, enrico.scholz@informatik.tu-chemnitz.de) AC_CONFIG_SRCDIR([src/capchroot.c]) AC_CONFIG_HEADER([config.h]) @@ -101,12 +101,7 @@ done IFS=$old_IFS AC_MSG_RESULT([$enable_apis]) -AC_LANG_PUSH(C++) -AC_CHECK_HEADERS([ext2fs/ext2fs.h], [], - [AC_CHECK_HEADERS([linux/ext2_fs.h], [], - [AC_MSG_ERROR([Sorry, do not know, how to include 'ext2fs.h'])])]) -AC_LANG_POP - +ENSC_CHECK_EXT2FS_HEADER AC_CHECK_FUNCS([vserver]) AC_CHECK_DECLS(MS_MOVE,,,[#include ]) AC_CHECK_TYPES(xid_t,,,[#include ]) Index: lib/getversion.c =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/lib/getversion.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -p -I$Id: -r1.1.2.2 -r1.1.2.3 --- lib/getversion.c 3 Dec 2003 00:08:21 -0000 1.1.2.2 +++ lib/getversion.c 26 Jan 2004 18:19:24 -0000 1.1.2.3 @@ -24,7 +24,7 @@ #include "getversion-internal.hc" int -vc_get_version(int cat) +vc_get_version() { - return vc_get_version_internal(cat); + return vc_get_version_internal(VC_CAT_COMPAT); } Index: lib/syscall_kill-v11.hc =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/lib/syscall_kill-v11.hc,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -p -I$Id: -r1.1.2.4 -r1.1.2.5 --- lib/syscall_kill-v11.hc 30 Dec 2003 14:06:25 -0000 1.1.2.4 +++ lib/syscall_kill-v11.hc 26 Jan 2004 18:20:18 -0000 1.1.2.5 @@ -23,7 +23,7 @@ static inline ALWAYSINLINE int vc_ctx_kill_v11(xid_t ctx, pid_t pid, int sig) { - struct vcmd_ctx_kill_v0 param = { 0 }; + struct vcmd_ctx_kill_v0 param = { 0,0 }; param.pid = pid; param.sig = sig; Index: lib/vserver-internal.h =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/lib/vserver-internal.h,v retrieving revision 1.1.4.11 retrieving revision 1.1.4.12 diff -u -p -I$Id: -r1.1.4.11 -r1.1.4.12 --- lib/vserver-internal.h 30 Dec 2003 14:07:03 -0000 1.1.4.11 +++ lib/vserver-internal.h 7 Jan 2004 16:22:59 -0000 1.1.4.12 @@ -40,7 +40,7 @@ # define VC_SELECT(ID) case ID: if(1) # define CALL_VC(...) \ switch (utilvserver_checkCompatVersion()&~0xff) { \ - case -1 : if (1) break; \ + case -1 & 0xff : if (1) break; \ VC_SUFFIX, __VA_ARGS__ , VC_PREFIX; \ default : errno = EINVAL; \ } \ Index: lib/vserver.h =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/lib/vserver.h,v retrieving revision 1.1.4.10 retrieving revision 1.1.4.11 diff -u -p -I$Id: -r1.1.4.10 -r1.1.4.11 --- lib/vserver.h 30 Dec 2003 13:45:56 -0000 1.1.4.10 +++ lib/vserver.h 26 Jan 2004 18:19:41 -0000 1.1.4.11 @@ -43,8 +43,8 @@ extern "C" { uint32_t mask; }; - /** Returns version of the given API-category */ - int vc_get_version(int category); + /** Returns version of the current kernel API */ + int vc_get_version(); /** Puts current process into context , removes the given caps and * sets flags. Index: m4/ensc_cflags.m4 =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/m4/ensc_cflags.m4,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -u -p -I$Id: -r1.1 -r1.1.4.1 --- m4/ensc_cflags.m4 29 Sep 2003 22:01:57 -0000 1.1 +++ m4/ensc_cflags.m4 26 Jan 2004 18:21:28 -0000 1.1.4.1 @@ -55,7 +55,7 @@ AC_DEFUN([__ENSC_CHECK_WARNFLAGS_CXX], # ENSC_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...) # ------------------------------------------------------------------------- -AC_DEFUN(ENSC_CHECK_CXX_FLAG, +AC_DEFUN([ENSC_CHECK_CXX_FLAG], [ AC_REQUIRE([__ENSC_CHECK_WARNFLAGS_CXX]) @@ -82,7 +82,7 @@ AC_DEFUN(ENSC_CHECK_CXX_FLAG, # ENSC_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...) # ------------------------------------------------------------------------- -AC_DEFUN(ENSC_CHECK_CC_FLAG,[ +AC_DEFUN([ENSC_CHECK_CC_FLAG],[ AC_REQUIRE([__ENSC_CHECK_WARNFLAGS_C]) echo 'void f(){}' > conftest.c @@ -100,7 +100,7 @@ echo 'void f(){}' > conftest.c rm -f conftest.c conftest.o ]) -AC_DEFUN(ENSC_CHECK_DEFAULT_FLAG, +AC_DEFUN([ENSC_CHECK_DEFAULT_FLAG], [ if test x"${ensc_sys_default_flag}" = x; then ENSC_CHECK_CC_FLAG([-fmessage-length=0]) Index: m4/ensc_e2fscheck.m4 =================================================================== RCS file: m4/ensc_e2fscheck.m4 diff -N m4/ensc_e2fscheck.m4 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ m4/ensc_e2fscheck.m4 26 Jan 2004 18:20:51 -0000 1.1.2.1 @@ -0,0 +1,70 @@ +dnl $Id: ensc_e2fscheck.m4,v 1.1.2.1 2004/01/26 18:20:51 ensc Exp $ + +dnl Copyright (C) 2004 Enrico Scholz +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; version 2 of the License. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +AC_DEFUN([ENSC_CHECK_EXT2FS_HEADER], +[ + AC_LANG_PUSH(C++) + AC_CACHE_CHECK([for ext2fs-headers], [ensc_cv_test_ext2fs_header],[ + AC_COMPILE_IFELSE(AC_LANG_SOURCE([#include + int main() { return 0; }]), + [ensc_cv_test_ext2fs_header=e2fsprogs],[ + AC_COMPILE_IFELSE(AC_LANG_SOURCE([#include + int main() { return 0; }]), + [ensc_cv_test_ext2fs_header=kernel],[ + ensc_cv_test_ext2fs_header=none])])]) + + case x"$ensc_cv_test_ext2fs_header" in + (xe2fsprogs) + AC_CHECK_HEADER([ext2fs/ext2_fs.h], + [AC_DEFINE(ENSC_HAVE_EXT2FS_EXT2_FS_H, 1, [define when is usable])], + [AC_MSG_FAILURE([unexpected error while checkin for ])]) + ;; + (xkernel) + AC_CHECK_HEADER([linux/ext2_fs.h], + [AC_DEFINE(ENSC_HAVE_LINUX_EXT2_FS_H, 1, [define when is usable])], + [AC_MSG_FAILURE([unexpected error while checkin for ])]) + ;; + (*) + AC_MSG_FAILURE([ +ext2fs headers were not found, or they are not usable. This can have +the following reasons: + +* you have neither the e2fsprogs nor the kernel headers installed + +* kernel headers are broken (e.g. these of linux 2.6 are known to be) + and you do not have e2fsprogs headers installed; please try to + install e2fsprogs-devel (for Red Hat) or e2fsprogs-dev (for Debian) + in this case + +* kernel headers are broken and your e2fsprogs headers are too old; + until version 1.27 (inclusive), they are using reserved C++ keywords + +* kernel headers are broken and your e2fsprogs headers are too new; + recent (January 2004) BK snapshots of e2fsprogs are unusable for + C++, for details and a solution see + https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=112448 + + +In the latter two cases you have the following options: +* fix the headers manually, or +* install a stable version of e2fsprogs (e.g. 1.34), or +* use good kernel headers (from linux 2.4.x) +]) + ;; + esac + AC_LANG_POP +]) Index: m4/ensc_kerneldir.m4 =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/m4/ensc_kerneldir.m4,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -p -I$Id: -r1.1.2.1 -r1.1.2.2 --- m4/ensc_kerneldir.m4 30 Oct 2003 14:24:09 -0000 1.1.2.1 +++ m4/ensc_kerneldir.m4 26 Jan 2004 18:21:28 -0000 1.1.2.2 @@ -19,7 +19,7 @@ dnl Usage: ENSC_KERNEL_HEADERS() dnl ... basedir of kernel-headers (without the '/linux'); dnl this value will be AC_SUBST'ed -AC_DEFUN(_ENSC_KERNEL_DIR, +AC_DEFUN([_ENSC_KERNEL_DIR], [ AC_CACHE_CHECK([for linux kernel dir], [ensc_cv_path_kerneldir], [ @@ -41,7 +41,7 @@ AC_ARG_WITH([kerneldir], } ]) -AC_DEFUN(ENSC_KERNEL_HEADERS, +AC_DEFUN([ENSC_KERNEL_HEADERS], [ AC_REQUIRE([_ENSC_KERNEL_DIR]) Index: m4/ensc_uv_vrootdir.m4 =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/m4/ensc_uv_vrootdir.m4,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -p -I$Id: -r1.1.2.1 -r1.1.2.2 --- m4/ensc_uv_vrootdir.m4 30 Oct 2003 15:21:25 -0000 1.1.2.1 +++ m4/ensc_uv_vrootdir.m4 26 Jan 2004 18:21:28 -0000 1.1.2.2 @@ -19,7 +19,7 @@ dnl Usage: ENSC_UV_VROOTDIR[( ... name of variable which will get assigned dnl the dirname of the vserver-topdir -AC_DEFUN(ENSC_UV_VROOTDIR, +AC_DEFUN([ENSC_UV_VROOTDIR], [ AC_MSG_CHECKING([which vserver-rootdir is to use]) AC_ARG_WITH([vrootdir], Index: scripts/vserver =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/scripts/vserver,v retrieving revision 1.1.2.1.2.6 retrieving revision 1.1.2.1.2.9 diff -u -p -I$Id: -r1.1.2.1.2.6 -r1.1.2.1.2.9 --- scripts/vserver 30 Dec 2003 13:50:31 -0000 1.1.2.1.2.6 +++ scripts/vserver 22 Jan 2004 19:52:59 -0000 1.1.2.1.2.9 @@ -317,27 +317,6 @@ elif [ "$2" = "build" ] ; then vserver_mknod dev/tty c 5 0 666 vserver_mknod dev/ptmx c 5 2 666 touch dev/hdv1 - # Turn off some service useless on a vserver - # vserver_turnoff apmd network autofs dhcpd gpm ipchains iptables \ - # irda isdn keytable kudzu linuxconf-setup netfs nfs nfslock \ - # pcmcia portmap pppoe random rawdevices rhnsd rstatd ruserd \ - # rwalld rwhod sendmail smb snmpd v_httpd h_xinetd v_sshd vservers \ - # xfs ypbind xinetd - ( - cd etc/init.d 2>/dev/null || cd etc/rc.d/init.d - for serv in * - do - case $serv in - *.bak|*~|functions|killall|halt|single) - ;; - *) - #$USR_LIB_VSERVER/capchroot $VROOTDIR/$1 /sbin/chkconfig --level 2345 $serv off - $0 --silent $1 chkconfig --level 2345 $serv off - ;; - esac - done - ) - rm -f etc/rc.d/rc6.d/S*reboot # Create a dummy /etc/fstab and /etc/mtab to please # df and linuxconf. We use hdv1, which does not exist # to remind the admin that it is not the real drive @@ -428,6 +407,27 @@ S_CAPS="" EOF echo $CONF has been created. Look at it\! fi + # Turn off some service useless on a vserver + # vserver_turnoff apmd network autofs dhcpd gpm ipchains iptables \ + # irda isdn keytable kudzu linuxconf-setup netfs nfs nfslock \ + # pcmcia portmap pppoe random rawdevices rhnsd rstatd ruserd \ + # rwalld rwhod sendmail smb snmpd v_httpd h_xinetd v_sshd vservers \ + # xfs ypbind xinetd + ( + cd etc/init.d 2>/dev/null || cd etc/rc.d/init.d + for serv in * + do + case $serv in + *.bak|*~|functions|killall|halt|single) + ;; + *) + #$USR_LIB_VSERVER/capchroot $VROOTDIR/$1 /sbin/chkconfig --level 2345 $serv off + $0 --silent $1 chkconfig --level 2345 $serv off + ;; + esac + done + ) + rm -f etc/rc.d/rc6.d/S*reboot fi elif [ ! -f /etc/vservers/$1.conf ] ; then echo No configuration for this vserver: /etc/vservers/$1.conf @@ -504,6 +504,9 @@ elif [ "$2" = "start" ] ; then ;; esac done + if [ -n "$S_START" ] ; then + STARTCMD=$S_START + fi if [ "$FAKEINIT" = "" ] ; then $USR_LIB_VSERVER/fakerunlevel $INITDEFAULT var/run/utmp fi @@ -613,6 +616,10 @@ elif [ "$2" = "stop" ] ; then esac done + if [ -n "$S_STOP" ] ; then + STOPCMD=$S_STOP + fi + calculateCaps $S_CAPS cd $VROOTDIR/$1 @@ -711,7 +718,7 @@ elif [ "$2" = "suexec" ] ; then cd $VROOTDIR/$VSERVER IPOPT=`setipopt $IPROOT` export PATH=$DEFAULTPATH - $CHBIND_CMD $SILENT $IPOPT --bcast $IPROOTBCAST \ + exec $CHBIND_CMD $SILENT $IPOPT --bcast $IPROOTBCAST \ $CHCONTEXT_CMD $SILENT $FLAGS $CAPS --secure --ctx $S_CONTEXT \ $CAPCHROOT_CMD --suid $USERID . "$@" else @@ -733,7 +740,7 @@ elif [ "$2" = "suexec" ] ; then cd $VROOTDIR/$VSERVER IPOPT=`setipopt $IPROOT` export PATH=$DEFAULTPATH - $CHBIND_CMD $SILENT $IPOPT --bcast $IPROOTBCAST \ + exec $CHBIND_CMD $SILENT $IPOPT --bcast $IPROOTBCAST \ $CHCONTEXT_CMD $SILENT $FLAGS $CAPS --secure $CTXOPT $HOSTOPT $DOMAINOPT \ $SAVE_S_CONTEXT_CMD /var/run/vservers/$VSERVER.ctx \ $CAPCHROOT_CMD --suid $USERID $CHROOTOPT . "$@" Index: scripts/vserver-copy =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/scripts/vserver-copy,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.4 diff -u -p -I$Id: -r1.1.4.2 -r1.1.4.4 --- scripts/vserver-copy 30 Oct 2003 15:16:30 -0000 1.1.4.2 +++ scripts/vserver-copy 19 Jan 2004 23:00:12 -0000 1.1.4.4 @@ -47,6 +47,11 @@ VERSION="0.4" umask 022 me=${0##*/} +mktemp="$(which mktemp 2>/dev/null) /tmp/vc.XXXXXX" || \ +mktemp=$(which tempfile 2>/dev/null) || { + echo $"Can not find mktemp or tempfile" >&2 + exit 1 +} ### Helper functions ### @@ -302,7 +307,7 @@ fi if [ -n "$ip" -a -n "$domain" ]; then # Insert the new IPROOT/S_HOSTNAME values into the config file info "Modifying $targetconf" - tmpf=$(tempfile) + tmpf=$($mktemp) if (sed -e "s/^S_HOSTNAME=.*/S_HOSTNAME=\"$newname\"/" \ -e "s/^IPROOT=.*/IPROOT=\"$ip\"/" $vconf > $tmpf) then @@ -348,7 +353,7 @@ else if ! $stopstart; then # Make sure that this vserver doesn't start on the # destination host if it reboots - tmpf=$(tempfile) + tmpf=$($mktemp) sed -e 's/^ONBOOT=.*/ONBOOT=no/' $vconf > $tmpf vconf=$tmpf fi @@ -372,7 +377,7 @@ if $stopstart; then fi # Make sure that we don't start the original on next boot - tmpf=$(tempfile) + tmpf=$($mktemp) sed -e 's/^ONBOOT=.*/ONBOOT=no/' $vconf > $tmpf mv $tmpf $vconf fi Index: src/chcontext.c =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/src/chcontext.c,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -u -p -I$Id: -r1.1.4.2 -r1.1.4.3 --- src/chcontext.c 30 Oct 2003 00:36:39 -0000 1.1.4.2 +++ src/chcontext.c 7 Jan 2004 16:24:01 -0000 1.1.4.3 @@ -117,7 +117,6 @@ int main (int argc, char *argv[]) int nbctx = 0; int ctxs[16]; int disconnect = 0; - int fakeinit = 0; int silent = 0; int flags = 0; unsigned remove_cap = 0; @@ -164,7 +163,6 @@ int main (int argc, char *argv[]) }else if (strcmp(opt,"private")==0){ flags |= 8; }else if (strcmp(opt,"fakeinit")==0){ - fakeinit = 1; flags |= 16; }else if (strcmp(opt,"hideinfo")==0){ flags |= 32; @@ -257,8 +255,10 @@ int main (int argc, char *argv[]) */ if (disconnect == 0 || fork()==0){ int newctx; + int xflags = flags & 16; + if (nbctx == 0) ctxs[nbctx++] = -1; - newctx = vc_new_s_context(ctxs[0],0,flags); + newctx = vc_new_s_context(ctxs[0],0,flags&~16); if (newctx != -1){ if (hostname != NULL){ if (sethostname (hostname,strlen(hostname))==-1){ @@ -275,7 +275,8 @@ int main (int argc, char *argv[]) } } remove_cap &= (~add_cap); - if (remove_cap != 0) vc_new_s_context (-2,remove_cap,0); + if (remove_cap!=0 || xflags!=0) + vc_new_s_context (-2,remove_cap,xflags); if (!silent){ printf ("New security context is %d\n" ,ctxs[0] == -1 ? newctx : ctxs[0]); Index: src/ext2fs.h =================================================================== RCS file: /cvsroot/util-vserver/util-vserver/src/Attic/ext2fs.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -p -I$Id: -r1.1.2.1 -r1.1.2.2 --- src/ext2fs.h 18 Nov 2003 22:31:11 -0000 1.1.2.1 +++ src/ext2fs.h 26 Jan 2004 18:22:00 -0000 1.1.2.2 @@ -19,9 +19,9 @@ #ifndef H_UTIL_VSERVER_SRC_EXT2FS_H #define H_UTIL_VSERVER_SRC_EXT2FS_H -#ifdef HAVE_EXT2FS_EXT2FS_H -# include -#elif defined(HAVE_LINUX_EXT2_FS_H) +#ifdef ENSC_HAVE_EXT2FS_EXT2_FS_H +# include +#elif defined(ENSC_HAVE_LINUX_EXT2_FS_H) # include #else # error Do not know how to include