From: CyberPsychotic [mlists@GIZMO.KYRNET.KG] Sent: Monday, August 16, 1999 4:49 PM To: BUGTRAQ@SECURITYFOCUS.COM Subject: Re: Internet Auditing Project ~ Has anyone hacked to run on Solaris 2.6: ~ Here are the quick hacks I did to get it working on solaris. Your opinions may differ though :-). (note some extra definitions I added to Makefile -DSOLARIS and -DHAVE_STRSEP) diff -u bass-1.0.7.orig/Makefile bass-1.0.7/Makefile --- bass-1.0.7.orig/Makefile Mon Aug 9 01:43:51 1999 +++ bass-1.0.7/Makefile Wed Aug 18 04:25:43 1999 @@ -11,7 +11,8 @@ BASS_DISTDIR = /usr/local/bass/ -BASS_DEFS = -DBASS_DEFAULT_DISTDIR=\"$(BASS_DISTDIR)\" +BASS_DEFS = -DBASS_DEFAULT_DISTDIR=\"$(BASS_DISTDIR)\" -DSOLARIS -DHAVE_STRSEP +BASS_LINK_LIBS = -lnsl -lsocket -lxnet # On Solaris you'll need to add *at least* these linker flags: # -lnsl -lsocket -lresolv -lrpc (is that how the rpc library is called?) @@ -34,7 +35,7 @@ all: BASS BASS: $(BASS_OBJS) - $(CC) -o BASS $(BASS_OBJS) + $(CC) -o BASS $(BASS_OBJS) $(BASS_LINK_LIBS) $(LIBPCLOAK_OBJ): cd $(LIBPCLOAK_DIR); $(MAKE) $(LIBPCLOAK).a diff -u bass-1.0.7.orig/bind.h bass-1.0.7/bind.h --- bass-1.0.7.orig/bind.h Mon Aug 9 01:43:51 1999 +++ bass-1.0.7/bind.h Wed Aug 18 03:51:51 1999 @@ -15,6 +15,13 @@ #include +/* + * on solaris conficts with XTI definition of unspecified value + */ +#ifdef SOLARIS +#undef T_UNSPEC +#endif + #define BINDPORT 53 #define BIND_IMMUNE_VERSION_4 "9.7" #define BIND_IMMUNE_VERSION_8 "8.2" Only in bass-1.0.7: er diff -u bass-1.0.7.orig/icmp.h bass-1.0.7/icmp.h --- bass-1.0.7.orig/icmp.h Mon Aug 9 01:43:51 1999 +++ bass-1.0.7/icmp.h Wed Aug 18 04:15:26 1999 @@ -13,8 +13,45 @@ */ -#include +#include #include +#include + +#ifdef SOLARIS + +/* solaris has different struct for ip header defined (struct ip, with BSD-like + *structure members. This is just a quck hack to fix problem +*/ + +typedef u_char u_int8_t; +typedef u_short u_int16_t; +typedef u_long u_int32_t; + +struct iphdr + { +#if __BYTE_ORDER == __LITTLE_ENDIAN + u_int8_t ihl:4; + u_int8_t version:4; +#elif __BYTE_ORDER == __BIG_ENDIAN + u_int8_t version:4; + u_int8_t ihl:4; +#else +#error "Please fix " +#endif + u_int8_t tos; + u_int16_t tot_len; + u_int16_t id; + u_int16_t frag_off; + u_int8_t ttl; + u_int8_t protocol; + u_int16_t check; + u_int32_t saddr; + u_int32_t daddr; + /*The options start here. */ + }; + + +#endif #define LOCAL_ICMP #ifndef LOCAL_ICMP diff -u bass-1.0.7.orig/imapd.c bass-1.0.7/imapd.c --- bass-1.0.7.orig/imapd.c Mon Aug 9 01:43:51 1999 +++ bass-1.0.7/imapd.c Wed Aug 18 04:31:08 1999 @@ -22,6 +22,56 @@ #include "network.h" #include "log.h" + +/* strsep first appeared in 4.4BSD lite, thus some unices still don't have it. + * This ifdef should fix this incompatibility + */ + +#ifdef HAVE_STRSEP +/* + * Get next token from string *stringp, where tokens are possibly-empty + * strings separated by characters from delim. + * + * Writes NULs into the string at *stringp to end tokens. + * delim need not remain constant from call to call. + * On return, *stringp points past the last NUL written (if there might + * be further tokens), or is NULL (if there are definitely no more tokens). + * + * If *stringp is NULL, strsep returns NULL. + */ +char * +strsep(stringp, delim) + register char **stringp; + register const char *delim; +{ + register char *s; + register const char *spanp; + register int c, sc; + char *tok; + + + if ((s = *stringp) == NULL) + return (NULL); + for (tok = s;;) { + c = *s++; + spanp = delim; + do { + if ((sc = *spanp++) == c) { + if (c == 0) + s = NULL; + else + s[-1] = 0; + *stringp = s; + return (tok); + } + } while (sc != 0); + } + /* NOTREACHED */ +} +#endif + + + /* imapd hook */ int imapd_handlehost(struct sockaddr_in *addr, char *host, int timer) { diff -u bass-1.0.7.orig/includes.h bass-1.0.7/includes.h --- bass-1.0.7.orig/includes.h Mon Aug 9 01:43:51 1999 +++ bass-1.0.7/includes.h Wed Aug 18 03:56:28 1999 @@ -15,4 +15,10 @@ #include #include +/* + * Solaris misses TIOCNOTTY defined here.. others? + */ +#ifdef SOLARIS +#include +#endif #endif -- fygrave@tigerteam.net http://www.kalug.lug.net