changetrack/0000755000175000017500000000000011256046354013516 5ustar cmorlandcmorlandchangetrack/gnu_public_license.html0000644000175000017500000005032510210640462020227 0ustar cmorlandcmorland GNU General Public License - GNU Project - Free Software Foundation (FSF)

GNU General Public License

 [image of a Philosophical Gnu] (jpeg 7k) (jpeg 141k) no gifs due to patent problems


Table of Contents


GNU GENERAL PUBLIC LICENSE

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.  
59 Temple Place - Suite 330, Boston, MA  02111-1307, USA

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

one line to give the program's name and an idea of what it does.
Copyright (C) yyyy  name of author

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) yyyy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'.  This is free software, and you are welcome
to redistribute it under certain conditions; type `show c' 
for details.

The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright
interest in the program `Gnomovision'
(which makes passes at compilers) written 
by James Hacker.

signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.


Return to GNU's home page.

FSF & GNU inquiries & questions to gnu@gnu.org. Other ways to contact the FSF.

Comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.

Copyright notice above.
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA

Updated: 16 Feb 1998 tower


changetrack/changetrack0000755000175000017500000004555211256046334015727 0ustar cmorlandcmorland#!/usr/bin/perl # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301, USA. use File::Copy; use Getopt::Std; use File::Path; use FileHandle; use strict; # subroutine to copy while maintaining permissions sub copyWP { my $from = $_[0]; my $to = $_[1]; if (-e $to) { chmod(0600, $to) or die "Failed to prepare $to for overwriting: $!"; } copy($from, $to) or die "Failed to copy: $!"; my $mode = (stat($from))[2] & 0777; chmod($mode, $to) or die "Failed to chmod: $!"; } my @temp = split(' ', '$Revision: 4.7 $ '); my $version = $temp[1]; my $homedir = $ENV{"HOME"} || $ENV{"LOGDIR"} || (getpwuid($<))[7]; my $hostname = `hostname`; chomp($hostname); if(substr($homedir,-1,1) ne "/") {$homedir = $homedir . "/";} my ($rcs_quiet, $diffargs); my ($configfile, $historypath); if($< == 0) { # if we're root # check multiple locations for the config files; if none exist, # use the last one, and we'll die later on. Useful for different # operating systems. ((-e ($configfile = '/etc/changetrack.conf')) or (-e ($configfile = '/usr/local/etc/changetrack.conf'))); ((-e ($historypath = '/var/lib/changetrack')) or (-e ($historypath = '/var/db/changetrack'))); } else { $configfile = $homedir . '.changetrackrc'; $historypath = $homedir . '.changetrack'; } my $error = getopts('hc:d:a:m:erqM:vuo:f:'); our($opt_h, $opt_c, $opt_d, $opt_a, $opt_m, $opt_e, $opt_r, $opt_q, $opt_M, $opt_v, $opt_u, $opt_o, $opt_f); if($opt_h || !$error || @ARGV) { if(@ARGV) {print "Unknown option: @ARGV\n";} print <) { # for each config line chomp; if(m/\s*#/) { next; } #ignore comments if(m/^\s*$/) { next; } # ignore blank lines # split by whitespace:whitespace my ($filename,$email,$options)=split(/\s+:\s+/); # get the list of emails, separated by whitespace @emails = split(/\s+/,$email); # add any address specified by -o on command line if (defined($opt_o) && ($opt_o ne '')) { push @emails, $opt_o; } # list of emails for this file foreach $email (@emails) { if(index($emailaddresses,$email,0) == -1) { # if the user is not yet in the list, add them $emailaddresses .= " " . $email; } } my @files; my $firstchar = substr($filename,0,1); if( $firstchar eq "@" ) { my $rest = substr($filename,1); # execute as find command @files = split '\0', `find2perl $rest -print0 |perl`; } else { # make these relative to user's home directory if(substr($filename,0,1) ne "/") { $filename = $homedir . $filename; } # find non-backup files matching the filename @files = glob $filename; } my $anyfile = 0; # flag in case we find nothing foreach my $realfile ( @files ) { my @diff = (); my @ed = (); if( "$realfile" =~ m/[\r\n\f\t<>`\$&!'"{}()\[\]\|]/ ) { if(!$opt_q) { print "Skipping unsafe filename '$realfile'\n";} @diff = (@diff, "unsafe: '$realfile'\n"); next; } # skip backup files not explicitly included if((substr("$realfile",-1,1) eq "~") && ($filename =~ m/\*/)) { if(!$opt_q) { print "Skipping backup file $realfile\n";} next; } # skip directories if(-d "$realfile") { if(!$opt_q) { print "Skipping directory $realfile\n";} @diff = (@diff, "Is a directory: $realfile\n"); next; } if( ! -f "$realfile" ) { if(!$opt_q) { print "Skipping non-archivable $realfile\n";} @diff = (@diff, "Is not a plain file: $realfile\n"); next; } if( ! -e "$realfile" ) { if(!$opt_q) { print "Skipping non-existing $realfile\n";} @diff = (@diff, "Does not exist: $realfile\n"); next; } if( ! -r "$realfile" ) { if(!$opt_q) { print "Skipping unreadable $realfile\n";} @diff = (@diff, "Is not readable: $realfile\n"); next; } $anyfile = 1; # at least one real file found $compfile = $realfile; # file for comparison @temp = stat $realfile; # other statistics: $filemode= $temp[2] & 0777; # access mode $fileuid = $temp[4]; # owner $filegid = $temp[5]; # group $compfile =~ s|/|:|g; # replace '/' with ':' $compfile =~ s| |_|g; # replace ' ' with '_' $compfile =~ s|^:||; # trash leading ':' $compfile = $historypath . $compfile; $logfile = $compfile . ".history"; # stores past events $statfile = $compfile . ".statistics"; # stores current file info $origfile = $compfile . ".original"; # stores name of original file if($opt_e) { $outfile = $compfile . ".edout"; # output from ed script $edfile = $compfile . ".ed"; # ed script } $yestfile = $compfile . ".yesterday"; # stores current data if( ! -r "$yestfile" ) { # can't open yesterday, doesn't exist. @diff = (@diff, "New file '$realfile'\n"); if($opt_e) { @ed = (@ed,"# cat this file into ed, eg 'cat $edfile | ed'\n"); @ed = (@ed,"# output goes into $outfile\n"); @ed = (@ed,"# edit this file to get rid of commands you don't want.\n"); @ed = (@ed,"\n!cp \"$origfile\" \"$outfile\"\n"); @ed = (@ed,"E $outfile\n"); # keep a copy of original file copyWP($realfile, $origfile); } # so no changes noted today. copyWP($realfile, $yestfile); open (STAT, ">$statfile") or die "Exiting: can't open > $statfile:$!\n"; printf STAT "%o\n%s\n%s\n", $filemode, $fileuid, $filegid; close(STAT); if(!$opt_r) { copy($realfile, $compfile); chdir($historypath); `co $rcs_quiet "$compfile"`; # hack to make rcs work. system("rcs $rcs_quiet -i -t-'this is \"$realfile\"' \"$compfile\""); `rcs $rcs_quiet -U "$compfile"`; `rm -f "$compfile"`; } } open(STAT, "$statfile") or die "Exiting: can't open < $statfile:$!\n"; $oldfilemode = ; # get the old permissions chomp($oldfilemode); $oldfilemode = oct $oldfilemode; $oldfileuid = ; # get the old owner chomp($oldfileuid); $oldfilegid = ; # get the old group chomp($oldfilegid); close(STAT); $statschanged = 0; # 'nothing changed' flag if($oldfilemode != $filemode) { @diff = (@diff, (sprintf "File permissions changed: was %o now %o\n", $oldfilemode, $filemode)); @ed = (@ed, ( sprintf "!chmod %o %s\n", $filemode, $outfile)); $statschanged = 1; } if($oldfileuid != $fileuid) { $oldusername = getpwuid($oldfileuid); $username = getpwuid($fileuid); @diff = (@diff, "Owner changed: was $oldusername ($oldfileuid) now $username ($fileuid)\n"); @ed = (@ed,"!chown $fileuid $outfile\n"); $statschanged = 1; } if($oldfilegid != $filegid) { $oldgroupname = getgrgid($oldfilegid); $groupname = getgrgid($filegid); @diff = (@diff, "Group changed: was $oldgroupname ($oldfilegid) now $groupname ($filegid)\n"); @ed = (@ed,"!chgrp $filegid $outfile\n"); $statschanged = 1; } if($statschanged) { open(STAT, ">$statfile") or die "Exiting: can't open to rewrite $statfile:$!\n"; printf STAT "%o\n%s\n%s\n", $filemode, $fileuid, $filegid; close(STAT); } open(DIFF, "diff $diffargs \"$yestfile\" \"$realfile\" |") or die "Exiting: can't run diff:$!\n"; if(!$opt_q) { print "$realfile";}; while() { # line starts with < or > or not unified header if(m/^\/ || ($opt_u && !(m/^\-\-\-/||m/^\+\+\+/))) { if(!$opt_q) { print ".";}; # indicate progress @diff = (@diff, $_); # get that line } $diff = 1; # flag the changes } close(DIFF); if($diff) { open(DIFF, "diff -e \"$yestfile\" \"$realfile\" |") or die "Can't do diff -e:$!\n"; # use -e to create ed commands while() { @ed = (@ed,"$_"); # get the 'ed'-styled diffs. No need to understand them. } close(DIFF); } if(!$opt_q) {print "\n";}; if(@diff || $message) { # there is something to add to the output file # deal with emailing foreach $email (@emails) { # it's ok to append to things that don't exist. $emessages{$email} .= "Changes made to '$realfile' follow:\n"; foreach my $line (@diff) { $emessages{$email} .= " $line"; } if($message) { $emessages{$email} .= $message;} # don't forget the message $emessages{$email} .= "\n"; # separate from next file } open(LOG,">>$logfile") or die "Exiting: can't open $logfile:$!\n"; print LOG "Changes made on $date follow:\n"; foreach my $line (@diff) { print LOG " $line"; # save the line } if($message) { print LOG " $message\n"; # save any message (nb after all changes) } if(@diff && $Message) { print LOG $Message; # only if there are changes } print LOG "\n"; # and a blank line # save the file for next time copyWP($realfile, $yestfile); # preserve file mode for the RCS log file and yesterdayfile. chmod($filemode, $yestfile); my $chmodfile = $realfile; $chmodfile =~ s|/|:|g; $chmodfile =~ s| |_|g; $chmodfile =~ s|^:||g; # the RCS file should never be writable. chmod($filemode & 0444, "$historypath/RCS/$chmodfile,v"); chmod($filemode & 0444 | 0600, "$historypath/$chmodfile.history"); chmod($filemode & 0444 | 0600, "$historypath/$chmodfile.statistics"); close(LOG); if($opt_e) { open(ED,">>$edfile") or die "Exiting: can't open $edfile:$!\n"; chmod($filemode & 0444 | 0600, "$edfile"); foreach my $line (@ed) { print ED $line; # save the edits as well } print ED "w\n"; # make sure ed writes the changes when run. close(ED); } if(!$opt_r) { chdir($historypath) or die "Can't chdir to $historypath for ci: $!\n"; my $quiet = ""; print "cp \"$realfile\" \"$compfile\"\n" unless defined($opt_q); `co \"$compfile\"`; # hack to make rcs work here too! copyWP($realfile, $compfile); # make backup copy #`mv $realfile $realfile.track`; # copy backwards, to keep modification date #`cp $realfile.track $realfile`; # make backup copy system("ci $rcs_quiet -m'modification of \"$realfile\" on $date' -l \"$compfile\""); `rm $compfile`; } } } if(!$anyfile) { # no file was matched by 'ls', so create message for misspelled files $origfile = $filename; $filename =~ s|/|:|g; # replace each '/' by ':' $filename =~ s| |_|g; # replace each ' ' by '_' $filename =~ s|^:||; # remove leading ':' open(LOG, ">>$historypath$filename"); print LOG "$date No files match `$origfile'\n"; close(LOG); } } # The $mailfrom variable must be a valid email address (or at least be # from a valid domain). Otherwise, outbound mail may get rejected by # an intermediate MTA before it is delivered to your mailbox (the old # 'changetrack@localhost' address is blocked by some anti-spam # filters). my $mailfrom = 'changetrack@' . "$hostname"; # override by "from" address specified by -f on command line if (defined($opt_f) && ($opt_f ne '')) { $mailfrom = $opt_f; } if($emailaddresses) { @emails = split(/\s+/,$emailaddresses); my ($sendmail) = grep { -x } ('/usr/sbin/sendmail', '/usr/lib/sendmail'); $sendmail or die "no sendmail?\n"; foreach my $email (@emails) { if(($email) && ($message = $emessages{$email})) { my $pipe = FileHandle->new ("|$sendmail -f $mailfrom -oi -odi $email"); $pipe or die "$!"; local ($, , $\ ) = ('', ''); $pipe->printf ("From: %s\nTo: %s\nSubject: %s\n\n%s", $mailfrom, $email, "Changed files on $hostname: $date", $message); $pipe->close or warn "$?"; } } } # $Log: changetrack,v $ # Revision 4.7 2009/09/22 04:04:44 cmorland # Security fix from Debian. # # Revision 4.6 2009/07/21 17:10:19 cmorland # Copy even if we don't have write permission on the file. # Maintain current permissions! # # Revision 4.5 2006/06/22 18:45:32 cjmorlan # Allowed searching of multiple locations for root's config files, to # make it work nicely on FreeBSD, as demonstrated by Tiago de Lima # Bueno. # # Revision 4.4 2006/06/22 18:32:41 cjmorlan # Applied patch from Ian Zimmerman (via JPS) to use /usr/sbin/sendmail, # to adhere to Linux Standard Base. # # Revision 4.3 2005/02/28 16:50:23 cjmorlan # Removed debugging lines! # # Revision 4.2 2005/02/28 16:37:57 cjmorlan # Added find2perl patch from Sam Mikes, and documented it. # # Revision 4.1 2005/02/28 16:05:03 cjmorlan # Updated to revision 4. Also updated documentation. # # Revision 3.19 2005/02/28 15:22:19 cjmorlan # fixing it to match my old rcs system number. # # Revision 1.1.1.1 2004/11/09 14:12:24 cjmorlan # Initial checkin to CVS. # # Revision 3.18 2003/07/28 12:28:21 cjmorlan # Added patch from JPS to retain file permissions of *.ed files. # # Revision 3.17 2003/07/15 14:38:12 cjmorlan # Applied patch from Jens Peter Secher to use glob and oct instead of `ls`. # # Revision 3.16 2002/07/05 20:09:34 cjmorlan # added a second copy of the `co` hack to make rcs work. # # Revision 3.15 2002/07/04 14:11:38 cjmorlan # Added $HOSTNAME to subject line. # Made it work with "use strict;" # Regex cleanups. # Minor changes. # # Revision 3.14 2002/04/30 17:52:13 cjmorlan # Added -f option to specify the "From: " field in outgoing emails. # # Revision 3.13 2002/04/23 14:56:35 cjmorlan # Added | 0600 for history and statistics file, so they can always be # written by the owner. # # Revision 3.12 2002/04/18 18:43:40 cjmorlan # File permissions are now copied from the real file to the history, statistics, # yesterday, and RCS files. For the RCS files, no more than 0444 is granted. # # Revision 3.11 2002/04/18 17:59:19 cjmorlan # Fixed RCS file locking problem. # # Revision 3.10 2002/02/22 15:31:17 cjmorlan # Added patch from Jens Peter Secher # # Revision 3.9 2002/02/06 00:11:41 cjmorlan # Fixed serious flaws in 3.8 that prevented it from actually running. # # Revision 3.8 2002/02/05 23:46:17 cjmorlan # Make the installer smarter, so it detects File::NCopy and Mail::Sendmail # # Revision 3.7 2001/11/16 02:08:16 cjmorlan # Applied patch from Devin Reade # # Revision 3.6 2001/09/25 18:52:26 cjmorlan # Applied patch from Devin Reade to fix -o option. # # Revision 3.5 2001/03/06 18:47:33 cjmorlan # Intented according to emacs default. # Fixed some @foo[] # # Revision 3.4 2001/03/06 18:09:55 cjmorlan # Made version match RCS revision. # # Revision 3.3 2001/03/06 18:08:37 cjmorlan # Added change from Ian Zimmerman, fixing RCS integration bug. # # Revision 3.2 1999/10/21 20:32:13 cjmorlan # added email features, cleaned. # Release version 2 # # Revision 3.1 1999/10/20 18:04:54 cjmorlan # replaced quotewords with split # # Revision 3.0 1999/09/24 04:45:03 cmorland # To add ideas from FSF # changetrack/Makefile0000644000175000017500000000035010211626056015145 0ustar cmorlandcmorlandtest: @sh test.sh install: test cp changetrack /usr/local/bin/ cp changetrack.man /usr/local/man/man1/ cp changetrack.conf /etc/ @echo "Examine and customize /etc/changetrack.conf." @echo "Add changetrack to your crontab." changetrack/test.sh0000755000175000017500000000104711231376563015037 0ustar cmorlandcmorland#!/bin/sh if [ ! `which perl` ] ; then echo "This program requires Perl." exit 1 fi FAILCHANGETRACKTEST= for I in File::Copy Getopt::Std File::Path FileHandle strict; do echo "Checking $I..." perl -e "use $I;" if [ "$?" -ne 0 ] ; then echo "Perl library '$I' is not installed.\nYou might find it here: http://search.cpan.org/search?query=$I" FAILCHANGETRACKTEST=-1 fi done rcs -V >/dev/null if [ "$?" -ne 0 ] ; then echo "RCS is not installed." FAILCHANGETRACKTEST=-1 fi if [ $FAILCHANGETRACKTEST ] ; then exit 1 fi changetrack/README0000644000175000017500000000352510210644344014373 0ustar cmorlandcmorlandUSE Changetrack is a program to monitor changes to a bunch of files. If files are modify one day, and the machine start working incorrectly some days later, Changetrack can provide information on which files were modified, and help locate the problem. Changetrack will also allow recovery of the files from any stage. This program makes human-readable output, and also uses RCS to allow recovery of any stage of revision. CONFIGURATION Files are listed in ~/.changetrackrc or (/etc/changetrack.conf if run as root), and numerous commandline options are available. List them by tying "changetrack -h". Each line in the file can contain file match patterns usable by glob or find2perl. See the included changetrack.conf for examples. MAINTENANCE It probably would be a good idea to go through and delete extremely out of date changes, to prevent confusion and excessive disk usage. SCHEDULE Changetrack is generally run from the crontab. If you are just worried about occassional changes, running it daily should be sufficient. If you are doing very intense modifications, it might be reasonable to run it every hour (or even more frequently). To keep track of shutdowns and reboots, and especially unplanned reboots (crashes), run Changetrack with the option "-m shutdown" in a shutdown script, and with a "-m startup" in a startup script. This will put the shutdown/startup message in each file, after any other changes have been listed. Any "startup" message without a preceding "shutdown" message indicates that the machine was not properly shut down. (This may be more annoyance than help on any machine which is frequently shut down.) TODO * Automate removal of out-of-date changes, to save disk space and clarify the important changes. * Fix any bugs (see the manual). GETTING CHANGETRACK Changetrack is available at http://changetrack.sourceforge.net/ changetrack/INSTALL0000644000175000017500000000111211231377174014542 0ustar cmorlandcmorlandINSTALLATION REQUIREMENTS This program works on UNIX-type systems. It likely will not work with any version of Perl before 5. The emailing functionality requires /usr/sbin/sendmail. To install changetrack, run `make install`. This will verify that needed packages are installed, and copy files appropriately. You should then customize the configuration file and set up a cron job so changetrack runs periodically. To do this type "crontab -e". This will open your cron tab in your editor. Add a line like "0 12 * * * changetrack -uq". This will run changetrack every day at noon. changetrack/changetrack.man0000644000175000017500000001032110210640461016446 0ustar cmorlandcmorland.TH CHANGETRACK 1 "" "" \" -*- nroff -*- .SH NAME changetrack \- track changes to configuration files .SH SYNOPSIS .B changetrack [-h] [\-c configfile] [\-d directory] [-e] [-r] [-q] [\-m message] [\-M message] [-v] [-u] [\-o emailaddress] .SH DESCRIPTION .B changetrack is a program to monitor changes to a bunch of files. If files are modify one day, and the machine starts working incorrectly some days later, .B changetrack can provide information on which files were modified, and help locate the problem. .PP Normally .B changetrack uses .B rcs to keep track of various revisions of the files. Each file is "installed" in the .B rcs system the first time that .B changetrack is run after that file is added to the config file. Whenever .B changetrack is run after that, a copy of the file is made, which is 'checked in' and implicitly 'checked out' of the .B rcs system. See the man page of .B co for information on retrieving an old version of the file. .PP Backup files (ending in tilde ~) are ignored, unless explicitely included. .PP After each pattern in the file list, adding white space, a colon (:) then more whitespace, followed by email addresses, separated by more whitespace, will result in the changes to that file being emailed to that address. All changes from each run are expressed in one email. Using the email feature requires Mail::SendMail to be installed; if it does not work correctly, an error message will be printed to standard error. .SH OPTIONS .TP .B \-h Display a short help message then exit. .TP .BI \-c "configfile" Get the list of files to track from .I configfile instead of from ~/.changetrackrc (/etc/changetrack.conf for the super-user) .TP .BI \-d "outputdirectory" Store output in .I outputdirectory instead of in ~/.changetrack/ (/var/lib/changetrack/ for the super-user) .TP .BI \-e Keep a copy of the file from when it was first added to the .B changetrack configuration, and keep .B ed -styled changes to rebuild the file. .I This option is recommended only if .BI rcs .I does not work on the machine. To recover using this means, the .ed file should have the last several commands removed, to allow the file to be rebuilt to the appropriate state. A command like 'cat myfile.ed | ed myfile.original' should be executed. .TP .B \-r Disable the .B rcs facility. .TP .B \-q Quiet mode; only print critical messages. Good for scripts. .TP .BI \-m "message" Print .I message on each file, after checking for any changes. Good for indicating reboots or other system events. .TP .BI \-M "message" Like \-m, but message is only printed on modified files. .TP .BI \-v Print version and exit. .TP .B \-u Use unified diffs (this only works with some implementations of .BI diff. .TP .BI \-o "emailaddress" Mail output to emailaddress. This is supplementary to emails specified in the config file. + .TP + .BI \-f "emailaddress" + Set "From" header to emailaddress (which must be a valid). .SH REQUIREMENTS This program requires .B diff. Unless the .B -r switch is used, this program requires .B rcs to be installed. If the .B -e switch is used, .B ed is required. .SH FILES .TP ~/.changetrackrc List of files to monitor. Each line may start with '#' indicating a comment. If a line is not a comment, it contains a file/pattern to monitor, and optionally " : " followed by any email addresses to send changes to. The filename may be a pattern described in the same way as for .B ls. Note: the default is .B /etc/changetrack.conf for root. .TP ~/.changetrack/ Default directory in which to store output information. The default is .B /var/lib/changetrack/ for root. All .B rcs files are stored in this directory, unless a subdirectory called RCS exists, in which case the .B rcs files are stored in that directory. .SH DIAGNOSTICS Each filename is written to standard output. .B rcs will print errors if certain things go wrong. It will also print a few lines each time .B changetrack is run after a new file is added to the configuration. .SH IDENTIFICATION Author: Cameron J. Morland. .br Manual Page Revision: 2.1 Release Date: 2001-03-06. .br Copyright \(co 2001-2005 Cameron J. Morland. .SH "SEE ALSO" rcsintro(1), co(1) .SH TODO Automate removal of out-of-date changes, to save disk space and clarify the important changes. .SH BUGS None known. changetrack/changetrack.conf0000644000175000017500000000154011231377010016624 0ustar cmorlandcmorland# this is the configuration file for changetrack. # you can use ls-compatible wildcards, # like /etc/h* or /opt/apache/cgi-bin/*.sh # # If you omit the leading '/' then it assumes that they # are relative to your home directory (~/), or / if you're root. # To email changes to users, use a line like: # /etc/passwd : root@localhost foo@bar.com # Note: one email will be sent to each user, unless none of the files # monitored by that user are modified. # common system files /etc/passwd /etc/hosts /etc/services #/etc/resolv.conf #/etc/inetd.conf #/etc/nsswitch.conf # If the filename starts with '@' we will assume the rest is a # find2perl compatible search, such as: # all the files ending in ".conf", recursively @ /etc -name "*.conf" # all world-readable text files under /etc (don't follow symlinks) #@/etc -type f -type T -perm -444 : root@localhost changetrack/gnu_short.txt0000644000175000017500000000140410446563030016261 0ustar cmorlandcmorlandchangetrack - track changes to configuration files Copyright (C) 1999-2006 Cameron J. Morland This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.