mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhamain.pl,2.51,2.52 mhdb.pl,2.23,2.24 mhfile.pl,2...

2002-11-20 16:53:29
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv8630/lib

Modified Files:
	mhamain.pl mhdb.pl mhfile.pl mhindex.pl mhinit.pl 
	mhmimetypes.pl mhopt.pl mhrcfile.pl mhthread.pl mhusage.pl 
	osinit.pl 
Log Message:
* New resources:
    DBFILEPERMS		File permissions for DBFILE.
    FILEPERMS		File permissions for archive files.

* Archive file creation modified to minimize the local symlink exploits:

  1.  A temp file with a random name is first created and written to.
  2.  Temp file is compressed if GZIPFILES is active.
  3.  Temp file is renamed to final filename.
  4.  File permissions are set according to FILEPERMS/DBFILEPERMS.

  Using a random temp filename makes it difficult for someone to
  predict filenames to execute a symlink exploit.  The rename operation
  is immune to symlink exploits, hence trying to using well-known names
  (e.g. maillist.html, threads.html) for exploitation will not work.

  Generation of temp files is done via the File::Temp module, if
  installed.  If not installed, a homegrown implementation is used.
  Although not as secure and robust as File::Temp, it's better than
  nothing and should provide a decent deterrent.

* Setuid/setgid execution causes mhonarc to terminate with an error.
  Mhonarc does not pass taint checks, so we abort with an error that
  setuid/setgid execution is not supported.  MHonArc is too insecure
  for setuid operation and trying to make it setuid-safe would require
  alot of work and potentially limit a large amount of functionality.

* Added check for Fcntl and File::Basename modules in FILELIST.

* Added stylesheet for documentation.  Main page docs updated to
  include class attributes to get desired rendering.  Updating
  resource reference pages will be done gradually to leverage
  style settings.  Since there is so many pages, it will be done
  on a page-by-page basis.  Maybe I can write a perl script that
  could auto-add class atteibutes where appropriate.


Index: mhamain.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhamain.pl,v
retrieving revision 2.51
retrieving revision 2.52
diff -C2 -r2.51 -r2.52
*** mhamain.pl	31 Oct 2002 05:21:50 -0000	2.51
--- mhamain.pl	20 Nov 2002 23:53:12 -0000	2.52
***************
*** 39,42 ****
--- 39,63 ----
  EndOfInfo
  
+ ###############################################################################
+ BEGIN {
+     ## Check what system we are executing under
+     require 'osinit.pl';  &OSinit();
+ 
+     ## Check if running setuid/setgid
+     $TaintMode = 0;
+     if ($UNIX && (( $< != $> ) || ( $( != $) ))) {
+ 	## We do not support setuid since there are too many
+ 	## security problems to handle, and if we did, mhonarc
+ 	## would probably not be very useful.
+ 	die "ERROR: setuid/setgid execution not supported!\n";
+ 
+ 	#$TaintMode = 1;
+ 	#$ENV{'PATH'}  = '/bin:/usr/bin';
+ 	#$ENV{'SHELL'} = '/bin/sh'  if exists $ENV{'SHELL'};
+ 	#delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+     }
+ }
+ ###############################################################################
+ 
  $CODE		= 0;
  $ERROR  	= "";
***************
*** 52,56 ****
  );
  
- 
  ###############################################################################
  ##	Public routines
--- 73,76 ----
***************
*** 65,71 ****
      my($curfh) = select(STDOUT);  $| = 1;  select($curfh);
  
-     ##	Check what system we are executing under
-     require 'osinit.pl';  &OSinit();
- 
      ##	Require essential libraries
      require 'mhlock.pl';
--- 85,88 ----
***************
*** 1001,1005 ****
      my($index, $force, $nocustom) = @_;
      my($msgi, $tmp, $tmp2, $template, @array2);
!     my($msghandle, $msginfh, $drvfh);
  
      my $msgnum	     = $IndexNum{$index};
--- 1018,1022 ----
      my($index, $force, $nocustom) = @_;
      my($msgi, $tmp, $tmp2, $template, @array2);
!     my($msghandle, $msginfh);
  
      my $msgnum	     = $IndexNum{$index};
***************
*** 1014,1018 ****
      my $filename     = msgnum_filename($msgnum);
      my $filepathname = join($DIRSEP, $OUTDIR, $filename);
!     my $tmppathname  = join($DIRSEP, $OUTDIR, "msgtmp.$$");
  
      if ($adding) {
--- 1031,1035 ----
      my $filename     = msgnum_filename($msgnum);
      my $filepathname = join($DIRSEP, $OUTDIR, $filename);
!     my $tmppathname;
  
      if ($adding) {
***************
*** 1037,1041 ****
  	$msghandle = \*STDOUT;
      } else {
! 	$msghandle = file_create($tmppathname, $GzipFiles);
      }
  
--- 1054,1058 ----
  	$msghandle = \*STDOUT;
      } else {
! 	($msghandle, $tmppathname) = file_temp('tmsgXXXXXXXXXX', $OUTDIR);
      }
  
***************
*** 1267,1288 ****
  	#&file_remove($tmppathname);
      }
!     file_rename($tmppathname, $filepathname)  unless $SINGLE;
  
      ## Create user defined files
      foreach (keys %UDerivedFile) {
  	($tmp = $_) =~ s/$VarExp/&replace_li_var($1,$index)/geo;
! 	$tmp2 = join($DIRSEP, $OUTDIR, $tmp);
! 	if ($drvfh = file_create($tmp2, $GzipFiles)) {
! 	    ($template = $UDerivedFile{$_}) =~
! 		s/$VarExp/&replace_li_var($1,$index)/geo;
! 	    print $drvfh $template;
! 	    close($drvfh);
! 	    if (defined($Derived{$index})) {
! 		push(@{$Derived{$index}}, $tmp);
! 	    } else {
! 		$Derived{$index} = [ $tmp ];
! 	    }
  	} else {
! 	    warn "Warning: Unable to create $tmp2\n";
  	}
      }
--- 1284,1308 ----
  	#&file_remove($tmppathname);
      }
!     if (!$SINGLE) {
! 	file_gzip($tmppathname)  if $GzipFiles;
! 	file_chmod(file_rename($tmppathname, $filepathname));
!     }
  
      ## Create user defined files
+     my($drvfh);
      foreach (keys %UDerivedFile) {
  	($tmp = $_) =~ s/$VarExp/&replace_li_var($1,$index)/geo;
! 	($drvfh, $tmppathname) = file_temp('drvXXXXXXXXXX', $OUTDIR);
! 	($template = $UDerivedFile{$_}) =~
! 	    s/$VarExp/&replace_li_var($1,$index)/geo;
! 	print $drvfh $template;
! 	close($drvfh);
! 	file_gzip($tmppathname)  if $GzipFiles;
! 	file_chmod(file_rename($tmppathname, join($DIRSEP, $OUTDIR, $tmp)));
! 
! 	if (defined($Derived{$index})) {
! 	    push(@{$Derived{$index}}, $tmp);
  	} else {
! 	    $Derived{$index} = [ $tmp ];
  	}
      }

Index: mhdb.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhdb.pl,v
retrieving revision 2.23
retrieving revision 2.24
diff -C2 -r2.23 -r2.24
*** mhdb.pl	17 Nov 2002 03:38:52 -0000	2.23
--- mhdb.pl	20 Nov 2002 23:53:12 -0000	2.24
***************
*** 26,29 ****
--- 26,31 ----
  ##---------------------------------------------------------------------------##
  
+ use File::Basename;
+ 
  ##---------------------------------------------------------------------------
  ##	output_db() spits out the state of mhonarc to a file.  This
***************
*** 38,42 ****
  sub output_db {
      my($pathname) = shift;
!     my $tmpfile = $pathname . "$$";
  
      ## Invoke pre-save callback
--- 40,45 ----
  sub output_db {
      my($pathname) = shift;
!     my($dirname) = dirname($pathname);
!     my($db, $tmpfile) = file_temp('dbXXXXXXXXXX', $dirname);
  
      ## Invoke pre-save callback
***************
*** 45,387 ****
      }
  
!     local(*DB);
!     if (!open(DB, ">$tmpfile")) {
  	warn qq/ERROR: Unable to create "$tmpfile": $!\n/;
  	return 0;
      }
!     binmode(DB);  # Unix text format okay for Perl source on Windog
  
! print DB "## MHonArcDB (Automatically generated by MHonArc)\n";
! print_var(\*DB,'DbVERSION',     \$VERSION);
  
  ## Meta-data
! print_var(\*DB,'ContentType', \%ContentType);
! print_var(\*DB,'Date',        \%Date);
! print_var(\*DB,'Derived',     \%Derived);
! print_var(\*DB,'FollowOld',   \%Follow);
! print_var(\*DB,'From',        \%From);
! print_var(\*DB,'IndexNum',    \%IndexNum);
! print_var(\*DB,'MsgId',       \%MsgId);
! print_var(\*DB,'Refs',        \%Refs);
! print_var(\*DB,'Subject',     \%Subject);
! print_var(\*DB,'TListOrder',  \(_at_)TListOrder);
! print_var(\*DB,'NumOfMsgs',   \$NumOfMsgs);
! print_var(\*DB,'NumOfPages',  \$NumOfPages);
! print_var(\*DB,'SaveRsrcs',   \$SaveRsrcs);
  
  if ($SaveRsrcs) {
  
  ## Resources
! print_var(\*DB,'CustomRcVars',\%CustomRcVars);
! print_var(\*DB,'FieldODefs',  \%FieldODefs);
! print_var(\*DB,'HFieldsExc',  \%HFieldsExc);
! print_var(\*DB,'HeadFields',  \%HeadFields);
! print_var(\*DB,'HeadHeads',   \%HeadHeads);
! print_var(\*DB,'Icons',       \%Icons);
! print_var(\*DB,'UDerivedFile',\%UDerivedFile);
! print_var(\*DB,'ZoneUD',      \%ZoneUD);
  
  unless ($IsDefault{'CHARSETALIASES'}) {
!     print_var(\*DB,'readmail::MIMECharsetAliases',
  		    \%readmail::MIMECharsetAliases);
  }
  unless ($IsDefault{'CHARSETCONVERTERS'}) {
!     print_var(\*DB,'readmail::MIMECharSetConverters',
  		    \%readmail::MIMECharSetConverters);
!     print_var(\*DB,'readmail::MIMECharSetConvertersSrc',
  		    \%readmail::MIMECharSetConvertersSrc);
  }
  unless ($IsDefault{'MIMEDECODERS'}) {
!     print_var(\*DB,'readmail::MIMEDecoders',
  		    \%readmail::MIMEDecoders);
!     print_var(\*DB,'readmail::MIMEDecodersSrc',
  		    \%readmail::MIMEDecodersSrc);
  }
  unless ($IsDefault{'MIMEFILTERS'}) {
!     print_var(\*DB,'readmail::MIMEFilters',
  		    \%readmail::MIMEFilters);
!     print_var(\*DB,'readmail::MIMEFiltersSrc',
  		    \%readmail::MIMEFiltersSrc);
  }
! print_var(\*DB,'readmail::MIMEFiltersArgs',
  		\%readmail::MIMEFiltersArgs)
  		unless $IsDefault{'MIMEARGS'};
  if (%readmail::MIMEExcs) {
!     print_var(\*DB,'readmail::MIMEExcs',
  		    \%readmail::MIMEExcs)
  		    unless $IsDefault{'MIMEEXCS'};
  }
  unless ($IsDefault{'MIMEALTPREFS'}) {
!     print_var(\*DB,'MIMEAltPrefs',
  		    \(_at_)MIMEAltPrefs);
  }
  
! print_var(\*DB,'DateFields', \(_at_)DateFields) unless $IsDefault{'DATEFIELDS'};
! print_var(\*DB,'FieldOrder', \(_at_)FieldOrder);
! print_var(\*DB,'FromFields', \(_at_)FromFields) unless $IsDefault{'FROMFIELDS'};
! print_var(\*DB,'Months',     \(_at_)Months)     if scalar(@Months);
! print_var(\*DB,'months',     \(_at_)months)     if scalar(@months);
! print_var(\*DB,'OtherIdxs',  \(_at_)OtherIdxs)  if scalar(@OtherIdxs);
! print_var(\*DB,'PerlINC',    \(_at_)PerlINC)    if scalar(@PerlINC);
! print_var(\*DB,'Weekdays',   \(_at_)Weekdays)   if scalar(@Weekdays);
! print_var(\*DB,'weekdays',   \(_at_)weekdays)   if scalar(@weekdays);
  
  ## I should use a hash for this stuff instead of individual variables.
  ## A legacy of Perl 4 days and a program getting larger than expected.
  
! print_var(\*DB,'AddressModify',  \$AddressModify)
  				unless $IsDefault{'AddressModify'};
! print_var(\*DB,'CheckNoArchive', \$CheckNoArchive);
! print_var(\*DB,'DOCURL',         \$DOCURL);
! print_var(\*DB,'NODOC',          \$NODOC);
! print_var(\*DB,'DecodeHeads',    \$DecodeHeads);
! print_var(\*DB,'DoFolRefs',      \$DoFolRefs);
! print_var(\*DB,'ExpireDate',     \$ExpireDate);
! print_var(\*DB,'ExpireTime',     \$ExpireTime);
! print_var(\*DB,'FROM',           \$FROM);
! print_var(\*DB,'GMTDateFmt',     \$GMTDateFmt);
! print_var(\*DB,'GzipExe',        \$GzipExe);
! print_var(\*DB,'GzipFiles',      \$GzipFiles);
! print_var(\*DB,'GzipLinks',      \$GzipLinks);
! print_var(\*DB,'HtmlExt',        \$HtmlExt);
! print_var(\*DB,'IDXSIZE',        \$IDXSIZE);
! print_var(\*DB,'KeepOnRmm',      \$KeepOnRmm);
! print_var(\*DB,'LocalDateFmt',   \$LocalDateFmt);
! print_var(\*DB,'MAILTOURL',      \$MAILTOURL)  unless $IsDefault{'MAILTOURL'};
! print_var(\*DB,'MAIN',           \$MAIN);
! print_var(\*DB,'MAXSIZE',        \$MAXSIZE);
! print_var(\*DB,'MHPATTERN',      \$MHPATTERN);
! print_var(\*DB,'MODTIME',        \$MODTIME);
! print_var(\*DB,'MSGFOOT',        \$MSGFOOT);
! print_var(\*DB,'MsgGMTDateFmt',  \$MsgGMTDateFmt);
! print_var(\*DB,'MSGHEAD',        \$MSGHEAD);
! print_var(\*DB,'MsgExcFilter',   \$MsgExcFilter);
! print_var(\*DB,'MsgLocalDateFmt',\$MsgLocalDateFmt);
! print_var(\*DB,'MsgPrefix',      \$MsgPrefix);
! print_var(\*DB,'MULTIIDX',       \$MULTIIDX);
! print_var(\*DB,'NOMAILTO',       \$NOMAILTO);
! print_var(\*DB,'NONEWS',         \$NONEWS);
! print_var(\*DB,'NOURL',          \$NOURL);
! print_var(\*DB,'NoMsgPgs',       \$NoMsgPgs);
! print_var(\*DB,'NoSubjectThreads', \$NoSubjectThreads);
! print_var(\*DB,'NoSubjectTxt',   \$NoSubjectTxt);
! print_var(\*DB,'NoteDir',        \$NoteDir);
! print_var(\*DB,'POSIXstrftime',  \$POSIXstrftime);
! print_var(\*DB,'THREAD',         \$THREAD);
! print_var(\*DB,'SubArtRxp',      \$SubArtRxp);
! print_var(\*DB,'SubReplyRxp',    \$SubReplyRxp);
! print_var(\*DB,'SubStripCode',   \$SubStripCode);
! print_var(\*DB,'UseLocalTime',   \$UseLocalTime);
! print_var(\*DB,'UsingLASTPG',    \$UsingLASTPG);
! print_var(\*DB,'VarExp',    	 \$VarExp);
! 
! print_var(\*DB,'MSGPGSSMARKUP',  \$MSGPGSSMARKUP);
! print_var(\*DB,'IDXPGSSMARKUP',  \$IDXPGSSMARKUP);
! print_var(\*DB,'TIDXPGSSMARKUP', \$TIDXPGSSMARKUP);
! print_var(\*DB,'SSMARKUP',       \$SSMARKUP);
! print_var(\*DB,'SpamMode',       \$SpamMode);
  
  if (!$IsDefault{'TEXTCLIPFUNC'}) {
!     print_var(\*DB,'TextClipFunc', \$TextClipFunc);
!     print_var(\*DB,'TextClipSrc',  \$TextClipSrc);
  };
  
  # Main index resources
! print_var(\*DB,'AUTHSORT',     \$AUTHSORT);
! print_var(\*DB,'NOSORT',       \$NOSORT);
! print_var(\*DB,'REVSORT',      \$REVSORT);
! print_var(\*DB,'SUBSORT',      \$SUBSORT);
! 
! print_var(\*DB,'AUTHBEG',      \$AUTHBEG) unless $IsDefault{'AUTHBEG'};
! print_var(\*DB,'AUTHEND',      \$AUTHEND) unless $IsDefault{'AUTHEND'};
! print_var(\*DB,'DAYBEG',       \$DAYBEG) unless $IsDefault{'DAYBEG'};
! print_var(\*DB,'DAYEND',       \$DAYEND) unless $IsDefault{'DAYEND'};
! print_var(\*DB,'IDXLABEL',     \$IDXLABEL) unless $IsDefault{'IDXLABEL'};
! print_var(\*DB,'IDXNAME',      \$IDXNAME);
! print_var(\*DB,'IDXPGBEG',     \$IDXPGBEG) unless $IsDefault{'IDXPGBEG'};
! print_var(\*DB,'IDXPGEND',     \$IDXPGEND) unless $IsDefault{'IDXPGEND'};
! print_var(\*DB,'IDXPREFIX',    \$IDXPREFIX);
! print_var(\*DB,'LIBEG',        \$LIBEG) unless $IsDefault{'LIBEG'};
! print_var(\*DB,'LIEND',        \$LIEND) unless $IsDefault{'LIEND'};
! print_var(\*DB,'LITMPL',       \$LITMPL) unless $IsDefault{'LITMPL'};
! print_var(\*DB,'FIRSTPGLINK',  \$FIRSTPGLINK) unless $IsDefault{'FIRSTPGLINK'};
! print_var(\*DB,'LASTPGLINK',   \$LASTPGLINK) unless $IsDefault{'LASTPGLINK'};
! print_var(\*DB,'NEXTPGLINK',   \$NEXTPGLINK) unless $IsDefault{'NEXTPGLINK'};
! print_var(\*DB,'NEXTPGLINKIA', \$NEXTPGLINKIA)
  				unless $IsDefault{'NEXTPGLINKIA'};
! print_var(\*DB,'PREVPGLINK',   \$PREVPGLINK) unless $IsDefault{'PREVPGLINK'};
! print_var(\*DB,'PREVPGLINKIA', \$PREVPGLINKIA)
  				unless $IsDefault{'PREVPGLINKIA'};
! print_var(\*DB,'SUBJECTBEG',   \$SUBJECTBEG) unless $IsDefault{'SUBJECTBEG'};
! print_var(\*DB,'SUBJECTEND',   \$SUBJECTEND) unless $IsDefault{'SUBJECTEND'};
! print_var(\*DB,'TITLE',        \$TITLE);
  
  # Thread index resources
! print_var(\*DB,'TNOSORT',      \$TNOSORT);
! print_var(\*DB,'TREVERSE',     \$TREVERSE);
! print_var(\*DB,'TSUBSORT',     \$TSUBSORT);
! 
! print_var(\*DB,'TCONTBEG',     \$TCONTBEG) unless $IsDefault{'TCONTBEG'};
! print_var(\*DB,'TCONTEND',     \$TCONTEND) unless $IsDefault{'TCONTEND'};
! print_var(\*DB,'TFOOT',        \$TFOOT) unless $IsDefault{'TFOOT'};
! print_var(\*DB,'THEAD',        \$THEAD) unless $IsDefault{'THEAD'};
! print_var(\*DB,'TIDXLABEL',    \$TIDXLABEL) unless $IsDefault{'TIDXLABEL'};
! print_var(\*DB,'TIDXNAME',     \$TIDXNAME);
! print_var(\*DB,'TIDXPGBEG',    \$TIDXPGBEG) unless $IsDefault{'TIDXPGBEG'};
! print_var(\*DB,'TIDXPGEND',    \$TIDXPGEND) unless $IsDefault{'TIDXPGEND'};
! print_var(\*DB,'TIDXPREFIX',   \$TIDXPREFIX);
! print_var(\*DB,'TINDENTBEG',   \$TINDENTBEG) unless $IsDefault{'TINDENTBEG'};
! print_var(\*DB,'TINDENTEND',   \$TINDENTEND) unless $IsDefault{'TINDENTEND'};
! print_var(\*DB,'TLEVELS',      \$TLEVELS);
! print_var(\*DB,'TLIEND',       \$TLIEND) unless $IsDefault{'TLIEND'};
! print_var(\*DB,'TLINONE',      \$TLINONE) unless $IsDefault{'TLINONE'};
! print_var(\*DB,'TLINONEEND',   \$TLINONEEND) unless $IsDefault{'TLINONEEND'};
! print_var(\*DB,'TLITXT',       \$TLITXT) unless $IsDefault{'TLITXT'};
! print_var(\*DB,'TFIRSTPGLINK', \$TFIRSTPGLINK)
  				unless $IsDefault{'TFIRSTPGLINK'};
! print_var(\*DB,'TLASTPGLINK',  \$TLASTPGLINK)
  				unless $IsDefault{'TLASTPGLINK'};
! print_var(\*DB,'TNEXTPGLINK',  \$TNEXTPGLINK) unless $IsDefault{'TNEXTPGLINK'};
! print_var(\*DB,'TNEXTPGLINKIA',\$TNEXTPGLINKIA)
  				unless $IsDefault{'TNEXTPGLINKIA'};
! print_var(\*DB,'TPREVPGLINK',  \$TPREVPGLINK) unless $IsDefault{'TPREVPGLINK'};
! print_var(\*DB,'TPREVPGLINKIA',\$TPREVPGLINKIA)
  				unless $IsDefault{'TPREVPGLINKIA'};
! print_var(\*DB,'TSINGLETXT',   \$TSINGLETXT) unless $IsDefault{'TSINGLETXT'};
! print_var(\*DB,'TSUBJECTBEG',  \$TSUBJECTBEG) unless $IsDefault{'TSUBJECTBEG'};
! print_var(\*DB,'TSUBJECTEND',  \$TSUBJECTEND) unless $IsDefault{'TSUBJECTEND'};
! print_var(\*DB,'TSUBLISTBEG',  \$TSUBLISTBEG) unless $IsDefault{'TSUBLISTBEG'};
! print_var(\*DB,'TSUBLISTEND',  \$TSUBLISTEND) unless $IsDefault{'TSUBLISTEND'};
! print_var(\*DB,'TTITLE',       \$TTITLE);
! print_var(\*DB,'TTOPBEG',      \$TTOPBEG) unless $IsDefault{'TTOPBEG'};
! print_var(\*DB,'TTOPEND',      \$TTOPEND) unless $IsDefault{'TTOPEND'};
  
! print_var(\*DB,'TSLICESINGLETXT', \$TSLICESINGLETXT)
  				unless $IsDefault{'TSLICESINGLETXT'};
! print_var(\*DB,'TSLICETOPBEG', \$TSLICETOPBEG)
  				unless $IsDefault{'TSLICETOPBEG'};
! print_var(\*DB,'TSLICETOPEND', \$TSLICETOPEND)
  				unless $IsDefault{'TSLICETOPEND'};
! print_var(\*DB,'TSLICESUBLISTBEG', \$TSLICESUBLISTBEG)
  				unless $IsDefault{'TSLICESUBLISTBEG'};
! print_var(\*DB,'TSLICESUBLISTEND', \$TSLICESUBLISTEND)
  				unless $IsDefault{'TSLICESUBLISTEND'};
! print_var(\*DB,'TSLICELEVELS', \$TSLICELEVELS)
  				unless $IsDefault{'TSLICELEVELS'};
! print_var(\*DB,'TSLICELITXT', \$TSLICELITXT)
  				unless $IsDefault{'TSLICELITXT'};
! print_var(\*DB,'TSLICELIEND', \$TSLICELIEND)
  				unless $IsDefault{'TSLICELIEND'};
! print_var(\*DB,'TSLICELINONE', \$TSLICELINONE)
  				unless $IsDefault{'TSLICELINONE'};
! print_var(\*DB,'TSLICELINONEEND', \$TSLICELINONEEND)
  				unless $IsDefault{'TSLICELINONEEND'};
! print_var(\*DB,'TSLICESUBJECTBEG', \$TSLICESUBJECTBEG)
  				unless $IsDefault{'TSLICESUBJECTBEG'};
! print_var(\*DB,'TSLICESUBJECTEND', \$TSLICESUBJECTEND)
  				unless $IsDefault{'TSLICESUBJECTEND'};
! print_var(\*DB,'TSLICEINDENTBEG', \$TSLICEINDENTBEG)
  				unless $IsDefault{'TSLICEINDENTBEG'};
! print_var(\*DB,'TSLICEINDENTEND', \$TSLICEINDENTEND)
  				unless $IsDefault{'TSLICEINDENTEND'};
! print_var(\*DB,'TSLICECONTBEG', \$TSLICECONTBEG)
  				unless $IsDefault{'TSLICECONTBEG'};
! print_var(\*DB,'TSLICECONTEND', \$TSLICECONTEND)
  				unless $IsDefault{'TSLICECONTEND'};
! print_var(\*DB,'TSLICESINGLETXTCUR', \$TSLICESINGLETXTCUR)
  				unless $IsDefault{'TSLICESINGLETXTCUR'};
! print_var(\*DB,'TSLICETOPBEGCUR', \$TSLICETOPBEGCUR)
  				unless $IsDefault{'TSLICETOPBEGCUR'};
! print_var(\*DB,'TSLICETOPENDCUR', \$TSLICETOPENDCUR)
  				unless $IsDefault{'TSLICETOPENDCUR'};
! print_var(\*DB,'TSLICELITXTCUR', \$TSLICELITXTCUR)
  				unless $IsDefault{'TSLICELITXTCUR'};
! print_var(\*DB,'TSLICELIENDCUR', \$TSLICELIENDCUR)
  				unless $IsDefault{'TSLICELIENDCUR'};
  
  ## Other resources
! print_var(\*DB,'BOTLINKS',     \$BOTLINKS) unless $IsDefault{'BOTLINKS'};
! print_var(\*DB,'FIELDSBEG',    \$FIELDSBEG) unless $IsDefault{'FIELDSBEG'};
! print_var(\*DB,'FIELDSEND',    \$FIELDSEND) unless $IsDefault{'FIELDSEND'};
! print_var(\*DB,'FLDBEG',       \$FLDBEG) unless $IsDefault{'FLDBEG'};
! print_var(\*DB,'FLDEND',       \$FLDEND) unless $IsDefault{'FLDEND'};
! print_var(\*DB,'FOLUPBEGIN',   \$FOLUPBEGIN) unless $IsDefault{'FOLUPBEGIN'};
! print_var(\*DB,'FOLUPEND',     \$FOLUPEND) unless $IsDefault{'FOLUPEND'};
! print_var(\*DB,'FOLUPLITXT',   \$FOLUPLITXT) unless $IsDefault{'FOLUPLITXT'};
! print_var(\*DB,'HEADBODYSEP',  \$HEADBODYSEP) unless $IsDefault{'HEADBODYSEP'};
! print_var(\*DB,'LABELBEG',     \$LABELBEG) unless $IsDefault{'LABELBEG'};
! print_var(\*DB,'LABELEND',     \$LABELEND) unless $IsDefault{'LABELEND'};
! print_var(\*DB,'MSGBODYEND',   \$MSGBODYEND) unless $IsDefault{'MSGBODYEND'};
! print_var(\*DB,'MSGIDLINK',    \$MSGIDLINK) unless $IsDefault{'MSGIDLINK'};
! print_var(\*DB,'MSGPGBEG',     \$MSGPGBEG) unless $IsDefault{'MSGPGBEG'};
! print_var(\*DB,'MSGPGEND',     \$MSGPGEND) unless $IsDefault{'MSGPGEND'};
! print_var(\*DB,'NEXTBUTTON',   \$NEXTBUTTON) unless $IsDefault{'NEXTBUTTON'};
! print_var(\*DB,'NEXTBUTTONIA', \$NEXTBUTTONIA)
  				unless $IsDefault{'NEXTBUTTONIA'};
! print_var(\*DB,'NEXTLINK',     \$NEXTLINK) unless $IsDefault{'NEXTLINK'};
! print_var(\*DB,'NEXTLINKIA',   \$NEXTLINKIA) unless $IsDefault{'NEXTLINKIA'};
! print_var(\*DB,'NOTE',         \$NOTE) unless $IsDefault{'NOTE'};
! print_var(\*DB,'NOTEIA',       \$NOTEIA) unless $IsDefault{'NOTEIA'};
! print_var(\*DB,'NOTEICON',     \$NOTEICON) unless $IsDefault{'NOTEICON'};
! print_var(\*DB,'NOTEICONIA',   \$NOTEICONIA) unless $IsDefault{'NOTEICONIA'};
! print_var(\*DB,'PREVBUTTON',   \$PREVBUTTON) unless $IsDefault{'PREVBUTTON'};
! print_var(\*DB,'PREVBUTTONIA', \$PREVBUTTONIA)
  				unless $IsDefault{'PREVBUTTONIA'};
! print_var(\*DB,'PREVLINK',     \$PREVLINK) unless $IsDefault{'PREVLINK'};
! print_var(\*DB,'PREVLINKIA',   \$PREVLINKIA) unless $IsDefault{'PREVLINKIA'};
! print_var(\*DB,'REFSBEGIN',    \$REFSBEGIN) unless $IsDefault{'REFSBEGIN'};
! print_var(\*DB,'REFSEND',      \$REFSEND) unless $IsDefault{'REFSEND'};
! print_var(\*DB,'REFSLITXT',    \$REFSLITXT) unless $IsDefault{'REFSLITXT'};
! print_var(\*DB,'SUBJECTHEADER',\$SUBJECTHEADER)
  				unless $IsDefault{'SUBJECTHEADER'};
! print_var(\*DB,'TNEXTBUTTON',  \$TNEXTBUTTON) unless $IsDefault{'TNEXTBUTTON'};
! print_var(\*DB,'TNEXTBUTTONIA',\$TNEXTBUTTONIA)
  				unless $IsDefault{'TNEXTBUTTONIA'};
! print_var(\*DB,'TNEXTINBUTTON',  \$TNEXTINBUTTON)
  				unless $IsDefault{'TNEXTINBUTTON'};
! print_var(\*DB,'TNEXTINBUTTONIA',  \$TNEXTINBUTTONIA)
  				unless $IsDefault{'TNEXTINBUTTONIA'};
! print_var(\*DB,'TNEXTINLINK',  \$TNEXTINLINK)
  				unless $IsDefault{'TNEXTINLINK'};
! print_var(\*DB,'TNEXTINLINKIA',  \$TNEXTINLINKIA)
  				unless $IsDefault{'TNEXTINLINKIA'};
! print_var(\*DB,'TNEXTLINK',    \$TNEXTLINK) unless $IsDefault{'TNEXTLINK'};
! print_var(\*DB,'TNEXTLINKIA',  \$TNEXTLINKIA) unless $IsDefault{'TNEXTLINKIA'};
! print_var(\*DB,'TOPLINKS',     \$TOPLINKS) unless $IsDefault{'TOPLINKS'};
! print_var(\*DB,'TPREVBUTTON',  \$TPREVBUTTON) unless $IsDefault{'TPREVBUTTON'};
! print_var(\*DB,'TPREVBUTTONIA',\$TPREVBUTTONIA)
  				unless $IsDefault{'TPREVBUTTONIA'};
! print_var(\*DB,'TPREVINBUTTON',  \$TPREVINBUTTON)
  				unless $IsDefault{'TPREVINBUTTON'};
! print_var(\*DB,'TPREVINBUTTONIA',  \$TPREVINBUTTONIA)
  				unless $IsDefault{'TPREVINBUTTONIA'};
! print_var(\*DB,'TPREVINLINK',  \$TPREVINLINK)
  				unless $IsDefault{'TPREVINLINK'};
! print_var(\*DB,'TPREVINLINKIA',  \$TPREVINLINKIA)
  				unless $IsDefault{'TPREVINLINKIA'};
! print_var(\*DB,'TPREVLINK',    \$TPREVLINK) unless $IsDefault{'TPREVLINK'};
! print_var(\*DB,'TPREVLINKIA',  \$TPREVLINKIA) unless $IsDefault{'TPREVLINKIA'};
! print_var(\*DB,'TSLICEBEG',    \$TSLICEBEG) unless $IsDefault{'TSLICEBEG'};
! print_var(\*DB,'TSLICEEND',    \$TSLICEEND) unless $IsDefault{'TSLICEEND'};
! print_var(\*DB,'TSliceNBefore',\$TSliceNBefore);
! print_var(\*DB,'TSliceNAfter', \$TSliceNAfter);
! print_var(\*DB,'TSliceInclusive', \$TSliceInclusive);
! print_var(\*DB,'TNEXTTOPBUTTON',  \$TNEXTTOPBUTTON)
  				unless $IsDefault{'TNEXTTOPBUTTON'};
! print_var(\*DB,'TNEXTTOPBUTTONIA',  \$TNEXTTOPBUTTONIA)
  				unless $IsDefault{'TNEXTTOPBUTTONIA'};
! print_var(\*DB,'TNEXTTOPLINK',  \$TNEXTTOPLINK)
  				unless $IsDefault{'TNEXTTOPLINK'};
! print_var(\*DB,'TNEXTTOPLINKIA',  \$TNEXTTOPLINKIA)
  				unless $IsDefault{'TNEXTTOPLINKIA'};
! print_var(\*DB,'TPREVTOPBUTTON',  \$TPREVTOPBUTTON)
  				unless $IsDefault{'TPREVTOPBUTTON'};
! print_var(\*DB,'TPREVTOPBUTTONIA',  \$TPREVTOPBUTTONIA)
  				unless $IsDefault{'TPREVTOPBUTTONIA'};
! print_var(\*DB,'TPREVTOPLINK',  \$TPREVTOPLINK)
  				unless $IsDefault{'TPREVTOPLINK'};
! print_var(\*DB,'TPREVTOPLINKIA',  \$TPREVTOPLINKIA)
  				unless $IsDefault{'TPREVTOPLINKIA'};
! print_var(\*DB,'UMASK',	       \$UMASK);
  
  }
--- 48,392 ----
      }
  
!     if (!open($db, ">$tmpfile")) {
  	warn qq/ERROR: Unable to create "$tmpfile": $!\n/;
  	return 0;
      }
!     binmode($db);  # Unix text format okay for Perl source on Windog
  
! print $db "## MHonArcDB (Automatically generated by MHonArc)\n";
! print_var($db,'DbVERSION',     \$VERSION);
  
  ## Meta-data
! print_var($db,'ContentType', \%ContentType);
! print_var($db,'Date',        \%Date);
! print_var($db,'Derived',     \%Derived);
! print_var($db,'FollowOld',   \%Follow);
! print_var($db,'From',        \%From);
! print_var($db,'IndexNum',    \%IndexNum);
! print_var($db,'MsgId',       \%MsgId);
! print_var($db,'Refs',        \%Refs);
! print_var($db,'Subject',     \%Subject);
! print_var($db,'TListOrder',  \(_at_)TListOrder);
! print_var($db,'NumOfMsgs',   \$NumOfMsgs);
! print_var($db,'NumOfPages',  \$NumOfPages);
! print_var($db,'SaveRsrcs',   \$SaveRsrcs);
  
  if ($SaveRsrcs) {
  
  ## Resources
! print_var($db,'CustomRcVars',\%CustomRcVars);
! print_var($db,'FieldODefs',  \%FieldODefs);
! print_var($db,'HFieldsExc',  \%HFieldsExc);
! print_var($db,'HeadFields',  \%HeadFields);
! print_var($db,'HeadHeads',   \%HeadHeads);
! print_var($db,'Icons',       \%Icons);
! print_var($db,'UDerivedFile',\%UDerivedFile);
! print_var($db,'ZoneUD',      \%ZoneUD);
  
  unless ($IsDefault{'CHARSETALIASES'}) {
!     print_var($db,'readmail::MIMECharsetAliases',
  		    \%readmail::MIMECharsetAliases);
  }
  unless ($IsDefault{'CHARSETCONVERTERS'}) {
!     print_var($db,'readmail::MIMECharSetConverters',
  		    \%readmail::MIMECharSetConverters);
!     print_var($db,'readmail::MIMECharSetConvertersSrc',
  		    \%readmail::MIMECharSetConvertersSrc);
  }
  unless ($IsDefault{'MIMEDECODERS'}) {
!     print_var($db,'readmail::MIMEDecoders',
  		    \%readmail::MIMEDecoders);
!     print_var($db,'readmail::MIMEDecodersSrc',
  		    \%readmail::MIMEDecodersSrc);
  }
  unless ($IsDefault{'MIMEFILTERS'}) {
!     print_var($db,'readmail::MIMEFilters',
  		    \%readmail::MIMEFilters);
!     print_var($db,'readmail::MIMEFiltersSrc',
  		    \%readmail::MIMEFiltersSrc);
  }
! print_var($db,'readmail::MIMEFiltersArgs',
  		\%readmail::MIMEFiltersArgs)
  		unless $IsDefault{'MIMEARGS'};
  if (%readmail::MIMEExcs) {
!     print_var($db,'readmail::MIMEExcs',
  		    \%readmail::MIMEExcs)
  		    unless $IsDefault{'MIMEEXCS'};
  }
  unless ($IsDefault{'MIMEALTPREFS'}) {
!     print_var($db,'MIMEAltPrefs',
  		    \(_at_)MIMEAltPrefs);
  }
  
! print_var($db,'DateFields', \(_at_)DateFields) unless $IsDefault{'DATEFIELDS'};
! print_var($db,'FieldOrder', \(_at_)FieldOrder);
! print_var($db,'FromFields', \(_at_)FromFields) unless $IsDefault{'FROMFIELDS'};
! print_var($db,'Months',     \(_at_)Months)     if scalar(@Months);
! print_var($db,'months',     \(_at_)months)     if scalar(@months);
! print_var($db,'OtherIdxs',  \(_at_)OtherIdxs)  if scalar(@OtherIdxs);
! print_var($db,'PerlINC',    \(_at_)PerlINC)    if scalar(@PerlINC);
! print_var($db,'Weekdays',   \(_at_)Weekdays)   if scalar(@Weekdays);
! print_var($db,'weekdays',   \(_at_)weekdays)   if scalar(@weekdays);
  
  ## I should use a hash for this stuff instead of individual variables.
  ## A legacy of Perl 4 days and a program getting larger than expected.
  
! print_var($db,'AddressModify',  \$AddressModify)
  				unless $IsDefault{'AddressModify'};
! print_var($db,'CheckNoArchive', \$CheckNoArchive);
! print_var($db,'DOCURL',         \$DOCURL);
! print_var($db,'NODOC',          \$NODOC);
! print_var($db,'DecodeHeads',    \$DecodeHeads);
! print_var($db,'DoFolRefs',      \$DoFolRefs);
! print_var($db,'ExpireDate',     \$ExpireDate);
! print_var($db,'ExpireTime',     \$ExpireTime);
! print_var($db,'FROM',           \$FROM);
! print_var($db,'GMTDateFmt',     \$GMTDateFmt);
! print_var($db,'GzipExe',        \$GzipExe);
! print_var($db,'GzipFiles',      \$GzipFiles);
! print_var($db,'GzipLinks',      \$GzipLinks);
! print_var($db,'HtmlExt',        \$HtmlExt);
! print_var($db,'IDXSIZE',        \$IDXSIZE);
! print_var($db,'KeepOnRmm',      \$KeepOnRmm);
! print_var($db,'LocalDateFmt',   \$LocalDateFmt);
! print_var($db,'MAILTOURL',      \$MAILTOURL)  unless $IsDefault{'MAILTOURL'};
! print_var($db,'MAIN',           \$MAIN);
! print_var($db,'MAXSIZE',        \$MAXSIZE);
! print_var($db,'MHPATTERN',      \$MHPATTERN);
! print_var($db,'MODTIME',        \$MODTIME);
! print_var($db,'MSGFOOT',        \$MSGFOOT);
! print_var($db,'MsgGMTDateFmt',  \$MsgGMTDateFmt);
! print_var($db,'MSGHEAD',        \$MSGHEAD);
! print_var($db,'MsgExcFilter',   \$MsgExcFilter);
! print_var($db,'MsgLocalDateFmt',\$MsgLocalDateFmt);
! print_var($db,'MsgPrefix',      \$MsgPrefix);
! print_var($db,'MULTIIDX',       \$MULTIIDX);
! print_var($db,'NOMAILTO',       \$NOMAILTO);
! print_var($db,'NONEWS',         \$NONEWS);
! print_var($db,'NOURL',          \$NOURL);
! print_var($db,'NoMsgPgs',       \$NoMsgPgs);
! print_var($db,'NoSubjectThreads', \$NoSubjectThreads);
! print_var($db,'NoSubjectTxt',   \$NoSubjectTxt);
! print_var($db,'NoteDir',        \$NoteDir);
! print_var($db,'POSIXstrftime',  \$POSIXstrftime);
! print_var($db,'THREAD',         \$THREAD);
! print_var($db,'SubArtRxp',      \$SubArtRxp);
! print_var($db,'SubReplyRxp',    \$SubReplyRxp);
! print_var($db,'SubStripCode',   \$SubStripCode);
! print_var($db,'UseLocalTime',   \$UseLocalTime);
! print_var($db,'UsingLASTPG',    \$UsingLASTPG);
! print_var($db,'VarExp',    	 \$VarExp);
! 
! print_var($db,'MSGPGSSMARKUP',  \$MSGPGSSMARKUP);
! print_var($db,'IDXPGSSMARKUP',  \$IDXPGSSMARKUP);
! print_var($db,'TIDXPGSSMARKUP', \$TIDXPGSSMARKUP);
! print_var($db,'SSMARKUP',       \$SSMARKUP);
! print_var($db,'SpamMode',       \$SpamMode);
  
  if (!$IsDefault{'TEXTCLIPFUNC'}) {
!     print_var($db,'TextClipFunc', \$TextClipFunc);
!     print_var($db,'TextClipSrc',  \$TextClipSrc);
  };
  
  # Main index resources
! print_var($db,'AUTHSORT',     \$AUTHSORT);
! print_var($db,'NOSORT',       \$NOSORT);
! print_var($db,'REVSORT',      \$REVSORT);
! print_var($db,'SUBSORT',      \$SUBSORT);
! 
! print_var($db,'AUTHBEG',      \$AUTHBEG) unless $IsDefault{'AUTHBEG'};
! print_var($db,'AUTHEND',      \$AUTHEND) unless $IsDefault{'AUTHEND'};
! print_var($db,'DAYBEG',       \$DAYBEG) unless $IsDefault{'DAYBEG'};
! print_var($db,'DAYEND',       \$DAYEND) unless $IsDefault{'DAYEND'};
! print_var($db,'IDXLABEL',     \$IDXLABEL) unless $IsDefault{'IDXLABEL'};
! print_var($db,'IDXNAME',      \$IDXNAME);
! print_var($db,'IDXPGBEG',     \$IDXPGBEG) unless $IsDefault{'IDXPGBEG'};
! print_var($db,'IDXPGEND',     \$IDXPGEND) unless $IsDefault{'IDXPGEND'};
! print_var($db,'IDXPREFIX',    \$IDXPREFIX);
! print_var($db,'LIBEG',        \$LIBEG) unless $IsDefault{'LIBEG'};
! print_var($db,'LIEND',        \$LIEND) unless $IsDefault{'LIEND'};
! print_var($db,'LITMPL',       \$LITMPL) unless $IsDefault{'LITMPL'};
! print_var($db,'FIRSTPGLINK',  \$FIRSTPGLINK) unless $IsDefault{'FIRSTPGLINK'};
! print_var($db,'LASTPGLINK',   \$LASTPGLINK) unless $IsDefault{'LASTPGLINK'};
! print_var($db,'NEXTPGLINK',   \$NEXTPGLINK) unless $IsDefault{'NEXTPGLINK'};
! print_var($db,'NEXTPGLINKIA', \$NEXTPGLINKIA)
  				unless $IsDefault{'NEXTPGLINKIA'};
! print_var($db,'PREVPGLINK',   \$PREVPGLINK) unless $IsDefault{'PREVPGLINK'};
! print_var($db,'PREVPGLINKIA', \$PREVPGLINKIA)
  				unless $IsDefault{'PREVPGLINKIA'};
! print_var($db,'SUBJECTBEG',   \$SUBJECTBEG) unless $IsDefault{'SUBJECTBEG'};
! print_var($db,'SUBJECTEND',   \$SUBJECTEND) unless $IsDefault{'SUBJECTEND'};
! print_var($db,'TITLE',        \$TITLE);
  
  # Thread index resources
! print_var($db,'TNOSORT',      \$TNOSORT);
! print_var($db,'TREVERSE',     \$TREVERSE);
! print_var($db,'TSUBSORT',     \$TSUBSORT);
! 
! print_var($db,'TCONTBEG',     \$TCONTBEG) unless $IsDefault{'TCONTBEG'};
! print_var($db,'TCONTEND',     \$TCONTEND) unless $IsDefault{'TCONTEND'};
! print_var($db,'TFOOT',        \$TFOOT) unless $IsDefault{'TFOOT'};
! print_var($db,'THEAD',        \$THEAD) unless $IsDefault{'THEAD'};
! print_var($db,'TIDXLABEL',    \$TIDXLABEL) unless $IsDefault{'TIDXLABEL'};
! print_var($db,'TIDXNAME',     \$TIDXNAME);
! print_var($db,'TIDXPGBEG',    \$TIDXPGBEG) unless $IsDefault{'TIDXPGBEG'};
! print_var($db,'TIDXPGEND',    \$TIDXPGEND) unless $IsDefault{'TIDXPGEND'};
! print_var($db,'TIDXPREFIX',   \$TIDXPREFIX);
! print_var($db,'TINDENTBEG',   \$TINDENTBEG) unless $IsDefault{'TINDENTBEG'};
! print_var($db,'TINDENTEND',   \$TINDENTEND) unless $IsDefault{'TINDENTEND'};
! print_var($db,'TLEVELS',      \$TLEVELS);
! print_var($db,'TLIEND',       \$TLIEND) unless $IsDefault{'TLIEND'};
! print_var($db,'TLINONE',      \$TLINONE) unless $IsDefault{'TLINONE'};
! print_var($db,'TLINONEEND',   \$TLINONEEND) unless $IsDefault{'TLINONEEND'};
! print_var($db,'TLITXT',       \$TLITXT) unless $IsDefault{'TLITXT'};
! print_var($db,'TFIRSTPGLINK', \$TFIRSTPGLINK)
  				unless $IsDefault{'TFIRSTPGLINK'};
! print_var($db,'TLASTPGLINK',  \$TLASTPGLINK)
  				unless $IsDefault{'TLASTPGLINK'};
! print_var($db,'TNEXTPGLINK',  \$TNEXTPGLINK) unless $IsDefault{'TNEXTPGLINK'};
! print_var($db,'TNEXTPGLINKIA',\$TNEXTPGLINKIA)
  				unless $IsDefault{'TNEXTPGLINKIA'};
! print_var($db,'TPREVPGLINK',  \$TPREVPGLINK) unless $IsDefault{'TPREVPGLINK'};
! print_var($db,'TPREVPGLINKIA',\$TPREVPGLINKIA)
  				unless $IsDefault{'TPREVPGLINKIA'};
! print_var($db,'TSINGLETXT',   \$TSINGLETXT) unless $IsDefault{'TSINGLETXT'};
! print_var($db,'TSUBJECTBEG',  \$TSUBJECTBEG) unless $IsDefault{'TSUBJECTBEG'};
! print_var($db,'TSUBJECTEND',  \$TSUBJECTEND) unless $IsDefault{'TSUBJECTEND'};
! print_var($db,'TSUBLISTBEG',  \$TSUBLISTBEG) unless $IsDefault{'TSUBLISTBEG'};
! print_var($db,'TSUBLISTEND',  \$TSUBLISTEND) unless $IsDefault{'TSUBLISTEND'};
! print_var($db,'TTITLE',       \$TTITLE);
! print_var($db,'TTOPBEG',      \$TTOPBEG) unless $IsDefault{'TTOPBEG'};
! print_var($db,'TTOPEND',      \$TTOPEND) unless $IsDefault{'TTOPEND'};
  
! print_var($db,'TSLICESINGLETXT', \$TSLICESINGLETXT)
  				unless $IsDefault{'TSLICESINGLETXT'};
! print_var($db,'TSLICETOPBEG', \$TSLICETOPBEG)
  				unless $IsDefault{'TSLICETOPBEG'};
! print_var($db,'TSLICETOPEND', \$TSLICETOPEND)
  				unless $IsDefault{'TSLICETOPEND'};
! print_var($db,'TSLICESUBLISTBEG', \$TSLICESUBLISTBEG)
  				unless $IsDefault{'TSLICESUBLISTBEG'};
! print_var($db,'TSLICESUBLISTEND', \$TSLICESUBLISTEND)
  				unless $IsDefault{'TSLICESUBLISTEND'};
! print_var($db,'TSLICELEVELS', \$TSLICELEVELS)
  				unless $IsDefault{'TSLICELEVELS'};
! print_var($db,'TSLICELITXT', \$TSLICELITXT)
  				unless $IsDefault{'TSLICELITXT'};
! print_var($db,'TSLICELIEND', \$TSLICELIEND)
  				unless $IsDefault{'TSLICELIEND'};
! print_var($db,'TSLICELINONE', \$TSLICELINONE)
  				unless $IsDefault{'TSLICELINONE'};
! print_var($db,'TSLICELINONEEND', \$TSLICELINONEEND)
  				unless $IsDefault{'TSLICELINONEEND'};
! print_var($db,'TSLICESUBJECTBEG', \$TSLICESUBJECTBEG)
  				unless $IsDefault{'TSLICESUBJECTBEG'};
! print_var($db,'TSLICESUBJECTEND', \$TSLICESUBJECTEND)
  				unless $IsDefault{'TSLICESUBJECTEND'};
! print_var($db,'TSLICEINDENTBEG', \$TSLICEINDENTBEG)
  				unless $IsDefault{'TSLICEINDENTBEG'};
! print_var($db,'TSLICEINDENTEND', \$TSLICEINDENTEND)
  				unless $IsDefault{'TSLICEINDENTEND'};
! print_var($db,'TSLICECONTBEG', \$TSLICECONTBEG)
  				unless $IsDefault{'TSLICECONTBEG'};
! print_var($db,'TSLICECONTEND', \$TSLICECONTEND)
  				unless $IsDefault{'TSLICECONTEND'};
! print_var($db,'TSLICESINGLETXTCUR', \$TSLICESINGLETXTCUR)
  				unless $IsDefault{'TSLICESINGLETXTCUR'};
! print_var($db,'TSLICETOPBEGCUR', \$TSLICETOPBEGCUR)
  				unless $IsDefault{'TSLICETOPBEGCUR'};
! print_var($db,'TSLICETOPENDCUR', \$TSLICETOPENDCUR)
  				unless $IsDefault{'TSLICETOPENDCUR'};
! print_var($db,'TSLICELITXTCUR', \$TSLICELITXTCUR)
  				unless $IsDefault{'TSLICELITXTCUR'};
! print_var($db,'TSLICELIENDCUR', \$TSLICELIENDCUR)
  				unless $IsDefault{'TSLICELIENDCUR'};
  
  ## Other resources
! print_var($db,'BOTLINKS',     \$BOTLINKS) unless $IsDefault{'BOTLINKS'};
! print_var($db,'FIELDSBEG',    \$FIELDSBEG) unless $IsDefault{'FIELDSBEG'};
! print_var($db,'FIELDSEND',    \$FIELDSEND) unless $IsDefault{'FIELDSEND'};
! print_var($db,'FLDBEG',       \$FLDBEG) unless $IsDefault{'FLDBEG'};
! print_var($db,'FLDEND',       \$FLDEND) unless $IsDefault{'FLDEND'};
! print_var($db,'FOLUPBEGIN',   \$FOLUPBEGIN) unless $IsDefault{'FOLUPBEGIN'};
! print_var($db,'FOLUPEND',     \$FOLUPEND) unless $IsDefault{'FOLUPEND'};
! print_var($db,'FOLUPLITXT',   \$FOLUPLITXT) unless $IsDefault{'FOLUPLITXT'};
! print_var($db,'HEADBODYSEP',  \$HEADBODYSEP) unless $IsDefault{'HEADBODYSEP'};
! print_var($db,'LABELBEG',     \$LABELBEG) unless $IsDefault{'LABELBEG'};
! print_var($db,'LABELEND',     \$LABELEND) unless $IsDefault{'LABELEND'};
! print_var($db,'MSGBODYEND',   \$MSGBODYEND) unless $IsDefault{'MSGBODYEND'};
! print_var($db,'MSGIDLINK',    \$MSGIDLINK) unless $IsDefault{'MSGIDLINK'};
! print_var($db,'MSGPGBEG',     \$MSGPGBEG) unless $IsDefault{'MSGPGBEG'};
! print_var($db,'MSGPGEND',     \$MSGPGEND) unless $IsDefault{'MSGPGEND'};
! print_var($db,'NEXTBUTTON',   \$NEXTBUTTON) unless $IsDefault{'NEXTBUTTON'};
! print_var($db,'NEXTBUTTONIA', \$NEXTBUTTONIA)
  				unless $IsDefault{'NEXTBUTTONIA'};
! print_var($db,'NEXTLINK',     \$NEXTLINK) unless $IsDefault{'NEXTLINK'};
! print_var($db,'NEXTLINKIA',   \$NEXTLINKIA) unless $IsDefault{'NEXTLINKIA'};
! print_var($db,'NOTE',         \$NOTE) unless $IsDefault{'NOTE'};
! print_var($db,'NOTEIA',       \$NOTEIA) unless $IsDefault{'NOTEIA'};
! print_var($db,'NOTEICON',     \$NOTEICON) unless $IsDefault{'NOTEICON'};
! print_var($db,'NOTEICONIA',   \$NOTEICONIA) unless $IsDefault{'NOTEICONIA'};
! print_var($db,'PREVBUTTON',   \$PREVBUTTON) unless $IsDefault{'PREVBUTTON'};
! print_var($db,'PREVBUTTONIA', \$PREVBUTTONIA)
  				unless $IsDefault{'PREVBUTTONIA'};
! print_var($db,'PREVLINK',     \$PREVLINK) unless $IsDefault{'PREVLINK'};
! print_var($db,'PREVLINKIA',   \$PREVLINKIA) unless $IsDefault{'PREVLINKIA'};
! print_var($db,'REFSBEGIN',    \$REFSBEGIN) unless $IsDefault{'REFSBEGIN'};
! print_var($db,'REFSEND',      \$REFSEND) unless $IsDefault{'REFSEND'};
! print_var($db,'REFSLITXT',    \$REFSLITXT) unless $IsDefault{'REFSLITXT'};
! print_var($db,'SUBJECTHEADER',\$SUBJECTHEADER)
  				unless $IsDefault{'SUBJECTHEADER'};
! print_var($db,'TNEXTBUTTON',  \$TNEXTBUTTON) unless $IsDefault{'TNEXTBUTTON'};
! print_var($db,'TNEXTBUTTONIA',\$TNEXTBUTTONIA)
  				unless $IsDefault{'TNEXTBUTTONIA'};
! print_var($db,'TNEXTINBUTTON',  \$TNEXTINBUTTON)
  				unless $IsDefault{'TNEXTINBUTTON'};
! print_var($db,'TNEXTINBUTTONIA',  \$TNEXTINBUTTONIA)
  				unless $IsDefault{'TNEXTINBUTTONIA'};
! print_var($db,'TNEXTINLINK',  \$TNEXTINLINK)
  				unless $IsDefault{'TNEXTINLINK'};
! print_var($db,'TNEXTINLINKIA',  \$TNEXTINLINKIA)
  				unless $IsDefault{'TNEXTINLINKIA'};
! print_var($db,'TNEXTLINK',    \$TNEXTLINK) unless $IsDefault{'TNEXTLINK'};
! print_var($db,'TNEXTLINKIA',  \$TNEXTLINKIA) unless $IsDefault{'TNEXTLINKIA'};
! print_var($db,'TOPLINKS',     \$TOPLINKS) unless $IsDefault{'TOPLINKS'};
! print_var($db,'TPREVBUTTON',  \$TPREVBUTTON) unless $IsDefault{'TPREVBUTTON'};
! print_var($db,'TPREVBUTTONIA',\$TPREVBUTTONIA)
  				unless $IsDefault{'TPREVBUTTONIA'};
! print_var($db,'TPREVINBUTTON',  \$TPREVINBUTTON)
  				unless $IsDefault{'TPREVINBUTTON'};
! print_var($db,'TPREVINBUTTONIA',  \$TPREVINBUTTONIA)
  				unless $IsDefault{'TPREVINBUTTONIA'};
! print_var($db,'TPREVINLINK',  \$TPREVINLINK)
  				unless $IsDefault{'TPREVINLINK'};
! print_var($db,'TPREVINLINKIA',  \$TPREVINLINKIA)
  				unless $IsDefault{'TPREVINLINKIA'};
! print_var($db,'TPREVLINK',    \$TPREVLINK) unless $IsDefault{'TPREVLINK'};
! print_var($db,'TPREVLINKIA',  \$TPREVLINKIA) unless $IsDefault{'TPREVLINKIA'};
! print_var($db,'TSLICEBEG',    \$TSLICEBEG) unless $IsDefault{'TSLICEBEG'};
! print_var($db,'TSLICEEND',    \$TSLICEEND) unless $IsDefault{'TSLICEEND'};
! print_var($db,'TNEXTTOPBUTTON',  \$TNEXTTOPBUTTON)
  				unless $IsDefault{'TNEXTTOPBUTTON'};
! print_var($db,'TNEXTTOPBUTTONIA',  \$TNEXTTOPBUTTONIA)
  				unless $IsDefault{'TNEXTTOPBUTTONIA'};
! print_var($db,'TNEXTTOPLINK',  \$TNEXTTOPLINK)
  				unless $IsDefault{'TNEXTTOPLINK'};
! print_var($db,'TNEXTTOPLINKIA',  \$TNEXTTOPLINKIA)
  				unless $IsDefault{'TNEXTTOPLINKIA'};
! print_var($db,'TPREVTOPBUTTON',  \$TPREVTOPBUTTON)
  				unless $IsDefault{'TPREVTOPBUTTON'};
! print_var($db,'TPREVTOPBUTTONIA',  \$TPREVTOPBUTTONIA)
  				unless $IsDefault{'TPREVTOPBUTTONIA'};
! print_var($db,'TPREVTOPLINK',  \$TPREVTOPLINK)
  				unless $IsDefault{'TPREVTOPLINK'};
! print_var($db,'TPREVTOPLINKIA',  \$TPREVTOPLINKIA)
  				unless $IsDefault{'TPREVTOPLINKIA'};
! 
! print_var($db,'DbFilePerms',     \$DbFilePerms);
! print_var($db,'FilePerms',       \$FilePerms);
! print_var($db,'TSliceNBefore',   \$TSliceNBefore);
! print_var($db,'TSliceNAfter',    \$TSliceNAfter);
! print_var($db,'TSliceInclusive', \$TSliceInclusive);
! print_var($db,'UMASK',	         \$UMASK);
  
  }
***************
*** 389,399 ****
      ## Invoke save callback
      if (defined($CBDbSave) && defined(&$CBDbSave)) {
! 	&$CBDbSave(\*DB);
      }
  
      ## Make sure file ends with a true value
!     print DB "1;\n";
  
!     close(DB);
  
      if (!rename($tmpfile, $pathname)) {
--- 394,404 ----
      ## Invoke save callback
      if (defined($CBDbSave) && defined(&$CBDbSave)) {
! 	&$CBDbSave($db);
      }
  
      ## Make sure file ends with a true value
!     print $db "1;\n";
  
!     close($db);
  
      if (!rename($tmpfile, $pathname)) {
***************
*** 401,404 ****
--- 406,410 ----
  	return 0;
      }
+     file_chmod($pathname, $DbFilePerms);
      1;
  }

Index: mhfile.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhfile.pl,v
retrieving revision 2.6
retrieving revision 2.7
diff -C2 -r2.6 -r2.7
*** mhfile.pl	14 May 2002 00:04:40 -0000	2.6
--- mhfile.pl	20 Nov 2002 23:53:12 -0000	2.7
***************
*** 29,32 ****
--- 29,61 ----
  
  use Symbol;
+ use Fcntl;
+ 
+ my $_have_File_Temp;
+ BEGIN {
+     # If File::Temp is installed, we will use it for temporary file
+     # generation.
+     eval { require File::Temp; };
+     $_have_File_Temp = scalar($@) ? 0 : 1;
+ 
+     # Increase File::Temp safety level if setuid
+     if ($_have_File_Temp && $UNIX && $TaintMode) {
+ 	File::Temp->safe_level(File::Temp::MEDIUM);
+     }
+ 
+     # Perl <5.004 did not auto-call srand().
+     eval { require 5.004; };
+     srand(time ^ ($$ + ($$ << 15)))  if scalar($@);
+ }
+ 
+ # Characters to use for home-grown temporay file generation.  We stick to
+ # basic alphanumerics to avoid OS-specific filename limitations.
+ my @TEMP_CHARS = qw(
+     A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+     a b c d e f g h i j k l m n o p q r s t u v w x y z
+     0 1 2 3 4 5 6 7 8 9 _
+ );
+ 
+ # Maximum tries to create a temporary file in home-grown implementation
+ sub TEMP_MAX_TRIES() { 10; }
  
  ##---------------------------------------------------------------------------##
***************
*** 38,52 ****
  
      if ($gz) {
! 	return $handle  if open($handle, "$GzipExe -cd $file |");
! 	die qq/ERROR: Failed to exec "$GzipExe -cd $file |": $!\n/;
      }
      return $handle  if open($handle, $file);
      if (-e "$file.gz") {
! 	return $handle  if open($handle, "$GzipExe -cd $file.gz |");
! 	die qq/ERROR: Failed to exec "$GzipExe -cd $file.gz |": $!\n/;
      }
      die qq/ERROR: Failed to open "$file": $!\n/;
  }
  
  sub file_create {
      my($file) = shift;
--- 67,107 ----
  
      if ($gz) {
! 	cmd_pipe_open($handle, $GzipExe, '-cd', $file);
! 	return $handle;
      }
      return $handle  if open($handle, $file);
      if (-e "$file.gz") {
! 	cmd_pipe_open($handle, $GzipExe, '-cd', "$file.gz");
! 	return $handle;
      }
      die qq/ERROR: Failed to open "$file": $!\n/;
  }
  
+ sub cmd_pipe_open {
+     my $handle	= shift;
+     my @cmd	= shift;
+ 
+     if (!$UNIX) {
+ 	return $handle  if open($handle, join(' ', @cmd, '|'));
+ 	die qq/ERROR: Failed to exec @cmd: $!\n/;
+     }
+     my $child_pid = open($handle, '-|');
+     if ($child_pid) {   # parent
+ 	return $handle;
+     } else {		# child
+       #open(STDERR, '>&STDOUT');
+       exec(@cmd) || die qq/ERROR: Cannot exec "@cmd": $!\n/;
+     }
+ }
+ 
+ sub file_gzip {
+     my $file = shift;
+     return  if ($file =~ /\.gz$/i);
+     if (system($GzipExe, $file) != 0) {
+ 	die qq/ERROR: Failed to exec "$GzipExe $file": $! $?\n/;
+     }
+ }
+ 
+ ## This function is currently not used anymore
  sub file_create {
      my($file) = shift;
***************
*** 89,92 ****
--- 144,148 ----
  	die qq/ERROR: Unable to rename "$src" to "$dst": $!\n/;
      }
+     $dst;
  }
  
***************
*** 104,107 ****
--- 160,204 ----
  	utime($atime, $mtime, $_, "$_.gz");
      }
+ }
+ 
+ sub file_temp {
+     my $template = shift;
+     my $dir	 = shift || $CURDIR;
+     my($handle, $tmpfile);
+ 
+     MKTEMP: {
+ 	if ($_have_File_Temp) {
+ 	    ($handle, $tmpfile) =
+ 		File::Temp::tempfile($template, 'DIR' => $dir, 'UNLINK' => 0);
+ 	    last MKTEMP;
+ 	}
+ 
+ 	$handle = gensym;
+ 	my($i);
+ 	for ($i=0; $i < TEMP_MAX_TRIES; ++$i) {
+ 	    ($tmpfile = $template) =~
+ 		s/X/$TEMP_CHARS[int(rand($#TEMP_CHARS))]/ge;
+ 	    $tmpfile = join($DIRSEP, $dir, $tmpfile);
+ 	    last  if sysopen($handle, $tmpfile,
+ 			     (O_WRONLY|O_EXCL|O_CREAT), 0600);
+ 	}
+ 	if ($i >= TEMP_MAX_TRIES) {
+ 	    die qq/ERROR: Unable to create temp file "$tmpfile": $!\n/;
+ 	}
+     }
+     ($handle, $tmpfile);
+ }
+ 
+ sub file_chmod {
+     my $file  = shift;
+     my $perm  = shift || $FilePermsOct;
+     ## Capture any die's in case chmod not supported.
+     eval {
+ 	if (chmod(($perm &~ umask), $file) < 1) {
+ 	    warn qq/Warning: Unable to change "$file" permissions to "/,
+ 		 sprintf('%o'. $perm),
+ 		 qq/": $!\n/;
+ 	}
+     };
  }
  

Index: mhindex.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhindex.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** mhindex.pl	27 Jun 2002 04:56:41 -0000	1.10
--- mhindex.pl	20 Nov 2002 23:53:12 -0000	1.11
***************
*** 33,38 ****
  sub write_main_index {
      my $onlypg = shift;
!     my($outhandle, $i, $i_p0, $filename, $tmpl, $isfirst, $tmp,
! 	  $offstart, $offend);
      local($PageNum, $PageSize); # XXX: Use in replace_li_vars()
      my($totalpgs);
--- 33,38 ----
  sub write_main_index {
      my $onlypg = shift;
!     my($outhandle, $tmpfile, $i, $i_p0, $tmpl, $isfirst, $tmp,
!        $offstart, $offend);
      local($PageNum, $PageSize); # XXX: Use in replace_li_vars()
      my($totalpgs);
***************
*** 82,90 ****
  	## Open/create index file
  	if ($IDXONLY) {
! 	   $outhandle = 'STDOUT';
! 
  	} else {
! 	    $outhandle = &file_create($IDXPATHNAME, $GzipFiles) ||
! 		die("ERROR: Unable to create $IDXPATHNAME\n");
  	}
  	print STDOUT "Writing $IDXPATHNAME ...\n"  unless $QUIET;
--- 82,88 ----
  	## Open/create index file
  	if ($IDXONLY) {
! 	   $outhandle = \*STDOUT;
  	} else {
! 	    ($outhandle, $tmpfile) = file_temp('midxXXXXXXXXXX', $OUTDIR);
  	}
  	print STDOUT "Writing $IDXPATHNAME ...\n"  unless $QUIET;
***************
*** 174,178 ****
  	## Print bottom part of index
  	&output_maillist_foot($outhandle);
! 	close($outhandle)  unless $IDXONLY;
      }
  }
--- 172,180 ----
  	## Print bottom part of index
  	&output_maillist_foot($outhandle);
! 	if (!$IDXONLY) {
! 	    close($outhandle);
! 	    file_gzip($tmpfile)  if $GzipFiles;
! 	    file_chmod(file_rename($tmpfile, $IDXPATHNAME));
! 	}
      }
  }

Index: mhinit.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhinit.pl,v
retrieving revision 2.38
retrieving revision 2.39
diff -C2 -r2.38 -r2.39
*** mhinit.pl	14 Nov 2002 00:40:59 -0000	2.38
--- mhinit.pl	20 Nov 2002 23:53:12 -0000	2.39
***************
*** 377,380 ****
--- 377,384 ----
      };
  }
+ $FilePerms      = $ENV{'M2H_FILEPERMS'} || '0666';
+ $FilePermsOct   = 0666;
+ $DbFilePerms    = $ENV{'M2H_DBFILEPERMS'} || '0660';
+ $DbFilePermsOct = 0660;
  
  $CheckNoArchive = defined($ENV{'M2H_CHECKNOARCHIVE'}) ?

Index: mhmimetypes.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhmimetypes.pl,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** mhmimetypes.pl	26 Sep 2002 02:52:53 -0000	1.11
--- mhmimetypes.pl	20 Nov 2002 23:53:12 -0000	1.12
***************
*** 292,297 ****
      ($ctype) = $content =~ m%^\s*([\w\-\./]+)%;	# Extract content-type
  
-     local(*OUTFILE);
- 
      $pathname = $OUTDIR;
      if ($path) {
--- 292,295 ----
***************
*** 310,323 ****
      }
  
      ## Set pathname for file
      $pathname .= $DIRSEP . $fname;
! 
!     if (open(OUTFILE, "> $pathname")) {
! 	binmode(OUTFILE);		# For WinDog
! 	print OUTFILE $$sref;
! 	close(OUTFILE);
!     } else {
! 	warn qq/Warning: Unable to create "$pathname": $!\n/;
      }
  
      join("",
--- 308,323 ----
      }
  
+     ## Write to temp file first
+     my($fh, $tmpfile) = file_temp('atchXXXXXXXXXX', $pathname);
+     binmode($fh);
+     print $fh $$sref;
+     close($fh);
+ 
      ## Set pathname for file
      $pathname .= $DIRSEP . $fname;
!     if (!rename($tmpfile, $pathname)) {
! 	die qq/ERROR: Unable to rename "$tmpfile" to "$pathname": $!\n/;
      }
+     file_chmod($pathname);
  
      join("",

Index: mhopt.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhopt.pl,v
retrieving revision 2.35
retrieving revision 2.36
diff -C2 -r2.35 -r2.36
*** mhopt.pl	17 Nov 2002 03:52:34 -0000	2.35
--- mhopt.pl	20 Nov 2002 23:53:12 -0000	2.36
***************
*** 54,57 ****
--- 54,58 ----
  	"datefields=s", # Fields that contains the date of a message
  	"dbfile=s",	# Database/state filename for mhonarc archive
+ 	"dbfileperms=i",# Octal permission to set DBFILE
  	"decodeheads",	# Decode all 1522 encoded data in message headers
  	"definevar|definevars=s@",
***************
*** 62,65 ****
--- 63,67 ----
  	"expiredate=s",	# Message cut-off date
  	"expireage=i",	# Time in seconds from current if message expires
+ 	"fileperms=i",	# Octal permission to create files
  	"folrefs",	# Print links to explicit follow-ups/references
  	"footer=s",	# File containing user text for bottom of index page
***************
*** 379,385 ****
  		&update_data_2_1_to_later();
  		&update_data_2_4_to_later();
! 	    }
  	    ## Check for 2.[0-4] archive
! 	    if ($DbVERSION =~ /^2\.[0-4]\./) {
  		print STDOUT "Updating database $DbVERSION data ...\n"
  		    unless $QUIET;
--- 381,387 ----
  		&update_data_2_1_to_later();
  		&update_data_2_4_to_later();
! 
  	    ## Check for 2.[0-4] archive
! 	    } elsif ($DbVERSION =~ /^2\.[0-4]\./) {
  		print STDOUT "Updating database $DbVERSION data ...\n"
  		    unless $QUIET;
***************
*** 593,596 ****
--- 595,602 ----
  	eval { umask oct($UMASK); };
      }
+     $FilePerms      = $opt{'fileperms'}  if defined($opt{'fileperms'});
+     $FilePermsOct   = oct($FilePerms);
+     $DbFilePerms    = $opt{'dbfileperms'}  if defined($opt{'dbfileperms'});
+     $DbFilePermsOct = oct($FilePerms);
  
      ##	Get sort method

Index: mhrcfile.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhrcfile.pl,v
retrieving revision 2.26
retrieving revision 2.27
diff -C2 -r2.26 -r2.27
*** mhrcfile.pl	17 Nov 2002 03:38:52 -0000	2.26
--- mhrcfile.pl	20 Nov 2002 23:53:12 -0000	2.27
***************
*** 131,134 ****
--- 131,141 ----
  	    last FMTSW;
  	}
+ 	if ($elem eq 'dbfileperms') {		# DBFILE creation permissions
+ 	    if ($line = &get_elem_last_line($handle, $elem)) {
+ 		$line =~ s/\s//g;
+ 		$DbFilePerms = $line;
+ 	    }
+ 	    last FMTSW;
+ 	}
  	if ($elem eq 'decodeheads') {
  	    $DecodeHeads = 1; last FMTSW;
***************
*** 208,211 ****
--- 215,225 ----
  	if ($elem eq 'fieldsend') {		# End markup of mail head
  	    $FIELDSEND = &get_elem_content($handle, $elem, $chop);
+ 	    last FMTSW;
+ 	}
+ 	if ($elem eq 'fileperms') {		# File creation permissions
+ 	    if ($line = &get_elem_last_line($handle, $elem)) {
+ 		$line =~ s/\s//g;
+ 		$FilePerms = $line;
+ 	    }
  	    last FMTSW;
  	}

Index: mhthread.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhthread.pl,v
retrieving revision 2.10
retrieving revision 2.11
diff -C2 -r2.10 -r2.11
*** mhthread.pl	27 Jun 2002 04:56:41 -0000	2.10
--- mhthread.pl	20 Nov 2002 23:53:12 -0000	2.11
***************
*** 38,41 ****
--- 38,42 ----
      local($PageNum, $PageSize, $totalpgs, %Printed);
      local($lastlevel, $tlevel, $iscont, $i, $offstart, $offend);
+     my($tmpfile);
  
      local($level) = 0;  	## !!!Used in print_thread!!!
***************
*** 87,94 ****
  
  	if ($IDXONLY) {
! 	    $handle = 'STDOUT';
  	} else {
! 	    ($handle = &file_create($TIDXPATHNAME, $GzipFiles)) ||
! 		die("ERROR: Unable to create $TIDXPATHNAME\n");
  	}
  	print STDOUT "Writing $TIDXPATHNAME ...\n"  unless $QUIET;
--- 88,94 ----
  
  	if ($IDXONLY) {
! 	    $handle = \*STDOUT;
  	} else {
! 	    ($handle, $tmpfile) = file_temp('tidxXXXXXXXXXX', $OUTDIR);
  	}
  	print STDOUT "Writing $TIDXPATHNAME ...\n"  unless $QUIET;
***************
*** 181,185 ****
  	print $handle "<!-- ", &commentize("MHonArc v$VERSION"), " -->\n";
  
! 	close($handle)  unless $IDXONLY;
      }
  }
--- 181,189 ----
  	print $handle "<!-- ", &commentize("MHonArc v$VERSION"), " -->\n";
  
! 	if (!$IDXONLY) {
! 	    close($handle);
! 	    file_gzip($tmpfile)  if $GzipFiles;
! 	    file_chmod(file_rename($tmpfile, $TIDXPATHNAME));
! 	}
      }
  }

Index: mhusage.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhusage.pl,v
retrieving revision 2.19
retrieving revision 2.20
diff -C2 -r2.19 -r2.20
*** mhusage.pl	7 Jun 2002 17:45:09 -0000	2.19
--- mhusage.pl	20 Nov 2002 23:53:12 -0000	2.20
***************
*** 34,39 ****
      PAGERCHECK: {
  	if ($UNIX &&
! 	    (($ENV{'PAGER'} && open(PAGER, "| $ENV{'PAGER'}")) ||
! 	     (open(PAGER, "| more")))) {
  	    $usefh = \*PAGER;
  	    $close = 1;
--- 34,40 ----
      PAGERCHECK: {
  	if ($UNIX &&
! 		(-t STDOUT) &&
! 		(($ENV{'PAGER'} && open(PAGER, "| $ENV{'PAGER'}")) ||
! 		 (open(PAGER, '| more')))) {
  	    $usefh = \*PAGER;
  	    $close = 1;
***************
*** 60,63 ****
--- 61,67 ----
  
  Options:
+   Only command-line options are summarized here.  See documentation
+   for information about resource file elements and environment variables.
+ 
    -add                     : Add message(s) to archive
    -afs                     : Skip archive directory permission check
***************
*** 72,76 ****
    -definevar <varlist>     : Define custom resource variables
    -dbfile <name>           : Name of MHonArc database file
!                              (def: ".mhonarc.db")
    -doc                     : Print link to doc at end of index page
    -docurl <url>            : URL to MHonArc documentation
--- 76,81 ----
    -definevar <varlist>     : Define custom resource variables
    -dbfile <name>           : Name of MHonArc database file
!   -dbfileperms <octal>     : File permissions for database file
!                              (def: "0660")
    -doc                     : Print link to doc at end of index page
    -docurl <url>            : URL to MHonArc documentation
***************
*** 79,82 ****
--- 84,89 ----
    -expiredate <date>       : Message cut-off date
    -expireage <secs>        : Time from current when messages expire
+   -fileperms <octal>       : File permissions for archive files
+                              (def: "0666")
    -folrefs                 : Print links to follow-ups/references
    -force                   : Perform archive operations even if unable to lock

Index: osinit.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/osinit.pl,v
retrieving revision 2.6
retrieving revision 2.7
diff -C2 -r2.6 -r2.7
*** osinit.pl	17 Sep 2001 16:09:27 -0000	2.6
--- osinit.pl	20 Nov 2002 23:53:12 -0000	2.7
***************
*** 28,31 ****
--- 28,33 ----
  ##---------------------------------------------------------------------------##
  
+ use File::Basename;
+ 
  package mhonarc;
  
***************
*** 62,65 ****
--- 64,68 ----
  	$DIRSEP = '/';  $CURDIR = '.';
  	$PATHSEP = ':';
+ 	fileparse_set_fstype('VMS');
  
      } elsif (($^O !~ /cygwin/i) &&
***************
*** 73,76 ****
--- 76,80 ----
  	$DIRSEP = '\\';  $CURDIR = '.';
  	$PATHSEP = ';';
+ 	fileparse_set_fstype(($^O =~ /mswin/i) ? 'MSWin32' : 'MSDOS');
  
      } elsif (defined($MacPerl::Version)) {
***************
*** 78,81 ****
--- 82,86 ----
  	$DIRSEP = ':';  $CURDIR = ':';
  	$PATHSEP = ';';
+ 	fileparse_set_fstype('MacOS');
  
      } else {
***************
*** 83,86 ****
--- 88,92 ----
  	$DIRSEP = '/';  $CURDIR = '.';
  	$PATHSEP = ':';
+ 	fileparse_set_fstype('UNIX');
      }
  

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV