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.8 diff -u -p -I$Id: -r1.1.2.1.2.7 -r1.1.2.1.2.8 --- NEWS 30 Dec 2003 14:22:13 -0000 1.1.2.1.2.7 +++ NEWS 22 Jan 2004 20:38:10 -0000 1.1.2.1.2.8 @@ -1,3 +1,23 @@ +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) + + 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.25 diff -u -p -I$Id: -r1.1.2.1.2.24 -r1.1.2.1.2.25 --- configure.ac 30 Dec 2003 19:38:29 -0000 1.1.2.1.2.24 +++ configure.ac 22 Jan 2004 20:38:10 -0000 1.1.2.1.2.25 @@ -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.27.90, enrico.scholz@informatik.tu-chemnitz.de) AC_CONFIG_SRCDIR([src/capchroot.c]) AC_CONFIG_HEADER([config.h]) 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: 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]);