mirror of
https://github.com/samba-team/samba.git
synced 2025-09-14 21:44:19 +03:00
r397: BUG 1199: check logfile before writing debug output
(This used to be commit 52df0905cd
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
ce55cf1b82
commit
b8f32d608f
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# This script is an input filter for printcap printing on a unix machine. It
|
# This script is an input filter for printcap printing on a unix machine. It
|
||||||
# uses the smbclient program to print the file to the specified smb-based
|
# uses the smbclient program to print the file to the specified smb-based
|
||||||
@@ -102,7 +102,33 @@ if [ $TRANS -eq 1 ]; then
|
|||||||
command="translate;$command";
|
command="translate;$command";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debugfile="/tmp/smb-print.log"
|
##
|
||||||
|
## Some security checks on the logfile if we are using it
|
||||||
|
##
|
||||||
|
## make the directory containing the logfile is necessary
|
||||||
|
## and set the permissions to be rwx for owner only
|
||||||
|
##
|
||||||
|
|
||||||
|
debugfile="/tmp/smb-print/logfile"
|
||||||
|
logdir=`dirname $debugfile`
|
||||||
|
if [ ! -d $logdir ]; then
|
||||||
|
mkdir -m 0700 $logdir
|
||||||
|
fi
|
||||||
|
|
||||||
|
##
|
||||||
|
## check ownership. If I don't own it refuse to
|
||||||
|
## create the logfile
|
||||||
|
##
|
||||||
|
if [ ! -O $logdir ]; then
|
||||||
|
echo "user running script does not own $logdir. Ignoring any debug options."
|
||||||
|
debug=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
##
|
||||||
|
## We should be safe at this point to create the log file
|
||||||
|
## without fear of a symlink attack -- move on to more script work.
|
||||||
|
##
|
||||||
|
|
||||||
if [ "x$debug" = "x" ] ; then
|
if [ "x$debug" = "x" ] ; then
|
||||||
debugfile=/dev/null debugargs=
|
debugfile=/dev/null debugargs=
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user