/usr/lib/news/control/rmgroup is in inn 1:1.7.2q-41build1.
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 | #! /bin/bash
## $Revision: 1.22 $
## Rmgroup control-message handler
PROG=rmgroup
## Some shells don't pass in $* unless we explicitly pass it in here.
## =()<. @<_PATH_PARSECTL>@ "$@">()=
. /usr/lib/news/bin/parsecontrol "$@"
# Fix up the group name so grep matches exactly.
GROUPNAME=`echo $1 | sed 's/\./\\./g'`
grep "^$GROUPNAME " ${ACTIVE} >/dev/null 2>&1 || {
# Group doesn't exist
exit
}
case ${ACTION} in
mail)
P1=$1
export FROM P1 NEWSBIN ARTICLE
(
echo "${FROM} requested that ${P1} be removed."
echo 'To do this, type the following:'
echo " ${NEWSBIN}/ctlinnd rmgroup "'"'${P1}'"'
echo ''
echo 'The full article was:'
sed -e 's/^~/~~/' ${ARTICLE}
) | ${MAILCMD} -s "rmgroup $1 by ${FROM}" ${NEWSMASTER}
exit
;;
esac
## Make sure the article is approved and that the group exists.
${SED} -e '/^$/q' <$ARTICLE >${TEMP}
grep '^Approved:' <${TEMP} >/dev/null 2>&1 || {
${WRITELOG} ${LOGFILE} "Unapproved rmgroup by ${FROM}" <${ARTICLE}
rm -f ${TEMP}
exit
}
rm -f ${TEMP}
grep "^$GROUPNAME " ${ACTIVE} >/dev/null 2>&1 || {
# Group doesn't exist
exit
}
case ${ACTION} in
logit)
${WRITELOG} ${LOGFILE} "rmgroup $1 by ${FROM} skipped" <${ARTICLE}
exit
;;
esac
## Do the work.
ctlinnd -s rmgroup "$1"
${WRITELOG} ${LOGFILE} "rmgroup $1 by ${FROM}" <${ARTICLE}
## We're sending to a file.
LOCK=${LOCKS}/LOCK.newsgroups
PID=$$
TRY=0
MAXTRY=60
export LOCK MAXTRY PID LOGFILE TRY
while [ ${TRY} -lt ${MAXTRY} ]; do
shlock -p ${PID} -f ${LOCK} && break
sleep 2
TRY=`expr ${TRY} + 1`
done
## If we got the lock, update the file; otherwise, give up.
test ${TRY} -lt ${MAXTRY} || {
echo "Newgroup cannot update newsgroups. Locked by" `cat ${LOCK}` 1>&2
exit
}
${EGREP} -v "^$GROUPNAME[ ]" <${NEWSGROUPS} >${TEMP}
cat ${TEMP} >${NEWSGROUPS}
rm ${TEMP} ${LOCK}
exit
|