From 68b63ac0f058fae066f512e89544c68047a1405c Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Tue, 29 Mar 2016 21:39:53 -0700 Subject: [PATCH 1/6] opensshlib: don't include missing file --- opensshlib/cipher-ctr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensshlib/cipher-ctr.c b/opensshlib/cipher-ctr.c index d9452861..09ad1abe 100644 --- a/opensshlib/cipher-ctr.c +++ b/opensshlib/cipher-ctr.c @@ -31,7 +31,7 @@ /* compatibility with old or broken OpenSSL versions */ #ifndef WIN32 -#include "openbsd-compat/openssl-compat.h" +#include "openbsd-compat.h" #endif #ifndef USE_BUILTIN_RIJNDAEL From dfa271bd882a9b20ce4b014f3bc4878aca8c738d Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Tue, 29 Mar 2016 21:54:00 -0700 Subject: [PATCH 2/6] Update flags and configure for minimum OS X 10.9 and i386 arch only (no ppc) --- macosx/Makefile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/macosx/Makefile b/macosx/Makefile index d2d74b25..a7f21033 100644 --- a/macosx/Makefile +++ b/macosx/Makefile @@ -19,19 +19,17 @@ PACKAGEMAKER = /Developer/usr/bin/packagemaker EXTRA_DIST_FILES = $(addprefix $(IMAGE_STAGING_DIR)/,COPYING README) -CONFIGURE_ARGS = --prefix="$(PREFIX)" CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" +CONFIGURE_ARGS = --prefix="$(PREFIX)" --without-openssl-header-check CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" # Flags for building universal binaries. See # http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html. UNIVERSAL_CONFIGURE_ARGS = --disable-dependency-tracking -# gcc-4.0 is used to avoid an error with stdarg.h ("No such file or directory") -# when building against the 10.4u SDK on OS X 10.6. -UNIVERSAL_CC = gcc-4.0 -UNIVERSAL_CXX = g++-4.0 -UNIVERSAL_CPPFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -UNIVERSAL_CFLAGS = $(UNIVERSAL_CPPFLAGS) -mmacosx-version-min=10.4 -arch ppc -arch i386 +UNIVERSAL_CC = gcc +UNIVERSAL_CXX = g++ +UNIVERSAL_CPPFLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk +UNIVERSAL_CFLAGS = $(UNIVERSAL_CPPFLAGS) -mmacosx-version-min=10.9 -arch i386 UNIVERSAL_CXXFLAGS = $(UNIVERSAL_CFLAGS) -UNIVERSAL_LDFLAGS = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc -arch i386 +UNIVERSAL_LDFLAGS = -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -arch i386 CC = $(UNIVERSAL_CC) CXX = $(UNIVERSAL_CXX) From 94e48def2451e7094ec05e552337e93c48ca9cbb Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Tue, 29 Mar 2016 21:54:29 -0700 Subject: [PATCH 3/6] Update svn commands to git for Github hosting --- macosx/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macosx/Makefile b/macosx/Makefile index a7f21033..409c2835 100644 --- a/macosx/Makefile +++ b/macosx/Makefile @@ -49,8 +49,8 @@ $(IMAGE_STAGING_DIR)/$(PKG_NAME): stage-ncrack README COPYING.formatted export-%: rm -rf $* -# Using @BASE discards local changes. - svn export ..@BASE $* + mkdir $* + git -C .. archive master | tar -x -C $* stage-ncrack: export-$(NCRACK_BUILD_DIR) cd $(NCRACK_BUILD_DIR) && ./configure $(CONFIGURE_ARGS) From 4a73216a76d2a5d54e7e5cb2cfb98cb1dfc4c56e Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Tue, 29 Mar 2016 21:56:04 -0700 Subject: [PATCH 4/6] Use configured CXXFLAGS for modules, too. Avoid linking errors with -arch != native --- modules/Makefile.in | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/Makefile.in b/modules/Makefile.in index 83e8ad29..ba7762d4 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -6,6 +6,7 @@ OBJS = @MODULES_OBJS@ include_dirs := .. ../nsock/include ../nbase ../opensshlib CPPFLAGS += $(addprefix -I,$(include_dirs)) -DHAVE_CONFIG_H +CXXFLAGS = @CXXFLAGS@ vpath %.h $(include_dirs) From 279fd3c38453249698dfb82e7fe00d38e89b41a1 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Wed, 30 Mar 2016 06:02:13 -0700 Subject: [PATCH 5/6] Ignore a few more generated files --- .gitignore | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 386c6c31..009e0130 100644 --- a/.gitignore +++ b/.gitignore @@ -28,12 +28,18 @@ nbase/Release/ nbase/nbase.lib nbase/nbase.pdb nbase/nbase.vcxproj.user +nbase/Makefile +nbase/nbase_config.h nsock/DebugNoPcap/ nsock/ReleaseNoPcap/ nsock/nsock.lib nsock/nsock.vcxproj.user +nsock/include/nsock_config.h +nsock/src/Makefile +nsock/tests/Makefile opensshlib/Debug/ opensshlib/Release/ opensshlib/openssh.vcxproj.user opensshlib/opensshlib.lib -opensshlib/opensshlib.pdb \ No newline at end of file +opensshlib/opensshlib.pdb +opensshlib/buildpkg.sh From 194aa6d64928f8f1378133c5e5bdea4156d36631 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Wed, 30 Mar 2016 06:05:44 -0700 Subject: [PATCH 6/6] Remove generated files from source control --- nbase/Makefile | 65 ---- nbase/nbase_config.h | 272 -------------- nsock/include/nsock_config.h | 91 ----- nsock/src/Makefile | 97 ----- nsock/tests/Makefile | 41 --- opensshlib/buildpkg.sh | 684 ----------------------------------- 6 files changed, 1250 deletions(-) delete mode 100644 nbase/Makefile delete mode 100644 nbase/nbase_config.h delete mode 100644 nsock/include/nsock_config.h delete mode 100644 nsock/src/Makefile delete mode 100644 nsock/tests/Makefile delete mode 100644 opensshlib/buildpkg.sh diff --git a/nbase/Makefile b/nbase/Makefile deleted file mode 100644 index 54713059..00000000 --- a/nbase/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -prefix = /usr/local -datarootdir = ${prefix}/share -exec_prefix = ${prefix} -bindir = ${exec_prefix}/bin -sbindir = ${exec_prefix}/sbin -mandir = ${datarootdir}/man -srcdir = . - -CC = gcc -AR = ar -RANLIB = ranlib -CCOPT = -DEFS = -DHAVE_CONFIG_H -# With GCC, add extra security checks to source code. -DEFS += -D_FORTIFY_SOURCE=2 -CPPFLAGS = -CFLAGS = -g -O2 -Wall $(CCOPT) $(GLIB_CFLAGS) $(DEFS) $(INCLS) -STATIC = -LDFLAGS = $(STATIC) -LIBS = -lssl -lcrypto -SHTOOL = ./shtool -INSTALL = $(SHTOOL) install -MAKEDEPEND = @MAKEDEPEND@ - -TARGET = libnbase.a - -DEPS = getopt.h nbase.h nbase_winconfig.h nbase_config.h nbase_ipv6.h nbase_winunix.h nbase_crc32ct.h nbase_addrset.h -OBJS = ${LIBOBJDIR}snprintf$U.o ${LIBOBJDIR}nbase_str$U.o ${LIBOBJDIR}nbase_misc$U.o ${LIBOBJDIR}nbase_memalloc$U.o ${LIBOBJDIR}nbase_rnd$U.o ${LIBOBJDIR}nbase_addrset$U.o - -all: $(TARGET) - -$(TARGET): $(DEPS) $(OBJS) - rm -f $@ - $(AR) cr $@ $(OBJS) - $(RANLIB) $@ - -clean: - rm -f $(OBJS) $(TARGET) - -distclean: clean - rm -f Makefile config.cache config.log config.status nbase_config.h - -depend: - $(MAKEDEPEND) $(INCLS) -s "# DO NOT DELETE" -- $(DEFS) -- $(SRCS) - -configure: configure.ac - autoconf - -Makefile: Makefile.in config.status - ./config.status - -config.status: configure - ./config.status --recheck - -.cc.o: - $(CC) -c $(CFLAGS) $*.cc - -# DO NOT DELETE -- Needed by makedepend - - - - - - - diff --git a/nbase/nbase_config.h b/nbase/nbase_config.h deleted file mode 100644 index 8d61cd71..00000000 --- a/nbase/nbase_config.h +++ /dev/null @@ -1,272 +0,0 @@ -/* nbase_config.h. Generated from nbase_config.h.in by configure. */ - -/*************************************************************************** - * nbase_config.h.in -- Autoconf uses this template, combined with the * - * configure script knowledge about system capabilities, to build the * - * nbase_config.h file that lets nbase (and libraries that call it) better * - * understand system particulars. * - * * - ***********************IMPORTANT NMAP LICENSE TERMS************************ - * * - * The Nmap Security Scanner is (C) 1996-2015 Insecure.Com LLC. Nmap is * - * also a registered trademark of Insecure.Com LLC. This program is free * - * software; you may redistribute and/or modify it under the terms of the * - * GNU General Public License as published by the Free Software * - * Foundation; Version 2 ("GPL"), BUT ONLY WITH ALL OF THE CLARIFICATIONS * - * AND EXCEPTIONS DESCRIBED HEREIN. This guarantees your right to use, * - * modify, and redistribute this software under certain conditions. If * - * you wish to embed Nmap technology into proprietary software, we sell * - * alternative licenses (contact sales@nmap.com). Dozens of software * - * vendors already license Nmap technology such as host discovery, port * - * scanning, OS detection, version detection, and the Nmap Scripting * - * Engine. * - * * - * Note that the GPL places important restrictions on "derivative works", * - * yet it does not provide a detailed definition of that term. To avoid * - * misunderstandings, we interpret that term as broadly as copyright law * - * allows. For example, we consider an application to constitute a * - * derivative work for the purpose of this license if it does any of the * - * following with any software or content covered by this license * - * ("Covered Software"): * - * * - * o Integrates source code from Covered Software. * - * * - * o Reads or includes copyrighted data files, such as Nmap's nmap-os-db * - * or nmap-service-probes. * - * * - * o Is designed specifically to execute Covered Software and parse the * - * results (as opposed to typical shell or execution-menu apps, which will * - * execute anything you tell them to). * - * * - * o Includes Covered Software in a proprietary executable installer. The * - * installers produced by InstallShield are an example of this. Including * - * Nmap with other software in compressed or archival form does not * - * trigger this provision, provided appropriate open source decompression * - * or de-archiving software is widely available for no charge. For the * - * purposes of this license, an installer is considered to include Covered * - * Software even if it actually retrieves a copy of Covered Software from * - * another source during runtime (such as by downloading it from the * - * Internet). * - * * - * o Links (statically or dynamically) to a library which does any of the * - * above. * - * * - * o Executes a helper program, module, or script to do any of the above. * - * * - * This list is not exclusive, but is meant to clarify our interpretation * - * of derived works with some common examples. Other people may interpret * - * the plain GPL differently, so we consider this a special exception to * - * the GPL that we apply to Covered Software. Works which meet any of * - * these conditions must conform to all of the terms of this license, * - * particularly including the GPL Section 3 requirements of providing * - * source code and allowing free redistribution of the work as a whole. * - * * - * As another special exception to the GPL terms, Insecure.Com LLC grants * - * permission to link the code of this program with any version of the * - * OpenSSL library which is distributed under a license identical to that * - * listed in the included docs/licenses/OpenSSL.txt file, and distribute * - * linked combinations including the two. * - * * - * Any redistribution of Covered Software, including any derived works, * - * must obey and carry forward all of the terms of this license, including * - * obeying all GPL rules and restrictions. For example, source code of * - * the whole work must be provided and free redistribution must be * - * allowed. All GPL references to "this License", are to be treated as * - * including the terms and conditions of this license text as well. * - * * - * Because this license imposes special exceptions to the GPL, Covered * - * Work may not be combined (even as part of a larger work) with plain GPL * - * software. The terms, conditions, and exceptions of this license must * - * be included as well. This license is incompatible with some other open * - * source licenses as well. In some cases we can relicense portions of * - * Nmap or grant special permissions to use it in other open source * - * software. Please contact fyodor@nmap.org with any such requests. * - * Similarly, we don't incorporate incompatible open source software into * - * Covered Software without special permission from the copyright holders. * - * * - * If you have any questions about the licensing restrictions on using * - * Nmap in other works, are happy to help. As mentioned above, we also * - * offer alternative license to integrate Nmap into proprietary * - * applications and appliances. These contracts have been sold to dozens * - * of software vendors, and generally include a perpetual license as well * - * as providing for priority support and updates. They also fund the * - * continued development of Nmap. Please email sales@nmap.com for further * - * information. * - * * - * If you have received a written license agreement or contract for * - * Covered Software stating terms other than these, you may choose to use * - * and redistribute Covered Software under those terms instead of these. * - * * - * Source is provided to this software because we believe users have a * - * right to know exactly what a program is going to do before they run it. * - * This also allows you to audit the software for security holes. * - * * - * Source code also allows you to port Nmap to new platforms, fix bugs, * - * and add new features. You are highly encouraged to send your changes * - * to the dev@nmap.org mailing list for possible incorporation into the * - * main distribution. By sending these changes to Fyodor or one of the * - * Insecure.Org development mailing lists, or checking them into the Nmap * - * source code repository, it is understood (unless you specify otherwise) * - * that you are offering the Nmap Project (Insecure.Com LLC) the * - * unlimited, non-exclusive right to reuse, modify, and relicense the * - * code. Nmap will always be available Open Source, but this is important * - * because the inability to relicense code has caused devastating problems * - * for other Free Software projects (such as KDE and NASM). We also * - * occasionally relicense the code to third parties as discussed above. * - * If you wish to specify special license conditions of your * - * contributions, just say so when you send them. * - * * - * This program is distributed in the hope that it will be useful, but * - * WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Nmap * - * license file for more details (it's in a COPYING file included with * - * Nmap, and also available from https://svn.nmap.org/nmap/COPYING) * - * * - ***************************************************************************/ - -/* $Id: nbase_config.h.in 34574 2015-06-03 13:01:29Z dmiller $ */ -#ifndef NBASE_CONFIG_H -#define NBASE_CONFIG_H - -#define HAVE_USLEEP 1 - -#define HAVE_NANOSLEEP 1 - -/* #undef HAVE_STRUCT_ICMP */ - -/* #undef HAVE_IP_IP_SUM */ - -/* #undef inline */ - -#define STDC_HEADERS 1 - -#define HAVE_STRING_H 1 - -#define HAVE_NETDB_H 1 - -#define HAVE_GETOPT_H 1 - -#define HAVE_UNISTD_H 1 - -#define HAVE_STRINGS_H 1 - -/* #undef HAVE_BSTRING_H */ - -/* #undef WORDS_BIGENDIAN */ - -#define HAVE_MEMORY_H 1 - -/* #undef HAVE_LIBIBERTY_H */ - -#define HAVE_FCNTL_H 1 - -#define HAVE_ERRNO_H 1 - -/* both bzero() and memcpy() are used in the source */ -/* #undef HAVE_BZERO */ -/* #undef HAVE_MEMCPY */ -#define HAVE_STRERROR 1 - -#define HAVE_SYS_PARAM_H 1 - -#define HAVE_SYS_SELECT_H 1 - -/* #undef HAVE_SYS_SOCKIO_H */ - -#define HAVE_SYS_SOCKET_H 1 - -#define HAVE_SYS_WAIT_H 1 - -#define HAVE_NET_IF_H 1 - -/* #undef BSD_NETWORKING */ - -#define HAVE_STRCASESTR 1 - -#define HAVE_STRCASECMP 1 - -#define HAVE_STRNCASECMP 1 - -#define HAVE_GETTIMEOFDAY 1 - -#define HAVE_SLEEP 1 - -#define HAVE_SIGNAL 1 - -#define HAVE_GETOPT 1 - -#define HAVE_GETOPT_LONG_ONLY 1 - -/* #undef HAVE_SOCKADDR_SA_LEN */ - -/* #undef HAVE_NETINET_IF_ETHER_H */ - -#define HAVE_NETINET_IN_H 1 - -#define HAVE_SYS_TIME_H 1 - -/* #undef PWD_H */ - -#define HAVE_ARPA_INET_H 1 - -#define HAVE_SYS_RESOURCE_H 1 - -#define HAVE_INTTYPES_H 1 - -/* #undef HAVE_MACH_O_DYLD_H */ - -/* #undef HAVE_RPC_TYPES_H */ - -#define HAVE_SYS_STAT_H 1 - -/* #undef SPRINTF_RETURNS_STRING */ - -/* #undef STUPID_SOLARIS_CHECKSUM_BUG */ - -/* IPv6 stuff */ -#define HAVE_IPV6 1 -#define HAVE_AF_INET6 1 -#define HAVE_SOCKADDR_IN6 1 -#define HAVE_SOCKADDR_STORAGE 1 -#define HAVE_GETADDRINFO 1 -#define HAVE_GAI_STRERROR 1 -#define HAVE_GETNAMEINFO 1 -#define HAVE_INET_NTOP 1 -#define HAVE_INET_PTON 1 - -/* #undef int8_t */ -/* #undef int16_t */ -/* #undef int32_t */ -/* #undef int64_t */ -/* #undef uint8_t */ -/* #undef uint16_t */ -/* #undef uint32_t */ -/* #undef uint64_t */ - -#define HAVE_SNPRINTF 1 -/* #undef HAVE_VASNPRINTF */ -#define HAVE_ASPRINTF 1 -#define HAVE_VASPRINTF 1 -/* #undef HAVE_VFPRINTF */ -#define HAVE_VSNPRINTF 1 -/* #undef NEED_SNPRINTF_PROTO */ -/* #undef NEED_VSNPRINTF_PROTO */ - -/* define if your compiler has __attribute__ */ -#define HAVE___ATTRIBUTE__ 1 - -#define HAVE_OPENSSL 1 - -#define HAVE_PROC_SELF_EXE 1 - -/* #undef LINUX */ -/* #undef FREEBSD */ -/* #undef OPENBSD */ -/* #undef SOLARIS */ -/* #undef SUNOS */ -/* #undef BSDI */ -/* #undef IRIX */ -/* #undef HPUX */ -/* #undef NETBSD */ - -#endif /* NBASE_CONFIG_H */ diff --git a/nsock/include/nsock_config.h b/nsock/include/nsock_config.h deleted file mode 100644 index d77a7e8c..00000000 --- a/nsock/include/nsock_config.h +++ /dev/null @@ -1,91 +0,0 @@ -/* ../include/nsock_config.h. Generated from nsock_config.h.in by configure. */ -/*************************************************************************** - * nsock_config.h.in -- Autoconf uses this template, combined with the * - * configure script knowledge about system capabilities, to build the * - * nsock_config.h include file that lets nsock better understand system * - * particulars. * - * * - ***********************IMPORTANT NSOCK LICENSE TERMS*********************** - * * - * The nsock parallel socket event library is (C) 1999-2015 Insecure.Com * - * LLC This library is free software; you may redistribute and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; Version 2. This guarantees * - * your right to use, modify, and redistribute this software under certain * - * conditions. If this license is unacceptable to you, Insecure.Com LLC * - * may be willing to sell alternative licenses (contact * - * sales@insecure.com ). * - * * - * As a special exception to the GPL terms, Insecure.Com LLC grants * - * permission to link the code of this program with any version of the * - * OpenSSL library which is distributed under a license identical to that * - * listed in the included docs/licenses/OpenSSL.txt file, and distribute * - * linked combinations including the two. You must obey the GNU GPL in all * - * respects for all of the code used other than OpenSSL. If you modify * - * this file, you may extend this exception to your version of the file, * - * but you are not obligated to do so. * - * * - * If you received these files with a written license agreement stating * - * terms other than the (GPL) terms above, then that alternative license * - * agreement takes precedence over this comment. * - * * - * Source is provided to this software because we believe users have a * - * right to know exactly what a program is going to do before they run it. * - * This also allows you to audit the software for security holes. * - * * - * Source code also allows you to port Nmap to new platforms, fix bugs, * - * and add new features. You are highly encouraged to send your changes * - * to the dev@nmap.org mailing list for possible incorporation into the * - * main distribution. By sending these changes to Fyodor or one of the * - * Insecure.Org development mailing lists, or checking them into the Nmap * - * source code repository, it is understood (unless you specify otherwise) * - * that you are offering the Nmap Project (Insecure.Com LLC) the * - * unlimited, non-exclusive right to reuse, modify, and relicense the * - * code. Nmap will always be available Open Source, but this is important * - * because the inability to relicense code has caused devastating problems * - * for other Free Software projects (such as KDE and NASM). We also * - * occasionally relicense the code to third parties as discussed above. * - * If you wish to specify special license conditions of your * - * contributions, just say so when you send them. * - * * - * This program is distributed in the hope that it will be useful, but * - * WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * General Public License v2.0 for more details * - * (http://www.gnu.org/licenses/gpl-2.0.html). * - * * - ***************************************************************************/ - -/* $Id: nsock_config.h.in 34574 2015-06-03 13:01:29Z dmiller $ */ - -/* #undef HAVE_PCAP */ -/* #undef DEC */ -#define LINUX 1 -/* #undef FREEBSD */ -/* #undef OPENBSD */ -/* #undef SOLARIS */ -/* #undef SUNOS */ -/* #undef BSDI */ -/* #undef IRIX */ -/* #undef HPUX */ -/* #undef NETBSD */ -/* #undef MACOSX */ - -/* #undef SOLARIS_BPF_PCAP_CAPTURE */ - -/* #undef HAVE_NET_BPF_H */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UN_H 1 - -#define HAVE_NETDB_H 1 - -#define HAVE_OPENSSL 1 -#define HAVE_SSL_SET_TLSEXT_HOST_NAME 1 - -#define HAVE_EPOLL 1 -#define HAVE_POLL 1 -/* #undef HAVE_KQUEUE */ - -#define PCAP_NETMASK_UNKNOWN 0 diff --git a/nsock/src/Makefile b/nsock/src/Makefile deleted file mode 100644 index cb225b81..00000000 --- a/nsock/src/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -NSOCK_VERSION = 0.02 -prefix = /usr/local -exec_prefix = ${prefix} -bindir = ${exec_prefix}/bin -sbindir = ${exec_prefix}/sbin -mandir = ${datarootdir}/man -srcdir = . -datarootdir = ${prefix}/share - -CC = gcc -AR = ar -RANLIB = ranlib -CCOPT = -DEFS = -DHAVE_CONFIG_H -DNSOCK_VERSION=\"$(NSOCK_VERSION)\" -# With GCC, add extra security checks to source code. -DEFS += -D_FORTIFY_SOURCE=2 -INCLS = -I../include -CFLAGS = -g -O2 -Wall $(CCOPT) -# CFLAGS = -g -Wall $(DEFS) $(INCLS) -CPPFLAGS = -I../../nbase $(DEFS) $(INCLS) -STATIC = -SHTOOL = ./shtool -INSTALL = $(SHTOOL) install -MAKEDEPEND = @MAKEDEPEND@ -RPMTDIR=$(HOME)/rpmdir -NBASEDIR=../../nbase -NSOCKTESTDIR=../tests - -TARGET = libnsock.a - -SRCS = error.c filespace.c gh_heap.c nsock_connect.c nsock_core.c \ - nsock_iod.c nsock_read.c nsock_timers.c nsock_write.c \ - nsock_ssl.c nsock_event.c nsock_pool.c netutils.c nsock_pcap.c \ - nsock_engines.c engine_select.c engine_epoll.c engine_kqueue.c \ - engine_poll.c nsock_proxy.c nsock_log.c proxy_http.c proxy_socks4.c - -OBJS = error.o filespace.o gh_heap.o nsock_connect.o nsock_core.o \ - nsock_iod.o nsock_read.o nsock_timers.o nsock_write.o \ - nsock_ssl.o nsock_event.o nsock_pool.o netutils.o nsock_pcap.o \ - nsock_engines.o engine_select.o engine_epoll.o engine_kqueue.o \ - engine_poll.o nsock_proxy.o nsock_log.o proxy_http.o proxy_socks4.o - -DEPS = error.h filespace.h gh_list.h nsock_internal.h netutils.h nsock_pcap.h \ - nsock_log.h nsock_proxy.h gh_heap.h ../include/nsock.h \ - $(NBASEDIR)/libnbase.a - -.c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ - -all: $(TARGET) - -$(TARGET): $(DEPS) $(OBJS) - rm -f $@ - $(AR) cr $@ $(OBJS) - $(RANLIB) $@ - -$(NBASEDIR)/libnbase.a: $(NBASEDIR)/Makefile - cd $(NBASEDIR) && $(MAKE) - -clean-test: - cd $(NSOCKTESTDIR) && $(MAKE) clean - -clean: clean-test - rm -f $(OBJS) $(TARGET) - -distclean: clean - rm -f Makefile makefile.dep config.log config.status ../include/nsock_config.h - -depend: - $(MAKEDEPEND) $(INCLS) -s "# DO NOT DELETE" -- $(DEFS) -- $(SRCS) - -check: - cd $(NSOCKTESTDIR) && $(MAKE) && ./run_tests.sh - -${srcdir}/configure: configure.ac - cd ${srcdir} && autoconf - -# autoheader might not change config.h.in, so touch a stamp file. -${srcdir}/config.h.in: stamp-h.in -${srcdir}/stamp-h.in: configure.ac acconfig.h \ - config.h.top config.h.bot - cd ${srcdir} && autoheader - echo timestamp > ${srcdir}/stamp-h.in - -config.h: stamp-h -stamp-h: config.h.in config.status - ./config.status - -Makefile: Makefile.in config.status - ./config.status - -config.status: configure - ./config.status --recheck - -makefile.dep: - $(CC) -MM $(CPPFLAGS) $(SRCS) > $@ -include makefile.dep diff --git a/nsock/tests/Makefile b/nsock/tests/Makefile deleted file mode 100644 index 2b69516d..00000000 --- a/nsock/tests/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# nsock regression test suite -# Same license as nmap -- see http://nmap.org/book/man-legal.html -## - -NBASEDIR=../../nbase -NSOCKLIB=../src/libnsock.a -NBASELIB=$(NBASEDIR)/libnbase.a - -CC = gcc -CFLAGS = -Wall -O0 -I../include -I$(NBASEDIR) -LDFLAGS = -L../../nbase -LIBS = -lssl -lcrypto - -SRC = tests_main.c \ - basic.c \ - timer.c \ - logs.c \ - connect.c \ - ghlists.c \ - ghheaps.c \ - cancel.c - -OBJ = $(SRC:.c=.o) - -EXE = tests_main - -all: $(SRC) $(EXE) - -$(EXE): $(OBJ) - $(CC) $(LDFLAGS) $(OBJ) -o $@ $(NSOCKLIB) $(NBASELIB) $(LIBS) - -.c.o: - $(CC) -c $(CFLAGS) $< -o $@ - -clean: - $(RM) $(OBJ) $(EXE) - -rebuild: clean $(EXE) - -.PHONY: clean rebuild diff --git a/opensshlib/buildpkg.sh b/opensshlib/buildpkg.sh deleted file mode 100644 index 2a3a67b2..00000000 --- a/opensshlib/buildpkg.sh +++ /dev/null @@ -1,684 +0,0 @@ -#!/bin/sh -# -# Fake Root Solaris/SVR4/SVR5 Build System - Prototype -# -# The following code has been provide under Public Domain License. I really -# don't care what you use it for. Just as long as you don't complain to me -# nor my employer if you break it. - Ben Lindstrom (mouring@eviladmin.org) -# -umask 022 -# -# Options for building the package -# You can create a openssh-config.local with your customized options -# -REMOVE_FAKE_ROOT_WHEN_DONE=yes -# -# uncommenting TEST_DIR and using -# configure --prefix=/var/tmp --with-privsep-path=/var/tmp/empty -# and -# PKGNAME=tOpenSSH should allow testing a package without interfering -# with a real OpenSSH package on a system. This is not needed on systems -# that support the -R option to pkgadd. -#TEST_DIR=/var/tmp # leave commented out for production build -PKGNAME=OpenSSH -# revisions within the same version (REV=a) -#REV= -SYSVINIT_NAME=opensshd -AWK=${AWK:="nawk"} -MAKE=${MAKE:="make"} -SSHDUID=67 # Default privsep uid -SSHDGID=67 # Default privsep gid -# uncomment these next three as needed -#PERMIT_ROOT_LOGIN=no -#X11_FORWARDING=yes -#USR_LOCAL_IS_SYMLINK=yes -# System V init run levels -SYSVINITSTART=S98 -SYSVINITSTOPT=K30 -# We will source these if they exist -POST_MAKE_INSTALL_FIXES=./pkg-post-make-install-fixes.sh -POST_PROTOTYPE_EDITS=./pkg-post-prototype-edit.sh -# We'll be one level deeper looking for these -PKG_PREINSTALL_LOCAL=../pkg-preinstall.local -PKG_POSTINSTALL_LOCAL=../pkg-postinstall.local -PKG_PREREMOVE_LOCAL=../pkg-preremove.local -PKG_POSTREMOVE_LOCAL=../pkg-postremove.local -PKG_REQUEST_LOCAL=../pkg-request.local -# end of sourced files -# -OPENSSHD=opensshd.init -OPENSSH_MANIFEST=openssh.xml -OPENSSH_FMRI=svc:/site/${SYSVINIT_NAME}:default -SMF_METHOD_DIR=/lib/svc/method/site -SMF_MANIFEST_DIR=/var/svc/manifest/site - -PATH_GROUPADD_PROG=/usr/sbin/groupadd -PATH_USERADD_PROG=/usr/sbin/useradd -PATH_PASSWD_PROG=/usr/bin/passwd -# -# list of system directories we do NOT want to change owner/group/perms -# when installing our package -SYSTEM_DIR="/etc \ -/etc/init.d \ -/etc/rcS.d \ -/etc/rc0.d \ -/etc/rc1.d \ -/etc/rc2.d \ -/etc/opt \ -/lib \ -/lib/svc \ -/lib/svc/method \ -/lib/svc/method/site \ -/opt \ -/opt/bin \ -/usr \ -/usr/bin \ -/usr/lib \ -/usr/sbin \ -/usr/share \ -/usr/share/man \ -/usr/share/man/man1 \ -/usr/share/man/man8 \ -/usr/local \ -/usr/local/bin \ -/usr/local/etc \ -/usr/local/libexec \ -/usr/local/man \ -/usr/local/man/man1 \ -/usr/local/man/man8 \ -/usr/local/sbin \ -/usr/local/share \ -/var \ -/var/opt \ -/var/run \ -/var/svc \ -/var/svc/manifest \ -/var/svc/manifest/site \ -/var/tmp \ -/tmp" - -# We may need to build as root so we make sure PATH is set up -# only set the path if it's not set already -[ -d /opt/bin ] && { - echo $PATH | grep ":/opt/bin" > /dev/null 2>&1 - [ $? -ne 0 ] && PATH=$PATH:/opt/bin -} -[ -d /usr/local/bin ] && { - echo $PATH | grep ":/usr/local/bin" > /dev/null 2>&1 - [ $? -ne 0 ] && PATH=$PATH:/usr/local/bin -} -[ -d /usr/ccs/bin ] && { - echo $PATH | grep ":/usr/ccs/bin" > /dev/null 2>&1 - [ $? -ne 0 ] && PATH=$PATH:/usr/ccs/bin -} -export PATH -# - -[ -f Makefile ] || { - echo "Please run this script from your build directory" - exit 1 -} - -# we will look for openssh-config.local to override the above options -[ -s ./openssh-config.local ] && . ./openssh-config.local - -START=`pwd` -FAKE_ROOT=$START/pkg - -## Fill in some details, like prefix and sysconfdir -for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir sysconfdir piddir srcdir -do - eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2` -done - -## Are we using Solaris' SMF? -DO_SMF=0 -if egrep "^#define USE_SOLARIS_PROCESS_CONTRACTS" config.h > /dev/null 2>&1 -then - DO_SMF=1 -fi - -## Collect value of privsep user -for confvar in SSH_PRIVSEP_USER -do - eval $confvar=`awk '/#define[ \t]'$confvar'/{print $3}' config.h` -done - -## Set privsep defaults if not defined -if [ -z "$SSH_PRIVSEP_USER" ] -then - SSH_PRIVSEP_USER=sshd -fi - -## Extract common info requires for the 'info' part of the package. -VERSION=`./ssh -V 2>&1 | sed -e 's/,.*//'` - -ARCH=`uname -m` -DEF_MSG="\n" -OS_VER=`uname -v` -SCRIPT_SHELL=/sbin/sh -UNAME_R=`uname -r` -UNAME_S=`uname -s` -case ${UNAME_S} in - SunOS) UNAME_S=Solaris - OS_VER=${UNAME_R} - ARCH=`uname -p` - RCS_D=yes - DEF_MSG="(default: n)" - ;; - SCO_SV) case ${UNAME_R} in - 3.2) UNAME_S=OpenServer5 - OS_VER=`uname -X | grep Release | sed -e 's/^Rel.*3.2v//'` - ;; - 5) UNAME_S=OpenServer6 - ;; - esac - SCRIPT_SHELL=/bin/sh - RC1_D=no - DEF_MSG="(default: n)" - ;; -esac - -case `basename $0` in - buildpkg.sh) -## Start by faking root install -echo "Faking root install..." -[ -d $FAKE_ROOT ] && rm -fr $FAKE_ROOT -mkdir $FAKE_ROOT -${MAKE} install-nokeys DESTDIR=$FAKE_ROOT -if [ $? -gt 0 ] -then - echo "Fake root install failed, stopping." - exit 1 -fi - -## Setup our run level stuff while we are at it. -if [ $DO_SMF -eq 1 ] -then - # For Solaris' SMF, /lib/svc/method/site is the preferred place - # for start/stop scripts that aren't supplied with the OS, and - # similarly /var/svc/manifest/site for manifests. - mkdir -p $FAKE_ROOT${TEST_DIR}${SMF_METHOD_DIR} - mkdir -p $FAKE_ROOT${TEST_DIR}${SMF_MANIFEST_DIR} - - cp ${OPENSSHD} $FAKE_ROOT${TEST_DIR}${SMF_METHOD_DIR}/${SYSVINIT_NAME} - chmod 744 $FAKE_ROOT${TEST_DIR}${SMF_METHOD_DIR}/${SYSVINIT_NAME} - - cat ${OPENSSH_MANIFEST} | \ - sed -e "s|__SYSVINIT_NAME__|${SYSVINIT_NAME}|" \ - -e "s|__SMF_METHOD_DIR__|${SMF_METHOD_DIR}|" \ - > $FAKE_ROOT${TEST_DIR}${SMF_MANIFEST_DIR}/${SYSVINIT_NAME}.xml - chmod 644 $FAKE_ROOT${TEST_DIR}${SMF_MANIFEST_DIR}/${SYSVINIT_NAME}.xml -else - mkdir -p $FAKE_ROOT${TEST_DIR}/etc/init.d - - cp ${OPENSSHD} $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} - chmod 744 $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} -fi - -[ "${PERMIT_ROOT_LOGIN}" = no ] && \ - perl -p -i -e "s/#PermitRootLogin yes/PermitRootLogin no/" \ - $FAKE_ROOT${sysconfdir}/sshd_config -[ "${X11_FORWARDING}" = yes ] && \ - perl -p -i -e "s/#X11Forwarding no/X11Forwarding yes/" \ - $FAKE_ROOT${sysconfdir}/sshd_config -# fix PrintMotd -perl -p -i -e "s/#PrintMotd yes/PrintMotd no/" \ - $FAKE_ROOT${sysconfdir}/sshd_config - -# We don't want to overwrite config files on multiple installs -mv $FAKE_ROOT${sysconfdir}/ssh_config $FAKE_ROOT${sysconfdir}/ssh_config.default -mv $FAKE_ROOT${sysconfdir}/sshd_config $FAKE_ROOT${sysconfdir}/sshd_config.default -[ -f $FAKE_ROOT${sysconfdir}/ssh_prng_cmds ] && \ -mv $FAKE_ROOT${sysconfdir}/ssh_prng_cmds $FAKE_ROOT${sysconfdir}/ssh_prng_cmds.default - -# local tweeks here -[ -s "${POST_MAKE_INSTALL_FIXES}" ] && . ${POST_MAKE_INSTALL_FIXES} - -cd $FAKE_ROOT - -## Ok, this is outright wrong, but it will work. I'm tired of pkgmk -## whining. -for i in *; do - PROTO_ARGS="$PROTO_ARGS $i=/$i"; -done - -## Build info file -echo "Building pkginfo file..." -cat > pkginfo << _EOF -PKG=$PKGNAME -NAME="OpenSSH Portable for ${UNAME_S}" -DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh." -VENDOR="OpenSSH Portable Team - http://www.openssh.com/portable.html" -ARCH=$ARCH -VERSION=$VERSION$REV -CATEGORY="Security,application" -BASEDIR=/ -CLASSES="none" -PSTAMP="${UNAME_S} ${OS_VER} ${ARCH} `date '+%d%b%Y %H:%M'`" -_EOF - -## Build empty depend file that may get updated by $POST_PROTOTYPE_EDITS -echo "Building depend file..." -touch depend - -## Build space file -echo "Building space file..." -if [ $DO_SMF -eq 1 ] -then - # XXX Is this necessary? If not, remove space line from mk-proto.awk. - touch space -else - cat > space << _EOF -# extra space required by start/stop links added by installf -# in postinstall -$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1 -$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME} 0 1 -_EOF - [ "$RC1_D" = no ] || \ - echo "$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1" >> space - [ "$RCS_D" = yes ] && \ - echo "$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1" >> space -fi - -## Build preinstall file -echo "Building preinstall file..." -cat > preinstall << _EOF -#! ${SCRIPT_SHELL} -# -_EOF - -# local preinstall changes here -[ -s "${PKG_PREINSTALL_LOCAL}" ] && . ${PKG_PREINSTALL_LOCAL} - -cat >> preinstall << _EOF -# -if [ "\${PRE_INS_STOP}" = "yes" ] -then - if [ $DO_SMF -eq 1 ] - then - svcadm disable $OPENSSH_FMRI - else - ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop - fi -fi - -exit 0 -_EOF - -## Build postinstall file -echo "Building postinstall file..." -cat > postinstall << _EOF -#! ${SCRIPT_SHELL} -# -[ -f \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_config ] || \\ - cp -p \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_config.default \\ - \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_config -[ -f \${PKG_INSTALL_ROOT}${sysconfdir}/sshd_config ] || \\ - cp -p \${PKG_INSTALL_ROOT}${sysconfdir}/sshd_config.default \\ - \${PKG_INSTALL_ROOT}${sysconfdir}/sshd_config -[ -f \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_prng_cmds.default ] && { - [ -f \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_prng_cmds ] || \\ - cp -p \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_prng_cmds.default \\ - \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_prng_cmds -} - -# make rc?.d dirs only if we are doing a test install -[ -n "${TEST_DIR}" ] && [ $DO_SMF -ne 1 ] && { - [ "$RCS_D" = yes ] && mkdir -p ${TEST_DIR}/etc/rcS.d - mkdir -p ${TEST_DIR}/etc/rc0.d - [ "$RC1_D" = no ] || mkdir -p ${TEST_DIR}/etc/rc1.d - mkdir -p ${TEST_DIR}/etc/rc2.d -} - -if [ $DO_SMF -eq 1 ] -then - # Delete the existing service, if it exists, then import the - # new one. - if svcs $OPENSSH_FMRI > /dev/null 2>&1 - then - svccfg delete -f $OPENSSH_FMRI - fi - # NOTE, The manifest disables sshd by default. - svccfg import ${TEST_DIR}${SMF_MANIFEST_DIR}/${SYSVINIT_NAME}.xml -else - if [ "\${USE_SYM_LINKS}" = yes ] - then - [ "$RCS_D" = yes ] && \ - installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s - installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s - [ "$RC1_D" = no ] || \ - installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s - installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s - else - [ "$RCS_D" = yes ] && \ - installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l - installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l - [ "$RC1_D" = no ] || \ - installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l - installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l - fi -fi - -# If piddir doesn't exist we add it. (Ie. --with-pid-dir=/var/opt/ssh) -[ -d $piddir ] || installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR$piddir d 0755 root sys - -_EOF - -# local postinstall changes here -[ -s "${PKG_POSTINSTALL_LOCAL}" ] && . ${PKG_POSTINSTALL_LOCAL} - -cat >> postinstall << _EOF -installf -f ${PKGNAME} - -# Use chroot to handle PKG_INSTALL_ROOT -if [ ! -z "\${PKG_INSTALL_ROOT}" ] -then - chroot="chroot \${PKG_INSTALL_ROOT}" -fi -# If this is a test build, we will skip the groupadd/useradd/passwd commands -if [ ! -z "${TEST_DIR}" ] -then - chroot=echo -fi - - echo "PrivilegeSeparation user always required." - if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null - then - echo "PrivSep user $SSH_PRIVSEP_USER already exists." - SSH_PRIVSEP_GROUP=\`grep "^$SSH_PRIVSEP_USER:" \${PKG_INSTALL_ROOT}/etc/passwd | awk -F: '{print \$4}'\` - SSH_PRIVSEP_GROUP=\`grep ":\$SSH_PRIVSEP_GROUP:" \${PKG_INSTALL_ROOT}/etc/group | awk -F: '{print \$1}'\` - else - DO_PASSWD=yes - fi - [ -z "\$SSH_PRIVSEP_GROUP" ] && SSH_PRIVSEP_GROUP=$SSH_PRIVSEP_USER - - # group required? - if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/group | egrep '^'\$SSH_PRIVSEP_GROUP'\$' >/dev/null - then - echo "PrivSep group \$SSH_PRIVSEP_GROUP already exists." - else - DO_GROUP=yes - fi - - # create group if required - [ "\$DO_GROUP" = yes ] && { - # Use gid of 67 if possible - if cut -f3 -d: \${PKG_INSTALL_ROOT}/etc/group | egrep '^'$SSHDGID'\$' >/dev/null - then - : - else - sshdgid="-g $SSHDGID" - fi - echo "Creating PrivSep group \$SSH_PRIVSEP_GROUP." - \$chroot ${PATH_GROUPADD_PROG} \$sshdgid \$SSH_PRIVSEP_GROUP - } - - # Create user if required - [ "\$DO_PASSWD" = yes ] && { - # Use uid of 67 if possible - if cut -f3 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSHDUID'\$' >/dev/null - then - : - else - sshduid="-u $SSHDUID" - fi - echo "Creating PrivSep user $SSH_PRIVSEP_USER." - \$chroot ${PATH_USERADD_PROG} -c 'SSHD PrivSep User' -s /bin/false -g $SSH_PRIVSEP_USER \$sshduid $SSH_PRIVSEP_USER - \$chroot ${PATH_PASSWD_PROG} -l $SSH_PRIVSEP_USER - } - -if [ "\${POST_INS_START}" = "yes" ] -then - if [ $DO_SMF -eq 1 ] - then - svcadm enable $OPENSSH_FMRI - else - ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} start - fi -fi -exit 0 -_EOF - -## Build preremove file -echo "Building preremove file..." -cat > preremove << _EOF -#! ${SCRIPT_SHELL} -# -if [ $DO_SMF -eq 1 ] -then - svcadm disable $OPENSSH_FMRI -else - ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop -fi -_EOF - -# local preremove changes here -[ -s "${PKG_PREREMOVE_LOCAL}" ] && . ${PKG_PREREMOVE_LOCAL} - -cat >> preremove << _EOF -exit 0 -_EOF - -## Build postremove file -echo "Building postremove file..." -cat > postremove << _EOF -#! ${SCRIPT_SHELL} -# -if [ $DO_SMF -eq 1 ] -then - if svcs $OPENSSH_FMRI > /dev/null 2>&1 - then - svccfg delete -f $OPENSSH_FMRI - fi -fi -_EOF - -# local postremove changes here -[ -s "${PKG_POSTREMOVE_LOCAL}" ] && . ${PKG_POSTREMOVE_LOCAL} - -cat >> postremove << _EOF -exit 0 -_EOF - -## Build request file -echo "Building request file..." -cat > request << _EOF -trap 'exit 3' 15 - -_EOF - -[ -x /usr/bin/ckyorn ] || cat >> request << _EOF - -ckyorn() { -# for some strange reason OpenServer5 has no ckyorn -# We build a striped down version here - -DEFAULT=n -PROMPT="Yes or No [yes,no,?,quit]" -HELP_PROMPT=" Enter y or yes if your answer is yes; n or no if your answer is no." -USAGE="usage: ckyorn [options] -where options may include: - -d default - -h help - -p prompt -" - -if [ \$# != 0 ] -then - while getopts d:p:h: c - do - case \$c in - h) HELP_PROMPT="\$OPTARG" ;; - d) DEFAULT=\$OPTARG ;; - p) PROMPT=\$OPTARG ;; - \\?) echo "\$USAGE" 1>&2 - exit 1 ;; - esac - done - shift \`expr \$OPTIND - 1\` -fi - -while true -do - echo "\${PROMPT}\\c " 1>&2 - read key - [ -z "\$key" ] && key=\$DEFAULT - case \$key in - [n,N]|[n,N][o,O]|[y,Y]|[y,Y][e,E][s,S]) echo "\${key}\\c" - exit 0 ;; - \\?) echo \$HELP_PROMPT 1>&2 ;; - q|quit) echo "q\\c" 1>&2 - exit 3 ;; - esac -done - -} - -_EOF - -if [ $DO_SMF -eq 1 ] -then - # This could get hairy, as the running sshd may not be under SMF. - # We'll assume an earlier version of OpenSSH started via SMF. - cat >> request << _EOF -PRE_INS_STOP=no -POST_INS_START=no -# determine if should restart the daemon -if [ -s ${piddir}/sshd.pid ] && \ - /usr/bin/svcs -H $OPENSSH_FMRI 2>&1 | egrep "^online" > /dev/null 2>&1 -then - ans=\`ckyorn -d n \ --p "Should the running sshd daemon be restarted? ${DEF_MSG}"\` || exit \$? - case \$ans in - [y,Y]*) PRE_INS_STOP=yes - POST_INS_START=yes - ;; - esac - -else - -# determine if we should start sshd - ans=\`ckyorn -d n \ --p "Start the sshd daemon after installing this package? ${DEF_MSG}"\` || exit \$? - case \$ans in - [y,Y]*) POST_INS_START=yes ;; - esac -fi - -# make parameters available to installation service, -# and so to any other packaging scripts -cat >\$1 <> request << _EOF -USE_SYM_LINKS=no -PRE_INS_STOP=no -POST_INS_START=no -# Use symbolic links? -ans=\`ckyorn -d n \ --p "Do you want symbolic links for the start/stop scripts? ${DEF_MSG}"\` || exit \$? -case \$ans in - [y,Y]*) USE_SYM_LINKS=yes ;; -esac - -# determine if should restart the daemon -if [ -s ${piddir}/sshd.pid -a -f ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} ] -then - ans=\`ckyorn -d n \ --p "Should the running sshd daemon be restarted? ${DEF_MSG}"\` || exit \$? - case \$ans in - [y,Y]*) PRE_INS_STOP=yes - POST_INS_START=yes - ;; - esac - -else - -# determine if we should start sshd - ans=\`ckyorn -d n \ --p "Start the sshd daemon after installing this package? ${DEF_MSG}"\` || exit \$? - case \$ans in - [y,Y]*) POST_INS_START=yes ;; - esac -fi - -# make parameters available to installation service, -# and so to any other packaging scripts -cat >\$1 <> request << _EOF -exit 0 - -_EOF - -## Next Build our prototype -echo "Building prototype file..." -cat >mk-proto.awk << _EOF - BEGIN { print "i pkginfo"; print "i depend"; \\ - print "i preinstall"; print "i postinstall"; \\ - print "i preremove"; print "i postremove"; \\ - print "i request"; print "i space"; \\ - split("$SYSTEM_DIR",sys_files); } - { - for (dir in sys_files) { if ( \$3 != sys_files[dir] ) - { if ( \$1 == "s" ) - { \$5=""; \$6=""; } - else - { \$5="root"; \$6="sys"; } - } - else - { \$4="?"; \$5="?"; \$6="?"; break;} - } } - { print; } -_EOF - -find . | egrep -v "prototype|pkginfo|mk-proto.awk" | sort | \ - pkgproto $PROTO_ARGS | ${AWK} -f mk-proto.awk > prototype - -# /usr/local is a symlink on some systems -[ "${USR_LOCAL_IS_SYMLINK}" = yes ] && { - grep -v "^d none /usr/local ? ? ?$" prototype > prototype.new - mv prototype.new prototype -} - -## Step back a directory and now build the package. -cd .. -# local prototype tweeks here -[ -s "${POST_PROTOTYPE_EDITS}" ] && . ${POST_PROTOTYPE_EDITS} - -echo "Building package.." -pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o -echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION$REV-$UNAME_S-$ARCH.pkg - ;; - - justpkg.sh) -rm -fr ${FAKE_ROOT}/${PKGNAME} -grep -v "^PSTAMP=" $FAKE_ROOT/pkginfo > $$tmp -mv $$tmp $FAKE_ROOT/pkginfo -cat >> $FAKE_ROOT/pkginfo << _EOF -PSTAMP="${UNAME_S} ${OS_VER} ${ARCH} `date '+%d%b%Y %H:%M'`" -_EOF -pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o -echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION$REV-$UNAME_S-$ARCH.pkg - ;; - -esac - -[ "${REMOVE_FAKE_ROOT_WHEN_DONE}" = yes ] && rm -rf $FAKE_ROOT -exit 0 -