/usr/bin/sfconf is in sendfile 2.1b.20080616-5.3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | #!/bin/sh
# File: sfconf
#
# Author: Ulli Horlacher (framstag@rus.uni-stuttgart.de)
#
# History:
#
# 1997-11-22 Framstag initial version
# 1997-11-23 Framstag substituted "-" with "_" in all identifiers
# 1998-01-10 Framstag added option -m
# 1998-03-15 Framstag look for spool and configdir in $HOME
# 1998-07-11 Framstag added notify program support
# 2005-05-30 Framstag better USER detection
#
# The configuration helper program for the sendfile package.
#
# Copyright © 1997-2005 Ulli Horlacher
# This file is covered by the GNU General Public License
if [ "$LOGNAME" ]; then
USER=$LOGNAME
else
USER=`id | sed 's/[()]/ /g' | awk '{print $2}'`
fi
SPOOL=$HOME/.sfspool
test -d $SPOOL || SPOOL=/var/spool/sendfile/$USER
CONFIG=$HOME/.sendfile
EDITOR=${EDITOR:=vi}
PAGER=${PAGER:=more}
PRG=`basename $0`
TMP=$CONFIG/$$.tmp
FILE=
if [ ! -d $CONFIG ]; then
if [ -d $SPOOL/config ]; then
ln -s $SPOOL/config $CONFIG
else
mkdir $CONFIG
fi
fi
usage() {
echo "$PRG is the sendfile user configuration helper"
echo "usage: $PRG OPTION ARGUMENT"
echo "options: -l -- list"
echo " -e -- edit"
echo " -i -- initialize (= edit with default values)"
echo " -m -- message receiving"
echo "arguments for options -l -e -i :"
echo " config -- user configuration file"
echo " aliases -- user alias file"
echo " filter -- user restrictions file"
echo " notify -- notify program for file receiving"
echo "arguments for option -l :"
echo " log -- sendfile log file"
echo " msglog -- sendmsg log file"
echo "arguments for option -m :"
echo " all -- messages can be written on all ttys"
echo " here -- messages can be written only on this tty"
echo "examples:"
echo " $PRG -l aliases # list the aliases file"
echo " $PRG -m here # messages will be written only on this tty"
exit
}
testfile() {
if [ ! -f "$1" ]; then
echo "%$PRG-Error: $1 does not exist" >&2
exit 1
fi
if [ ! -r "$1" ]; then
echo "%$PRG-Error: $1 is not readable by you" >&2
exit 1
fi
}
init_append() {
if [ -r $FILE ]; then
cat <<EOD>> $TMP
## The next lines are from your old `basename $FILE` file.
## You may want to delete them (if they are garbage).
EOD
cat $FILE >> $TMP
fi
mv $TMP $FILE
}
init_aliases() {
cat <<EOD> $TMP
## This is the user aliases file for sendfile/sendmsg.
## The syntax is: ALIAS ADDRESS, example:
frams framstag@bofh.belwue.de
EOD
init_append
}
init_config() {
cat <<EOD> $TMP
## This is the user configuration file for sendfile/sendmsg.
## Text after a # is a comment and will be ignored.
# ring the gong when a message arrives (on/off)
bell = on
# allow remote sender to delete his files afterwards (on/off)
deleting = on
# logging of incoming messages in the user log file (on/off)
msglog = off
# Notification by message, mail, both or none when a file arrives.
# You may specify a second argument as a recipients address.
# Extra: when you specify "notification = program" then the notify-program
# in your sendfile configuration directory will be executed.
# Type "sfconf -i notify" for an example.
# notification = mail tome@somewhere.inthe.net
# notification = program
notification = message
# enforce secure incoming transfer with pgp (sign/encrypt/both/none)
forcepgp = none
# forward incoming files to another SAFT address
# forward = tome@on.another.org
# if you have an O-SAFT account, specify it here
# (the fetchfile client will use it)
# o-saft = othername@saft.banana.net
# default compression methode (none/gzip/bzip2)
defaultcompress = gzip
EOD
init_append
}
init_restrictions() {
cat <<EOD> $TMP
## This is the user restrictions file for sendfile/sendmsg.
## It contains addresses from where you don't want messages or files.
## The format is: user@host [mfb]
## m stands for messages, f for files and b for both.
## Wildcards * and ? are allowed. Examples:
## bgates@microsoft.com b
## *aol.com m
## Text after a # is a comment, like these first lines.
EOD
init_append
}
init_notify() {
cat <<EOD> $TMP
#!/bin/sh
# This program will be called whenever someone has sent you some files AND
# when you have set the option "notification = program" with "sfconf -e config".
#
# The shell-argument \$1 contains the name of the sender,
# in \$2..\$n are the spool file numbers.
# This here is just an example what you can do!
from=\$1; shift
n=\`echo \$* | wc -w\`
sendmsg -f -s "\$n new file(s) from \$from!" \$USER
exit
EOD
chmod 700 $TMP
init_append
}
#args=`getopt h?lei $*` || usage
#set -- x $args
#while shift; do
# case $1 in
# -\?|-h) usage;;
# -l) list=true;;
# -e) edit=true;;
# -i) init=true;;
# --) shift; break;;
# esac
#done
case "$1" in
-l) list=true;;
-e) edit=true;;
-i) init=true;;
-m) msg=true;;
*) usage;;
esac
if [ "$msg" = true ]; then
case "$2" in
a|all) sendmsg -M;;
h|here|t|this) sendmsg -m;;
*) usage;;
esac
exit;
fi
case "$2" in
a|alias|aliases) FILE=$CONFIG/aliases;;
c|conf|config) FILE=$CONFIG/config;;
f|filter|r|restrictions) FILE=$CONFIG/restrictions;;
n|notify) FILE=$CONFIG/notify
if [ $USER = root ]; then
echo "%$PRG-Error: for security reasons, root is not allowed to use a notify program" >&2
exit 1
fi;;
l|log) log=true; FILE=$SPOOL/log;;
m|msg|msglog) log=true; FILE=$SPOOL/msglog;;
*) usage;;
esac
if [ "$log" = true ]; then
if [ "$edit" = true ]; then usage; fi
testfile $FILE
awk '{if (NR>1 || $1!="#") print $0}' $FILE | utf7decode | $PAGER
exit $?
fi
if [ "$list" = true ]; then
testfile $FILE
$PAGER $FILE
exit $?
fi
if [ "$edit" = true ]; then
if [ -f $FILE ]; then
$EDITOR $FILE
exit $?
else
echo "%$PRG-Error: $FILE does not exist" >&2
echo "%$PRG-Info: you can create it with: $PRG -i $2" >&2
exit 1
fi
fi
if [ "$init" = true ]; then
trap "rm -f $TMP;exit" 1 2 3 15
case $FILE in
*aliases) init_aliases;;
*config) init_config;;
*restrictions) init_restrictions;;
*notify) init_notify;;
esac
$EDITOR $FILE
exit $?
fi
|