Hylafax Developers Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-devel] missing parts of security-patch.sh




Here are the parts of security-patch.sh that never made it into
the 4.1 code with some shell portability fixes.

*** hylafax/configure.old	Sat Jun 17 15:41:46 2000
--- hylafax/configure	Sat Jun 17 16:27:20 2000
***************
*** 186,191 ****
--- 186,193 ----
  MKFIFO
  MV
  MV_F
+ NOCLOBBER_OFF
+ NOCLOBBER_ON
  PAGESIZE
  PATHGETTY	PATH_GETTY
  PATHVGETTY	PATH_VGETTY
***************
*** 1291,1296 ****
--- 1293,1306 ----
      SCRIPT_SH=/bin/sh
  else
      Note "Using $SCRIPT_SH to process command scripts."
+ # Security stuff
+     case $SCRIPT_SH in
+ 	*/sh)	;;
+ 	*/ksh)	NOCLOBBER_ON='"set -o noclobber"'
+ 		NOCLOBBER_OFF='"set +o noclobber"' ;;
+ 	*/bash)	NOCLOBBER_ON='"set -o noclobber"'
+ 		NOCLOBBER_OFF='"set +o noclobber"' ;;
+     esac
  fi
  
  makeDefs()
*** hylafax/distrules.old	Sat Jun  3 16:21:46 2000
--- hylafax/distrules	Sat Jun 17 15:59:00 2000
***************
*** 75,81 ****
      html/setup-advanced.html			\
      html/setup-client.html			\
      html/source.html				\
-     html/survey.html				\
      html/toc.html				\
      html/troubleshooting.html			\
      html/upgrade4.0.html			\
--- 75,80 ----
***************
*** 120,127 ****
      html/install-source.html			\
      html/modems.html				\
      html/namechange.html			\
-     html/survey-help.html			\
-     html/survey-query.html			\
      html/version.html				\
      html/ftpmail-help.html			\
      html/v2.3beta036special.html		\
--- 119,124 ----
***************
*** 157,163 ****
      html/tools/man2html.c			\
      html/tools/unquote.c			\
      html/tools/manpage.sh.in			\
-     html/tools/faxsurvey.sh.in			\
      ${NULL}
  #
  # Files that are makeup the HylaFAX
--- 154,159 ----
*** hylafax/etc/faxaddmodem.sh.in.old	Sat Jun  3 16:21:50 2000
--- hylafax/etc/faxaddmodem.sh.in	Sat Jun 17 15:59:07 2000
***************
*** 85,93 ****
      exit 1
  fi
  
  SH=$SCRIPT_SH			# shell for use below
  CPATH=$SPOOL/etc/config		# prefix of configuration file
! OUT=/tmp/addmodem$$		# temp file in which modem output is recorded
  SVR4UULCKN=$LIBEXEC/lockname	# SVR4 UUCP lock name construction program
  ONDELAY=$LIBEXEC/ondelay	# prgm to open devices blocking on carrier
  CAT="$CAT -u"			# something to do unbuffered reads and writes
--- 85,99 ----
      exit 1
  fi
  
+ # security
+ TMPDIR=/tmp/.faxaddmodem$$
+ umask 077
+ rm -rf $TMPDIR
+ mkdir $TMPDIR || exit 1
+ 
  SH=$SCRIPT_SH			# shell for use below
  CPATH=$SPOOL/etc/config		# prefix of configuration file
! OUT=$TMPDIR/addmodem$$         # temp file in which modem output is recorded
  SVR4UULCKN=$LIBEXEC/lockname	# SVR4 UUCP lock name construction program
  ONDELAY=$LIBEXEC/ondelay	# prgm to open devices blocking on carrier
  CAT="$CAT -u"			# something to do unbuffered reads and writes
***************
*** 219,225 ****
  done
  
  JUNK="$OUT"
! trap "$RMCMD \$JUNK; exit 1" 0 1 2 15
  
  if [ ! -d $UUCP_LOCKDIR ]; then
      cat<<EOF
--- 225,231 ----
  done
  
  JUNK="$OUT"
! trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; exit 1" 0 1 2 15
  
  if [ ! -d $UUCP_LOCKDIR ]; then
      cat<<EOF
***************
*** 656,662 ****
  # Prompt user for server-related configuration parameters
  # and do consistency checking on what we get.
  #
! PROMPTS=/tmp/faxpr$$
  JUNK="$JUNK $PROMPTS"
  while isNotOK $ok; do
      if [ "$ok" != skip ]; then
--- 662,668 ----
  # Prompt user for server-related configuration parameters
  # and do consistency checking on what we get.
  #
! PROMPTS=$TMPDIR/faxpr$$
  JUNK="$JUNK $PROMPTS"
  while isNotOK $ok; do
      if [ "$ok" != skip ]; then
***************
*** 835,846 ****
  	echo ""
  	echo "Hmm, something seems to be hung, check your modem eh?"
       done)& nagpid=$!
!     trap "$RMCMD \$JUNK; kill $nagpid \$catpid; exit 1" 0 1 2 15
! 
      SendToModem "AT+FCLASS=?" 			# ask for class support
  
      kill $nagpid
!     trap "$RMCMD \$JUNK; test \"\$catpid\" && kill \$catpid; exit 1" 0 1 2 15
      sleep 1
  
      RESULT=`tr -ds '\015' '\012' < $OUT | tail -1`
--- 841,851 ----
  	echo ""
  	echo "Hmm, something seems to be hung, check your modem eh?"
       done)& nagpid=$!
!     trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; kill $nagpid \$catpid; exit 1" 0 1 2 15
      SendToModem "AT+FCLASS=?" 			# ask for class support
  
      kill $nagpid
!     trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; test \"\$catpid\" && kill \$catpid; exit 1" 0 1 2 15
      sleep 1
  
      RESULT=`tr -ds '\015' '\012' < $OUT | tail -1`
***************
*** 1705,1711 ****
      prompt "Are these ok [yes]?"; read ok
  done
  verifyModemRate
! TMPSED=/tmp/faxsed$$; JUNK="$JUNK $TMPSED"
  (echoServerSedCommands; echoModemSedCommands)>$TMPSED
  
  #
--- 1710,1716 ----
      prompt "Are these ok [yes]?"; read ok
  done
  verifyModemRate
! TMPSED=$TMPDIR/faxsed$$; JUNK="$JUNK $TMPSED"
  (echoServerSedCommands; echoModemSedCommands)>$TMPSED
  
  #
*** hylafax/etc/faxsetup.sh.in.old	Sat Jun  3 16:21:54 2000
--- hylafax/etc/faxsetup.sh.in	Sat Jun 17 15:59:13 2000
***************
*** 1967,1977 ****
  
  	PROMPTS=/tmp/faxpr$$
  	JUNK="$JUNK $PROMPTS"
! 	$RM $PROMPTS
  
  	while true; do
  	    if [ "$ok" != skip ]; then
! 		test -f $PROMPTS || compilePrompts>$PROMPTS<<EOF
  #	CountryCode		Country code
  #	AreaCode		Area code
  #	LongDistancePrefix	Long distance dialing prefix
--- 1967,1981 ----
  
  	PROMPTS=/tmp/faxpr$$
  	JUNK="$JUNK $PROMPTS"
! 	$RM -rf $PROMPTS
  
  	while true; do
  	    if [ "$ok" != skip ]; then
! 		test -f $PROMPTS || (
! 		${NOCLOBBER_ON}
! 		> $PROMPTS || exit 1
! 		${NOCLOBBER_OFF}
! 		compilePrompts>$PROMPTS<<EOF
  #	CountryCode		Country code
  #	AreaCode		Area code
  #	LongDistancePrefix	Long distance dialing prefix
*** hylafax/etc/probemodem.sh.in.old	Mon Oct 12 13:47:48 1998
--- hylafax/etc/probemodem.sh.in	Sat Jun 17 15:59:16 2000
***************
*** 34,39 ****
--- 34,42 ----
  # DATE:		@DATE@
  # TARGET:	@TARGET@
  #
+ # security
+ NOCLOBBER_ON=@NOCLOBBER_ON@
+ NOCLOBBER_OFF=@NOCLOBBER_OFF@
  
  #
  # probemodem [tty]
***************
*** 76,81 ****
--- 79,90 ----
  SVR4UULCKN=$LIBEXEC/lockname	# SVR4 UUCP lock name construction program
  ONDELAY=$LIBEXEC/ondelay	# prgm to open devices blocking on carrier
  CAT="$CAT -u"			# something to do unbuffered reads and writes
+ 
+ # security
+ rm -rf $OUT
+ ${NOCLOBBER_ON}
+ > $OUT || exit 1
+ ${NOCLOBBER_OFF}
  
  while [ -z "$TTY" -o ! -c /dev/$TTY ]; do
      if [ "$TTY" != "" ]; then
*** hylafax/util/faxcron.sh.in.old	Fri Jun  2 16:54:48 2000
--- hylafax/util/faxcron.sh.in	Sat Jun 17 16:06:54 2000
***************
*** 68,76 ****
  TEE=tee
  UPDATE="date +'%D %H:%M' >$LAST"
  
! JUNK=/tmp/faxjunk$$		# temp file used multiple times
! AWKTMP=/tmp/faxawk$$		# temp file for awk program
  
  while [ x"$1" != x"" ] ; do
      case $1 in
      -n)	    RM=":" TEE=":" CP=":" MV=":" CHOWN=":" CHMOD=":" UPDATE=":";;
--- 68,81 ----
  TEE=tee
  UPDATE="date +'%D %H:%M' >$LAST"
  
! # security
! TMPDIR=/tmp/.faxcron.sh$$
! rm -rf $TMPDIR
! mkdir $TMPDIR || exit 1
  
+ JUNK=$TMPDIR/faxjunk$$         # temp file used multiple times
+ AWKTMP=$TMPDIR/faxawk$$                # temp file for awk program
+ 
  while [ x"$1" != x"" ] ; do
      case $1 in
      -n)	    RM=":" TEE=":" CP=":" MV=":" CHOWN=":" CHMOD=":" UPDATE=":";;
***************
*** 85,91 ****
      shift
  done
  
! trap "$RM \$AWKTMP \$JUNK; exit 1" 0 1 2 15
  
  
  test -z "$LASTRUN" && LASTRUN=`$CAT $LAST 2>/dev/null`
--- 90,96 ----
      shift
  done
  
! trap "$RM \$AWKTMP \$JUNK; $RM -rf $TMPDIR; exit 1" 0 1 2 15
  
  
  test -z "$LASTRUN" && LASTRUN=`$CAT $LAST 2>/dev/null`
***************
*** 280,286 ****
  EOF
  $AWK -f $AWKTMP -v LASTRUN="$LASTRUN" TRANSCRIPT="\
      LOGFILE=log/%s;\
!     TMP=/tmp/faxlog\$\$;\
      if [ -f \$LOGFILE ]; then\
  	$SED -n -e '/%s %s %s.*SESSION BEGIN/,/SESSION END/p' \$LOGFILE |\
  	$SED -e '/start.*timer/d'\
--- 285,291 ----
  EOF
  $AWK -f $AWKTMP -v LASTRUN="$LASTRUN" TRANSCRIPT="\
      LOGFILE=log/%s;\
!     TMP=$TMPDIR/faxlog\$\$;\
      if [ -f \$LOGFILE ]; then\
  	$SED -n -e '/%s %s %s.*SESSION BEGIN/,/SESSION END/p' \$LOGFILE |\
  	$SED -e '/start.*timer/d'\
*** hylafax/util/recvstats.sh.in.old	Wed Apr  5 19:00:58 2000
--- hylafax/util/recvstats.sh.in	Sat Jun 17 16:13:41 2000
***************
*** 26,31 ****
--- 26,34 ----
  # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  # OF THIS SOFTWARE.
  #
+ # security
+ NOCLOBBER_ON=@NOCLOBBER_ON@
+ NOCLOBBER_OFF=@NOCLOBBER_OFF@
  
  #
  # Print Statistics about Received Facsimile.
***************
*** 119,124 ****
--- 122,133 ----
  #
  tmpAwk=/tmp/xferfax$$
  trap "rm -f $tmpAwk; exit 1" 0 1 2 15
+ 
+ # security
+ rm -rf $tmpAwk
+ ${NOCLOBBER_ON}
+ > $tmpAwk || exit 1
+ ${NOCLOBBER_OFF}
  
  ($CAT<<'EOF'
  #


-- 
Tim Rice				Multitalents	(707) 874-1130
tim@trr.metro.net




Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services