This patch was provided by Chris Kuethe (ckuethe at math dot ualberta dot ca). It allows sftpd-1.45 to compile and run on OpenBSD and Irix. To apply this patch and rebuild: % cd sftpd % patch < openbsd-irix.patch.txt % make distclean <-- if already tried to compile % ./configure && make diff -u sftpd-orig-1.45p4/Makefile.in sftpd-1.45p4/Makefile.in --- sftpd-orig-1.45p4/Makefile.in Tue Sep 19 03:08:07 2000 +++ sftpd-1.45p4/Makefile.in Wed Sep 20 09:02:33 2000 @@ -29,7 +29,7 @@ link = @CXX@ ${ccflags} ${defines} ${includes} linkend = ${libraries} makelib = ar -r - +ranlib = ranlib # method to compile .cpp to .o (more reliable than ".cpp.o" method) %.o : %.cpp @@ -111,6 +111,7 @@ strtokp.o syserr.o warn.o libextras.a: ${extras-objs} ${makelib} libextras.a ${extras-objs} + ${ranlib} libextras.a # smcrypto: cryptographic primitives, dependent only on extras smcrypto-objs = \ @@ -122,6 +123,7 @@ crypto/queue.o crypto/randpool.o crypto/rng.o libsmcrypto.a: ${smcrypto-objs} ${makelib} libsmcrypto.a ${smcrypto-objs} + ${ranlib} libsmcrypto.a # sftp: protocol primitives and utilities, dependent on extras & smcrypto sftp-objs = \ @@ -131,6 +133,7 @@ sftp.o sftpver.o socksrc.o sockutil.o libsftp.a: ${sftp-objs} ${makelib} libsftp.a ${sftp-objs} + ${ranlib} libsftp.a # ----------- tool-generated --------------------------- # line-ending conversions diff -u sftpd-orig-1.45p4/addent.h sftpd-1.45p4/addent.h --- sftpd-orig-1.45p4/addent.h Sun Aug 6 16:17:42 2000 +++ sftpd-1.45p4/addent.h Wed Sep 20 09:04:35 2000 @@ -13,7 +13,7 @@ // (may call getEntropyFromSystem instead of requiring typing) void getEntropyFromConsole(int numbits); -// get it from /dev/random +// get it from /dev/random (/dev/srandom on OpenBSD) void getEntropyFromSystem(int numbits); #endif // __ADDENT_H Common subdirectories: sftpd-orig-1.45p4/crypto and sftpd-1.45p4/crypto Common subdirectories: sftpd-orig-1.45p4/doc and sftpd-1.45p4/doc diff -u sftpd-orig-1.45p4/nonport.cpp sftpd-1.45p4/nonport.cpp --- sftpd-orig-1.45p4/nonport.cpp Sun Sep 17 06:52:41 2000 +++ sftpd-1.45p4/nonport.cpp Wed Sep 20 09:11:08 2000 @@ -7,6 +7,13 @@ #include // strncpy #include + +#ifdef __OpenBSD__ +# define DEV_RANDOM "/dev/srandom" +#else +# define DEV_RANDOM "/dev/random" +#endif + #ifdef __WIN32__ # ifdef USE_MINWIN_H # include "minwin.h" // api @@ -522,10 +529,15 @@ // want to busy-wait for more entropy to arrive // - the default configuration won't yield any data at all, because // no IRQs are set up to gather entropy (see rndcontrol(8)) + // + // OpenBSD has /dev/srandom, a strong software random number generator. + // We use this since /dev/random only works if a hardware random number + // generator is installed, and those are only supported on some hardware + // configurations. #if defined(__UNIX__) && !defined(__FREEBSD__) // see if /dev/random exists and is readable - int fd = open("/dev/random", O_RDONLY); + int fd = open(DEV_RANDOM, O_RDONLY); if (fd < 0) { return false; } @@ -573,7 +585,7 @@ { #ifdef __UNIX__ // open /dev/random - int fd = open("/dev/random", O_RDONLY); + int fd = open(DEV_RANDOM, O_RDONLY); if (!fd) { perror("open"); exit(2); --- sftpd-orig-1.45p4/sockutil.cpp Tue Sep 19 02:00:00 2000 +++ sftpd-1.45p4/sockutil.cpp Wed Sep 20 13:50:12 2000 @@ -447,7 +447,7 @@ # define LENGTH_PARAM socklen_t #elif defined(__OSF1__) # define LENGTH_PARAM unsigned long -#elif defined(__FREEBSD__) +#elif defined(__FREEBSD__) || defined(__OpenBSD__) # define LENGTH_PARAM socklen_t #else # define LENGTH_PARAM int --- sftpd-orig-1.45p4/sockutil.h Sun Sep 17 06:52:42 2000 +++ sftpd-1.45p4/sockutil.h Wed Sep 20 14:21:33 2000 @@ -2,6 +2,14 @@ // some utilities built on top of sockets layer // copyright SafeTP Development Group, Inc., 2000 Terms of use are as specified in license.txt +// absolutely gross hack to get things to work on my Irix machines. *barf* +#ifdef MIPSEB + #define BIG_ENDIAN // g++ may whine about this already being defined. too bad + #ifdef LITTLE_ENDIAN + #undef LITTLE_ENDIAN + #endif +#endif + #ifndef __SOCKUTIL_H #define __SOCKUTIL_H