trend-update.pl v1.03 released [PATCH]

Alain Fauconnet <[email protected]> Fri, 11 Feb 2005 11:23:37 +0700
Newsgroups gmane.comp.security.virus.vtools
Message-ID <[email protected]>
Hello List,

Well, my trend-update.pl didn't pass the recent Trend engine update
for Linux with flying colors *blush*. That has triggered 3 very, very
stupid bugs.

Note: this is unrelated to the
"getstore(http://www.trendmicro.com/ftp/products/engine/vsapi-x86-linux-7.500-1001.tar.z)
returned 404" errors that some may have seen. This was due to (I
presume) the file not being propagated to the Akamai caches yet.

So v1.03 is out. It'll be on my server in a few minutes at
http://itsec.ait.ac.th/download/local/trend-update.tar.gz.

To save you the hassle of porting your settings, I've also attached a
diff that can be applied to your existing v1.02 to this mail.

Sorry... the engine update code hadn't been tested in a long time and
I had broken it.

What's new in v1.03?

#                     - Fixed bug in trophie_alive() that caused it to return
#                       1 (true) if no PID was found
#                     - Fixed two missing quotes in chmod() calls that
#                       caused division by zero errors
#                     - With these two bugfixes, passed the engine update
#                       (oops)

Greets,
_Alain_

_______________________________________________
vtools mailing list
[email protected]
http://www.vanja.com/list/listinfo.cgi/vtools
trend-update-v1.02-v1.03.diff (text/plain, 2.8 KB)
*** /usr/local/sbin/trend-update.pl	Fri Nov 12 09:28:02 2004
--- trend-update.pl	Fri Feb 11 11:13:09 2005
***************
*** 132,137 ****
--- 132,144 ----
  #			  to use Mail::Mailer instead of HTTP::Request to send
  #			  out mail report and to improve Perl correctness.
  #			  (more to be applied later so that we can 'use strict')
+ # 11-Feb-2005 AlainF	Version 1.03
+ #			- Fixed bug in trophie_alive() that caused it to return
+ #			  1 (true) if no PID was found
+ #			- Fixed two missing quotes in chmod() calls that
+ #			  caused division by zero errors
+ #			- With these two bugfixes, passed the engine update
+ #			  (oops)
  
  #
  # Modules
***************
*** 388,394 ****
   # Wait a while, then check that the PID file exists and the
   # process is alive
   sleep $delay;
!  return trophie_alive()
  }
  
  # stop_trophie - stops Trophie
--- 395,401 ----
   # Wait a while, then check that the PID file exists and the
   # process is alive
   sleep $delay;
!  return trophie_alive();
  }
  
  # stop_trophie - stops Trophie
***************
*** 403,409 ****
   # Wait a while, then check that the PID file exists and the
   # process is alive
   sleep($delay);
!  return !trophie_alive()
  }
  
  # trophie_alive - checks that Trophie is running
--- 410,416 ----
   # Wait a while, then check that the PID file exists and the
   # process is alive
   sleep($delay);
!  return (trophie_alive() == 0);
  }
  
  # trophie_alive - checks that Trophie is running
***************
*** 411,420 ****
  sub trophie_alive {
   say(2, "Checking that Trophie is alive");
   $tpid = get_trophie_pid();
!  say(3, "Sending null signal to Trophie[$tpid]");
!  if (kill(0, $tpid) != 1) {
!   say(3, "Sending null signal to Trophie failed: $!");
!   return 0
   }
   return 1;
  }
--- 418,432 ----
  sub trophie_alive {
   say(2, "Checking that Trophie is alive");
   $tpid = get_trophie_pid();
!  if ($tpid != 0) {
!   say(3, "Sending null signal to Trophie[$tpid]");
!   if (kill(0, $tpid) != 1) {
!    say(3, "Sending null signal to Trophie failed: $!");
!    return 0
!   }
!  } else {
!   say(2, "No PID found for Trophie");
!   return 0;
   }
   return 1;
  }
***************
*** 954,965 ****
       push @newfiles, $file;
      }
      # Make sure we can write to it
!     chmod(0755, $trenddir/$file);
      open(OUTPART, ">$trenddir/$file");
      print(OUTPART $data);
      close(OUTPART);
      # Now make it unwritable
!     chmod(0555, $trenddir/$file);
     }
    }
    close ($taroutfh);
--- 966,977 ----
       push @newfiles, $file;
      }
      # Make sure we can write to it
!     chmod(0755, "$trenddir/$file");
      open(OUTPART, ">$trenddir/$file");
      print(OUTPART $data);
      close(OUTPART);
      # Now make it unwritable
!     chmod(0555, "$trenddir/$file");
     }
    }
    close ($taroutfh);