home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume39 / iss / patch01 < prev    next >
Encoding:
Text File  |  1993-09-29  |  7.9 KB  |  332 lines

  1. Newsgroups: comp.sources.misc
  2. From: gt6468c@prism.gatech.edu (Christopher Klaus)
  3. Subject: v39i114:  iss - Internet Security Scanner, v1.02, Patch01
  4. Message-ID: <1993Sep29.221921.27286@sparky.sterling.com>
  5. X-Md4-Signature: 949a34d86b1c8e32a638e5ed23a5462c
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Wed, 29 Sep 1993 22:19:21 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: gt6468c@prism.gatech.edu (Christopher Klaus)
  12. Posting-number: Volume 39, Issue 114
  13. Archive-name: iss/patch01
  14. Environment: INET, UNIX
  15. Patch-To: iss: Volume 39, Issue 109
  16.  
  17. Some minor bugs were found in ISS and the code has been cleaned up 
  18. a little and fixed.
  19.  
  20. The changes made were:
  21. 1. Changing  S_un to s.addr which abreviates the structure, but also
  22.    makes it more compatible to compile on other machines.
  23. 2. The closing of files was changed from close(file) -> fclose(file).
  24. 3. Unnecessary variables have been removed.
  25. 4. One of the nested loops was incorrectly bracketted around the wrong 
  26.    command.
  27. 5. Incorrectly calling the function getname(a). Changed to getname(&a).
  28.  
  29. Here's the patch.
  30. -- 
  31. Christopher William Klaus
  32. Internet: gt6468c@prism.gatech.edu coup@gnu.ai.mit.edu cklaus@hotsun.nersc.gov
  33. 26468 GaTech Station, Atlanta Georgia, 30332   (404)-206-1513
  34.  
  35. *** iss/iss.c    Wed Sep 29 10:24:17 1993
  36. --- newiss/iss.c    Wed Sep 29 17:36:12 1993
  37. ***************
  38. *** 1,5 ****
  39.   /*
  40. !  * Internet Security Scannner v1.00
  41.    *
  42.    * Purpose: Check the Security of your Domain
  43.    *
  44. --- 1,5 ----
  45.   /*
  46. !  * Internet Security Scannner v1.02
  47.    *
  48.    * Purpose: Check the Security of your Domain
  49.    *
  50. ***************
  51. *** 43,48 ****
  52. --- 43,49 ----
  53.   #include <netdb.h>
  54.   #include <ctype.h>
  55.   #include <arpa/nameser.h>
  56. + #include <string.h>
  57.   #include "telnet.h"
  58.   
  59.   #define TELOPTS
  60. ***************
  61. *** 58,67 ****
  62.   
  63.   struct sockaddr_in a;
  64.   /* struct of socket */
  65. ! int s, x, y, i, len, hi, low, thirty = 30, sd;
  66.   int r;
  67.   /*  range values to scan */
  68. ! int first = 0, second = 0, low1 = 0, low2 = 0, high1 = 0, high2 = 0;
  69.   
  70.   int sec = 0, log = 0, port = 0;
  71.   /* Check to see when function is done */
  72. --- 59,68 ----
  73.   
  74.   struct sockaddr_in a;
  75.   /* struct of socket */
  76. ! int s, x, y, i, thirty = 30, sd;
  77.   int r;
  78.   /*  range values to scan */
  79. ! int first = 0, second = 0, low1 = 0, high1 = 0;
  80.   
  81.   int sec = 0, log = 0, port = 0;
  82.   /* Check to see when function is done */
  83. ***************
  84. *** 105,119 ****
  85.       sleep(5);
  86.       setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &thirty, sizeof(thirty));
  87.       s = socket(AF_INET, SOCK_STREAM, 0);
  88. !     printf("Retrying Socket.\n");
  89.       if (s < 0)
  90.       {
  91. !         printf("Socket is locked\n");
  92.       }
  93.       }
  94.       a.sin_port = (port == 0) ? 23 : port;
  95.       a.sin_family = AF_INET;
  96. !     a.sin_addr.S_un.S_addr = (first << 24) | (second << 16) | (x << 8) | (y);
  97.       r = connect(s, &a, sizeof(a));
  98.       return (s);
  99.   }
  100. --- 106,120 ----
  101.       sleep(5);
  102.       setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &thirty, sizeof(thirty));
  103.       s = socket(AF_INET, SOCK_STREAM, 0);
  104. !     (void) printf("Retrying Socket.\n");
  105.       if (s < 0)
  106.       {
  107. !         (void) printf("Socket is locked\n");
  108.       }
  109.       }
  110.       a.sin_port = (port == 0) ? 23 : port;
  111.       a.sin_family = AF_INET;
  112. !     a.sin_addr.s_addr = (first << 24) | (second << 16) | (x << 8) | (y);
  113.       r = connect(s, &a, sizeof(a));
  114.       return (s);
  115.   }
  116. ***************
  117. *** 121,127 ****
  118.   void
  119.   usage()
  120.   {
  121. !     printf("\n\nISS v1.0  (Internet Security Scanner)\n");
  122.       printf("Usage: %s -msrdyvpqef #1 #2 #3 #4\n", progname);
  123.       printf(" -m Ignores checking for mail port.\n");
  124.       printf(" -s xx number of seconds max to wait\n");
  125. --- 122,128 ----
  126.   void
  127.   usage()
  128.   {
  129. !     printf("\n\nISS v1.02 (Internet Security Scanner)\n");
  130.       printf("Usage: %s -msrdyvpqef #1 #2 #3 #4\n", progname);
  131.       printf(" -m Ignores checking for mail port.\n");
  132.       printf(" -s xx number of seconds max to wait\n");
  133. ***************
  134. *** 231,237 ****
  135.       fflush(fp);
  136.       if (login != 1)
  137.       {
  138. !     writeln("sync");
  139.       alarm(0);
  140.       alarm(3);
  141.       for (count = 0; count < 2; count++)
  142. --- 232,238 ----
  143.       fflush(fp);
  144.       if (login != 1)
  145.       {
  146. !     writeln(s,"sync");
  147.       alarm(0);
  148.       alarm(3);
  149.       for (count = 0; count < 2; count++)
  150. ***************
  151. *** 335,341 ****
  152.       sprintf(buf, "%s.dom", addr);
  153.       if ((nis = fopen(buf, "r")) == NULL)
  154.       {
  155. !     printf("\nError Opening File\n");
  156.       return (1);
  157.       }
  158.       while (!feof(nis))
  159. --- 336,342 ----
  160.       sprintf(buf, "%s.dom", addr);
  161.       if ((nis = fopen(buf, "r")) == NULL)
  162.       {
  163. !     (void) printf("\nError Opening File\n");
  164.       return (1);
  165.       }
  166.       while (!feof(nis))
  167. ***************
  168. *** 347,353 ****
  169.           fprintf(fp, "\nDomainname: %s NIS Server: %s", tryname, buf);
  170.       }
  171.       }
  172. !     close(nis);
  173.       sprintf(buf, "rm %s.dom", addr);
  174.       system(buf);
  175.   
  176. --- 348,354 ----
  177.           fprintf(fp, "\nDomainname: %s NIS Server: %s", tryname, buf);
  178.       }
  179.       }
  180. !     fclose(nis);
  181.       sprintf(buf, "rm %s.dom", addr);
  182.       system(buf);
  183.   
  184. ***************
  185. *** 509,515 ****
  186.       sprintf(buf, "%s.log", addr);
  187.       if ((rpc = fopen(buf, "r")) == NULL)
  188.       {
  189. !     printf("\nError Opening File\n");
  190.       return (1);
  191.       }
  192.       while (!feof(rpc))
  193. --- 510,516 ----
  194.       sprintf(buf, "%s.log", addr);
  195.       if ((rpc = fopen(buf, "r")) == NULL)
  196.       {
  197. !     (void) printf("\nError Opening File\n");
  198.       return (1);
  199.       }
  200.       while (!feof(rpc))
  201. ***************
  202. *** 564,578 ****
  203.           rusr = 1;
  204.       }
  205.       }
  206. !     close(rpc);
  207.   /* Try to guess domain name if ypserv was found */
  208.       if (yp)
  209.       {
  210. !     strcpy(testname, hname);
  211.       domainguess();
  212.       if (smtpname[0] != NULL)
  213.       {
  214. !         strcpy(testname, smtpname);
  215.           domainguess();
  216.           smtpname[0] = NULL;
  217.       }
  218. --- 565,579 ----
  219.           rusr = 1;
  220.       }
  221.       }
  222. !     fclose(rpc);
  223.   /* Try to guess domain name if ypserv was found */
  224.       if (yp)
  225.       {
  226. !     (void) strcpy(testname, hname);
  227.       domainguess();
  228.       if (smtpname[0] != NULL)
  229.       {
  230. !         (void) strcpy(testname, smtpname);
  231.           domainguess();
  232.           smtpname[0] = NULL;
  233.       }
  234. ***************
  235. *** 605,611 ****
  236.           }
  237.           }
  238.       }
  239. !     close(rpc);
  240.       }
  241.   /* Tries to get password file via ypserv, need ypx in local directory */
  242.   /* Plan to add my own code that grabs the password file */
  243. --- 606,612 ----
  244.           }
  245.           }
  246.       }
  247. !     fclose(rpc);
  248.       }
  249.   /* Tries to get password file via ypserv, need ypx in local directory */
  250.   /* Plan to add my own code that grabs the password file */
  251. ***************
  252. *** 632,639 ****
  253.           {
  254.           fprintf(fp, "%s", buf);
  255.           }
  256. -         close(rpc);
  257.       }
  258.   
  259.       }
  260.       sprintf(buf, "rm %s.log", addr);
  261. --- 633,640 ----
  262.           {
  263.           fprintf(fp, "%s", buf);
  264.           }
  265.       }
  266. +     fclose(rpc);
  267.   
  268.       }
  269.       sprintf(buf, "rm %s.log", addr);
  270. ***************
  271. *** 659,665 ****
  272.           sprintf(buf, "%s -p %s > %s.log 2> /dev/null", RPCINFO, addr, addr);
  273.           system(buf);
  274.       }
  275. !     getname(a);
  276.       fprintf(fp, "%s %s", addr, hname);
  277.       fprintf(fp, "\n>%s", temp2);
  278.       clrlog();
  279. --- 660,666 ----
  280.           sprintf(buf, "%s -p %s > %s.log 2> /dev/null", RPCINFO, addr, addr);
  281.           system(buf);
  282.       }
  283. !     getname(&a);
  284.       fprintf(fp, "%s %s", addr, hname);
  285.       fprintf(fp, "\n>%s", temp2);
  286.       clrlog();
  287. ***************
  288. *** 716,723 ****
  289.   {
  290.   #define BUFSIZE 16
  291.   
  292. -     char buf[BUFSIZE];
  293. -     char scratch[1024];
  294.       sethostent(1);
  295.       progname = argv[0];
  296.   
  297. --- 717,722 ----
  298. ***************
  299. *** 845,852 ****
  300.           a.sin_port = (port == 0) ? 23 : port;
  301.           a.sin_family = AF_INET;
  302.   
  303. !         a.sin_addr.S_un.S_addr = (first << 24) | (second << 16) | (x << 8) | (y);
  304. !         if (getname(a) == 1)    /* Look For Names */
  305.           {
  306.               checkall();    /* Try for addresses with names */
  307.           }
  308. --- 844,851 ----
  309.           a.sin_port = (port == 0) ? 23 : port;
  310.           a.sin_family = AF_INET;
  311.   
  312. !         a.sin_addr.s_addr = (first << 24) | (second << 16) | (x << 8) | (y);
  313. !         if (getname(&a) == 1)    /* Look For Names */
  314.           {
  315.               checkall();    /* Try for addresses with names */
  316.           }
  317. ***************
  318. *** 857,861 ****
  319.       }
  320.       }
  321.       endhostent();
  322. !     close(fp);
  323.   }
  324. --- 856,861 ----
  325.       }
  326.       }
  327.       endhostent();
  328. !     fclose(fp);
  329. !     return(0);
  330.   }
  331. exit 0 # Just in case...
  332.