From: Serge Goncharov Subject: iss-1.3 patch for FreeBSD-2.0 Status: OR diff --new-file -P -r -c ./oldiss-1.3/Makefile ./iss-1.3/Makefile *** ./oldiss-1.3/Makefile Fri Apr 7 05:05:02 1995 --- ./iss-1.3/Makefile Tue Apr 18 21:33:58 1995 *************** *** 2,9 **** --- 2,19 ---- # many features and vulnerability checks from the commercial version. # Please send e-mail to iss@iss.net for more information. + + # for FreeBSD 2.0 + CFLAGS= -D__freebsd__ + + # for other system + # CFLAGS= + iss: iss.o telnet.h $(CC) -o $@ iss.o clean: rm -f iss iss.o + + iss.o: + $(CC) $(CFLAGS) -c iss.c -o iss.o diff --new-file -P -r -c ./oldiss-1.3/iss.c ./iss-1.3/iss.c *** ./oldiss-1.3/iss.c Fri Apr 7 05:04:31 1995 --- ./iss-1.3/iss.c Wed Apr 19 15:32:31 1995 *************** *** 40,45 **** --- 40,51 ---- #include #include #include + #ifdef __freebsd__ + #include + #include + #include + extern int errno; + #endif #include #include "telnet.h" #include *************** *** 58,67 **** --- 64,80 ---- #include /* Set to Appropriate Paths For Various Unixes */ + #ifdef __freebsd__ + #define SHOWMOUNT "/usr/bin/showmount" + #define RUSERS "/usr/bin/rusers" + #define RPCINFO "/usr/bin/rpcinfo" + #define YPWHICH "/usr/bin/ypwhich" + #else #define SHOWMOUNT "/usr/etc/showmount" #define RUSERS "/usr/ucb/rusers" #define RPCINFO "/usr/etc/rpcinfo" #define YPWHICH "/usr/bin/ypwhich" + #endif struct sockaddr_in a; /* struct of socket */ *************** *** 70,81 **** --- 83,101 ---- /* range values to scan */ struct in_addr first, second, myaddr; + #ifdef __freebsd__ + static char *logname_set[] = { "daemon", "sync", "ftp", "bbs", "lp", \ + "guest", "toor", "demo", "0" } ; + #endif + int nname = 0; int sec = 0, port = 0; /* Check to see when function is done */ int done; /* Conditions to check scan for in each host */ int mail = 0, acctcheck = 0, ypx = 0, rpcinfo = 0, scanports = 0; int quick = 0, export = 0, ftp = 0, login = 0; + jmp_buf envir; + int was_setjmp = 1; int mnt = 0, width = 0; char hname[200], testname[200], smtpname[200], addr[100], *progname, c; *************** *** 89,95 **** --- 109,123 ---- #ifdef sun siginterrupt(SIGALRM, 1); #endif + #ifdef __freebsd__ + signal(SIGALRM, (sig_t) donothing); + if ( ! was_setjmp ) { + was_setjmp = 1; + longjmp(envir, 1); + } + #else signal(SIGALRM, donothing); + #endif } getname(addr) struct sockaddr_in *addr; *************** *** 100,105 **** --- 128,134 ---- if (hoste) { sprintf(hname, "%s", hoste->h_name); + fprintf(fp, "Got hostname: %s\n", hoste->h_name); return (1); } else { *************** *** 107,113 **** --- 136,146 ---- return (0); } } + #ifdef __freebsd__ + m_ctos() + #else ctos() /* Connect to Socket */ + #endif { int soc; soc = socket(AF_INET, SOCK_STREAM, 0); *************** *** 125,131 **** --- 158,168 ---- a.sin_port = htons((port == 0) ? 23 : port); a.sin_family = AF_INET; a.sin_addr.s_addr = htonl(x); + #ifdef __freebsd__ + r = connect(soc, (struct sockaddr *)&a, sizeof(a)); + #else r = connect(soc, &a, sizeof(a)); + #endif return (soc); } /* Give usage message */ *************** *** 210,218 **** --- 247,259 ---- clrlog(); cnt = 0; count = 0; + was_setjmp = 0; (void) write(s, '\n', 1); while (!done && (count != 250)) { + #ifdef __freebsd__ + if ( setjmp(envir) ) break; + #endif a = read(s, &c, 1); if (a < 0) return; *************** *** 245,254 **** --- 286,310 ---- fflush(fp); if (login != 1) { + #ifdef __freebsd__ + fprintf(fp, "Try to login as %s\n", logname_set[nname]); + (void) writeln(s, logname_set[nname]); + done = 0; + #else (void) writeln(s, "sync"); + #endif alarm(0); alarm(3); cnt = 0; + #ifdef __freebsd__ + fprintf(fp, "Got: "); + was_setjmp = 0; + while ( !done ) + { + c = 0; + if ( setjmp(envir) ) break; + if ( read(s, &c, 1) == 1 && (c != 0) ) + #else for (count = 0; count < 3; count++) { c = 0; *************** *** 256,269 **** --- 312,329 ---- { c = 0; if (!(read(sd, &c, 1)) && (c != 0)) + #endif { fprintf(fp, "%c", c); fflush(fp); } } + #ifndef __freebsd__ } + #endif fflush(fp); + fprintf(fp, "\n"); } } *************** *** 405,411 **** --- 465,475 ---- port = 25; done = 0; c = 0; + #ifdef __freebsd__ + sd = m_ctos(); + #else sd = ctos(); + #endif if (r != -1) { /* Read & Write Here */ *************** *** 466,472 **** --- 530,540 ---- int t = 0; alarm((sec == 0) ? 5 : sec); port = 21; + #ifdef __freebsd__ + sd = m_ctos(); + #else sd = ctos(); + #endif if (r != -1) { (void) setsockopt(sd, SOL_SOCKET, SO_LINGER, &thirty, sizeof(thirty)); *************** *** 672,677 **** --- 740,757 ---- alarm((sec == 0) ? 6 : sec); /* Set Alarm to def 6 seconds */ port = 23; + #ifdef __freebsd__ + nname = 0 ; + while ( logname_set[nname] != "0" ) { + done = 0; + sd = m_ctos(); + if (r != -1) + do_log(sd); + alarm(0); + (void) close(sd); + nname++; + } + #else sd = ctos(); if (r != -1) { *************** *** 680,685 **** --- 760,766 ---- /* Try to Connect */ alarm(0); (void) close(sd); + #endif if (r != -1) { if (!rpcinfo) *************** *** 806,812 **** --- 887,897 ---- perror("socket"); return (1); } + #ifdef __freebsd__ + if (!(connect(SocketDescriptor, (struct sockaddr *) &SocketInetAddr, + #else if (!(connect(SocketDescriptor, (char *) &SocketInetAddr, + #endif sizeof(SocketInetAddr)) < 0)) { (void) fprintf(fp, "Host %s, Port %d ", *************** *** 927,933 **** --- 1012,1022 ---- #ifdef sun siginterrupt(SIGALRM, 1); #endif + #ifdef __freebsd__ + signal(SIGALRM, (sig_t) donothing); + #else signal(SIGALRM, donothing); + #endif fprintf(fp, "\nScanning from %s", inet_ntoa(first)); fprintf(fp, " to %s\n", inet_ntoa(second)); fflush(fp); *************** *** 939,945 **** --- 1028,1038 ---- if ((x & 0xff) == 0) x++; myaddr.s_addr = htonl(x); + #ifdef __freebsd__ + (void) strcpy(addr, (char *) inet_ntoa(myaddr)); + #else (void) strcpy(addr, inet_ntoa(myaddr)); + #endif if (quick == 1) { a.sin_port = htons((port == 0) ? 23 : port); diff --new-file -P -r -c ./oldiss-1.3/nfsbug/Makefile ./iss-1.3/nfsbug/Makefile *** ./oldiss-1.3/nfsbug/Makefile Wed Apr 19 16:21:56 1995 --- ./iss-1.3/nfsbug/Makefile Wed Apr 19 15:41:28 1995 *************** *** 1,7 **** CC=cc #CFLAGS=-g -I. -DSVR4 #LIBS=-lsocket -lnsl -L/usr/ucblib -lucb -lresolv ! CFLAGS=-ggdb -I. LIBS= NFSBUG_SOURCES=mount_clnt.c mount_xdr.c nfs_prot_clnt.c nfs_prot_xdr.c nfsbug.c NFSBUG_OBJECTS=mount_clnt.o mount_xdr.o nfs_prot_clnt.o nfs_prot_xdr.o nfsbug.o --- 1,7 ---- CC=cc #CFLAGS=-g -I. -DSVR4 #LIBS=-lsocket -lnsl -L/usr/ucblib -lucb -lresolv ! CFLAGS=-ggdb -I. -D__freebsd__ LIBS= NFSBUG_SOURCES=mount_clnt.c mount_xdr.c nfs_prot_clnt.c nfs_prot_xdr.c nfsbug.c NFSBUG_OBJECTS=mount_clnt.o mount_xdr.o nfs_prot_clnt.o nfs_prot_xdr.o nfsbug.o diff --new-file -P -r -c ./oldiss-1.3/nfsbug/nfsbug.c ./iss-1.3/nfsbug/nfsbug.c *** ./oldiss-1.3/nfsbug/nfsbug.c Wed Apr 19 16:21:56 1995 --- ./iss-1.3/nfsbug/nfsbug.c Wed Apr 19 15:57:51 1995 *************** *** 25,45 **** --- 25,57 ---- #include #include #include + #ifndef __freebsd__ #include + #endif #include #include + #ifndef __freebsd__ #include #include + #endif #ifdef SVR4 #include #else #ifndef HPUX + # ifdef __freebsd__ + # include + # include + # else #include #endif #endif + #endif #include "mount.h" #include "nfs_prot.h" + #ifdef __freebsd__ + typedef struct { long val[2]; } fsid_t; + #endif #ifndef TRUE #define TRUE 1