#!/bin/sh
#SYSTEMS: Solaris, Linux
MSG="# Checking that the /tmp and /var/tmp directories have the sticky bit set..."
SYSTEM=`uname -s`
######Solaris######
if [ "$SYSTEM" = "SunOS" ]; then
  case "`uname -r`" in
    5.[6789]*) ;;
    *)
      #Only supported on Solaris 2.6 and newer
      exit 0;;
  esac
fi
######Common######
echo ""; echo "$MSG"
STICKY1=`ls -ld /tmp | cut -c10`
STICKY2=`ls -ld /var/tmp | cut -c10`
if [ $STICKY1 != "t" ]; then
  echo "--WARN-- [TMP001w] The /tmp directory does NOT have the sticky-bit set."
fi
if [ $STICKY2 != "t" ]; then
  echo "--WARN-- [TMP001w] The /var/tmp directory does NOT have the sticky-bit set."
fi