ben         97/12/26 07:52:38

  Modified:    src      CHANGES
               src/main util_script.c
  Log:
  Check for executables by looking at the header.
  Submitted by: Jim Patterson <[EMAIL PROTECTED]>
  Reviewed by:  Ben Laurie
  
  Revision  Changes    Path
  1.542     +4 -0      apachen/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.541
  retrieving revision 1.542
  diff -u -r1.541 -r1.542
  --- CHANGES   1997/12/24 04:36:11     1.541
  +++ CHANGES   1997/12/26 15:52:35     1.542
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3b4
   
  +  *) WIN32: Check for binaries by looking for the executable header
  +     instead of counting control characters.
  +      [Jim Patterson <[EMAIL PROTECTED]>] PR#1340
  +
     *) ap_snprintf() moved from main/util_snprintf.c to ap/ap_snprintf.c
        so the functionality is available to applications other than the
        server itself (like the src/support tools).  [Ken Coar]
  
  
  
  1.87      +4 -17     apachen/src/main/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/util_script.c,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- util_script.c     1997/12/07 21:49:54     1.86
  +++ util_script.c     1997/12/26 15:52:37     1.87
  @@ -728,23 +728,10 @@
                memmove(interpreter+2,interpreter+i,strlen(interpreter+i)+1);
            }
            else {
  -             /*
  -              * check and see how many control chars. On
  -              * that basis, I will classify it as a text
  -              * or binary file
  -              */
  -             int ctrl = 0;
  -
  -             for (i = 0; i < sz; i++) {
  -                 static char *spec = "\r\n\t";
  -                 if (iscntrl(interpreter[i]) && !strchr(spec, 
interpreter[i]))
  -                     ctrl++;
  -             }
  -             if (ctrl > sz / 10)
  -                 is_binary = 1;
  -             else
  -                 is_binary = 0;
  -
  +                        /* Check to see if it's a executable */
  +                IMAGE_DOS_HEADER *hdr = (IMAGE_DOS_HEADER*)interpreter;
  +                if (hdr->e_magic == IMAGE_DOS_SIGNATURE && hdr->e_cblp < 512)
  +                    is_binary = 1;
            }
        }
   
  
  
  

Reply via email to