1 Index: python/Makefile-files
2 ===================================================================
3 --- python/Makefile-files (revision 2883)
4 +++ python/Makefile-files (revision 2896)
8 ## Copyright (C) 2008 Daniel Hokka Zakrisson
11 ## This program is free software; you can redistribute it and/or
12 ## modify it under the terms of the GNU General Public License
13 ## as published by the Free Software Foundation; either version 2
14 ## of the License, or (at your option) any later version.
17 ## This program is distributed in the hope that it will be useful,
18 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ## GNU General Public License for more details.
23 ## You should have received a copy of the GNU General Public License
24 ## along with this program; if not, write to the Free Software
25 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 +AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += python/libvserver.py
30 pyexec_LTLIBRARIES += python/_libvserver.la
31 pyexec_SCRIPTS += python/libvserver.py
32 python__libvserver_la_SOURCES = python/_libvserver.c
33 Index: src/testsuite/hashcalc-plain.c
34 ===================================================================
35 --- src/testsuite/hashcalc-plain.c (revision 2883)
36 +++ src/testsuite/hashcalc-plain.c (revision 2896)
40 // Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
43 // This program is free software; you can redistribute it and/or modify
44 // it under the terms of the GNU General Public License as published by
45 // the Free Software Foundation; version 2 of the License.
48 // This program is distributed in the hope that it will be useful,
49 // but WITHOUT ANY WARRANTY; without even the implied warranty of
50 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51 // GNU General Public License for more details.
54 // You should have received a copy of the GNU General Public License
55 // along with this program; if not, write to the Free Software
56 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
61 +#include <sys/stat.h>
64 #define ENSC_TESTSUITE
67 static char const HEX_DIGIT[] = "0123456789abcdef";
68 size_t d_size = ensc_crypto_hashctx_get_digestsize(h_ctx);
71 unsigned char digest[d_size];
74 if (ensc_crypto_hashctx_get_digest(h_ctx, digest, NULL, d_size)==-1)
78 for (size_t in=0; in<d_size; ++in) {
79 res[out++] = HEX_DIGIT[digest[in] >> 4];
80 res[out++] = HEX_DIGIT[digest[in] & 0x0f];
89 assert(ensc_crypto_hashctx_update(&hash_context, buf, buf_size)!=-1);
90 munmap((void *)(buf), buf_size);
94 assert(convertDigest(digest, &hash_context));
97 Vwrite(1, digest, strlen(digest));
101 ensc_crypto_hashctx_free(&hash_context);
106 Index: src/testsuite/Makefile-files
107 ===================================================================
108 --- src/testsuite/Makefile-files (revision 2883)
109 +++ src/testsuite/Makefile-files (revision 2896)
111 ## $Id$ --*- makefile -*--
113 ## Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
116 ## This program is free software; you can redistribute it and/or modify
117 ## it under the terms of the GNU General Public License as published by
118 ## the Free Software Foundation; version 2 of the License.
121 ## This program is distributed in the hope that it will be useful,
122 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
123 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124 ## GNU General Public License for more details.
127 ## You should have received a copy of the GNU General Public License
128 ## along with this program; if not, write to the Free Software
129 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
131 src/testsuite/hashcalc-plain.sh \
132 src/testsuite/vwait-test.sh
134 +DIETPROGS += src/testsuite/vunify-functest \
135 + src/testsuite/chcontext-test \
136 + src/testsuite/chbind-test \
137 + src/testsuite/rpm-fake-test
139 src_testsuite_rpm_fake_test_SOURCES = src/testsuite/rpm-fake-test.c
141 src_testsuite_vunify_functest_SOURCES = src/testsuite/vunify-functest.c
142 src_testsuite_vunify_functest_LDADD = $(LIBINTERNAL)
143 src_testsuite_vunify_functest_CPPFLAGS= $(AM_CPPFLAGS) $(src_testsuite_CPPFLAGS)
146 src_testsuite_chcontext_test_SOURCES = src/testsuite/chcontext-test.c
147 -src_testsuite_chcontext_test_LDADD = lib/libvserver.la $(LIBINTERNAL)
148 +src_testsuite_chcontext_test_LDADD = $(VSERVER_LDADDS) $(LIBINTERNAL)
151 src_testsuite_chbind_test_SOURCES = src/testsuite/chbind-test.c
152 -src_testsuite_chbind_test_LDADD = lib/libvserver.la
153 +src_testsuite_chbind_test_LDADD = $(LIBVSERVER)
155 src_testsuite_hashcalc_SOURCES = src/testsuite/hashcalc.c
156 src_testsuite_hashcalc_plain_SOURCES = src/testsuite/hashcalc-plain.c
158 src_testsuite_hashcalc_plain_CFLAGS = $(AM_CFLAGS) $(ENSC_CRYPTO_CFLAGS)
160 if ENSC_CAN_CRYPTO_WITH_DIETLIBC
161 +DIETPROGS += src/testsuite/hashcalc \
162 + src/testsuite/hashcalc-plain
164 src_testsuite_hashcalc_LDADD = $(LIBINTERNAL) $(LIBENSCVECTOR) $(ENSC_CRYPTO_LIB) $(VSERVER_LDADDS)
165 src_testsuite_hashcalc_LDFLAGS = $(VSERVER_LDFLGS)
167 Index: src/vcontext.c
168 ===================================================================
169 --- src/vcontext.c (revision 2883)
170 +++ src/vcontext.c (revision 2896)
174 // Copyright (C) 2004-2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
177 // This program is free software; you can redistribute it and/or modify
178 // it under the terms of the GNU General Public License as published by
179 // the Free Software Foundation; version 2 of the License.
182 // This program is distributed in the hope that it will be useful,
183 // but WITHOUT ANY WARRANTY; without even the implied warranty of
184 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
185 // GNU General Public License for more details.
188 // You should have received a copy of the GNU General Public License
189 // along with this program; if not, write to the Free Software
190 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
195 +#include "compat-pivot_root.h"
196 #include "lib/internal.h"
197 #include "lib_internal/jail.h"
198 #include "lib_internal/sys_personality.h"
200 { "personality-flags", required_argument, 0, CMD_PERSFLAG },
201 { "vlogin", no_argument, 0, CMD_VLOGIN },
202 { "pivot-root", no_argument, 0, CMD_PIVOT_ROOT },
205 { "fakeinit", no_argument, 0, CMD_INITPID }, // compatibility
214 struct sockaddr_un addr;
217 if (filename==0) return -1;
219 ENSC_INIT_UNIX_SOCK(addr, filename);
221 doExternalSync(int fd, char const *msg)
228 if (msg) EsendAll(fd, msg, strlen(msg));
229 @@ -256,13 +257,13 @@
232 pid_t pid = initSync(p, args->do_disconnect);
237 int ext_sync_fd = connectExternalSync(args->sync_sock);
239 - doSyncStage0(p, args->do_disconnect);
241 + doSyncStage0(p, args->do_disconnect);
243 if (args->do_create) {
244 xid = vc_ctx_create(args->xid, NULL);
249 assert(args->do_disconnect);
252 waitOnSync(pid, p, args->xid!=VC_DYNAMIC_XID && args->do_migrate);
255 @@ -430,11 +431,11 @@
256 .personality_flags = 0,
262 int c = getopt_long(argc, argv, "+", CMDLINE_OPTIONS, 0);
267 case CMD_HELP : showHelp(1, argv[0], 0);
268 case CMD_VERSION : showVersion();
269 @@ -474,10 +475,10 @@
272 signal(SIGCHLD, SIG_DFL);
275 if (args.do_migrateself)
276 args.xid = Evc_get_task_xid(0);
279 if (!args.do_create && !args.do_migrate)
280 WRITE_MSG(2, "Neither '--create' nor '--migrate' specified; try '--help' for more information\n");
281 else if (args.do_create && args.do_migrate)
282 Index: scripts/vserver.suexec
283 ===================================================================
284 --- scripts/vserver.suexec (revision 2883)
285 +++ scripts/vserver.suexec (revision 2896)
288 $_EXEC_ULIMIT "$VSERVER_DIR/ulimits" \
289 ${USE_VNAMESPACE:+$_VNAMESPACE --enter "$S_CONTEXT" -- } \
290 - $_VSPACE --enter "$S_CONTEXT" "${OPTS_VSPACE[@]}" -- \
291 + $_VSPACE --enter "$S_CONTEXT" "${OPTS_VSPACE[@]}" "${OPTS_VSPACE_SHARED[@]}" -- \
292 $_VTAG --migrate "${OPTS_VTAG_ENTER[@]}" --silent -- \
293 $_VCONTEXT $SILENT_OPT --migrate $OPT_VCONTEXT_CHROOT \
294 --xid "$S_CONTEXT" --uid "$user" "${OPTS_VCONTEXT_ENTER[@]}" -- \
295 Index: scripts/vserver.stop
296 ===================================================================
297 --- scripts/vserver.stop (revision 2883)
298 +++ scripts/vserver.stop (revision 2896)
303 - "$_VSPACE" --enter "$S_CONTEXT" "${OPTS_VSPACE[@]}" -- \
304 + "$_VSPACE" --enter "$S_CONTEXT" "${OPTS_VSPACE[@]}" "${OPTS_VSPACE_SHARED[@]}" -- \
305 "$_VTAG" --migrate "${OPTS_VTAG_ENTER[@]}" --silent -- \
306 $_VCONTEXT $SILENT_OPT --migrate $OPT_VCONTEXT_CHROOT --xid "$S_CONTEXT" -- \
307 "${INITCMD_STOP[@]}" || fail=1
308 Index: scripts/vserver.start
309 ===================================================================
310 --- scripts/vserver.start (revision 2883)
311 +++ scripts/vserver.start (revision 2896)
313 if $_VSERVER_INFO - FEATURE migrate; then
316 + "${VSPACE_SHARED_CMD[@]}" \
318 $_EXEC_ULIMIT "$VSERVER_DIR"/ulimits \
319 $_VTAG --create "${OPTS_VTAG_CREATE[@]}" --silent -- \
321 $_VCONTEXT --create "${OPTS_VCONTEXT_CREATE[@]}" -- \
322 ${OPTION_STRACE:+$_STRACE -fF -o /tmp/vserver-start.$$} \
323 ${USE_VNAMESPACE:+$_VNAMESPACE --set -- } \
324 - $_VSPACE --set "${OPTS_VSPACE[@]}" -- \
325 + $_VSPACE --set "${OPTS_VSPACE[@]}" "${OPTS_VSPACE_SHARED[@]}" -- \
326 $_EXEC_REMOUNT /proc /sys -- \
327 $_VLIMIT --dir "$VSERVER_DIR"/rlimits --missingok -- \
328 $_VSCHED --xid self --force "${OPTS_VSCHED[@]}" -- \
329 Index: scripts/vserver.functions
330 ===================================================================
331 --- scripts/vserver.functions (revision 2883)
332 +++ scripts/vserver.functions (revision 2896)
334 declare -a OPTS_VTAG_ENTER=()
335 declare -a OPTS_VMEMCTRL=()
336 declare -a OPTS_VSPACE=( --default )
337 +declare -a OPTS_VSPACE_SHARED=()
338 +declare -a VSPACE_SHARED_CMD=()
340 declare -a STOPCMD_PREPARE=()
342 @@ -787,16 +789,30 @@
345 local d="$vdir"/spaces
348 - ( test ! -e "$d"/pid ) || \
349 - OPTS_VSPACE=( "${OPTS_VSPACE[@]}" --pid )
350 + if test -e "$d"/pid; then
351 + getFileValue shared "$d"/pid
352 + if test -z "$shared"; then
353 + OPTS_VSPACE=( "${OPTS_VSPACE[@]}" --pid )
355 + OPTS_VSPACE_SHARED=( "${OPTS_VSPACE_SHARED[@]}" --pid )
356 + VSPACE_SHARED_CMD=( "${VSPACE_SHARED_CMD[@]}" $_VSPACE --enter "$shared" --pid -- )
360 - test ! -e "$d"/net || {
361 - OPTS_VSPACE=( "${OPTS_VSPACE[@]}" --net )
362 + if test -e "$d"/net; then
363 + getFileValue shared "$d"/net
364 # network context and namespace don't make much sense
365 _HAVE_CHBIND_OPTIONS=1
368 + if test -z "$shared"; then
369 + OPTS_VSPACE=( "${OPTS_VSPACE[@]}" --net )
371 + OPTS_VSPACE_SHARED=( "${OPTS_VSPACE_SHARED[@]}" --net )
372 + VSPACE_SHARED_CMD=( "${VSPACE_SHARED_CMD[@]}" $_VSPACE --enter "$shared" --net -- )
377 getFileValue mask "$d"/mask || \
379 ===================================================================
380 --- configure.ac (revision 2883)
381 +++ configure.ac (revision 2896)
385 dnl Copyright (C) 2003,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
388 dnl This program is free software; you can redistribute it and/or modify
389 dnl it under the terms of the GNU General Public License as published by
390 dnl the Free Software Foundation; either version 2, or (at your option)
391 dnl any later version.
394 dnl This program is distributed in the hope that it will be useful,
395 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
396 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
397 dnl GNU General Public License for more details.
400 dnl You should have received a copy of the GNU General Public License
401 dnl along with this program; if not, write to the Free Software
402 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
407 dnl As a special exception to the GNU General Public License, if you
408 dnl distribute this file as part of a program that contains a configuration
409 dnl script generated by Autoconf, you may include it under the same
410 dnl distribution terms that you use for the rest of that program.
415 AC_INIT(util-vserver, 0.30.215, vserver@list.linux-vserver.org)
418 if test x"$prefix" = x/; then
423 ENSC_CHECK_CC_FLAG([-std=c99 -Wall -pedantic -W])
424 ENSC_CHECK_CXX_FLAG([-ansi -Wall -pedantic -W -fmessage-length=0])
426 [AC_HELP_STRING([--disable-internal-headers],
427 [use vserver specific headers from the kernel instead of the shipped versions (default: no)])],
428 [case "$enableval" in
430 - (*) AC_MSG_ERROR(['$i' is not a supported value for '--disable-internal-headers']);;
432 + (*) AC_MSG_ERROR(['$i' is not a supported value for '--disable-internal-headers']);;
434 [enable_internal_headers=yes])
436 @@ -258,14 +258,14 @@
437 enable_api_oldproc=${enable_api_oldproc:-1}
438 enable_api_olduts=${enable_api_olduts:-1}
440 - (v11) AC_DEFINE(VC_ENABLE_API_V11, 1)
441 + (v11) AC_DEFINE(VC_ENABLE_API_V11, 1)
442 enable_api_oldproc=${enable_api_oldproc:-1}
443 enable_api_olduts=${enable_api_olduts:-1}
445 (fscompat) AC_DEFINE(VC_ENABLE_API_FSCOMPAT, 1);;
446 (v13obs) AC_DEFINE(VC_ENABLE_API_V13OBS, 1)
447 AC_DEFINE(VC_ENABLE_API_V13, 1);;
448 - (v13) AC_DEFINE(VC_ENABLE_API_V13, 1);;
449 + (v13) AC_DEFINE(VC_ENABLE_API_V13, 1);;
450 (net) AC_DEFINE(VC_ENABLE_API_NET, 1);;
451 (v21) AC_DEFINE(VC_ENABLE_API_V21, 1);;
452 (v22) AC_DEFINE(VC_ENABLE_API_V22, 1);;
454 AC_CHECK_HEADER([beecrypt/beecrypt.h], [ : ],
455 [ ensc_have_beecrypt=no ])
459 if test x"$ensc_have_beecrypt" = xyes; then
460 AC_CHECK_LIB(beecrypt, hashFunctionContextInit, [ : ],
461 [ ensc_have_beecrypt=no ])
463 crypto api: $ensc_crypto_api
464 python bindings: $ensc_have_python
465 use library versioning: $ensc_have_versioning
470 sysconf-Directory: $sysconfdir
471 Index: lib/syscall_setiattr-fscompat.hc
472 ===================================================================
473 --- lib/syscall_setiattr-fscompat.hc (revision 2883)
474 +++ lib/syscall_setiattr-fscompat.hc (revision 2896)
478 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
481 // This program is free software; you can redistribute it and/or modify
482 // it under the terms of the GNU General Public License as published by
483 // the Free Software Foundation; version 2 of the License.
486 // This program is distributed in the hope that it will be useful,
487 // but WITHOUT ANY WARRANTY; without even the implied warranty of
488 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
489 // GNU General Public License for more details.
492 // You should have received a copy of the GNU General Public License
493 // along with this program; if not, write to the Free Software
494 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
496 #include "ioctl-getxflg.hc"
499 +#include <sys/stat.h>
501 static inline ALWAYSINLINE int
502 vc_set_iattr_fscompat(char const *filename,
505 fd = open(filename, O_RDONLY|O_NONBLOCK);
506 if (fd==-1) return -1;
509 stat_rc = fstat(fd, &st);
510 if (stat_rc==-1) goto err;
513 if (vc_X_set_ext2flags(fd, 0, VC_IMMUTABLE_LINK_FL)==-1 ||
520 if ( (mask&VC_IATTR_XID) &&
521 Index: lib/syscall_getiattr-fscompat.hc
522 ===================================================================
523 --- lib/syscall_getiattr-fscompat.hc (revision 2883)
524 +++ lib/syscall_getiattr-fscompat.hc (revision 2896)
528 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
531 // This program is free software; you can redistribute it and/or modify
532 // it under the terms of the GNU General Public License as published by
533 // the Free Software Foundation; version 2 of the License.
536 // This program is distributed in the hope that it will be useful,
537 // but WITHOUT ANY WARRANTY; without even the implied warranty of
538 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
539 // GNU General Public License for more details.
542 // You should have received a copy of the GNU General Public License
543 // along with this program; if not, write to the Free Software
544 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
546 #include "ioctl-getxflg.hc"
550 +#include <sys/stat.h>
552 static inline ALWAYSINLINE int
553 vc_get_iattr_fscompat(char const *filename,
554 xid_t * /*@null@*/ xid,
557 if ( (old_mask&VC_IATTR_BARRIER) && S_ISDIR(st.st_mode)) {
561 *mask |= VC_IATTR_BARRIER;
562 if ((st.st_mode&0777)==0 &&
563 vc_X_get_ext2flags(fd, &ext2_flags)!=-1 &&
571 Index: lib_internal/matchlist-initrefserverlist.c
572 ===================================================================
573 --- lib_internal/matchlist-initrefserverlist.c (revision 2883)
574 +++ lib_internal/matchlist-initrefserverlist.c (revision 2896)
578 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
581 // This program is free software; you can redistribute it and/or modify
582 // it under the terms of the GNU General Public License as published by
583 // the Free Software Foundation; version 2 of the License.
586 // This program is distributed in the hope that it will be useful,
587 // but WITHOUT ANY WARRANTY; without even the implied warranty of
588 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
589 // GNU General Public License for more details.
592 // You should have received a copy of the GNU General Public License
593 // along with this program; if not, write to the Free Software
594 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
599 +#include <sys/stat.h>
601 #define ENSC_WRAPPERS_FCNTL 1
602 #define ENSC_WRAPPERS_UNISTD 1
604 int cur_dir = Eopen(".", O_RDONLY, 0);
605 struct dirent **entries;
610 count = scandir(".", &entries, selectRefserver, alphasort);
613 *lst = Emalloc(sizeof(struct MatchList) * count);
615 for (i=0; i<count; ++i) {
616 - char const *tmp = entries[i]->d_name;
617 + char const *tmp = entries[i]->d_name;
618 size_t l = strlen(tmp);
619 char vname[sizeof("./") + l];
620 struct MatchVserverInfo vserver = {
623 memcpy(vname, "./", 2);
624 memcpy(vname+2, tmp, l+1);
627 if (!MatchVserverInfo_init(&vserver)) {
628 WRITE_MSG(2, "failed to initialize unification of reference vserver\n");
630 Index: ensc_vector/testsuite/Makefile-files
631 ===================================================================
632 --- ensc_vector/testsuite/Makefile-files (revision 2883)
633 +++ ensc_vector/testsuite/Makefile-files (revision 2896)
635 ## $Id$ --*- makefile -*--
637 ## Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
640 ## This program is free software; you can redistribute it and/or modify
641 ## it under the terms of the GNU General Public License as published by
642 ## the Free Software Foundation; version 2 of the License.
645 ## This program is distributed in the hope that it will be useful,
646 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
647 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
648 ## GNU General Public License for more details.
651 ## You should have received a copy of the GNU General Public License
652 ## along with this program; if not, write to the Free Software
653 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
655 TESTS += ensc_vector/testsuite/test1 \
656 ensc_vector/testsuite/test2
658 +DIETPROGS += ensc_vector/testsuite/test1 \
659 + ensc_vector/testsuite/test2
661 ensc_vector_testsuite_test1_SOURCES = ensc_vector/testsuite/test1.c
662 ensc_vector_testsuite_test1_LDADD = $(LIBENSCVECTOR)