aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UPDATING11
-rw-r--r--comms/smstools3/Makefile29
-rw-r--r--comms/smstools3/files/patch-src-Makefile20
-rw-r--r--comms/smstools3/files/smsd.in31
-rw-r--r--comms/smstools3/pkg-plist5
5 files changed, 72 insertions, 24 deletions
diff --git a/UPDATING b/UPDATING
index 297fb4bdbb72..81f9c40a33e9 100644
--- a/UPDATING
+++ b/UPDATING
@@ -6,6 +6,17 @@ You should get into the habit of checking this file for changes each
time you update your ports collection, before attempting any port
upgrades.
+20081121:
+ AFFECTS: users of comms/smstools3
+ AUTHOR: mm@FreeBSD.org
+
+ The startup script of comms/smstools3 has changed. For increased security
+ smstools now runs as user uucp / group dialer by default. The script
+ commands like sendsms etc. should be executed as user uucp.
+ To restore the old behaviour, set smsd_user="root" and smsd_group="wheel"
+ in your /etc/rc.conf.
+ Hint: use security/sudo for running smsd scripts as user uucp
+
20081108:
AFFECTS: users of editors/tamago
AUTHOR: hrs@FreeBSD.org
diff --git a/comms/smstools3/Makefile b/comms/smstools3/Makefile
index 4ae0f07e3f60..466657082c84 100644
--- a/comms/smstools3/Makefile
+++ b/comms/smstools3/Makefile
@@ -7,6 +7,7 @@
PORTNAME= smstools
PORTVERSION= 3.1.3
+PORTREVISION= 1
CATEGORIES= comms
MASTER_SITES= http://smstools3.kekekasvi.com/packages/
DISTNAME= smstools3-${PORTVERSION}
@@ -14,16 +15,21 @@ DISTNAME= smstools3-${PORTVERSION}
MAINTAINER= mm@FreeBSD.org
COMMENT= SMS Gateway software for GSM modems and mobile phones
-LIB_DEPENDS= mm:${PORTSDIR}/devel/mm
-
CONFLICTS= gnokii-[0-9]* smstools-2.* sendsms-[0-9]*
+OPTIONS= STATS "Build status and statistics support" on
WRKSRC= ${WRKDIR}/smstools3
USE_GMAKE= yes
USE_RC_SUBR= smsd
SPOOLDIR?= /var/spool/sms
-PLIST_SUB+= PREFIX="${PREFIX}" \
- SPOOLDIR="${SPOOLDIR}"
+LOGDIR?= /var/log/smsd
+PIDDIR?= /var/run/smsd
+SMSD_USER?= uucp
+SMSD_GROUP?= dialer
+SUB_LIST+= SPOOLDIR="${SPOOLDIR}" LOGDIR="${LOGDIR}" PIDDIR="${PIDDIR}" \
+ SMSD_USER="${SMSD_USER}" SMSD_GROUP="${SMSD_GROUP}"
+PLIST_SUB+= SPOOLDIR="${SPOOLDIR}" LOGDIR="${LOGDIR}" PIDDIR="${PIDDIR}" \
+ SMSD_USER="${SMSD_USER}" SMSD_GROUP="${SMSD_GROUP}"
DOCS= alarmhandler.html blacklist.html book.html compiling.html \
configure.html configure2.html costs.html eventhandler.html \
@@ -50,6 +56,15 @@ SCRIPTS= checkhandler-utf-8 email2sms eventhandler-utf-8 forwardsms \
sms2unicode sms2xml sms3 smsevent smsresend smstest.php \
sql_demo unicode2sms
+.include <bsd.port.pre.mk>
+
+.if !defined(WITHOUT_STATS)
+LIB_DEPENDS+= mm.14:${PORTSDIR}/devel/mm
+CFLAGS+= -I${LOCALBASE}/include
+.else
+CFLAGS+= -D NOSTATS
+.endif
+
post-patch:
@${REINPLACE_CMD} 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/install.sh \
${WRKSRC}/src/smsd_cfg.c
@@ -62,12 +77,14 @@ post-install:
@${MKDIR} ${DATADIR}
@${INSTALL_SCRIPT} ${SCRIPTS:S,^,${WRKSRC}/scripts/,} ${DATADIR}
.for FILE in sendsms sms2html sms2unicode unicode2sms
- @${LN} -s ${DATADIR}/${FILE} ${PREFIX}/bin/${FILE}
+ @${LN} -sf ${DATADIR}/${FILE} ${PREFIX}/bin/${FILE}
.endfor
@${INSTALL_DATA} ${WRKSRC}/examples/smsd.conf.easy ${PREFIX}/etc/smsd.conf.sample
@if [ ! -f ${PREFIX}/etc/smsd.conf ]; then \
${CP} ${PREFIX}/etc/smsd.conf.sample ${PREFIX}/etc/smsd.conf; \
fi
+ @${MKDIR} ${SPOOLDIR} ${LOGDIR} ${PIDDIR}
+ @${CHOWN} -R ${SMSD_USER}:${SMSD_GROUP} ${SPOOLDIR} ${LOGDIR} ${PIDDIR}
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}/slideshow
@${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/doc/,} ${DOCSDIR}/
@@ -78,4 +95,4 @@ post-install:
@${MKDIR} ${EXAMPLESDIR}
@${INSTALL_DATA} ${EXAMPLES:S,^,${WRKSRC}/examples/,} ${EXAMPLESDIR}/
.endif
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/comms/smstools3/files/patch-src-Makefile b/comms/smstools3/files/patch-src-Makefile
new file mode 100644
index 000000000000..6f6d7ab1fd2f
--- /dev/null
+++ b/comms/smstools3/files/patch-src-Makefile
@@ -0,0 +1,20 @@
+--- src/Makefile.orig 2008-11-21 11:41:21.000000000 +0100
++++ src/Makefile 2008-11-21 11:42:39.000000000 +0100
+@@ -6,7 +6,7 @@
+ # CC=gcc
+
+ # Comment this out, to enable statistics
+-CFLAGS += -D NOSTATS
++#CFLAGS += -D NOSTATS
+
+ # Uncomment this to force smsd to run in terminal mode
+ #CFLAGS += -D TERMINAL
+@@ -24,7 +24,7 @@
+ ifneq (,$(findstring NOSTATS,$(CFLAGS)))
+ $(CC) $(CFLAGS) -o $@ $^
+ else
+- $(CC) `mm-config --cflags` $(CFLAGS) -o $@ $^ `mm-config --ldflags --libs`
++ $(CC) `$(LOCALBASE)/bin/mm-config --cflags` $(CFLAGS) -o $@ $^ `$(LOCALBASE)/bin/mm-config --ldflags --libs`
+ @echo "(Please ignore warning about tempnam -- it is used in a safe way)"
+ endif
+
diff --git a/comms/smstools3/files/smsd.in b/comms/smstools3/files/smsd.in
index 2dec3b9ad417..b1d7d1fcda02 100644
--- a/comms/smstools3/files/smsd.in
+++ b/comms/smstools3/files/smsd.in
@@ -10,25 +10,22 @@
#
# smsd_enable="YES"
#
-smsd_enable=${smsd_enable-"NO"}
-
-. %%RC_SUBR%%
+. "%%RC_SUBR%%"
name="smsd"
+
+load_rc_config ${name}
+: ${smsd_enable="NO"}
+: ${smsd_pidfile="%%PIDDIR%%/smsd.pid"}
+: ${smsd_infofile="%%PIDDIR%%/smsd.working"}
+: ${smsd_logfile="%%LOGDIR%%/smsd.log"}
+: ${smsd_config="%%PREFIX%%/etc/smsd.conf"}
+: ${smsd_user="uucp"}
+: ${smsd_group="dialer"}
+
rcvar=`set_rcvar`
-load_rc_config $name
-pidfile="/var/run/smsd.pid"
+pidfile=${smsd_pidfile}
command="%%PREFIX%%/bin/smsd"
-command_args='&'
-
-# Unfortunally we need to this because as the program won't
-# exit cleanly and the terminal will be stuck forever in waitpid.
-case "$1" in
- stop)
- pkill smsd
- ;;
- *)
- run_rc_command "$1"
- ;;
-esac
+command_args="-c${smsd_config} -p${smsd_pidfile} -i${smsd_infofile} -l${smsd_logfile} -u${smsd_user} -g${smsd_group}"
+run_rc_command "$1"
diff --git a/comms/smstools3/pkg-plist b/comms/smstools3/pkg-plist
index a262edf2f671..3d625b57211f 100644
--- a/comms/smstools3/pkg-plist
+++ b/comms/smstools3/pkg-plist
@@ -91,8 +91,11 @@ etc/smsd.conf.sample
%%PORTDOCS%%@dirrm %%DATADIR%%
%%PORTDOCS%%@dirrm %%DOCSDIR%%/slideshow
%%PORTDOCS%%@dirrm %%DOCSDIR%%
-@exec mkdir -p %%SPOOLDIR%%/incoming %%SPOOLDIR%%/outgoing %%SPOOLDIR%%/checked
+@exec mkdir -p %%SPOOLDIR%%/incoming %%SPOOLDIR%%/outgoing %%SPOOLDIR%%/checked %%LOGDIR%% %%PIDDIR%%
+@exec chown -R %%SMSD_USER%%:%%SMSD_GROUP%% %%SPOOLDIR%% %%LOGDIR%% %%PIDDIR%%
@unexec echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
@unexec echo "If you are permanently removing smstools, you should also:" | /usr/bin/fmt
@unexec echo "'rm -rf %%SPOOLDIR%%'" | /usr/bin/fmt
+@unexec echo "'rm -rf %%LOGDIR%%'" | /usr/bin/fmt
+@unexec echo "'rm -rf %%PIDDIR%%'" | /usr/bin/fmt
@unexec echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="