File smstools3.patch of Package smstools3
Index: smstools3/examples/smsd.conf.easy
===================================================================
--- smstools3.orig/examples/smsd.conf.easy
+++ smstools3/examples/smsd.conf.easy
@@ -2,7 +2,8 @@
devices = GSM1
logfile = /var/log/smsd.log
-loglevel = 7
+loglevel = 5
+umask = 027
[GSM1]
device = /dev/ttyS0
Index: smstools3/scripts/sendsms
===================================================================
--- smstools3.orig/scripts/sendsms
+++ smstools3/scripts/sendsms
@@ -18,7 +18,7 @@ KEYS=""
# When creating keys, remember to use -n for echo:
# echo -n "key" | md5sum
-smsd_user="smsd"
+SENDSMS_GROUP="sendsms"
# Will need echo which accepts -n argument:
ECHO=echo
@@ -32,24 +32,24 @@ if ! [ -z "$KEYS" ]; then
printf "Key: "
read KEY
if [ -z "$KEY" ]; then
- echo "Key required, stopping."
+ echo "Key required, stopping." 2>&1
exit 1
fi
KEY=`$ECHO -n "$KEY" | md5sum | awk '{print $1;}'`
if ! echo "$KEYS" | grep "$KEY" >/dev/null; then
- echo "Incorrect key, stopping."
+ echo "Incorrect key, stopping." 2>&1
exit 1
fi
fi
-DEST=$1
-TEXT=$2
+DEST="$1"
+TEXT="$2"
if [ -z "$DEST" ]; then
printf "Destination(s): "
read DEST
if [ -z "$DEST" ]; then
- echo "No destination, stopping."
+ echo "No destination, stopping." 2>&1
exit 1
fi
fi
@@ -58,21 +58,24 @@ if [ -z "$TEXT" ]; then
printf "Text: "
read TEXT
if [ -z "$TEXT" ]; then
- echo "No text, stopping."
+ echo "No text, stopping." 2>&1
exit 1
fi
fi
-if [ $# -gt 2 ]; then
+if [ $# -eq 3 -a X"$TEXT" = X-f ]; then
+ TEXT=`cat $3`
+ destinations="$DEST"
+elif [ $# -gt 2 ]; then
n=$#
while [ $n -gt 1 ]; do
destinations="$destinations $1"
shift
n=`expr $n - 1`
done
- TEXT=$1
+ TEXT="$1"
else
- destinations=$DEST
+ destinations="$DEST"
fi
echo "-- "
@@ -85,31 +88,23 @@ if which iconv > /dev/null 2>&1; then
fi
fi
-owner=""
-if [ -f /etc/passwd ]; then
- if grep $smsd_user: /etc/passwd >/dev/null; then
- owner=$smsd_user
- fi
-fi
-
for destination in $destinations
do
echo "To: $destination"
TMPFILE=`mktemp /tmp/smsd_XXXXXX`
- $ECHO "To: $destination" >> $TMPFILE
- [ -n "$ALPHABET" ] && $ECHO "$ALPHABET" >> $TMPFILE
- $ECHO "" >> $TMPFILE
+ $ECHO "To: $destination" >> "$TMPFILE"
+ [ -n "$ALPHABET" ] && $ECHO "$ALPHABET" >> "$TMPFILE"
+ $ECHO "" >> "$TMPFILE"
if [ -z "$ALPHABET" ]; then
- $ECHO -n "$TEXT" >> $TMPFILE
+ $ECHO -n "$TEXT" >> "$TMPFILE"
else
- $ECHO -n "$TEXT" | iconv -t UNICODEBIG >> $TMPFILE
+ $ECHO -n "$TEXT" | iconv -t UNICODEBIG >> "$TMPFILE"
fi
- if [ "x$owner" != x ]; then
- chown $owner $TMPFILE
- fi
+ chgrp $SENDSMS_GROUP "$TMPFILE"
+ chmod 640 "$TMPFILE"
FILE=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
mv $TMPFILE $FILE
Index: smstools3/src/Makefile
===================================================================
--- smstools3.orig/src/Makefile
+++ smstools3/src/Makefile
@@ -9,10 +9,10 @@ CFLAGS = -D NUMBER_OF_MODEMS=64
# CC=gcc
# Comment this out, to enable statistics
-CFLAGS += -D NOSTATS
+#CFLAGS += -D NOSTATS
# Comment this out if iconv is not available on the system
-#CFLAGS += -D USE_ICONV
+CFLAGS += -D USE_ICONV
# Uncomment this is iconv is used and it's not included in libc:
#LFLAGS += -liconv
Index: smstools3/src/smsd_cfg.c
===================================================================
--- smstools3.orig/src/smsd_cfg.c
+++ smstools3/src/smsd_cfg.c
@@ -819,7 +819,7 @@ int readcfg()
else
if (!strcasecmp(name, "umask"))
{
- conf_umask = (mode_t) strtol(ask_value(0, name, value), NULL, 0);
+ conf_umask = (mode_t) strtol(ask_value(0, name, value), NULL, 0) & 0777;
if (errno == EINVAL)
startuperror("Invalid value for umask: %s\n", value);
}