debian/0000755000000000000000000000000012236427460007174 5ustar debian/docs0000644000000000000000000000003112236427214010036 0ustar readme_cn.txt readme.txt debian/rules0000755000000000000000000000062112236427214010250 0ustar #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # To enable all, uncomment following line export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_CFLAGS_MAINT_APPEND = -DLinux -Wall -I. -DTAP -DHV -Wno-strict-aliasing export DEB_LDFLAGS_MAINT_APPEND = -lpthread -lutil -s %: dh $@ override_dh_auto_clean: $(MAKE) -C src -f Makefile.linux clean rm -f vpcs debian/watch0000644000000000000000000000032312236427214010220 0ustar version=3 opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|BETA|beta|alpha|b|a)[\-\.]?\d*)$/$1~$2/ \ http://qa.debian.org/watch/sf.php/vpcs/vpcs-(\d.*)-(?:src|source)\.(?:tgz|tbz|tbz2|txz|tar\.(?:gz|bz2|xz)) debian/patches/0000755000000000000000000000000012236427214010620 5ustar debian/patches/LinuxMakefilePatch0000644000000000000000000000156612236427214014270 0ustar Description: Patch Makefile.linux Modify upstream linux Makefile to allow hardening/autobuilding Author: Daniel Lintott --- vpcs-0.5b0.orig/src/Makefile.linux +++ vpcs-0.5b0/src/Makefile.linux @@ -1,12 +1,11 @@ RM=rm -f -CC=gcc $(CCOPT) +CC=gcc OSTYPE=Linux -CPUTYPE=i386 OPT=-O2 HVOPT=-DHV -CFLAGS=-D$(OSTYPE) -D$(CPUTYPE) $(OPT) $(HVOPT) -Wall -I. -DTAP -LDFLAGS=-lpthread -lutil -s -static +CFLAGS?=-D$(OSTYPE) -D$(CPUTYPE) $(OPT) $(HVOPT) -Wall -I. -DTAP +LDFLAGS?=-lpthread -lutil -s -static OBJS=vpcs.o \ daemon.o \ readline.o \ @@ -31,10 +30,10 @@ OBJS=vpcs.o \ all: vpcs vpcs: $(OBJS) - $(CC) $(OBJS) -o vpcs $(LDFLAGS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(OBJS) -o vpcs $(LDFLAGS) .c.o: keys.h vpcs.h packets.h dhcp.h - $(CC) $(INCLUDE_PATH) $(CFLAGS) -c $< + $(CC) $(INCLUDE_PATH) $(CPPFLAGS) $(CFLAGS) -c $< clean: $(RM) *.o vpcs debian/patches/echild_fix0000644000000000000000000000136112236427214012642 0ustar Description: Fix ECHILD error Fix the ECHILD error that was present under kFreeBSD Author: Petr Salinger Origin: other --- Index: vpcs/src/hv.c =================================================================== --- vpcs.orig/src/hv.c 2013-10-08 11:18:05.625004770 +0100 +++ vpcs/src/hv.c 2013-10-08 11:19:39.219828123 +0100 @@ -156,15 +156,16 @@ goto ret; } #endif - signal(SIGCHLD, SIG_IGN); - signal(SIGPIPE, SIG_IGN); - memset(vpcs_list, 0, MAX_DAEMONS * sizeof(struct list)); if (openpty(&ptyfdm, &ptyfds, NULL, NULL, NULL)) { perror("Create pseudo-terminal"); goto ret; } + + signal(SIGCHLD, SIG_IGN); + signal(SIGPIPE, SIG_IGN); + fptys = fdopen(ptyfds, "w"); rls = readline_init(50, 128); debian/patches/series0000644000000000000000000000014712236427214012037 0ustar ManpageFix LinuxMakefilePatch CreateTopLevelMakefile BuildOnGNUkFreeBSD HypervisorPathPatch echild_fix debian/patches/BuildOnGNUkFreeBSD0000644000000000000000000000145012236427214013757 0ustar Description: Build also on GNU/kfreeBSD Author: Juhani Numminen --- vpcs-0.5b0.orig/src/daemon.c +++ vpcs-0.5b0/src/daemon.c @@ -51,7 +51,7 @@ #ifdef Darwin #include -#elif Linux +#elif Linux || GNUkFreeBSD #include #elif FreeBSD #include --- vpcs-0.5b0.orig/src/hv.c +++ vpcs-0.5b0/src/hv.c @@ -55,7 +55,7 @@ #ifdef Darwin #include -#elif Linux +#elif Linux || GNUkFreeBSD #include #elif FreeBSD #include @@ -389,7 +389,7 @@ run_vpcs(int ac, char **av) /* reinitialized, maybe call getopt twice */ optind = 1; -#if (defined(FreeBSD) || defined(Darwin)) +#if ((!defined(GNUkFreeBSD) && defined(FreeBSD)) || defined(Darwin)) optreset = 1; #endif while ((c = getopt(ac, av, "p:m:s:c:")) != -1) { debian/patches/HypervisorPathPatch0000644000000000000000000000363512236427214014521 0ustar Description: Fix bug in hv.c finding vpcs in path Author: Paul Meng Origin: upstream --- --- ../hv.c 2013-09-29 21:11:50.381533000 +0100 +++ ./src/hv.c 2013-09-29 21:14:33.167486729 +0100 @@ -78,6 +78,7 @@ static void* pty_slave(void *arg); static void clean(void); static int hypervisor(int port); +static char *getpath(const char *name); extern int vpcs(int argc, char **argv); extern int help_rlogin(int argc, char **argv); @@ -130,7 +131,7 @@ /* using windows native API to get 'real' path */ if (GetModuleFileName(NULL, prgname, PATH_MAX) == 0) { #else - if (!realpath(argv[0], prgname)) { + if (!getpath(argv[0])) { #endif printf("Can not get file path\n"); return 1; @@ -733,6 +734,69 @@ return 0; } +static int +is_there(char *candidate) +{ + struct stat fin; + + /* XXX work around access(2) false positives for superuser */ + if (access(candidate, X_OK) == 0 && + stat(candidate, &fin) == 0 && + S_ISREG(fin.st_mode) && + (getuid() != 0 || + (fin.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0)) { + return (1); + } + return (0); +} + + +static char * +getpath(const char *name) +{ + char *pathenv = NULL, *env; + const char *d; + int found; + char rpath[PATH_MAX]; + + if (strchr(name, '/') != NULL) { + strcpy(rpath, name); + if (is_there(rpath)) { + found = 1; + goto ret; + } else + return NULL; + } + + if (getenv("PATH") == NULL) + return NULL; + + pathenv = strdup(getenv("PATH")); + if (pathenv == NULL) + return NULL; + + found = 0; + env = pathenv; + while ((d = strsep(&env, ":")) != NULL) { + if (*d == '\0') + d = "."; + if (snprintf(rpath, sizeof(rpath), "%s/%s", d, name) >= + (int)sizeof(rpath)) + continue; + if (is_there(rpath)) { + found = 1; + break; + } + } + + free(pathenv); +ret: + if (found) { + return realpath(rpath, prgname); + } else + return NULL; +} + static int run_help(int ac, char **av) { debian/patches/CreateTopLevelMakefile0000644000000000000000000000212712236427214015061 0ustar Description: Create a top level makefile The original source package does not include a top-level makefile, so we create one. Author: Daniel Lintott Index: vpcs/Makefile =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ vpcs/Makefile 2013-09-27 12:05:16.658688079 +0100 @@ -0,0 +1,32 @@ +# Makefile for VPCS 0.5b0 + +# Operating System Type +# Linux = linux +# Windows = cygwin +# MacOSX = osx +# FreeBSD = fbsd +export VPCS_OS?=linux + +# Executable binary extension +export PREFIX?=/usr +export BIN_EXT?= + + +.PHONY: all install clean +all: vpcs + +vpcs: + @echo Building VPCS for $(VPCS_OS) on $(ARCH) + $(MAKE) -C src -f Makefile.$(VPCS_OS) + mv src/vpcs vpcs$(BIN_EXT) + +install: vpcs$(BIN_EXT) + @echo "Installing VPCS to $(DESTDIR)" + install -d $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1 + install vpcs$(BIN_EXT) $(DESTDIR)$(PREFIX)/bin/ + install -m644 man/vpcs.1 $(DESTDIR)$(PREFIX)/share/man/man1/ + +clean: + $(MAKE) -C src -f Makefile.$(VPCS_OS) clean + $(RM) -f vpcs$(BIN_EXT) + debian/patches/ManpageFix0000644000000000000000000000216712236427214012570 0ustar Description: Manpage fix Author: Daniel Lintott Index: vpcs/man/vpcs.1 =================================================================== --- vpcs.orig/man/vpcs.1 2013-09-26 12:56:09.233018287 +0100 +++ vpcs/man/vpcs.1 2013-09-26 12:57:01.328363361 +0100 @@ -1,6 +1,6 @@ .TH VPCS "1" "2013-09-20" "0.5" "Virtual PC Simulator" -./ Last revision: 2013-09-20 16:25:50 +.\" Last revision: 2013-09-20 16:25:50 .hy 0 .if n .ad l @@ -155,7 +155,7 @@ \fBsleep\fR [text] Print and pause the running script for .TP -\fBtrace\fR [-options] +\fBtrace\fR [\-options] Print the path packets take to network .TP \fBversion\fR @@ -184,7 +184,7 @@ \fBdisconnect\fR Exit the telnet session .TP -\fBquit\fR [-f] +\fBquit\fR [\-f] Stop \fBvpcs\fR processes and hypervisor, \fI-f\fR force quit without prompting .TP @@ -210,4 +210,4 @@ .br Source code and license can be found at vpcs.sf.net. .br -For more information, please visit wiki.freecode.com.cn. \ No newline at end of file +For more information, please visit wiki.freecode.com.cn. debian/copyright0000644000000000000000000000472612236427214011135 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: vpcs Source: http://sourceforge.net/projects/vpcs/ Files: * Copyright: 2007-2013 Paul Meng License: BSD-2-Clause Files: src/getopt.* Copyright: 2002-2003 Mark K. Kim License: BSD-2-Clause Files: src/inet6.c Copyright: 1996-1999 Internet Systems Consortium 2004 Internet Systems Consortium, Inc. License: ISC Files: debian/* Copyright: 2013 Daniel Lintott License: BSD-2-Clause License: BSD-2-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. License: ISC Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. . THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. debian/compat0000644000000000000000000000000212236427214010367 0ustar 9 debian/control0000644000000000000000000000120312236427214010570 0ustar Source: vpcs Section: net Priority: optional Maintainer: Daniel Lintott Build-Depends: debhelper (>= 9) Standards-Version: 3.9.4 Homepage: http://sourceforge.net/projects/vpcs/ Vcs-Browser: https://github.com/dlintott/vpcs Vcs-Git: https://github.com/dlintott/vpcs.git Package: vpcs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: virtual PC simulator for Dynamips VPCS can simulate up to 9 PCs. You can ping/traceroute to them or ping/traceroute to other hosts/routers from the VPCS. . VPCS is not intended to be a fully functional PC, but is a tool to be used together with Dynamips. debian/changelog0000644000000000000000000000023112236427214011037 0ustar vpcs (0.5b0-1) unstable; urgency=low * Initial release. (Closes: #720196) -- Daniel Lintott Wed, 06 Nov 2013 11:42:03 +0000 debian/source/0000755000000000000000000000000012236427214010471 5ustar debian/source/format0000644000000000000000000000001412236427214011677 0ustar 3.0 (quilt)